Skip to content

Commit

Permalink
[ci] Make mac universal builds more universal (#11663)
Browse files Browse the repository at this point in the history
* [ci] Install arm64 neko for arm64 mac builds

* [ci] Create universal binary for haxelib

* [ci] Build native haxelib binary on arm64 mac

* [make] Use universal neko binaries for mac package

It can still be configured to specific architectures if needed, using
`PACKAGE_INSTALLER_MAC_ARCH`.

* [make] Default to host arch for mac installer

* [make] Use neko version 2.4.0-rc

* [make] Use neko version 2.4.0-rc.1

This version fixes a permission issue with universal mac binaries
  • Loading branch information
tobil4sk authored and kLabz committed Jul 18, 2024
1 parent 66ed49e commit 762fd2d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ jobs:
os: [macos-latest, macos-14]
runs-on: ${{ matrix.os }}
env:
PLATFORM: mac
PLATFORM: mac${{ matrix.os == 'macos-14' && '-arm64' || '' }}
OPAMYES: 1
MACOSX_DEPLOYMENT_TARGET: 10.13
OCAML_VERSION: 5.1.1
Expand Down Expand Up @@ -912,9 +912,8 @@ jobs:
tar -xf macX64Binaries/*_bin.tar.gz -C macX64Binaries --strip-components=1
tar -xf macArmBinaries/*_bin.tar.gz -C macArmBinaries --strip-components=1
lipo -create -output haxe macX64Binaries/haxe macArmBinaries/haxe
# there is only x64 haxelib
mv macX64Binaries/haxelib .
make -s package_unix package_installer_mac
lipo -create -output haxelib macX64Binaries/haxelib macArmBinaries/haxelib
make -s package_unix package_installer_mac PACKAGE_INSTALLER_MAC_ARCH=universal
ls -l out
otool -L ./haxe
otool -L ./haxelib
Expand Down
20 changes: 15 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ PACKAGE_FILE_NAME=haxe_$(COMMIT_DATE)_$(COMMIT_SHA)
HAXE_VERSION=$(shell $(CURDIR)/$(HAXE_OUTPUT) -version 2>&1 | awk '{print $$1;}')
HAXE_VERSION_SHORT=$(shell echo "$(HAXE_VERSION)" | grep -oE "^[0-9]+\.[0-9]+\.[0-9]+")

NEKO_VERSION=2.3.0
NEKO_VERSION=2.4.0-rc.1
NEKO_MAJOR_VERSION=$(shell echo "$(NEKO_VERSION)" | grep -oE "^[0-9]+")
NEKO_VERSION_TAG=v$(shell echo "$(NEKO_VERSION)" | sed "s/\./-/g")

Expand Down Expand Up @@ -168,19 +168,29 @@ xmldoc:
$(INSTALLER_TMP_DIR):
mkdir -p $(INSTALLER_TMP_DIR)

$(INSTALLER_TMP_DIR)/neko-osx64.tar.gz: $(INSTALLER_TMP_DIR)
wget -nv https://github.com/HaxeFoundation/neko/releases/download/$(NEKO_VERSION_TAG)/neko-$(NEKO_VERSION)-osx64.tar.gz -O installer/neko-osx64.tar.gz
# Can be 'universal', 'arm64', or 'x86_64'
ifndef PACKAGE_INSTALLER_MAC_ARCH
PACKAGE_INSTALLER_MAC_ARCH:=$(shell uname -m)
endif

$(INSTALLER_TMP_DIR)/neko-osx.tar.gz: $(INSTALLER_TMP_DIR)
NEKO_ARCH_SUFFIX=$$(if [ "$(PACKAGE_INSTALLER_MAC_ARCH)" = "x86_64" ]; then \
echo 64; \
else \
echo "-$(PACKAGE_INSTALLER_MAC_ARCH)"; \
fi); \
wget -nv https://github.com/HaxeFoundation/neko/releases/download/$(NEKO_VERSION_TAG)/neko-$(NEKO_VERSION)-osx$$NEKO_ARCH_SUFFIX.tar.gz -O installer/neko-osx.tar.gz

# Installer

package_installer_mac: $(INSTALLER_TMP_DIR)/neko-osx64.tar.gz package_unix
package_installer_mac: $(INSTALLER_TMP_DIR)/neko-osx.tar.gz package_unix
$(eval OUTFILE := $(shell pwd)/$(PACKAGE_OUT_DIR)/$(PACKAGE_FILE_NAME)_installer.tar.gz)
$(eval PACKFILE := $(shell pwd)/$(PACKAGE_OUT_DIR)/$(PACKAGE_FILE_NAME)_bin.tar.gz)
$(eval VERSION := $(shell $(CURDIR)/$(HAXE_OUTPUT) -version 2>&1))
bash -c "rm -rf $(INSTALLER_TMP_DIR)/{resources,pkg,tgz,haxe.tar.gz}"
mkdir $(INSTALLER_TMP_DIR)/resources
# neko - unpack to change the dir name
cd $(INSTALLER_TMP_DIR)/resources && tar -zxvf ../neko-osx64.tar.gz
cd $(INSTALLER_TMP_DIR)/resources && tar -zxvf ../neko-osx.tar.gz
mv $(INSTALLER_TMP_DIR)/resources/neko* $(INSTALLER_TMP_DIR)/resources/neko
cd $(INSTALLER_TMP_DIR)/resources && tar -zcvf neko.tar.gz neko
# haxe - unpack to change the dir name
Expand Down
7 changes: 3 additions & 4 deletions extra/github-actions/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ jobs:
os: [macos-latest, macos-14]
runs-on: ${{ matrix.os }}
env:
PLATFORM: mac
PLATFORM: mac${{ matrix.os == 'macos-14' && '-arm64' || '' }}
OPAMYES: 1
MACOSX_DEPLOYMENT_TARGET: 10.13
OCAML_VERSION: 5.1.1
Expand Down Expand Up @@ -429,9 +429,8 @@ jobs:
tar -xf macX64Binaries/*_bin.tar.gz -C macX64Binaries --strip-components=1
tar -xf macArmBinaries/*_bin.tar.gz -C macArmBinaries --strip-components=1
lipo -create -output haxe macX64Binaries/haxe macArmBinaries/haxe
# there is only x64 haxelib
mv macX64Binaries/haxelib .
make -s package_unix package_installer_mac
lipo -create -output haxelib macX64Binaries/haxelib macArmBinaries/haxelib
make -s package_unix package_installer_mac PACKAGE_INSTALLER_MAC_ARCH=universal
ls -l out
otool -L ./haxe
otool -L ./haxelib
Expand Down

0 comments on commit 762fd2d

Please sign in to comment.