From f3d0f2151f46126f978d7021ef8b792f51fb266c Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 20 Mar 2015 16:39:35 +0100 Subject: [PATCH] update for lastest macport, and allow the use of the default locale on macos --- README.macos.md | 32 ++++++++------------------------ build/macos/environment.sh | 19 +++++++++++++++++++ configure.ac | 9 ++++++++- gtk/main.c | 7 +++++-- 4 files changed, 40 insertions(+), 27 deletions(-) diff --git a/README.macos.md b/README.macos.md index 15746cf5e..525681cd5 100644 --- a/README.macos.md +++ b/README.macos.md @@ -13,29 +13,26 @@ ##### Multiple MacOS version support -In order to enable generation of bundle for multiple MacOS version and 32 bit processors, it is recommended to: +In order to enable generation of bundle for older MacOS version, it is recommended to: -1. Edit `/opt/local/etc/macports/macports.conf` to add the following line: + Edit `/opt/local/etc/macports/macports.conf` to add the following line: - > macosx_deployment_target 10.6 + > macosx_deployment_target 10.7 -2. Edit `/opt/local/etc/macports/variants.conf` to add the following line: - - > +universal ##### Linphone library (liblinphone) sudo port install automake autoconf libtool pkgconfig intltool wget cunit \ - antlr3 speex libvpx readline sqlite3 libsoup openldap libupnp \ + antlr3 speex libvpx readline sqlite3 openldap libupnp \ ffmpeg-devel -gpl2 ##### Linphone UI (GTK version) Install `GTK`. It is recommended to use the `quartz` backend for better integration. - sudo port install gtk2 +quartz +no_x11 - sudo port install gtk-osx-application -python27 + sudo port install gtk2 +quartz +no_x11 libsoup + sudo port install gtk-osx-application +no_python sudo port install hicolor-icon-theme #### Using HomeBrew @@ -160,28 +157,15 @@ Then run, inside Linphone source tree configure as told before but with `--enabl The resulting bundle is located in Linphone build directory, together with a zipped version. * For a better appearance, you can install `gtk-quartz-engine` (a GTK theme) that makes GTK application more similar to other Mac applications (but not perfect). - + sudo port install gnome-common git clone https://github.com/jralls/gtk-quartz-engine.git cd gtk-quartz-engine - autoreconf -i + ./autogen.sh ./configure --prefix=/opt/local CFLAGS="$CFLAGS -Wno-error" && make sudo make install Generate a new bundle to have it included. -### libiconv hack - -The `Makefile.am` rules used to generate the bundle fetch a `libiconv.2.dylib` from a Linphone download page. -This library adds some additional symbols so that dependencies requiring the `iconv` from `/usr/lib` and the ones requiring from the bundle are both satisfied. -In case this library needs to generated, here are the commands: - - wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz - cd libiconv-1.14 - patch -p1 < ../linphone/build/MacOS/libiconv-MacOS.patch - ./configure --prefix=/opt/local --disable-static 'CFLAGS=-arch i386 -arch x86_64 -mmacosx-version-min=10.5' 'LDFLAGS=-arch i386 -arch x86_64 -mmacosx-version-min=10.5' CXXFLAGS="-arch i386 -arch x86_64 -mmacosx-version-min=10.5" && make - make install DESTDIR=/tmp - -The resulted library can be found in `/tmp/opt/local/lib`. diff --git a/build/macos/environment.sh b/build/macos/environment.sh index b466fecc4..fae264e0e 100644 --- a/build/macos/environment.sh +++ b/build/macos/environment.sh @@ -3,5 +3,24 @@ export LINPHONE_WORKDIR="$bundle_res" export GIO_EXTRA_MODULES="$bundle_lib/gio/modules" export PANGO_LIBDIR="$bundle_lib" export PANGO_SYSCONFDIR="$bundle_etc" + +#this is very important not to force a shared library path so that native frameworks can find their dependencies by themselves, +#and not be forced to use the few libraries we have in the bundle that have the same name as native libs (ex: libiconv) export DYLD_LIBRARY_PATH= +#the fucking script of the gtk-mac-bundler resets LANG due to obscure bugs. Set it back. +LANG=`defaults read .GlobalPreferences AppleLocale` + +case "$LANG" in + *.UTF-8) + ;; + *) + if test -d /usr/share/locale/${LANG}.UTF-8 ; then + LANG=${LANG}.UTF-8 + fi + ;; +esac + +export LANG + +echo "LANG is $LANG" \ No newline at end of file diff --git a/configure.ac b/configure.ac index e96de237c..c95d166ad 100644 --- a/configure.ac +++ b/configure.ac @@ -337,7 +337,14 @@ AC_ARG_ENABLE(gtk_ui, if test "$gtk_ui" = "true" ; then PKG_CHECK_MODULES(LIBGTK, gtk+-2.0 >= 2.18.0 gthread-2.0) if test "$enable_x11" = "false" ; then - PKG_CHECK_MODULES(LIBGTKMAC,[gtk-mac-integration >= 2.0.1]) + PKG_CHECK_MODULES(LIBGTKMAC,[gtk-mac-integration >= 2.0.1], [found_gtkmac=true], [found_gtkmac=false]) + if test "$found_gtkmac" != "true" ; then + dnl for newest macports, the name changed. + PKG_CHECK_MODULES(LIBGTKMAC,[gtk-mac-integration-gtk2 >= 2.0.1], [found_gtkmac=true], [found_gtkmac=false]) + fi + if test "$found_gtkmac" != "true" ; then + AC_MSG_ERROR([gtk-mac-integration not found. Please install gtk-osx-application package.]) + fi AC_DEFINE([HAVE_GTK_OSX],[1],[Defined when gtk osx is used]) fi else diff --git a/gtk/main.c b/gtk/main.c index ac0b4cd52..dce389c97 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -2101,8 +2101,11 @@ int main(int argc, char *argv[]){ /*for pulseaudio:*/ g_setenv("PULSE_PROP_media.role", "phone", TRUE); #endif - - if ((lang=linphone_gtk_get_lang(config_file))!=NULL && lang[0]!='\0'){ + lang=linphone_gtk_get_lang(config_file); + if (lang == NULL || lang[0]=='\0'){ + lang = getenv("LANG"); + } + if (lang && lang[0]!='\0'){ #ifdef WIN32 char tmp[128]; snprintf(tmp,sizeof(tmp),"LANG=%s",lang);