-
Notifications
You must be signed in to change notification settings - Fork 625
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GitHub Actions: add cross compile for FreeBSD, OpenBSD, NetBSD workflows
This allows users get our executable for FreeBSD, OpenBSD, NetBSD in a different maner. Signed-off-by: leleliu008 <leleliu008@gmail.com>
- Loading branch information
1 parent
684ed1d
commit b80bde3
Showing
3 changed files
with
354 additions
and
0 deletions.
There are no files selected for viewing
119 changes: 119 additions & 0 deletions
119
.github/workflows/cross-compile-for--netbsd-on-ubuntu.yml
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,119 @@ | ||
name: cross compile for NetBSD on Ubuntu | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
netbsd-release-version: [9.3] | ||
|
||
runs-on: ubuntu-latest | ||
|
||
env: | ||
CC: clang --target=amd64-unknown-netbsd --sysroot=${{ github.workspace }}/amd64-unknown-netbsd-sysroot | ||
CFLAGS: -I${{ github.workspace }}/amd64-unknown-netbsd-3rdroot/include -v -fPIC | ||
LDFLAGS: -L${{ github.workspace }}/amd64-unknown-netbsd-3rdroot/lib -Wl,-v | ||
PKG_CONFIG_PATH: ${{ github.workspace }}/amd64-unknown-netbsd-3rdroot/lib/pkgconfig | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: universal-ctags/ctags | ||
|
||
- run: sudo apt-get -y update | ||
- run: sudo apt-get -y install clang cmake make automake autoconf pkg-config curl file | ||
|
||
- run: install -d amd64-unknown-netbsd-sysroot | ||
- run: install -d amd64-unknown-netbsd-3rdroot | ||
|
||
- name: install amd64-unknown-netbsd-sysroot | ||
run: | | ||
major="$(printf '%s\n' ${{ matrix.netbsd-release-version }} | cut -d. -f1)" | ||
minor="$(printf '%s\n' ${{ matrix.netbsd-release-version }} | cut -d. -f2)" | ||
for item in base comp | ||
do | ||
FILENAME="$item.tar.xz" | ||
curl -LO "https://ftp.netbsd.org/pub/NetBSD/NetBSD-${{ matrix.netbsd-release-version }}/amd64/binary/sets/$FILENAME" | ||
tar vxf "$FILENAME" -C amd64-unknown-netbsd-sysroot | ||
done | ||
- name: build zlib | ||
run: | | ||
install -d src/zlib | ||
cd src/zlib | ||
curl -L -o src.tar.gz https://zlib.net/fossils/zlib-1.3.tar.gz | ||
tar vxf src.tar.gz --strip-components=1 | ||
sed -i 's|/share/pkgconfig|/lib/pkgconfig|' CMakeLists.txt | ||
cmake -S . -B build.d -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/amd64-unknown-netbsd-3rdroot -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTING=OFF | ||
cmake --build build.d | ||
cmake --install build.d | ||
- name: build libiconv | ||
run: | | ||
install -d src/libiconv | ||
cd src/libiconv | ||
curl -L -o src.tar.gz https://ftp.gnu.org/gnu/libiconv/libiconv-1.17.tar.gz | ||
tar vxf src.tar.gz --strip-components=1 | ||
./configure --host=amd64-unknown-netbsd --prefix=${{ github.workspace }}/amd64-unknown-netbsd-3rdroot --enable-extra-encodings --enable-static --disable-shared | ||
make V=1 | ||
make install | ||
- name: build libxml2 | ||
run: | | ||
install -d src/libxml2 | ||
cd src/libxml2 | ||
curl -L -o src.tar.gz https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.6.tar.xz | ||
tar vxf src.tar.gz --strip-components=1 | ||
./configure --host=amd64-unknown-netbsd --prefix=${{ github.workspace }}/amd64-unknown-netbsd-3rdroot --with-zlib --without-lzma --without-python --without-readline --without-coverage --enable-ipv6 --enable-static --disable-shared LIBS=-liconv | ||
make V=1 | ||
make install | ||
- name: build libyaml | ||
run: | | ||
install -d src/libyaml | ||
cd src/libyaml | ||
curl -L -o src.tar.gz https://github.com/yaml/libyaml/releases/download/0.2.5/yaml-0.2.5.tar.gz | ||
tar vxf src.tar.gz --strip-components=1 | ||
./configure --host=amd64-unknown-netbsd --prefix=${{ github.workspace }}/amd64-unknown-netbsd-3rdroot | ||
make V=1 | ||
make install | ||
- name: build jansson | ||
run: | | ||
install -d src/jansson | ||
cd src/jansson | ||
curl -L -o src.tar.gz https://github.com/akheron/jansson/releases/download/v2.14/jansson-2.14.tar.gz | ||
tar vxf src.tar.gz --strip-components=1 | ||
cmake -S . -B build.d -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/amd64-unknown-netbsd-3rdroot -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTING=OFF -DJANSSON_BUILD_SHARED_LIBS=OFF -DJANSSON_BUILD_DOCS=OFF -DJANSSON_COVERAGE=OFF -DJANSSON_EXAMPLES=OFF -DJANSSON_WITHOUT_TESTS=ON | ||
cmake --build build.d | ||
cmake --install build.d | ||
- name: build libpcre2 | ||
run: | | ||
install -d src/libpcre2 | ||
cd src/libpcre2 | ||
curl -L -o src.tar.gz https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.tar.bz2 | ||
tar vxf src.tar.gz --strip-components=1 | ||
cmake -S . -B build.d -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/amd64-unknown-netbsd-3rdroot -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTING=OFF -DJANSSON_BUILD_SHARED_LIBS=OFF -DCMAKE_C_STANDARD=99 -DCMAKE_C_STANDARD_REQUIRED=ON -DPCRE2_BUILD_PCRE2_8=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DPCRE2_BUILD_PCRE2GREP=OFF -DPCRE2_BUILD_TESTS=OFF -DPCRE2_SUPPORT_VALGRIND=OFF -DPCRE2_SUPPORT_UNICODE=ON | ||
cmake --build build.d | ||
cmake --install build.d | ||
- run: ./autogen.sh | ||
- run: | | ||
./configure --host=amd64-unknown-netbsd --prefix=${{ github.workspace }}/uctags-netbsd-amd64 --enable-static || { | ||
cat config.log | ||
exit 1 | ||
} | ||
- run: make V=1 | ||
- run: make install | ||
|
||
- run: readelf -h ctags | ||
- run: readelf -d ctags | ||
- run: file ctags | grep NetBSD |
110 changes: 110 additions & 0 deletions
110
.github/workflows/cross-compile-for-freebsd-on-ubuntu.yml
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,110 @@ | ||
name: cross compile for FreeBSD on Ubuntu | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
freebsd-release-version: [13.2] | ||
|
||
runs-on: ubuntu-latest | ||
|
||
env: | ||
CC: clang --target=amd64-unknown-freebsd --sysroot=${{ github.workspace }}/amd64-unknown-freebsd-sysroot | ||
CFLAGS: -I${{ github.workspace }}/amd64-unknown-freebsd-3rdroot/include -v -fPIC | ||
LDFLAGS: -L${{ github.workspace }}/amd64-unknown-freebsd-3rdroot/lib -Wl,-v | ||
PKG_CONFIG_PATH: ${{ github.workspace }}/amd64-unknown-freebsd-3rdroot/lib/pkgconfig | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: universal-ctags/ctags | ||
|
||
- run: sudo apt-get -y update | ||
- run: sudo apt-get -y install clang cmake make automake autoconf curl file | ||
|
||
- run: install -d amd64-unknown-freebsd-sysroot | ||
- run: install -d amd64-unknown-freebsd-3rdroot | ||
|
||
- run: curl -L -o amd64-unknown-freebsd-sysroot.txz https://archive.freebsd.org/old-releases/amd64/${{ matrix.freebsd-release-version }}-RELEASE/base.txz | ||
- run: tar vxf amd64-unknown-freebsd-sysroot.txz -C amd64-unknown-freebsd-sysroot | ||
|
||
- name: build zlib | ||
run: | | ||
install -d src/zlib | ||
cd src/zlib | ||
curl -L -o src.tar.gz https://zlib.net/fossils/zlib-1.3.tar.gz | ||
tar vxf src.tar.gz --strip-components=1 | ||
sed -i 's|/share/pkgconfig|/lib/pkgconfig|' CMakeLists.txt | ||
cmake -S . -B build.d -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/amd64-unknown-freebsd-3rdroot -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTING=OFF | ||
cmake --build build.d | ||
cmake --install build.d | ||
- name: build libiconv | ||
run: | | ||
install -d src/libiconv | ||
cd src/libiconv | ||
curl -L -o src.tar.gz https://ftp.gnu.org/gnu/libiconv/libiconv-1.17.tar.gz | ||
tar vxf src.tar.gz --strip-components=1 | ||
./configure --host=amd64-unknown-freebsd --prefix=${{ github.workspace }}/amd64-unknown-freebsd-3rdroot --enable-extra-encodings --enable-static --disable-shared | ||
make V=1 | ||
make install | ||
- name: build libxml2 | ||
run: | | ||
install -d src/libxml2 | ||
cd src/libxml2 | ||
curl -L -o src.tar.gz https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.6.tar.xz | ||
tar vxf src.tar.gz --strip-components=1 | ||
./configure --host=amd64-unknown-freebsd --prefix=${{ github.workspace }}/amd64-unknown-freebsd-3rdroot --with-zlib --without-lzma --without-python --without-readline --without-coverage --enable-ipv6 --enable-static --disable-shared LIBS=-liconv | ||
make V=1 | ||
make install | ||
- name: build libyaml | ||
run: | | ||
install -d src/libyaml | ||
cd src/libyaml | ||
curl -L -o src.tar.gz https://github.com/yaml/libyaml/releases/download/0.2.5/yaml-0.2.5.tar.gz | ||
tar vxf src.tar.gz --strip-components=1 | ||
./configure --host=amd64-unknown-freebsd --prefix=${{ github.workspace }}/amd64-unknown-freebsd-3rdroot | ||
make V=1 | ||
make install | ||
- name: build jansson | ||
run: | | ||
install -d src/jansson | ||
cd src/jansson | ||
curl -L -o src.tar.gz https://github.com/akheron/jansson/releases/download/v2.14/jansson-2.14.tar.gz | ||
tar vxf src.tar.gz --strip-components=1 | ||
cmake -S . -B build.d -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/amd64-unknown-freebsd-3rdroot -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTING=OFF -DJANSSON_BUILD_SHARED_LIBS=OFF -DJANSSON_BUILD_DOCS=OFF -DJANSSON_COVERAGE=OFF -DJANSSON_EXAMPLES=OFF -DJANSSON_WITHOUT_TESTS=ON | ||
cmake --build build.d | ||
cmake --install build.d | ||
- name: build libpcre2 | ||
run: | | ||
install -d src/libpcre2 | ||
cd src/libpcre2 | ||
curl -L -o src.tar.gz https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.tar.bz2 | ||
tar vxf src.tar.gz --strip-components=1 | ||
cmake -S . -B build.d -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/amd64-unknown-freebsd-3rdroot -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTING=OFF -DJANSSON_BUILD_SHARED_LIBS=OFF -DCMAKE_C_STANDARD=99 -DCMAKE_C_STANDARD_REQUIRED=ON -DPCRE2_BUILD_PCRE2_8=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DPCRE2_BUILD_PCRE2GREP=OFF -DPCRE2_BUILD_TESTS=OFF -DPCRE2_SUPPORT_VALGRIND=OFF -DPCRE2_SUPPORT_UNICODE=ON | ||
cmake --build build.d | ||
cmake --install build.d | ||
- run: ./autogen.sh | ||
- run: | | ||
./configure --host=amd64-unknown-freebsd --prefix=${{ github.workspace }}/uctags-freebsd-amd64 --enable-static || { | ||
cat config.log | ||
exit 1 | ||
} | ||
- run: make V=1 | ||
- run: make install | ||
|
||
- run: readelf -h ctags | ||
- run: readelf -d ctags | ||
- run: file ctags | grep FreeBSD |
125 changes: 125 additions & 0 deletions
125
.github/workflows/cross-compile-for-openbsd-on-ubuntu.yml
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,125 @@ | ||
name: cross compile for OpenBSD on Ubuntu | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
openbsd-release-version: [7.4] | ||
|
||
runs-on: ubuntu-latest | ||
|
||
env: | ||
CC: clang --target=amd64-unknown-openbsd --sysroot=${{ github.workspace }}/amd64-unknown-openbsd-sysroot | ||
CFLAGS: -I${{ github.workspace }}/amd64-unknown-openbsd-3rdroot/include -v -fPIC | ||
LDFLAGS: -L${{ github.workspace }}/amd64-unknown-openbsd-3rdroot/lib -Wl,-v | ||
PKG_CONFIG_PATH: ${{ github.workspace }}/amd64-unknown-openbsd-3rdroot/lib/pkgconfig | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: universal-ctags/ctags | ||
|
||
- run: sudo apt-get -y update | ||
- run: sudo apt-get -y install clang cmake make automake autoconf pkg-config curl file | ||
|
||
- run: install -d amd64-unknown-openbsd-sysroot | ||
- run: install -d amd64-unknown-openbsd-3rdroot | ||
|
||
- name: install amd64-unknown-openbsd-sysroot | ||
run: | | ||
major="$(printf '%s\n' ${{ matrix.openbsd-release-version }} | cut -d. -f1)" | ||
minor="$(printf '%s\n' ${{ matrix.openbsd-release-version }} | cut -d. -f2)" | ||
for item in base comp | ||
do | ||
FILENAME="$item$major$minor.tgz" | ||
curl -LO "https://cdn.openbsd.org/pub/OpenBSD/${{ matrix.openbsd-release-version }}/amd64/$FILENAME" | ||
tar vxf "$FILENAME" -C amd64-unknown-openbsd-sysroot | ||
done | ||
- name: build zlib | ||
run: | | ||
install -d src/zlib | ||
cd src/zlib | ||
curl -L -o src.tar.gz https://zlib.net/fossils/zlib-1.3.tar.gz | ||
tar vxf src.tar.gz --strip-components=1 | ||
sed -i 's|/share/pkgconfig|/lib/pkgconfig|' CMakeLists.txt | ||
cmake -S . -B build.d -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/amd64-unknown-openbsd-3rdroot -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTING=OFF | ||
cmake --build build.d | ||
cmake --install build.d | ||
- name: build libiconv | ||
run: | | ||
install -d src/libiconv | ||
cd src/libiconv | ||
curl -L -o src.tar.gz https://ftp.gnu.org/gnu/libiconv/libiconv-1.17.tar.gz | ||
tar vxf src.tar.gz --strip-components=1 | ||
./configure --host=amd64-unknown-openbsd --prefix=${{ github.workspace }}/amd64-unknown-openbsd-3rdroot --enable-extra-encodings --enable-static --disable-shared | ||
make V=1 | ||
make install | ||
- name: build libxml2 | ||
run: | | ||
install -d src/libxml2 | ||
cd src/libxml2 | ||
curl -L -o src.tar.gz https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.6.tar.xz | ||
tar vxf src.tar.gz --strip-components=1 | ||
./configure --host=amd64-unknown-openbsd --prefix=${{ github.workspace }}/amd64-unknown-openbsd-3rdroot --with-zlib --without-lzma --without-python --without-readline --without-coverage --enable-ipv6 --enable-static --disable-shared LIBS=-liconv | ||
make V=1 | ||
make install | ||
cd ${{ github.workspace }}/amd64-unknown-openbsd-3rdroot/lib/pkgconfig | ||
sed -i '/^Requires: /d' libxml-2.0.pc | ||
printf 'Requires: zlib\n' >> libxml-2.0.pc | ||
- name: build libyaml | ||
run: | | ||
install -d src/libyaml | ||
cd src/libyaml | ||
curl -L -o src.tar.gz https://github.com/yaml/libyaml/releases/download/0.2.5/yaml-0.2.5.tar.gz | ||
tar vxf src.tar.gz --strip-components=1 | ||
./configure --host=amd64-unknown-openbsd --prefix=${{ github.workspace }}/amd64-unknown-openbsd-3rdroot | ||
make V=1 | ||
make install | ||
- name: build jansson | ||
run: | | ||
install -d src/jansson | ||
cd src/jansson | ||
curl -L -o src.tar.gz https://github.com/akheron/jansson/releases/download/v2.14/jansson-2.14.tar.gz | ||
tar vxf src.tar.gz --strip-components=1 | ||
cmake -S . -B build.d -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/amd64-unknown-openbsd-3rdroot -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTING=OFF -DJANSSON_BUILD_SHARED_LIBS=OFF -DJANSSON_BUILD_DOCS=OFF -DJANSSON_COVERAGE=OFF -DJANSSON_EXAMPLES=OFF -DJANSSON_WITHOUT_TESTS=ON | ||
cmake --build build.d | ||
cmake --install build.d | ||
- name: build libpcre2 | ||
run: | | ||
install -d src/libpcre2 | ||
cd src/libpcre2 | ||
curl -L -o src.tar.gz https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.tar.bz2 | ||
tar vxf src.tar.gz --strip-components=1 | ||
cmake -S . -B build.d -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/amd64-unknown-openbsd-3rdroot -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTING=OFF -DJANSSON_BUILD_SHARED_LIBS=OFF -DCMAKE_C_STANDARD=99 -DCMAKE_C_STANDARD_REQUIRED=ON -DPCRE2_BUILD_PCRE2_8=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DPCRE2_BUILD_PCRE2GREP=OFF -DPCRE2_BUILD_TESTS=OFF -DPCRE2_SUPPORT_VALGRIND=OFF -DPCRE2_SUPPORT_UNICODE=ON | ||
cmake --build build.d | ||
cmake --install build.d | ||
- run: rm ${{ github.workspace }}/amd64-unknown-openbsd-3rdroot/lib/lib*.so | ||
|
||
- run: ./autogen.sh | ||
- run: | | ||
./configure --host=amd64-unknown-openbsd --prefix=${{ github.workspace }}/uctags-openbsd-amd64 || { | ||
cat config.log | ||
exit 1 | ||
} | ||
- run: cat config.log | ||
- run: make V=1 | ||
- run: make install | ||
|
||
- run: readelf -h ctags | ||
- run: readelf -d ctags | ||
- run: file ctags | grep OpenBSD |