[libcxx-commits] [libcxx] d6c95ae - [libc++] Update scripts to build libc++/libc++abi for Apple

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 23 11:31:20 PDT 2020


Author: Louis Dionne
Date: 2020-04-23T14:31:04-04:00
New Revision: d6c95ae6ffb50bba9b110c4f86c17c054c305e07

URL: https://github.com/llvm/llvm-project/commit/d6c95ae6ffb50bba9b110c4f86c17c054c305e07
DIFF: https://github.com/llvm/llvm-project/commit/d6c95ae6ffb50bba9b110c4f86c17c054c305e07.diff

LOG: [libc++] Update scripts to build libc++/libc++abi for Apple

Also, make sure we test them.

Added: 
    

Modified: 
    libcxx/utils/ci/apple-install-libcxx.sh
    libcxx/utils/ci/apple-install-libcxxabi.sh
    libcxx/utils/ci/macos-trunk.sh

Removed: 
    


################################################################################
diff  --git a/libcxx/utils/ci/apple-install-libcxx.sh b/libcxx/utils/ci/apple-install-libcxx.sh
index 1337ca2c271f..b10f0a1578ba 100755
--- a/libcxx/utils/ci/apple-install-libcxx.sh
+++ b/libcxx/utils/ci/apple-install-libcxx.sh
@@ -10,33 +10,38 @@
 set -e
 
 PROGNAME="$(basename "${0}")"
