Commit d954e577 authored by Jesse van den Kieboom's avatar Jesse van den Kieboom

[osx] Reorganize bundle making

parent e4fcb2d5
...@@ -92,7 +92,7 @@ CLEANFILES = ...@@ -92,7 +92,7 @@ CLEANFILES =
include data/Makefile.am include data/Makefile.am
include pixmaps/Makefile.am include pixmaps/Makefile.am
include win32/Makefile.am include win32/Makefile.am
include osx/Makefile.am include osx/bundle/data/Makefile.am
include tests/Makefile.am include tests/Makefile.am
include plugins/Makefile.am include plugins/Makefile.am
include gedit/Makefile.am include gedit/Makefile.am
......
...@@ -461,7 +461,7 @@ plugins/filebrowser/org.gnome.gedit.plugins.filebrowser.gschema.xml.in ...@@ -461,7 +461,7 @@ plugins/filebrowser/org.gnome.gedit.plugins.filebrowser.gschema.xml.in
plugins/pythonconsole/org.gnome.gedit.plugins.pythonconsole.gschema.xml.in plugins/pythonconsole/org.gnome.gedit.plugins.pythonconsole.gschema.xml.in
plugins/time/org.gnome.gedit.plugins.time.gschema.xml.in plugins/time/org.gnome.gedit.plugins.time.gschema.xml.in
po/Makefile.in po/Makefile.in
osx/Info.plist]) osx/bundle/data/Info.plist])
AC_OUTPUT AC_OUTPUT
......
#!/bin/bash
pushd $(dirname "$0") > /dev/null
D=$(pwd -P)
popd > /dev/null
ME="$0"
BUNDLE="$D/gedit.app"
function do_strip {
tp=$(file -b --mime-type "$1")
if [ "$tp" != "application/octet-stream" ]; then
return
fi
name=$(mktemp -t bundle)
st=$(stat -f %p "$1")
strip -o "$name" -S "$1"
mv -f "$name" "$1"
chmod "$st" "$1"
chmod u+w "$1"
}
function make_help_usage() {
echo "[-f]"
}
function make_help_short() {
echo "Make the gedit.app bundle"
}
function build_gtk_mac_bundler() {
b="$D/../build/build"
lbin=$("$b" env local-bin)
if [ -x "$lbin/gtk-mac-bundler" ]; then
return
fi
echo "Installing gtk-mac-bundler..."
home=$("$b" env home)
sbin="$home/source"
mkdir -p "$sbin"
(
cd "$sbin"
if [ ! -d gtk-mac-bundler ]; then
git clone https://github.com/jessevdk/gtk-mac-bundler || exit 1
fi
(
cd gtk-mac-bundler
git checkout -b stable f1a829521fabda2266f346dfe86bf09c9401f87d || exit 1
HOME="$home" make install
) || exit 1
) || exit 1
}
function cmd_make() {
build_gtk_mac_bundler
if [ -d "$BUNDLE" ] && [ "$1x" = "-fx" ]; then
rm -rf "$BUNDLE"
fi
b="$D/../build/build"
# No idea why it's not writable, but we need it to be so that install_name_tool
# can change the link paths
inst=$("$b" env inst)
chmod u+w "$inst/lib/libpython3.3m.dylib"
if [ ! -d "$BUNDLE" ]; then
lbin=$("$b" env local-bin)
echo "Generating bundle from gedit.bundle specification..."
"$b" run "$lbin/gtk-mac-bundler" "$D/data/gedit.bundle" || exit 1
mv "$D/data/gedit.app" "$BUNDLE"
else
echo "$BUNDLE bundle already exists, only stripping it..."
fi
echo "Removing unneeded files from bundle"
# Remove pyc and pyo files
for i in $(find "$BUNDLE/Contents/Resources/lib/python3"* -type f -regex '.*\.py[oc]' 2>/dev/null); do
rm -f "$i"
done
echo "Strip debug symbols from bundle binaries"
# Strip debug symbols from libraries/modules
for i in $(find -E "$BUNDLE/Contents/Resources" -type f -regex '.*\.(so|dylib)$' 2>/dev/null); do
do_strip "$i"
done
# Strip debug symbols from binaries
for i in $(find "$BUNDLE/Contents/Resources/bin" -type f 2>/dev/null); do
if [ -x "$i" ]; then
do_strip "$i"
fi
done
# Strip debug symbols from main binary
do_strip "$BUNDLE/Contents/MacOS/gedit-bin"
}
function help_help_short() {
echo "Shows this help message"
}
function cmd_help() {
if [ -z "$1" ]; then
echo "Usage: $ME [command]"
echo ""
echo "Available commands:"
echo ""
for cmd in "${commands[@]}"; do
printf " \033[1m$cmd\x1B[0m "
l=${#cmd}
let d="$commandsmaxlen - $l + 1"
printf "%${d}s" ""
echo -n "- "
if [[ $(type -t "${cmd}_help_short") = "function" ]]; then
"${cmd}_help_short"
else
echo ""
fi
done
echo ""
else
cmd="cmd_$1"
if [[ $(type -t "$cmd") != "function" ]]; then
printf "Invalid command \033[1m$1\033[0m, available commands are: $cmds\n"
exit 1
fi
printf "Usage: $ME \033[1m$1\033[0m "
if [[ $(type -t "$1_help_usage") = "function" ]]; then
"$1_help_usage"
else
echo ""
fi
echo ""
if [[ $(type -t "$1_help_long") != "function" ]]; then
"$1_help_short"
else
"$1_help_long"
fi
fi
}
commands=()
commandsmaxlen=0
while read line
do
cmd=${line#declare -f }
if [[ "$cmd" = cmd_* ]]; then
cname=${cmd#cmd_}
commands+=($cname)
l=${#cname}
if [[ $l > $commandsmaxlen ]]; then
commandsmaxlen=$l
fi
fi
done < <(declare -F)
cmds=$(printf ", \033[1m%s\033[0m" "${commands[@]}")
cmds=${cmds:2}
if [ -z "$1" ]; then
cmd_help
exit 0
fi
cmd="cmd_$1"
if [[ $(type -t "$cmd") != "function" ]]; then
printf "Invalid command $1, available commands are: $cmds\n"
exit 1
fi
shift 1
"$cmd" "$@"
...@@ -25,7 +25,9 @@ ...@@ -25,7 +25,9 @@
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>Copyright 2009 gedit, GNU General Public License.</string> <string>Copyright 2009 gedit, GNU General Public License.</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>10.4</string> <string>10.7</string>
<key>CFBundleName</key>
<string>gedit</string>
<key>CFBundleDocumentTypes</key> <key>CFBundleDocumentTypes</key>
<array> <array>
<dict> <dict>
......
...@@ -5,9 +5,9 @@ if test "x$GTK_DEBUG_LAUNCHER" != x; then ...@@ -5,9 +5,9 @@ if test "x$GTK_DEBUG_LAUNCHER" != x; then
fi fi
if test "x$GTK_DEBUG_GDB" != x; then if test "x$GTK_DEBUG_GDB" != x; then
EXEC="gdb --args" EXEC="lldb --"
elif test "x$GTK_DEBUG_DTRUSS" != x; then elif test "x$GTK_DEBUG_DTRUSS" != x; then
EXEC="dtruss" EXEC="sudo dtruss sudo -u $USER"
else else
EXEC=exec EXEC=exec
fi fi
...@@ -15,7 +15,10 @@ fi ...@@ -15,7 +15,10 @@ fi
name=$(basename "$0") name=$(basename "$0")
dirn=$(dirname "$0") dirn=$(dirname "$0")
bundle=$(cd "$dirn/../../" && pwd) pushd "$dirn/../../" > /dev/null
bundle=$(pwd -P)
popd > /dev/null
bundle_contents="$bundle"/Contents bundle_contents="$bundle"/Contents
bundle_res="$bundle_contents"/Resources bundle_res="$bundle_contents"/Resources
bundle_lib="$bundle_res"/lib bundle_lib="$bundle_res"/lib
...@@ -31,14 +34,15 @@ export GTK_DATA_PREFIX="$bundle_res" ...@@ -31,14 +34,15 @@ export GTK_DATA_PREFIX="$bundle_res"
export GTK_EXE_PREFIX="$bundle_res" export GTK_EXE_PREFIX="$bundle_res"
export GTK_PATH="$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_MODULE_FILE="$bundle_lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
export GIO_EXTRA_MODULES="$bundle_lib/gio/modules" #export GIO_EXTRA_MODULES="$bundle_lib/gio/modules"
export GI_TYPELIB_PATH="$bundle_lib/girepository-1.0" export GI_TYPELIB_PATH="$bundle_lib/girepository-1.0"
export PYTHONPATH="$bundle_lib/python2.7/site-packages:$PYTHONPATH" export PYTHONPATH="$bundle_lib/python3.3/site-packages"
export PYTHONHOME="$bundle_res" export PYTHONHOME="$bundle_res"
export PANGO_LIBDIR="$bundle_lib" export PANGO_LIBDIR="$bundle_lib"
export PANGO_SYSCONFDIR="$bundle_etc" export PANGO_SYSCONFDIR="$bundle_etc"
export PEAS_PLUGIN_LOADERS_DIR="$bundle_lib/libpeas-1.0/loaders" export PEAS_PLUGIN_LOADERS_DIR="$bundle_lib/libpeas-1.0/loaders"
export DBUS_REPLACE_INSTALL_PREFIX=$(printf '%q' "$bundle_res/") export ENCHANT_MODULES_DIR="$bundle_lib/enchant"
export ENCHANT_DATA_DIR="$bundle_data/enchant"
if test -f "$bundle_lib/charset.alias"; then if test -f "$bundle_lib/charset.alias"; then
export CHARSETALIASDIR="$bundle_lib" export CHARSETALIASDIR="$bundle_lib"
...@@ -50,31 +54,11 @@ if test -f "$bundle_res/environment.sh"; then ...@@ -50,31 +54,11 @@ if test -f "$bundle_res/environment.sh"; then
source "$bundle_res/environment.sh" source "$bundle_res/environment.sh"
fi fi
if test -f "$HOME/.geditenv"; then
source "$HOME/.geditenv"
fi
# Strip out the argument added by the OS. # Strip out the argument added by the OS.
if [ x`echo "x$1" | sed -e "s/^x-psn_.*//"` == x ]; then if [ x`echo "x$1" | sed -e "s/^x-psn_.*//"` == x ]; then
shift 1 shift 1
fi fi
# Launch dbus if needed
dbusenv="$TMPDIR/gedit-$USER.dbus"
if [ -f "$dbusenv" ]; then
source "$dbusenv"
fi
if [ -z "$DBUS_SESSION_BUS_PID" ] || ! ps -p "$DBUS_SESSION_BUS_PID" >/dev/null; then
"$bundle_bin/dbus-launch" --config-file "$bundle_etc/dbus-1/session.conf" > "$dbusenv"
source "$dbusenv"
fi
export DBUS_SESSION_BUS_PID
export DBUS_SESSION_BUS_ADDRESS
if [ "x$GTK_DEBUG_SHELL" != "x" ]; then if [ "x$GTK_DEBUG_SHELL" != "x" ]; then
exec bash exec bash
else else
......
...@@ -21,17 +21,14 @@ ...@@ -21,17 +21,14 @@
<destination overwrite="yes">${env:HOME}/Desktop</destination> <destination overwrite="yes">${env:HOME}/Desktop</destination>
--> -->
<image>
<!-- Not implemented yet (DMG image). -->
</image>
<!-- Optionally specify a launcher script to use. If the <!-- Optionally specify a launcher script to use. If the
application sets up everything needed itself, like application sets up everything needed itself, like
environment variable, linker paths, etc, a launcher script is environment variable, linker paths, etc, a launcher script is
not needed. If the source path is left out, the default not needed. If the source path is left out, the default
script will be used. script will be used.
--> -->
<launcher-script>${project}/launcher.sh</launcher-script> <launcher-script>${project}/gedit</launcher-script>
<run-install-name-tool/>
</meta> </meta>
<!-- The special macro "${project}" refers to the directory where <!-- The special macro "${project}" refers to the directory where
...@@ -48,9 +45,6 @@ ...@@ -48,9 +45,6 @@
<!-- Copy in GTK+ im modules --> <!-- Copy in GTK+ im modules -->
<binary>${prefix}/lib/gtk-3.0/${pkg:gtk+-3.0:gtk_binary_version}/immodules/*.so</binary> <binary>${prefix}/lib/gtk-3.0/${pkg:gtk+-3.0:gtk_binary_version}/immodules/*.so</binary>
<!-- Copy in GTK+ theming engines -->
<binary>${prefix}/lib/gtk-3.0/${pkg:gtk+-3.0:gtk_binary_version}/theming-engines/*.so</binary>
<!-- Copy in pango modules --> <!-- Copy in pango modules -->
<binary>${prefix}/lib/pango/${pkg:pango:pango_module_version}/modules/*.so</binary> <binary>${prefix}/lib/pango/${pkg:pango:pango_module_version}/modules/*.so</binary>
...@@ -64,47 +58,32 @@ ...@@ -64,47 +58,32 @@
<!-- Take the applespell enchant provider --> <!-- Take the applespell enchant provider -->
<binary>${prefix}/lib/enchant/libenchant_applespell.so</binary> <binary>${prefix}/lib/enchant/libenchant_applespell.so</binary>
<!-- Copy in gio modules --> <!-- Copy in peas modules -->
<binary>${prefix}/lib/gio/modules/*.so</binary> <binary>${prefix}/lib/libpeas-1.0/loaders/*.so</binary>
<!-- Copy in girepository typelibs --> <!-- Copy in girepository typelibs -->
<data>${prefix}/lib/girepository-1.0</data> <data>${prefix}/lib/girepository-1.0</data>
<!-- DBUS --> <!-- Copy in gedit private girepository typelibs -->
<binary>${prefix}/bin/dbus-*</binary> <data>${prefix}/lib/gedit/girepository-1.0</data>
<data>${prefix}/etc/dbus-1</data>
<data>${prefix}/share/dbus-1</data>
<binary>${prefix}/libexec/dbus-daemon-launch-helper</binary>
<!-- Copy in peas modules -->
<binary>${prefix}/lib/libpeas-1.0/loaders/*.so</binary>
<!-- python --> <!-- python -->
<binary>${prefix}/lib/python2.7/site-packages/cairo/*.so</binary> <binary>${prefix}/lib/python3.3/site-packages/cairo/*.so</binary>
<binary>${prefix}/lib/python2.7/site-packages/gi/*.so</binary> <binary>${prefix}/lib/python3.3/site-packages/gi/*.so</binary>
<binary>${prefix}/lib/python2.7/site-packages/gi/_glib/*.so</binary>
<binary>${prefix}/lib/python2.7/site-packages/gi/_gobject/*.so</binary> <!--<data>${prefix}/lib/python3.3/site-packages/cairo</data>
<binary>${prefix}/lib/python2.7/site-packages/libxml2mod.so</binary> <data>${prefix}/lib/python2.3/site-packages/gi</data>-->
<data>${prefix}/lib/python2.7/site-packages/cairo</data> <data>${prefix}/include/python3.3m/pyconfig.h</data>
<data>${prefix}/lib/python2.7/site-packages/gi</data>
<data>${prefix}/lib/python2.7/site-packages/libxml2.py</data>
<data>${prefix}/include/python2.7/pyconfig.h</data>
<binary>${prefix}/lib/python2.7/lib-dynload/*.so</binary> <binary>${prefix}/lib/python3.3/lib-dynload/*.so</binary>
<data>${prefix}/lib/python2.7</data> <data>${prefix}/lib/python3.3</data>
<binary>${prefix}/bin/python*</binary> <binary>${prefix}/bin/python3</binary>
<!-- GTK+3 data --> <!-- GTK+3 data -->
<data>${prefix}/etc/gtk-3.0/*</data> <data>${prefix}/etc/gtk-3.0/*</data>
<!-- dconf -->
<binary>${prefix}/libexec/dconf-service</binary>
<!-- gvfs -->
<binary>${prefix}/libexec/gvfsd-*</binary>
<data>${prefix}/share/gvfs</data>
<!-- gtksourceview --> <!-- gtksourceview -->
<data>${prefix}/share/gtksourceview-3.0</data> <data>${prefix}/share/gtksourceview-3.0</data>
...@@ -122,6 +101,8 @@ ...@@ -122,6 +101,8 @@
<!-- Themes --> <!-- Themes -->
<data>${prefix}/share/themes/Default</data> <data>${prefix}/share/themes/Default</data>
<data>${prefix}/share/themes/Adwaita</data> <data>${prefix}/share/themes/Adwaita</data>
<data>${prefix}/share/themes/HighContrast</data>
<data>${prefix}/share/themes/Mac</data>
<!-- App icon --> <!-- App icon -->
<data dest="${bundle}/Contents/Resources">${project}/gedit.icns</data> <data dest="${bundle}/Contents/Resources">${project}/gedit.icns</data>
...@@ -131,10 +112,6 @@ ...@@ -131,10 +112,6 @@
<data>${prefix}/share/glib-2.0/schemas/gschemas.compiled</data> <data>${prefix}/share/glib-2.0/schemas/gschemas.compiled</data>
<!-- Icon theme --> <!-- Icon theme -->
<icon-theme icons="auto">Adwaita</icon-theme>
<icon-theme icons="auto">gnome</icon-theme> <icon-theme icons="auto">gnome</icon-theme>
<!--<data>${prefix}/share/icons/gnome/16x16/apps/system-file-manager.png</data>
<data>${prefix}/share/icons/gnome/22x22/apps/system-file-manager.png</data>
<data>${prefix}/share/icons/gnome/24x24/apps/system-file-manager.png</data>
<data>${prefix}/share/icons/gnome/32x32/apps/system-file-manager.png</data>
<data>${prefix}/share/icons/gnome/scalable/apps/system-file-manager.svg</data>-->
</app-bundle> </app-bundle>
#!/bin/bash
if [ -d gedit.app ] && [ "$1x" = "-fx" ]; then
rm -rf gedit.app
fi
if [ ! -d gedit.app ]; then
gtk-mac-bundler gedit.bundle
else
echo "Note gedit.app bundle already exists, only stripping it..."
fi
function do_strip {
tp=$(file -b --mime-type "$1")
if [ "$tp" != "application/octet-stream" ]; then
return
fi
name=$(mktemp -t bundle)
st=$(stat -f %p "$1")
strip -o "$name" -S "$1"
mv -f "$name" "$1"
chmod "$st" "$1"
chmod u+w "$1"
}
echo "Removing unneeded files from bundle"
# Remove pyc and pyo files
for i in $(find gedit.app/Contents/Resources/lib/python2.7 -type f -regex '.*\.py[oc]'); do
rm -f "$i"
done
echo "Strip debug symbols from bundle binaries"
# Strip debug symbols
for i in $(find -E gedit.app/Contents/Resources -type f -regex '.*\.(so|dylib)$'); do
do_strip "$i"
done
for i in $(find gedit.app/Contents/Resources/bin -type f); do
if [ -x "$i" ]; then
do_strip "$i"
fi
done
do_strip gedit.app/Contents/MacOS/gedit-bin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment