Skip to content

Commit

Permalink
ci release: add macos arm64 support (#1179)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgmdev authored Oct 30, 2022
1 parent 8a9bac7 commit d89d1e6
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 8 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ jobs:
name: macOS (x86_64)
needs: release
runs-on: macos-11
strategy:
matrix:
arch: [x86_64, arm64]
env:
CC: clang
CXX: clang++
Expand All @@ -110,8 +113,8 @@ jobs:
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_REF=${{ needs.release.outputs.version }}" >> "$GITHUB_ENV"
echo "INSTALL_NAME=lite-xl-${{ needs.release.outputs.version }}-macos-$(uname -m)" >> "$GITHUB_ENV"
echo "INSTALL_NAME_ADDONS=lite-xl-${{ needs.release.outputs.version }}-addons-macos-$(uname -m)" >> "$GITHUB_ENV"
echo "INSTALL_NAME=lite-xl-${{ needs.release.outputs.version }}-macos-${{ matrix.arch }}" >> "$GITHUB_ENV"
echo "INSTALL_NAME_ADDONS=lite-xl-${{ needs.release.outputs.version }}-addons-macos-${{ matrix.arch }}" >> "$GITHUB_ENV"
- uses: actions/checkout@v2
- name: Python Setup
uses: actions/setup-python@v2
Expand All @@ -122,11 +125,11 @@ jobs:
- name: Build
run: |
bash --version
bash scripts/build.sh --bundle --debug --forcefallback --release
CROSS_ARCH=${{ matrix.arch }} bash scripts/build.sh --bundle --debug --forcefallback --release
- name: Create DMG Image
run: |
bash scripts/package.sh --version ${INSTALL_REF} --debug --dmg --release
bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --dmg --release
CROSS_ARCH=${{ matrix.arch }} bash scripts/package.sh --version ${INSTALL_REF} --debug --dmg --release
CROSS_ARCH=${{ matrix.arch }} bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --dmg --release
- name: Upload Files
uses: softprops/action-gh-release@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions resources/macos/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<key>CFBundleShortVersionString</key>
<string>@PROJECT_VERSION@</string>
<key>NSHumanReadableCopyright</key>
<string>© 2019-2021 Francesco Abbate</string>
<string>© 2019-2022 Lite XL Team</string>
</dict>
</plist>
</plist>

24 changes: 24 additions & 0 deletions resources/macos/macos_arm64.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[host_machine]
system = 'darwin'
cpu_family = 'aarch64'
cpu = 'arm64'
endian = 'little'

[binaries]
c = ['clang']
cpp = ['clang++']
objc = ['clang']
objcpp = ['clang++']
ar = ['ar']
strip = ['strip']
pkgconfig = ['pkg-config']

[built-in options]
c_args = ['-arch', 'arm64']
cpp_args = ['-stdlib=libc++', '-arch', 'arm64']
objc_args = ['-arch', 'arm64']
objcpp_args = ['-stdlib=libc++', '-arch', 'arm64']
c_link_args = ['-arch', 'arm64']
cpp_link_args = ['-arch', 'arm64']
objc_link_args = ['-arch', 'arm64']
objcpp_link_args = ['-arch', 'arm64']
8 changes: 7 additions & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ show_help() {

main() {
local platform="$(get_platform_name)"
local arch="$(get_platform_arch)"
local build_dir="$(get_default_build_dir)"
local build_type="debug"
local prefix=/
Expand Down Expand Up @@ -106,11 +107,16 @@ main() {
portable=""
fi

if [[ $platform == "macos" && $arch == "arm64" ]]; then
cross_file="--cross-file resources/macos/macos_arm64.conf"
fi

rm -rf "${build_dir}"

CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS meson setup \
--buildtype=$build_type \
--prefix "$prefix" \
$cross_file \
$force_fallback \
$bundle \
$portable \
Expand All @@ -124,7 +130,7 @@ main() {

meson compile -C "${build_dir}"

if [ ! -z ${pgo+x} ]; then
if [[ $pgo != "" ]]; then
cp -r data "${build_dir}/src"
"${build_dir}/src/lite-xl"
meson configure -Db_pgo=use "${build_dir}"
Expand Down
2 changes: 2 additions & 0 deletions scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ get_platform_arch() {
else
arch=i686
fi
elif [[ $CROSS_ARCH != "" ]]; then
arch=$CROSS_ARCH
fi
echo "$arch"
}
Expand Down

0 comments on commit d89d1e6

Please sign in to comment.