Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qutebrowser: enable cross compilation #230171

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9fa4c9a
qt5: use makeScopeWithSplicing
Artturin Mar 9, 2023
ad4c604
qt5.wrapQtAppsHook: move libs to depsTargetTargetPropagated
Artturin Mar 10, 2023
413bf08
[DONTMERGE] kludge: disable dependency-mismatch-check hook
May 2, 2023
fed6ec7
qt5: use depsTargetTargetPropagated for self.qtbase.dev
Apr 24, 2023
ae5f76c
qt5: add buildPackages.stdenv.cc to depsBuildBuild
May 5, 2023
4d80a33
qt5.qtbase: add configureFlags for cross
Mar 9, 2023
2c34157
qt5.qtbase: add configurePhase env vars for cross
Mar 9, 2023
5293dad
qt5.qtbase: omit --host and --build configureFlags
Mar 9, 2023
d7e0a4f
qt5.qtbase: add buildPackages.stdenv.cc to depsBuildBuild
May 5, 2023
c15dfef
qt5.qtdeclarative: populate $dev/bin when cross
May 5, 2023
3269871
qt5.qtwayland: fix cross compilation
Mar 11, 2023
59ea980
qt5.qtwebchannel: omit $bin output if cross
Mar 9, 2023
42ce406
qt5.qtwebengine: use python3 (to fix cross)
Mar 9, 2023
c8a11f9
qt5.qtwebengine: point build at proper pkg-config for cross
Mar 9, 2023
bc87e5f
qt5.qtwebengine: fix cross
May 5, 2023
5c34adf
pythonPackages.pynacl: fix cross
May 2, 2023
9ac67a3
adblock: mark broken if cross
May 5, 2023
40c552b
pykeepass: mark broken if cross
May 5, 2023
764414a
pyqt5: add enableVerbose?false
Apr 23, 2023
9fb7ad3
pyqt: fix cross compilation
May 5, 2023
30e6396
pyqtwebengine: use multiple cores, dont discard errors
May 5, 2023
2df05d9
pyqtwebengine: fix cross
May 5, 2023
a7f9220
[DONTMERGE] pyqtwebengine: kludge: add -I flags manually
May 5, 2023
aee65e3
qutebrowser: enable cross compilation
May 5, 2023
0cc380b
qtwebengine: pipewireSupport=false if cross
May 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions pkgs/applications/networking/browsers/qutebrowser/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
, wrapGAppsHook ? null
, enableWideVine ? false
, widevine-cdm
, buildPackages
}: let
isQt6 = mkDerivationWith == null;

Expand Down Expand Up @@ -78,14 +79,20 @@ buildPythonApplication {
wrapQtAppsHook wrapGAppsHook asciidoc
docbook_xml_dtd_45 docbook_xsl libxml2 libxslt
]
++ lib.optional isQt6 python3Packages.pygments;
++ lib.optional isQt6 python3Packages.pygments
++ lib.optional stdenv.isLinux (lib.getDev qtwayland); # for qtwaylandscanner

