2017-10-24 12:39:54 +01:00
|
|
|
{ qtModule, qtCompatVersion,
|
|
|
|
qtdeclarative, qtquickcontrols, qtlocation, qtwebchannel
|
2017-06-17 17:26:19 +01:00
|
|
|
|
|
|
|
, bison, coreutils, flex, git, gperf, ninja, pkgconfig, python2, which
|
|
|
|
|
2018-03-13 10:16:03 +00:00
|
|
|
, xorg, libXcursor, libXScrnSaver, libXrandr, libXtst
|
2018-03-18 16:28:14 +00:00
|
|
|
, fontconfig, freetype, harfbuzz, icu, dbus, libdrm
|
2017-06-17 17:26:19 +01:00
|
|
|
, zlib, minizip, libjpeg, libpng, libtiff, libwebp, libopus
|
|
|
|
, jsoncpp, protobuf, libvpx, srtp, snappy, nss, libevent
|
|
|
|
, alsaLib
|
|
|
|
, libcap
|
|
|
|
, pciutils
|
|
|
|
, systemd
|
|
|
|
, enableProprietaryCodecs ? true
|
2019-01-12 14:28:11 +00:00
|
|
|
, gn
|
|
|
|
, cups, darwin, openbsm, runCommand, xcbuild
|
2018-08-15 17:38:47 +01:00
|
|
|
, ffmpeg ? null
|
2018-12-22 11:49:41 +00:00
|
|
|
, lib, stdenv
|
2017-06-17 17:26:19 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
2017-10-24 12:39:54 +01:00
|
|
|
let qt56 = qtCompatVersion == "5.6"; in
|
|
|
|
|
|
|
|
qtModule {
|
2017-06-17 17:26:19 +01:00
|
|
|
name = "qtwebengine";
|
2017-10-24 12:39:54 +01:00
|
|
|
qtInputs = [ qtdeclarative qtquickcontrols qtlocation qtwebchannel ];
|
2017-06-17 17:26:19 +01:00
|
|
|
nativeBuildInputs = [
|
2018-04-25 05:18:35 +01:00
|
|
|
bison coreutils flex git gperf ninja pkgconfig python2 which gn
|
2019-01-12 14:28:11 +00:00
|
|
|
] ++ optional stdenv.isDarwin xcbuild;
|
2017-06-17 17:26:19 +01:00
|
|
|
doCheck = true;
|
2017-09-27 01:00:23 +01:00
|
|
|
outputs = [ "bin" "dev" "out" ];
|
2017-06-17 17:26:19 +01:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2018-05-25 21:22:47 +01:00
|
|
|
# ninja builds some components with -Wno-format,
|
|
|
|
# which cannot be set at the same time as -Wformat-security
|
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
|
2017-06-17 17:26:19 +01:00
|
|
|
postPatch =
|
|
|
|
# Patch Chromium build tools
|
|
|
|
''
|
|
|
|
( cd src/3rdparty/chromium; patchShebangs . )
|
|
|
|
''
|
|
|
|
# Patch Chromium build files
|
2019-01-28 00:01:17 +00:00
|
|
|
+ optionalString (lib.versionOlder qtCompatVersion "5.12") ''
|
2018-12-14 07:41:46 +00:00
|
|
|
substituteInPlace ./src/3rdparty/chromium/build/common.gypi --replace /bin/echo ${coreutils}/bin/echo
|
2017-10-24 12:39:54 +01:00
|
|
|
substituteInPlace ./src/3rdparty/chromium/v8/${if qt56 then "build" else "gypfiles"}/toolchain.gypi \
|
2017-06-17 17:26:19 +01:00
|
|
|
--replace /bin/echo ${coreutils}/bin/echo
|
2017-10-24 12:39:54 +01:00
|
|
|
substituteInPlace ./src/3rdparty/chromium/v8/${if qt56 then "build" else "gypfiles"}/standalone.gypi \
|
2017-06-17 17:26:19 +01:00
|
|
|
--replace /bin/echo ${coreutils}/bin/echo
|
|
|
|
''
|
|
|
|
# Patch library paths in Qt sources
|
|
|
|
+ ''
|
|
|
|
sed -i \
|
|
|
|
-e "s,QLibraryInfo::location(QLibraryInfo::DataPath),QLatin1String(\"$out\"),g" \
|
|
|
|
-e "s,QLibraryInfo::location(QLibraryInfo::TranslationsPath),QLatin1String(\"$out/translations\"),g" \
|
|
|
|
-e "s,QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath),QLatin1String(\"$out/libexec\"),g" \
|
|
|
|
src/core/web_engine_library_info.cpp
|
|
|
|
''
|
|
|
|
# Patch library paths in Chromium sources
|
|
|
|
+ optionalString (!stdenv.isDarwin) ''
|
|
|
|
sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${systemd.lib}/lib/\1!' \
|
|
|
|
src/3rdparty/chromium/device/udev_linux/udev?_loader.cc
|
|
|
|
|
|
|
|
sed -i -e '/libpci_loader.*Load/s!"\(libpci\.so\)!"${pciutils}/lib/\1!' \
|
|
|
|
src/3rdparty/chromium/gpu/config/gpu_info_collector_linux.cc
|
2018-04-25 05:18:35 +01:00
|
|
|
''
|
2019-01-12 14:28:11 +00:00
|
|
|
+ optionalString stdenv.isDarwin (''
|
2018-04-25 05:18:35 +01:00
|
|
|
substituteInPlace src/core/config/mac_osx.pri \
|
2019-02-26 22:36:17 +00:00
|
|
|
--replace /usr ${stdenv.cc}
|
2019-01-12 14:28:11 +00:00
|
|
|
''
|
2019-02-26 22:46:40 +00:00
|
|
|
+ (optionalString (lib.versionAtLeast qtCompatVersion "5.11") ''
|
|
|
|
substituteInPlace src/3rdparty/chromium/third_party/crashpad/crashpad/util/BUILD.gn \
|
|
|
|
--replace '$sysroot/usr' "${darwin.xnu}"
|
|
|
|
'')
|
2019-01-12 14:28:11 +00:00
|
|
|
+ ''
|
2018-04-25 05:18:35 +01:00
|
|
|
|
|
|
|
cat <<EOF > src/3rdparty/chromium/build/mac/find_sdk.py
|
|
|
|
#!/usr/bin/env python
|
2019-01-12 14:28:11 +00:00
|
|
|
print("${darwin.apple_sdk.sdk}")
|
2018-04-25 05:18:35 +01:00
|
|
|
print("10.10.0")
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat <<EOF > src/3rdparty/chromium/build/config/mac/sdk_info.py
|
|
|
|
#!/usr/bin/env python
|
2019-01-12 14:28:11 +00:00
|
|
|
print('xcode_version="0910"')
|
|
|
|
print('xcode_version_int=910')
|
2018-04-25 05:18:35 +01:00
|
|
|
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]"
|
2017-06-17 17:26:19 +01:00
|
|
|
|
2019-01-12 14:28:11 +00:00
|
|
|
substituteInPlace src/3rdparty/chromium/sandbox/mac/BUILD.gn \
|
|
|
|
--replace 'libs = [ "sandbox" ]' 'libs = [ "/usr/lib/libsandbox.1.dylib" ]'
|
|
|
|
'');
|
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE =
|
|
|
|
lib.optionalString 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"
|
|
|
|
|
|
|
|
#
|
|
|
|
# Prevent errors like
|
|
|
|
# /nix/store/xxx-apple-framework-CoreData/Library/Frameworks/CoreData.framework/Headers/NSEntityDescription.h:51:7:
|
|
|
|
# error: pointer to non-const type 'id' with no explicit ownership
|
|
|
|
# id** _kvcPropertyAccessors;
|
|
|
|
#
|
|
|
|
# TODO remove when new Apple SDK is in
|
|
|
|
#
|
|
|
|
"-fno-objc-arc"
|
|
|
|
];
|
2018-03-26 20:31:11 +01:00
|
|
|
|
2017-06-17 17:26:19 +01:00
|
|
|
preConfigure = ''
|
2018-03-26 20:31:11 +01:00
|
|
|
export NINJAFLAGS=-j$NIX_BUILD_CORES
|
2017-10-24 12:39:54 +01:00
|
|
|
|
|
|
|
if [ -d "$PWD/tools/qmake" ]; then
|
|
|
|
QMAKEPATH="$PWD/tools/qmake''${QMAKEPATH:+:}$QMAKEPATH"
|
|
|
|
fi
|
2018-04-25 05:18:35 +01:00
|
|
|
'';
|
2017-06-17 17:26:19 +01:00
|
|
|
|
2018-08-15 17:38:47 +01:00
|
|
|
qmakeFlags = if stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64
|
|
|
|
then [ "--" "-system-ffmpeg" ] ++ optional enableProprietaryCodecs "-proprietary-codecs"
|
|
|
|
else optional enableProprietaryCodecs "-- -proprietary-codecs";
|
2017-06-17 17:26:19 +01:00
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
# Image formats
|
|
|
|
libjpeg libpng libtiff libwebp
|
|
|
|
|
|
|
|
# Video formats
|
|
|
|
srtp libvpx
|
|
|
|
|
|
|
|
# Audio formats
|
|
|
|
libopus
|
|
|
|
|
|
|
|
# Text rendering
|
|
|
|
harfbuzz icu
|
2018-04-25 05:18:35 +01:00
|
|
|
|
|
|
|
libevent
|
2018-08-26 12:04:05 +01:00
|
|
|
] ++ optionals (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [
|
2018-08-15 17:38:47 +01:00
|
|
|
ffmpeg
|
2018-04-25 05:18:35 +01:00
|
|
|
] ++ optionals (!stdenv.isDarwin) [
|
|
|
|
dbus zlib minizip snappy nss protobuf jsoncpp
|
2017-06-17 17:26:19 +01:00
|
|
|
|
|
|
|
# Audio formats
|
|
|
|
alsaLib
|
|
|
|
|
|
|
|
# Text rendering
|
|
|
|
fontconfig freetype
|
|
|
|
|
|
|
|
libcap
|
|
|
|
pciutils
|
|
|
|
|
|
|
|
# X11 libs
|
2018-03-13 10:16:03 +00:00
|
|
|
xorg.xrandr libXScrnSaver libXcursor libXrandr xorg.libpciaccess libXtst
|
2018-03-18 16:28:14 +00:00
|
|
|
xorg.libXcomposite xorg.libXdamage libdrm
|
2018-04-25 05:18:35 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
# FIXME These dependencies shouldn't be needed but can't find a way
|
|
|
|
# around it. Chromium pulls this in while bootstrapping GN.
|
|
|
|
++ lib.optionals stdenv.isDarwin (with darwin; with apple_sdk.frameworks; [
|
|
|
|
libobjc
|
|
|
|
cctools
|
|
|
|
|
|
|
|
# frameworks
|
|
|
|
ApplicationServices
|
2019-01-12 14:28:11 +00:00
|
|
|
AVFoundation
|
2018-04-25 05:18:35 +01:00
|
|
|
Foundation
|
2019-01-12 14:28:11 +00:00
|
|
|
ForceFeedback
|
|
|
|
GameController
|
2018-04-25 05:18:35 +01:00
|
|
|
AppKit
|
|
|
|
ImageCaptureCore
|
|
|
|
CoreBluetooth
|
|
|
|
IOBluetooth
|
|
|
|
CoreWLAN
|
|
|
|
Quartz
|
|
|
|
Cocoa
|
|
|
|
|
|
|
|
openbsm
|
|
|
|
libunwind
|
|
|
|
]);
|
2017-08-27 18:42:21 +01:00
|
|
|
|
2019-01-12 14:28:11 +00:00
|
|
|
buildInputs = optionals stdenv.isDarwin (with darwin; [
|
2019-01-20 19:57:59 +00:00
|
|
|
cups
|
|
|
|
|
2019-01-12 14:28:11 +00:00
|
|
|
# For sandbox.h include
|
|
|
|
(runCommand "MacOS_SDK_sandbox.h" {} ''
|
|
|
|
install -Dm444 "${lib.getDev darwin.apple_sdk.sdk}"/include/sandbox.h "$out"/include/sandbox.h
|
|
|
|
'')
|
|
|
|
|
|
|
|
# For:
|
|
|
|
# _NSDefaultRunLoopMode
|
|
|
|
# _OBJC_CLASS_$_NSDate
|
|
|
|
# _OBJC_CLASS_$_NSDictionary
|
|
|
|
# _OBJC_CLASS_$_NSRunLoop
|
|
|
|
# _OBJC_CLASS_$_NSURL
|
|
|
|
darwin.cf-private
|
|
|
|
]);
|
|
|
|
|
|
|
|
__impureHostDeps = optional stdenv.isDarwin "/usr/lib/libsandbox.1.dylib";
|
|
|
|
|
2017-08-27 18:42:21 +01:00
|
|
|
dontUseNinjaBuild = true;
|
|
|
|
dontUseNinjaInstall = true;
|
2019-01-12 14:28:11 +00:00
|
|
|
dontUseXcbuild = true;
|
2017-08-27 18:42:21 +01:00
|
|
|
|
2018-04-25 05:18:35 +01:00
|
|
|
postInstall = lib.optionalString stdenv.isLinux ''
|
2017-06-17 17:26:19 +01:00
|
|
|
cat > $out/libexec/qt.conf <<EOF
|
|
|
|
[Paths]
|
|
|
|
Prefix = ..
|
|
|
|
EOF
|
|
|
|
'';
|
2018-04-25 05:18:35 +01:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A web engine based on the Chromium web browser";
|
|
|
|
maintainers = with maintainers; [ matthewbauer ];
|
|
|
|
platforms = platforms.unix;
|
2018-09-13 11:28:18 +01:00
|
|
|
broken = qt56; # 2018-09-13, no successful build since 2018-04-25
|
2018-04-25 05:18:35 +01:00
|
|
|
};
|
|
|
|
|
2017-06-17 17:26:19 +01:00
|
|
|
}
|