| OLD | NEW |
| 1 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 1 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 # | 4 # |
| 5 # Environment variable NACL_ARCH should be set to one of the following | 5 # Environment variable NACL_ARCH should be set to one of the following |
| 6 # values: i686 x86_64 pnacl arm | 6 # values: i686 x86_64 pnacl arm |
| 7 | 7 |
| 8 | 8 |
| 9 # NAMING CONVENTION | 9 # NAMING CONVENTION |
| 10 # ================= | 10 # ================= |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 if [ -z "${OS_JOBS:-}" ]; then | 172 if [ -z "${OS_JOBS:-}" ]; then |
| 173 if [ "${OS_NAME}" = "Darwin" ]; then | 173 if [ "${OS_NAME}" = "Darwin" ]; then |
| 174 OS_JOBS=4 | 174 OS_JOBS=4 |
| 175 elif [ "${OS_NAME}" = "Linux" ]; then | 175 elif [ "${OS_NAME}" = "Linux" ]; then |
| 176 OS_JOBS=$(nproc) | 176 OS_JOBS=$(nproc) |
| 177 else | 177 else |
| 178 OS_JOBS=1 | 178 OS_JOBS=1 |
| 179 fi | 179 fi |
| 180 fi | 180 fi |
| 181 | 181 |
| 182 CONF_BUILD=$(/bin/sh "${SCRIPT_DIR}/config.guess") |
| 183 CONF_HOST=${NACL_CROSS_PREFIX} |
| 184 # TODO(gdeepti): Investigate whether emscripten accurately fits this case for |
| 185 # long term usage. |
| 186 if [[ ${NACL_ARCH} == pnacl ]]; then |
| 187 # The PNaCl tools use "pnacl-" as the prefix, but config.sub |
| 188 # does not know about "pnacl". It only knows about "le32-nacl". |
| 189 # Unfortunately, most of the config.subs here are so old that |
| 190 # it doesn't know about that "le32" either. So we just say "nacl". |
| 191 CONF_HOST="nacl" |
| 192 fi |
| 193 |
| 182 GomaTest() { | 194 GomaTest() { |
| 183 # test the goma compiler | 195 # test the goma compiler |
| 184 if [ "${NACL_GOMA_FORCE:-}" = 1 ]; then | 196 if [ "${NACL_GOMA_FORCE:-}" = 1 ]; then |
| 185 return 0 | 197 return 0 |
| 186 fi | 198 fi |
| 187 echo 'int foo = 4;' > goma_test.c | 199 echo 'int foo = 4;' > goma_test.c |
| 188 GOMA_USE_LOCAL=false GOMA_FALLBACK=false gomacc "$1" -c \ | 200 GOMA_USE_LOCAL=false GOMA_FALLBACK=false gomacc "$1" -c \ |
| 189 goma_test.c -o goma_test.o 2> /dev/null | 201 goma_test.c -o goma_test.o 2> /dev/null |
| 190 local RTN=$? | 202 local RTN=$? |
| 191 rm -f goma_test.c | 203 rm -f goma_test.c |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 ConfigureStep_Autoconf | 986 ConfigureStep_Autoconf |
| 975 elif IsCMakeProject; then | 987 elif IsCMakeProject; then |
| 976 ConfigureStep_CMake | 988 ConfigureStep_CMake |
| 977 else | 989 else |
| 978 echo "No configure or CMakeLists.txt script found in ${SRC_DIR}" | 990 echo "No configure or CMakeLists.txt script found in ${SRC_DIR}" |
| 979 fi | 991 fi |
| 980 } | 992 } |
| 981 | 993 |
| 982 | 994 |
| 983 ConfigureStep_Autoconf() { | 995 ConfigureStep_Autoconf() { |
| 984 conf_build=$(/bin/sh "${SCRIPT_DIR}/config.guess") | |
| 985 | |
| 986 SetupCrossEnvironment | 996 SetupCrossEnvironment |
| 987 | 997 |
| 988 # Without this autoconf builds will use the same CFLAGS/LDFLAGS for host | 998 # Without this autoconf builds will use the same CFLAGS/LDFLAGS for host |
| 989 # builds as NaCl builds and not all the flags we use are supported by the | 999 # builds as NaCl builds and not all the flags we use are supported by the |
| 990 # host compiler, which could be an older version of gcc | 1000 # host compiler, which could be an older version of gcc |
| 991 # (e.g. -fdiagnostics-color=auto). | 1001 # (e.g. -fdiagnostics-color=auto). |
| 992 export CFLAGS_FOR_BUILD="" | 1002 export CFLAGS_FOR_BUILD="" |
| 993 export LDFLAGS_FOR_BUILD="" | 1003 export LDFLAGS_FOR_BUILD="" |
| 994 | 1004 |
| 995 local conf_host=${NACL_CROSS_PREFIX} | |
| 996 # TODO(gdeepti): Investigate whether emscripten accurately fits this case for | |
| 997 # long term usage. | |
| 998 if [[ ${TOOLCHAIN} == pnacl ]]; then | |
| 999 # The PNaCl tools use "pnacl-" as the prefix, but config.sub | |
| 1000 # does not know about "pnacl". It only knows about "le32-nacl". | |
| 1001 # Unfortunately, most of the config.subs here are so old that | |
| 1002 # it doesn't know about that "le32" either. So we just say "nacl". | |
| 1003 conf_host="nacl" | |
| 1004 fi | |
| 1005 | |
| 1006 # Inject a shim that speed up pnacl invocations for configure. | 1005 # Inject a shim that speed up pnacl invocations for configure. |
| 1007 if [ "${NACL_ARCH}" = "pnacl" ]; then | 1006 if [ "${NACL_ARCH}" = "pnacl" ]; then |
| 1008 local PNACL_CONF_SHIM="${TOOLS_DIR}/pnacl-configure-shim.py" | 1007 local PNACL_CONF_SHIM="${TOOLS_DIR}/pnacl-configure-shim.py" |
| 1009 CC="${PNACL_CONF_SHIM} ${CC}" | 1008 CC="${PNACL_CONF_SHIM} ${CC}" |
| 1010 fi | 1009 fi |
| 1011 | 1010 |
| 1012 if [[ ${TOOLCHAIN} == emscripten ]]; then | 1011 if [[ ${TOOLCHAIN} == emscripten ]]; then |
| 1013 echo "export EMMAKEN_JUST_CONFIGURE=1" | 1012 echo "export EMMAKEN_JUST_CONFIGURE=1" |
| 1014 export EMMAKEN_JUST_CONFIGURE=1 | 1013 export EMMAKEN_JUST_CONFIGURE=1 |
| 1015 fi | 1014 fi |
| 1016 | 1015 |
| 1017 # Specify both --build and --host options. This forces autoconf into cross | 1016 # Specify both --build and --host options. This forces autoconf into cross |
| 1018 # compile mode. This is useful since the autodection doesn't always works. | 1017 # compile mode. This is useful since the autodection doesn't always works. |
| 1019 # For example a trivial PNaCl binary can sometimes run on the linux host if | 1018 # For example a trivial PNaCl binary can sometimes run on the linux host if |
| 1020 # it has the correct LLVM bimfmt support. What is more, autoconf will | 1019 # it has the correct LLVM bimfmt support. What is more, autoconf will |
| 1021 # generate a warning if only --host is specified. | 1020 # generate a warning if only --host is specified. |
| 1022 LogExecute "${NACL_CONFIGURE_PATH}" \ | 1021 LogExecute "${NACL_CONFIGURE_PATH}" \ |
| 1023 --build=${conf_build} \ | 1022 --build=${CONF_BUILD} \ |
| 1024 --host=${conf_host} \ | 1023 --host=${CONF_HOST} \ |
| 1025 --prefix=${PREFIX} \ | 1024 --prefix=${PREFIX} \ |
| 1026 --with-http=no \ | 1025 --with-http=no \ |
| 1027 --with-html=no \ | 1026 --with-html=no \ |
| 1028 --with-ftp=no \ | 1027 --with-ftp=no \ |
| 1029 --${NACL_OPTION}-mmx \ | 1028 --${NACL_OPTION}-mmx \ |
| 1030 --${NACL_OPTION}-sse \ | 1029 --${NACL_OPTION}-sse \ |
| 1031 --${NACL_OPTION}-sse2 \ | 1030 --${NACL_OPTION}-sse2 \ |
| 1032 --${NACL_OPTION}-asm \ | 1031 --${NACL_OPTION}-asm \ |
| 1033 --with-x=no \ | 1032 --with-x=no \ |
| 1034 ${EXTRA_CONFIGURE_ARGS:-} | 1033 ${EXTRA_CONFIGURE_ARGS:-} |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1607 ###################################################################### | 1606 ###################################################################### |
| 1608 # Always run | 1607 # Always run |
| 1609 # These functions are called when this script is imported to do | 1608 # These functions are called when this script is imported to do |
| 1610 # any essential checking/setup operations. | 1609 # any essential checking/setup operations. |
| 1611 ###################################################################### | 1610 ###################################################################### |
| 1612 PatchSpecsFile | 1611 PatchSpecsFile |
| 1613 InjectSystemHeaders | 1612 InjectSystemHeaders |
| 1614 InstallConfigSite | 1613 InstallConfigSite |
| 1615 GetRevision | 1614 GetRevision |
| 1616 MakeDirs | 1615 MakeDirs |
| OLD | NEW |