build.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. name: build
  2. on:
  3. push:
  4. pull_request:
  5. schedule:
  6. - cron: '0 0 1 * *'
  7. jobs:
  8. build-linux-ubuntu:
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: install dependencies
  12. run: |
  13. sudo apt-get update
  14. sudo apt-get install libzip-dev libcurl4-openssl-dev libusb-1.0-0-dev
  15. - name: prepare environment
  16. run: |
  17. echo "target_triplet=`gcc -dumpmachine`" >> $GITHUB_ENV
  18. - name: fetch libirecovery
  19. uses: dawidd6/action-download-artifact@v6
  20. with:
  21. github_token: ${{secrets.GITHUB_TOKEN}}
  22. workflow: build.yml
  23. name: libirecovery-latest_${{env.target_triplet}}
  24. repo: libimobiledevice/libirecovery
  25. - name: fetch libplist
  26. uses: dawidd6/action-download-artifact@v6
  27. with:
  28. github_token: ${{secrets.GITHUB_TOKEN}}
  29. workflow: build.yml
  30. name: libplist-latest_${{env.target_triplet}}
  31. repo: libimobiledevice/libplist
  32. - name: fetch libusbmuxd
  33. uses: dawidd6/action-download-artifact@v6
  34. with:
  35. github_token: ${{secrets.GITHUB_TOKEN}}
  36. workflow: build.yml
  37. name: libusbmuxd-latest_${{env.target_triplet}}
  38. repo: libimobiledevice/libusbmuxd
  39. - name: fetch libimobiledevice-glue
  40. uses: dawidd6/action-download-artifact@v6
  41. with:
  42. github_token: ${{secrets.GITHUB_TOKEN}}
  43. workflow: build.yml
  44. name: libimobiledevice-glue-latest_${{env.target_triplet}}
  45. repo: libimobiledevice/libimobiledevice-glue
  46. - name: fetch libimobiledevice
  47. uses: dawidd6/action-download-artifact@v6
  48. with:
  49. github_token: ${{secrets.GITHUB_TOKEN}}
  50. workflow: build.yml
  51. name: libimobiledevice-latest_${{env.target_triplet}}
  52. repo: libimobiledevice/libimobiledevice
  53. - name: fetch libtatsu
  54. uses: dawidd6/action-download-artifact@v6
  55. with:
  56. github_token: ${{secrets.GITHUB_TOKEN}}
  57. workflow: build.yml
  58. name: libtatsu-latest_${{env.target_triplet}}
  59. repo: libimobiledevice/libtatsu
  60. - name: install external dependencies
  61. run: |
  62. mkdir extract
  63. for I in *.tar; do
  64. tar -C extract -xvf $I
  65. done
  66. rm -rf extract/lib
  67. sudo cp -r extract/* /
  68. sudo ldconfig
  69. - uses: actions/checkout@v4
  70. with:
  71. fetch-depth: 0
  72. - name: autogen
  73. run: ./autogen.sh PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
  74. - name: make
  75. run: make
  76. - name: make install
  77. run: sudo make install
  78. - name: prepare artifact
  79. run: |
  80. mkdir -p dest
  81. DESTDIR=`pwd`/dest make install
  82. tar -C dest -cf idevicerestore.tar usr
  83. - name: publish artifact
  84. uses: actions/upload-artifact@v4
  85. with:
  86. name: idevicerestore-latest_${{env.target_triplet}}
  87. path: idevicerestore.tar
  88. build-macOS:
  89. runs-on: macOS-latest
  90. steps:
  91. - name: install dependencies
  92. run: |
  93. if test -x "`which port`"; then
  94. sudo port install libtool autoconf automake pkgconfig
  95. else
  96. brew install libtool autoconf automake pkgconfig
  97. fi
  98. shell: bash
  99. - name: fetch libirecovery
  100. uses: dawidd6/action-download-artifact@v6
  101. with:
  102. github_token: ${{secrets.GITHUB_TOKEN}}
  103. workflow: build.yml
  104. name: libirecovery-latest_macOS
  105. repo: libimobiledevice/libirecovery
  106. - name: fetch libplist
  107. uses: dawidd6/action-download-artifact@v6
  108. with:
  109. github_token: ${{secrets.GITHUB_TOKEN}}
  110. workflow: build.yml
  111. name: libplist-latest_macOS
  112. repo: libimobiledevice/libplist
  113. - name: fetch libusbmuxd
  114. uses: dawidd6/action-download-artifact@v6
  115. with:
  116. github_token: ${{secrets.GITHUB_TOKEN}}
  117. workflow: build.yml
  118. name: libusbmuxd-latest_macOS
  119. repo: libimobiledevice/libusbmuxd
  120. - name: fetch libimobiledevice-glue
  121. uses: dawidd6/action-download-artifact@v6
  122. with:
  123. github_token: ${{secrets.GITHUB_TOKEN}}
  124. workflow: build.yml
  125. name: libimobiledevice-glue-latest_macOS
  126. repo: libimobiledevice/libimobiledevice-glue
  127. - name: fetch libimobiledevice
  128. uses: dawidd6/action-download-artifact@v6
  129. with:
  130. github_token: ${{secrets.GITHUB_TOKEN}}
  131. workflow: build.yml
  132. name: libimobiledevice-latest_macOS
  133. repo: libimobiledevice/libimobiledevice
  134. - name: fetch libtatsu
  135. uses: dawidd6/action-download-artifact@v6
  136. with:
  137. github_token: ${{secrets.GITHUB_TOKEN}}
  138. workflow: build.yml
  139. name: libtatsu-latest_macOS
  140. repo: libimobiledevice/libtatsu
  141. - name: install external dependencies
  142. run: |
  143. mkdir extract
  144. for I in *.tar; do
  145. tar -C extract -xvf $I
  146. done
  147. sudo cp -r extract/* /
  148. - uses: actions/checkout@v4
  149. - name: install additional requirements
  150. run: |
  151. SDKDIR=`xcrun --sdk macosx --show-sdk-path 2>/dev/null`
  152. echo "SDKDIR=$SDKDIR" >> $GITHUB_ENV
  153. TESTARCHS="arm64 x86_64"
  154. USEARCHS=
  155. for ARCH in $TESTARCHS; do
  156. if echo "int main(int argc, char **argv) { return 0; }" |clang -arch $ARCH -o /dev/null -isysroot $SDKDIR -x c - 2>/dev/null; then
  157. USEARCHS="$USEARCHS -arch $ARCH"
  158. fi
  159. done
  160. export CFLAGS="$USEARCHS -isysroot $SDKDIR"
  161. echo "Using CFLAGS: $CFLAGS"
  162. echo "BUILD_CFLAGS=$CFLAGS" >> $GITHUB_ENV
  163. mkdir -p deps
  164. FILENAME="libzip-static.tar.bz2"
  165. curl -o $FILENAME.b64 -Ls "https://gist.github.com/nikias/3da15d03120382f87b44029cd8495a02/raw/99cd8138fed99e8f6530b6f179f787342c698e1f/libzip-1.7.1_static_macOS.tar.bz2"
  166. base64 -D < $FILENAME.b64 > $FILENAME
  167. tar -C deps -xjf $FILENAME
  168. echo "LIBZIP_CFLAGS=-I`pwd`/deps/include" >> $GITHUB_ENV
  169. echo "LIBZIP_LIBS=`pwd`/deps/lib/libzip.a -Xlinker ${SDKDIR}/usr/lib/libbz2.tbd -Xlinker ${SDKDIR}/usr/lib/liblzma.tbd -lz" >> $GITHUB_ENV
  170. - name: autogen
  171. run: |
  172. export CFLAGS="${{env.BUILD_CFLAGS}} -Wno-nullability-completeness -Wno-expansion-to-defined"
  173. echo "Using CFLAGS: $CFLAGS"
  174. ./autogen.sh PKG_CONFIG_PATH=/usr/local/lib/pkgconfig \
  175. libcurl_CFLAGS="-I${{env.SDKDIR}}/usr/include" libcurl_LIBS="-lcurl" \
  176. libzip_CFLAGS="$LIBZIP_CFLAGS" libzip_LIBS="$LIBZIP_LIBS" \
  177. zlib_CFLAGS="-I${{env.SDKDIR}}/usr/include" zlib_LIBS="-lz" \
  178. libimobiledevice_CFLAGS="-I/usr/local/include" libimobiledevice_LIBS="-L/usr/local/lib -lusbmuxd-2.0 -limobiledevice-glue-1.0 -limobiledevice-1.0"
  179. - name: make
  180. run: make
  181. - name: make install
  182. run: sudo make install
  183. - name: prepare artifact
  184. run: |
  185. mkdir -p dest
  186. DESTDIR=`pwd`/dest make install
  187. tar -C dest -cf idevicerestore.tar usr
  188. - name: publish artifact
  189. uses: actions/upload-artifact@v4
  190. with:
  191. name: idevicerestore-latest_macOS
  192. path: idevicerestore.tar
  193. build-windows:
  194. runs-on: windows-2019
  195. defaults:
  196. run:
  197. shell: msys2 {0}
  198. strategy:
  199. fail-fast: false
  200. matrix:
  201. include: [
  202. { msystem: MINGW64, arch: x86_64 },
  203. { msystem: MINGW32, arch: i686 }
  204. ]
  205. steps:
  206. - uses: msys2/setup-msys2@v2
  207. with:
  208. msystem: ${{ matrix.msystem }}
  209. release: false
  210. update: false
  211. install: >-
  212. base-devel
  213. git
  214. mingw-w64-${{ matrix.arch }}-gcc
  215. make
  216. libtool
  217. autoconf
  218. automake-wrapper
  219. liblzma
  220. - name: prepare environment
  221. run: |
  222. dest=`echo ${{ matrix.msystem }} |tr [:upper:] [:lower:]`
  223. echo "dest=$dest" >> $GITHUB_ENV
  224. echo "target_triplet=`gcc -dumpmachine`" >> $GITHUB_ENV
  225. - name: fetch libirecovery
  226. uses: dawidd6/action-download-artifact@v6
  227. with:
  228. github_token: ${{secrets.GITHUB_TOKEN}}
  229. workflow: build.yml
  230. name: libirecovery-latest_${{ matrix.arch }}-${{ env.dest }}
  231. repo: libimobiledevice/libirecovery
  232. - name: fetch libplist
  233. uses: dawidd6/action-download-artifact@v6
  234. with:
  235. github_token: ${{secrets.GITHUB_TOKEN}}
  236. workflow: build.yml
  237. name: libplist-latest_${{ matrix.arch }}-${{ env.dest }}
  238. repo: libimobiledevice/libplist
  239. - name: fetch libusbmuxd
  240. uses: dawidd6/action-download-artifact@v6
  241. with:
  242. github_token: ${{secrets.GITHUB_TOKEN}}
  243. workflow: build.yml
  244. name: libusbmuxd-latest_${{ matrix.arch }}-${{ env.dest }}
  245. repo: libimobiledevice/libusbmuxd
  246. - name: fetch libimobiledevice-glue
  247. uses: dawidd6/action-download-artifact@v6
  248. with:
  249. github_token: ${{secrets.GITHUB_TOKEN}}
  250. workflow: build.yml
  251. name: libimobiledevice-glue-latest_${{ matrix.arch }}-${{ env.dest }}
  252. repo: libimobiledevice/libimobiledevice-glue
  253. - name: fetch libimobiledevice
  254. uses: dawidd6/action-download-artifact@v6
  255. with:
  256. github_token: ${{secrets.GITHUB_TOKEN}}
  257. workflow: build.yml
  258. name: libimobiledevice-latest_${{ matrix.arch }}-${{ env.dest }}
  259. repo: libimobiledevice/libimobiledevice
  260. - name: fetch libtatsu
  261. uses: dawidd6/action-download-artifact@v6
  262. with:
  263. github_token: ${{secrets.GITHUB_TOKEN}}
  264. workflow: build.yml
  265. name: libtatsu-latest_${{ matrix.arch }}-${{ env.dest }}
  266. repo: libimobiledevice/libtatsu
  267. - name: install external dependencies
  268. run: |
  269. mkdir extract
  270. for I in *.tar; do
  271. tar -C extract -xvf $I
  272. done
  273. cp -r extract/* /
  274. - uses: actions/checkout@v4
  275. - name: install additional requirements
  276. run: |
  277. FILENAME="libzip-1.7.1-static.tar.bz2"
  278. curl -o $FILENAME.b64 -Ls "https://gist.github.com/nikias/3da15d03120382f87b44029cd8495a02/raw/99cd8138fed99e8f6530b6f179f787342c698e1f/libzip-1.7.1_static_${{matrix.arch}}-${{env.dest}}.tar.bz2"
  279. base64 -d < $FILENAME.b64 > $FILENAME
  280. mkdir deps
  281. tar -C deps -xjf $FILENAME
  282. echo "LIBZIP_CFLAGS=-I`pwd`/deps/include" >> $GITHUB_ENV
  283. echo "LIBZIP_LIBS=`pwd`/deps/lib/libzip.a /${{env.dest}}/lib/libbz2.a /${{env.dest}}/lib/liblzma.a " >> $GITHUB_ENV
  284. FILENAME="libcurl-8.1.0-static.tar.bz2"
  285. curl -o $FILENAME.b64 -Ls "https://gist.github.com/nikias/6c397a0a2f4f4eafd91b81cccd22b761/raw/85216e60af6787f3b351291165eb91bd585ff09a/libcurl-8.1.0-static-${{matrix.arch}}-${{env.dest}}.tar.bz2"
  286. base64 -d < $FILENAME.b64 > $FILENAME
  287. tar -C deps -xjf $FILENAME
  288. echo "LIBCURL_CFLAGS=-I`pwd`/deps/include -DCURL_STATICLIB" >> $GITHUB_ENV
  289. echo "LIBCURL_LIBS=`pwd`/deps/lib/libcurl.a /${{env.dest}}/lib/libzstd.a -lws2_32 -lcrypt32 -lwldap32 -lbcrypt -lssl -lcrypto" >> $GITHUB_ENV
  290. - name: autogen
  291. run: |
  292. ./autogen.sh CC=gcc CXX=g++ \
  293. libzip_VERSION=1.7.1 libzip_CFLAGS="${{env.LIBZIP_CFLAGS}}" libzip_LIBS="${{env.LIBZIP_LIBS}}" \
  294. zlib_LIBS="/${{env.dest}}/lib/libz.a" libcurl_CFLAGS="${{env.LIBCURL_CFLAGS}}" libcurl_LIBS="$LIBCURL_LIBS"
  295. - name: make
  296. run: make
  297. - name: make install
  298. run: make install
  299. - name: prepare artifact
  300. run: |
  301. mkdir -p dest
  302. DESTDIR=`pwd`/dest make install
  303. tar -C dest -cf idevicerestore.tar ${{ env.dest }}
  304. - name: publish artifact
  305. uses: actions/upload-artifact@v4
  306. with:
  307. name: idevicerestore-latest_${{ matrix.arch }}-${{ env.dest }}
  308. path: idevicerestore.tar
  309. build-docker:
  310. runs-on: ubuntu-latest
  311. steps:
  312. - uses: actions/checkout@v4
  313. - name: build
  314. run: |
  315. pushd docker && ./build.sh; popd
  316. docker image save -o idevicerestore-docker.tar idevicerestore-docker
  317. - name: publish artifact
  318. uses: actions/upload-artifact@v4
  319. with:
  320. name: idevicerestore-latest_docker
  321. path: idevicerestore-docker.tar