| OLD | NEW |
| (Empty) |
| 1 #!/bin/bash | |
| 2 | |
| 3 # This is a temporary hack to see whether we can build libstdc++ from | |
| 4 # gcc 4.6.1 with pnacl-clang | |
| 5 # Upon success this should be folded into utman | |
| 6 # NOTE: run this in native_client/ like so | |
| 7 # | |
| 8 # tools/llvm/unsupported/build-libstdc++.sh download | |
| 9 # tools/llvm/unsupported/build-libstdc++.sh libstdcpp-patch | |
| 10 # tools/llvm/unsupported/build-libstdc++.sh libstdcpp-configure | |
| 11 # tools/llvm/unsupported/build-libstdc++.sh libstdcpp-make -k | |
| 12 # | |
| 13 set -o nounset | |
| 14 set -o errexit | |
| 15 | |
| 16 | |
| 17 readonly INSTALL_ROOT="$(pwd)/toolchain/pnacl_linux_x86_64_newlib" | |
| 18 readonly INSTALL_BIN="${INSTALL_ROOT}/bin" | |
| 19 readonly INSTALL_LIB="${INSTALL_ROOT}/lib" | |
| 20 readonly LIBSTDCPP_INSTALL_DIR="${INSTALL_ROOT}/pkg/libstdcpp" | |
| 21 | |
| 22 readonly GCC_SRC="$(pwd)/pnacl/git/gcc" | |
| 23 | |
| 24 CC=gcc | |
| 25 | |
| 26 | |
| 27 # Location of PNaCl gcc/g++/as | |
| 28 readonly PNACL_GCC="${INSTALL_BIN}/pnacl-gcc" | |
| 29 readonly PNACL_GXX="${INSTALL_BIN}/pnacl-g++" | |
| 30 readonly PNACL_CLANG="${INSTALL_BIN}/pnacl-clang" | |
| 31 readonly PNACL_CLANGXX="${INSTALL_BIN}/pnacl-clang++" | |
| 32 readonly PNACL_AR="${INSTALL_BIN}/pnacl-ar" | |
| 33 readonly PNACL_RANLIB="${INSTALL_BIN}/pnacl-ranlib" | |
| 34 readonly PNACL_AS="${INSTALL_BIN}/pnacl-as" | |
| 35 readonly PNACL_LD="${INSTALL_BIN}/pnacl-ld" | |
| 36 readonly PNACL_NM="${INSTALL_BIN}/pnacl-nm" | |
| 37 readonly PNACL_TRANSLATE="${INSTALL_BIN}/pnacl-translate" | |
| 38 readonly PNACL_READELF="${INSTALL_BIN}/readelf" | |
| 39 readonly PNACL_SIZE="${INSTALL_BIN}/size" | |
| 40 readonly PNACL_STRIP="${INSTALL_BIN}/pnacl-strip" | |
| 41 | |
| 42 readonly PNACL_AS_ARM="${INSTALL_BIN}/pnacl-arm-as" | |
| 43 readonly PNACL_AS_X8632="${INSTALL_BIN}/pnacl-i686-as" | |
| 44 readonly PNACL_AS_X8664="${INSTALL_BIN}/pnacl-x86_64-as" | |
| 45 | |
| 46 | |
| 47 readonly ILLEGAL_TOOL=${INSTALL_BIN}/pnacl-illegal | |
| 48 | |
| 49 STD_ENV_FOR_LIBSTDCPP_CLANG=( | |
| 50 CC_FOR_BUILD="${CC}" | |
| 51 CC="${PNACL_CLANG}" | |
| 52 CXX="${PNACL_CLANGXX}" | |
| 53 RAW_CXX_FOR_TARGET="${PNACL_CLANGXX}" | |
| 54 LD="${ILLEGAL_TOOL}" | |
| 55 CFLAGS="--pnacl-arm-bias" | |
| 56 CPPFLAGS="--pnacl-arm-bias" | |
| 57 CXXFLAGS="--pnacl-arm-bias " | |
| 58 CFLAGS_FOR_TARGET="--pnacl-arm-bias" | |
| 59 CPPFLAGS_FOR_TARGET="--pnacl-arm-bias" | |
| 60 CC_FOR_TARGET="${PNACL_CLANG}" | |
| 61 GCC_FOR_TARGET="${PNACL_CLANG}" | |
| 62 CXX_FOR_TARGET="${PNACL_CLANGXX}" | |
| 63 AR="${PNACL_AR}" | |
| 64 AR_FOR_TARGET="${PNACL_AR}" | |
| 65 NM_FOR_TARGET="${PNACL_NM}" | |
| 66 RANLIB="${PNACL_RANLIB}" | |
| 67 RANLIB_FOR_TARGET="${PNACL_RANLIB}" | |
| 68 AS_FOR_TARGET="${ILLEGAL_TOOL}" | |
| 69 LD_FOR_TARGET="${ILLEGAL_TOOL}" | |
| 70 OBJDUMP_FOR_TARGET="${ILLEGAL_TOOL}" ) | |
| 71 | |
| 72 | |
| 73 generate-patch() { | |
| 74 pushd ${GCC_SRC} | |
| 75 git diff | |
| 76 popd | |
| 77 } | |
| 78 | |
| 79 libstdcpp-patch() { | |
| 80 pushd ${GCC_SRC} | |
| 81 patch -p1 < ../../../tools/llvm/unsupported/patch-libstdc++ | |
| 82 popd | |
| 83 } | |
| 84 | |
| 85 | |
| 86 libstdcpp-configure() { | |
| 87 mkdir -p build | |
| 88 pushd build | |
| 89 | |
| 90 env -i PATH=/usr/bin/:/bin "${STD_ENV_FOR_LIBSTDCPP_CLANG[@]}" \ | |
| 91 ${GCC_SRC}/libstdc++-v3/configure \ | |
| 92 --host=arm-none-linux-gnueabi \ | |
| 93 --disable-shared \ | |
| 94 --disable-rpath \ | |
| 95 --enable-shared=no \ | |
| 96 --disable-libstdcxx-pch \ | |
| 97 --enable-linux-futex=no \ | |
| 98 --with-newlib \ | |
| 99 --enable-cxx-flags="-D__SIZE_MAX__=4294967295"\ | |
| 100 --enable-libstdcxx-time=no \ | |
| 101 --enable-sjlj-exceptions=no \ | |
| 102 --prefix="${LIBSTDCPP_INSTALL_DIR}" \ | |
| 103 --enable-multilib=no \ | |
| 104 "$@" | |
| 105 popd | |
| 106 } | |
| 107 | |
| 108 | |
| 109 libstdcpp-make() { | |
| 110 pushd build | |
| 111 env -i PATH=/usr/bin/:/bin "${STD_ENV_FOR_LIBSTDCPP_CLANG[@]}" \ | |
| 112 make \ | |
| 113 "$@" | |
| 114 popd | |
| 115 } | |
| 116 | |
| 117 | |
| 118 libstdcpp-install() { | |
| 119 pushd build | |
| 120 # install headers (=install-data) | |
| 121 # for good measure make sure we do not keep any old headers | |
| 122 rm -rf "${INSTALL_ROOT}/include/c++" | |
| 123 rm -rf "${LIBSTDCPP_INSTALL_DIR}" | |
| 124 env -i PATH=/usr/bin/:/bin "${STD_ENV_FOR_LIBSTDCPP_CLANG[@]}" \ | |
| 125 make \ | |
| 126 install-data \ | |
| 127 "$@" | |
| 128 | |
| 129 # Install bitcode library | |
| 130 mkdir -p "${INSTALL_LIB}" | |
| 131 cp src/.libs/libstdc++.a "${INSTALL_LIB}" | |
| 132 | |
| 133 popd | |
| 134 } | |
| 135 | |
| 136 | |
| 137 "$@" | |
| OLD | NEW |