Skip to content

Commit 6ca858d

Browse files
authored
Merge pull request #3491 from masatake/gha-split-cross-build-platform
GitHub Actions: use apt-get instead of brew on Ubuntu
2 parents 34f1c6a + a9feabb commit 6ca858d

File tree

4 files changed

+142
-17
lines changed

4 files changed

+142
-17
lines changed

.github/workflows/cross-compile-android-ndk.yml renamed to .github/workflows/cross-compile-android-ndk-on-mac.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: cross compile with android-ndk
1+
name: cross compile with android-ndk on mac
22

33
on:
44
push:
@@ -11,15 +11,15 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
build-machine-os: [ubuntu-22.04, ubuntu-20.04, macos-12, macos-11]
14+
build-machine-os: [macos-12, macos-11]
1515

1616
runs-on: ${{ matrix.build-machine-os }}
1717

1818
steps:
1919
- uses: actions/checkout@v2
20-
20+
2121
- run: brew install gcc make automake autoconf file
22-
22+
2323
- run: ./autogen.sh
2424

2525
- name: Run ./configure ...
@@ -36,30 +36,30 @@ jobs:
3636
TOOLCHAIN_BASE_DIR=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$BUILD_MACHINE_OS_TYPE-$BUILD_MACHINE_OS_ARCH
3737
TOOLCHAIN_BIN_DIR=$TOOLCHAIN_BASE_DIR/bin
3838
SYSROOT=$TOOLCHAIN_BASE_DIR/sysroot
39-
39+
4040
export CC=$TOOLCHAIN_BIN_DIR/armv7a-linux-androideabi21-clang
4141
export AR=$TOOLCHAIN_BIN_DIR/llvm-ar
4242
export RANLIB=$TOOLCHAIN_BIN_DIR/llvm-ranlib
4343
4444
export CFLAGS="--sysroot $SYSROOT -Qunused-arguments -Os -fpic"
4545
export CPPFLAGS="--sysroot $SYSROOT -Qunused-arguments"
4646
export LDFLAGS="--sysroot $SYSROOT"
47-
47+
4848
TARGET=armv7a-linux-androideabi
49-
49+
5050
COLOR_PURPLE='\033[0;35m' # Purple
5151
COLOR_GREEN='\033[0;32m' # Green
5252
COLOR_OFF='\033[0m' # Reset
53-
53+
5454
echo() {
5555
printf "%b\n" "$*"
5656
}
57-
57+
5858
run() {
5959
echo "$COLOR_PURPLE==>$COLOR_OFF $COLOR_GREEN$@$COLOR_OFF"
6060
eval "$*"
6161
}
62-
62+
6363
run ./configure \
6464
--host=$TARGET \
6565
--disable-iconv \
@@ -73,7 +73,7 @@ jobs:
7373
LDFLAGS="\"$LDFLAGS\"" \
7474
AR=$AR \
7575
RANLIB=$RANLIB
76-
76+
7777
- run: make V=1
78-
78+
7979
- run: file ctags | grep 'ELF 32-bit LSB pie executable, ARM, EABI5'
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: cross compile with android-ndk on ubuntu
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
cross-compile:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
build-machine-os: [ubuntu-22.04, ubuntu-20.04]
15+
16+
runs-on: ${{ matrix.build-machine-os }}
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- run: sudo apt-get -y -o APT::Immediate-Configure=false update
22+
- run: sudo apt-get -y -o APT::Immediate-Configure=false install gcc make automake autoconf file
23+
24+
- run: ./autogen.sh
25+
26+
- name: Run ./configure ...
27+
run: |
28+
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#environment-variables-3
29+
[ -n "$ANDROID_NDK_LATEST_HOME" ] && {
30+
export ANDROID_NDK_HOME="$ANDROID_NDK_LATEST_HOME"
31+
export ANDROID_NDK_ROOT="$ANDROID_NDK_LATEST_HOME"
32+
}
33+
34+
BUILD_MACHINE_OS_TYPE=$(uname | tr A-Z a-z)
35+
BUILD_MACHINE_OS_ARCH=$(uname -m)
36+
37+
TOOLCHAIN_BASE_DIR=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$BUILD_MACHINE_OS_TYPE-$BUILD_MACHINE_OS_ARCH
38+
TOOLCHAIN_BIN_DIR=$TOOLCHAIN_BASE_DIR/bin
39+
SYSROOT=$TOOLCHAIN_BASE_DIR/sysroot
40+
41+
export CC=$TOOLCHAIN_BIN_DIR/armv7a-linux-androideabi21-clang
42+
export AR=$TOOLCHAIN_BIN_DIR/llvm-ar
43+
export RANLIB=$TOOLCHAIN_BIN_DIR/llvm-ranlib
44+
45+
export CFLAGS="--sysroot $SYSROOT -Qunused-arguments -Os -fpic"
46+
export CPPFLAGS="--sysroot $SYSROOT -Qunused-arguments"
47+
export LDFLAGS="--sysroot $SYSROOT"
48+
49+
TARGET=armv7a-linux-androideabi
50+
51+
COLOR_PURPLE='\033[0;35m' # Purple
52+
COLOR_GREEN='\033[0;32m' # Green
53+
COLOR_OFF='\033[0m' # Reset
54+
55+
echo() {
56+
printf "%b\n" "$*"
57+
}
58+
59+
run() {
60+
echo "$COLOR_PURPLE==>$COLOR_OFF $COLOR_GREEN$@$COLOR_OFF"
61+
eval "$*"
62+
}
63+
64+
run ./configure \
65+
--host=$TARGET \
66+
--disable-iconv \
67+
--disable-xml \
68+
--disable-json \
69+
--disable-yaml \
70+
--disable-pcre2 \
71+
CC="$CC" \
72+
CFLAGS="\"$CFLAGS\"" \
73+
CPPFLAGS="\"$CPPFLAGS\"" \
74+
LDFLAGS="\"$LDFLAGS\"" \
75+
AR=$AR \
76+
RANLIB=$RANLIB
77+
78+
- run: make V=1
79+
80+
# pie executable or shared object
81+
- run: file ctags | grep 'ELF 32-bit LSB .*, ARM, EABI5'

