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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 # a few months. | 673 # a few months. |
674 if [ ! -d "${NACL_PACKAGES_CACHE}" -a -d "${NACL_PACKAGES_OUT}/tarballs" ]; th
en | 674 if [ ! -d "${NACL_PACKAGES_CACHE}" -a -d "${NACL_PACKAGES_OUT}/tarballs" ]; th
en |
675 mv "${NACL_PACKAGES_OUT}/tarballs" "${NACL_PACKAGES_CACHE}" | 675 mv "${NACL_PACKAGES_OUT}/tarballs" "${NACL_PACKAGES_CACHE}" |
676 fi | 676 fi |
677 MakeDir "${NACL_PACKAGES_CACHE}" | 677 MakeDir "${NACL_PACKAGES_CACHE}" |
678 MakeDir "${NACL_PACKAGES_PUBLISH}" | 678 MakeDir "${NACL_PACKAGES_PUBLISH}" |
679 MakeDir "${WORK_DIR}" | 679 MakeDir "${WORK_DIR}" |
680 } | 680 } |
681 | 681 |
682 | 682 |
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 # | 683 # |
734 # Assemble a multi-arch version for use in the devenv packaged app. | 684 # Assemble a multi-arch version for use in the devenv packaged app. |
735 # | 685 # |
736 # | 686 # |
737 PublishMultiArch() { | 687 PublishMultiArch() { |
738 local binary=$1 | 688 local binary=$1 |
739 local target=$2 | 689 local target=$2 |
740 | 690 |
741 if [ $# -gt 2 ]; then | 691 if [ $# -gt 2 ]; then |
742 local assembly_dir="${PUBLISH_DIR}/$3" | 692 local assembly_dir="${PUBLISH_DIR}/$3" |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1553 local args="" | 1503 local args="" |
1554 fi | 1504 fi |
1555 # Create packge in temporary location and move into place once | 1505 # Create packge in temporary location and move into place once |
1556 # done. This prevents partially created packages from being | 1506 # done. This prevents partially created packages from being |
1557 # left lying around if this process is interrupted. | 1507 # left lying around if this process is interrupted. |
1558 LogExecute tar cjf "${PACKAGE_FILE}.tmp" -C "${INSTALL_DIR}" ${args} . | 1508 LogExecute tar cjf "${PACKAGE_FILE}.tmp" -C "${INSTALL_DIR}" ${args} . |
1559 LogExecute mv -f "${PACKAGE_FILE}.tmp" "${PACKAGE_FILE}" | 1509 LogExecute mv -f "${PACKAGE_FILE}.tmp" "${PACKAGE_FILE}" |
1560 } | 1510 } |
1561 | 1511 |
1562 | 1512 |
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() { | 1513 PackageInstall() { |
1587 RunDownloadStep | 1514 RunDownloadStep |
1588 RunPatchStep | 1515 RunPatchStep |
1589 RunConfigureStep | 1516 RunConfigureStep |
1590 RunBuildStep | 1517 RunBuildStep |
1591 RunPostBuildStep | 1518 RunPostBuildStep |
1592 RunTestStep | 1519 RunTestStep |
1593 RunInstallStep | 1520 RunInstallStep |
1594 RunPublishStep | 1521 RunPublishStep |
1595 RunPostInstallTestStep | 1522 RunPostInstallTestStep |
1596 ZipPublishDir | |
1597 PackageStep | 1523 PackageStep |
1598 } | 1524 } |
1599 | 1525 |
1600 | 1526 |
1601 NaclportsMain() { | 1527 NaclportsMain() { |
1602 local COMMAND=PackageInstall | 1528 local COMMAND=PackageInstall |
1603 if [[ $# -gt 0 ]]; then | 1529 if [[ $# -gt 0 ]]; then |
1604 COMMAND=Run$1 | 1530 COMMAND=Run$1 |
1605 fi | 1531 fi |
1606 if [ -d "${BUILD_DIR}" ]; then | 1532 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 | 1631 # These functions are called when this script is imported to do |
1706 # any essential checking/setup operations. | 1632 # any essential checking/setup operations. |
1707 ###################################################################### | 1633 ###################################################################### |
1708 CheckToolchain | 1634 CheckToolchain |
1709 CheckPatchVersion | 1635 CheckPatchVersion |
1710 PatchSpecsFile | 1636 PatchSpecsFile |
1711 InjectSystemHeaders | 1637 InjectSystemHeaders |
1712 InstallConfigSite | 1638 InstallConfigSite |
1713 GetRevision | 1639 GetRevision |
1714 MakeDirs | 1640 MakeDirs |
OLD | NEW |