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

[ci] Make mac universal builds more universal #11663

Merged
merged 7 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 4 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ jobs:
os: [macos-14, macos-13]
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 @@ -544,7 +544,7 @@ jobs:
set -ex
eval $(opam env)
opam config exec -- make -s -j`sysctl -n hw.ncpu` STATICLINK=1 "LIB_PARAMS=/usr/local/lib/libz.a /usr/local/lib/libpcre2-8.a /usr/local/lib/libmbedtls.a /usr/local/lib/libmbedcrypto.a /usr/local/lib/libmbedx509.a -cclib '-framework Security -framework CoreFoundation'" haxe
opam config exec -- arch -x86_64 make -s haxelib
opam config exec -- make -s haxelib
make -s package_unix package_installer_mac
ls -l out
otool -L ./haxe
Expand Down Expand Up @@ -682,9 +682,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 @@ -181,19 +181,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
2 changes: 1 addition & 1 deletion extra/github-actions/build-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
set -ex
eval $(opam env)
opam config exec -- make -s -j`sysctl -n hw.ncpu` STATICLINK=1 "LIB_PARAMS=/usr/local/lib/libz.a /usr/local/lib/libpcre2-8.a /usr/local/lib/libmbedtls.a /usr/local/lib/libmbedcrypto.a /usr/local/lib/libmbedx509.a -cclib '-framework Security -framework CoreFoundation'" haxe
opam config exec -- arch -x86_64 make -s haxelib
opam config exec -- make -s haxelib
make -s package_unix package_installer_mac
ls -l out
otool -L ./haxe
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 @@ -311,7 +311,7 @@ jobs:
os: [macos-14, macos-13]
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 @@ -378,9 +378,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
Loading