From 96ff7ecdae7092464ebab75a4c6ed3bba79002c6 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Tue, 28 Nov 2023 20:25:43 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Install=20universal=20binary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 10 +++++++++- script/build | 5 ++++- script/install | 4 ++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 2e2a122..70c2db8 100644 --- a/Makefile +++ b/Makefile @@ -81,6 +81,10 @@ updateHeaders: ## Updates private headers. build: ## Builds the project. script/build +.PHONY: build-universal +build-universal: ## Builds a "fat" universal binary. + script/build --universal + .PHONY: test test: build ## Runs tests. script/test @@ -91,9 +95,13 @@ run: build ${EXECUTABLE_DIRECTORY}/${CMD_NAME} $(ARGS) .PHONY: install -install: ## Installs the project. +install: build ## Installs the project. script/install $(PREFIX) +.PHONY: install-universal +install-universal: build-universal ## Installs a universal binary. + script/install --universal + .PHONY: uninstall uninstall: ## Uninstalls the project. script/uninstall diff --git a/script/build b/script/build index 8f0d1ae..5c70383 100755 --- a/script/build +++ b/script/build @@ -9,7 +9,10 @@ # Build for the host architecture by default. ARCH=() if [[ "$1" == '--universal' ]]; then - ARCH=(--arch arm64 --arch x86_64) + ARCH=( \ + --arch arm64 \ + --arch x86_64 \ + ) fi # Disable the manifest cache on Xcode 12.5 and later. diff --git a/script/install b/script/install index 1fc0b3b..5237a7d 100755 --- a/script/install +++ b/script/install @@ -18,7 +18,7 @@ PREFIX=$(brew --prefix) while test -n "$1"; do if [[ "$1" == '--universal' ]]; then ARCH=universal - RELEASE=.build/release + RELEASE=.build/apple/Products/Release else # Override default prefix path with optional arg PREFIX="$1" @@ -30,4 +30,4 @@ done echo "==> 📲 Installing mas ($MAS_VERSION) for $ARCH to $PREFIX" ditto -v \ "$RELEASE/mas" \ - "$PREFIX/bin/" + "$PREFIX/bin/mas"