Skip to content

Commit

Permalink
append MASON_STDLIB_VERSION to binary if MASON_CXX_PACKAGE == true
Browse files Browse the repository at this point in the history
respect CXX env var

add script to print c++ stdlib version

include <string> instead of <ciso646> because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65473
  • Loading branch information
mikemorris committed Oct 1, 2015
1 parent 36dc928 commit 3c627cb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*-*/
*-*/
stdlib.o
10 changes: 8 additions & 2 deletions mason.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ case ${MASON_ROOT} in
*\ * ) mason_error "Directory '${MASON_ROOT} contains spaces."; exit ;;
esac

export MASON_STDLIB_VERSION="-"`${CXX:-c++} ${MASON_DIR}/stdlib.cpp -o ${MASON_DIR}/stdlib.o && ${MASON_DIR}/stdlib.o`

if [ ${MASON_PLATFORM} = 'osx' ]; then
export MASON_HOST_ARG="--host=x86_64-apple-darwin"
export MASON_PLATFORM_VERSION=`xcrun --sdk macosx --show-sdk-version`
Expand Down Expand Up @@ -86,7 +88,6 @@ elif [ ${MASON_PLATFORM} = 'ios' ]; then
export MASON_ISIM_CFLAGS="${MIN_SDK_VERSION_FLAG} -isysroot ${MASON_SDK_PATH} -arch i386 -arch x86_64"

elif [ ${MASON_PLATFORM} = 'linux' ]; then

export MASON_DYNLIB_SUFFIX="so"

# Assume current system is the target platform
Expand Down Expand Up @@ -243,7 +244,12 @@ else
MASON_PLATFORM_ID=${MASON_PLATFORM}-${MASON_PLATFORM_VERSION}
fi
MASON_PREFIX=${MASON_ROOT}/${MASON_PLATFORM_ID}/${MASON_NAME}/${MASON_VERSION}
MASON_BINARIES=${MASON_PLATFORM_ID}/${MASON_NAME}/${MASON_VERSION}.tar.gz
MASON_BINARIES_PREFIX=${MASON_PLATFORM_ID}/${MASON_NAME}/${MASON_VERSION}
if [[ ${MASON_CXX_PACKAGE} == true ]]; then
MASON_BINARIES=${MASON_BINARIES_PREFIX}${MASON_STDLIB_VERSION}.tar.gz
else
MASON_BINARIES=${MASON_BINARIES_PREFIX}.tar.gz
fi
MASON_BINARIES_PATH=${MASON_ROOT}/.binaries/${MASON_BINARIES}


Expand Down
16 changes: 16 additions & 0 deletions stdlib.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <string>

#include <stdio.h>
#include <stdlib.h>

#define PRINT(name, version) printf("%s-%d\n", name, version);

int main(int argc, char *argv[]) {
#ifdef _LIBCPP_VERSION
PRINT("libc++", _LIBCPP_ABI_VERSION)
#elif __GLIBCXX__
PRINT("libstdc++", __GLIBCXX__)
#endif

exit(EXIT_SUCCESS);
}

0 comments on commit 3c627cb

Please sign in to comment.