Browse Source

fix install names of dylibs on macos

copy-dylibs-in-bottle
Alexandros Theodotou 3 years ago
parent
commit
e70f6bb72f
Signed by: alex
GPG Key ID: 022EAE42313D70F3
  1. 2
      .gitignore
  2. 2
      Makefile
  3. 14
      tools/gen_osx_installer.sh
  4. 116
      tools/gen_osx_installer_bundler.sh
  5. 2
      tools/osx/Info.plist.in
  6. 5
      tools/osx/launcher.sh
  7. 106
      tools/osx/zrythm.bundle.in

2
.gitignore vendored

@ -10,3 +10,5 @@ zrythm_installer @@ -10,3 +10,5 @@ zrythm_installer
.DS_Store
*.asc
*.md5
tools/osx/zrythm.bundle
tools/osx/Info.plist

2
Makefile

@ -283,7 +283,7 @@ $(OSX_INSTALL_PREFIX)/bin/zrythm $(OSX_INSTALL_TRIAL_PREFIX)/bin/zrythm&: $(BUIL @@ -283,7 +283,7 @@ $(OSX_INSTALL_PREFIX)/bin/zrythm $(OSX_INSTALL_TRIAL_PREFIX)/bin/zrythm&: $(BUIL
$(call make_osx,$(OSX_INSTALL_PREFIX),false)
# this must be run on macos
artifacts/osx/$(OSX_INSTALLER) artifacts/osx/$(OSX_TRIAL_INSTALLER)&: tools/gen_osx_installer.sh $(OSX_INSTALL_PREFIX)/bin/zrythm $(OSX_INSTALL_TRIAL_PREFIX)/bin/zrythm tools/osx/startup_script.sh tools/osx/appdmg.json.in
artifacts/osx/$(OSX_INSTALLER) artifacts/osx/$(OSX_TRIAL_INSTALLER)&: tools/gen_osx_installer.sh $(OSX_INSTALL_PREFIX)/bin/zrythm $(OSX_INSTALL_TRIAL_PREFIX)/bin/zrythm tools/osx/launcher.sh tools/osx/appdmg.json.in
tools/gen_osx_installer.sh $(ZRYTHM_VERSION) \
$(BUILD_OSX_DIR)/zrythm-$(ZRYTHM_VERSION) \
$(OSX_INSTALL_PREFIX) \

14
tools/gen_osx_installer.sh

@ -68,7 +68,7 @@ echo "copying plists" @@ -68,7 +68,7 @@ echo "copying plists"
sed "s/@VERSION@/$ZRYTHM_VERSION/" < \
$OSX_SOURCE_DATA_DIR/Info.plist.in > $Contents/Info.plist
cp $OSX_SOURCE_DATA_DIR/startup_script.sh $Contents/MacOS/Zrythm
cp $OSX_SOURCE_DATA_DIR/launcher.sh $Contents/MacOS/Zrythm
chmod 775 $Contents/MacOS/Zrythm
MAIN_EXECUTABLE=zrythm ## used in startup_script
@ -76,7 +76,7 @@ echo "Copying zrythm executable ...." @@ -76,7 +76,7 @@ echo "Copying zrythm executable ...."
cp $ZRYTHM_INSTALL_PREFIX/bin/zrythm $Bin/
cp $OSX_SOURCE_DATA_DIR/zrythm.icns $Resources/
set +e # things below are not error-free (optional files etc) :(
set +e # things below are not error-free (optional files etc)
# etc gtk
cp -RL $NORMAL_PREFIX/etc/gtk-3.0 $Etc/
@ -129,7 +129,7 @@ sed -i -e \ @@ -129,7 +129,7 @@ sed -i -e \
SCHEMAS_DIR="glib-2.0/schemas"
mkdir -p $Share/$SCHEMAS_DIR
cp $NORMAL_PREFIX/share/$SCHEMAS_DIR/org.zrythm*.xml \
cp $ZRYTHM_SRC_DIR/data/org.zrythm*.xml \
"$Share/$SCHEMAS_DIR/"
cp $NORMAL_PREFIX/share/$SCHEMAS_DIR/org.gtk.*.xml \
"$Share/$SCHEMAS_DIR/"
@ -194,7 +194,7 @@ done @@ -194,7 +194,7 @@ done
echo "Fixing up library names ..."
for libdir in $Lib ; do
libbase=`basename $libdir`
for dylib in $libdir/*.dylib $libdir/*.so ; do
for dylib in $(find $libdir -name '*.dylib' -o -name '*.so') ; do
# skip symlinks
if test -L $dylib ; then
continue
@ -210,11 +210,14 @@ for libdir in $Lib ; do @@ -210,11 +210,14 @@ for libdir in $Lib ; do
fi
done
if test "x$changes" != x ; then
echo "processing $dylib"
chmod +w $dylib
if install_name_tool $changes $dylib ; then
:
else
exit 1
fi
echo "done processing $dylib: $changes"
fi
# now the change what the library thinks its own name is
base=`basename $dylib`
@ -222,6 +225,9 @@ for libdir in $Lib ; do @@ -222,6 +225,9 @@ for libdir in $Lib ; do
done
done
# change pixbuf loader paths
sed -i -e "s|/usr/local|@executable_path/..|" $Lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
# add license, readme, third party info
cp $ZRYTHM_SRC_DIR/README.md $Resources/
cp $ZRYTHM_SRC_DIR/COPYING* $Resources/

116
tools/gen_osx_installer_bundler.sh

@ -0,0 +1,116 @@ @@ -0,0 +1,116 @@
#! /bin/bash
# Copyright (C) 2019-2020 Alexandros Theodotou <alex at zrythm dot org>
# Notes:
# 1. This script assumes you have all the dependencies
# installed using HomeBrew.
# 2. Meant to be run from the parent dir
# 3. Uses appdmg (brew install npm, npm install -g appdmg)
# 4. need to install librsvg and then reinstall gdk-pixbuf
# in brew to get svg support (or copy the pixbuf loader from
# the Cellar of libtsvg to the Cellar of gdk-pixbuf)
# args:
# 1: version
# 2: zrythm source root dir
# 3: prefix where zrythm was installed
# 4: path to copy finished installer to
# 5: osx data dir (tools/osx)
# 6: normal prefix (where other programs are installed)
# 7: App name Zrythm or Zrythm (Trial)
# 8: App name Zrythm or Zrythm-trial
set -e
ZRYTHM_VERSION=$1
ZRYTHM_SRC_DIR=$2
ZRYTHM_INSTALL_PREFIX=$3
FINAL_DMG_PATH=$4
OSX_SOURCE_DATA_DIR=$5
NORMAL_PREFIX=$6
APP_NAME_W_SPACES=$7
APP_NAME_NO_SPACES=$8
WORK_ROOT=/tmp/zrythm-dmg
rm -rf $WORK_ROOT
# setup directory structure
APPDIR=$WORK_ROOT/$APP_NAME_NO_SPACES-buf
Contents=$APPDIR/Contents
Resources=$Contents/Resources
Bin=$Resources/bin
Share=$Resources/share
Etc=$Resources/etc
Locale=$Resources/share/locale
Lib=$Resources/lib
echo "Building new app directory structure ..."
mkdir -p $Contents/MacOS
mkdir -p $Etc
mkdir -p $Locale
mkdir -p $Lib
mkdir -p $Bin
# copy static files
echo "copying plists"
sed "s/@VERSION@/$ZRYTHM_VERSION/" < \
$OSX_SOURCE_DATA_DIR/Info.plist.in > $Contents/Info.plist
cp $Contents/Info.plist $OSX_SOURCE_DATA_DIR/Info.plist
THEMES_DIR="$Share/themes"
mkdir -p "$THEMES_DIR"
cp -RL "$NORMAL_PREFIX/share/themes/Default" "$THEMES_DIR/"
echo "copying Adwaita icons"
ICONS_DIR="$Share/icons"
mkdir -p "$ICONS_DIR"
cp -RL "$NORMAL_PREFIX/share/icons/Adwaita" "$ICONS_DIR/"
echo "copying existing hicolor icons"
cp -RL "$NORMAL_PREFIX/share/icons/hicolor" "$ICONS_DIR/"
echo "copying app icon"
APPICON_DIR1=$ICONS_DIR/hicolor/scalable/apps
APPICON_DIR2=$ICONS_DIR/hicolor/48x48/apps
mkdir -p $APPICON_DIR1
mkdir -p $APPICON_DIR2
cp $ZRYTHM_SRC_DIR/resources/icons/zrythm/zrythm.svg $APPICON_DIR1/
cp $ZRYTHM_SRC_DIR/resources/icons/zrythm/zrythm.svg $APPICON_DIR2/
SCHEMAS_DIR="glib-2.0/schemas"
mkdir -p $Share/$SCHEMAS_DIR
cp $NORMAL_PREFIX/share/$SCHEMAS_DIR/org.zrythm*.xml \
"$Share/$SCHEMAS_DIR/"
cp $NORMAL_PREFIX/share/$SCHEMAS_DIR/org.gtk.*.xml \
"$Share/$SCHEMAS_DIR/"
echo "building schemas"
glib-compile-schemas "$Share/$SCHEMAS_DIR/"
# add license, readme, third party info
cp $ZRYTHM_SRC_DIR/README.md $Resources/
cp $ZRYTHM_SRC_DIR/COPYING* $Resources/
brew list --versions -1 -v > $Resources/THIRDPARTY_INFO.txt
sed "s|@NORMAL_PREFIX@|$NORMAL_PREFIX|" < \
$OSX_SOURCE_DATA_DIR/zrythm.bundle.in > $WORK_ROOT/zrythm.bundle
sed -i -e "s|@ZRYTHM_PREFIX@|$ZRYTHM_INSTALL_PREFIX|" $WORK_ROOT/zrythm.bundle
sed -i -e "s|@BUNDLE_DEST@|$WORK_ROOT|" $WORK_ROOT/zrythm.bundle
sed -i -e "s|@OSX_DATA_DIR@|$OSX_SOURCE_DATA_DIR|" $WORK_ROOT/zrythm.bundle
sed -i -e "s|@BUFFER@|$APPDIR|" $WORK_ROOT/zrythm.bundle
gtk-mac-bundler $WORK_ROOT/zrythm.bundle
# make dmg
echo "making dmg from .app"
rm -f $FINAL_DMG_PATH
mkdir -p $(dirname "$FINAL_DMG_PATH")
sed "s|@APP_PATH@|$APPDIR|" < \
$OSX_SOURCE_DATA_DIR/appdmg.json.in > $WORK_ROOT/appdmg.json
sed -i -e "s|@APPNAME@|$APP_NAME_W_SPACES|" $WORK_ROOT/appdmg.json
sed -i -e "s|@ICNS_PATH@|$Resources/zrythm.icns|" \
$WORK_ROOT/appdmg.json
cat $WORK_ROOT/appdmg.json
appdmg $WORK_ROOT/appdmg.json $FINAL_DMG_PATH
rm -f $WORK_ROOT/appdmg.json
echo "Done."
exit

2
tools/osx/Info.plist.in

@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
<key>LSMinimumSystemVersion</key>
<string>10.4</string>
<key>GtkOSXLaunchScriptFile</key>
<string>gtk3-launcher.sh</string>
<string>launcher.sh</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>ATSApplicationFontsPath</key>

5
tools/osx/startup_script.sh → tools/osx/launcher.sh

@ -6,18 +6,23 @@ tmp=`dirname "$tmp"` @@ -6,18 +6,23 @@ tmp=`dirname "$tmp"`
tmp=`dirname "$tmp"`
bundle=`dirname "$tmp"`
bundle_contents="$bundle"/Contents
bundle_macos="$bundle_contents"/MacOS
bundle_res="$bundle_contents"/Resources
bundle_lib="$bundle_res"/lib
bundle_bin="$bundle_res"/bin
bundle_data="$bundle_res"/share
bundle_etc="$bundle_res"/etc
export PREFIX="$bundle_res"
export DYLD_LIBRARY_PATH="$bundle_lib"
export XDG_CONFIG_DIRS="$bundle_etc"/xdg
export XDG_DATA_DIRS="$bundle_data"
export GTK_DATA_PREFIX="$bundle_res"
export GTK_EXE_PREFIX="$bundle_res"
export GTK_PATH="$bundle_res"
export GDK_PIXBUF_MODULE_FILE="$bundle_lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
export GDK_PIXBUF_MODULEDIR="$bundle_lib/gdk-pixbuf-2.0/2.10.0/loaders"
I18NDIR="$bundle_data/locale"

106
tools/osx/zrythm.bundle.in

@ -0,0 +1,106 @@ @@ -0,0 +1,106 @@
<?xml version="1.0"?> <!--*- mode: xml -*-->
<app-bundle>
<meta>
<prefix name="default">/usr/local/opt/gtk+3</prefix>
<prefix name="atk">/usr/local/opt/atk</prefix>
<prefix name="cairo">/usr/local/opt/cairo</prefix>
<prefix name="fftw">/usr/local/opt/fftw</prefix>
<prefix name="flac">/usr/local/opt/flac</prefix>
<prefix name="fontconfig">/usr/local/opt/fontconfig</prefix>
<prefix name="freetype">/usr/local/opt/freetype</prefix>
<prefix name="fribidi">/usr/local/opt/fribidi</prefix>
<prefix name="gcc">/usr/local/opt/gcc</prefix>
<prefix name="gdk-pixbuf">/usr/local/opt/gdk-pixbuf</prefix>
<prefix name="gettext">/usr/local/opt/gettext</prefix>
<prefix name="glib">/usr/local/opt/glib</prefix>
<prefix name="graphite2">/usr/local/opt/graphite2</prefix>
<prefix name="harfbuzz">/usr/local/opt/harfbuzz</prefix>
<prefix name="jpeg">/usr/local/opt/jpeg</prefix>
<prefix name="libcroco">/usr/local/opt/libcroco</prefix>
<prefix name="libepoxy">/usr/local/opt/libepoxy</prefix>
<prefix name="libffi">/usr/local/opt/libffi</prefix>
<prefix name="libogg">/usr/local/opt/libogg</prefix>
<prefix name="libpng">/usr/local/opt/libpng</prefix>
<prefix name="librsvg">/usr/local/opt/librsvg</prefix>
<prefix name="libsamplerate">/usr/local/opt/libsamplerate</prefix>
<prefix name="libsndfile">/usr/local/opt/libsndfile</prefix>
<prefix name="libtiff">/usr/local/opt/libtiff</prefix>
<prefix name="libvorbis">/usr/local/opt/libvorbis</prefix>
<prefix name="libyaml">/usr/local/opt/libyaml</prefix>
<prefix name="lilv">/usr/local/opt/lilv</prefix>
<prefix name="pango">/usr/local/opt/pango</prefix>
<prefix name="pcre">/usr/local/opt/pcre</prefix>
<prefix name="pixman">/usr/local/opt/pixman</prefix>
<prefix name="rubberband">/usr/local/opt/rubberband</prefix>
<prefix name="sdl2">/usr/local/opt/sdl2</prefix>
<prefix name="serd">/usr/local/opt/serd</prefix>
<prefix name="sord">/usr/local/opt/sord</prefix>
<prefix name="sratom">/usr/local/opt/sratom</prefix>
<!-- The project directory is the default location of the created
app. If you leave out the path, the current directory is
used. Note the usage of an environment variable here again.
-->
<destination overwrite="yes">@BUNDLE_DEST@</destination>
<run-install-name-tool/>
<!-- Optionally specify a launcher script to use. Builtin script is used if not specified. -->
<launcher-script>@OSX_DATA_DIR@/launcher.sh</launcher-script>
<gtk>gtk+-3.0</gtk>
</meta>
<plist>@BUFFER@/Contents/Info.plist</plist>
<!-- The executable for the application -->
<main-binary dest="${bundle}/bin">@ZRYTHM_PREFIX@/bin/zrythm</main-binary>
<!-- Modules for GTK+ (image loaders, etc) -->
<binary>${prefix}/lib/gtk-3.0</binary>
<!-- Starting with 2.24, gdk-pixbuf installs into its own directory. -->
<binary>
${prefix:gdk-pixbuf}/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.so
</binary>
<!-- Translation filenames, one for each program or library that you
want to copy in to the bundle. The "dest" attribute is
optional, as usual. Bundler will find all translations of that
library/program under the indicated directory and copy them.-->
<translations name="gtk30">
${prefix}/share/locale
</translations>
<data dest="${bundle}/Contents/Resources/share">
@ZRYTHM_PREFIX@/share
</data>
<!-- Copy in the themes data. You may want to trim this to save space
in your bundle. -->
<data dest="${bundle}/Contents/Resources/share/themes">
@BUFFER@/Contents/Resources/share/themes
</data>
<data dest="${bundle}/Contents/Resources/share/icons">
@BUFFER@/Contents/Resources/share/icons
</data>
<data dest="${bundle}/Contents/Resources/share/glib-2.0/schemas">
@BUFFER@/Contents/Resources/share/glib-2.0/schemas
</data>
<data dest="${bundle}/Contents/Resources">
@OSX_DATA_DIR@/zrythm.icns
</data>
<data dest="${bundle}/Contents/Resources">
@BUFFER@/Contents/Resources/README.md
</data>
<data dest="${bundle}/Contents/Resources">
@BUFFER@/Contents/Resources/COPYING
</data>
<data dest="${bundle}/Contents/Resources">
@BUFFER@/Contents/Resources/THIRDPARTY_INFO.txt
</data>
</app-bundle>
Loading…
Cancel
Save