Bug 200124 - [WPE][GTK] build-webkit should set CMAKE_PREFIX_PATH and CMAKE_LIBRARY_PATH properly
Summary: [WPE][GTK] build-webkit should set CMAKE_PREFIX_PATH and CMAKE_LIBRARY_PATH p...
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2019-07-25 07:33 PDT by Michael Catanzaro
Modified: 2019-07-25 09:36 PDT (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2019-07-25 07:33:30 PDT
Continuing discussion from bug #197934, build-webkit needs to set CMAKE_PREFIX_PATH and CMAKE_LIBRARY_PATH. r165452 attempted to do this, but I think it didn't work because these are not environment variables.
Comment 1 Michael Catanzaro 2019-07-25 07:34:30 PDT
Also: thanks Fujii, Don, and Charlie for discussion and help.
Comment 2 Michael Catanzaro 2019-07-25 07:56:39 PDT
I tried this little patch:

diff --git a/Tools/Scripts/webkitdirs.pm b/Tools/Scripts/webkitdirs.pm
index 1374b4b3f2d..dc5be704897 100755
--- a/Tools/Scripts/webkitdirs.pm
+++ b/Tools/Scripts/webkitdirs.pm
@@ -2220,6 +2220,11 @@ sub generateBuildSystemFromCMakeProject
     my @args;
     push @args, "-DPORT=\"$port\"";
     push @args, "-DCMAKE_INSTALL_PREFIX=\"$prefixPath\"" if $prefixPath;
+    if (shouldUseJhbuild()) {
+        my $jhbuildPath = getJhbuildPath();
+        push @args, "-DCMAKE_PREFIX_PATH=\"$jhbuildPath\"";
+        push @args, "-DCMAKE_LIBRARY_PATH=\"$jhbuildPath/lib\"";
+    }
     if ($config =~ /release/i) {
         push @args, "-DCMAKE_BUILD_TYPE=Release";
diff --git a/Tools/jhbuild/jhbuildrc_common.py b/Tools/jhbuild/jhbuildrc_common.py
index 61dfa7ec48e..dafd277623f 100644
--- a/Tools/jhbuild/jhbuildrc_common.py
+++ b/Tools/jhbuild/jhbuildrc_common.py
@@ -78,10 +78,6 @@ def init(jhbuildrc_globals, jhbuild_platform):
         addpath('PKG_CONFIG_PATH', os.path.join(libdir, 'pkgconfig'))
     addpath('PKG_CONFIG_PATH', os.path.join(os.sep, 'usr', 'share', 'pkgconfig'))
-    prefix = jhbuildrc_globals['prefix']
-    addpath('CMAKE_PREFIX_PATH', prefix)
-    addpath('CMAKE_LIBRARY_PATH', os.path.join(prefix, 'lib'))
     if 'JHBUILD_MIRROR' in os.environ:
         jhbuildrc_globals['dvcs_mirror_dir'] = os.environ['JHBUILD_MIRROR']
         jhbuildrc_globals['tarballdir'] = os.environ['JHBUILD_MIRROR']

But it's not enough, see my comment in bug #197934. We might want to do this anyway, but it won't fix the present issue.
Comment 3 Michael Catanzaro 2019-07-25 08:15:04 PDT
This bug is invalid. From https://cmake.org/cmake/help/latest/command/find_library.html, we see:

Search paths specified in cmake-specific environment variables. These are intended to be set in the user’s shell configuration, and therefore use the host’s native path separator (; on Windows and : on UNIX). This can be skipped if NO_CMAKE_ENVIRONMENT_PATH is passed.
<prefix>/lib/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and <prefix>/lib for each <prefix> in CMAKE_PREFIX_PATH

i.e. they should be respected as environment variables. Closing.