From 12bcc48f1864bc1e98b14d7d5749fe0322a91c7c Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 22 Aug 2011 22:06:32 +0200 Subject: [PATCH] macos x build procedure improved - fix quit procedure (unsaved settings) --- README.macos | 85 +++++++++++++--------------------------------------- gtk/main.c | 12 +++++++- 2 files changed, 31 insertions(+), 66 deletions(-) diff --git a/README.macos b/README.macos index e9440307e..99d2e2816 100644 --- a/README.macos +++ b/README.macos @@ -2,83 +2,38 @@ * Compiling linphone on macos X * ********************************** +You need: + - Xcode (download from apple or using appstore application) + - Macports: http://www.macports.org/ + Download and install macports using its user friendly installer. -You have two options: using gtk-osx framework (http://gtk-osx.sourceforge.net/) which results in a Linphone GTK well integrated into Mac OS -environment. The other option is using MacPort, in which case Linphone will run as an X11 application inside Mac OS. - -At the date of March 25, 2011, no video support is available yet. - - -Compiling using gtk-osx -======================= - -Requirements: -* gtk-osx framework -* xcode (for gcc) -* macport (to retrieve dependencies easily, such as libosip2, libeXosip2, libspeex -* linphone git tree - -Steps: - -- Install gtk-osx jhbuild environment as described at -http://sourceforge.net/apps/trac/gtk-osx/wiki/Build -It will build gtk for osx as well as many dependencies. - -- Install ige-mac-bundler following instructions here (git clone method is preferred): -http://sourceforge.net/apps/trac/gtk-osx/wiki/Bundle +- Install build time dependencies + $ port install automake autoconf libtool intltool - Install some linphone dependencies with macports $ port install speex-dev $ port install osip2 $ port install eXosip2 + $ port install ffmpeg-devel + $ port install sdl-devel -- Install libSDL and ffmpeg from their official git or hg repositories. At this date (2011/05/09) the macports version are too old and buggy. +- Install gtk. It is recommended to use the quartz backend for better integration. + $ port install gtk2 +no_x11 + $ port install ige-mac-integration -- Now you can compile linphone +- Compile linphone -$ jhbuild shell -$ PKG_CONFIG_PATH=$HOME/gtk/inst/lib/pkgconfig:/opt/local/lib/pkgconfig/ ./configure --disable-static --disable-strict --with-gsm=/opt/local --disable-x11 -#assuming you have gsm installed in /opt/local. However gsm is optional. -$ make +If you got the source code from git, run ./autogen.sh first. -- You can generate a bundle using -$ make bundle - -The bundle is generated in ~/Desktop/Linphone and can safely be exported to other places and computers. - - -Compiling using MacPort -======================= - -This procedure works for audio, video still not fully supported. -It was tested on macos X (leopard) on september 2009. - -Requirements: -* xcode (for gcc) -* macport (GNU porting project) -* svn or git checkout'd linphone tree. - -Steps: -* install with the 'port install' command the following dependencies - - automake - - autoconf - - libtool - - gettext - - intltool - - gtk2 - - speex-dev - - osip2 - - eXosip2 +Then or otherwise, do: -* add /opt/local/bin to your PATH by editing (or creating) ~/.profile, logout and login again for changes to take effect - -* within linphone source directory, run ./autogen.sh -* run - ./configure --prefix=/opt/local --disable-video --with-readline=none && make - (note: we disable readline for linphonec because it appears to hang at this time) -* install to /opt/local - sudo make install + $ ./configure --prefix=/opt/local --with-readline=/opt/local --disable-strict --disable-x11 && make +Install to /opt/local + + $ sudo make install + +Done. diff --git a/gtk/main.c b/gtk/main.c index 6968466d8..03d66dc37 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -65,6 +65,7 @@ static gboolean iconified=FALSE; static gchar *workingdir=NULL; static char *progpath=NULL; gchar *linphone_logfile=NULL; +static gboolean app_terminated=FALSE; static GOptionEntry linphone_options[]={ { @@ -1364,6 +1365,14 @@ static void linphone_gtk_check_soundcards(){ } } +#ifdef HAVE_GTK_OSX +static gboolean on_block_termination(void){ + gtk_main_quit(); + g_message("Block termination returning %i",!app_terminated); + return !app_terminated; +} +#endif + int main(int argc, char *argv[]){ #ifdef ENABLE_NLS void *p; @@ -1458,7 +1467,7 @@ int main(int argc, char *argv[]){ g_signal_connect(G_OBJECT(theMacApp),"NSApplicationDidBecomeActive",(GCallback)linphone_gtk_show_main_window,NULL); g_signal_connect(G_OBJECT(theMacApp),"NSApplicationWillTerminate",(GCallback)gtk_main_quit,NULL); /*never block termination:*/ - g_signal_connect(G_OBJECT(theMacApp),"NSApplicationBlockTermination",(GCallback)gtk_false,NULL); + g_signal_connect(G_OBJECT(theMacApp),"NSApplicationBlockTermination",(GCallback)on_block_termination,NULL); #endif the_ui=linphone_gtk_create_window("main"); @@ -1491,6 +1500,7 @@ int main(int argc, char *argv[]){ linphone_gtk_destroy_log_window(); linphone_core_destroy(the_core); linphone_gtk_log_uninit(); + app_terminated=TRUE; #ifndef HAVE_GTK_OSX /*workaround a bug on win32 that makes status icon still present in the systray even after program exit.*/ gtk_status_icon_set_visible(icon,FALSE);