From 6c9ba16e114d996f75f564c2c4aceca0d105f304 Mon Sep 17 00:00:00 2001 From: Jehan Date: Fri, 18 May 2018 09:08:51 +0200 Subject: [PATCH] configure, libgimpwidgets: customizable default color profile directory We have this problem with flatpak that the common directory ("/usr/share/color/icc") is not visible from inside the sandbox. With proper permissions, it is actually accessible, yet the host's /usr is mounted at /run/host/usr/. Since sandbox systems are getting more common, we need to make this path customizable. I am therefore adding a --with-icc-directory configure option to change the default color profile folder at build time. See: https://github.com/flathub/org.gimp.GIMP/issues/15 --- configure.ac | 27 ++++++++++++++++++- .../gimpcolorprofilechooserdialog.c | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 96010b7d6c..62909dbed2 100644 --- a/configure.ac +++ b/configure.ac @@ -2320,7 +2320,7 @@ AM_CONDITIONAL(HAVE_DESKTOP_FILE_VALIDATE, test "x$DESKTOP_FILE_VALIDATE" != "xn # order to filter first packaging bugs from core bugs. AC_ARG_WITH(bug-report-url, - [ --with-bug-report-url URL used by the debug dialog to report bugs],, + [ --with-bug-report-url URL used by the debug dialog to report bugs],, [with_bug_report_url="$PACKAGE_BUGREPORT"]) if test "x$with_bug_report_url" = "x"; then @@ -2341,6 +2341,30 @@ NOTE: if you plan on packaging GIMP for distribution, it is recommended " fi +######################### +# Default ICC directory # +######################### + +# This is necessary because some Unix systems may have a different +# standard path for color profiles. And in particular, sandbox builds +# might mount the host system at a different root. This is for +# instance the case of flatpak which mount the host root at /run/host/. +if test "x$platform_osx" = "xno" && + test "x$platform_win32" = "xno"; then + AC_MSG_CHECKING([default directory for color profiles]) + AC_ARG_WITH(icc-directory, + [ --with-icc-directory Path to default color profiles for this system],, + [with_icc_directory="/usr/share/color/icc"]) + + if test "x$with_icc_directory" = "x"; then + with_icc_directory="/usr/share/color/icc" + fi + + AC_DEFINE_UNQUOTED(COLOR_PROFILE_DIRECTORY, + "$with_icc_directory", + [The path to default color profiles for this system]) +fi + ###################################### # Checks for gtk-doc and docbook-tools ###################################### @@ -2827,6 +2851,7 @@ Optional Features: Vector icons: $enable_vector_icons Dr. Mingw (Win32): $enable_drmingw Bundled MyPaint Brushes: $enable_bundled_mypaint_brushes (at $mypaint_brushes_dir) + Default ICC directory: $with_icc_directory Optional Plug-Ins: Ascii Art: $have_libaa diff --git a/libgimpwidgets/gimpcolorprofilechooserdialog.c b/libgimpwidgets/gimpcolorprofilechooserdialog.c index 5bedbbd491..a6795b8b4b 100644 --- a/libgimpwidgets/gimpcolorprofilechooserdialog.c +++ b/libgimpwidgets/gimpcolorprofilechooserdialog.c @@ -295,7 +295,7 @@ gimp_color_profile_chooser_dialog_add_shortcut (GimpColorProfileChooserDialog *d } if (! folder_set) - add_shortcut (dialog, "/usr/share/color/icc"); + add_shortcut (dialog, COLOR_PROFILE_DIRECTORY); } #endif }