Skip to content

Commit 34afc1b

Browse files
committed
workflows: Adapt build.yml to android-tools-static
1 parent d2a0a44 commit 34afc1b

File tree

1 file changed

+93
-74
lines changed

1 file changed

+93
-74
lines changed

.github/workflows/build.yml

Lines changed: 93 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: build
1+
name: Compile and check on supported systems
22

33
on: [push, pull_request]
44

@@ -7,46 +7,46 @@ jobs:
77
name: Upload the source
88
runs-on: ubuntu-latest
99
steps:
10+
# - name: Cache source
11+
# id: cache
12+
# uses: actions/cache@v4
13+
# with:
14+
# path: android-tools-source.tar.xz
15+
# key: build-cache
1016
- name: prep ubuntu
17+
# if: steps.cache.outputs.cache-hit != 'true'
1118
run: |
1219
sudo apt-get update
1320
DEBIAN_FRONTEND=noninteractive sudo apt-get install -yq \
14-
${{ matrix.pkgs }} cmake git golang libbrotli-dev \
15-
libgtest-dev liblz4-dev libpcre2-dev libprotobuf-dev libunwind-dev \
16-
libzstd-dev make pandoc pkg-config protobuf-compiler xz-utils
21+
cmake git meson
1722
- name: checkout
23+
# if: steps.cache.outputs.cache-hit != 'true'
1824
uses: actions/checkout@v4
25+
timeout-minutes: 15
1926
with:
27+
path: android-tools-source
2028
submodules: true
21-
- name: git config
22-
run: |
23-
git config --global user.email "[email protected]"
24-
git config --global user.name "Your Name"
25-
- name: get vendor modules
26-
run: |
27-
cd vendor/boringssl
28-
go mod vendor
29-
- name: generate man page
30-
run: |
31-
cd vendor/adb/docs/user
32-
pandoc -s -t man adb.1.md -o adb.1
3329
- name: build & install
30+
# if: steps.cache.outputs.cache-hit != 'true'
31+
timeout-minutes: 5
3432
run: |
3533
export SOURCE_DATE_EPOCH=$(date +%s)
3634
echo "SOURCE_DATE_EPOCH: ${SOURCE_DATE_EPOCH}"
37-
cmake \
38-
-DANDROID_TOOLS_USE_BUNDLED_FMT=ON \
39-
-DANDROID_TOOLS_USE_BUNDLED_LIBUSB=ON \
40-
-B build
41-
cmake --build build --target package_source
42-
for x in sha1sum sha256sum sha512sum b2sum; do
43-
printf "$x " && $x ${{ github.workspace }}/build/android-tools-*.tar.xz | cut -d " " -f 1
44-
done
35+
meson subprojects download --sourcedir android-tools-source
36+
patch -d android-tools-source -p1 < android-tools-source/onlypatch.patch
37+
meson setup unused_build android-tools-source -Duse_bundled_libusb=true
38+
patch -d android-tools-source -Rp1 < android-tools-source/onlypatch.patch
39+
40+
rm -rf android-tools-source/.git android-tools-source/subprojects/packagecache android-tools-source/vendor/*/.git
41+
42+
touch android-tools-source/nopatch
43+
44+
tar -cf android-tools-source.tar android-tools-source/
4545
- name: upload package_source
4646
uses: actions/upload-artifact@v4
4747
with:
4848
name: package_source
49-
path: ${{ github.workspace }}/build/android-tools-*.tar.xz
49+
path: android-tools-source.tar
5050

5151
linux:
5252
runs-on: ubuntu-latest
@@ -55,13 +55,16 @@ jobs:
5555
fail-fast: false
5656
matrix:
5757
include:
58+
# gcc is required in clang builds on opensuse; the clang package on its
59+
# own cannot compile C++, it is missing vital dependencies (a linker,
60+
# some gcc libraries...). gcc-c++ should pull in all of it.
5861
- os: "opensuse/leap:latest"
5962
pkgs: "clang gcc11-c++"
6063
env1: "CC=clang CXX=clang++"
6164
- os: "opensuse/tumbleweed"
6265
pkgs: "gcc gcc-c++"
6366
- os: "opensuse/tumbleweed"
64-
pkgs: clang
67+
pkgs: "clang gcc-c++"
6568
env1: "CC=clang CXX=clang++"
6669
- os: "archlinux:base"
6770
pkgs: gcc
@@ -97,39 +100,31 @@ jobs:
97100
if: startsWith(matrix.os, 'opensuse')
98101
run: |
99102
zypper -n ref
100-
zypper -n in ${{ matrix.pkgs }} cmake git go gtest pcre2-devel pkgconfig \
101-
'pkgconfig(libbrotlicommon)' 'pkgconfig(liblz4)' \
102-
'pkgconfig(libunwind-generic)' \
103-
'pkgconfig(libzstd)' 'pkgconfig(protobuf)' ninja tar xz zlib-devel
103+
zypper -n in ${{ matrix.pkgs }} cmake meson tar
104104
105105
- name: prep archlinux
106106
if: startsWith(matrix.os, 'archlinux')
107107
run: |
108108
pacman -Syu --needed --noconfirm \
109-
${{ matrix.pkgs }} brotli cmake git go gtest libunwind \
110-
lz4 pcre2 pkgconfig protobuf zstd ninja
109+
${{ matrix.pkgs }} cmake meson
111110
112111
- name: prep ubuntu
113112
if: startsWith(matrix.os, 'ubuntu')
114113
run: |
115114
apt-get update
116115
DEBIAN_FRONTEND=noninteractive apt-get install -yq \
117-
${{ matrix.pkgs }} cmake git golang libbrotli-dev \
118-
libgtest-dev liblz4-dev libpcre2-dev libprotobuf-dev libunwind-dev \
119-
libzstd-dev pkg-config protobuf-compiler ninja-build xz-utils
116+
${{ matrix.pkgs }} cmake meson
120117
121118
- name: prep alpine
122119
if: startsWith(matrix.os, 'alpine')
123120
run: |
124-
apk add build-base pcre2-dev linux-headers gtest-dev samurai \
125-
go git perl cmake protobuf-dev brotli-dev zstd-dev lz4-dev
121+
apk add build-base meson cmake linux-headers
126122
127123
- name: prep fedora
128124
if: startsWith(matrix.os, 'fedora')
125+
# libatomic is needed because of https://github.com/mesonbuild/meson/issues/14946
129126
run: |
130-
dnf install -y ${{ matrix.pkgs }} cmake ninja-build perl git golang \
131-
brotli-devel gtest-devel lz4-devel pcre2-devel protobuf-devel \
132-
libzstd-devel tar xz
127+
dnf install -y ${{ matrix.pkgs }} cmake meson libatomic
133128
134129
- name: download source
135130
uses: actions/download-artifact@v4
@@ -138,31 +133,23 @@ jobs:
138133

139134
- name: build & install
140135
run: |
141-
export GOFLAGS="-mod=vendor"
142-
tar -xf android-tools-*.tar.xz
136+
tar -xf android-tools-*.tar
143137
cd android-tools-*/
144138
test -n "${{ matrix.env1 }}" && export ${{ matrix.env1 }}
145139
test -n "${{ matrix.env2 }}" && export ${{ matrix.env2 }}
146-
mkdir build && cd build
147-
cmake \
148-
-DCMAKE_C_FLAGS="$CFLAGS" \
149-
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
150-
-DCMAKE_BUILD_TYPE=Release \
151-
-DANDROID_TOOLS_USE_BUNDLED_FMT=ON \
152-
-DANDROID_TOOLS_USE_BUNDLED_LIBUSB=ON \
153-
-GNinja \
154-
..
155-
ninja --verbose
156-
echo -e "\n### make install ###\n"
157-
cmake --install . --prefix /usr/local
140+
meson setup build -Duse_bundled_libusb=true \
141+
--native-file nativefiles/release_configuration.ini \
142+
--prefix /usr/local
143+
echo -e "\n### install ###\n"
144+
meson install -C build
158145
echo -e "\n### all done ###\n"
159146
160147
- name: check
161148
run: |
162149
/usr/local/bin/adb --version
163150
/usr/local/bin/fastboot --version
164-
/usr/local/bin/make_f2fs -V
165-
/usr/local/bin/sload_f2fs -V
151+
# /usr/local/bin/make_f2fs -V
152+
# /usr/local/bin/sload_f2fs -V
166153
167154
macos:
168155
strategy:
@@ -182,8 +169,7 @@ jobs:
182169
- name: prep macos
183170
run: |
184171
rm -rf /opt/homebrew/include/openssl /usr/local/opt/openssl /usr/local/include/openssl
185-
brew install --overwrite --quiet brotli cmake go googletest lz4 \
186-
ninja pcre2 protobuf zstd
172+
brew install --overwrite --quiet meson
187173
188174
- name: download source
189175
uses: actions/download-artifact@v4
@@ -192,26 +178,59 @@ jobs:
192178

