-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
268 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,268 @@ | ||
name: build | ||
on: | ||
release: | ||
types: | ||
- created | ||
|
||
env: | ||
LIBPLIST_VERSION: 2.2.0 | ||
OPENSSL_VERSION: 3.0.0 | ||
|
||
jobs: | ||
build-linux: | ||
runs-on: ubuntu-latest | ||
env: | ||
TOOLCHAIN: x86_64-linux-musl-cross | ||
TRIPLE: x86_64-linux-musl | ||
steps: | ||
- uses: actions/checkout@v1 | ||
with: | ||
submodules: recursive | ||
|
||
- name: cache files | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.ccache | ||
~/dep_src | ||
key: build-linux-${ { env.GITHUB_SHA } } | ||
restore-keys: | | ||
build-linux- | ||
- 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 "LDID_VERSION=$(echo "$(git describe --tags --abbrev=0)")" >> $GITHUB_ENV | ||
- name: setup toolchain | ||
run: | | ||
sudo apt-get install -y ccache | ||
wget -q -nc -P ${DOWNLOAD_PATH} https://musl.cc/${TOOLCHAIN}.tgz | ||
tar xf ${DOWNLOAD_PATH}/${TOOLCHAIN}.tgz -C ${HOME} | ||
echo "${HOME}/${TOOLCHAIN}/bin" >> $GITHUB_PATH | ||
echo "CC=ccache ${TRIPLE}-gcc" >> $GITHUB_ENV | ||
echo "CXX=ccache ${TRIPLE}-g++" >> $GITHUB_ENV | ||
echo "CFLAGS=-static -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=${TRIPLE} --prefix=/usr --without-cython --enable-static --disable-shared | ||
make -j$(nproc) | ||
make install DESTDIR="${ROOT}" | ||
- 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 --libdir=/usr/lib --openssldir=/etc/ssl --static -static | ||
make -j$(nproc) | ||
make install_sw DESTDIR="${ROOT}" | ||
- name: build | ||
run: | | ||
${CC} ${CFLAGS} -Os -c -o lookup2.o lookup2.c | ||
${CXX} ${CFLAGS} -Os -c -o ldid.o ldid.cpp -std=c++11 -DLDID_VERSION=\"${LDID_VERSION}\" | ||
${CXX} -Os -std=c++11 ldid.o lookup2.o ${ROOT}/usr/lib/libplist-2.0.a ${ROOT}/usr/lib/libcrypto.a -o ldid | ||
${TRIPLE}-strip ldid | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: ldid_linux | ||
path: ldid | ||
|
||
build-macos-x86_64: | ||
runs-on: macos-11 | ||
steps: | ||
- uses: actions/checkout@v1 | ||
with: | ||
submodules: recursive | ||
|
||
- name: ccache cache files | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.ccache | ||
~/dep_src | ||
key: build-macos-x86_64-${ { env.GITHUB_SHA } } | ||
restore-keys: | | ||
build-macos-x86_64- | ||
- 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 "LDID_VERSION=$(echo "$(git describe --tags --abbrev=0)")" >> $GITHUB_ENV | ||
- name: setup toolchain | ||
run: | | ||
brew install ccache libtool autoconf automake | ||
echo "CC=ccache clang -arch x86_64 -mmacosx-version-min=10.13" >> $GITHUB_ENV | ||
echo "CXX=ccache clang++ -arch x86_64 -mmacosx-version-min=10.13" >> $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 --prefix=/usr --without-cython --enable-static --disable-shared --host=x86_64-apple-darwin | ||
make -j$(sysctl -n hw.ncpu) | ||
make install DESTDIR="${ROOT}" | ||
- 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 --libdir=/usr/lib --openssldir=/etc/ssl no-shared darwin64-x86_64 | ||
make -j$(sysctl -n hw.ncpu) | ||
make install_sw DESTDIR="${ROOT}" | ||
- name: build | ||
run: | | ||
${CC} ${CPPFLAGS} ${CFLAGS} -flto=thin -Os -c -o lookup2.o lookup2.c | ||
${CXX} ${CPPFLAGS} ${CFLAGS} -flto=thin -Os -c -o ldid.o ldid.cpp -std=c++11 -DLDID_VERSION=\"${LDID_VERSION}\" | ||
${CXX} ${ROOT}/usr/lib/libplist-2.0.a ${ROOT}/usr/lib/libcrypto.a -flto=thin -Os -std=c++11 ldid.o lookup2.o -o ldid | ||
strip ldid | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: ldid_macos_x86_64 | ||
path: ldid | ||
|
||
build-macos-arm64: | ||
runs-on: macos-11 | ||
steps: | ||
- uses: actions/checkout@v1 | ||
with: | ||
submodules: recursive | ||
|
||
- name: ccache cache files | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.ccache | ||
~/dep_src | ||
key: build-macos-arm64-${ { env.GITHUB_SHA } } | ||
restore-keys: | | ||
build-macos-arm64- | ||
- 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 "LDID_VERSION=$(echo "$(git describe --tags --abbrev=0)")" >> $GITHUB_ENV | ||
- name: setup toolchain | ||
run: | | ||
brew install ccache libtool autoconf automake | ||
echo "CC=ccache clang -arch arm64 -mmacosx-version-min=11.0" >> $GITHUB_ENV | ||
echo "CXX=ccache clang++ -arch arm64 -mmacosx-version-min=11.0" >> $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 --prefix=/usr --without-cython --enable-static --disable-shared --host=aarch64-apple-darwin | ||
make -j$(sysctl -n hw.ncpu) | ||
make install DESTDIR="${ROOT}" | ||
- 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 --libdir=/usr/lib --openssldir=/etc/ssl no-shared darwin64-arm64 | ||
make -j$(sysctl -n hw.ncpu) | ||
make install_sw DESTDIR="${ROOT}" | ||
- name: build | ||
run: | | ||
${CC} ${CPPFLAGS} ${CFLAGS} -flto=thin -Os -c -o lookup2.o lookup2.c | ||
${CXX} ${CPPFLAGS} ${CFLAGS} -flto=thin -Os -c -o ldid.o ldid.cpp -std=c++11 -DLDID_VERSION=\"${LDID_VERSION}\" | ||
${CXX} ${ROOT}/usr/lib/libplist-2.0.a ${ROOT}/usr/lib/libcrypto.a -flto=thin -Os -std=c++11 ldid.o lookup2.o -o ldid | ||
strip ldid | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: ldid_macos_arm64 | ||
path: ldid | ||
|
||
releases: | ||
runs-on: ubuntu-latest | ||
needs: [build-linux, build-macos-x86_64, build-macos-arm64] | ||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Download linux artifact | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: ldid_linux | ||
path: ldid_linux | ||
- name: Download macos-x86_64 artifact | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: ldid_macos_x86_64 | ||
path: ldid_macos_x86_64 | ||
- name: Download macos-arm64 artifact | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: ldid_macos_arm64 | ||
path: ldid_macos_arm64 | ||
|
||
- name: Upload Release Asset linux | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ./ldid_linux/ldid | ||
asset_name: ldid_linux | ||
asset_content_type: application/octet-stream | ||
- name: Upload Release Asset macos x86_64 | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ./ldid_macos_x86_64/ldid | ||
asset_name: ldid_macos_x86_64 | ||
asset_content_type: application/octet-stream | ||
- name: Upload Release Asset macos arm64 | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ./ldid_macos_arm64/ldid | ||
asset_name: ldid_macos_arm64 | ||
asset_content_type: application/octet-stream |