Skip to content

Commit

Permalink
Simplify CI setup, move some logic to a script
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Dec 8, 2023
1 parent 8ccc290 commit 1f0ad6e
Show file tree
Hide file tree
Showing 11 changed files with 314 additions and 60 deletions.
146 changes: 146 additions & 0 deletions .github/workflows/bootstrap-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
#!/bin/bash

set -e

if [ x"${1}" = x"" ]; then
echo "usage: $0 <target>"
exit 1
fi

function get_linux_deb_arch() {
case "${1}" in
"linux-aarch64") echo "arm64" ;;
"linux-armhf") echo "armhf" ;;
"linux-i686") echo "i386" ;;
"linux-riscv64") echo "riscv64" ;;
"linux-x86_64") echo "amd64" ;;
esac
}

function install_compiler() {
local arch="${1}"
local release="${2}"

apt-get install -yqq g++

if [ -n "${GITHUB_ENV}" ] && [ "${release}" = "bionic" ]; then
apt-get install -yqq g++-11
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 60 --slave /usr/bin/g++ g++ /usr/bin/g++-11
fi

case "${arch}" in
"linux-aarch64")
if [ "$(uname -m)" != "aarch64" ]; then
apt-get install -yqq g++-aarch64-linux-gnu
elif [ -n "${GITHUB_ENV}" ] && [ "${release}" = "bionic" ]; then
update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc /usr/bin/gcc-11 60 --slave /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ /usr/bin/g++-11
fi
;;
"linux-armhf")
if [ "$(uname -m)" != "armhf" ]; then
apt-get install -yqq g++-arm-linux-gnueabihf
elif [ -n "${GITHUB_ENV}" ] && [ "${release}" = "bionic" ]; then
update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/gcc-11 60 --slave /usr/bin/arm-linux-gnueabihf-g++ arm-linux-gnueabihf-g++ /usr/bin/g++-11
fi
;;
"linux-i686")
if [ "$(uname -m)" != "i686" ]; then
apt-get install -yqq g++-i686-linux-gnu
elif [ -n "${GITHUB_ENV}" ] && [ "${release}" = "bionic" ]; then
update-alternatives --install /usr/bin/i686-linux-gnu-gcc i686-linux-gnu-gcc /usr/bin/gcc-11 60 --slave /usr/bin/i686-linux-gnu-g++ i686-linux-gnu-g++ /usr/bin/g++-11
fi
;;
"linux-riscv64")
if [ "$(uname -m)" != "riscv64" ]; then
apt-get install -yqq g++-riscv64-linux-gnu
fi
;;
"linux-x86_64")
if [ "$(uname -m)" != "x86_64" ]; then
apt-get install -yqq g++-x86_64-linux-gnu
elif [ -n "${GITHUB_ENV}" ] && [ "${release}" = "bionic" ]; then
update-alternatives --install /usr/bin/x86_64-linux-gnu-gcc x86_64-linux-gnu-gcc /usr/bin/gcc-11 60 --slave /usr/bin/x86_64-linux-gnu-g++ x86_64-linux-gnu-g++ /usr/bin/g++-11
fi
;;
"win32")
apt-get install -yqq binutils-mingw-w64-i686 g++-mingw-w64-i686
;;
"win64")
apt-get install -yqq binutils-mingw-w64-x86-64 g++-mingw-w64-x86-64
;;
esac
}

case "${1}" in
"macos"|"macos-universal"|"macos-universal-10.15")
brew install autoconf automake cmake coreutils gawk git gnu-sed jq make meson

[ -n "${GITHUB_ENV}" ] && echo "PAWPAW_PACK_NAME=${1}-$(sw_vers -productVersion | cut -d '.' -f 1)" >> "${GITHUB_ENV}"
;;
*)
apt-get update -qq
apt-get install -yqq autoconf automake build-essential curl cmake file git jq libglib2.0-dev-bin libtool lsb-release make meson gperf patchelf uuid-dev zlib1g-dev

linux_arch=$(get_linux_deb_arch "${1}")
release=$(lsb_release -cs 2>/dev/null)

