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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 # Replace the package's config.sub one with an up-do-date copy | 878 # Replace the package's config.sub one with an up-do-date copy |
879 # that includes nacl support. We only do this if the string | 879 # that includes nacl support. We only do this if the string |
880 # 'nacl)' is not already contained in the file. | 880 # 'nacl)' is not already contained in the file. |
881 CONFIG_SUB=${CONFIG_SUB:-config.sub} | 881 CONFIG_SUB=${CONFIG_SUB:-config.sub} |
882 if [ ! -f "${CONFIG_SUB}" ]; then | 882 if [ ! -f "${CONFIG_SUB}" ]; then |
883 CONFIG_SUB=$(find "${SRC_DIR}" -name config.sub -print) | 883 CONFIG_SUB=$(find "${SRC_DIR}" -name config.sub -print) |
884 fi | 884 fi |
885 | 885 |
886 for sub in ${CONFIG_SUB}; do | 886 for sub in ${CONFIG_SUB}; do |
887 if grep -q 'nacl)' "${sub}" /dev/null; then | 887 if grep -q 'nacl)' "${sub}" /dev/null; then |
888 echo "${CONFIG_SUB} supports NaCl" | 888 if grep -q 'emscripten)' "${sub}" /dev/null; then |
889 else | 889 echo "${CONFIG_SUB} supports NaCl + emscripten" |
890 echo "Patching ${sub}" | 890 continue |
891 /bin/cp -f "${TOOLS_DIR}/config.sub" "${sub}" | 891 fi |
892 fi | 892 fi |
| 893 echo "Patching ${sub}" |
| 894 /bin/cp -f "${TOOLS_DIR}/config.sub" "${sub}" |
893 done | 895 done |
894 } | 896 } |
895 | 897 |
896 | 898 |
897 PatchConfigure() { | 899 PatchConfigure() { |
898 if [ -f configure ]; then | 900 if [ -f configure ]; then |
899 Banner "Patching configure" | 901 Banner "Patching configure" |
900 "${TOOLS_DIR}/patch_configure.py" configure | 902 "${TOOLS_DIR}/patch_configure.py" configure |
901 fi | 903 fi |
902 } | 904 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 # Without this autoconf builds will use the same CFLAGS/LDFLAGS for host | 966 # Without this autoconf builds will use the same CFLAGS/LDFLAGS for host |
965 # builds as NaCl builds and not all the flags we use are supported by the | 967 # builds as NaCl builds and not all the flags we use are supported by the |
966 # host compiler, which could be an older version of gcc | 968 # host compiler, which could be an older version of gcc |
967 # (e.g. -fdiagnostics-color=auto). | 969 # (e.g. -fdiagnostics-color=auto). |
968 export CFLAGS_FOR_BUILD="" | 970 export CFLAGS_FOR_BUILD="" |
969 export LDFLAGS_FOR_BUILD="" | 971 export LDFLAGS_FOR_BUILD="" |
970 | 972 |
971 local conf_host=${NACL_CROSS_PREFIX} | 973 local conf_host=${NACL_CROSS_PREFIX} |
972 # TODO(gdeepti): Investigate whether emscripten accurately fits this case for | 974 # TODO(gdeepti): Investigate whether emscripten accurately fits this case for |
973 # long term usage. | 975 # long term usage. |
974 if [ "${NACL_ARCH}" = "pnacl" -o "${NACL_ARCH}" = "emscripten" ]; then | 976 if [[ ${TOOLCHAIN} == pnacl ]]; then |
975 # The PNaCl tools use "pnacl-" as the prefix, but config.sub | 977 # The PNaCl tools use "pnacl-" as the prefix, but config.sub |
976 # does not know about "pnacl". It only knows about "le32-nacl". | 978 # does not know about "pnacl". It only knows about "le32-nacl". |
977 # Unfortunately, most of the config.subs here are so old that | 979 # Unfortunately, most of the config.subs here are so old that |
978 # it doesn't know about that "le32" either. So we just say "nacl". | 980 # it doesn't know about that "le32" either. So we just say "nacl". |
979 conf_host="nacl" | 981 conf_host="nacl" |
980 fi | 982 fi |
981 | 983 |
982 # Inject a shim that speed up pnacl invocations for configure. | 984 # Inject a shim that speed up pnacl invocations for configure. |
983 if [ "${NACL_ARCH}" = "pnacl" ]; then | 985 if [ "${NACL_ARCH}" = "pnacl" ]; then |
984 local PNACL_CONF_SHIM="${TOOLS_DIR}/pnacl-configure-shim.py" | 986 local PNACL_CONF_SHIM="${TOOLS_DIR}/pnacl-configure-shim.py" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 fi | 1228 fi |
1227 } | 1229 } |
1228 | 1230 |
1229 | 1231 |
1230 # | 1232 # |
1231 # Write a wrapper script that will run a nexe under sel_ldr | 1233 # Write a wrapper script that will run a nexe under sel_ldr |
1232 # $1 - Script name | 1234 # $1 - Script name |
1233 # $2 - Nexe name | 1235 # $2 - Nexe name |
1234 # | 1236 # |
1235 WriteLauncherScript() { | 1237 WriteLauncherScript() { |
| 1238 local script=$1 |
| 1239 local binary=$2 |
1236 if [ "${SKIP_SEL_LDR_TESTS}" = "1" ]; then | 1240 if [ "${SKIP_SEL_LDR_TESTS}" = "1" ]; then |
1237 return | 1241 return |
1238 fi | 1242 fi |
1239 | 1243 |
| 1244 if [[ ! -f $binary ]]; then |
| 1245 echo "error: missing binary: ${binary}" |
| 1246 exit 1 |
| 1247 fi |
| 1248 |
1240 if [ "${TOOLCHAIN}" = "emscripten" ]; then | 1249 if [ "${TOOLCHAIN}" = "emscripten" ]; then |
1241 local node=node | 1250 local node=node |
1242 if ! which node > /dev/null ; then | 1251 if ! which node > /dev/null ; then |
1243 node=nodejs | 1252 node=nodejs |
1244 if ! which nodejs > /dev/null ; then | 1253 if ! which nodejs > /dev/null ; then |
1245 echo "Failed to find 'node' or 'nodejs' in PATH" | 1254 echo "Failed to find 'node' or 'nodejs' in PATH" |
1246 exit 1 | 1255 exit 1 |
1247 fi | 1256 fi |
1248 fi | 1257 fi |
1249 cat > "$1" <<HERE | 1258 cat > "$script" <<HERE |
1250 #!/bin/bash | 1259 #!/bin/bash |
1251 | 1260 |
1252 SCRIPT_DIR=\$(dirname "\${BASH_SOURCE[0]}") | 1261 SCRIPT_DIR=\$(dirname "\${BASH_SOURCE[0]}") |
1253 NODE=${node} | 1262 NODE=${node} |
1254 | 1263 |
1255 cd "\${SCRIPT_DIR}" | 1264 cd "\${SCRIPT_DIR}" |
1256 exec \${NODE} $2 "\$@" | 1265 exec \${NODE} $binary "\$@" |
1257 HERE | 1266 HERE |
1258 chmod 750 "$1" | 1267 chmod 750 "$script" |
1259 echo "Wrote script $1 -> $2" | 1268 echo "Wrote script $script -> $binary" |
1260 return | 1269 return |
1261 fi | 1270 fi |
1262 | 1271 |
1263 if [ "${OS_NAME}" = "Cygwin" ]; then | 1272 if [ "${OS_NAME}" = "Cygwin" ]; then |
1264 local LOGFILE=nul | 1273 local LOGFILE=nul |
1265 else | 1274 else |
1266 local LOGFILE=/dev/null | 1275 local LOGFILE=/dev/null |
1267 fi | 1276 fi |
1268 | 1277 |
1269 if [ "${NACL_LIBC}" = "glibc" ]; then | 1278 if [ "${NACL_LIBC}" = "glibc" ]; then |
1270 cat > "$1" <<HERE | 1279 cat > "$script" <<HERE |
1271 #!/bin/bash | 1280 #!/bin/bash |
1272 SCRIPT_DIR=\$(dirname "\${BASH_SOURCE[0]}") | 1281 SCRIPT_DIR=\$(dirname "\${BASH_SOURCE[0]}") |
1273 if [ \$(uname -s) = CYGWIN* ]; then | 1282 if [ \$(uname -s) = CYGWIN* ]; then |
1274 SCRIPT_DIR=\$(cygpath -m \${SCRIPT_DIR}) | 1283 SCRIPT_DIR=\$(cygpath -m \${SCRIPT_DIR}) |
1275 fi | 1284 fi |
1276 NACL_SDK_ROOT=${NACL_SDK_ROOT} | 1285 NACL_SDK_ROOT=${NACL_SDK_ROOT} |
1277 | 1286 |
1278 NACL_SDK_LIB=${NACL_SDK_LIB} | 1287 NACL_SDK_LIB=${NACL_SDK_LIB} |
1279 LIB_PATH_DEFAULT=${NACL_SDK_LIBDIR}:${NACLPORTS_LIBDIR} | 1288 LIB_PATH_DEFAULT=${NACL_SDK_LIBDIR}:${NACLPORTS_LIBDIR} |
1280 LIB_PATH_DEFAULT=\${LIB_PATH_DEFAULT}:\${NACL_SDK_LIB}:\${SCRIPT_DIR} | 1289 LIB_PATH_DEFAULT=\${LIB_PATH_DEFAULT}:\${NACL_SDK_LIB}:\${SCRIPT_DIR} |
1281 SEL_LDR_LIB_PATH=\${SEL_LDR_LIB_PATH}:\${LIB_PATH_DEFAULT} | 1290 SEL_LDR_LIB_PATH=\${SEL_LDR_LIB_PATH}:\${LIB_PATH_DEFAULT} |
1282 | 1291 |
1283 "\${NACL_SDK_ROOT}/tools/sel_ldr.py" -p --library-path "\${SEL_LDR_LIB_PATH}" \ | 1292 "\${NACL_SDK_ROOT}/tools/sel_ldr.py" -p --library-path "\${SEL_LDR_LIB_PATH}" \ |
1284 -- "\${SCRIPT_DIR}/$2" "\$@" | 1293 -- "\${SCRIPT_DIR}/$binary" "\$@" |
1285 HERE | 1294 HERE |
1286 else | 1295 else |
1287 cat > "$1" <<HERE | 1296 cat > "$script" <<HERE |
1288 #!/bin/bash | 1297 #!/bin/bash |
1289 SCRIPT_DIR=\$(dirname "\${BASH_SOURCE[0]}") | 1298 SCRIPT_DIR=\$(dirname "\${BASH_SOURCE[0]}") |
1290 if [ \$(uname -s) = CYGWIN* ]; then | 1299 if [ \$(uname -s) = CYGWIN* ]; then |
1291 SCRIPT_DIR=\$(cygpath -m \${SCRIPT_DIR}) | 1300 SCRIPT_DIR=\$(cygpath -m \${SCRIPT_DIR}) |
1292 fi | 1301 fi |
1293 NACL_SDK_ROOT=${NACL_SDK_ROOT} | 1302 NACL_SDK_ROOT=${NACL_SDK_ROOT} |
1294 | 1303 |
1295 "\${NACL_SDK_ROOT}/tools/sel_ldr.py" -p -- "\${SCRIPT_DIR}/$2" "\$@" | 1304 "\${NACL_SDK_ROOT}/tools/sel_ldr.py" -p -- "\${SCRIPT_DIR}/$binary" "\$@" |
1296 HERE | 1305 HERE |
1297 fi | 1306 fi |
1298 | 1307 |
1299 chmod 750 "$1" | 1308 chmod 750 "$script" |
1300 echo "Wrote script $1 -> $2" | 1309 echo "Wrote script $script -> $binary" |
1301 } | 1310 } |
1302 | 1311 |
1303 | 1312 |
1304 TranslateAndWriteLauncherScript() { | 1313 TranslateAndWriteLauncherScript() { |
1305 local PEXE=$1 | 1314 local PEXE=$1 |
1306 local PEXE_FINAL=$1_final.pexe | 1315 local PEXE_FINAL=$1_final.pexe |
1307 local ARCH=$2 | 1316 local ARCH=$2 |
1308 local NEXE=$3 | 1317 local NEXE=$3 |
1309 local SCRIPT=$4 | 1318 local SCRIPT=$4 |
1310 # Finalize the pexe to make sure it is finalizeable. | 1319 # Finalize the pexe to make sure it is finalizeable. |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1568 ###################################################################### | 1577 ###################################################################### |
1569 # Always run | 1578 # Always run |
1570 # These functions are called when this script is imported to do | 1579 # These functions are called when this script is imported to do |
1571 # any essential checking/setup operations. | 1580 # any essential checking/setup operations. |
1572 ###################################################################### | 1581 ###################################################################### |
1573 PatchSpecsFile | 1582 PatchSpecsFile |
1574 InjectSystemHeaders | 1583 InjectSystemHeaders |
1575 InstallConfigSite | 1584 InstallConfigSite |
1576 GetRevision | 1585 GetRevision |
1577 MakeDirs | 1586 MakeDirs |
OLD | NEW |