Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "SWT/Devel/Gtk/pkg-config compiled GTK"
(Created page with "Sometimes it's necessary to write native GTK snippets to reproduce issues that could be bugs in GTK itself. Of course, it's also important to be able to test these snippets ac...") |
|||
Line 1: | Line 1: | ||
− | Sometimes it's necessary to write native GTK snippets to reproduce issues that could be bugs in GTK itself. Of course, it's also important to be able to test these snippets across multiple versions of GTK, specifically GTK3. As a prerequisite, please see the article about [[SWT/Devel/Gtk/Compiling_Gtk | compiling GTK.]] | + | = Using pkg-config with compiled GTK libraries = |
+ | == Getting started == | ||
+ | Sometimes it's necessary to write native GTK snippets to reproduce issues that could be bugs in GTK itself. Of course, it's also important to be able to test these snippets across multiple versions of GTK, specifically GTK3. As a prerequisite, please see the article about [[SWT/Devel/Gtk/Compiling_Gtk | compiling GTK.]] After you've compiled your version of GTK and have a .libs directory, proceed to the next step. | ||
+ | |||
+ | == Compiling GTK applications using system GTK == | ||
+ | GTK compiles its applications using information from pkg-config. pkg-config has rule files that it uses to store information about the program's needs. These files are located in: | ||
+ | /usr/lib64/pkgconfig | ||
+ | |||
+ | Compiling an ordinary GTK application using your system GTK is easy. Follow the steps here and you are done: https://developer.gnome.org/gtk3/stable/gtk-compiling.html | ||
+ | But compiling a GTK application using your "custom" compiled GTK libraries requires modification of the pkg-config rule files. | ||
+ | |||
+ | == Modifying pkg-config rule files == | ||
+ | Navigate to the following directory: | ||
+ | /usr/lib64/pkgconfig | ||
+ | |||
+ | Using sudo/elevated permissions, make a copy of the gdk-3.0.pc and gtk+-3.0.pc files. You'll want to have a backup in case something goes wrong. Next, we are going to edit them. | ||
+ | <source lang=bash> | ||
+ | prefix=/usr | ||
+ | exec_prefix=/usr | ||
+ | libdir=/home/ericwill/src/gtk_versions/current/gtk/gtk | ||
+ | includedir=/home/ericwill/src/gtk_versions/current/gtk | ||
+ | targets=x11 broadway wayland | ||
+ | |||
+ | gtk_binary_version=3.0.0 | ||
+ | gtk_host=x86_64-redhat-linux-gnu | ||
+ | |||
+ | Name: GTK+ | ||
+ | Description: GTK+ Graphical UI Library | ||
+ | Version: 3.18.2 | ||
+ | Requires: gdk-3.0 atk >= 2.15.1 cairo >= 1.14.0 cairo-gobject >= 1.14.0 gdk-pixbuf-2.0 >= 2.30.0 gio-2.0 >= 2.45.8 | ||
+ | Requires.private: atk atk-bridge-2.0 wayland-client >= 1.5.91 xkbcommon >= 0.2.0 wayland-cursor >= 1.5.91 wayland-egl epoxy >= 1.0 pangoft2 gio-unix-2.0 >= 2.45.8 | ||
+ | Libs: -L${libdir} -lgtk-3 | ||
+ | Cflags: -I${includedir} | ||
+ | </source> |
Revision as of 15:49, 30 May 2016
Contents
Using pkg-config with compiled GTK libraries
Getting started
Sometimes it's necessary to write native GTK snippets to reproduce issues that could be bugs in GTK itself. Of course, it's also important to be able to test these snippets across multiple versions of GTK, specifically GTK3. As a prerequisite, please see the article about compiling GTK. After you've compiled your version of GTK and have a .libs directory, proceed to the next step.
Compiling GTK applications using system GTK
GTK compiles its applications using information from pkg-config. pkg-config has rule files that it uses to store information about the program's needs. These files are located in:
/usr/lib64/pkgconfig
Compiling an ordinary GTK application using your system GTK is easy. Follow the steps here and you are done: https://developer.gnome.org/gtk3/stable/gtk-compiling.html But compiling a GTK application using your "custom" compiled GTK libraries requires modification of the pkg-config rule files.
Modifying pkg-config rule files
Navigate to the following directory:
/usr/lib64/pkgconfig
Using sudo/elevated permissions, make a copy of the gdk-3.0.pc and gtk+-3.0.pc files. You'll want to have a backup in case something goes wrong. Next, we are going to edit them.
prefix=/usr exec_prefix=/usr libdir=/home/ericwill/src/gtk_versions/current/gtk/gtk includedir=/home/ericwill/src/gtk_versions/current/gtk targets=x11 broadway wayland gtk_binary_version=3.0.0 gtk_host=x86_64-redhat-linux-gnu Name: GTK+ Description: GTK+ Graphical UI Library Version: 3.18.2 Requires: gdk-3.0 atk >= 2.15.1 cairo >= 1.14.0 cairo-gobject >= 1.14.0 gdk-pixbuf-2.0 >= 2.30.0 gio-2.0 >= 2.45.8 Requires.private: atk atk-bridge-2.0 wayland-client >= 1.5.91 xkbcommon >= 0.2.0 wayland-cursor >= 1.5.91 wayland-egl epoxy >= 1.0 pangoft2 gio-unix-2.0 >= 2.45.8 Libs: -L${libdir} -lgtk-3 Cflags: -I${includedir}