Difference between revisions of "GTK+ 3 migration"
(→Building Inkscape against GTK+ 3: Build now succeeds) |
(Updated) |
||
Line 14: | Line 14: | ||
After this, you can build as usual. | After this, you can build as usual. | ||
== Current status == | |||
Inkscape builds successfully against GTK+ 3, but the resulting program is unstable and isn't recommended for users yet. A few key issues are as follows: | |||
* Several significant bugs affect the GTK+ 3 builds. Please see the [https://bugs.launchpad.net/inkscape/+bugs?field.tag=gtk3 list of known bugs], and please report any more that you find! | |||
* The Gtk+ 3 builds introduce a number of dependencies, including version 3.3.4 of the GDL dockable-dialog library (Gtk+ 2 builds use an internal copy of the library). Most linux distributions now provide this. We're [[tracking the dependencies]]... keep an eye on the list. | |||
* There is currently no easy way of building against Gtk+ 3 on Windows. However, there is [https://bugs.launchpad.net/inkscape/+bug/1088612 work in progress]. | |||
* Gtk+ 3 is still evolving. To avoid being affected by the level of pain we experienced with the Gtk+ 2 -> Gtk+ 3 migration, we should aim to stay as up-to-date with our API usage as possible... i.e., eliminate [[#deprecated symbols]] as soon as possible! | |||
== Guidance from upstream == | == Guidance from upstream == | ||
Line 19: | Line 27: | ||
== Deprecated symbols == | == Deprecated symbols == | ||
There are a few macros that can be defined during compilation to protect us against usage of deprecated GTK+ 3 symbols, by doing something like: | |||
<pre>make -k CPPFLAGS+="-DMACRO"</pre> | |||
where "<nowiki>MACRO</nowiki>" should be replaced by a macro from the following list: | |||
* GTK_DISABLE_DEPRECATED - prevent usage of deprecated GTK+ symbols | |||
* GDK_DISABLE_DEPRECATED - prevent usage of deprecated GDK symbols | |||
* GTKMM_DISABLE_DEPRECATED - prevent usage of deprecated Gtkmm symbols | |||
* GDKMM_DISABLE_DEPRECATED - prevent usage of deprecated Gtkmm symbols | |||
< | |||
* | |||
In addition to this, several deprecated symbols (in a number of libraries) have been tagged with the "deprecated" attribute in their C/C++ declarations. Most compilers will therefore warn you at compile time if the symbol is in use. To turn these warnings into errors, you can do something like: | |||
<pre>make -k CPPFLAGS+="-Werror=deprecated-declarations"</pre> | |||
In all the above cases, the "-k" flag is used to tell make to keep processing after errors have been found. This lets us generate a complete "todo" list of errors in the code rather than just seeing the first. |
Revision as of 16:41, 16 December 2012
Inkscape currently makes use of the GTK+ 2.20 library API. Ultimately, we will need to switch to the new GTK+ 3 API. This version of the library introduces a number of major changes that are incompatible with GTK, so we need to make some changes to Inkscape.
Building Inkscape against GTK+ 3
First, configure Inkscape to build against GTK+ 3 using configure --enable-gtk3-experimental
. I prefer to use a separate subfolder for these experimental builds.
# Create a subfolder in the source directory for the experimental builds mkdir build-gtk3 cd build-gtk3 # Configure to use GTK+ 3 ../configure --enable-gtk3-experimental
After this, you can build as usual.
Current status
Inkscape builds successfully against GTK+ 3, but the resulting program is unstable and isn't recommended for users yet. A few key issues are as follows:
- Several significant bugs affect the GTK+ 3 builds. Please see the list of known bugs, and please report any more that you find!
- The Gtk+ 3 builds introduce a number of dependencies, including version 3.3.4 of the GDL dockable-dialog library (Gtk+ 2 builds use an internal copy of the library). Most linux distributions now provide this. We're tracking the dependencies... keep an eye on the list.
- There is currently no easy way of building against Gtk+ 3 on Windows. However, there is work in progress.
- Gtk+ 3 is still evolving. To avoid being affected by the level of pain we experienced with the Gtk+ 2 -> Gtk+ 3 migration, we should aim to stay as up-to-date with our API usage as possible... i.e., eliminate #deprecated symbols as soon as possible!
Guidance from upstream
The GTK+ 3 reference manual offers some guidance for the upgrade process.
Deprecated symbols
There are a few macros that can be defined during compilation to protect us against usage of deprecated GTK+ 3 symbols, by doing something like:
make -k CPPFLAGS+="-DMACRO"
where "MACRO" should be replaced by a macro from the following list:
- GTK_DISABLE_DEPRECATED - prevent usage of deprecated GTK+ symbols
- GDK_DISABLE_DEPRECATED - prevent usage of deprecated GDK symbols
- GTKMM_DISABLE_DEPRECATED - prevent usage of deprecated Gtkmm symbols
- GDKMM_DISABLE_DEPRECATED - prevent usage of deprecated Gtkmm symbols
In addition to this, several deprecated symbols (in a number of libraries) have been tagged with the "deprecated" attribute in their C/C++ declarations. Most compilers will therefore warn you at compile time if the symbol is in use. To turn these warnings into errors, you can do something like:
make -k CPPFLAGS+="-Werror=deprecated-declarations"
In all the above cases, the "-k" flag is used to tell make to keep processing after errors have been found. This lets us generate a complete "todo" list of errors in the code rather than just seeing the first.