]> git.cameronkatri.com Git - ldid.git/commitdiff
Fix macOS actions (#9)
authorCameron Katri <me@cameronkatri.com>
Tue, 22 Mar 2022 11:16:43 +0000 (07:16 -0400)
committerGitHub <noreply@github.com>
Tue, 22 Mar 2022 11:16:43 +0000 (07:16 -0400)
.github/workflows/build.yml

index 7e5090e7d44467fe681f05db3fc5634c72e87b5c..1358e181ea7a1269bcf02aaa0a1ef5e64e4fc15d 100644 (file)
@@ -157,14 +157,40 @@ jobs:
         submodules: recursive
 
     - uses: actions/cache@v2
+      id: cache
       with:
         path: |
           ~/Library/Caches/Mozilla.sccache
           ~/dep_src
+          ~/__cache
         key: build-macos-${{ matrix.arch }}-${ { env.GITHUB_SHA } }
         restore-keys: |
           build-macos-${{ matrix.arch }}-
 
+    - name: Setup Procursus Bootstrap (install)
+      if: steps.cache.outpus.cache-hit != 'true'
+      run: |
+        wget https://apt.procurs.us/bootstrap_darwin-amd64.tar.zst https://apt.procurs.us/Toolchain12_5.tzst
+        sudo gtar --preserve-permissions -xkf ./bootstrap_darwin-amd64.tar.zst -C /
+        echo '/opt/procursus/sbin:/opt/procursus/bin' >> $GITHUB_PATH
+        PATH=/opt/procursus/sbin:/opt/procursus/bin:$PATH sudo /opt/procursus/bin/apt update
+        sudo /opt/procursus/bin/apt -V dist-upgrade -y || :
+        sudo /opt/procursus/bin/apt -V dist-upgrade -y
+        sudo /opt/procursus/bin/apt install -y libssl-dev libplist-dev
+
+    - name: Add Procursus to PATH
+      run: |
+        echo '/opt/procursus/sbin:/opt/procursus/bin' >> $GITHUB_PATH
+
+    - name: Setup Procursus Bootstrap (cache)
+      if: steps.cache.outputs.cache-hit == 'true'
+      run: |
+        sudo mkdir -p ~/__cache/procursus/var/cache/apt/archives/partial ~/__cache/procursus/var/lib/apt/lists/partial
+        sudo rsync -aP ~/__cache/procursus /opt
+        sudo /opt/procursus/bin/apt update
+        sudo /opt/procursus/bin/apt -V dist-upgrade -y
+        sudo /opt/procursus/bin/apt -V dist-upgrade -y
+
     - name: setup environment
       run: |
         export DOWNLOAD_PATH=${HOME}/dep_src
@@ -173,15 +199,8 @@ jobs:
         echo "DOWNLOAD_PATH=${DOWNLOAD_PATH}" >> $GITHUB_ENV
         echo "DEP_PATH=${DEP_PATH}" >> $GITHUB_ENV
 
-        if [ "${ARCH}" = "arm64" ]; then
-          echo "HOST_ARCH=aarch64" >> $GITHUB_ENV
-        else
-          echo "HOST_ARCH=${ARCH}" >> $GITHUB_ENV
-        fi
-
     - name: setup toolchain
       run: |
-        brew install libtool autoconf automake
 
         # Download sccache
         wget -nc -P ${DOWNLOAD_PATH} \
@@ -189,40 +208,31 @@ jobs:
         tar xf ${DOWNLOAD_PATH}/sccache-v${SCCACHE_VERSION}-x86_64-apple-darwin.tar.gz -C ${HOME}
         chmod +x ${HOME}/sccache-v${SCCACHE_VERSION}-x86_64-apple-darwin/sccache
 
-        echo "${HOME}/sccache-v${SCCACHE_VERSION}-x86_64-apple-darwin" >> $GITHUB_PATH
-        echo "CC=sccache clang -arch ${ARCH} -mmacosx-version-min=10.13" >> $GITHUB_ENV
-        echo "CXX=sccache clang++ -arch ${ARCH} -mmacosx-version-min=10.13" >> $GITHUB_ENV
-        echo "CFLAGS=-Os" >> $GITHUB_ENV
-
-    - name: build libplist
-      run: |
-        wget -q -nc -P ${DOWNLOAD_PATH} https://github.com/libimobiledevice/libplist/releases/download/${LIBPLIST_VERSION}/libplist-${LIBPLIST_VERSION}.tar.bz2
-        tar xf ${DOWNLOAD_PATH}/libplist-${LIBPLIST_VERSION}.tar.bz2 -C ${DEP_PATH}
-        cd ${DEP_PATH}/libplist-${LIBPLIST_VERSION}
-        ./configure --host=${HOST_ARCH}-apple-darwin --without-cython --enable-static --disable-shared
-        make -j$(sysctl -n hw.ncpu)
-
-        echo "CFLAGS=${CFLAGS} -I${DEP_PATH}/libplist-${LIBPLIST_VERSION}/include" >> $GITHUB_ENV
-        echo "LIBPLIST_LIB=${DEP_PATH}/libplist-${LIBPLIST_VERSION}/src/.libs/libplist-2.0.a" >> $GITHUB_ENV
-
-    - name: build openssl
-      run: |
-        wget -q -nc -P ${DOWNLOAD_PATH} https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
-        tar xf ${DOWNLOAD_PATH}/openssl-${OPENSSL_VERSION}.tar.gz -C ${DEP_PATH}
-        cd ${DEP_PATH}/openssl-${OPENSSL_VERSION}
-        ./config --prefix=/usr no-shared darwin64-${ARCH}
-        make -j$(sysctl -n hw.ncpu) build_generated libcrypto.a
+        if [ "${ARCH}" = "arm64" ]; then
+          wget -nc -P ${DOWNLOAD_PATH} \
+            https://apt.procurs.us/pool/main/big_sur/libssl-dev_${OPENSSL_VERSION}_darwin-arm64.deb
+          dpkg -x ${DOWNLOAD_PATH}/libssl-dev_${OPENSSL_VERSION}_darwin-arm64.deb ${DEP_PATH}
+          wget -nc -P ${DOWNLOAD_PATH} \
+            https://apt.procurs.us/pool/main/big_sur/libplist-dev_${LIBPLIST_VERSION}_darwin-arm64.deb
+          dpkg -x ${DOWNLOAD_PATH}/libplist-dev_${LIBPLIST_VERSION}_darwin-arm64.deb ${DEP_PATH}
+          echo "LIBS=${DEP_PATH}/opt/procursus/lib/libplist-2.0.a ${DEP_PATH}/opt/procursus/lib/libcrypto.a" >> $GITHUB_ENV
+        else
+          echo "LIBS=/opt/procursus/lib/libplist-2.0.a /opt/procursus/lib/libcrypto.a" >> $GITHUB_ENV
+        fi
 
-        echo "CFLAGS=${CFLAGS} -I${DEP_PATH}/openssl-${OPENSSL_VERSION}/include" >> $GITHUB_ENV
-        echo "LIBCRYPTO_LIB=${DEP_PATH}/openssl-${OPENSSL_VERSION}/libcrypto.a" >> $GITHUB_ENV
+        echo "${HOME}/sccache-v${SCCACHE_VERSION}-x86_64-apple-darwin" >> $GITHUB_PATH
+        echo "CC=sccache clang -arch ${ARCH} -mmacosx-version-min=11.0" >> $GITHUB_ENV
+        echo "CXX=sccache clang++ -arch ${ARCH} -mmacosx-version-min=11.0" >> $GITHUB_ENV
+        echo "CFLAGS=-Os -I/opt/procursus/include -flto=thin" >> $GITHUB_ENV
 
     - name: build
       run: |
         export LDID_VERSION=$(echo "$(git describe --tags --abbrev=0)")
         make -j$(sysctl -n hw.ncpu) \
-          CFLAGS="${CFLAGS} -flto=thin" \
+          CFLAGS="${CFLAGS}" \
+          CXXFLAGS="${CFLAGS} -std=c++11" \
           VERSION="${LDID_VERSION}" \
-          LIBS="${LIBPLIST_LIB} ${LIBCRYPTO_LIB}"
+          LIBS="${LIBS}"
         strip ldid
 
     - uses: actions/upload-artifact@v1