if [ -n "${linux_arch}" ]; then
if [ "$(lsb_release -si 2>/dev/null)" = "Ubuntu" ]; then
sed -i "s/deb http/deb [arch=i386,amd64] http/" /etc/apt/sources.list
sed -i "s/deb mirror/deb [arch=i386,amd64] mirror/" /etc/apt/sources.list
if [ "${linux_arch}" != "amd64" ] && [ "${linux_arch}" != "i386" ]; then
echo "deb [arch=${linux_arch}] http://ports.ubuntu.com/ubuntu-ports ${release} main restricted universe multiverse" | tee -a /etc/apt/sources.list
echo "deb [arch=${linux_arch}] http://ports.ubuntu.com/ubuntu-ports ${release}-updates main restricted universe multiverse" | tee -a /etc/apt/sources.list
echo "deb [arch=${linux_arch}] http://ports.ubuntu.com/ubuntu-ports ${release}-backports main restricted universe multiverse" | tee -a /etc/apt/sources.list
fi
if [ -n "${GITHUB_ENV}" ] && [ "${release}" = "bionic" ]; then
apt-get install -yqq --no-install-recommends software-properties-common
add-apt-repository -yn ppa:ubuntu-toolchain-r/test
fi
fi
dpkg --add-architecture ${linux_arch}
apt-get update -qq
apt-get install -yqq \
binfmt-support \
qemu-user-static \
qtbase5-dev-tools \
libasound2-dev:${linux_arch} \
libdbus-1-dev:${linux_arch} \
libgl1-mesa-dev:${linux_arch} \
libglib2.0-dev:${linux_arch} \
libpcre2-dev:${linux_arch} \
libpcre3-dev:${linux_arch} \
libqt5svg5-dev:${linux_arch} \
libx11-dev:${linux_arch} \
libxcb1-dev:${linux_arch} \
libxcursor-dev:${linux_arch} \
libxext-dev:${linux_arch} \
libxfixes-dev:${linux_arch} \
libxrandr-dev:${linux_arch} \
libxrender-dev:${linux_arch} \
qtbase5-dev:${linux_arch} \
uuid-dev:${linux_arch}
elif [ "${1}" = "win32" ] || [ "${1}" = "win64" ]; then
dpkg --add-architecture i386
apt-get update -qq
apt-get install -yqq autopoint libffi-dev libreadline-dev mingw-w64
if [ "$(lsb_release -si 2>/dev/null)" = "Debian" ]; then
apt-get install -yqq wine wine32 wine64
else
apt-get install -yqq wine-stable
fi
fi

case "${release}" in
"bionic"|"bullseye"|"focal")
apt-get install -yqq --no-install-recommends python3-pip
pip3 install --isolated --upgrade --no-cache-dir --force-reinstall pip
pip3 install --isolated --upgrade --no-cache-dir --force-reinstall cmake meson
;;
esac

install_compiler "${1}" "${release}"

