mirror of
https://github.com/mas-cli/mas
synced 2024-11-25 04:50:24 +00:00
🛠 Make --universal a build option
This commit is contained in:
parent
3e88d28622
commit
c177fa79a1
5 changed files with 33 additions and 12 deletions
17
script/build
17
script/build
|
@ -6,10 +6,21 @@
|
|||
# Builds the Swift Package.
|
||||
#
|
||||
|
||||
# Build for the host architecture by default.
|
||||
ARCH=
|
||||
if [[ "$1" == '--universal' ]]; then
|
||||
ARCH='--arch arm64 --arch x86_64'
|
||||
fi
|
||||
|
||||
# Disable the manifest cache on Xcode 12.5 and later.
|
||||
CACHE=
|
||||
if [[ "$(swift build --help)" =~ manifest-cache ]]; then
|
||||
CACHE='--manifest-cache none'
|
||||
fi
|
||||
|
||||
echo "==> 🏗️ Building mas ($(script/version))"
|
||||
swift build \
|
||||
--configuration release \
|
||||
--arch arm64 \
|
||||
--arch x86_64 \
|
||||
${ARCH} \
|
||||
--disable-sandbox \
|
||||
--manifest-cache none
|
||||
${CACHE}
|
||||
|
|
|
@ -11,6 +11,5 @@ VERSION=$(script/version)
|
|||
echo "Building mas $VERSION artifacts"
|
||||
|
||||
script/clean
|
||||
script/build
|
||||
script/archive
|
||||
script/build --universal
|
||||
script/package
|
||||
|
|
|
@ -10,18 +10,29 @@
|
|||
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/mas.rb
|
||||
#
|
||||
|
||||
ARCH=$(uname -m)
|
||||
RELEASE=.build/${ARCH}-apple-macosx/release
|
||||
VERSION=$(script/version)
|
||||
|
||||
# Override default prefix path with optional 1st arg
|
||||
if test -n "$1"; then
|
||||
PREFIX="$1"
|
||||
elif [[ $(uname -m) == 'arm64' ]]; then
|
||||
if [[ $(uname -m) == 'arm64' ]]; then
|
||||
PREFIX=/opt/homebrew
|
||||
else
|
||||
PREFIX=/usr/local
|
||||
fi
|
||||
|
||||
while test -n "$1"; do
|
||||
if [[ "$1" == '--universal' ]]; then
|
||||
ARCH=universal
|
||||
RELEASE=.build/apple/Products/Release
|
||||
else
|
||||
# Override default prefix path with optional arg
|
||||
PREFIX="$1"
|
||||
fi
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
echo "==> 📲 Installing mas ($VERSION) for $ARCH to $PREFIX"
|
||||
ditto -v \
|
||||
".build/apple/Products/Release/mas" \
|
||||
"$RELEASE/mas" \
|
||||
"$PREFIX/bin/"
|
||||
|
|
|
@ -18,7 +18,7 @@ DISTRIBUTION_PLIST="Package/Distribution.plist"
|
|||
|
||||
# Destination for install root
|
||||
DSTROOT=.build/distributions
|
||||
script/install "$DSTROOT/usr/local"
|
||||
script/install "$DSTROOT/usr/local" --universal
|
||||
|
||||
VERSION=$(script/version)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# script/uninstall
|
||||
# mas
|
||||
#
|
||||
# Removes mas and MasKit from PREFIX.
|
||||
# Removes mas from PREFIX.
|
||||
#
|
||||
|
||||
# Override default prefix path with optional 1st arg
|
||||
|
|
Loading…
Reference in a new issue