GNOME Bugzilla – Bug 692597
patch to allow relocation on Linux, and first step to integrating cross-platform relocation
Last modified: 2018-04-15 00:34:40 UTC
Created attachment 234490 [details] [review] Patch to add/generalize relocation for GTK The attached patch against gtk-2-24 provides --enable-relocation which builds GTK so that GTK_{DATA,LIB,LOCALEDIR,SYSCONF}DIR and GTK_DATA_DIR are determined at runtime, not build time. The paths are determined relative to the location of the executable file used to exec the calling process, BUT the value may also set by defining the environment variables GTK_BUNDLEDIR or any of GTK_{DATA,LIB,LOCALEDIR,SYSCONF}DIR and GTK_DATA_DIR to override the location or provide a different packaging strategy. GTK already had code for doing this on Quartz - this has been merged into the new file gtkrelocation.c, and the old --enable-quartz-relocation has been made equivalent to --enable-relocation. Provision has been made for merging the existing Windows relocation code too, but this has not been done at this time because the Windows version behaves in a more complex fashion that I do not believe is necessary but would rather defer to those who understand why it behaves as it currently does.
Review of attachment 234490 [details] [review]: ::: gtk/gtkrelocation.c @@ +1,3 @@ +/* gtklinuxrelocation: functions used to provide relocation on Linux + * + * Copyright (C) 2013 Whomsoever Really?? _br_find_exe at least is clearly copied from BinReloc, so its author definitely should get credit here.
the "Whomsoever" was a placeholder until the full credits could be identified. several different people deserve credit here.
Review of attachment 234490 [details] [review]: I'm missing the documentation part that would explain how one is expected to use this. If we want to go for this, the implementations of _gtk_...dir shouldn't be spread across multiple files. Put it all into one file, with all the ifdeffery in one place. It seems with your patch, we have _gtk_get_...dir implementations in both gtkprivate.c and gtkrelocation.c ? ::: gtk/gtkrelocation.c @@ +71,3 @@ +static char * +_br_find_exe (gint *error) +{ This entire function has the wrong coding style.
(1) i didn't move the windows stuff in here for now, just because it was an initial pass at the overall idea. moving them in is easy, since the ones for linux and OS X are modelled on them. moving them all here would remove any relocation code from gtkprivate.c and it would all be in gtkrelocation.c. if there is serious interest in the idea, i can do another patch with everything merged into one location. (2) the br_find_exe() code comes from another project (via GIMP) and I did not reformat it. same rationale as (1), but simple to fix. (3) what form would you want the documentation in? doxygen inline? web text? i'm happy to write it up.
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
Will there ever be actual interest in making GTK+ relocatable on *nix systems?
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla. If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab: https://gitlab.gnome.org/GNOME/gtk/issues/new