7 - '.github/workflows/*'
13 - '.github/workflows/*'
21 LIBPLIST_VERSION: 2.2.0
22 OPENSSL_VERSION: 1.1.1n
23 SCCACHE_VERSION: 0.2.15
27 runs-on: ubuntu-latest
34 TOOLCHAIN: ${{ matrix.triple }}-cross
35 TRIPLE: ${{ matrix.triple }}
38 - uses: actions/checkout@v1
42 - uses: actions/cache@v2
47 key: build-linux-${{ matrix.triple }}-${{ env.GITHUB_SHA }}
49 build-linux-${{ matrix.triple }}
51 - name: setup environment
53 export DOWNLOAD_PATH=${HOME}/dep_src
54 export DEP_PATH=${HOME}/build
55 mkdir -p ${DOWNLOAD_PATH} ${DEP_PATH}
56 echo "DOWNLOAD_PATH=${DOWNLOAD_PATH}" >> $GITHUB_ENV
57 echo "DEP_PATH=${DEP_PATH}" >> $GITHUB_ENV
58 echo "ARCH=$(echo ${{ matrix.triple }} | cut -d- -f 1)" >> $GITHUB_ENV
60 - name: setup toolchain
63 wget -q -nc -P ${DOWNLOAD_PATH} https://musl.cc/${TOOLCHAIN}.tgz
64 tar xf ${DOWNLOAD_PATH}/${TOOLCHAIN}.tgz -C ${HOME}
67 wget -q -nc -P ${DOWNLOAD_PATH} \
68 https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz
69 tar xf ${DOWNLOAD_PATH}/sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz -C ${HOME}
70 mv ${HOME}/sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl/sccache ${HOME}/${TOOLCHAIN}/bin
71 chmod +x ${HOME}/${TOOLCHAIN}/bin/sccache
73 echo "${HOME}/${TOOLCHAIN}/bin" >> $GITHUB_PATH
74 echo "CC=sccache ${TRIPLE}-gcc" >> $GITHUB_ENV
75 echo "CXX=sccache ${TRIPLE}-g++" >> $GITHUB_ENV
76 echo "AR=${TRIPLE}-gcc-ar" >> $GITHUB_ENV
77 echo "NM=${TRIPLE}-gcc-nm" >> $GITHUB_ENV
78 echo "RANLIB=${TRIPLE}-gcc-ranlib" >> $GITHUB_ENV
79 echo "CFLAGS=-Os -fPIC -fno-pie -no-pie -static -flto -ffunction-sections -fdata-sections" >> $GITHUB_ENV
80 echo "LDFLAGS=-Wl,--gc-sections -Wl,-strip-all -flto" >> $GITHUB_ENV
82 - name: build libplist
84 wget -q -nc -P ${DOWNLOAD_PATH} https://github.com/libimobiledevice/libplist/releases/download/${LIBPLIST_VERSION}/libplist-${LIBPLIST_VERSION}.tar.bz2
85 tar xf ${DOWNLOAD_PATH}/libplist-${LIBPLIST_VERSION}.tar.bz2 -C ${DEP_PATH}
86 cd ${DEP_PATH}/libplist-${LIBPLIST_VERSION}
87 ./configure --host=${TRIPLE} --prefix=/usr --without-cython --enable-static --disable-shared
90 echo "CPPFLAGS=${CPPFLAGS} -I${DEP_PATH}/libplist-${LIBPLIST_VERSION}/include" >> $GITHUB_ENV
91 echo "LIBPLIST_LIB=${DEP_PATH}/libplist-${LIBPLIST_VERSION}/src/.libs/libplist-2.0.a" >> $GITHUB_ENV
95 export PLATFORM="linux-${ARCH}"
97 wget -q -nc -P ${DOWNLOAD_PATH} https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
98 tar xf ${DOWNLOAD_PATH}/openssl-${OPENSSL_VERSION}.tar.gz -C ${DEP_PATH}
99 cd ${DEP_PATH}/openssl-${OPENSSL_VERSION}
100 ./Configure --prefix=/usr --static -static ${PLATFORM}
101 make -j$(nproc) build_generated libcrypto.a
103 echo "CPPFLAGS=${CPPFLAGS} -I${DEP_PATH}/openssl-${OPENSSL_VERSION}/include" >> $GITHUB_ENV
104 echo "LIBCRYPTO_LIB=${DEP_PATH}/openssl-${OPENSSL_VERSION}/libcrypto.a" >> $GITHUB_ENV
108 export LDID_VERSION=$(echo "$(git describe --tags --abbrev=0)")
110 VERSION="${LDID_VERSION}" \
111 LDFLAGS="-static -static-libstdc++ ${LDFLAGS}" \
112 LIBS="${LIBPLIST_LIB} ${LIBCRYPTO_LIB}"
115 - uses: actions/upload-artifact@v1
117 name: ldid_linux_${{ env.ARCH }}
120 - name: Upload Release Asset Linux
121 uses: actions/upload-release-asset@v1
122 if: ${{ github.event_name == 'release' }}
124 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126 upload_url: ${{ github.event.release.upload_url }}
128 asset_name: ldid_linux_${{ env.ARCH }}
129 asset_content_type: application/octet-stream
139 ARCH: ${{ matrix.arch }}
141 - uses: actions/checkout@v1
143 submodules: recursive
145 - uses: actions/cache@v2
148 ~/Library/Caches/Mozilla.sccache
150 key: build-macos-${{ matrix.arch }}-${ { env.GITHUB_SHA } }
152 build-macos-${{ matrix.arch }}-
154 - name: setup environment
156 export DOWNLOAD_PATH=${HOME}/dep_src
157 export DEP_PATH=${HOME}/build
158 mkdir -p ${DOWNLOAD_PATH} ${DEP_PATH}
159 echo "DOWNLOAD_PATH=${DOWNLOAD_PATH}" >> $GITHUB_ENV
160 echo "DEP_PATH=${DEP_PATH}" >> $GITHUB_ENV
162 if [ "${ARCH}" = "arm64" ]; then
163 echo "HOST_ARCH=aarch64" >> $GITHUB_ENV
165 echo "HOST_ARCH=${ARCH}" >> $GITHUB_ENV
168 - name: setup toolchain
170 brew install libtool autoconf automake
173 wget -nc -P ${DOWNLOAD_PATH} \
174 https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-x86_64-apple-darwin.tar.gz
175 tar xf ${DOWNLOAD_PATH}/sccache-v${SCCACHE_VERSION}-x86_64-apple-darwin.tar.gz -C ${HOME}
176 chmod +x ${HOME}/sccache-v${SCCACHE_VERSION}-x86_64-apple-darwin/sccache
178 echo "${HOME}/sccache-v${SCCACHE_VERSION}-x86_64-apple-darwin" >> $GITHUB_PATH
179 echo "CC=sccache clang -arch ${ARCH} -mmacosx-version-min=10.13" >> $GITHUB_ENV
180 echo "CXX=sccache clang++ -arch ${ARCH} -mmacosx-version-min=10.13" >> $GITHUB_ENV
181 echo "CFLAGS=-Os" >> $GITHUB_ENV
183 - name: build libplist
185 wget -q -nc -P ${DOWNLOAD_PATH} https://github.com/libimobiledevice/libplist/releases/download/${LIBPLIST_VERSION}/libplist-${LIBPLIST_VERSION}.tar.bz2
186 tar xf ${DOWNLOAD_PATH}/libplist-${LIBPLIST_VERSION}.tar.bz2 -C ${DEP_PATH}
187 cd ${DEP_PATH}/libplist-${LIBPLIST_VERSION}
188 ./configure --host=${HOST_ARCH}-apple-darwin --without-cython --enable-static --disable-shared
189 make -j$(sysctl -n hw.ncpu)
191 echo "CFLAGS=${CFLAGS} -I${DEP_PATH}/libplist-${LIBPLIST_VERSION}/include" >> $GITHUB_ENV
192 echo "LIBPLIST_LIB=${DEP_PATH}/libplist-${LIBPLIST_VERSION}/src/.libs/libplist-2.0.a" >> $GITHUB_ENV
194 - name: build openssl
196 wget -q -nc -P ${DOWNLOAD_PATH} https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
197 tar xf ${DOWNLOAD_PATH}/openssl-${OPENSSL_VERSION}.tar.gz -C ${DEP_PATH}
198 cd ${DEP_PATH}/openssl-${OPENSSL_VERSION}
199 ./Configure --prefix=/usr no-shared darwin64-${ARCH}-cc
200 make -j$(sysctl -n hw.ncpu) build_generated libcrypto.a
202 echo "CFLAGS=${CFLAGS} -I${DEP_PATH}/openssl-${OPENSSL_VERSION}/include" >> $GITHUB_ENV
203 echo "LIBCRYPTO_LIB=${DEP_PATH}/openssl-${OPENSSL_VERSION}/libcrypto.a" >> $GITHUB_ENV
207 export LDID_VERSION=$(echo "$(git describe --tags --abbrev=0)")
208 make -j$(sysctl -n hw.ncpu) \
209 CFLAGS="${CFLAGS} -flto=thin" \
210 VERSION="${LDID_VERSION}" \
211 LIBS="${LIBPLIST_LIB} ${LIBCRYPTO_LIB}"
214 - uses: actions/upload-artifact@v1
216 name: ldid_macos_${{ matrix.arch }}
219 - name: Upload Release Asset Linux
220 uses: actions/upload-release-asset@v1
221 if: ${{ github.event_name == 'release' }}
223 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
225 upload_url: ${{ github.event.release.upload_url }}
227 asset_name: ldid_macos_${{ matrix.arch }}
228 asset_content_type: application/octet-stream