Chromium Code Reviews| 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 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1193 | 1193 |
| 1194 if [ "${NACL_ARCH}" = "pnacl" ]; then | 1194 if [ "${NACL_ARCH}" = "pnacl" ]; then |
| 1195 for pexe in ${EXECUTABLES}; do | 1195 for pexe in ${EXECUTABLES}; do |
| 1196 FinalizePexe "${pexe}" | 1196 FinalizePexe "${pexe}" |
| 1197 done | 1197 done |
| 1198 if [ "${TRANSLATE_PEXES:-}" != "no" ]; then | 1198 if [ "${TRANSLATE_PEXES:-}" != "no" ]; then |
| 1199 for pexe in ${EXECUTABLES}; do | 1199 for pexe in ${EXECUTABLES}; do |
| 1200 TranslatePexe "${pexe}" | 1200 TranslatePexe "${pexe}" |
| 1201 done | 1201 done |
| 1202 fi | 1202 fi |
| 1203 return | |
| 1204 fi | 1203 fi |
| 1205 | 1204 |
| 1206 for nexe in ${EXECUTABLES}; do | 1205 for nexe in ${EXECUTABLES}; do |
| 1207 Validate "${nexe}" | 1206 Validate "${nexe}" |
| 1208 # Create a script which will run the executable in sel_ldr. The name | 1207 # Create a script which will run the executable in sel_ldr. The name |
| 1209 # of the script is the same as the name of the executable, either without | 1208 # of the script is the same as the name of the executable, either without |
| 1210 # any extension or with the .sh extension. | 1209 # any extension or with the .sh extension. |
| 1210 | |
| 1211 local script_name="${nexe}.sh" | |
| 1211 if [[ ${nexe} == *${NACL_EXEEXT} && ! -d ${nexe%%${NACL_EXEEXT}} ]]; then | 1212 if [[ ${nexe} == *${NACL_EXEEXT} && ! -d ${nexe%%${NACL_EXEEXT}} ]]; then |
| 1212 WriteLauncherScript "${nexe%%${NACL_EXEEXT}}" "$(basename ${nexe})" | 1213 script_name="${nexe%%${NACL_EXEEXT}}" |
| 1213 else | |
| 1214 WriteLauncherScript "${nexe}.sh" "$(basename ${nexe})" | |
| 1215 fi | 1214 fi |
| 1215 | |
| 1216 nexe="$(basename ${nexe})" | |
| 1217 if [[ ${NACL_ARCH} == pnacl ]]; then | |
| 1218 local basename="${nexe%.*}" | |
| 1219 nexe=${basename}.x86-64.nexe | |
|
binji
2016/01/04 19:37:03
we assume x86_64 host?
| |
| 1220 fi | |
| 1221 WriteLauncherScript "${script_name}" "${nexe}" | |
| 1216 done | 1222 done |
| 1217 | 1223 |
| 1218 VerifySharedLibraryOrder | 1224 VerifySharedLibraryOrder |
| 1219 } | 1225 } |
| 1220 | 1226 |
| 1221 | 1227 |
| 1222 # | 1228 # |
| 1223 # Run an executable with under sel_ldr. | 1229 # Run an executable with under sel_ldr. |
| 1224 # $1 - Executable (.nexe) name | 1230 # $1 - Executable (.nexe) name |
| 1225 # | 1231 # |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1342 local NEXE=$3 | 1348 local NEXE=$3 |
| 1343 local SCRIPT=$4 | 1349 local SCRIPT=$4 |
| 1344 # Finalize the pexe to make sure it is finalizeable. | 1350 # Finalize the pexe to make sure it is finalizeable. |
| 1345 if [ "${PEXE}" -nt "${PEXE_FINAL}" ]; then | 1351 if [ "${PEXE}" -nt "${PEXE_FINAL}" ]; then |
| 1346 "${PNACLFINALIZE}" "${PEXE}" -o "${PEXE_FINAL}" | 1352 "${PNACLFINALIZE}" "${PEXE}" -o "${PEXE_FINAL}" |
| 1347 fi | 1353 fi |
| 1348 # Translate to the appropriate version. | 1354 # Translate to the appropriate version. |
| 1349 if [ "${PEXE_FINAL}" -nt "${NEXE}" ]; then | 1355 if [ "${PEXE_FINAL}" -nt "${NEXE}" ]; then |
| 1350 "${TRANSLATOR}" "${PEXE_FINAL}" -arch "${ARCH}" -o "${NEXE}" | 1356 "${TRANSLATOR}" "${PEXE_FINAL}" -arch "${ARCH}" -o "${NEXE}" |
| 1351 fi | 1357 fi |
| 1352 WriteLauncherScriptPNaCl "${SCRIPT}" $(basename "${NEXE}") "${ARCH}" | 1358 WriteLauncherScript "${SCRIPT}" $(basename "${NEXE}") |
| 1353 } | 1359 } |
| 1354 | 1360 |
| 1355 | 1361 |
| 1356 # | |
| 1357 # Write a wrapper script that will run a nexe under sel_ldr, for PNaCl | |
| 1358 # $1 - Script name | |
| 1359 # $2 - Nexe name | |
| 1360 # $3 - sel_ldr architecture | |
| 1361 # | |
| 1362 WriteLauncherScriptPNaCl() { | |
| 1363 local script_name=$1 | |
| 1364 local nexe_name=$2 | |
| 1365 local arch=$3 | |
| 1366 cat > "${script_name}" <<HERE | |
| 1367 #!/bin/bash | |
| 1368 SCRIPT_DIR=\$(dirname "\${BASH_SOURCE[0]}") | |
| 1369 NACL_SDK_ROOT="${NACL_SDK_ROOT}" | |
| 1370 | |
| 1371 "\${NACL_SDK_ROOT}/tools/sel_ldr.py" -p -- "\${SCRIPT_DIR}/${nexe_name}" "\$@" | |
| 1372 HERE | |
| 1373 chmod 750 "${script_name}" | |
| 1374 echo "Wrote script ${PWD}/${script_name}" | |
| 1375 } | |
| 1376 | |
| 1377 | |
| 1378 FinalizePexe() { | 1362 FinalizePexe() { |
| 1379 local pexe=$1 | 1363 local pexe=$1 |
| 1380 Banner "Finalizing ${pexe}" | 1364 Banner "Finalizing ${pexe}" |
| 1381 "${PNACLFINALIZE}" "${pexe}" | 1365 "${PNACLFINALIZE}" "${pexe}" |
| 1382 } | 1366 } |
| 1383 | 1367 |
| 1384 | 1368 |
| 1385 # | 1369 # |
| 1386 # Translate a PNaCl executable (.pexe) into one or more | 1370 # Translate a PNaCl executable (.pexe) into one or more |
| 1387 # native NaCl executables (.nexe). | 1371 # native NaCl executables (.nexe). |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1613 ###################################################################### | 1597 ###################################################################### |
| 1614 # Always run | 1598 # Always run |
| 1615 # These functions are called when this script is imported to do | 1599 # These functions are called when this script is imported to do |
| 1616 # any essential checking/setup operations. | 1600 # any essential checking/setup operations. |
| 1617 ###################################################################### | 1601 ###################################################################### |
| 1618 PatchSpecsFile | 1602 PatchSpecsFile |
| 1619 InjectSystemHeaders | 1603 InjectSystemHeaders |
| 1620 InstallConfigSite | 1604 InstallConfigSite |
| 1621 GetRevision | 1605 GetRevision |
| 1622 MakeDirs | 1606 MakeDirs |
| OLD | NEW |