Skip to content

Commit

Permalink
🔨 Install universal binary
Browse files Browse the repository at this point in the history
  • Loading branch information
phatblat committed Nov 29, 2023
1 parent 35dccac commit 6743fab
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion script/build
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions script/install
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -30,4 +30,4 @@ done
echo "==> 📲 Installing mas ($MAS_VERSION) for $ARCH to $PREFIX"
ditto -v \
"$RELEASE/mas" \
"$PREFIX/bin/"
"$PREFIX/bin/mas"

0 comments on commit 6743fab

Please sign in to comment.