wrapQtAppsHook: wrap Qt applications for runtime dependencies
This commit is contained in:
parent
0daecd2d7a
commit
f79fd2e826
@ -64,8 +64,8 @@ in
|
||||
};
|
||||
|
||||
security.wrappers = {
|
||||
kcheckpass.source = "${lib.getBin plasma5.kscreenlocker}/lib/libexec/kcheckpass";
|
||||
"start_kdeinit".source = "${lib.getBin pkgs.kinit}/lib/libexec/kf5/start_kdeinit";
|
||||
kcheckpass.source = "${lib.getBin plasma5.kscreenlocker}/libexec/kcheckpass";
|
||||
"start_kdeinit".source = "${lib.getBin pkgs.kinit}/libexec/kf5/start_kdeinit";
|
||||
kwin_wayland = {
|
||||
source = "${lib.getBin plasma5.kwin}/bin/kwin_wayland";
|
||||
capabilities = "cap_sys_nice+ep";
|
||||
|
@ -1,37 +1,39 @@
|
||||
{
|
||||
mkDerivation, lib, makeWrapper,
|
||||
mkDerivation, lib, config,
|
||||
|
||||
extra-cmake-modules, kdoctools,
|
||||
|
||||
karchive, kconfig, kcrash, kdbusaddons, ki18n, kiconthemes, kitemmodels,
|
||||
khtml, kio, kparts, kpty, kservice, kwidgetsaddons, libarchive,
|
||||
breeze-icons, karchive, kconfig, kcrash, kdbusaddons, ki18n,
|
||||
kiconthemes, kitemmodels, khtml, kio, kparts, kpty, kservice, kwidgetsaddons,
|
||||
|
||||
libarchive, libzip,
|
||||
|
||||
# Archive tools
|
||||
p7zip, unzip, zip,
|
||||
p7zip, lrzip,
|
||||
|
||||
# Unfree tools
|
||||
unfreeEnableUnrar ? false, unrar,
|
||||
}:
|
||||
|
||||
let
|
||||
extraTools = [ p7zip lrzip ] ++ lib.optional unfreeEnableUnrar unrar;
|
||||
in
|
||||
|
||||
mkDerivation {
|
||||
name = "ark";
|
||||
nativeBuildInputs = [ extra-cmake-modules kdoctools makeWrapper ];
|
||||
propagatedBuildInputs = [
|
||||
karchive kconfig kcrash kdbusaddons khtml ki18n kiconthemes kio kitemmodels
|
||||
kparts kpty kservice kwidgetsaddons libarchive
|
||||
];
|
||||
outputs = [ "out" "dev" ];
|
||||
postFixup =
|
||||
let
|
||||
PATH =
|
||||
lib.makeBinPath
|
||||
([ p7zip unzip zip ] ++ lib.optional unfreeEnableUnrar unrar);
|
||||
in ''
|
||||
wrapProgram "$out/bin/ark" --prefix PATH : "${PATH}"
|
||||
'';
|
||||
meta = {
|
||||
license = with lib.licenses;
|
||||
[ gpl2 lgpl3 ] ++ lib.optional unfreeEnableUnrar unfree;
|
||||
maintainers = [ lib.maintainers.ttuegel ];
|
||||
};
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
nativeBuildInputs = [ extra-cmake-modules kdoctools ];
|
||||
buildInputs = [ libarchive libzip ] ++ extraTools;
|
||||
propagatedBuildInputs = [
|
||||
breeze-icons karchive kconfig kcrash kdbusaddons khtml ki18n kiconthemes kio
|
||||
kitemmodels kparts kpty kservice kwidgetsaddons
|
||||
];
|
||||
|
||||
qtWrapperArgs = [ "--prefix" "PATH" ":" (lib.makeBinPath extraTools) ];
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
{
|
||||
stdenv, mkDerivation, lib,
|
||||
extra-cmake-modules, kdoctools,
|
||||
chmlib ? null, discount, djvulibre, ebook_tools, kactivities, karchive, kbookmarks,
|
||||
kcompletion, kconfig, kconfigwidgets, kcoreaddons, kdbusaddons,
|
||||
kdegraphics-mobipocket, kiconthemes, kjs, khtml, kio, kparts, kpty, kwallet,
|
||||
kwindowsystem, libkexiv2, libspectre, libzip, phonon, poppler, qca-qt5,
|
||||
qtdeclarative, qtsvg, threadweaver, kcrash
|
||||
breeze-icons, chmlib ? null, discount, djvulibre, ebook_tools, kactivities,
|
||||
karchive, kbookmarks, kcompletion, kconfig, kconfigwidgets, kcoreaddons,
|
||||
kdbusaddons, kdegraphics-mobipocket, kiconthemes, kjs, khtml, kio, kparts,
|
||||
kpty, kwallet, kwindowsystem, libkexiv2, libspectre, libzip, phonon, poppler,
|
||||
qca-qt5, qtdeclarative, qtsvg, threadweaver, kcrash
|
||||
}:
|
||||
|
||||
mkDerivation {
|
||||
name = "okular";
|
||||
nativeBuildInputs = [ extra-cmake-modules kdoctools ];
|
||||
buildInputs = [
|
||||
discount djvulibre ebook_tools kactivities karchive kbookmarks
|
||||
breeze-icons discount djvulibre ebook_tools kactivities karchive kbookmarks
|
||||
kcompletion kconfig kconfigwidgets kcoreaddons kdbusaddons
|
||||
kdegraphics-mobipocket kiconthemes kjs khtml kio kparts kpty kwallet
|
||||
kwindowsystem libkexiv2 libspectre libzip phonon poppler qca-qt5
|
||||
|
@ -34,7 +34,8 @@ mkDerivation {
|
||||
|
||||
qtgraphicaleffects qtquickcontrols qtquickcontrols2 qtscript qtwayland qtx11extras
|
||||
];
|
||||
outputs = [ "bin" "dev" "out" ];
|
||||
propagatedUserEnvPkgs = [ qtgraphicaleffects ];
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DNIXPKGS_XMESSAGE=${getBin xmessage}/bin/xmessage"
|
||||
@ -45,7 +46,7 @@ mkDerivation {
|
||||
"-DNIXPKGS_XPROP=${getBin xprop}/bin/xprop"
|
||||
"-DNIXPKGS_ID=${getBin coreutils}/bin/id"
|
||||
"-DNIXPKGS_DBUS_UPDATE_ACTIVATION_ENVIRONMENT=${getBin dbus}/bin/dbus-update-activation-environment"
|
||||
"-DNIXPKGS_START_KDEINIT_WRAPPER=${getLib kinit}/lib/libexec/kf5/start_kdeinit_wrapper"
|
||||
"-DNIXPKGS_START_KDEINIT_WRAPPER=${getLib kinit}/libexec/kf5/start_kdeinit_wrapper"
|
||||
"-DNIXPKGS_QDBUS=${getBin qttools}/bin/qdbus"
|
||||
"-DNIXPKGS_KWRAPPER5=${getBin kinit}/bin/kwrapper5"
|
||||
"-DNIXPKGS_KREADCONFIG5=${getBin kconfig}/bin/kreadconfig5"
|
||||
@ -72,10 +73,6 @@ mkDerivation {
|
||||
|
||||
preConfigure = ''
|
||||
NIX_CFLAGS_COMPILE+=" -DNIXPKGS_KDOSTARTUPCONFIG5=\"''${!outputBin}/bin/kdostartupconfig5\""
|
||||
cmakeFlags+=" -DNIXPKGS_STARTPLASMA=''${!outputBin}/lib/libexec/startplasma"
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
moveToOutput lib/libexec/startplasma ''${!outputBin}
|
||||
cmakeFlags+=" -DNIXPKGS_STARTPLASMA=''${!outputBin}/libexec/startplasma"
|
||||
'';
|
||||
}
|
||||
|
@ -45,17 +45,9 @@ let
|
||||
if [ "$hookName" != postHook ]; then
|
||||
postHooks+=("source @dev@/nix-support/setup-hook")
|
||||
else
|
||||
# Propagate $${out} output
|
||||
propagatedUserEnvPkgs="$propagatedUserEnvPkgs @${out}@"
|
||||
|
||||
if [ -z "$outputDev" ]; then
|
||||
echo "error: \$outputDev is unset!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Propagate $dev so that this setup hook is propagated
|
||||
# But only if there is a separate $dev output
|
||||
if [ "$outputDev" != out ]; then
|
||||
if [ "''${outputDev:?}" != out ]; then
|
||||
propagatedBuildInputs="$propagatedBuildInputs @dev@"
|
||||
fi
|
||||
fi
|
||||
@ -75,10 +67,9 @@ let
|
||||
inherit (srcs."${name}") src version;
|
||||
|
||||
outputs = args.outputs or [ "bin" "dev" "out" ];
|
||||
hasBin = lib.elem "bin" outputs;
|
||||
hasDev = lib.elem "dev" outputs;
|
||||
hasSeparateDev = lib.elem "dev" outputs;
|
||||
|
||||
defaultSetupHook = if hasBin && hasDev then propagateBin else null;
|
||||
defaultSetupHook = if hasSeparateDev then propagateBin else null;
|
||||
setupHook = args.setupHook or defaultSetupHook;
|
||||
|
||||
meta = {
|
||||
|
@ -1,16 +1,16 @@
|
||||
_ecmEnvHook() {
|
||||
ecmEnvHook() {
|
||||
addToSearchPath XDG_DATA_DIRS "$1/share"
|
||||
addToSearchPath XDG_CONFIG_DIRS "$1/etc/xdg"
|
||||
}
|
||||
addEnvHooks "$targetOffset" _ecmEnvHook
|
||||
addEnvHooks "$targetOffset" ecmEnvHook
|
||||
|
||||
_ecmPreConfigureHook() {
|
||||
ecmPostHook() {
|
||||
# Because we need to use absolute paths here, we must set *all* the paths.
|
||||
cmakeFlags+=" -DKDE_INSTALL_EXECROOTDIR=${!outputBin}"
|
||||
cmakeFlags+=" -DKDE_INSTALL_BINDIR=${!outputBin}/bin"
|
||||
cmakeFlags+=" -DKDE_INSTALL_SBINDIR=${!outputBin}/sbin"
|
||||
cmakeFlags+=" -DKDE_INSTALL_LIBDIR=${!outputLib}/lib"
|
||||
cmakeFlags+=" -DKDE_INSTALL_LIBEXECDIR=${!outputLib}/lib/libexec"
|
||||
cmakeFlags+=" -DKDE_INSTALL_LIBEXECDIR=${!outputLib}/libexec"
|
||||
cmakeFlags+=" -DKDE_INSTALL_CMAKEPACKAGEDIR=${!outputDev}/lib/cmake"
|
||||
cmakeFlags+=" -DKDE_INSTALL_INCLUDEDIR=${!outputInclude}/include"
|
||||
cmakeFlags+=" -DKDE_INSTALL_LOCALSTATEDIR=/var"
|
||||
@ -51,4 +51,58 @@ _ecmPreConfigureHook() {
|
||||
cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/$qtQmlPrefix"
|
||||
fi
|
||||
}
|
||||
preConfigureHooks+=(_ecmPreConfigureHook)
|
||||
postHooks+=(ecmPostHook)
|
||||
|
||||
xdgDataSubdirs=(
|
||||
"doc" "config.kcfg" "kconf_update" "kservices5" "kservicetypes5" \
|
||||
"kxmlgui5" "knotifications5" "icons" "locale" "sounds" "templates" \
|
||||
"wallpapers" "applications" "desktop-directories" "mime" "appdata" "dbus-1" \
|
||||
)
|
||||
|
||||
|
||||
ecmHostPathSeen=( )
|
||||
|
||||
ecmUnseenHostPath() {
|
||||
for pkg in "${ecmHostPathSeen[@]}"
|
||||
do
|
||||
if [ "${pkg:?}" == "$1" ]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
ecmHostPathSeen+=("$1")
|
||||
return 0
|
||||
}
|
||||
|
||||
ecmHostPathHook() {
|
||||
ecmUnseenHostPath "$1" || return 0
|
||||
|
||||
local xdgConfigDir="$1/etc/xdg"
|
||||
if [ -d "$xdgConfigDir" ]
|
||||
then
|
||||
qtWrapperArgs+=(--prefix XDG_CONFIG_DIRS : "$xdgConfigDir")
|
||||
fi
|
||||
|
||||
for xdgDataSubdir in "${xdgDataSubdirs[@]}"
|
||||
do
|
||||
if [ -d "$1/share/$xdgDataSubdir" ]
|
||||
then
|
||||
qtWrapperArgs+=(--prefix XDG_DATA_DIRS : "$1/share")
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
local manDir="$1/man"
|
||||
if [ -d "$manDir" ]
|
||||
then
|
||||
qtWrapperArgs+=(--prefix MANPATH : "$manDir")
|
||||
fi
|
||||
|
||||
local infoDir="$1/info"
|
||||
if [ -d "$infoDir" ]
|
||||
then
|
||||
qtWrapperArgs+=(--prefix INFOPATH : "$infoDir")
|
||||
fi
|
||||
}
|
||||
addEnvHooks "$hostOffset" ecmHostPathHook
|
||||
|
@ -9,6 +9,7 @@ let inherit (lib) getLib; in
|
||||
mkDerivation {
|
||||
name = "kinit";
|
||||
meta = { maintainers = [ lib.maintainers.ttuegel ]; };
|
||||
outputs = [ "out" "dev" ];
|
||||
nativeBuildInputs = [ extra-cmake-modules kdoctools ];
|
||||
buildInputs = [
|
||||
kconfig kcrash ki18n kio kservice kwindowsystem
|
||||
@ -19,9 +20,6 @@ mkDerivation {
|
||||
''-DNIXPKGS_KF5_PARTS=\"${getLib kparts}/lib/libKF5Parts.so.5\"''
|
||||
''-DNIXPKGS_KF5_PLASMA=\"${getLib plasma-framework}/lib/libKF5Plasma.so.5\"''
|
||||
];
|
||||
postFixup = ''
|
||||
moveToOutput "lib/libexec/kf5/start_kdeinit" "$bin"
|
||||
'';
|
||||
setupHook = writeScript "setup-hook.sh" ''
|
||||
kinitFixupOutputHook() {
|
||||
if [ $prefix != ''${!outputBin} ] && [ -d $prefix/lib ]; then
|
||||
|
@ -17,7 +17,7 @@ top-level attribute to `top-level/all-packages.nix`.
|
||||
|
||||
{
|
||||
newScope,
|
||||
stdenv, fetchurl, fetchFromGitHub, makeSetupHook,
|
||||
stdenv, fetchurl, fetchFromGitHub, makeSetupHook, makeWrapper,
|
||||
bison, cups ? null, harfbuzz, libGL, perl,
|
||||
gstreamer, gst-plugins-base, gtk3, dconf,
|
||||
cf-private, llvmPackages_5,
|
||||
@ -34,6 +34,8 @@ let
|
||||
|
||||
qtCompatVersion = "5.11";
|
||||
|
||||
stdenvActual = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
|
||||
|
||||
mirror = "https://download.qt.io";
|
||||
srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; } // {
|
||||
# Community port of the now unmaintained upstream qtwebkit.
|
||||
@ -64,16 +66,18 @@ let
|
||||
qtwebkit = [ ./qtwebkit.patch ];
|
||||
};
|
||||
|
||||
mkDerivation =
|
||||
import ../mkDerivation.nix {
|
||||
inherit (stdenv) lib;
|
||||
stdenv = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
|
||||
}
|
||||
{ inherit debug; };
|
||||
|
||||
qtModule =
|
||||
import ../qtModule.nix
|
||||
{ inherit mkDerivation perl; inherit (stdenv) lib; }
|
||||
{
|
||||
inherit perl;
|
||||
inherit (stdenv) lib;
|
||||
# Use a variant of mkDerivation that does not include wrapQtApplications
|
||||
# to avoid cyclic dependencies between Qt modules.
|
||||
mkDerivation =
|
||||
import ../mkDerivation.nix
|
||||
{ inherit (stdenv) lib; inherit debug; wrapQtAppsHook = null; }
|
||||
stdenvActual.mkDerivation;
|
||||
}
|
||||
{ inherit self srcs patches; };
|
||||
|
||||
addPackages = self: with self;
|
||||
@ -81,7 +85,11 @@ let
|
||||
callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
|
||||
in {
|
||||
|
||||
inherit mkDerivation;
|
||||
mkDerivationWith =
|
||||
import ../mkDerivation.nix
|
||||
{ inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
|
||||
|
||||
mkDerivation = mkDerivationWith stdenvActual.mkDerivation;
|
||||
|
||||
qtbase = callPackage ../modules/qtbase.nix {
|
||||
inherit (srcs.qtbase) src version;
|
||||
@ -146,6 +154,12 @@ let
|
||||
fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
|
||||
};
|
||||
} ../hooks/qmake-hook.sh;
|
||||
|
||||
wrapQtAppsHook = makeSetupHook {
|
||||
deps =
|
||||
[ self.qtbase.dev makeWrapper ]
|
||||
++ optional stdenv.isLinux self.qtwayland.dev;
|
||||
} ../hooks/wrap-qt-apps-hook.sh;
|
||||
};
|
||||
|
||||
self = makeScope newScope addPackages;
|
||||
|
@ -17,7 +17,7 @@ top-level attribute to `top-level/all-packages.nix`.
|
||||
|
||||
{
|
||||
newScope,
|
||||
stdenv, fetchurl, fetchFromGitHub, makeSetupHook,
|
||||
stdenv, fetchurl, fetchFromGitHub, makeSetupHook, makeWrapper,
|
||||
bison, cups ? null, harfbuzz, libGL, perl,
|
||||
gstreamer, gst-plugins-base, gtk3, dconf,
|
||||
cf-private, llvmPackages_5,
|
||||
@ -34,6 +34,8 @@ let
|
||||
|
||||
qtCompatVersion = "5.12";
|
||||
|
||||
stdenvActual = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
|
||||
|
||||
mirror = "https://download.qt.io";
|
||||
srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; } // {
|
||||
# Community port of the now unmaintained upstream qtwebkit.
|
||||
@ -69,16 +71,18 @@ let
|
||||
qttools = [ ./qttools.patch ];
|
||||
};
|
||||
|
||||
mkDerivation =
|
||||
import ../mkDerivation.nix {
|
||||
inherit (stdenv) lib;
|
||||
stdenv = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
|
||||
}
|
||||
{ inherit debug; };
|
||||
|
||||
qtModule =
|
||||
import ../qtModule.nix
|
||||
{ inherit mkDerivation perl; inherit (stdenv) lib; }
|
||||
{
|
||||
inherit perl;
|
||||
inherit (stdenv) lib;
|
||||
# Use a variant of mkDerivation that does not include wrapQtApplications
|
||||
# to avoid cyclic dependencies between Qt modules.
|
||||
mkDerivation =
|
||||
import ../mkDerivation.nix
|
||||
{ inherit (stdenv) lib; inherit debug; wrapQtAppsHook = null; }
|
||||
stdenvActual.mkDerivation;
|
||||
}
|
||||
{ inherit self srcs patches; };
|
||||
|
||||
addPackages = self: with self;
|
||||
@ -86,7 +90,11 @@ let
|
||||
callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
|
||||
in {
|
||||
|
||||
inherit mkDerivation;
|
||||
mkDerivationWith =
|
||||
import ../mkDerivation.nix
|
||||
{ inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
|
||||
|
||||
mkDerivation = mkDerivationWith stdenvActual.mkDerivation;
|
||||
|
||||
qtbase = callPackage ../modules/qtbase.nix {
|
||||
inherit (srcs.qtbase) src version;
|
||||
@ -151,6 +159,12 @@ let
|
||||
fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
|
||||
};
|
||||
} ../hooks/qmake-hook.sh;
|
||||
|
||||
wrapQtAppsHook = makeSetupHook {
|
||||
deps =
|
||||
[ self.qtbase.dev makeWrapper ]
|
||||
++ optional stdenv.isLinux self.qtwayland.dev;
|
||||
} ../hooks/wrap-qt-apps-hook.sh;
|
||||
};
|
||||
|
||||
self = makeScope newScope addPackages;
|
||||
|
@ -26,7 +26,7 @@ existing packages here and modify it as necessary.
|
||||
|
||||
{
|
||||
newScope,
|
||||
stdenv, fetchurl, fetchpatch, makeSetupHook,
|
||||
stdenv, fetchurl, fetchpatch, makeSetupHook, makeWrapper,
|
||||
bison, cups ? null, harfbuzz, libGL, perl,
|
||||
gstreamer, gst-plugins-base,
|
||||
cf-private,
|
||||
@ -105,14 +105,18 @@ let
|
||||
];
|
||||
};
|
||||
|
||||
mkDerivation =
|
||||
import ../mkDerivation.nix
|
||||
{ inherit stdenv; inherit (stdenv) lib; }
|
||||
{ inherit debug; };
|
||||
|
||||
qtModule =
|
||||
import ../qtModule.nix
|
||||
{ inherit mkDerivation perl; inherit (stdenv) lib; }
|
||||
{
|
||||
inherit perl;
|
||||
inherit (stdenv) lib;
|
||||
# Use a variant of mkDerivation that does not include wrapQtApplications
|
||||
# to avoid cyclic dependencies between Qt modules.
|
||||
mkDerivation =
|
||||
import ../mkDerivation.nix
|
||||
{ inherit (stdenv) lib; inherit debug; wrapQtAppsHook = null; }
|
||||
stdenv.mkDerivation;
|
||||
}
|
||||
{ inherit self srcs patches; };
|
||||
|
||||
addPackages = self: with self;
|
||||
@ -120,7 +124,11 @@ let
|
||||
callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
|
||||
in {
|
||||
|
||||
inherit mkDerivation;
|
||||
mkDerivationWith =
|
||||
import ../mkDerivation.nix
|
||||
{ inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
|
||||
|
||||
mkDerivation = mkDerivationWith stdenv.mkDerivation;
|
||||
|
||||
qtbase = callPackage ../modules/qtbase.nix {
|
||||
inherit bison cups harfbuzz libGL;
|
||||
@ -176,6 +184,12 @@ let
|
||||
deps = [ self.qtbase.dev ];
|
||||
substitutions = { inherit (stdenv) isDarwin; };
|
||||
} ../hooks/qmake-hook.sh;
|
||||
|
||||
wrapQtAppsHook = makeSetupHook {
|
||||
deps =
|
||||
[ self.qtbase.dev makeWrapper ]
|
||||
++ optional stdenv.isLinux self.qtwayland.dev;
|
||||
} ../hooks/wrap-qt-apps-hook.sh;
|
||||
};
|
||||
|
||||
self = makeScope newScope addPackages;
|
||||
|
@ -17,7 +17,7 @@ top-level attribute to `top-level/all-packages.nix`.
|
||||
|
||||
{
|
||||
newScope,
|
||||
stdenv, fetchurl, fetchpatch, makeSetupHook,
|
||||
stdenv, fetchurl, fetchpatch, makeSetupHook, makeWrapper,
|
||||
bison, cups ? null, harfbuzz, libGL, perl,
|
||||
gstreamer, gst-plugins-base, gtk3, dconf,
|
||||
cf-private,
|
||||
@ -68,14 +68,18 @@ let
|
||||
|
||||
};
|
||||
|
||||
mkDerivation =
|
||||
import ../mkDerivation.nix
|
||||
{ inherit stdenv; inherit (stdenv) lib; }
|
||||
{ inherit debug; };
|
||||
|
||||
qtModule =
|
||||
import ../qtModule.nix
|
||||
{ inherit mkDerivation perl; inherit (stdenv) lib; }
|
||||
{
|
||||
inherit perl;
|
||||
inherit (stdenv) lib;
|
||||
# Use a variant of mkDerivation that does not include wrapQtApplications
|
||||
# to avoid cyclic dependencies between Qt modules.
|
||||
mkDerivation =
|
||||
import ../mkDerivation.nix
|
||||
{ inherit (stdenv) lib; inherit debug; wrapQtAppsHook = null; }
|
||||
stdenv.mkDerivation;
|
||||
}
|
||||
{ inherit self srcs patches; };
|
||||
|
||||
addPackages = self: with self;
|
||||
@ -83,7 +87,11 @@ let
|
||||
callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
|
||||
in {
|
||||
|
||||
inherit mkDerivation;
|
||||
mkDerivationWith =
|
||||
import ../mkDerivation.nix
|
||||
{ inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
|
||||
|
||||
mkDerivation = mkDerivationWith stdenv.mkDerivation;
|
||||
|
||||
qtbase = callPackage ../modules/qtbase.nix {
|
||||
inherit (srcs.qtbase) src version;
|
||||
@ -145,6 +153,12 @@ let
|
||||
fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
|
||||
};
|
||||
} ../hooks/qmake-hook.sh;
|
||||
|
||||
wrapQtAppsHook = makeSetupHook {
|
||||
deps =
|
||||
[ self.qtbase.dev makeWrapper ]
|
||||
++ optional stdenv.isLinux self.qtwayland.dev;
|
||||
} ../hooks/wrap-qt-apps-hook.sh;
|
||||
};
|
||||
|
||||
self = makeScope newScope addPackages;
|
||||
|
@ -19,12 +19,14 @@ export QMAKEPATH
|
||||
QMAKEMODULES=
|
||||
export QMAKEMODULES
|
||||
|
||||
addToQMAKEPATH() {
|
||||
if [ -d "$1/mkspecs" ]; then
|
||||
qmakePathHook() {
|
||||
if [ -d "$1/mkspecs" ]
|
||||
then
|
||||
QMAKEMODULES="${QMAKEMODULES}${QMAKEMODULES:+:}/mkspecs"
|
||||
QMAKEPATH="${QMAKEPATH}${QMAKEPATH:+:}$1"
|
||||
fi
|
||||
}
|
||||
envBuildHostHooks+=(qmakePathHook)
|
||||
|
||||
# Propagate any runtime dependency of the building package.
|
||||
# Each dependency is propagated to the user environment and as a build
|
||||
@ -32,18 +34,18 @@ addToQMAKEPATH() {
|
||||
# package depending on the building package. (This is necessary in case
|
||||
# the building package does not provide runtime dependencies itself and so
|
||||
# would not be propagated to the user environment.)
|
||||
qtEnvHook() {
|
||||
addToQMAKEPATH "$1"
|
||||
if providesQtRuntime "$1"; then
|
||||
if [ "z${!outputBin}" != "z${!outputDev}" ]; then
|
||||
qtEnvHostTargetHook() {
|
||||
if providesQtRuntime "$1" && [ "z${!outputBin}" != "z${!outputDev}" ]
|
||||
then
|
||||
propagatedBuildInputs+=" $1"
|
||||
fi
|
||||
propagatedUserEnvPkgs+=" $1"
|
||||
fi
|
||||
}
|
||||
envHostTargetHooks+=(qtEnvHook)
|
||||
envHostTargetHooks+=(qtEnvHostTargetHook)
|
||||
|
||||
postPatchMkspecs() {
|
||||
# Prevent this hook from running multiple times
|
||||
dontPatchMkspecs=1
|
||||
|
||||
local bin="${!outputBin}"
|
||||
local dev="${!outputDev}"
|
||||
local doc="${!outputDoc}"
|
||||
|
106
pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh
Normal file
106
pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh
Normal file
@ -0,0 +1,106 @@
|
||||
# Inherit arguments given in mkDerivation
|
||||
qtWrapperArgs=( $qtWrapperArgs )
|
||||
|
||||
qtHostPathSeen=()
|
||||
|
||||
qtUnseenHostPath() {
|
||||
for pkg in "${qtHostPathSeen[@]}"
|
||||
do
|
||||
if [ "${pkg:?}" == "$1" ]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
qtHostPathSeen+=("$1")
|
||||
return 0
|
||||
}
|
||||
|
||||
qtHostPathHook() {
|
||||
qtUnseenHostPath "$1" || return 0
|
||||
|
||||
local pluginDir="$1/${qtPluginPrefix:?}"
|
||||
if [ -d "$pluginDir" ]
|
||||
then
|
||||
qtWrapperArgs+=(--prefix QT_PLUGIN_PATH : "$pluginDir")
|
||||
fi
|
||||
|
||||
local qmlDir="$1/${qtQmlPrefix:?}"
|
||||
if [ -d "$qmlDir" ]
|
||||
then
|
||||
qtWrapperArgs+=(--prefix QML2_IMPORT_PATH : "$qmlDir")
|
||||
fi
|
||||
}
|
||||
addEnvHooks "$hostOffset" qtHostPathHook
|
||||
|
||||
makeQtWrapper() {
|
||||
local original="$1"
|
||||
local wrapper="$2"
|
||||
shift 2
|
||||
makeWrapper "$original" "$wrapper" "${qtWrapperArgs[@]}" "$@"
|
||||
}
|
||||
|
||||
wrapQtApp() {
|
||||
local program="$1"
|
||||
shift 1
|
||||
wrapProgram "$program" "${qtWrapperArgs[@]}" "$@"
|
||||
}
|
||||
|
||||
qtOwnPathsHook() {
|
||||
local xdgDataDir="${!outputBin}/share"
|
||||
if [ -d "$xdgDataDir" ]
|
||||
then
|
||||
qtWrapperArgs+=(--prefix XDG_DATA_DIRS : "$xdgDataDir")
|
||||
fi
|
||||
|
||||
local xdgConfigDir="${!outputBin}/etc/xdg"
|
||||
if [ -d "$xdgConfigDir" ]
|
||||
then
|
||||
qtWrapperArgs+=(--prefix XDG_CONFIG_DIRS : "$xdgConfigDir")
|
||||
fi
|
||||
|
||||
qtHostPathHook "${!outputBin}"
|
||||
}
|
||||
|
||||
preFixupPhases+=" qtOwnPathsHook"
|
||||
|
||||
isQtApp () {
|
||||
readelf -d "$1" 2>/dev/null | grep -q -F 'libQt5Core'
|
||||
}
|
||||
|
||||
# Note: $qtWrapperArgs still gets defined even if $dontWrapQtApps is set.
|
||||
wrapQtAppsHook() {
|
||||
# skip this hook when requested
|
||||
[ -z "$dontWrapQtApps" ] || return 0
|
||||
|
||||
# guard against running multiple times (e.g. due to propagation)
|
||||
[ -z "$wrapQtAppsHookHasRun" ] || return 0
|
||||
wrapQtAppsHookHasRun=1
|
||||
|
||||
local targetDirs=( "$prefix/bin" )
|
||||
echo "wrapping Qt applications in ${targetDirs[@]}"
|
||||
|
||||
for targetDir in "${targetDirs[@]}"
|
||||
do
|
||||
[ -d "$targetDir" ] || continue
|
||||
|
||||
find "$targetDir" -executable -print0 | while IFS= read -r -d '' file
|
||||
do
|
||||
isQtApp "$file" || continue
|
||||
|
||||
if [ -f "$file" ]
|
||||
then
|
||||
echo "wrapping $file"
|
||||
wrapQtApp "$file"
|
||||
elif [ -h "$file" ]
|
||||
then
|
||||
target="$(readlink -e "$file")"
|
||||
echo "wrapping $file -> $target"
|
||||
rm "$file"
|
||||
makeQtWrapper "$target" "$file"
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
fixupOutputHooks+=(wrapQtAppsHook)
|
@ -1,8 +1,8 @@
|
||||
{ stdenv, lib }:
|
||||
{ lib, debug, wrapQtAppsHook }:
|
||||
|
||||
let inherit (lib) optional; in
|
||||
|
||||
{ debug }:
|
||||
mkDerivation:
|
||||
|
||||
args:
|
||||
|
||||
@ -24,7 +24,9 @@ let
|
||||
|
||||
enableParallelBuilding = args.enableParallelBuilding or true;
|
||||
|
||||
nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ wrapQtAppsHook ];
|
||||
|
||||
};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation (args // args_)
|
||||
mkDerivation (args // args_)
|
||||
|
@ -3,5 +3,5 @@
|
||||
qtModule {
|
||||
name = "qtspeech";
|
||||
qtInputs = [ ];
|
||||
outputs = [ "out" "dev" "bin" ];
|
||||
outputs = [ "out" "dev" ];
|
||||
}
|
||||
|
@ -12772,7 +12772,7 @@ in
|
||||
qt56 = recurseIntoAttrs (makeOverridable
|
||||
(import ../development/libraries/qt-5/5.6) {
|
||||
inherit newScope;
|
||||
inherit stdenv fetchurl fetchpatch makeSetupHook;
|
||||
inherit stdenv fetchurl fetchpatch makeSetupHook makeWrapper;
|
||||
bison = bison2; # error: too few arguments to function 'int yylex(...
|
||||
inherit cups;
|
||||
harfbuzz = harfbuzzFull;
|
||||
@ -12787,7 +12787,7 @@ in
|
||||
qt59 = recurseIntoAttrs (makeOverridable
|
||||
(import ../development/libraries/qt-5/5.9) {
|
||||
inherit newScope;
|
||||
inherit stdenv fetchurl fetchpatch makeSetupHook;
|
||||
inherit stdenv fetchurl fetchpatch makeSetupHook makeWrapper;
|
||||
bison = bison2; # error: too few arguments to function 'int yylex(...
|
||||
inherit cups;
|
||||
harfbuzz = harfbuzzFull;
|
||||
@ -12804,7 +12804,7 @@ in
|
||||
qt511 = recurseIntoAttrs (makeOverridable
|
||||
(import ../development/libraries/qt-5/5.11) {
|
||||
inherit newScope;
|
||||
inherit stdenv fetchurl fetchFromGitHub makeSetupHook;
|
||||
inherit stdenv fetchurl fetchFromGitHub makeSetupHook makeWrapper;
|
||||
bison = bison2; # error: too few arguments to function 'int yylex(...
|
||||
inherit cups;
|
||||
harfbuzz = harfbuzzFull;
|
||||
@ -12822,7 +12822,7 @@ in
|
||||
qt512 = recurseIntoAttrs (makeOverridable
|
||||
(import ../development/libraries/qt-5/5.12) {
|
||||
inherit newScope;
|
||||
inherit stdenv fetchurl fetchFromGitHub makeSetupHook;
|
||||
inherit stdenv fetchurl fetchFromGitHub makeSetupHook makeWrapper;
|
||||
bison = bison2; # error: too few arguments to function 'int yylex(...
|
||||
inherit cups;
|
||||
harfbuzz = harfbuzzFull;
|
||||
|
Loading…
Reference in New Issue
Block a user