2020-02-13 05:00:44 +00:00
|
|
|
#!/usr/bin/env bash
|
2013-04-14 06:09:40 +00:00
|
|
|
|
2016-05-25 17:21:05 +00:00
|
|
|
# Script to produce an OS X installer .pkg and .app(.zip)
|
|
|
|
|
2019-11-28 19:37:43 +00:00
|
|
|
VERSION=$(git describe --always --dirty 2>/dev/null)
|
2013-04-14 06:09:40 +00:00
|
|
|
if test -z "$VERSION" ; then
|
2016-04-20 06:34:12 +00:00
|
|
|
echo "Could not get version from git"
|
2019-02-28 13:08:02 +00:00
|
|
|
if test -f version; then
|
2019-11-28 19:37:43 +00:00
|
|
|
VERSION=$(cat version)
|
2019-02-28 13:08:02 +00:00
|
|
|
fi
|
2013-04-14 06:09:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Version is $VERSION"
|
|
|
|
|
|
|
|
set -x
|
2012-05-10 09:11:28 +00:00
|
|
|
|
2013-04-14 06:09:40 +00:00
|
|
|
#Exit on error
|
|
|
|
set -e
|
|
|
|
|
2021-01-31 21:52:19 +00:00
|
|
|
# Respect MAC_CODESIGN_ID, or default for ad-hoc.
|
2020-02-13 05:00:44 +00:00
|
|
|
# Note the :- means "or default" and the following - is the value.
|
|
|
|
MAC_CODESIGN_ID=${MAC_CODESIGN_ID:--}
|
|
|
|
|
2019-11-28 19:37:43 +00:00
|
|
|
PKGDIR=$(mktemp -d)
|
2012-05-30 07:27:50 +00:00
|
|
|
|
2019-01-26 00:45:06 +00:00
|
|
|
SRC_DIR=$PWD
|
2016-05-25 17:21:05 +00:00
|
|
|
OUTPUT_PATH=${FISH_ARTEFACT_PATH:-~/fish_built}
|
|
|
|
|
2019-11-28 19:37:43 +00:00
|
|
|
mkdir -p "$PKGDIR/build" "$PKGDIR/root" "$PKGDIR/intermediates" "$PKGDIR/dst"
|
2021-10-17 20:07:25 +00:00
|
|
|
|
|
|
|
# Pass FISH_USE_SYSTEM_PCRE2=OFF because a system PCRE2 on macOS will not be signed by fish,
|
|
|
|
# and will probably not be built universal, so the package will fail to validate/run on other systems.
|
|
|
|
{ cd "$PKGDIR/build" && cmake -DMAC_INJECT_GET_TASK_ALLOW=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_GETTEXT=OFF -DFISH_USE_SYSTEM_PCRE2=OFF -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DMAC_CODESIGN_ID="${MAC_CODESIGN_ID}" "$SRC_DIR" && make VERBOSE=1 -j 12 && env DESTDIR="$PKGDIR/root/" make install; }
|
2020-02-11 06:25:49 +00:00
|
|
|
pkgbuild --scripts "$SRC_DIR/build_tools/osx_package_scripts" --root "$PKGDIR/root/" --identifier 'com.ridiculousfish.fish-shell-pkg' --version "$VERSION" "$PKGDIR/intermediates/fish.pkg"
|
|
|
|
productbuild --package-path "$PKGDIR/intermediates" --distribution "$SRC_DIR/build_tools/osx_distribution.xml" --resources "$SRC_DIR/build_tools/osx_package_resources/" "$OUTPUT_PATH/fish-$VERSION.pkg"
|
2021-01-31 21:52:19 +00:00
|
|
|
|
2022-01-03 03:12:48 +00:00
|
|
|
MAC_PRODUCTSIGN_ID=${MAC_PRODUCTSIGN_ID:--}
|
|
|
|
productsign --sign "${MAC_PRODUCTSIGN_ID}" "$OUTPUT_PATH/fish-$VERSION.pkg" "$OUTPUT_PATH/fish-$VERSION-signed.pkg" && mv "$OUTPUT_PATH/fish-$VERSION-signed.pkg" "$OUTPUT_PATH/fish-$VERSION.pkg"
|
2013-10-06 00:06:22 +00:00
|
|
|
|
|
|
|
# Make the app
|
2022-01-21 21:03:35 +00:00
|
|
|
{ cd "$PKGDIR/build" && make -j 12 signed_fish_macapp && zip -r "$OUTPUT_PATH/fish-$VERSION.app.zip" fish.app; }
|
2016-05-25 17:11:02 +00:00
|
|
|
|
2021-10-17 20:53:18 +00:00
|
|
|
rm -rf "$PKGDIR"
|