@@ -10,6 +10,7 @@ TEST_CI_ARGS ?=
1010STAGINGSERVER ?= node-www
1111LOGLEVEL ?= silent
1212OSTYPE := $(shell uname -s | tr '[:upper:]' '[:lower:]')
13+ ARCHTYPE := $(shell uname -m | tr '[:upper:]' '[:lower:]')
1314COVTESTS ?= test-cov
1415COV_SKIP_TESTS ?= core_line_numbers.js,testFinalizer.js,test_function/test.js
1516GTEST_FILTER ?= "*"
@@ -972,6 +973,16 @@ release-only: check-xz
972973 fi
973974
974975$(PKG ) : release-only
976+ # pkg building is currently only supported on an ARM64 macOS host for
977+ # ease of compiling fat-binaries for both macOS architectures.
978+ ifneq ($(OSTYPE ) ,darwin)
979+ $(warning Invalid OSTYPE)
980+ $(error OSTYPE should be `darwin` currently is $(OSTYPE))
981+ endif
982+ ifneq ($(ARCHTYPE ) ,arm64)
983+ $(warning Invalid ARCHTYPE)
984+ $(error ARCHTYPE should be `arm64` currently is $(ARCHTYPE))
985+ endif
975986 $(RM) -r $(MACOSOUTDIR)
976987 mkdir -p $(MACOSOUTDIR)/installer/productbuild
977988 cat tools/macos-installer/productbuild/distribution.xml.tmpl \
@@ -992,14 +1003,28 @@ $(PKG): release-only
9921003 | sed -E "s/\\{npmversion\\}/$(NPMVERSION)/g" \
9931004 >$(MACOSOUTDIR)/installer/productbuild/Resources/$$lang/conclusion.html ; \
9941005 done
1006+ CC_host="cc -arch x86_64" CXX_host="c++ -arch x86_64" \
1007+ CC_target="cc -arch x86_64" CXX_target="c++ -arch x86_64" \
1008+ CC="cc -arch x86_64" CXX="c++ -arch x86_64" $(PYTHON) ./configure \
1009+ --dest-cpu=x86_64 \
1010+ --tag=$(TAG) \
1011+ --release-urlbase=$(RELEASE_URLBASE) \
1012+ $(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS)
1013+ arch -x86_64 $(MAKE) install V=$(V) DESTDIR=$(MACOSOUTDIR)/dist/x64/node
1014+ SIGN="$(CODESIGN_CERT)" PKGDIR="$(MACOSOUTDIR)/dist/x64/node/usr/local" sh \
1015+ tools/osx-codesign.sh
9951016 $(PYTHON) ./configure \
996- --dest-cpu=x64 \
1017+ --dest-cpu=arm64 \
9971018 --tag=$(TAG) \
9981019 --release-urlbase=$(RELEASE_URLBASE) \
9991020 $(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS)
10001021 $(MAKE) install V=$(V) DESTDIR=$(MACOSOUTDIR)/dist/node
10011022 SIGN="$(CODESIGN_CERT)" PKGDIR="$(MACOSOUTDIR)/dist/node/usr/local" sh \
10021023 tools/osx-codesign.sh
1024+ lipo $(MACOSOUTDIR)/dist/x64/node/usr/local/bin/node \
1025+ $(MACOSOUTDIR)/dist/node/usr/local/bin/node \
1026+ -output $(MACOSOUTDIR)/dist/node/usr/local/bin/node \
1027+ -create
10031028 mkdir -p $(MACOSOUTDIR)/dist/npm/usr/local/lib/node_modules
10041029 mkdir -p $(MACOSOUTDIR)/pkgs
10051030 mv $(MACOSOUTDIR)/dist/node/usr/local/lib/node_modules/npm \
0 commit comments