@@ -17,30 +17,6 @@ permissions:
1717 id-token : write # needed for keyless signing
1818
1919jobs :
20- linux-x86_64-all-libs :
21- runs-on : ubuntu-latest
22- steps :
23- - name : Checkout
24- uses : actions/checkout@v3
25- - name : Build static libraries - libgit2 compiled with libssh2 and openssl
26- run : |
27- TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs \
28- BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/amd \
29- ./hack/static.sh all
30-
31- mkdir -p ./libgit2-linux-all-libs/
32- mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs/include ./libgit2-linux-all-libs/
33- mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs/share ./libgit2-linux-all-libs/
34- mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs/lib ./libgit2-linux-all-libs/
35- mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs/lib64 ./libgit2-linux-all-libs/
36-
37- tar -zcvf linux-x86_64-all-libs.tar.gz libgit2-linux-all-libs
38- rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
39- - uses : actions/upload-artifact@v3
40- with :
41- name : release-artifact
42- path : " *.tar.gz"
43- if-no-files-found : error
4420
4521 linux-x86_64-libgit2-only :
4622 runs-on : ubuntu-latest
6541 path : " *.tar.gz"
6642 if-no-files-found : error
6743
68- darwin-all-libs :
69- # This job builds and releases "universal libraries" that are
70- # supported by both darwin-amd64 and darwin-arm64.
71- #
72- # First builds in amd64, then cross-compile in arm64. Later combining
73- # both outcomes onto a single binary for each static library.
74- #
75- # `macos-11` has been picked as support for arm64 was only added on Xcode 12.
76- # Although some minor versions of Catalina 10.15 can support it, at the time
77- # of testing, GitHub's macos-10.15 did not seem to.
78- # Cross-compiling to arm64 on that runner consistently failed.
79- runs-on : macos-11
80- steps :
81- - name : Checkout
82- uses : actions/checkout@v3
83- - name : Build universal static libraries for Darwin - libgit2 compiled with libssh2 and openssl
84- run : |
85- # The amd64 is used as base, using the target dir name (darwin-all-libs)
86- # instead of the platform specific one, removes the need of replacing the
87- # path in the .pc files.
88- TARGET_DIR=${GITHUB_WORKSPACE}/build/darwin-all-libs \
89- BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/amd \
90- ./hack/static.sh all
91-
92- TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64 \
93- BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/arm \
94- TARGET_ARCH=arm64 \
95- CMAKE_APPLE_SILICON_PROCESSOR=arm64 \
96- ./hack/static.sh all
97-
98-
99- LIBGIT2_SED="s;-L/Applications/Xcode.* ;;g"
100- LIBGIT2PC="${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/pkgconfig/libgit2.pc"
101-
102- # pkgconfig includes absolute paths that are specific to the runner machine.
103- # We need to remove the absolute path for iconv, so when the libgit2 library
104- # is consumed pkgconfig will automatically try to find it through the default
105- # search paths on the target machine.
106- if command -v gsed &> /dev/null; then
107- gsed -i "${LIBGIT2_SED}" "${LIBGIT2PC}"
108- else
109- sed -i "" "${LIBGIT2_SED}" "${LIBGIT2PC}"
110- fi
111-
112- mkdir -p ./darwin-all-libs/lib
113- mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/include ./darwin-all-libs/
114- mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/share ./darwin-all-libs/
115- mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/cmake ./darwin-all-libs/lib/
116- mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/engines-3 ./darwin-all-libs/lib/
117- mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/ossl-modules ./darwin-all-libs/lib/
118- mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/pkgconfig ./darwin-all-libs/lib/
119-
120- libtool -static -o ./darwin-all-libs/lib/libcrypto.a \
121- ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/libcrypto.a \
122- ${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libcrypto.a
123-
124- libtool -static -o ./darwin-all-libs/lib/libgit2.a \
125- ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/libgit2.a \
126- ${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libgit2.a
127-
128- libtool -static -o ./darwin-all-libs/lib/libssh2.a \
129- ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/libssh2.a \
130- ${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libssh2.a
131-
132- libtool -static -o ./darwin-all-libs/lib/libssl.a \
133- ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/libssl.a \
134- ${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libssl.a
135-
136- libtool -static -o ./darwin-all-libs/lib/libz.a \
137- ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/libz.a \
138- ${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libz.a
139-
140- tar -zcvf darwin-all-libs.tar.gz darwin-all-libs
141- rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
142- env :
143- MACOSX_DEPLOYMENT_TARGET : 10.15
144- - uses : actions/upload-artifact@v3
145- with :
146- name : release-artifact
147- path : " *.tar.gz"
148- if-no-files-found : error
149-
15044 # similar to darwin-all-libs, but only compiles libgit2.
15145 darwin-libgit2-only :
15246 runs-on : macos-11
@@ -165,17 +59,20 @@ jobs:
16559 CMAKE_APPLE_SILICON_PROCESSOR=arm64 \
16660 ./hack/static.sh build_libgit2_only
16761
168- LIBGIT2_SED="s;-L/Applications/Xcode.* ;;g"
62+ LIBGIT2_WORKDIR_SED="s;${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64;${GITHUB_WORKSPACE}/build/darwin-libgit2-only;g"
63+ LIBGIT2_XCODE_SED="s;-L/Applications/Xcode.* ;;g"
16964 LIBGIT2PC="${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/lib/pkgconfig/libgit2.pc"
17065
17166 # pkgconfig includes absolute paths that are specific to the runner machine.
17267 # We need to remove the absolute path for iconv, so when the libgit2 library
17368 # is consumed pkgconfig will automatically try to find it through the default
17469 # search paths on the target machine.
17570 if command -v gsed &> /dev/null; then
176- gsed -i "${LIBGIT2_SED}" "${LIBGIT2PC}"
71+ gsed -i "${LIBGIT2_WORKDIR_SED}" "${LIBGIT2PC}"
72+ gsed -i "${LIBGIT2_XCODE_SED}" "${LIBGIT2PC}"
17773 else
178- sed -i "" "${LIBGIT2_SED}" "${LIBGIT2PC}"
74+ sed -i "" "${LIBGIT2_WORKDIR_SED}" "${LIBGIT2PC}"
75+ sed -i "" "${LIBGIT2_XCODE_SED}" "${LIBGIT2PC}"
17976 fi
18077
18178 mkdir ./darwin-libgit2-only
20097 runs-on : ubuntu-latest
20198 needs :
20299 [
203- linux-x86_64-all-libs,
204100 linux-x86_64-libgit2-only,
205- darwin-all-libs,
206101 darwin-libgit2-only,
207102 ]
208103 if : ${{ always() && contains(join(needs.*.result, ','), 'success') }}
0 commit comments