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