[ -n "${GITHUB_ENV}" ] && echo "PAWPAW_PACK_NAME=${1}-${release}" >> "${GITHUB_ENV}"
;;
esac
84 changes: 30 additions & 54 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,69 +14,45 @@ jobs:
strategy:
matrix:
include:
- name: amd64
cflags:
ldflags:
prefix: x86_64-linux-gnu
#- name: arm64
#cflags:
#ldflags:
#prefix: aarch64-linux-gnu
#- name: armhf
#cflags: -mfpu=neon-vfpv4 -mfloat-abi=hard
#ldflags:
#prefix: arm-linux-gnueabihf
#- name: i386
#cflags:
#ldflags:
#prefix: i686-linux-gnu
#- target: linux-aarch64
#prefix: aarch64-linux-gnu
#deb_arch: arm64
#- target: linux-armhf
#prefix: arm-linux-gnueabihf
#deb_arch: armhf
#- target: linux-i686
#prefix: i686-linux-gnu
#deb_arch: i386
#- target: linux-riscv64
#prefix: riscv64-linux-gnu
#deb_arch: riscv64
- target: linux-x86_64
prefix: x86_64-linux-gnu
deb_arch: amd64
runs-on: ubuntu-latest
container:
image: ubuntu:20.04
image: ubuntu:20.04
steps:
- name: Set up dependencies
- name: Install git
run: |
dpkg --add-architecture ${{ matrix.name }}
if [ "${{ matrix.name }}" != "amd64" ] && [ "${{ matrix.name }}" != "i386" ]; then
sed -i "s/deb http/deb [arch=amd64] http/" /etc/apt/sources.list
echo "deb [arch=${{ matrix.name }}] http://ports.ubuntu.com/ubuntu-ports focal main restricted universe multiverse" | tee -a /etc/apt/sources.list
echo "deb [arch=${{ matrix.name }}] http://ports.ubuntu.com/ubuntu-ports focal-updates main restricted universe multiverse" | tee -a /etc/apt/sources.list
echo "deb [arch=${{ matrix.name }}] http://ports.ubuntu.com/ubuntu-ports focal-backports main restricted universe multiverse" | tee -a /etc/apt/sources.list
fi
apt-get update -qq
apt-get install -yqq \
binfmt-support \
build-essential \
git \
meson \
pkg-config \
qemu-user-static \
$(echo g++-${{ matrix.prefix }} | sed 's/_/-/g') \
libasound2-dev:${{ matrix.name }} \
libfftw3-dev:${{ matrix.name }} \
libfreetype6-dev:${{ matrix.name }} \
libgl1-mesa-dev:${{ matrix.name }} \
libx11-dev:${{ matrix.name }} \
libxcomposite-dev:${{ matrix.name }} \
libxcursor-dev:${{ matrix.name }} \
libxrender-dev:${{ matrix.name }}
apt-get update -qq && apt-get install -yqq --no-install-recommends ca-certificates curl git openssl
curl -sLO https://launchpad.net/~kxstudio-debian/+archive/ubuntu/toolchain/+files/git_2.34.1-1ubuntu1~bpo20.04.1~ppa1_amd64.deb
curl -sLO https://launchpad.net/~kxstudio-debian/+archive/ubuntu/toolchain/+files/git-man_2.34.1-1ubuntu1~bpo20.04.1~ppa1_all.deb
dpkg -i *.deb
rm *.deb
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up dependencies
run: |
./.github/workflows/bootstrap-deps.sh ${{ matrix.target }}
apt-get install -yqq libfftw3-dev:${{ matrix.deb_arch }} libfreetype6-dev:${{ matrix.deb_arch }}
- name: Build
env:
AR: ${{ matrix.prefix }}-ar
CC: ${{ matrix.prefix }}-gcc
CXX: ${{ matrix.prefix }}-g++
LD: ${{ matrix.prefix }}-ld
NM: ${{ matrix.prefix }}-nm
STRIP: ${{ matrix.prefix }}-strip
CFLAGS: ${{ matrix.cflags }}
CXXFLAGS: ${{ matrix.cflags }}
LDFLAGS: ${{ matrix.ldflags }} -static-libgcc -static-libstdc++
LDFLAGS: -static-libgcc -static-libstdc++
PKG_CONFIG_PATH: /usr/lib/${{ matrix.prefix }}/pkgconfig
run: |
meson build --buildtype=release --prefix=/usr
meson build --buildtype=release --prefix=/usr --cross-file scripts/meson/${{ matrix.target }}.ini
ninja -C build
- name: Install
run: |
Expand All @@ -91,10 +67,10 @@ jobs:
echo "SHA8=$(echo ${{ github.sha }} | cut -c1-8)" >> $GITHUB_ENV
- name: Pack binaries
run: |
tar czf ${{ github.event.repository.name }}-linux-${{ matrix.name }}-${{ github.event.pull_request.number || env.SHA8 }}.tar.gz -C ${{ env.DESTDIR }}/usr/lib lv2 vst vst3
tar czf ${{ github.event.repository.target }}-linux-${{ matrix.target }}-${{ github.event.pull_request.number || env.SHA8 }}.tar.gz -C ${{ env.DESTDIR }}/usr/lib lv2 vst vst3
- uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}-linux-${{ matrix.name }}-${{ github.event.pull_request.number || env.SHA8 }}
name: ${{ github.event.repository.target }}-linux-${{ matrix.target }}-${{ github.event.pull_request.number || env.SHA8 }}
path: |
*.tar.gz
- uses: softprops/action-gh-release@v1
Expand Down
19 changes: 19 additions & 0 deletions scripts/meson/linux-aarch64.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[binaries]
name = 'linux-aarch64'
c = 'aarch64-linux-gnu-gcc'
cpp = 'aarch64-linux-gnu-g++'
ar = 'aarch64-linux-gnu-gcc-ar'
nm = 'aarch64-linux-gnu-gcc-nm'
ld = 'aarch64-linux-gnu-ld'
strip = 'aarch64-linux-gnu-strip'
pkgconfig = 'pkg-config'
exe_wrapper = 'qemu-aarch64-static'

