Update build_dist.sh to support standalone mode
You can now use it from the command line like: audacity/mac/scripts/build_dist.sh audacity/mac build/bin/Release
This commit is contained in:
parent
9e5434b843
commit
e12376b2bd
|
@ -1,6 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -x
|
|
||||||
|
|
||||||
# Function to retrieve a value from a plist
|
# Function to retrieve a value from a plist
|
||||||
function plist
|
function plist
|
||||||
|
@ -8,6 +7,11 @@ function plist
|
||||||
/usr/libexec/PlistBuddy -c "Print ${2}" "${1}"
|
/usr/libexec/PlistBuddy -c "Print ${2}" "${1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function realpath
|
||||||
|
{
|
||||||
|
python -c "import os; import sys; print(os.path.realpath(sys.argv[1]))" "${1}"
|
||||||
|
}
|
||||||
|
|
||||||
# Function to notarize a file (APP or DMG)
|
# Function to notarize a file (APP or DMG)
|
||||||
function notarize
|
function notarize
|
||||||
{
|
{
|
||||||
|
@ -58,6 +62,7 @@ function notarize
|
||||||
|
|
||||||
# Extract the current status and stop polling if it's no longer in progress
|
# Extract the current status and stop polling if it's no longer in progress
|
||||||
STATUS=$(plist "${OUTPUT}" "notarization-info:Status")
|
STATUS=$(plist "${OUTPUT}" "notarization-info:Status")
|
||||||
|
echo "Notarization status: ${STATUS}"
|
||||||
if [ "${STATUS}" != "in progress" ]
|
if [ "${STATUS}" != "in progress" ]
|
||||||
then
|
then
|
||||||
break
|
break
|
||||||
|
@ -75,12 +80,34 @@ function notarize
|
||||||
rm "${OUTPUT}"
|
rm "${OUTPUT}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ -z "${SRCROOT}" -o -z "${DSTROOT}" ]
|
||||||
|
then
|
||||||
|
if [ "${#}" -ne 2 ]
|
||||||
|
then
|
||||||
|
echo "You must specify the source and destination roots"
|
||||||
|
echo
|
||||||
|
echo "Usage: ${0} srcroot dstroot"
|
||||||
|
echo
|
||||||
|
echo " srcroot path to the 'mac' subdirectory of your source tree"
|
||||||
|
echo " dstroot path to where Audacity was built:"
|
||||||
|
echo " legacy build = /tmp/Audacity.dst"
|
||||||
|
echo " cmake build = <build directory/bin/Release"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
SRCROOT="${1}"
|
||||||
|
DSTROOT="${2}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get full paths
|
||||||
|
SRCROOT=$(realpath "${SRCROOT}")
|
||||||
|
DSTROOT=$(realpath "${DSTROOT}")
|
||||||
|
|
||||||
# Setup
|
# Setup
|
||||||
VERSION=`awk '/^#define+ AUDACITY_VERSION / {print $3}' build/Info.plist.h`
|
VERSION=`awk '/^#define+ AUDACITY_VERSION / {print $3}' ${SRCROOT}/../src/Audacity.h`
|
||||||
RELEASE=`awk '/^#define+ AUDACITY_RELEASE / {print $3}' build/Info.plist.h`
|
RELEASE=`awk '/^#define+ AUDACITY_RELEASE / {print $3}' ${SRCROOT}/../src/Audacity.h`
|
||||||
REVISION=`awk '/^#define+ AUDACITY_REVISION / {print $3}' build/Info.plist.h`
|
REVISION=`awk '/^#define+ AUDACITY_REVISION / {print $3}' ${SRCROOT}/../src/Audacity.h`
|
||||||
VERSION=$VERSION.$RELEASE.$REVISION
|
VERSION=$VERSION.$RELEASE.$REVISION
|
||||||
IDENT=$(plist "${INSTALL_ROOT}/Audacity.app/Contents/Info.plist" "CFBundleIdentifier")
|
IDENT=$(plist "${DSTROOT}/Audacity.app/Contents/Info.plist" "CFBundleIdentifier")
|
||||||
|
|
||||||
#
|
#
|
||||||
# This depends on a file in the builders HOME directory called ".audacity_signing" that
|
# This depends on a file in the builders HOME directory called ".audacity_signing" that
|
||||||
|
@ -116,8 +143,8 @@ echo "Audacity has been installed to: ${DSTROOT}"
|
||||||
cd "${DSTROOT}/.."
|
cd "${DSTROOT}/.."
|
||||||
|
|
||||||
# Make sure we have consistent ownership and permissions
|
# Make sure we have consistent ownership and permissions
|
||||||
chmod -RH "${INSTALL_MODE_FLAG}" "${TARGET_BUILD_DIR}"
|
chmod -RH 755 "${DSTROOT}"
|
||||||
chown -RH "${INSTALL_OWNER}:${INSTALL_GROUP}" "${TARGET_BUILD_DIR}"
|
chown -RH $(id -u):$(id -g) "${DSTROOT}"
|
||||||
|
|
||||||
# Preclean
|
# Preclean
|
||||||
rm -rf "$DMG" "$DMG.dmg" TMP.dmg
|
rm -rf "$DMG" "$DMG.dmg" TMP.dmg
|
||||||
|
@ -125,15 +152,30 @@ rm -rf "$DMG" "$DMG.dmg" TMP.dmg
|
||||||
# Sign and notarize the app
|
# Sign and notarize the app
|
||||||
if [ -n "${SIGNING}" ]
|
if [ -n "${SIGNING}" ]
|
||||||
then
|
then
|
||||||
xcrun codesign --force \
|
xcrun codesign --verbose \
|
||||||
--deep \
|
|
||||||
--verbose \
|
|
||||||
--timestamp \
|
--timestamp \
|
||||||
--identifier "${IDENT}" \
|
--identifier "${IDENT}" \
|
||||||
--options runtime \
|
--options runtime \
|
||||||
--entitlements "${SRCROOT}/${CODE_SIGN_ENTITLEMENTS}" \
|
--entitlements "${SRCROOT}/Audacity.entitlements" \
|
||||||
--sign "${CODESIGN_APP_IDENTITY}" \
|
--sign "${CODESIGN_APP_IDENTITY}" \
|
||||||
$(find ${DSTROOT}/Audacity.app -type f ! -path "*help*")
|
${DSTROOT}/Audacity.app/Contents/modules/*
|
||||||
|
|
||||||
|
xcrun codesign --verbose \
|
||||||
|
--timestamp \
|
||||||
|
--identifier "${IDENT}" \
|
||||||
|
--options runtime \
|
||||||
|
--entitlements "${SRCROOT}/Audacity.entitlements" \
|
||||||
|
--sign "${CODESIGN_APP_IDENTITY}" \
|
||||||
|
${DSTROOT}/Audacity.app/Contents/plug-ins/*
|
||||||
|
|
||||||
|
xcrun codesign --verbose \
|
||||||
|
--deep \
|
||||||
|
--timestamp \
|
||||||
|
--identifier "${IDENT}" \
|
||||||
|
--options runtime \
|
||||||
|
--entitlements "${SRCROOT}/Audacity.entitlements" \
|
||||||
|
--sign "${CODESIGN_APP_IDENTITY}" \
|
||||||
|
${DSTROOT}/Audacity.app
|
||||||
|
|
||||||
# Create the ZIP archive for notarization
|
# Create the ZIP archive for notarization
|
||||||
xcrun ditto -c -k --keepParent "${DSTROOT}/Audacity.app" "${DSTROOT}.zip"
|
xcrun ditto -c -k --keepParent "${DSTROOT}/Audacity.app" "${DSTROOT}.zip"
|
||||||
|
@ -152,6 +194,10 @@ fi
|
||||||
mkdir "$DMG"
|
mkdir "$DMG"
|
||||||
cp -pR "${DSTROOT}/" "${DMG}"
|
cp -pR "${DSTROOT}/" "${DMG}"
|
||||||
|
|
||||||
|
# Copy over the background image
|
||||||
|
mkdir "${DMG}/.background"
|
||||||
|
cp "${SRCROOT}/Resources/Audacity-DMG-background.png" "${DMG}/.background"
|
||||||
|
|
||||||
#Add a custom icon for the DMG
|
#Add a custom icon for the DMG
|
||||||
#cp -p mac/Resources/Audacity.icns "${DMG}"/.VolumeIcon.icns
|
#cp -p mac/Resources/Audacity.icns "${DMG}"/.VolumeIcon.icns
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue