leetle-hildon-1chinook-migration-things.md (2015B)
1 # Leetle hildon-1/chinook migration things 2 3 Most of "my" applications are now chinook ready, at least in the svn. However, I prefer to keep them compatible with mistral and bora, so I need to do little quirks. Let's investigate osso-xterm's modifications for example. 4 5 What was previously known as hildon-libs, is now hildon-1, so we need to tell configure.ac about this. Before the change, I had: 6 7 <div class="p"> 8 <pre> 9 PKG_CHECK_MODULES(HILDON, hildon-libs >= 0.12.0) 10 AC_SUBST(HILDON_CFLAGS) 11 AC_SUBST(HILDON_LIBS) 12 </pre> 13 </div> 14 15 Now, as we need to also check for hildon-1, and due to the fact that we need to know it in source as the include paths have changed, it goes like this: 16 17 <div class="p"> 18 <pre> 19 PKG_CHECK_MODULES(HILDON, hildon-1 >= 0.9.9, \ 20 AC_DEFINE(HILDON, 1, [Version of hildon libraries]), \ 21 [AC_DEFINE(HILDON, 0, [Version of hildon libraries]) \ 22 PKG_CHECK_MODULES(HILDON_LIBS, hildon-libs >= 0.12.0)]) 23 AC_SUBST(HILDON_CFLAGS) 24 AC_SUBST(HILDON_LIBS) 25 </pre> 26 </div> 27 28 In code, I do the following: 29 30 <div class="p"> 31 <pre> 32 #ifdef HAVE_CONFIG_H 33 # include <config.h> 34 #endif 35 #if HILDON == 1 36 # include <hildon/hildon-window.h> 37 #else 38 # include <hildon-widgets/hildon-window.h> 39 #endif 40 </pre> 41 </div> 42 43 There are also some real changes, but with this I get to compile stuff and get warnings/errors for the other stuff that has changed. Those I've, again, separated with #if HILDON == 1. 44 45 For projects that don't use autotools, I use this kind of stuff: 46 47 <div class="p"> 48 <pre> 49 mh_shot_tool_CFLAGS += $(shell if pkg-config hildon-1 --exists; then \ 50 pkg-config hildon-1 --cflags; echo -DHILDON=1; \ 51 elif pkg-config hildon-libs --exists; then \ 52 pkg-config hildon-libs --cflags; echo -DHILDON=0; \ 53 else pkg-config gtk+-2.0 --cflags; fi) 54 </pre> 55 </div> 56 57 **Edit:** thanks to Loïc for pointing out, the AC_SUBSTs aren't actually needed, PKG_CHECK_MODULES already does that. You may omit them and it will still work.