diff --git a/.github/workflows/bootstrap-deps.sh b/.github/workflows/bootstrap-deps.sh index 0ad73e4..4cbf004 100755 --- a/.github/workflows/bootstrap-deps.sh +++ b/.github/workflows/bootstrap-deps.sh @@ -7,8 +7,6 @@ if [ x"${1}" = x"" ]; then exit 1 fi -EMSCRIPTEN_VERSION=${EMSCRIPTEN_VERSION:=latest} - function get_linux_deb_arch() { case "${1}" in "linux-aarch64") echo "arm64" ;; @@ -16,36 +14,54 @@ function get_linux_deb_arch() { "linux-i686") echo "i386" ;; "linux-riscv64") echo "riscv64" ;; "linux-x86_64") echo "amd64" ;; - "win32"|"win64") echo "i386" ;; esac } function install_compiler() { case "${1}" in "linux-aarch64") - apt-get install -yqq g++-aarch64-linux-gnu + if [ "$(uname -m)" != "aarch64" ]; then + apt-get install -yqq g++-aarch64-linux-gnu + else + apt-get install -yqq g++ + fi ;; "linux-armhf") - apt-get install -yqq g++-arm-linux-gnueabihf + if [ "$(uname -m)" != "armhf" ]; then + apt-get install -yqq g++-arm-linux-gnueabihf + else + apt-get install -yqq g++ + fi ;; "linux-i686") - apt-get install -yqq g++-i686-linux-gnu + if [ "$(uname -m)" != "i686" ]; then + apt-get install -yqq g++-i686-linux-gnu + else + apt-get install -yqq g++ + fi ;; "linux-riscv64") - apt-get install -yqq g++-riscv64-linux-gnu + if [ "$(uname -m)" != "riscv64" ]; then + apt-get install -yqq g++-riscv64-linux-gnu + else + apt-get install -yqq g++ + fi ;; "linux-x86_64") - # FIXME this assumes build runner is x86_64 - apt-get install -yqq g++ - ;; - "wasm") - [ -e ~/PawPawBuilds/emsdk ] || git clone https://github.com/emscripten-core/emsdk.git ~/PawPawBuilds/emsdk - cd ~/PawPawBuilds/emsdk && ./emsdk install ${EMSCRIPTEN_VERSION} && ./emsdk activate ${EMSCRIPTEN_VERSION} + if [ "$(uname -m)" != "x86_64" ]; then + apt-get install -yqq g++-x86_64-linux-gnu + else + apt-get install -yqq g++ + fi ;; "win32") + dpkg --add-architecture i386 + apt-get update -qq apt-get install -yqq binutils-mingw-w64-i686 g++-mingw-w64-i686 mingw-w64 wine-stable ;; "win64") + dpkg --add-architecture i386 + apt-get update -qq apt-get install -yqq binutils-mingw-w64-x86-64 g++-mingw-w64-x86-64 mingw-w64 wine-stable ;; esac @@ -54,12 +70,14 @@ function install_compiler() { case "${1}" in "macos"|"macos-universal"|"macos-universal-10.15") brew install cmake git jq meson + + [ -n "${GITHUB_ENV}" ] && echo "PAWPAW_PACK_NAME=${1}-$(sw_vers -productVersion)" >> "${GITHUB_ENV}" ;; *) - sed -i "s/deb http/deb [arch=amd64] http/" /etc/apt/sources.list - sed -i "s/deb mirror/deb [arch=amd64] mirror/" /etc/apt/sources.list + 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 apt-get update -qq - apt-get install -yqq autoconf automake autopoint binfmt-support build-essential curl cmake git jq lsb-release meson gperf qemu-user-static + apt-get install -yqq autoconf automake autopoint binfmt-support build-essential curl cmake git jq lsb-release meson gperf patchelf qemu-user-static arch=$(get_linux_deb_arch "${1}") release=$(lsb_release -cs) @@ -76,5 +94,7 @@ case "${1}" in fi install_compiler "${1}" + + [ -n "${GITHUB_ENV}" ] && echo "PAWPAW_PACK_NAME=${1}-${release}" >> "${GITHUB_ENV}" ;; esac diff --git a/.github/workflows/bootstrap.yml b/.github/workflows/bootstrap.yml index 32fe54d..c827fac 100644 --- a/.github/workflows/bootstrap.yml +++ b/.github/workflows/bootstrap.yml @@ -4,7 +4,7 @@ on: push: env: - CACHE_VERSION: 3 + CACHE_VERSION: 1 DEBIAN_FRONTEND: noninteractive EMSCRIPTEN_VERSION: 3.1.27 PAWPAW_SKIP_TESTS: 1 @@ -14,36 +14,70 @@ jobs: strategy: matrix: include: + # macos + - target: macos + os: macos-11 + - target: macos-universal + os: macos-11 + - target: macos-universal-10.15 + os: macos-11 + # ubuntu:18.04 - target: linux-aarch64 + container: ubuntu:18.04 os: ubuntu-latest - container: ubuntu:22.04 - target: linux-armhf + container: ubuntu:18.04 os: ubuntu-latest - container: ubuntu:22.04 - target: linux-i686 + container: ubuntu:18.04 + os: ubuntu-latest + #- target: linux-riscv64 + #container: ubuntu:18.04 + #os: ubuntu-latest + - target: linux-x86_64 + container: ubuntu:18.04 + os: ubuntu-latest + # ubuntu:20.04 + - target: linux-aarch64 + container: ubuntu:20.04 + os: ubuntu-latest + - target: linux-armhf + container: ubuntu:20.04 + os: ubuntu-latest + - target: linux-i686 + container: ubuntu:20.04 os: ubuntu-latest - container: ubuntu:22.04 - target: linux-riscv64 + container: ubuntu:20.04 os: ubuntu-latest - container: ubuntu:22.04 - target: linux-x86_64 + container: ubuntu:20.04 os: ubuntu-latest + # ubuntu:22.04 + - target: linux-aarch64 container: ubuntu:22.04 - - target: macos - os: macos-11 - - target: macos-universal - os: macos-11 - - target: macos-universal-10.15 - os: macos-11 - - target: wasm os: ubuntu-latest + - target: linux-armhf container: ubuntu:22.04 - - target: win32 os: ubuntu-latest + - target: linux-i686 + container: ubuntu:22.04 + os: ubuntu-latest + - target: linux-riscv64 container: ubuntu:22.04 - - target: win64 os: ubuntu-latest + - target: linux-x86_64 + container: ubuntu:22.04 + os: ubuntu-latest + - target: wasm container: ubuntu:22.04 + os: ubuntu-latest + - target: win32 + container: ubuntu:22.04 + os: ubuntu-latest + - target: win64 + container: ubuntu:22.04 + os: ubuntu-latest runs-on: ${{ matrix.os }} container: image: ${{ matrix.container }} @@ -54,25 +88,22 @@ jobs: with: path: | ~/PawPawBuilds - key: common-${{ matrix.target }}-v${{ env.CACHE_VERSION }} + key: common-${{ matrix.container || matrix.os }}-${{ matrix.target }}-v${{ env.CACHE_VERSION }} - name: Set up dependencies run: | ./.github/workflows/bootstrap-deps.sh ${{ matrix.target }} - name: Run bootstrap shell: bash run: | - if [ '${{ matrix.target }}' == 'wasm' ]; then - source ~/PawPawBuilds/emsdk/emsdk_env.sh - fi ./bootstrap-common.sh ${{ matrix.target }} && ./.cleanup.sh ${{ matrix.target }} - name: Pack bootstrap build shell: bash run: | - tar -C ~/PawPawBuilds -czf common-${{ matrix.target }}.tar.gz builds targets + tar -C ~/PawPawBuilds -czf common-${{ env.PAWPAW_PACK_NAME }}.tar.gz builds targets - uses: actions/upload-artifact@v3 with: - name: common-${{ matrix.target }} - path: common-${{ matrix.target }}.tar.gz + name: common-${{ env.PAWPAW_PACK_NAME }} + path: common-${{ env.PAWPAW_PACK_NAME }}.tar.gz #plugins: #strategy: diff --git a/setup/env.sh b/setup/env.sh index 0bb9219..755d874 100644 --- a/setup/env.sh +++ b/setup/env.sh @@ -70,6 +70,20 @@ if [ -n "${PAWPAW_NOSIMD}" ] && [ "${PAWPAW_NOSIMD}" -ne 0 ]; then PAWPAW_PREFIX+="-nosimd" fi +# --------------------------------------------------------------------------------------------------------------------- +# emscripten setup + +if [ "${WASM}" -eq 1 ]; then + EMSCRIPTEN_VERSION=${EMSCRIPTEN_VERSION:=3.1.27} + + if [ ! -e "${PAWPAW_DIR}/emsdk" ]; then + git clone https://github.com/emscripten-core/emsdk.git "${PAWPAW_DIR}/emsdk" + "${PAWPAW_DIR}/emsdk/emsdk" install ${EMSCRIPTEN_VERSION} && "${PAWPAW_DIR}/emsdk/emsdk" activate ${EMSCRIPTEN_VERSION} + fi + + source "${PAWPAW_DIR}/emsdk/emsdk_env.sh" +fi + # --------------------------------------------------------------------------------------------------------------------- # build environment