Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsh Cripps <acripps@redhat.com>2021-03-22 15:18:48 +0300
committerAsh Cripps <acripps@redhat.com>2021-04-09 14:13:47 +0300
commit1d8c022544d909607e508990e1361a03f3f51236 (patch)
tree3aa583638d50cf451df214fc2de3490f33fc797f /Makefile
parent7df0fc5c5c074ef9fe342b47eceb6437311aeab8 (diff)
build: update Makefile to support fat binary
build a binary that is both x86_64 and arm64 on macos PR-URL: https://github.com/nodejs/node/pull/37861 Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 26 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 8ca7fed2d01..697ce9bb750 100644
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,7 @@ TEST_CI_ARGS ?=
STAGINGSERVER ?= node-www
LOGLEVEL ?= silent
OSTYPE := $(shell uname -s | tr '[:upper:]' '[:lower:]')
+ARCHTYPE := $(shell uname -m | tr '[:upper:]' '[:lower:]')
COVTESTS ?= test-cov
COV_SKIP_TESTS ?= core_line_numbers.js,testFinalizer.js,test_function/test.js
GTEST_FILTER ?= "*"
@@ -972,6 +973,16 @@ release-only: check-xz
fi
$(PKG): release-only
+# pkg building is currently only supported on an ARM64 macOS host for
+# ease of compiling fat-binaries for both macOS architectures.
+ifneq ($(OSTYPE),darwin)
+ $(warning Invalid OSTYPE)
+ $(error OSTYPE should be `darwin` currently is $(OSTYPE))
+endif
+ifneq ($(ARCHTYPE),arm64)
+ $(warning Invalid ARCHTYPE)
+ $(error ARCHTYPE should be `arm64` currently is $(ARCHTYPE))
+endif
$(RM) -r $(MACOSOUTDIR)
mkdir -p $(MACOSOUTDIR)/installer/productbuild
cat tools/macos-installer/productbuild/distribution.xml.tmpl \
@@ -992,14 +1003,28 @@ $(PKG): release-only
| sed -E "s/\\{npmversion\\}/$(NPMVERSION)/g" \
>$(MACOSOUTDIR)/installer/productbuild/Resources/$$lang/conclusion.html ; \
done
+ CC_host="cc -arch x86_64" CXX_host="c++ -arch x86_64" \
+ CC_target="cc -arch x86_64" CXX_target="c++ -arch x86_64" \
+ CC="cc -arch x86_64" CXX="c++ -arch x86_64" $(PYTHON) ./configure \
+ --dest-cpu=x86_64 \
+ --tag=$(TAG) \
+ --release-urlbase=$(RELEASE_URLBASE) \
+ $(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS)
+ arch -x86_64 $(MAKE) install V=$(V) DESTDIR=$(MACOSOUTDIR)/dist/x64/node
+ SIGN="$(CODESIGN_CERT)" PKGDIR="$(MACOSOUTDIR)/dist/x64/node/usr/local" sh \
+ tools/osx-codesign.sh
$(PYTHON) ./configure \
- --dest-cpu=x64 \
+ --dest-cpu=arm64 \
--tag=$(TAG) \
--release-urlbase=$(RELEASE_URLBASE) \
$(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS)
$(MAKE) install V=$(V) DESTDIR=$(MACOSOUTDIR)/dist/node
SIGN="$(CODESIGN_CERT)" PKGDIR="$(MACOSOUTDIR)/dist/node/usr/local" sh \
tools/osx-codesign.sh
+ lipo $(MACOSOUTDIR)/dist/x64/node/usr/local/bin/node \
+ $(MACOSOUTDIR)/dist/node/usr/local/bin/node \
+ -output $(MACOSOUTDIR)/dist/node/usr/local/bin/node \
+ -create
mkdir -p $(MACOSOUTDIR)/dist/npm/usr/local/lib/node_modules
mkdir -p $(MACOSOUTDIR)/pkgs
mv $(MACOSOUTDIR)/dist/node/usr/local/lib/node_modules/npm \