[host_machine]
system = 'linux'
cpu_family = 'aarch64'
cpu = 'aarch64'
endian = 'little'

[properties]
needs_exe_wrapper = true
19 changes: 19 additions & 0 deletions scripts/meson/linux-armhf.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[binaries]
name = 'linux-armhf'
c = 'arm-linux-gnueabihf-gcc'
cpp = 'arm-linux-gnueabihf-g++'
ar = 'arm-linux-gnueabihf-gcc-ar'
nm = 'arm-linux-gnueabihf-gcc-nm'
ld = 'arm-linux-gnueabihf-ld'
strip = 'arm-linux-gnueabihf-strip'
pkgconfig = 'pkg-config'
exe_wrapper = 'qemu-arm-static'

[host_machine]
system = 'linux'
cpu_family = 'arm'
cpu = 'arm'
endian = 'little'

[properties]
needs_exe_wrapper = true
19 changes: 19 additions & 0 deletions scripts/meson/linux-i686.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[binaries]
name = 'linux-i686'
c = 'i686-linux-gnu-gcc'
cpp = 'i686-linux-gnu-g++'
ar = 'i686-linux-gnu-gcc-ar'
nm = 'i686-linux-gnu-gcc-nm'
ld = 'i686-linux-gnu-ld'
strip = 'i686-linux-gnu-strip'
pkgconfig = 'pkg-config'
exe_wrapper = 'qemu-i386-static'

[host_machine]
system = 'linux'
cpu_family = 'i686'
cpu = 'i686'
endian = 'little'

[properties]
needs_exe_wrapper = true
19 changes: 19 additions & 0 deletions scripts/meson/linux-riscv64.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[binaries]
name = 'linux-riscv64'
c = 'riscv64-linux-gnu-gcc'
cpp = 'riscv64-linux-gnu-g++'
ar = 'riscv64-linux-gnu-gcc-ar'
nm = 'riscv64-linux-gnu-gcc-nm'
ld = 'riscv64-linux-gnu-ld'
strip = 'riscv64-linux-gnu-strip'
pkgconfig = 'pkg-config'
exe_wrapper = 'qemu-riscv64-static'

[host_machine]
system = 'linux'
cpu_family = 'riscv64'
cpu = 'riscv64'
endian = 'big'

[properties]
needs_exe_wrapper = true
19 changes: 19 additions & 0 deletions scripts/meson/linux-x86_64.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[binaries]
name = 'linux-aarch64'
c = 'x86_64-linux-gnu-gcc'
cpp = 'x86_64-linux-gnu-g++'
ar = 'x86_64-linux-gnu-gcc-ar'
nm = 'x86_64-linux-gnu-gcc-nm'
ld = 'x86_64-linux-gnu-ld'
strip = 'x86_64-linux-gnu-strip'
pkgconfig = 'pkg-config'
exe_wrapper = 'qemu-x86_64-static'

[host_machine]
system = 'linux'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[properties]
needs_exe_wrapper = true
19 changes: 19 additions & 0 deletions scripts/meson/macos-old.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[binaries]
name = 'macos-old'
c = 'i686-apple-darwin10-gcc'
cpp = 'i686-apple-darwin10-g++'
ar = 'i686-apple-darwin10-gcc-ar'
nm = 'i686-apple-darwin10-gcc-nm'
ld = 'i686-apple-darwin10-ld'
strip = 'i686-apple-darwin10-strip'
pkgconfig = 'pkg-config'
# exe_wrapper = 'darwine'

[host_machine]
system = 'macos'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[properties]
needs_exe_wrapper = true
18 changes: 18 additions & 0 deletions scripts/meson/wasm.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[binaries]
name = 'wasm'
c = 'emcc'
cpp = 'em++'
ar = 'emar'
nm = 'emnm'
strip = 'emstrip'
pkgconfig = 'pkg-config'
exe_wrapper = 'emrun --no_server'

[host_machine]
system = 'wasm'
cpu_family = 'x86'
cpu = 'x86'
endian = 'little'

[properties]
needs_exe_wrapper = true
Loading

0 comments on commit 1f0ad6e

Please sign in to comment.