.github/workflows/cross-compile-mingw-w64.yml renamed to .github/workflows/cross-compile-mingw-w64-on-mac.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: cross compile with mingw-w64
1+
name: cross compile with mingw-w64 on mac
22

33
on:
44
push:
@@ -11,14 +11,14 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
build-machine-os: [ubuntu-22.04, ubuntu-20.04, macos-12, macos-11]
14+
build-machine-os: [macos-12, macos-11]
1515
target: [i686-w64-mingw32,x86_64-w64-mingw32]
1616

1717
runs-on: ${{ matrix.build-machine-os }}
1818

1919
steps:
2020
- uses: actions/checkout@v2
21-
21+
2222
- run: brew install mingw-w64 gcc make automake autoconf file
2323

2424
- run: ./autogen.sh
@@ -37,7 +37,7 @@ jobs:
3737
AR=${{ matrix.target }}-ar \
3838
RANLIB=${{ matrix.target }}-ranlib \
3939
WINDRES=${{ matrix.target }}-windres
40-
40+
4141
- run: make V=1
42-
42+
4343
- run: file ctags.exe | grep PE32
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: cross compile with mingw-w64 on ubuntu
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
cross-compile:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
build-machine-os: [ubuntu-22.04, ubuntu-20.04]
15+
target: [i686-w64-mingw32,x86_64-w64-mingw32]
16+
17+
runs-on: ${{ matrix.build-machine-os }}
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
22+
- run: sudo apt-get -y -o APT::Immediate-Configure=false update
23+
- run: sudo apt-get -y -o APT::Immediate-Configure=false install mingw-w64 gcc make automake autoconf file
24+
25+
- run: ./autogen.sh
26+
27+
- name: Run ./configure ...
28+
run: |
29+
./configure \
30+
--host=${{ matrix.target }} \
31+
--disable-iconv \
32+
--disable-xml \
33+
--disable-json \
34+
--disable-yaml \
35+
--disable-pcre2 \
36+
CC=${{ matrix.target }}-gcc \
37+
CFLAGS='-v' \
38+
AR=${{ matrix.target }}-ar \
39+
RANLIB=${{ matrix.target }}-ranlib \
40+
WINDRES=${{ matrix.target }}-windres
41+
42+
- run: make V=1
43+
44+
- run: file ctags.exe | grep PE32

0 commit comments

Comments
 (0)