From 8af9727937480d26ff39a7eeb96668073f846d9f Mon Sep 17 00:00:00 2001 From: TingPing Date: Mon, 13 Jan 2014 09:28:06 -0500 Subject: Add gtk-mac-bundler files --- .gitignore | 2 + osx/Info.plist | 30 ++++++++++ osx/gtkrc | 97 ++++++++++++++++++++++++++++++ osx/hexchat.bundle | 71 ++++++++++++++++++++++ osx/hexchat.icns | Bin 0 -> 136174 bytes osx/launcher.sh | 173 +++++++++++++++++++++++++++++++++++++++++++++++++++++ osx/makebundle.sh | 15 +++++ 7 files changed, 388 insertions(+) create mode 100644 osx/Info.plist create mode 100644 osx/gtkrc create mode 100644 osx/hexchat.bundle create mode 100644 osx/hexchat.icns create mode 100755 osx/launcher.sh create mode 100755 osx/makebundle.sh diff --git a/.gitignore b/.gitignore index a21036c0..894aeb57 100644 --- a/.gitignore +++ b/.gitignore @@ -78,3 +78,5 @@ resource.h *.sdf *.suo *.user +#OSX +osx/HexChat.app diff --git a/osx/Info.plist b/osx/Info.plist new file mode 100644 index 00000000..06469a5e --- /dev/null +++ b/osx/Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + HexChat + CFBundleGetInfoString + 2.9.6 + CFBundleIconFile + hexchat.icns + CFBundleIdentifier + org.hexchat + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleShortVersionString + 2.9.6 + CFBundleSignature + ???? + CFBundleVersion + 2.9.6 + NSHumanReadableCopyright + + LSMinimumSystemVersion + 10.4 + + diff --git a/osx/gtkrc b/osx/gtkrc new file mode 100644 index 00000000..326f9d5a --- /dev/null +++ b/osx/gtkrc @@ -0,0 +1,97 @@ +# Based off example shipped with gtk-quartz-engine + +gtk-icon-sizes = "gtk-menu=16,16:gtk-small-toolbar=16,16:gtk-large-toolbar=24,24:gtk-dnd=32,32" +gtk-toolbar-icon-size = small-toolbar + +gtk_color_scheme = "fg_color:#000\nbg_color:ededed\nbase_color:#fff\ntext_color:#1A1A1A\nselected_bg_color:#86ABD9\nselected_fg_color:#fff\ntooltip_bg_color:#F5F5B5\ntooltip_fg_color:#000" + +gtk-button-images = 0 +gtk-menu-images = 0 +gtk-enable-mnemonics = 0 + +style "clearlooks-default" +{ + engine "clearlooks" + { + } +} + +style "quartz-default" +{ + xthickness = 0 + ythickness = 0 + + GtkWidget::interior-focus = 1 + GtkWidget::focus-line-width = 0 + GtkWidget::focus-padding = 0 + + GtkButton::default-border = { 0, 0, 0, 0 } + GtkButton::default-outside-border = { 0, 0, 0, 0 } + GtkButton::child-displacement-x = 0 + GtkButton::child-displacement-y = 0 + + GtkCheckButton::indicator-spacing = 3 + + GtkSpinButton::shadow-type = out + + GtkComboBox::appears-as-list = 0 + GtkComboBox::focus-on-click = 0 + + GtkNotebook::tab-curvature = 4 + GtkNotebook::tab-overlap = 0 + + GtkTreeView::allow-rules = 1 + GtkTreeView::expander-size = 14 + GtkToolbar::internal-padding = 3 + GtkExpander::expander-size = 14 + + GtkScrolledWindow::scrollbar-spacing = 0 + + GtkMenuItem::horizontal-padding = 8 + GtkSeparatorMenuItem::horizontal-padding = 2 + + engine "quartz" + { + } +} + +style "quartz-toolbar" +{ + xthickness = 3 + ythickness = 3 +} + +style "quartz-frame" +{ + xthickness = 2 + ythickness = 2 +} + +style "quartz-scrolled-window" +{ + xthickness = 2 + ythickness = 2 +} + +style "quartz-notebook" +{ + xthickness = 2 + ythickness = 2 +} + +style "quartz-menu" +{ + +} + +class "GtkWidget" style "quartz-default" +#class "GtkMenu*" style "quartz-menu" # TODO fix buggy menus +class "GtkNotebook" style "quartz-notebook" + +class "GtkEntry" style "clearlooks-default" +class "SexySpellEntry" style "clearlooks-default" +# GtkSpinButton now uses clearlooks but its broken anyways + +widget_class "*Toolbar*" style "quartz-toolbar" +widget_class "*." style "quartz-scrolled-window" +widget_class "*." style "quartz-frame" diff --git a/osx/hexchat.bundle b/osx/hexchat.bundle new file mode 100644 index 00000000..0ed14b6c --- /dev/null +++ b/osx/hexchat.bundle @@ -0,0 +1,71 @@ + + + + + ${env:JHBUILD_PREFIX} + ${project} + + + ${project}/launcher.sh + gtk+-2.0 + + + ${project}/Info.plist + + + ${prefix}/bin/hexchat + + + + + ${prefix}/lib/${gtkdir}/modules/*.so + + + ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/engines/libquartz.so + + + ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/engines/libclearlooks.so + + + ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/printbackends/*.so + + + ${prefix}/lib/gdk-pixbuf-2.0/${pkg:${gtk}:gtk_binary_version}/loaders/*.so + + + ${prefix}/lib/pango/${pkg:pango:pango_module_version}/modules/ + + + + ${prefix}/share/locale + + + ${prefix}/share/locale + + + + ${project}/gtkrc + + + + ${project}/hexchat.icns + + + + + diff --git a/osx/hexchat.icns b/osx/hexchat.icns new file mode 100644 index 00000000..f7d7d690 Binary files /dev/null and b/osx/hexchat.icns differ diff --git a/osx/launcher.sh b/osx/launcher.sh new file mode 100755 index 00000000..19915b4a --- /dev/null +++ b/osx/launcher.sh @@ -0,0 +1,173 @@ +#!/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_LIBDIR="$bundle_lib" +export PANGO_SYSCONFDIR="$bundle_etc" + +#export PYTHON="$bundle_contents/MacOS/python" +#export PYTHONHOME="$bundle_res" +#export PYTHONPATH="$bundle_lib/python2.7:$bundle_lib/python2.7/site-packages" + +APP=name +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/osx/makebundle.sh b/osx/makebundle.sh new file mode 100755 index 00000000..24130aa1 --- /dev/null +++ b/osx/makebundle.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +if [ -z "$JHBUILD_PREFIX" ]; then + echo "You must run this within a jhbuild shell." + exit 1 +fi + +if [ ! -f $JHBUILD_PREFIX/bin/python ]; then + echo "You must install python with jhbuild." + exit 1 +fi + +rm -rf HexChat.app + +$JHBUILD_PREFIX/bin/python $HOME/.local/bin/gtk-mac-bundler hexchat.bundle -- cgit 1.4.1