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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 # i686-nacl-clang doesn't currently know about i686-nacl/usr/include | 63 # i686-nacl-clang doesn't currently know about i686-nacl/usr/include |
64 # or i686-nacl/usr/lib. Instead it shared the headers with x86_64 | 64 # or i686-nacl/usr/lib. Instead it shared the headers with x86_64 |
65 # and uses x86_64-nacl/usr/lib32. | 65 # and uses x86_64-nacl/usr/lib32. |
66 # TODO(sbc): remove this once we fix: | 66 # TODO(sbc): remove this once we fix: |
67 # https://code.google.com/p/nativeclient/issues/detail?id=4108 | 67 # https://code.google.com/p/nativeclient/issues/detail?id=4108 |
68 if [ "${TOOLCHAIN}" = "clang-newlib" -a "${NACL_ARCH}" = "i686" ]; then | 68 if [ "${TOOLCHAIN}" = "clang-newlib" -a "${NACL_ARCH}" = "i686" ]; then |
69 NACLPORTS_CPPFLAGS+=" -isystem ${NACLPORTS_INCLUDE}" | 69 NACLPORTS_CPPFLAGS+=" -isystem ${NACLPORTS_INCLUDE}" |
70 NACLPORTS_LDFLAGS+=" -L${NACLPORTS_LIBDIR}" | 70 NACLPORTS_LDFLAGS+=" -L${NACLPORTS_LIBDIR}" |
71 fi | 71 fi |
72 | 72 |
| 73 if [ "${TOOLCHAIN}" = "pnacl" -a "${NACL_ARCH}" = "le32" ]; then |
| 74 NACLPORTS_CPPFLAGS+=" -isystem ${NACLPORTS_INCLUDE}" |
| 75 fi |
| 76 |
73 if [ "${TOOLCHAIN}" = "clang-newlib" -o "${TOOLCHAIN}" = "pnacl" -o \ | 77 if [ "${TOOLCHAIN}" = "clang-newlib" -o "${TOOLCHAIN}" = "pnacl" -o \ |
74 "${TOOLCHAIN}" = "emscripten" ]; then | 78 "${TOOLCHAIN}" = "emscripten" ]; then |
75 NACLPORTS_CLANG=1 | 79 NACLPORTS_CLANG=1 |
76 else | 80 else |
77 NACLPORTS_CLANG=0 | 81 NACLPORTS_CLANG=0 |
78 fi | 82 fi |
79 | 83 |
80 # If stderr is a tty enable clang color compiler diagnostics | 84 # If stderr is a tty enable clang color compiler diagnostics |
81 if [ -t 1 -a "${NACLPORTS_CLANG}" = "1" ]; then | 85 if [ -t 1 -a "${NACLPORTS_CLANG}" = "1" ]; then |
82 NACLPORTS_CPPFLAGS+=" -fcolor-diagnostics" | 86 NACLPORTS_CPPFLAGS+=" -fcolor-diagnostics" |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 if IsCMakeProject; then | 511 if IsCMakeProject; then |
508 return | 512 return |
509 fi | 513 fi |
510 | 514 |
511 if [ "${NACL_DEBUG}" = "1" ]; then | 515 if [ "${NACL_DEBUG}" = "1" ]; then |
512 NACLPORTS_CFLAGS+=" -g -O0" | 516 NACLPORTS_CFLAGS+=" -g -O0" |
513 NACLPORTS_CXXFLAGS+=" -g -O0" | 517 NACLPORTS_CXXFLAGS+=" -g -O0" |
514 else | 518 else |
515 NACLPORTS_CFLAGS+=" -DNDEBUG -O2" | 519 NACLPORTS_CFLAGS+=" -DNDEBUG -O2" |
516 NACLPORTS_CXXFLAGS+=" -DNDEBUG -O2" | 520 NACLPORTS_CXXFLAGS+=" -DNDEBUG -O2" |
517 if [ "${NACL_ARCH}" = "pnacl" ]; then | 521 if [ "${NACL_ARCH}" = "pnacl" -a "${NACL_ARCH}" == "le32" ]; then |
518 NACLPORTS_LDFLAGS+=" -DNDEBUG -O2" | 522 NACLPORTS_LDFLAGS+=" -DNDEBUG -O2" |
519 fi | 523 fi |
520 fi | 524 fi |
521 } | 525 } |
522 | 526 |
523 EnableCliMain() { | 527 EnableCliMain() { |
524 if [[ ${TOOLCHAIN} == emscripten ]]; then | 528 if [[ ${TOOLCHAIN} == emscripten ]]; then |
525 return | 529 return |
526 fi | 530 fi |
527 NACLPORTS_LDFLAGS+=" ${NACL_CLI_MAIN_LDFLAGS}" | 531 NACLPORTS_LDFLAGS+=" ${NACL_CLI_MAIN_LDFLAGS}" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 LIBDOT_SEARCH_PATH=${CHROMEAPPS} LogExecute "${LIB_DOT}/bin/concat.sh" \ | 755 LIBDOT_SEARCH_PATH=${CHROMEAPPS} LogExecute "${LIB_DOT}/bin/concat.sh" \ |
752 -i "${HTERM}/concat/hterm_deps.concat" -o "${INSTALL_DIR}/hterm.concat.js" | 756 -i "${HTERM}/concat/hterm_deps.concat" -o "${INSTALL_DIR}/hterm.concat.js" |
753 LIBDOT_SEARCH_PATH=${CHROMEAPPS} LogExecute ${LIB_DOT}/bin/concat.sh \ | 757 LIBDOT_SEARCH_PATH=${CHROMEAPPS} LogExecute ${LIB_DOT}/bin/concat.sh \ |
754 -i "${HTERM}/concat/hterm.concat" -o "${INSTALL_DIR}/hterm2.js" | 758 -i "${HTERM}/concat/hterm.concat" -o "${INSTALL_DIR}/hterm2.js" |
755 chmod +w "${INSTALL_DIR}/hterm.concat.js" "${INSTALL_DIR}/hterm2.js" | 759 chmod +w "${INSTALL_DIR}/hterm.concat.js" "${INSTALL_DIR}/hterm2.js" |
756 cat "${INSTALL_DIR}/hterm2.js" >> "${INSTALL_DIR}/hterm.concat.js" | 760 cat "${INSTALL_DIR}/hterm2.js" >> "${INSTALL_DIR}/hterm.concat.js" |
757 Remove "${INSTALL_DIR}/hterm2.js" | 761 Remove "${INSTALL_DIR}/hterm2.js" |
758 | 762 |
759 LogExecute cp "${TOOLS_DIR}/naclterm.js" "${INSTALL_DIR}" | 763 LogExecute cp "${TOOLS_DIR}/naclterm.js" "${INSTALL_DIR}" |
760 LogExecute cp "${TOOLS_DIR}/pipeserver.js" "${INSTALL_DIR}" | 764 LogExecute cp "${TOOLS_DIR}/pipeserver.js" "${INSTALL_DIR}" |
761 if [ "${NACL_ARCH}" = "pnacl" ] ; then | 765 if [[ "${NACL_ARCH}" = "pnacl" || "${NACL_ARCH}" = "le32" ]] ; then |
762 sed 's/x-nacl/x-pnacl/' \ | 766 sed 's/x-nacl/x-pnacl/' \ |
763 "${TOOLS_DIR}/naclprocess.js" > "${INSTALL_DIR}/naclprocess.js" | 767 "${TOOLS_DIR}/naclprocess.js" > "${INSTALL_DIR}/naclprocess.js" |
764 else | 768 else |
765 LogExecute cp "${TOOLS_DIR}/naclprocess.js" "${INSTALL_DIR}" | 769 LogExecute cp "${TOOLS_DIR}/naclprocess.js" "${INSTALL_DIR}" |
766 fi | 770 fi |
767 } | 771 } |
768 | 772 |
769 | 773 |
770 # | 774 # |
771 # Build step for projects based on the NaCl SDK build | 775 # Build step for projects based on the NaCl SDK build |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 } | 1170 } |
1167 | 1171 |
1168 | 1172 |
1169 # | 1173 # |
1170 # Validate a given NaCl executable (.nexe file) | 1174 # Validate a given NaCl executable (.nexe file) |
1171 # $1 - Execuatable file (.nexe) | 1175 # $1 - Execuatable file (.nexe) |
1172 # | 1176 # |
1173 Validate() { | 1177 Validate() { |
1174 local binary=$1 | 1178 local binary=$1 |
1175 | 1179 |
1176 if [[ ${NACL_ARCH} = pnacl || ${NACL_ARCH} = emscripten ]]; then | 1180 if [[ ${NACL_ARCH} = pnacl || ${NACL_ARCH} = le32 |
| 1181 || ${NACL_ARCH} = emscripten ]]; then |
1177 if [[ ! -f $binary ]]; then | 1182 if [[ ! -f $binary ]]; then |
1178 echo "error: missing binary: ${binary}" | 1183 echo "error: missing binary: ${binary}" |
1179 exit 1 | 1184 exit 1 |
1180 fi | 1185 fi |
1181 return | 1186 return |
1182 fi | 1187 fi |
1183 | 1188 |
1184 LogExecute "${NACL_SDK_ROOT}/tools/ncval" "${binary}" | 1189 LogExecute "${NACL_SDK_ROOT}/tools/ncval" "${binary}" |
1185 if [[ $? != 0 ]]; then | 1190 if [[ $? != 0 ]]; then |
1186 exit 1 | 1191 exit 1 |
1187 fi | 1192 fi |
1188 } | 1193 } |
1189 | 1194 |
1190 | 1195 |
1191 # | 1196 # |
1192 # PostBuildStep by default will validate (using ncval) any executables | 1197 # PostBuildStep by default will validate (using ncval) any executables |
1193 # specified in the ${EXECUTABLES} as well as create wrapper scripts | 1198 # specified in the ${EXECUTABLES} as well as create wrapper scripts |
1194 # for running them in sel_ldr. | 1199 # for running them in sel_ldr. |
1195 # | 1200 # |
1196 DefaultPostBuildStep() { | 1201 DefaultPostBuildStep() { |
1197 if [[ -z ${EXECUTABLES} ]]; then | 1202 if [[ -z ${EXECUTABLES} ]]; then |
1198 return | 1203 return |
1199 fi | 1204 fi |
1200 | 1205 if [[ ${NACL_ARCH} == pnacl || ${NACL_ARCH} == le32 ]]; then |
1201 if [[ ${NACL_ARCH} == pnacl ]]; then | 1206 if [[ ${NACL_ARCH} == pnacl ]]; then |
1202 for pexe in ${EXECUTABLES}; do | 1207 for pexe in ${EXECUTABLES}; do |
1203 FinalizePexe "${pexe}" | 1208 FinalizePexe "${pexe}" |
1204 done | 1209 done |
| 1210 fi |
1205 if [[ ${TRANSLATE_PEXES:-} == no ]]; then | 1211 if [[ ${TRANSLATE_PEXES:-} == no ]]; then |
1206 return | 1212 return |
1207 fi | 1213 fi |
1208 for pexe in ${EXECUTABLES}; do | 1214 for pexe in ${EXECUTABLES}; do |
1209 TranslatePexe "${pexe}" | 1215 TranslatePexe "${pexe}" |
1210 done | 1216 done |
1211 fi | 1217 fi |
1212 | |
1213 for nexe in ${EXECUTABLES}; do | 1218 for nexe in ${EXECUTABLES}; do |
1214 Validate "${nexe}" | 1219 Validate "${nexe}" |
1215 # Create a script which will run the executable in sel_ldr. The name | 1220 # Create a script which will run the executable in sel_ldr. The name |
1216 # of the script is the same as the name of the executable, either without | 1221 # of the script is the same as the name of the executable, either without |
1217 # any extension or with the .sh extension. | 1222 # any extension or with the .sh extension. |
1218 | 1223 |
1219 local script_name="${nexe}.sh" | 1224 local script_name="${nexe}.sh" |
1220 if [[ ${nexe} == *${NACL_EXEEXT} && ! -d ${nexe%%${NACL_EXEEXT}} ]]; then | 1225 if [[ ${nexe} == *${NACL_EXEEXT} && ! -d ${nexe%%${NACL_EXEEXT}} ]]; then |
1221 script_name="${nexe%%${NACL_EXEEXT}}" | 1226 script_name="${nexe%%${NACL_EXEEXT}}" |
1222 fi | 1227 fi |
1223 | 1228 |
1224 nexe="$(basename ${nexe})" | 1229 nexe="$(basename ${nexe})" |
1225 if [[ ${NACL_ARCH} == pnacl ]]; then | 1230 if [[ ${NACL_ARCH} == pnacl || ${NACL_ARCH} == le32 ]]; then |
1226 local basename="${nexe%.*}" | 1231 local basename="${nexe%.*}" |
1227 nexe=${basename}.x86-64.nexe | 1232 nexe=${basename}.x86-64.nexe |
1228 fi | 1233 fi |
1229 WriteLauncherScript "${script_name}" "${nexe}" | 1234 WriteLauncherScript "${script_name}" "${nexe}" |
1230 done | 1235 done |
1231 | 1236 |
1232 VerifySharedLibraryOrder | 1237 VerifySharedLibraryOrder |
1233 } | 1238 } |
1234 | 1239 |
1235 | 1240 |
1236 # | 1241 # |
1237 # Run an executable (under sel_ldr or node.js). | 1242 # Run an executable (under sel_ldr or node.js). |
1238 # $1 - Executable (.nexe or .pexe) name | 1243 # $1 - Executable (.nexe or .pexe) name |
1239 # | 1244 # |
1240 RunSelLdrCommand() { | 1245 RunSelLdrCommand() { |
1241 if [ "${SKIP_SEL_LDR_TESTS}" = "1" ]; then | 1246 if [ "${SKIP_SEL_LDR_TESTS}" = "1" ]; then |
1242 return | 1247 return |
1243 fi | 1248 fi |
1244 | 1249 |
1245 if [ "${NACL_ARCH}" = "pnacl" ]; then | 1250 if [ "${NACL_ARCH}" = "pnacl" -o "${NACL_ARCH}" = "le32" ]; then |
1246 # For PNaCl we translate to each arch where we have sel_ldr, then run it. | 1251 # For PNaCl we translate to each arch where we have sel_ldr, then run it. |
1247 local PEXE=$1 | 1252 local PEXE=$1 |
1248 local NEXE_32=$1_32.nexe | 1253 local NEXE_32=$1_32.nexe |
1249 local NEXE_64=$1_64.nexe | 1254 local NEXE_64=$1_64.nexe |
1250 local SCRIPT_32=$1_32.sh | 1255 local SCRIPT_32=$1_32.sh |
1251 local SCRIPT_64=$1_64.sh | 1256 local SCRIPT_64=$1_64.sh |
1252 shift | 1257 shift |
1253 TranslateAndWriteLauncherScript "${PEXE}" x86-32 "${NEXE_32}" "${SCRIPT_32}" | 1258 TranslateAndWriteLauncherScript "${PEXE}" x86-32 "${NEXE_32}" "${SCRIPT_32}" |
1254 echo "[sel_ldr x86-32] ${SCRIPT_32} $*" | 1259 echo "[sel_ldr x86-32] ${SCRIPT_32} $*" |
1255 "./${SCRIPT_32}" "$@" | 1260 "./${SCRIPT_32}" "$@" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 TranslateAndWriteLauncherScript() { | 1371 TranslateAndWriteLauncherScript() { |
1367 local pexe=$1 | 1372 local pexe=$1 |
1368 local arch=$2 | 1373 local arch=$2 |
1369 local nexe=$3 | 1374 local nexe=$3 |
1370 local script=$4 | 1375 local script=$4 |
1371 if [[ ! -f ${pexe} ]]; then | 1376 if [[ ! -f ${pexe} ]]; then |
1372 echo "pexe not found: ${pexe}" | 1377 echo "pexe not found: ${pexe}" |
1373 exit 1 | 1378 exit 1 |
1374 fi | 1379 fi |
1375 if [[ ${pexe} -nt ${nexe} ]]; then | 1380 if [[ ${pexe} -nt ${nexe} ]]; then |
1376 echo "Finalizing -> ${pexe}" | 1381 if [[ ${NACL_ARCH} != le32 ]]; then |
1377 "${PNACLFINALIZE}" "${pexe}" | 1382 echo "Finalizing -> ${pexe}" |
| 1383 "${PNACLFINALIZE}" "${pexe}" |
| 1384 else |
| 1385 echo "Skipping finalizing: ${pexe} -> ${nexe}" |
| 1386 fi |
1378 echo "Translating -> ${nexe}" | 1387 echo "Translating -> ${nexe}" |
1379 "${TRANSLATOR}" "${pexe}" -arch "${arch}" -o "${nexe}" | 1388 "${TRANSLATOR}" "${pexe}" -arch "${arch}" -o "${nexe}" |
1380 else | 1389 else |
1381 echo "Skipping finalization and translation: ${pexe} -> ${nexe}" | 1390 echo "Skipping finalization and translation: ${pexe} -> ${nexe}" |
1382 fi | 1391 fi |
1383 WriteLauncherScript "${script}" $(basename "${nexe}") | 1392 WriteLauncherScript "${script}" $(basename "${nexe}") |
1384 } | 1393 } |
1385 | 1394 |
1386 | 1395 |
1387 # | 1396 # |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 ###################################################################### | 1638 ###################################################################### |
1630 # Always run | 1639 # Always run |
1631 # These functions are called when this script is imported to do | 1640 # These functions are called when this script is imported to do |
1632 # any essential checking/setup operations. | 1641 # any essential checking/setup operations. |
1633 ###################################################################### | 1642 ###################################################################### |
1634 PatchSpecsFile | 1643 PatchSpecsFile |
1635 InjectSystemHeaders | 1644 InjectSystemHeaders |
1636 InstallConfigSite | 1645 InstallConfigSite |
1637 GetRevision | 1646 GetRevision |
1638 MakeDirs | 1647 MakeDirs |
OLD | NEW |