Title: [242724] trunk
Revision
242724
Author
[email protected]
Date
2019-03-11 12:11:09 -0700 (Mon, 11 Mar 2019)

Log Message

[CMake] Build 32bit binaries on Linux/64bit when the --32-bit is passed to build-jsc
https://bugs.webkit.org/show_bug.cgi?id=194147

Patch by Xan Lopez <[email protected]> on 2019-03-11
Reviewed by Michael Saboff.

.:

* CMakeLists.txt: set WTF_CPU properly if FORCE_32BIT is set in
build-jsc.

Tools:

To make --32-bit work correctly on Linux/64bit we need to:

- Set FORCE_32BIT on, which will be read by CMake to set WTF_CPU
correctly. Ideally we'd just redefine CMAKE_SYSTEM_PROCESSOR, but
unfortunately CMake only allows us to do this during
crosscompilation, which is overkill here.
- Set CMAKE_PREFIX_PATH and CMAKE_LIBRARY_ARCHITECTURE so that the
pkg-config detection module uses the x86 .pc files instead of the
x86_64 ones.
- Set the -m32 flags for the compiler.

* Scripts/webkitdirs.pm:
(generateBuildSystemFromCMakeProject):

Modified Paths

Diff

Modified: trunk/CMakeLists.txt (242723 => 242724)


--- trunk/CMakeLists.txt	2019-03-11 19:07:38 UTC (rev 242723)
+++ trunk/CMakeLists.txt	2019-03-11 19:11:09 UTC (rev 242724)
@@ -93,7 +93,15 @@
 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
     set(WTF_CPU_MIPS 1)
 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x64|x86_64|amd64)")
-    set(WTF_CPU_X86_64 1)
+    # FORCE_32BIT is set in the build script when --32-bit is passed
+    # on a Linux/intel 64bit host. This allows us to produce 32bit
+    # binaries without setting the build up as a crosscompilation,
+    # which is the only way to modify CMAKE_SYSTEM_PROCESSOR.
+    if (FORCE_32BIT)
+        set(WTF_CPU X86 1)
+    else ()
+        set(WTF_CPU_X86_64 1)
+    endif ()
 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
     set(WTF_CPU_X86 1)
 elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc")

Modified: trunk/ChangeLog (242723 => 242724)


--- trunk/ChangeLog	2019-03-11 19:07:38 UTC (rev 242723)
+++ trunk/ChangeLog	2019-03-11 19:11:09 UTC (rev 242724)
@@ -1,3 +1,13 @@
+2019-03-11  Xan Lopez  <[email protected]>
+
+        [CMake] Build 32bit binaries on Linux/64bit when the --32-bit is passed to build-jsc
+        https://bugs.webkit.org/show_bug.cgi?id=194147
+
+        Reviewed by Michael Saboff.
+
+        * CMakeLists.txt: set WTF_CPU properly if FORCE_32BIT is set in
+        build-jsc.
+
 2019-03-11  Michael Catanzaro  <[email protected]>
 
         [WPE] Enable web process sandbox

Modified: trunk/Tools/ChangeLog (242723 => 242724)


--- trunk/Tools/ChangeLog	2019-03-11 19:07:38 UTC (rev 242723)
+++ trunk/Tools/ChangeLog	2019-03-11 19:11:09 UTC (rev 242724)
@@ -1,3 +1,24 @@
+2019-03-11  Xan Lopez  <[email protected]>
+
+        [CMake] Build 32bit binaries on Linux/64bit when the --32-bit is passed to build-jsc
+        https://bugs.webkit.org/show_bug.cgi?id=194147
+
+        Reviewed by Michael Saboff.
+
+        To make --32-bit work correctly on Linux/64bit we need to:
+
+        - Set FORCE_32BIT on, which will be read by CMake to set WTF_CPU
+        correctly. Ideally we'd just redefine CMAKE_SYSTEM_PROCESSOR, but
+        unfortunately CMake only allows us to do this during
+        crosscompilation, which is overkill here.
+        - Set CMAKE_PREFIX_PATH and CMAKE_LIBRARY_ARCHITECTURE so that the
+        pkg-config detection module uses the x86 .pc files instead of the
+        x86_64 ones.
+        - Set the -m32 flags for the compiler.
+
+        * Scripts/webkitdirs.pm:
+        (generateBuildSystemFromCMakeProject):
+
 2019-03-08  Dewei Zhu  <[email protected]>
 
         Add MotionMark-1.1 plan file for run-benchmark script.

Modified: trunk/Tools/Scripts/webkitdirs.pm (242723 => 242724)


--- trunk/Tools/Scripts/webkitdirs.pm	2019-03-11 19:07:38 UTC (rev 242723)
+++ trunk/Tools/Scripts/webkitdirs.pm	2019-03-11 19:11:09 UTC (rev 242724)
@@ -2262,6 +2262,15 @@
     # Some ports have production mode, but build-webkit should always use developer mode.
     push @args, "-DDEVELOPER_MODE=ON" if isGtk() || isJSCOnly() || isWPE() || isWinCairo();
 
+    if ($architecture eq "x86_64" && shouldBuild32Bit()) {
+        # CMAKE_LIBRARY_ARCHITECTURE is needed to get the right .pc
+        # files in Debian-based systems, for the others
+        # CMAKE_PREFIX_PATH will get us /usr/lib, which should be the
+        # right path for 32bit. See FindPkgConfig.cmake.
+        push @cmakeArgs, '-DFORCE_32BIT=ON -DCMAKE_PREFIX_PATH="/usr" -DCMAKE_LIBRARY_ARCHITECTURE=x86';
+        $ENV{"CFLAGS"} =  "-m32" . ($ENV{"CFLAGS"} || "");
+        $ENV{"CXXFLAGS"} = "-m32" . ($ENV{"CXXFLAGS"} || "");
+    }
     push @args, @cmakeArgs if @cmakeArgs;
 
     my $cmakeSourceDir = isCygwin() ? windowsSourceDir() : sourceDir();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to