From dad60566b709110a3c27cf28f21c42ffd075c1f2 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Sequoia Date: Thu, 28 Dec 2017 22:42:49 -0800 Subject: [PATCH 3004/3008] Revert "Remove the buildit and testit scripts; they haven't been supported in years" This reverts commit a075831614abc819566eba3576f9c1e13c6face8. --- lib/buildit | 189 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/testit | 183 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 372 insertions(+) create mode 100755 lib/buildit create mode 100755 test/testit diff --git libcxx-5.0.1.src/lib/buildit libcxx-5.0.1.src/lib/buildit new file mode 100755 index 000000000..c18de042e --- /dev/null +++ libcxx-5.0.1.src/lib/buildit @@ -0,0 +1,189 @@ +#! /bin/sh +# +# Set the $TRIPLE environment variable to your system's triple before +# running this script. If you set $CXX, that will be used to compile +# the library. Otherwise we'll use clang++. + +set -e + +echo "---------- WARNING ----------" +echo "buildit is no longer supported and will be removed in the next week!" +echo "please contact the libc++ maintainers if you have any concerns" +echo "" + +if [ `basename $(pwd)` != "lib" ] +then + echo "current directory must be lib" + exit 1 +fi + +if [ -z "$CXX" ] +then + CXX=clang++ +fi + +if [ -z "$CXX_LANG" ] +then + CXX_LANG=c++11 +fi + +if [ -z "$CC" ] +then + CC=clang +fi + +if [ -z "$MACOSX_DEPLOYMENT_TARGET" ] +then + if [ -z "$IPHONEOS_DEPLOYMENT_TARGET" ] + then + MACOSX_DEPLOYMENT_TARGET=10.7 + fi +fi + +if [ -z "$RC_ProjectSourceVersion" ] +then + RC_ProjectSourceVersion=1 +fi + +EXTRA_FLAGS="-nostdinc++ -std=${CXX_LANG} -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion \ + -Wstrict-aliasing=2 -Wstrict-overflow=4 -D_LIBCPP_BUILDING_LIBRARY " + +case $TRIPLE in + *-apple-*) + if [ -z $RC_XBS ] + then + RC_CFLAGS="-arch i386 -arch x86_64" + fi + SOEXT=dylib + if [ "$MACOSX_DEPLOYMENT_TARGET" = "10.6" ] + then + EXTRA_FLAGS="-nostdinc++ -std=c++11 -U__STRICT_ANSI__" + LDSHARED_FLAGS="-o libc++.1.dylib \ + -dynamiclib -nodefaultlibs -current_version 1 \ + -compatibility_version 1 \ + -install_name /usr/lib/libc++.1.dylib \ + -Wl,-reexport_library,/usr/lib/libc++abi.dylib \ + -Wl,-unexported_symbols_list,libc++unexp.exp \ + /usr/lib/libSystem.B.dylib" + else + if [ -n "$SDKROOT" ] + then + EXTRA_FLAGS+="-isysroot ${SDKROOT} " + if echo "${RC_ARCHS}" | grep -q "armv7" + then + RE_EXPORT_LINE="${SDKROOT}/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++sjlj-abi.exp" + else + RE_EXPORT_LINE="-Wl,-reexport_library,${SDKROOT}/usr/lib/libc++abi.dylib" + fi + CXX=`xcrun -sdk "${SDKROOT}" -find clang++` + CC=`xcrun -sdk "${SDKROOT}" -find clang` + else + # Check if we have _LIBCPPABI_VERSION, to determine the reexport list to use. + if (echo "#include " | $CXX -E -dM -x c++ - | \ + grep _LIBCPPABI_VERSION > /dev/null) + then + RE_EXPORT_LINE="/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++abi2.exp" + else + RE_EXPORT_LINE="/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++abi.exp" + fi + fi + LDSHARED_FLAGS="-o libc++.1.dylib \ + -dynamiclib -nodefaultlibs \ + -current_version ${RC_ProjectSourceVersion} \ + -compatibility_version 1 \ + -install_name /usr/lib/libc++.1.dylib \ + -lSystem \ + -Wl,-unexported_symbols_list,libc++unexp.exp \ + ${RE_EXPORT_LINE} \ + -Wl,-force_symbols_not_weak_list,notweak.exp \ + -Wl,-force_symbols_weak_list,weak.exp" + fi + ;; + *-*-mingw*) + # FIXME: removing libgcc and libsupc++ dependencies means porting libcxxrt and LLVM/compiler-rt + SOEXT=dll + LDSHARED_FLAGS="-o libc++.dll \ + -shared -nodefaultlibs -Wl,--export-all-symbols -Wl,--allow-multiple-definition -Wl,--out-implib,libc++.dll.a \ + -lsupc++ -lpthread -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcr100 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt" + ;; + *-ibm-*) + hostOS=`uname` + hostOS=`echo $hostOS | sed -e "s/\s+$//"` + hostOS=`echo $hostOS | tr '[A-Z]' '[a-z]'` + + if [ $hostOS = "linux" ] + then + LDSHARED_FLAGS="-o libc++.so.1 \ + -qmkshrobj -Wl,-soname,libc++.so.1 \ + -lpthread -lrt -lc -lstdc++" + EXTRA_FLAGS="-qlanglvl=extended0x -D__GLIBCXX__=1" + else + LDSHARED_FLAGS="-o shr.o -qmkshrobj -lpthread -bnoquiet" + EXTRA_FLAGS="-qlanglvl=extended0x" + fi + RC_CFLAGS="-qpic=large" + ;; + *) + RC_CFLAGS="-fPIC" + SOEXT=so + LDSHARED_FLAGS="-o libc++.so.1.0 \ + -shared -nodefaultlibs -Wl,-soname,libc++.so.1 \ + -lpthread -lrt -lc -lstdc++" + ;; +esac + +if [ -z "$RC_XBS" ] +then + rm -f libc++.1.$SOEXT* +fi + +set -x + +for FILE in ../src/*.cpp; do + $CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -I../include $FILE +done +case $TRIPLE in + *-*-mingw*) + for FILE in ../src/support/win32/*.cpp; do + $CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -I../include $FILE + done + ;; +esac +$CC *.o $RC_CFLAGS $LDSHARED_FLAGS $EXTRA_FLAGS + +#libtool -static -o libc++.a *.o + +# Create the link for the final library name, so that we can use this directory +# as a link target for the tests. +case $TRIPLE in + *-apple-*) + rm -f libc++.dylib + ln -s libc++.1.dylib libc++.dylib + ;; + *-*-mingw*) + ;; + *-ibm-*) + if [ $hostOS = "linux" ] + then + rm -f libc++.so + ln -s libc++.so.1 libc++.so + else #AIX + rm -f libc++.a + ar r libc++.a shr.o + fi + ;; + *) + rm -f libc++.so + ln -s libc++.so.1 libc++.so + ;; +esac + +if [ -z "$RC_XBS" ] +then + rm *.o +fi + +echo "---------- WARNING ----------" +echo "buildit is no longer supported and will be removed in the next week!" +echo "please contact the libc++ maintainers if you have any concerns" +echo "" diff --git libcxx-5.0.1.src/test/testit libcxx-5.0.1.src/test/testit new file mode 100755 index 000000000..2fda687d8 --- /dev/null +++ libcxx-5.0.1.src/test/testit @@ -0,0 +1,183 @@ +#!/bin/sh +# //===--------------------------- testit ---------------------------------===// +# // +# // The LLVM Compiler Infrastructure +# // +# // This file is distributed under the University of Illinois Open Source +# // License. See LICENSE.TXT for details. +# // +# //===--------------------------------------------------------------------===// + +currentpath=`pwd` +origpath=$currentpath +currentdir=`basename $currentpath` +while [ $currentdir != "test" ]; do + if [ $currentdir = "/" ] + then + echo "current directory must be in or under \"test\"." + exit 1 + fi + cd .. + currentpath=`pwd` + currentdir=`basename $currentpath` +done + +cd .. +LIBCXX_ROOT=`pwd` +cd $origpath + +if [ -z "$CC" ] +then + if which xcrun >/dev/null + then + CC="xcrun clang++" + else + CC=clang++ + fi +fi + +if [ -z "$CXX_LANG" ] +then + CXX_LANG=c++11 +fi +if [ -z "$OPTIONS" ] +then + OPTIONS="-std=${CXX_LANG} -stdlib=libc++ -nostdinc++" +fi +OPTIONS="$OPTIONS -I$LIBCXX_ROOT/test/support" + +if [ -z "$HEADER_INCLUDE" ] +then + HEADER_INCLUDE="-I$LIBCXX_ROOT/include" +fi + +if [ -z "$SOURCE_LIB" ] +then + SOURCE_LIB="-L$LIBCXX_ROOT/lib" +fi + +case $TRIPLE in + *-*-mingw* | *-*-cygwin* | *-*-win*) + TEST_EXE=test.exe + ;; + *) + TEST_EXE=a.out + ;; +esac + +case $(uname -s) in + NetBSD) + THREAD_FLAGS=-lpthread + ;; +esac + +FAIL=0 +PASS=0 +UNIMPLEMENTED=0 +IMPLEMENTED_FAIL=0 +IMPLEMENTED_PASS=0 + +afunc() { + fail=0 + pass=0 + if (ls ${TEST_PREFIX}*fail.cpp > /dev/null 2>&1) + then + for FILE in $(ls ${TEST_PREFIX}*fail.cpp); do + if $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS -o ./$TEST_EXE > /dev/null 2>&1 + then + rm ./$TEST_EXE + echo "$FILE should not compile" + fail=$(($fail+1)) + else + pass=$(($pass+1)) + fi + done + fi + + if (ls ${TEST_PREFIX}*pass.cpp > /dev/null 2>&1) + then + for FILE in $(ls ${TEST_PREFIX}*pass.cpp); do + if [ "$VERBOSE" ] + then + echo "Running test: " $FILE + fi + if $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS $(test $1 = no || echo $THREAD_FLAGS) -o ./$TEST_EXE + then + if ./$TEST_EXE + then + rm ./$TEST_EXE + pass=$(($pass+1)) + else + echo "`pwd`/$FILE failed at run time" + echo "Compile line was:" $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS $(test $1 = no || echo $THREAD_FLAGS) + fail=$(($fail+1)) + rm ./$TEST_EXE + fi + else + echo "`pwd`/$FILE failed to compile" + echo "Compile line was:" $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS $(test $1 = no || echo $THREAD_FLAGS) + fail=$(($fail+1)) + fi + done + fi + + if [ $fail -gt 0 ] + then + echo "failed $fail tests in `pwd`" + IMPLEMENTED_FAIL=$(($IMPLEMENTED_FAIL+1)) + fi + if [ $pass -gt 0 ] + then + echo "passed $pass tests in `pwd`" + if [ $fail -eq 0 ] + then + IMPLEMENTED_PASS=$((IMPLEMENTED_PASS+1)) + fi + fi + if [ $fail -eq 0 -a $pass -eq 0 ] + then + echo "not implemented: `pwd`" + UNIMPLEMENTED=$(($UNIMPLEMENTED+1)) + fi + + FAIL=$(($FAIL+$fail)) + PASS=$(($PASS+$pass)) + + for FILE in * + do + if [ -d "$FILE" ]; + then + cd $FILE + if [ $FILE = thread -o $1 = yes ]; then + afunc yes + else + afunc no + fi + cd .. + fi + done +} + +afunc no + +echo "****************************************************" +echo "Results for `pwd`:" +echo "using `$CC --version`" +echo "with $OPTIONS $HEADER_INCLUDE $SOURCE_LIB" +echo "----------------------------------------------------" +echo "sections without tests : $UNIMPLEMENTED" +echo "sections with failures : $IMPLEMENTED_FAIL" +echo "sections without failures: $IMPLEMENTED_PASS" +echo " + ----" +echo "total number of sections : $(($UNIMPLEMENTED+$IMPLEMENTED_FAIL+$IMPLEMENTED_PASS))" +echo "----------------------------------------------------" +echo "number of tests failed : $FAIL" +echo "number of tests passed : $PASS" +echo " + ----" +echo "total number of tests : $(($FAIL+$PASS))" +echo "****************************************************" + +echo "---------- WARNING ----------" +echo "testit is no longer supported and will be removed in the future" + +exit $FAIL -- 2.15.1