propagatedBuildInputs = with python3Packages; ([
pyyaml backendPackage jinja2 pygments
# scripts and userscripts libs
tldextract beautifulsoup4
readability-lxml pykeepass stem
readability-lxml
] ++ lib.optionals (!pykeepass.meta.broken) [
pykeepass
] ++ [
stem
pynacl
] ++ lib.optionals (!adblock.meta.broken) [
# extensive ad blocking
adblock
]
Expand Down Expand Up @@ -116,7 +123,7 @@ buildPythonApplication {
runHook preInstall

make -f misc/Makefile \
PYTHON=${python3}/bin/python3 \
PYTHON=${buildPackages.python3}/bin/python3 \
PREFIX=. \
DESTDIR="$out" \
DATAROOTDIR=/share \
Expand Down
9 changes: 7 additions & 2 deletions pkgs/development/libraries/qt-5/5.15/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ let
{
inherit perl;
inherit lib;
inherit buildPackages;
# Use a variant of mkDerivation that does not include wrapQtApplications
# to avoid cyclic dependencies between Qt modules.
mkDerivation =
Expand All @@ -127,6 +128,9 @@ let
callPackage = self.newScope { inherit qtCompatVersion qtModule srcs stdenv; };
in {

# remove before 23.11
overrideScope' = lib.warn "qt5 now uses makeScopeWithSplicing which does not have \"overrideScope'\", use \"overrideScope\"." self.overrideScope;

inherit callPackage qtCompatVersion qtModule srcs;

mkDerivationWith =
Expand Down Expand Up @@ -221,7 +225,7 @@ let

qmake = makeSetupHook {
name = "qmake-hook";
propagatedBuildInputs = [ self.qtbase.dev ];
depsTargetTargetPropagated = [ self.qtbase.dev ];
substitutions = {
inherit debug;
fix_qmake_libtool = ../hooks/fix-qmake-libtool.sh;
Expand All @@ -230,7 +234,8 @@ let

wrapQtAppsHook = makeSetupHook {
name = "wrap-qt5-apps-hook";
propagatedBuildInputs = [ self.qtbase.dev buildPackages.makeBinaryWrapper ]
propagatedBuildInputs = [ buildPackages.makeWrapper ];
depsTargetTargetPropagated = [ self.qtbase.dev ]
++ lib.optional stdenv.isLinux self.qtwayland.dev;
} ../hooks/wrap-qt-apps-hook.sh;
} // lib.optionalAttrs config.allowAliases {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if [[ -n "${__nix_qtbase-}" ]]; then
echo >&2 "Error: detected mismatched Qt dependencies:"
echo >&2 " @dev@"
echo >&2 " $__nix_qtbase"
exit 1
#exit 1
fi
else # Only set up Qt once.
__nix_qtbase="@dev@"
Expand Down
23 changes: 23 additions & 0 deletions pkgs/development/libraries/qt-5/modules/qtbase.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@
, developerBuild ? false
, decryptSslTraffic ? false
, testers
, buildPackages
}:

let
debugSymbols = debug || developerBuild;
qtPlatformCross = plat: with plat;
if isLinux
then "linux-generic-g++"
else throw "Please add a qtPlatformCross entry for ${plat.config}";
in

stdenv.mkDerivation (finalAttrs: {
Expand Down Expand Up @@ -82,6 +87,13 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [ bison flex gperf lndir perl pkg-config which ]
++ lib.optionals stdenv.isDarwin [ xcbuild ];

depsBuildBuild = [
# `qtbase` expects to find `cc` (with no prefix) in the
# `$PATH`, so the following is needed even if
# `stdenv.buildPlatform.canExecute stdenv.hostPlatform`
buildPackages.stdenv.cc
];

propagatedNativeBuildInputs = [ lndir ];

enableParallelBuilding = true;
Expand Down Expand Up @@ -155,6 +167,13 @@ stdenv.mkDerivation (finalAttrs: {
export MAKEFLAGS+=" -j$NIX_BUILD_CORES"

./bin/syncqt.pl -version $version
'' + lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
# QT's configure script will refuse to use pkg-config unless these two environment variables are set
export PKG_CONFIG_SYSROOT_DIR=/
export PKG_CONFIG_LIBDIR=${lib.getLib pkg-config}/lib
echo "QMAKE_LFLAGS=''${LDFLAGS}" >> mkspecs/devices/${qtPlatformCross stdenv.hostPlatform}/qmake.conf
echo "QMAKE_CFLAGS=''${CFLAGS}" >> mkspecs/devices/${qtPlatformCross stdenv.hostPlatform}/qmake.conf
echo "QMAKE_CXXFLAGS=''${CXXFLAGS}" >> mkspecs/devices/${qtPlatformCross stdenv.hostPlatform}/qmake.conf
'';

postConfigure = ''
Expand Down Expand Up @@ -203,6 +222,7 @@ stdenv.mkDerivation (finalAttrs: {
PSQL_LIBS = lib.optionalString (postgresql != null) "-L${postgresql.lib}/lib -lpq";

# TODO Remove obsolete and useless flags once the build will be totally mastered
configurePlatforms = [ ];
configureFlags = [
"-plugindir $(out)/$(qtPluginPrefix)"
"-qmldir $(out)/$(qtQmlPrefix)"
Expand All @@ -228,6 +248,9 @@ stdenv.mkDerivation (finalAttrs: {
"-L" "${icu.out}/lib"
"-I" "${icu.dev}/include"
"-pch"
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-device ${qtPlatformCross stdenv.hostPlatform}"
"-device-option CROSS_COMPILE=${stdenv.cc.targetPrefix}"
]
++ lib.optional debugSymbols "-debug"
++ lib.optionals developerBuild [
Expand Down
10 changes: 9 additions & 1 deletion pkgs/development/libraries/qt-5/modules/qtdeclarative.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{ qtModule, lib, python3, qtbase, qtsvg }:
{ lib
, stdenv
, qtModule, python3, qtbase, qtsvg }:

qtModule {
pname = "qtdeclarative";
Expand All @@ -21,4 +23,10 @@ qtModule {
"bin/qmlscene"
"bin/qmltestrunner"
];
postFixup = lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
mv $dev/bin/qmlformat $bin/bin/qmlformat
mv $dev/bin/qmltyperegistrar $bin/bin/qmltyperegistrar
ln -s $bin/bin/qmlformat $dev/bin/qmlformat
ln -s $bin/bin/qmltyperegistrar $dev/bin/qmltyperegistrar
'';
}
12 changes: 9 additions & 3 deletions pkgs/development/libraries/qt-5/modules/qtwayland.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
{ qtModule, qtbase, qtquickcontrols, wayland, pkg-config }:
{ lib
, stdenv
, qtModule, qtbase, qtquickcontrols, wayland, pkg-config, fetchpatch
, buildPackages }:

qtModule {
pname = "qtwayland";
qtInputs = [ qtbase qtquickcontrols ];
buildInputs = [ wayland ];
nativeBuildInputs = [ pkg-config ];
outputs = [ "out" "dev" "bin" ];
nativeBuildInputs = [
pkg-config
buildPackages.wayland # for wayland-scanner
];
outputs = [ "out" "dev" ] ++ lib.optionals (stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ "bin" ];
patches = [
# NixOS-specific, ensure that app_id is correctly determined for
# wrapped executables from `wrapQtAppsHook` (see comment in patch for further
Expand Down
9 changes: 7 additions & 2 deletions pkgs/development/libraries/qt-5/modules/qtwebchannel.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{ qtModule, qtbase, qtdeclarative }:
{ lib
, stdenv
, qtModule
, qtbase
, qtdeclarative
}:

qtModule {
pname = "qtwebchannel";
qtInputs = [ qtbase qtdeclarative ];
outputs = [ "out" "dev" "bin" ];
outputs = [ "out" "dev" ] ++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [ "bin" ];
}

Loading