Skip to content

Commit

Permalink
build: update Makefile to support fat binary
Browse files Browse the repository at this point in the history
build a binary that is both x86_64 and arm64 on macos
  • Loading branch information
Ash Cripps committed Mar 23, 2021
1 parent cda60c5 commit 3090f4c
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -982,12 +982,26 @@ $(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/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
$(MAKE) install V=$(V) DESTDIR=$(MACOSOUTDIR)/dist/arm64/node
lipo $(MACOSOUTDIR)/dist/x64/node \
$(MACOSOUTDIR)/dist/arm64/node \
-output $(MACOSOUTDIR)/dist/node \
-create
SIGN="$(CODESIGN_CERT)" PKGDIR="$(MACOSOUTDIR)/dist/node/usr/local" sh \
tools/osx-codesign.sh
mkdir -p $(MACOSOUTDIR)/dist/npm/usr/local/lib/node_modules
Expand Down

0 comments on commit 3090f4c

Please sign in to comment.