Skip to content

Commit

Permalink
Do some more cleanup in the macOS bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
amolenaar committed Aug 12, 2020
1 parent 3b41ef1 commit fb7e307
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions macos-dmg/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,27 @@ find "${RESOURCESDIR}" -type f -exec chmod u+w {} \;
# that we don't want to use. We need the executable in Resources/Python.app.
cp "${CONTENTSDIR}/Frameworks/Python.framework/Versions/${PYVER}/Resources/Python.app/Contents/MacOS/Python" "${MACOSDIR}/python"

log "Installing Gaphor in ${RESOURCESDIR}..."

"${RESOURCESDIR}/bin/pip3" install --no-warn-script-location ../dist/gaphor-${VERSION}-py3-none-any.whl

log "Cleaning unneeded resources..."

rm "${RESOURCESDIR}"/lib/*.a
rm "${RESOURCESDIR}/lib/libgtkmacintegration-gtk2.2.dylib"
rm -r "${RESOURCESDIR}/lib/cairo"
rm -r "${RESOURCESDIR}/lib/cmake"
rm -r "${RESOURCESDIR}/lib/gettext"
rm -r "${RESOURCESDIR}/lib/glib-2.0"
rm -r "${RESOURCESDIR}/lib/gobject-introspection"
rm -r "${RESOURCESDIR}/lib/pkgconfig"

rm -r "${CONTENTSDIR}/Frameworks/Python.framework/Versions/${PYVER}/Resources/Python.app"
rm -r "${CONTENTSDIR}/Frameworks/Python.framework/Versions/${PYVER}/bin"
rm -r "${CONTENTSDIR}/Frameworks/Python.framework/Versions/${PYVER}/include"
rm -r "${CONTENTSDIR}/Frameworks/Python.framework/Versions/${PYVER}/share"

log "Installing Gaphor in ${RESOURCESDIR}..."

"${RESOURCESDIR}/bin/pip3" install --no-warn-script-location ../dist/gaphor-${VERSION}-py3-none-any.whl


echo "Fixing dynamic link dependencies..."
log "Fixing dynamic link dependencies..."

function map {
local fun=$1
Expand Down Expand Up @@ -153,17 +160,19 @@ function fix_paths {
echo ${MACOSDIR}/python
} | map fix_paths

log "Compiling .gir files..."

function compile_gir {
local gir="$1"
log "Compiling $gir"
local outfile="$(basename $gir | sed 's/gir$/typelib/')"
sed -i "" 's#/usr/local/Cellar/[^/]*/[^/]*#@executable_path/../Resources#g' "${gir}"
g-ir-compiler --output="${RESOURCESDIR}/lib/girepository-1.0/${outfile}" "${gir}"
}

find "${RESOURCESDIR}" -type f -name '*.gir' | map compile_gir

log "Compiling schemas"
log "Compiling schemas..."

glib-compile-schemas ${RESOURCESDIR}/share/glib-2.0/schemas

log "Building Gaphor-$VERSION.dmg..."
Expand All @@ -180,5 +189,4 @@ create-dmg \
"Gaphor-$VERSION.dmg" \
"Gaphor.app"


log "Done!"

0 comments on commit fb7e307

Please sign in to comment.