+
+function error() { printf "error: %s\n" "$*"; exit 1; }
+
 function usage() {
 cat <<EOF
 Usage:
-${PROGNAME} [-h|--help] --llvm-root <DIR> --build-dir <DIR> --install-dir <DIR> --symbols-dir <DIR> --sdk <SDK> --architectures <architectures...> --version <X.Y.Z> --cache <PATH>
+${PROGNAME} [options]
 
---llvm-root     Full path to the root of the LLVM monorepo. Only the libcxx
-                and libcxxabi directories are required.
+[-h|--help]                  Display this help and exit.
 
---build-dir     Directory to use for building. This will contain intermediate
-                build products.
+--llvm-root <DIR>            Full path to the root of the LLVM monorepo. Only the libcxx
+                             and libcxxabi directories are required.
 
---install-dir   Directory to install the library to.
+--build-dir <DIR>            Full path to the directory to use for building. This will
+                             contain intermediate build products.
 
---symbols-dir   Directory to install the .dSYM bundle to.
+--install-dir <DIR>          Full path to the directory to install the library to.
 
---sdk           SDK used for building the library. This represents the target
-                platform that the library will run on. You can get a list of
-                SDKs with \`xcodebuild -showsdks\`.
+--symbols-dir <DIR>          Full path to the directory to install the .dSYM bundle to.
 
---architectures A whitespace separated list of architectures to build for.
-                The library will be built for each architecture independently,
-                and a universal binary containing all architectures will be
-                created from that.
+--sdk <SDK>                  SDK used for building the library. This represents
+                             the target platform that the library will run on.
+                             You can get a list of SDKs with \`xcodebuild -showsdks\`.
 
---version       The version of the library to encode in the dylib.
+--architectures "<arch>..."  A whitespace separated list of architectures to build for.
+                             The library will be built for each architecture independently,
+                             and a universal binary containing all architectures will be
+                             created from that.
 
---cache         The CMake cache to use to control how the library gets built.
+--version X[.Y[.Z]]          The version of the library to encode in the dylib.
+
+--cache <PATH>               The CMake cache to use to control how the library gets built.
 EOF
 }
 
@@ -67,15 +72,8 @@ while [[ $# -gt 0 ]]; do
             shift; shift
             ;;
         --architectures)
-            architectures=""
-            shift
-            while [[ $# -gt 0 ]]; do
-                if [[ "${1}" == "-"* ]]; then
-                    break
-                fi
-                architectures+=" ${1}"
-                shift
-            done
+            architectures="${2}"
+            shift; shift
             ;;
         --version)
             version="${2}"
@@ -86,19 +84,16 @@ while [[ $# -gt 0 ]]; do
             shift; shift
             ;;
         *)
-            echo "Unknown argument '${1}'"
-            exit 1
+            error "Unknown argument '${1}'"
             ;;
     esac
 done
 
 for arg in llvm_root build_dir symbols_dir install_dir sdk architectures version cache; do
     if [ -z ${!arg+x} ]; then
-        echo "Missing required argument '--${arg//_/-}'"
-        exit 1
+        error "Missing required argument '--${arg//_/-}'"
     elif [ "${!arg}" == "" ]; then
-        echo "Argument to --${arg//_/-} must not be empty"
-        exit 1
+        error "Argument to --${arg//_/-} must not be empty"
     fi
 done
 

diff  --git a/libcxx/utils/ci/apple-install-libcxxabi.sh b/libcxx/utils/ci/apple-install-libcxxabi.sh
index cf1e462b3225..04173b2adbeb 100755
--- a/libcxx/utils/ci/apple-install-libcxxabi.sh
+++ b/libcxx/utils/ci/apple-install-libcxxabi.sh
@@ -10,33 +10,38 @@
 set -e
 
 PROGNAME="$(basename "${0}")"
+
+function error() { printf "error: %s\n" "$*"; exit 1; }
+
 function usage() {
 cat <<EOF
 Usage:
-${PROGNAME} [-h|--help] --llvm-root <DIR> --build-dir <DIR> --install-dir <DIR> --symbols-dir <DIR> --sdk <SDK> --architectures <architectures...> --version <X.Y.Z> --cache <PATH>
+${PROGNAME} [options]
 
---llvm-root     Full path to the root of the LLVM monorepo. Only the libcxx
-                and libcxxabi directories are required.
+[-h|--help]                  Display this help and exit.
 
---build-dir     Directory to use for building. This will contain intermediate
-                build products.
+--llvm-root <DIR>            Full path to the root of the LLVM monorepo. Only the libcxx
+                             and libcxxabi directories are required.
 
---install-dir   Directory to install the library to.
+--build-dir <DIR>            Full path to the directory to use for building. This will
+                             contain intermediate build products.
 
---symbols-dir   Directory to install the .dSYM bundle to.
+--install-dir <DIR>          Full path to the directory to install the library to.
 
---sdk           SDK used for building the library. This represents the target
-                platform that the library will run on. You can get a list of
-                SDKs with \`xcodebuild -showsdks\`.
+--symbols-dir <DIR>          Full path to the directory to install the .dSYM bundle to.
 
---architectures A whitespace separated list of architectures to build for.
-                The library will be built for each architecture independently,
-                and a universal binary containing all architectures will be
-                created from that.
+--sdk <SDK>                  SDK used for building the library. This represents
+                             the target platform that the library will run on.
+                             You can get a list of SDKs with \`xcodebuild -showsdks\`.
 
---version       The version of the library to encode in the dylib.
+--architectures "<arch>..."  A whitespace separated list of architectures to build for.
+                             The library will be built for each architecture independently,
+                             and a universal binary containing all architectures will be
+                             created from that.
 
---cache         The CMake cache to use to control how the library gets built.
+--version X[.Y[.Z]]          The version of the library to encode in the dylib.
+
+--cache <PATH>               The CMake cache to use to control how the library gets built.
 EOF
 }
 
@@ -67,15 +72,8 @@ while [[ $# -gt 0 ]]; do
             shift; shift
             ;;
         --architectures)
-            architectures=""
-            shift
-            while [[ $# -gt 0 ]]; do
-                if [[ "${1}" == "-"* ]]; then
-                    break
-                fi
-                architectures+=" ${1}"
-                shift
-            done
+            architectures="${2}"
+            shift; shift
             ;;
         --version)
             version="${2}"
@@ -86,19 +84,16 @@ while [[ $# -gt 0 ]]; do
             shift; shift
             ;;
         *)
-            echo "Unknown argument '${1}'"
-            exit 1
+            error "Unknown argument '${1}'"
             ;;
     esac
 done
 
 for arg in llvm_root build_dir symbols_dir install_dir sdk architectures version cache; do
     if [ -z ${!arg+x} ]; then
-        echo "Missing required argument '--${arg//_/-}'"
-        exit 1
+        error "Missing required argument '--${arg//_/-}'"
     elif [ "${!arg}" == "" ]; then
-        echo "Argument to --${arg//_/-} must not be empty"
-        exit 1
+        error "Argument to --${arg//_/-} must not be empty"
     fi
 done
 

diff  --git a/libcxx/utils/ci/macos-trunk.sh b/libcxx/utils/ci/macos-trunk.sh
index 7a5ee75e2b5e..ea6a9b435b5a 100755
--- a/libcxx/utils/ci/macos-trunk.sh
+++ b/libcxx/utils/ci/macos-trunk.sh
@@ -4,7 +4,7 @@ set -ue
 
 function usage() {
   cat <<EOM
-$(basename ${0}) [-h|--help] --monorepo-root <MONOREPO-ROOT> --std <STD> --arch <ARCHITECTURE> [--lit-args <ARGS...>]
+$(basename ${0}) [-h|--help] --monorepo-root <MONOREPO-ROOT> --std <STD> --arch <ARCHITECTURE> --libcxx-exceptions <ON|OFF> [--lit-args <ARGS...>]
 
 This script is used to continually test libc++ and libc++abi trunk on MacOS.
 
@@ -130,3 +130,28 @@ echo "@@@@@@"
 echo "@@@ Running tests for libc++abi @@@"
 ninja -C "${LLVM_BUILD_DIR}" check-cxxabi
 echo "@@@@@@"
+
+
+# TODO: In the future, we should only build that way, and we should run the
+#       test suite against those.
+echo "@@@ Building libc++ and libc++abi using the Apple script (to make sure they work) @@@"
+"${MONOREPO_ROOT}/libcxx/utils/ci/apple-install-libcxx.sh"      \
+    --llvm-root "${MONOREPO_ROOT}"                              \
+    --build-dir "${LLVM_BUILD_DIR}/apple-build-cxx"             \
+    --install-dir "${LLVM_BUILD_DIR}/apple-install-cxx"         \
+    --symbols-dir "${LLVM_BUILD_DIR}/apple-symbols-cxx"         \
+    --sdk macosx                                                \
+    --architectures "x86_64"                                    \
+    --version 999.99.99                                         \
+    --cache "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake"
+
+"${MONOREPO_ROOT}/libcxx/utils/ci/apple-install-libcxxabi.sh"   \
+    --llvm-root "${MONOREPO_ROOT}"                              \
+    --build-dir "${LLVM_BUILD_DIR}/apple-build-cxxabi"          \
+    --install-dir "${LLVM_BUILD_DIR}/apple-install-cxxabi"      \
+    --symbols-dir "${LLVM_BUILD_DIR}/apple-symbols-cxxabi"      \
+    --sdk macosx                                                \
+    --architectures "x86_64"                                    \
+    --version 999.99.99                                         \
+    --cache "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake"
+echo "@@@@@@"


        


More information about the libcxx-commits mailing list