diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 583a368..ced7127 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -310,9 +310,191 @@ jobs: name: tsschecker_${{ env.OS }}_${{ env.ARCH }} path: tsschecker/tsschecker${{ env.EXE_SUFFIX }} + build-macos: + runs-on: macos-11 + strategy: + matrix: + arch: + - x86_64 + - arm64 + env: + ARCH: ${{ matrix.arch }} + + steps: + - uses: actions/checkout@v1 + with: + submodules: recursive + + - uses: actions/cache@v2 + with: + path: | + ~/Library/Caches/Mozilla.sccache + ~/dep_src + key: build-macos-${{ matrix.arch }}-${ { env.GITHUB_SHA } } + restore-keys: | + build-macos-${{ matrix.arch }}- + + - name: setup environment + run: | + export DOWNLOAD_PATH=${HOME}/dep_src + export DEP_PATH=${HOME}/build + export ROOT=${HOME}/root + mkdir -p ${DOWNLOAD_PATH} ${DEP_PATH} ${ROOT} + echo "DOWNLOAD_PATH=${DOWNLOAD_PATH}" >> $GITHUB_ENV + echo "DEP_PATH=${DEP_PATH}" >> $GITHUB_ENV + echo "ROOT=${ROOT}" >> $GITHUB_ENV + echo "CPU_COUNT=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV + echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + + 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} \ + https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-x86_64-apple-darwin.tar.gz + 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 + echo "CPPFLAGS=-I${ROOT}/usr/include" >> $GITHUB_ENV + echo "LDFLAGS=-L${ROOT}/usr/lib" >> $GITHUB_ENV + echo "PKG_CONFIG_PATH=${ROOT}/usr/lib/pkgconfig" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=${ROOT}/usr/lib" >> $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 --prefix=/usr --without-cython --enable-static --disable-shared + make -j${CPU_COUNT} + make install DESTDIR="${ROOT}" + + - name: build libirecovery + run: | + wget -q -nc -P ${DOWNLOAD_PATH} https://github.com/libimobiledevice/libirecovery/releases/download/${LIBIRECOVERY_VERSION}/libirecovery-${LIBIRECOVERY_VERSION}.tar.bz2 + tar xf ${DOWNLOAD_PATH}/libirecovery-${LIBIRECOVERY_VERSION}.tar.bz2 -C ${DEP_PATH} + cd ${DEP_PATH}/libirecovery-${LIBIRECOVERY_VERSION} + wget https://gist.github.com/1Conan/2d015aad17f87f171b32ebfd9f48fb96/raw/c12fca047f8b0bba1c8983470bf863d80d7e1c1d/libirecovery.patch + patch -p1 < libirecovery.patch + glibtoolize --force + aclocal -I m4 + autoheader + automake --add-missing + autoconf + ./configure --host=${HOST_ARCH}-apple-darwin --prefix=/usr --enable-static --disable-shared --with-dummy + make -j${CPU_COUNT} + make install DESTDIR="${ROOT}" + + - name: build zlib + run: | + wget -q -nc -P ${DOWNLOAD_PATH} https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz + tar xf ${DOWNLOAD_PATH}/zlib-${ZLIB_VERSION}.tar.gz -C ${DEP_PATH} + cd ${DEP_PATH}/zlib-${ZLIB_VERSION} + ./configure --static --prefix=/usr + make -j${CPU_COUNT} + make install DESTDIR="${ROOT}" + + - name: build libcurl + run: | + wget -q -nc -P ${DOWNLOAD_PATH} https://curl.haxx.se/download/curl-${LIBCURL_VERSION}.tar.gz + tar xf ${DOWNLOAD_PATH}/curl-${LIBCURL_VERSION}.tar.gz -C ${DEP_PATH} + cd ${DEP_PATH}/curl-${LIBCURL_VERSION} + ./configure \ + --host=${HOST_ARCH}-apple-darwin \ + --prefix=/usr \ + --enable-static \ + --disable-shared \ + --enable-ipv6 \ + --disable-dependency-tracking \ + --with-zlib=${ROOT}/usr \ + --with-secure-transport \ + --without-ca-bundle \ + --without-ca-path \ + --without-zstd \ + --without-brotli \ + --disable-ldap \ + --disable-ldaps \ + --without-libidn2 \ + --without-nghttp2 \ + --without-librtmp + make -j${CPU_COUNT} + make install DESTDIR="${ROOT}" + + - name: build libzip + run: | + wget -q -nc -P ${DOWNLOAD_PATH} https://libzip.org/download/libzip-${LIBZIP_VERSION}.tar.gz + tar xf ${DOWNLOAD_PATH}/libzip-${LIBZIP_VERSION}.tar.gz -C ${DEP_PATH} + cd ${DEP_PATH}/libzip-${LIBZIP_VERSION} + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CROSSCOMPILING=true \ + -DCMAKE_SYSTEM_NAME=Darwin \ + -DCMAKE_SYSTEM_PROCESSOR="${HOST_ARCH}" \ + -DCMAKE_C_FLAGS="${CFLAGS}" \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ + -DCMAKE_OSX_ARCHITECTURES="${ARCH}" \ + -DCMAKE_FIND_ROOT_PATH="${ROOT}" \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_FIND_LIBRARY_SUFFIXES=".a" \ + -DENABLE_BZIP2=FALSE \ + -DENABLE_LZMA=FALSE \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DSKIP_BUILD_RPATH=TRUE + + make -j${CPU_COUNT} + make install DESTDIR="${ROOT}" + + - name: build libgeneral + run: | + rm -rf ${DEP_PATH}/libgeneral + git clone https://github.com/tihmstar/libgeneral ${DEP_PATH}/libgeneral + cd ${DEP_PATH}/libgeneral + git checkout ${LIBGENERAL_COMMIT} + + ./autogen.sh --host=${HOST_ARCH}-apple-darwin --enable-static --disable-shared --prefix=/usr + make -j$(nproc) + make install DESTDIR="${ROOT}" + + - name: build libfragmentzip + run: | + rm -rf ${DEP_PATH}/libfragmentzip + git clone https://github.com/tihmstar/libfragmentzip.git ${DEP_PATH}/libfragmentzip + cd ${DEP_PATH}/libfragmentzip + ./autogen.sh curl_LIBS="${ROOT}/usr/lib/libcurl.a" \ + --host=${HOST_ARCH}-apple-darwin \ + --prefix=/usr \ + --enable-static \ + --disable-shared + make -j$(nproc) + make install DESTDIR="${ROOT}" + + - name: build tsschecker + run: | + ./autogen.sh --host=${HOST_ARCH}-apple-darwin --enable-static --disable-shared + + make LDFLAGS="-all-static ${LDFLAGS}" + strip tsschecker/tsschecker + + - uses: actions/upload-artifact@v1 + with: + name: tsschecker_macos_${{ env.ARCH }} + path: tsschecker/tsschecker + release: runs-on: ubuntu-latest - needs: [build-win-lin] + needs: [build-win-lin, build-macos] steps: - uses: actions/checkout@v1