| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 238 |
| 239 | 239 |
| 240 # DESTDIR is where the headers, libraries, etc. will be installed | 240 # DESTDIR is where the headers, libraries, etc. will be installed |
| 241 # Default to the usr folder within the SDK. | 241 # Default to the usr folder within the SDK. |
| 242 if [ -z "${DESTDIR:-}" ]; then | 242 if [ -z "${DESTDIR:-}" ]; then |
| 243 readonly DEFAULT_DESTDIR=1 | 243 readonly DEFAULT_DESTDIR=1 |
| 244 DESTDIR=${INSTALL_DIR} | 244 DESTDIR=${INSTALL_DIR} |
| 245 fi | 245 fi |
| 246 | 246 |
| 247 DESTDIR_LIB=${DESTDIR}/${PREFIX}/lib | 247 DESTDIR_LIB=${DESTDIR}/${PREFIX}/lib |
| 248 DESTDIR_BIN=${DESTDIR}/${PREFIX}/bin |
| 248 DESTDIR_INCLUDE=${DESTDIR}/${PREFIX}/include | 249 DESTDIR_INCLUDE=${DESTDIR}/${PREFIX}/include |
| 249 | 250 |
| 250 PUBLISH_DIR="${NACL_PACKAGES_PUBLISH}/${PACKAGE_NAME}/${TOOLCHAIN}" | 251 PUBLISH_DIR="${NACL_PACKAGES_PUBLISH}/${PACKAGE_NAME}/${TOOLCHAIN}" |
| 251 PUBLISH_CREATE_NMF_ARGS="-L ${DESTDIR_LIB}" | 252 PUBLISH_CREATE_NMF_ARGS="-L ${DESTDIR_LIB}" |
| 252 | 253 |
| 253 SKIP_SEL_LDR_TESTS=0 | 254 SKIP_SEL_LDR_TESTS=0 |
| 254 | 255 |
| 255 # Skip sel_ldr tests when building for arm | 256 # Skip sel_ldr tests when building for arm |
| 256 if [ "${NACL_ARCH}" = "arm" ]; then | 257 if [ "${NACL_ARCH}" = "arm" ]; then |
| 257 SKIP_SEL_LDR_TESTS=1 | 258 SKIP_SEL_LDR_TESTS=1 |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 # a few months. | 674 # a few months. |
| 674 if [ ! -d "${NACL_PACKAGES_CACHE}" -a -d "${NACL_PACKAGES_OUT}/tarballs" ]; th
en | 675 if [ ! -d "${NACL_PACKAGES_CACHE}" -a -d "${NACL_PACKAGES_OUT}/tarballs" ]; th
en |
| 675 mv "${NACL_PACKAGES_OUT}/tarballs" "${NACL_PACKAGES_CACHE}" | 676 mv "${NACL_PACKAGES_OUT}/tarballs" "${NACL_PACKAGES_CACHE}" |
| 676 fi | 677 fi |
| 677 MakeDir "${NACL_PACKAGES_CACHE}" | 678 MakeDir "${NACL_PACKAGES_CACHE}" |
| 678 MakeDir "${NACL_PACKAGES_PUBLISH}" | 679 MakeDir "${NACL_PACKAGES_PUBLISH}" |
| 679 MakeDir "${WORK_DIR}" | 680 MakeDir "${WORK_DIR}" |
| 680 } | 681 } |
| 681 | 682 |
| 682 | 683 |
| 683 PublishByArchForDevEnv() { | |
| 684 MakeDir "${PUBLISH_DIR}" | |
| 685 local ARCH_DIR=${PUBLISH_DIR}/${NACL_ARCH} | |
| 686 MakeDir "${ARCH_DIR}" | |
| 687 # TODO(bradnelson): Drop this once all pors that have executables list them | |
| 688 # explicitly (required for pnacl to work right anyhow). | |
| 689 if [ "${EXECUTABLES:-}" != "" ]; then | |
| 690 local executables="${EXECUTABLES}" | |
| 691 elif [ "${OS_NAME}" != "Darwin" ]; then | |
| 692 # -executable is not supported on BSD and -perm +nn is not | |
| 693 # supported on linux | |
| 694 local executables=$(find . -type f -executable -not -path "*/.git/*") | |
| 695 else | |
| 696 local executables=$(find . -type f -perm +u+x -not -path "*/.git/*") | |
| 697 fi | |
| 698 for nexe in ${executables}; do | |
| 699 local name=$(basename ${nexe}) | |
| 700 name=${name/%.nexe/} | |
| 701 name=${name/%.pexe/} | |
| 702 LogExecute cp "${nexe}" "${ARCH_DIR}/${name}" | |
| 703 # TODO(bradnelson): Do something prettier. | |
| 704 if [[ "$(head -c 2 ${nexe})" != "#!" && \ | |
| 705 "$(head -c 2 ${nexe})" != "# " && \ | |
| 706 "${nexe}" != *.so && \ | |
| 707 "${nexe}" != *.so.* && \ | |
| 708 "${nexe}" != *.txt && \ | |
| 709 "${nexe}" != config.status ]]; then | |
| 710 # Strip non-scripts | |
| 711 LogExecute "${NACLSTRIP}" "${ARCH_DIR}/${name}" | |
| 712 | |
| 713 # Run create_nmf for non-scripts. | |
| 714 # Stage libraries for toolchains that support dynamic linking. | |
| 715 if [[ "${TOOLCHAIN}" = "glibc" || "${TOOLCHAIN}" = "bionic" ]]; then | |
| 716 pushd "${ARCH_DIR}" | |
| 717 # Create a temporary name ending in .nexe so create_nmf does the right | |
| 718 # thing. | |
| 719 LogExecute cp "${name}" tmp.nexe | |
| 720 LogExecute python "${NACL_SDK_ROOT}/tools/create_nmf.py" \ | |
| 721 tmp.nexe -s . -o tmp.nmf ${PUBLISH_CREATE_NMF_ARGS:-} | |
| 722 LogExecute rm tmp.nexe | |
| 723 LogExecute rm tmp.nmf | |
| 724 popd | |
| 725 fi | |
| 726 fi | |
| 727 done | |
| 728 ChangeDir "${ARCH_DIR}" | |
| 729 Remove "${ARCH_DIR}.zip" | |
| 730 LogExecute zip -r "${ARCH_DIR}.zip" . | |
| 731 } | |
| 732 | |
| 733 # | 684 # |
| 734 # Assemble a multi-arch version for use in the devenv packaged app. | 685 # Assemble a multi-arch version for use in the devenv packaged app. |
| 735 # | 686 # |
| 736 # | 687 # |
| 737 PublishMultiArch() { | 688 PublishMultiArch() { |
| 738 local binary=$1 | 689 local binary=$1 |
| 739 local target=$2 | 690 local target=$2 |
| 740 | 691 |
| 741 if [ $# -gt 2 ]; then | 692 if [ $# -gt 2 ]; then |
| 742 local assembly_dir="${PUBLISH_DIR}/$3" | 693 local assembly_dir="${PUBLISH_DIR}/$3" |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1553 local args="" | 1504 local args="" |
| 1554 fi | 1505 fi |
| 1555 # Create packge in temporary location and move into place once | 1506 # Create packge in temporary location and move into place once |
| 1556 # done. This prevents partially created packages from being | 1507 # done. This prevents partially created packages from being |
| 1557 # left lying around if this process is interrupted. | 1508 # left lying around if this process is interrupted. |
| 1558 LogExecute tar cjf "${PACKAGE_FILE}.tmp" -C "${INSTALL_DIR}" ${args} . | 1509 LogExecute tar cjf "${PACKAGE_FILE}.tmp" -C "${INSTALL_DIR}" ${args} . |
| 1559 LogExecute mv -f "${PACKAGE_FILE}.tmp" "${PACKAGE_FILE}" | 1510 LogExecute mv -f "${PACKAGE_FILE}.tmp" "${PACKAGE_FILE}" |
| 1560 } | 1511 } |
| 1561 | 1512 |
| 1562 | 1513 |
| 1563 ZipPublishDir() { | |
| 1564 # If something exists in the publish directory, zip it for download by mingn. | |
| 1565 if [ "${NACLPORTS_QUICKBUILD}" = "1" ]; then | |
| 1566 return | |
| 1567 fi | |
| 1568 | |
| 1569 if [ ! -d "${PUBLISH_DIR}" ]; then | |
| 1570 return | |
| 1571 fi | |
| 1572 | |
| 1573 # If an arch specfic zip already exists (e.g. from PublishByArchForDevEnv) | |
| 1574 # then skip supping the whole publish dir | |
| 1575 if [ -f "${PUBLISH_DIR}/${NACL_ARCH}.zip" ]; then | |
| 1576 return | |
| 1577 fi | |
| 1578 | |
| 1579 # Remove existing zip as it may contain only some architectures. | |
| 1580 Remove "${PUBLISH_DIR}.zip" | |
| 1581 ChangeDir "${PUBLISH_DIR}" | |
| 1582 LogExecute zip -rq "${PUBLISH_DIR}.zip" ./ | |
| 1583 } | |
| 1584 | |
| 1585 | |
| 1586 PackageInstall() { | 1514 PackageInstall() { |
| 1587 RunDownloadStep | 1515 RunDownloadStep |
| 1588 RunPatchStep | 1516 RunPatchStep |
| 1589 RunConfigureStep | 1517 RunConfigureStep |
| 1590 RunBuildStep | 1518 RunBuildStep |
| 1591 RunPostBuildStep | 1519 RunPostBuildStep |
| 1592 RunTestStep | 1520 RunTestStep |
| 1593 RunInstallStep | 1521 RunInstallStep |
| 1594 RunPublishStep | 1522 RunPublishStep |
| 1595 RunPostInstallTestStep | 1523 RunPostInstallTestStep |
| 1596 ZipPublishDir | |
| 1597 PackageStep | 1524 PackageStep |
| 1598 } | 1525 } |
| 1599 | 1526 |
| 1600 | 1527 |
| 1601 NaclportsMain() { | 1528 NaclportsMain() { |
| 1602 local COMMAND=PackageInstall | 1529 local COMMAND=PackageInstall |
| 1603 if [[ $# -gt 0 ]]; then | 1530 if [[ $# -gt 0 ]]; then |
| 1604 COMMAND=Run$1 | 1531 COMMAND=Run$1 |
| 1605 fi | 1532 fi |
| 1606 if [ -d "${BUILD_DIR}" ]; then | 1533 if [ -d "${BUILD_DIR}" ]; then |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1705 # These functions are called when this script is imported to do | 1632 # These functions are called when this script is imported to do |
| 1706 # any essential checking/setup operations. | 1633 # any essential checking/setup operations. |
| 1707 ###################################################################### | 1634 ###################################################################### |
| 1708 CheckToolchain | 1635 CheckToolchain |
| 1709 CheckPatchVersion | 1636 CheckPatchVersion |
| 1710 PatchSpecsFile | 1637 PatchSpecsFile |
| 1711 InjectSystemHeaders | 1638 InjectSystemHeaders |
| 1712 InstallConfigSite | 1639 InstallConfigSite |
| 1713 GetRevision | 1640 GetRevision |
| 1714 MakeDirs | 1641 MakeDirs |
| OLD | NEW |