diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | macosx/Makefile.am | 1 | ||||
-rw-r--r-- | macosx/bundle/Info-sylpheed.plist | 30 | ||||
-rw-r--r-- | macosx/bundle/Makefile.am | 8 | ||||
-rw-r--r-- | macosx/bundle/README.txt | 13 | ||||
-rw-r--r-- | macosx/bundle/gtkrc | 2 | ||||
-rwxr-xr-x | macosx/bundle/launcher.sh | 168 | ||||
-rw-r--r-- | macosx/bundle/sylpheed.bundle | 148 | ||||
-rw-r--r-- | macosx/bundle/sylpheed.icns | bin | 0 -> 38887 bytes | |||
-rwxr-xr-x | makeosx.sh | 8 | ||||
-rw-r--r-- | src/main.c | 10 | ||||
-rw-r--r-- | src/manual.c | 14 |
14 files changed, 413 insertions, 1 deletions
@@ -1,3 +1,10 @@ +2013-12-19 + + * src/main.c + src/manual.c: OS X: modified for bundle folder structure. + * makeosx.sh: OS X: added build script for OS X. + * macosx/bundle: OS X: added files for gtk-mac-bundler. + 2013-12-13 * libsylph/utils.c: set_startup_dir(): OS X: set application bundle diff --git a/Makefile.am b/Makefile.am index e4d90522..f73399c2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = ac libsylph src plugin po manual faq nsis +SUBDIRS = ac libsylph src plugin po manual faq nsis macosx EXTRA_DIST = config.rpath \ ChangeLog.ja \ @@ -20,6 +20,7 @@ EXTRA_DIST = config.rpath \ sylpheed-128x128.png \ sylpheed-64x64.png \ autogen.sh \ + makeosx.sh \ makewin32.sh \ mime.types \ sylpheed-mailto-protocol_admin.reg \ diff --git a/configure.in b/configure.in index 1756bc9f..3bd6b68a 100644 --- a/configure.in +++ b/configure.in @@ -488,6 +488,8 @@ manual/Makefile manual/en/Makefile manual/ja/Makefile nsis/Makefile +macosx/Makefile +macosx/bundle/Makefile ]) dnl Output the configuration summary diff --git a/macosx/Makefile.am b/macosx/Makefile.am new file mode 100644 index 00000000..ef26b0cb --- /dev/null +++ b/macosx/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = bundle diff --git a/macosx/bundle/Info-sylpheed.plist b/macosx/bundle/Info-sylpheed.plist new file mode 100644 index 00000000..bea22ff6 --- /dev/null +++ b/macosx/bundle/Info-sylpheed.plist @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>Sylpheed</string> + <key>CFBundleGetInfoString</key> + <string>3.4beta7, (C) 1999-2013 Sylpheed Development Team http://sylpheed.sraoss.jp</string> + <key>CFBundleIconFile</key> + <string>sylpheed.icns</string> + <key>CFBundleIdentifier</key> + <string>jp.sraoss.sylpheed.sylpheed</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>3.4</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>3.4</string> + <key>NSHumanReadableCopyright</key> + <string>Copyright 1999-2013 Sylpheed Development Team</string> + <key>LSMinimumSystemVersion</key> + <string>10.6</string> +</dict> +</plist> diff --git a/macosx/bundle/Makefile.am b/macosx/bundle/Makefile.am new file mode 100644 index 00000000..05d7c03e --- /dev/null +++ b/macosx/bundle/Makefile.am @@ -0,0 +1,8 @@ +EXTRA_DIST = \ + Info-sylpheed.plist \ + Makefile.am \ + README.txt \ + gtkrc \ + launcher.sh \ + sylpheed.bundle \ + sylpheed.icns diff --git a/macosx/bundle/README.txt b/macosx/bundle/README.txt new file mode 100644 index 00000000..9e1cebba --- /dev/null +++ b/macosx/bundle/README.txt @@ -0,0 +1,13 @@ +Gtk Mac Bundler files to create application bundle +================================================== + +1. Install GTK+ and Sylpheed with jhbuild. + +2. Install gtk-mac-bundler. + +3. Run the following commands in this folder: + +$ jhbuild shell +$ gtk-mac-bundler sylpheed.bundle + +4. If successful, Sylpheed.app will be created on Desktop. diff --git a/macosx/bundle/gtkrc b/macosx/bundle/gtkrc new file mode 100644 index 00000000..ba5477ca --- /dev/null +++ b/macosx/bundle/gtkrc @@ -0,0 +1,2 @@ +gtk-icon-theme-name = "Tango" +gtk-enable-mnemonics = 0 diff --git a/macosx/bundle/launcher.sh b/macosx/bundle/launcher.sh new file mode 100755 index 00000000..e79527b8 --- /dev/null +++ b/macosx/bundle/launcher.sh @@ -0,0 +1,168 @@ +#!/bin/sh + +if test "x$GTK_DEBUG_LAUNCHER" != x; then + set -x +fi + +if test "x$GTK_DEBUG_GDB" != x; then + EXEC="gdb --args" +else + EXEC=exec +fi + +name=`basename "$0"` +tmp="$0" +tmp=`dirname "$tmp"` +tmp=`dirname "$tmp"` +bundle=`dirname "$tmp"` +bundle_contents="$bundle"/Contents +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 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 GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc" +export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules" +export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-2.0/gdk-pixbuf.loaders" +export PANGO_RC_FILE="$bundle_etc/pango/pangorc" + +APP=sylpheed +I18NDIR="$bundle_data/locale" +# Set the locale-related variables appropriately: +unset LANG LC_MESSAGES LC_MONETARY LC_COLLATE + +# Has a language ordering been set? +# If so, set LC_MESSAGES and LANG accordingly; otherwise skip it. +# First step uses sed to clean off the quotes and commas, to change - to _, and change the names for the chinese scripts from "Hans" to CN and "Hant" to TW. +APPLELANGUAGES=`defaults read .GlobalPreferences AppleLanguages | sed -En -e 's/\-/_/' -e 's/Hant/TW/' -e 's/Hans/CN/' -e 's/[[:space:]]*\"?([[:alnum:]_]+)\"?,?/\1/p' ` +if test "$APPLELANGUAGES"; then + # A language ordering exists. + # Test, item per item, to see whether there is an corresponding locale. + for L in $APPLELANGUAGES; do + #test for exact matches: + if test -f "$I18NDIR/${L}/LC_MESSAGES/$APP.mo"; then + export LANG=$L + break + fi + #This is a special case, because often the original strings are in US + #English and there is no translation file. + if test "x$L" == "xen_US"; then + export LANG=$L + break + fi + #OK, now test for just the first two letters: + if test -f "$I18NDIR/${L:0:2}/LC_MESSAGES/$APP.mo"; then + export LANG=${L:0:2} + break + fi + #Same thing, but checking for any english variant. + if test "x${L:0:2}" == "xen"; then + export LANG=$L + break + fi; + done +fi +unset APPLELANGUAGES L + +# If we didn't get a language from the language list, try the Collation preference, in case it's the only setting that exists. +APPLECOLLATION=`defaults read .GlobalPreferences AppleCollationOrder` +if test -z ${LANG} -a -n $APPLECOLLATION; then + if test -f "$I18NDIR/${APPLECOLLATION:0:2}/LC_MESSAGES/$APP.mo"; then + export LANG=${APPLECOLLATION:0:2} + fi +fi +if test ! -z $APPLECOLLATION; then + export LC_COLLATE=$APPLECOLLATION +fi +unset APPLECOLLATION + +# Continue by attempting to find the Locale preference. +APPLELOCALE=`defaults read .GlobalPreferences AppleLocale` + +if test -f "$I18NDIR/${APPLELOCALE:0:5}/LC_MESSAGES/$APP.mo"; then + if test -z $LANG; then + export LANG="${APPLELOCALE:0:5}" + fi + +elif test -z $LANG -a -f "$I18NDIR/${APPLELOCALE:0:2}/LC_MESSAGES/$APP.mo"; then + export LANG="${APPLELOCALE:0:2}" +fi + +#Next we need to set LC_MESSAGES. If at all possilbe, we want a full +#5-character locale to avoid the "Locale not supported by C library" +#warning from Gtk -- even though Gtk will translate with a +#two-character code. +if test -n $LANG; then +#If the language code matches the applelocale, then that's the message +#locale; otherwise, if it's longer than two characters, then it's +#probably a good message locale and we'll go with it. + if test $LANG == ${APPLELOCALE:0:5} -o $LANG != ${LANG:0:2}; then + export LC_MESSAGES=$LANG +#Next try if the Applelocale is longer than 2 chars and the language +#bit matches $LANG + elif test $LANG == ${APPLELOCALE:0:2} -a $APPLELOCALE > ${APPLELOCALE:0:2}; then + export LC_MESSAGES=${APPLELOCALE:0:5} +#Fail. Get a list of the locales in $PREFIX/share/locale that match +#our two letter language code and pick the first one, special casing +#english to set en_US + elif test $LANG == "en"; then + export LC_MESSAGES="en_US" + else + LOC=`find $PREFIX/share/locale -name $LANG???` + for L in $LOC; do + export LC_MESSAGES=$L + done + fi +else +#All efforts have failed, so default to US english + export LANG="en_US" + export LC_MESSAGES="en_US" +fi +CURRENCY=`echo $APPLELOCALE | sed -En 's/.*currency=([[:alpha:]]+).*/\1/p'` +if test "x$CURRENCY" != "x"; then +#The user has set a special currency. Gtk doesn't install LC_MONETARY files, but Apple does in /usr/share/locale, so we're going to look there for a locale to set LC_CURRENCY to. + if test -f /usr/local/share/$LC_MESSAGES/LC_MONETARY; then + if test -a `cat /usr/local/share/$LC_MESSAGES/LC_MONETARY` == $CURRENCY; then + export LC_MONETARY=$LC_MESSAGES + fi + fi + if test -z "$LC_MONETARY"; then + FILES=`find /usr/share/locale -name LC_MONETARY -exec grep -H $CURRENCY {} \;` + if test -n "$FILES"; then + export LC_MONETARY=`echo $FILES | sed -En 's%/usr/share/locale/([[:alpha:]_]+)/LC_MONETARY.*%\1%p'` + fi + fi +fi +#No currency value means that the AppleLocale governs: +if test -z "$LC_MONETARY"; then + LC_MONETARY=${APPLELOCALE:0:5} +fi +#For Gtk, which only looks at LC_ALL: +export LC_ALL=$LC_MESSAGES + +unset APPLELOCALE FILES LOC + +if test -f "$bundle_lib/charset.alias"; then + export CHARSETALIASDIR="$bundle_lib" +fi + +# Extra arguments can be added in environment.sh. +EXTRA_ARGS= +if test -f "$bundle_res/environment.sh"; then + source "$bundle_res/environment.sh" +fi + +# Strip out the argument added by the OS. +if /bin/expr "x$1" : '^x-psn_' > /dev/null; then + shift 1 +fi + +$EXEC "$bundle_contents/MacOS/$name-bin" "$@" $EXTRA_ARGS diff --git a/macosx/bundle/sylpheed.bundle b/macosx/bundle/sylpheed.bundle new file mode 100644 index 00000000..fc6393d9 --- /dev/null +++ b/macosx/bundle/sylpheed.bundle @@ -0,0 +1,148 @@ +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<app-bundle> + + <meta> + <!-- Where to pick up the GTK+ installation, icon themes, + etc. Note that "${env:JHBUILD_PREFIX}" is evaluated to the + value of the environment variable JHBUILD_PREFIX. You can + define additional prefixes and refer to them in paths + throughout this file on the form "${prefix:name}". This is + useful for installing certain libraries or even the + application itself separately. Note that JHBUILD_PREFIX is + defined by jhbuild, so it you are not using jhbuild you can + either define your own or just hardcode the path here. + --> + <prefix name="default">${env:JHBUILD_PREFIX}</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">${env:HOME}/Desktop</destination> + + <image> + <!-- Not implemented yet (DMG image). --> + </image> + + <!-- Comment this out to keep the install names in binaries --> + <run-install-name-tool/> + + <!-- Optionally specify a launcher script to use. If the + application sets up everything needed itself, like + environment variable, linker paths, etc, a launcher script is + not needed. If the source path is left out, the default + script will be used. + --> + <launcher-script>${project}/launcher.sh</launcher-script > + + <!-- Not implemented: Optional runtime, could be python or mono + for example. + --> + <!-- runtime copy="yes">/usr/bin/python</runtime --> + <!-- Indicate the active gtk version to use. This is needed only + for gtk+-3.0 projects. --> + <gtk>gtk+-2.0</gtk> + </meta> + + <!-- The special macro "${project}" refers to the directory where + this bundle file is located. The application name and bundle + identifier are taken from the plist file. + --> + <plist>${project}/Info-sylpheed.plist</plist> + + <main-binary>${prefix}/bin/sylpheed</main-binary> + + <!-- Copy in GTK+ modules. Note the ${gtkdir} macro, which expands + to the correct library subdirectory for the specified gtk + version. + --> + <binary> + ${prefix}/lib/${gtkdir}/modules/*.so + </binary> + + <!-- Copy in GTK+ theme engines and print backends. Note the use of the + "${pkg:module:variable}" macro, which evaluates to a pkg-config + variable in the specified module. Note that any libraries that + binaries link to are also copied in automatically. Note also + the included ${gtk} macro, which gets the correct package name + to get. --> + <binary> + ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/engines/*.so + </binary> + <binary> + ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/printbackends/*.so + </binary> + <binary> + ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/immodules/*.so + </binary> + +<!-- Starting with 2.24, gdk-pixbuf installs into its own directory. --> + <binary> + ${prefix}/lib/gdk-pixbuf-2.0/${pkg:${gtk}:gtk_binary_version}/loaders/*.so + </binary> + + <binary> + ${prefix}/lib/sylpheed/plugins/*.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="gtk20"> + ${prefix}/share/locale + </translations> + <translations name="sylpheed"> + ${prefix}/share/locale + </translations> + + + <!-- Data to copy in, usually Glade/UI files, images, sounds files + etc. The destination inside the bundle can be specified if the + files should end up at a different location, by using the + "dest" property. The destination must then start with the macro + "${bundle}", which refers to the bundle root directory. + --> + <data> + ${prefix}/share/sylpheed + </data> + <!-- data> + ${prefix}/share/pixmaps + </data --> + + <!-- Copy in the themes data. You may want to trim this to save space + in your bundle. --> + <data> + ${prefix}/share/themes + </data> + + <!-- Copy icons. Note that the .icns file is an Apple format which + contains up to 4 sizes of icon. You can use + /Developer/Applications/Utilities/Icon Composer.app to import + artwork and create the file. --> + <data dest="${bundle}/Contents/Resources"> + ${project}/sylpheed.icns + </data> + + <!-- This is where theme commands go. You can copy them in from your + theme of choice if they provide and example, or you can just + change the source path. --> + + <data dest="${bundle}/Contents/Resources/etc/${gtkdir}/gtkrc"> + ${project}/gtkrc + </data> + + <!-- Icon themes to copy. The "icons" property can be either of + "auto", "all", or "none". All or none should be + self-explanatory, while auto means that the script will try to + figure out which icons are needed. This is done by getting all + the strings from all copied binaries, and matching them against + icon names. To be safe, you should use "all". "none" is useful + if you want just the index.theme file but no icons, mostly + needed for the "hicolor" base theme. + > + <icon-theme icons="auto"> + Tango + </icon-theme --> + +</app-bundle> diff --git a/macosx/bundle/sylpheed.icns b/macosx/bundle/sylpheed.icns Binary files differnew file mode 100644 index 00000000..50431818 --- /dev/null +++ b/macosx/bundle/sylpheed.icns diff --git a/makeosx.sh b/makeosx.sh new file mode 100755 index 00000000..92ae1eda --- /dev/null +++ b/makeosx.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +./configure --prefix=$HOME/gtk/inst \ + --with-localedir=Contents/Resources/share/locale \ + --with-themedir=Contents/Resources/share/icons \ + && make \ + && make install-strip \ + && (cd plugin/attachment_tool; make install-plugin) @@ -1428,6 +1428,16 @@ static void plugin_init(void) NULL); syl_plugin_load_all(path); g_free(path); +#elif defined(__APPLE__) + path = g_strconcat(get_startup_dir(), G_DIR_SEPARATOR_S, + "Contents" G_DIR_SEPARATOR_S + "Resources" G_DIR_SEPARATOR_S + "lib" G_DIR_SEPARATOR_S + "sylpheed" G_DIR_SEPARATOR_S + PLUGIN_DIR, + NULL); + syl_plugin_load_all(path); + g_free(path); #else syl_plugin_load_all(PLUGINDIR); #endif diff --git a/src/manual.c b/src/manual.c index 44bc54e0..9383bd9b 100644 --- a/src/manual.c +++ b/src/manual.c @@ -65,6 +65,13 @@ void manual_open(ManualLang lang) get_startup_dir(), G_DIR_SEPARATOR_S "doc" G_DIR_SEPARATOR_S "manual", +#elif defined(__APPLE__) + get_startup_dir(), + G_DIR_SEPARATOR_S "Contents" G_DIR_SEPARATOR_S + "Resources" G_DIR_SEPARATOR_S + "share" G_DIR_SEPARATOR_S + "sylpheed" G_DIR_SEPARATOR_S + "manual", #else MANUALDIR, #endif @@ -87,6 +94,13 @@ void faq_open(ManualLang lang) #ifdef G_OS_WIN32 get_startup_dir(), G_DIR_SEPARATOR_S "doc" G_DIR_SEPARATOR_S "faq", +#elif defined(__APPLE__) + get_startup_dir(), + G_DIR_SEPARATOR_S "Contents" G_DIR_SEPARATOR_S + "Resources" G_DIR_SEPARATOR_S + "share" G_DIR_SEPARATOR_S + "sylpheed" G_DIR_SEPARATOR_S + "faq", #else FAQDIR, #endif |