Changeset 242724 in webkit


Ignore:
Timestamp:
Mar 11, 2019 12:11:09 PM (5 years ago)
Author:
commit-queue@webkit.org
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 <Xan Lopez> 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):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/CMakeLists.txt

    r239378 r242724  
    9494    set(WTF_CPU_MIPS 1)
    9595elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x64|x86_64|amd64)")
    96     set(WTF_CPU_X86_64 1)
     96    # FORCE_32BIT is set in the build script when --32-bit is passed
     97    # on a Linux/intel 64bit host. This allows us to produce 32bit
     98    # binaries without setting the build up as a crosscompilation,
     99    # which is the only way to modify CMAKE_SYSTEM_PROCESSOR.
     100    if (FORCE_32BIT)
     101        set(WTF_CPU X86 1)
     102    else ()
     103        set(WTF_CPU_X86_64 1)
     104    endif ()
    97105elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
    98106    set(WTF_CPU_X86 1)
  • trunk/ChangeLog

    r242709 r242724  
     12019-03-11  Xan Lopez  <xan@igalia.com>
     2
     3        [CMake] Build 32bit binaries on Linux/64bit when the --32-bit is passed to build-jsc
     4        https://bugs.webkit.org/show_bug.cgi?id=194147
     5
     6        Reviewed by Michael Saboff.
     7
     8        * CMakeLists.txt: set WTF_CPU properly if FORCE_32BIT is set in
     9        build-jsc.
     10
    1112019-03-11  Michael Catanzaro  <mcatanzaro@igalia.com>
    212
  • trunk/Tools/ChangeLog

    r242721 r242724  
     12019-03-11  Xan Lopez  <xan@igalia.com>
     2
     3        [CMake] Build 32bit binaries on Linux/64bit when the --32-bit is passed to build-jsc
     4        https://bugs.webkit.org/show_bug.cgi?id=194147
     5
     6        Reviewed by Michael Saboff.
     7
     8        To make --32-bit work correctly on Linux/64bit we need to:
     9
     10        - Set FORCE_32BIT on, which will be read by CMake to set WTF_CPU
     11        correctly. Ideally we'd just redefine CMAKE_SYSTEM_PROCESSOR, but
     12        unfortunately CMake only allows us to do this during
     13        crosscompilation, which is overkill here.
     14        - Set CMAKE_PREFIX_PATH and CMAKE_LIBRARY_ARCHITECTURE so that the
     15        pkg-config detection module uses the x86 .pc files instead of the
     16        x86_64 ones.
     17        - Set the -m32 flags for the compiler.
     18
     19        * Scripts/webkitdirs.pm:
     20        (generateBuildSystemFromCMakeProject):
     21
    1222019-03-08  Dewei Zhu  <dewei_zhu@apple.com>
    223
  • trunk/Tools/Scripts/webkitdirs.pm

    r241786 r242724  
    22632263    push @args, "-DDEVELOPER_MODE=ON" if isGtk() || isJSCOnly() || isWPE() || isWinCairo();
    22642264
     2265    if ($architecture eq "x86_64" && shouldBuild32Bit()) {
     2266        # CMAKE_LIBRARY_ARCHITECTURE is needed to get the right .pc
     2267        # files in Debian-based systems, for the others
     2268        # CMAKE_PREFIX_PATH will get us /usr/lib, which should be the
     2269        # right path for 32bit. See FindPkgConfig.cmake.
     2270        push @cmakeArgs, '-DFORCE_32BIT=ON -DCMAKE_PREFIX_PATH="/usr" -DCMAKE_LIBRARY_ARCHITECTURE=x86';
     2271        $ENV{"CFLAGS"} =  "-m32" . ($ENV{"CFLAGS"} || "");
     2272        $ENV{"CXXFLAGS"} = "-m32" . ($ENV{"CXXFLAGS"} || "");
     2273    }
    22652274    push @args, @cmakeArgs if @cmakeArgs;
    22662275
Note: See TracChangeset for help on using the changeset viewer.