qtwebengine: fix build for darwin
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
, systemd
|
||||
, enableProprietaryCodecs ? true
|
||||
, gn
|
||||
, cups, darwin, openbsm, runCommand, xcbuild
|
||||
, cups, darwin, openbsm, runCommand, xcbuild, writeScriptBin
|
||||
, ffmpeg_3 ? null
|
||||
, lib, stdenv
|
||||
}:
|
||||
@@ -51,6 +51,13 @@ qtModule {
|
||||
substituteInPlace ./src/3rdparty/chromium/v8/gypfiles/standalone.gypi \
|
||||
--replace /bin/echo ${coreutils}/bin/echo
|
||||
''
|
||||
# Prevent Chromium build script from making the path to `clang` relative to
|
||||
# the build directory. `clang_base_path` is the value of `QMAKE_CLANG_DIR`
|
||||
# from `src/core/config/mac_osx.pri`.
|
||||
+ optionalString stdenv.isDarwin ''
|
||||
substituteInPlace ./src/3rdparty/chromium/build/toolchain/mac/BUILD.gn \
|
||||
--replace 'prefix = rebase_path("$clang_base_path/bin/", root_build_dir)' 'prefix = "$clang_base_path/bin/"'
|
||||
''
|
||||
# Patch library paths in Qt sources
|
||||
+ ''
|
||||
sed -i \
|
||||
@@ -69,32 +76,15 @@ qtModule {
|
||||
''
|
||||
+ optionalString stdenv.isDarwin (''
|
||||
substituteInPlace src/core/config/mac_osx.pri \
|
||||
--replace /usr ${stdenv.cc}
|
||||
--replace 'QMAKE_CLANG_DIR = "/usr"' 'QMAKE_CLANG_DIR = "${stdenv.cc}"'
|
||||
''
|
||||
# Following is required to prevent a build error:
|
||||
# ninja: error: '/nix/store/z8z04p0ph48w22rqzx7ql67gy8cyvidi-SDKs/MacOSX10.12.sdk/usr/include/mach/exc.defs', needed by 'gen/third_party/crashpad/crashpad/util/mach/excUser.c', missing and no known rule to make it
|
||||
+ (optionalString (lib.versionAtLeast qtCompatVersion "5.11") ''
|
||||
substituteInPlace src/3rdparty/chromium/third_party/crashpad/crashpad/util/BUILD.gn \
|
||||
--replace '$sysroot/usr' "${darwin.xnu}"
|
||||
'')
|
||||
+ ''
|
||||
|
||||
cat <<EOF > src/3rdparty/chromium/build/mac/find_sdk.py
|
||||
#!/usr/bin/env python
|
||||
print("${darwin.apple_sdk.sdk}")
|
||||
print("10.12.0")
|
||||
EOF
|
||||
|
||||
cat <<EOF > src/3rdparty/chromium/build/config/mac/sdk_info.py
|
||||
#!/usr/bin/env python
|
||||
print('xcode_version="0910"')
|
||||
print('xcode_version_int=910')
|
||||
print('xcode_build="9B55"')
|
||||
print('machine_os_build="17E199"')
|
||||
print('sdk_path=""')
|
||||
print('sdk_version="10.10"')
|
||||
print('sdk_platform_path=""')
|
||||
print('sdk_build="17B41"')
|
||||
EOF
|
||||
|
||||
# Apple has some secret stuff they don't share with OpenBSM
|
||||
substituteInPlace src/3rdparty/chromium/base/mac/mach_port_broker.mm \
|
||||
--replace "audit_token_to_pid(msg.trailer.msgh_audit)" "msg.trailer.msgh_audit.val[5]"
|
||||
@@ -111,8 +101,8 @@ EOF
|
||||
# TODO: investigate and fix properly
|
||||
"-march=westmere"
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
"-DMAC_OS_X_VERSION_MAX_ALLOWED=MAC_OS_X_VERSION_10_10"
|
||||
"-DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_10"
|
||||
"-DMAC_OS_X_VERSION_MAX_ALLOWED=MAC_OS_X_VERSION_10_12"
|
||||
"-DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_12"
|
||||
|
||||
#
|
||||
# Prevent errors like
|
||||
@@ -189,6 +179,7 @@ EOF
|
||||
CoreWLAN
|
||||
Quartz
|
||||
Cocoa
|
||||
LocalAuthentication
|
||||
|
||||
openbsm
|
||||
libunwind
|
||||
@@ -197,6 +188,21 @@ EOF
|
||||
buildInputs = optionals stdenv.isDarwin (with darwin; [
|
||||
cups
|
||||
|
||||
# `sw_vers` is used by `src/3rdparty/chromium/build/config/mac/sdk_info.py`
|
||||
# to get some information about the host platform.
|
||||
(writeScriptBin "sw_vers" ''
|
||||
#!${stdenv.shell}
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-buildVersion) echo "17E199";;
|
||||
*) break ;;
|
||||
|
||||
esac
|
||||
shift
|
||||
done
|
||||
'')
|
||||
|
||||
# For sandbox.h include
|
||||
(runCommand "MacOS_SDK_sandbox.h" {} ''
|
||||
install -Dm444 "${lib.getDev darwin.apple_sdk.sdk}"/include/sandbox.h "$out"/include/sandbox.h
|
||||
|
||||
Reference in New Issue
Block a user