Misc improvements for macos packaging

This commit is contained in:
Arjan Molenaar 2019-04-27 16:29:18 +02:00
parent 19c9ef89c4
commit cc1b282156
2 changed files with 12 additions and 10 deletions

View File

@ -20,7 +20,7 @@ export PYTHONHOME="${CONTENTS}/Frameworks/Python.framework/Versions/${PYVER}"
export PYTHONPATH="${CONTENTS}/lib/python${PYVER}/site-packages"
export DYLD_LIBRARY_PATH="${CONTENTS}/lib"
export FONTCONFIG_PATH="${CONTENTS}/Resources/fonts"
export FONTCONFIG_SYSROOT="${CONTENTS}/Resources"
export GTK_DATA_PREFIX="${CONTENTS}"
export GTK_EXE_PREFIX="${CONTENTS}"
export GTK_PATH="${CONTENTS}"

View File

@ -12,9 +12,10 @@ set -euo pipefail
APP=Gaphor.app
VERSION="$(ls ../dist/gaphor-*.tar.gz | tail -1 | sed 's#^.*gaphor-\(.*\).tar.gz#\1#')"
MACOSDIR="${APP}/Contents/MacOS"
RESOURCESDIR="${APP}/Contents/Resources"
INSTALLDIR="${APP}/Contents"
APPHOME="${APP}/Contents"
MACOSDIR="${APPHOME}/MacOS"
RESOURCESDIR="${APPHOME}/Resources"
INSTALLDIR="${APPHOME}"
LOCALDIR=/usr/local
@ -87,7 +88,7 @@ rm -r "${INSTALLDIR}/Frameworks/Python.framework/Versions/${PYVER}/share"
log "Installing Gaphor in ${INSTALLDIR}..."
pip3 install --prefix "${INSTALLDIR}" --force-reinstall ../dist/gaphor-${VERSION}.tar.gz
pip3 install --prefix "${INSTALLDIR}" --force-reinstall --no-warn-script-location ../dist/gaphor-${VERSION}.tar.gz
# Fix dynamic link dependencies:
@ -129,6 +130,7 @@ function fix_paths {
function fix_gir {
local gir="$1"
log Fixing $gir
local outfile="$(basename $gir | sed 's/gir$/typelib/')"
sed -i "" 's#/usr/local/Cellar/[^/]*/[^/]*#@executable_path/..#' "${gir}"
g-ir-compiler --output="${INSTALLDIR}/lib/girepository-1.0/${outfile}" "${gir}"
@ -136,17 +138,17 @@ function fix_gir {
{
# Libraries
find ${INSTALLDIR} -type f -name '*.so'
find ${INSTALLDIR} -type f -name '*.dylib'
echo ${INSTALLDIR}/Frameworks/Python.framework/Versions/*/Python
find ${APPHOME} -type f -name '*.so'
find ${APPHOME} -type f -name '*.dylib'
echo ${APPHOME}/Frameworks/Python.framework/Versions/*/Python
# Binaries
file ${INSTALLDIR}/bin/* | grep Mach-O | cut -f1 -d:
echo ${INSTALLDIR}/MacOS/python
echo ${MACOSDIR}/python
} | map fix_paths
find "${INSTALLDIR}" -type f -name '*.gir' | map fix_gir
log "Building Gaphor-$VERSION.dmg..."
hdiutil create -srcfolder $APP Gaphor-$VERSION.dmg