Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add meson support & use for cross-compilation of releases #35

Merged
merged 31 commits into from
Apr 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e314c3c
Add basic meson support
maxfierke Nov 12, 2021
92d9256
Fix meson compilation on macOS
maxfierke Feb 12, 2022
dcef3ab
Enable static linking of libraries w/ meson
maxfierke Feb 17, 2022
b00f803
Set crystal build flags based on buildtype
maxfierke Feb 17, 2022
bb41251
Remove .gitignore of builddir
maxfierke Feb 17, 2022
dd3856b
Replace readline with Term::Prompt
maxfierke Apr 11, 2022
c09252e
Make cross-compilation really work under meson
maxfierke Apr 11, 2022
fc0d1f9
Ensure meson is installed in CI
maxfierke Apr 11, 2022
5cfd4b4
Set PKG_CONFIG_PATH for Crystal's openssl version detection
maxfierke Apr 11, 2022
6281c51
Ensure ninja gets installed on ubuntu runners
maxfierke Apr 11, 2022
e03a78b
Use openssl@3 on macOS CI
maxfierke Apr 11, 2022
8b9d23f
Remove libedit from allowed dynlibs
maxfierke Apr 11, 2022
7856366
of course the order has changed to
maxfierke Apr 11, 2022
a10e8c5
Generate pkg-config for embedded openssl for Crystal to use for OpenS…
maxfierke Apr 12, 2022
3681244
Hopefully fix static linux-amd64 builds
maxfierke Apr 12, 2022
886df4c
set env vars for build compiler im x86_64 linux build
maxfierke Apr 14, 2022
63795a3
Don't generate pkgconfig for openssl if we're using openssl via pkgco…
maxfierke Apr 14, 2022
249e9f9
Use non-musl gcc for build machine on x86_64
maxfierke Apr 14, 2022
3a7fa70
specify CC_FOR_BUILD
maxfierke Apr 14, 2022
6f5c310
Add macOS arm64 build
maxfierke Apr 14, 2022
eccd3ad
Bump pcre wrap to 8.45-1
maxfierke Apr 14, 2022
7d68935
turn on verbose mode
maxfierke Apr 15, 2022
3a8825c
Be more explicit about LD, AR, and RANLIB
maxfierke Apr 15, 2022
89fab34
Fix AR, RANLIB paths, use absolute for _FOR_BUILD
maxfierke Apr 15, 2022
20f168d
idk maybe clang works
maxfierke Apr 15, 2022
3a1c480
try musl gcc on linux-x86_64 again for build machine
maxfierke Apr 15, 2022
0cc758d
ensure macos builds are stripped
maxfierke Apr 15, 2022
8c9dc91
:facepalm: maybe use the x86_64 musl cross since we're on gnu
maxfierke Apr 15, 2022
9dac7ba
Remove unknown- from cross-compiler setup
maxfierke Apr 16, 2022
4270bfe
Ensure musl gets statically linked properly
maxfierke Apr 16, 2022
c221a6b
Fix cross-compilation on Apple clang
maxfierke Apr 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Install crystal
run: brew install crystal
- name: Install crystal and tool dependencies
run: brew install crystal meson openssl@3

- name: Install dependencies
run: shards install

- name: Run tests
run: make test STATIC_LIBS=1
run: make test STATIC=1
env:
PKG_CONFIG_PATH: "/usr/local/opt/openssl@3/lib/pkgconfig"

ubuntu-tests:
runs-on: ubuntu-latest
Expand All @@ -36,8 +38,11 @@ jobs:
- name: Add Crystal repos
run: curl -sSL https://crystal-lang.org/install.sh | sudo bash

- name: Install crystal
run: sudo apt install -y crystal libevent-dev libpcre3-dev libreadline-dev libssl-dev
- name: Install crystal and tool dependencies
run: |
sudo apt install -y crystal libevent-dev libpcre3-dev libssl-dev ninja-build
sudo apt purge meson
sudo pip3 install meson

- name: Install dependencies
run: shards install
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/provision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Install crystal
run: brew install crystal
- name: Install crystal and tool dependencies
run: brew install crystal meson openssl@3

- name: Install dependencies
run: shards install

- name: Build mstrap
run: make build STATIC_LIBS=1
run: make build STATIC=1
env:
PKG_CONFIG_PATH: "/usr/local/opt/openssl@3/lib/pkgconfig"

# Based on https://raw.githubusercontent.com/MikeMcQuaid/strap/master/.github/workflows/tests.yml

Expand Down Expand Up @@ -81,11 +83,13 @@ jobs:
- name: Add Crystal repos
run: curl -sSL https://crystal-lang.org/install.sh | sudo bash

- name: Install crystal
- name: Install crystal and tool dependencies
run: |
sudo apt install -y crystal libevent-dev libpcre3-dev libreadline-dev libssl-dev \
curl \
sudo apt install -y crystal libevent-dev libpcre3-dev libssl-dev \
curl ninja-build \
ruby ruby-bundler
sudo apt purge meson
sudo pip3 install meson

- name: Install dependencies
run: shards install
Expand Down
107 changes: 88 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,30 @@ jobs:
- name: Add Crystal repos
run: curl -sSL https://crystal-lang.org/install.sh | sudo bash

- name: Install crystal
run: sudo apt install -y crystal libevent-dev libpcre3-dev libreadline-dev libssl-dev
- name: Install crystal and tool dependencies
run: |
sudo apt install -y crystal ninja-build
sudo apt purge meson
sudo pip3 install meson

- name: Install dependencies
run: shards install

- name: Install musl compiler
run: |
curl -O https://more.musl.cc/x86_64-linux-musl/x86_64-linux-musl-cross.tgz
tar xzf x86_64-linux-musl-cross.tgz -C /opt
echo "/opt/x86_64-linux-musl-cross/bin" >> $GITHUB_PATH

- run: x86_64-linux-musl-gcc --version

- name: Build release bundle
run: |
make release RELEASE=1 STATIC=1
make release RELEASE=1 STATIC=1 TARGET_CABI=musl
env:
CC_FOR_BUILD: /usr/bin/clang
CXX_FOR_BUILD: /usr/bin/clang++
LD_FOR_BUILD: lld

- name: Upload release bundle artifact
uses: actions/upload-artifact@v2
Expand All @@ -40,26 +55,26 @@ jobs:
- name: Add Crystal repos
run: curl -sSL https://crystal-lang.org/install.sh | sudo bash

- name: Install crystal
run: sudo apt install -y crystal libevent-dev libpcre3-dev libreadline-dev libssl-dev
- name: Install crystal and tool dependencies
run: |
sudo apt install -y crystal ninja-build
sudo apt purge meson
sudo pip3 install meson

- name: Install dependencies
run: shards install

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: arm64
- name: Install musl cross-compiler
run: |
curl -O https://more.musl.cc/x86_64-linux-musl/aarch64-linux-musl-cross.tgz
tar xzf aarch64-linux-musl-cross.tgz -C /opt
echo "/opt/aarch64-linux-musl-cross/bin" >> $GITHUB_PATH

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
- run: aarch64-linux-musl-gcc --version

- name: Build release bundle
run: |
make release RELEASE=1 STATIC=1 TARGET_ARCH=aarch64
make release RELEASE=1 STATIC=1 TARGET_ARCH=aarch64 TARGET_CABI=musl

- name: Upload release bundle artifact
uses: actions/upload-artifact@v2
Expand All @@ -73,8 +88,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Install crystal
run: brew install crystal
- name: Install crystal and tool dependencies
run: brew install crystal meson openssl@3

- name: Install gon via homebrew for code signing and app notarization
run: |
Expand All @@ -94,17 +109,54 @@ jobs:
env:
AC_USERNAME: ${{ secrets.AC_USERNAME }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
PKG_CONFIG_PATH: "/usr/local/opt/openssl@3/lib/pkgconfig"
run: |
make release RELEASE=1 STATIC_LIBS=1 GON_CONFIG=./gon.ci.hcl
make release RELEASE=1 STATIC=1 GON_CONFIG=./gon.ci.hcl

- name: Upload release bundle artifact
uses: actions/upload-artifact@v2
with:
name: mstrap_macos_amd64
path: dist

build_macos_arm64:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install crystal and tool dependencies
run: brew install crystal meson openssl@3

- name: Install gon via homebrew for code signing and app notarization
run: |
brew tap mitchellh/gon
brew install mitchellh/gon/gon

- name: Install dependencies
run: shards install

- name: Import Developer ID Application cert for signing and notorizing
uses: Apple-Actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071
with:
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}

- name: Build signed & notorized release bundle
env:
AC_USERNAME: ${{ secrets.AC_USERNAME }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
run: |
make release RELEASE=1 STATIC=1 TARGET_ARCH=arm64 GON_CONFIG=./gon.ci.hcl

- name: Upload release bundle artifact
uses: actions/upload-artifact@v2
with:
name: mstrap_macos_arm64
path: dist

release:
needs: [build_linux_amd64, build_linux_aarch64, build_macos_amd64]
needs: [build_linux_amd64, build_linux_aarch64, build_macos_amd64, build_macos_arm64]
runs-on: ubuntu-latest
steps:
- name: Determine version
Expand Down Expand Up @@ -132,6 +184,13 @@ jobs:
name: mstrap_macos_amd64
path: dist-macos-amd64

- name: Download mstrap_macos_arm64.zip artifact
id: download_macos_arm64
uses: actions/download-artifact@v2
with:
name: mstrap_macos_arm64
path: dist-macos-arm64

- name: Create release
id: create_release
uses: actions/create-release@v1
Expand Down Expand Up @@ -172,3 +231,13 @@ jobs:
asset_path: dist-macos-amd64/mstrap.zip
asset_name: mstrap-v${{ steps.version.outputs.version }}_macos_amd64.zip
asset_content_type: application/zip

- name: Upload release zip for macos arm64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist-macos-arm64/mstrap.zip
asset_name: mstrap-v${{ steps.version.outputs.version }}_macos_arm64.zip
asset_content_type: application/zip
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
/lib/
/bin/
/dist/
/subprojects/*
!/subprojects/*.wrap
!/subprojects/packagefiles
/.crystal/
/.shards/
*.dwarf
Expand Down
4 changes: 0 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ RUN \
# Crystal
crystal shards \
# mstrap depedencies (used by Crystal stdlib)
readline-dev \
readline-static \
ncurses-dev \
ncurses-static \
openssl-libs-static \
zlib-static

Expand Down
Loading