193179
- name: build & install
194180
run: |
195-
tar -xf android-tools-*.tar.xz
181+
tar -xf android-tools-*.tar
196182
cd android-tools-*/
197-
mkdir build && cd build
198-
cmake \
199-
-DCMAKE_C_FLAGS="$CFLAGS" \
200-
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
201-
-DCMAKE_BUILD_TYPE=Release \
202-
-DCMAKE_INSTALL_PREFIX=$HOME/android-tools \
203-
-DANDROID_TOOLS_USE_BUNDLED_FMT=ON \
204-
-DANDROID_TOOLS_USE_BUNDLED_LIBUSB=ON \
205-
-GNinja \
206-
..
207-
ninja --verbose
208-
echo -e "\n### make install ###\n"
209-
cmake --install .
183+
meson setup build -Duse_bundled_libusb=true \
184+
--native-file nativefiles/release_configuration.ini \
185+
--prefix "$HOME/android-tools"
186+
echo -e "\n### install ###\n"
187+
meson install -C build
210188
echo -e "\n### all done ###\n"
211189
212190
- name: check
213191
run: |
214192
$HOME/android-tools/bin/adb --version
215193
$HOME/android-tools/bin/fastboot --version
216-
$HOME/android-tools/bin/make_f2fs -V
217-
$HOME/android-tools/bin/sload_f2fs -V
194+
# $HOME/android-tools/bin/make_f2fs -V
195+
# $HOME/android-tools/bin/sload_f2fs -V
196+
197+
windows:
198+
runs-on: windows-2022
199+
needs: [upload-src]
200+
steps:
201+
- name: prep MSYS2
202+
uses: msys2/[email protected]
203+
with:
204+
msystem: UCRT64
205+
install: >
206+
mingw-w64-ucrt-x86_64-meson
207+
mingw-w64-ucrt-x86_64-gcc
208+
mingw-w64-ucrt-x86_64-cmake
209+
mingw-w64-ucrt-x86_64-nasm
210+
211+
- name: download source
212+
uses: actions/download-artifact@v4
213+
with:
214+
name: package_source
215+
- name: extract source
216+
timeout-minutes: 10
217+
run: tar -oxf android-tools-source.tar
218+
219+
- name: build & install
220+
shell: msys2 {0}
221+
run: |
222+
cd android-tools-*/
223+
meson setup build -Duse_bundled_libusb=true \
224+
--native-file nativefiles/release_configuration.ini \
225+
--native-file nativefiles/release_configuration_fullstatic.ini \
226+
--native-file nativefiles/release_configuration_standardlayout.ini
227+
echo -e "\n### install ###\n"
228+
meson install -C build --destdir "$PWD/../android-tools"
229+
echo -e "\n### all done ###\n"
230+
231+
- name: check
232+
run: |
233+
.\android-tools\adb.exe --version
234+
.\android-tools\fastboot.exe --version
235+
# .\android-tools\make_f2fs.exe -V
236+
# .\android-tools\sload_f2fs.exe -V

0 commit comments

Comments
 (0)