Skip to content

Commit

Permalink
lxqt: use modified LXQtConfigVars CMake macro
Browse files Browse the repository at this point in the history
LXQt uses the values in this macro to set installation
directories and in the case of lxqt-session to substitute in paths.
However, by doing this all the paths are from within lxqt-build-tools
prefix. By utilizing a setup hook we can set the directories with the
correct prefix as cmake flags.
  • Loading branch information
worldofpeace committed Aug 22, 2019
1 parent 3167eb3 commit e34de04
Show file tree
Hide file tree
Showing 19 changed files with 31 additions and 133 deletions.
7 changes: 0 additions & 7 deletions pkgs/desktops/lxqt/liblxqt/default.nix
Expand Up @@ -27,15 +27,8 @@ mkDerivation rec {
xorg.libXScrnSaver
];

cmakeFlags = [
"-DLXQT_ETC_XDG_DIR=/run/current-system/sw/etc/xdg"
];

postPatch = ''
sed -i 's|set(LXQT_SHARE_DIR .*)|set(LXQT_SHARE_DIR "/run/current-system/sw/share/lxqt")|' CMakeLists.txt
sed -i "s|\''${POLKITQT-1_POLICY_FILES_INSTALL_DIR}|''${out}/share/polkit-1/actions|" CMakeLists.txt
substituteInPlace CMakeLists.txt \
--replace "\''${LXQT_TRANSLATIONS_DIR}" "''${out}/share/lxqt/translations"
'';

meta = with lib; {
Expand Down
5 changes: 0 additions & 5 deletions pkgs/desktops/lxqt/lxqt-about/default.nix
Expand Up @@ -25,11 +25,6 @@ mkDerivation rec {
libqtxdg
];

postPatch = ''
substituteInPlace CMakeLists.txt \
--replace "\''${LXQT_TRANSLATIONS_DIR}" "''${out}/share/lxqt/translations"
'';

meta = with lib; {
description = "Dialogue window providing information about LXQt and the system it's running on";
homepage = https://github.com/lxqt/lxqt-about;
Expand Down
5 changes: 0 additions & 5 deletions pkgs/desktops/lxqt/lxqt-admin/default.nix
Expand Up @@ -29,11 +29,6 @@ mkDerivation rec {
postPatch = ''
sed "s|\''${POLKITQT-1_POLICY_FILES_INSTALL_DIR}|''${out}/share/polkit-1/actions|" \
-i lxqt-admin-user/CMakeLists.txt
for f in lxqt-admin-{user,time}/CMakeLists.txt; do
substituteInPlace $f \
--replace "\''${LXQT_TRANSLATIONS_DIR}" "''${out}/share/lxqt/translations"
done
'';

meta = with lib; {
Expand Down
1 change: 0 additions & 1 deletion pkgs/desktops/lxqt/lxqt-archiver/default.nix
@@ -1,7 +1,6 @@
{ lib, mkDerivation, fetchFromGitHub, cmake, pkgconfig, lxqt-build-tools, json-glib, libfm-qt, qtbase, qttools, qtx11extras }:

mkDerivation rec {
name = "${pname}-${version}";
pname = "lxqt-archiver";
version = "0.0.96";

Expand Down
7 changes: 7 additions & 0 deletions pkgs/desktops/lxqt/lxqt-build-tools/LXQtConfigVars.cmake
@@ -0,0 +1,7 @@
add_definitions("-DLXQT_RELATIVE_SHARE_DIR=\"${LXQT_RELATIVE_SHARE_DIR}\"")
add_definitions("-DLXQT_SHARE_DIR=\"${LXQT_SHARE_DIR}\"")
add_definitions("-DLXQT_RELATIVE_SHARE_TRANSLATIONS_DIR=\"${LXQT_RELATIVE_TRANSLATIONS_DIR}\"")
add_definitions("-DLXQT_SHARE_TRANSLATIONS_DIR=\"${LXQT_TRANSLATIONS_DIR}\"")
add_definitions("-DLXQT_GRAPHICS_DIR=\"${LXQT_GRAPHICS_DIR}\"")
add_definitions("-DLXQT_ETC_XDG_DIR=\"${LXQT_ETC_XDG_DIR}\"")
add_definitions("-DLXQT_DATA_DIR=\"${LXQT_DATA_DIR}\"")
11 changes: 9 additions & 2 deletions pkgs/desktops/lxqt/lxqt-build-tools/default.nix
Expand Up @@ -11,11 +11,18 @@ mkDerivation rec {
sha256 = "0i7m9s4g5rsw28vclc9nh0zcapx85cqfwxkx7rrw7wa12svy7pm2";
};

nativeBuildInputs = [ cmake pkgconfig ];
nativeBuildInputs = [ cmake pkgconfig setupHook ];

buildInputs = [ qtbase glib pcre ];

preConfigure = ''cmakeFlags+=" -DLXQT_ETC_XDG_DIR=$out/etc/xdg"'';
setupHook = ./setup-hook.sh;

# We're dependent on this macro doing add_definitions in most places
# But we have the setup-hook to set the values.
postInstall = ''
rm $out/share/cmake/lxqt-build-tools/modules/LXQtConfigVars.cmake
cp ${./LXQtConfigVars.cmake} $out/share/cmake/lxqt-build-tools/modules/LXQtConfigVars.cmake
'';

meta = with lib; {
description = "Various packaging tools and scripts for LXQt applications";
Expand Down
15 changes: 15 additions & 0 deletions pkgs/desktops/lxqt/lxqt-build-tools/setup-hook.sh
@@ -0,0 +1,15 @@
LXQtCMakePostHook() {
cmakeFlagsArray+=(
-DLXQT_LIBRARY_NAME=lxqt
-DLXQT_SHARE_DIR=$out/share/lxqt
-DLXQT_TRANSLATIONS_DIR=$out/share/lxqt/translations
-DLXQT_GRAPHICS_DIR=$out/share/lxqt/graphics
-DLXQT_ETC_XDG_DIR=$out/etc/xdg
-DLXQT_DATA_DIR=$out/share
-DLXQT_RELATIVE_SHARE_DIR=lxqt
-DLXQT_RELATIVE_SHARE_TRANSLATIONS_DIR=lxqt/translations
)

}

postHooks+=(LXQtCMakePostHook)
17 changes: 0 additions & 17 deletions pkgs/desktops/lxqt/lxqt-config/default.nix
Expand Up @@ -38,23 +38,6 @@ mkDerivation rec {
];

postPatch = ''
substituteInPlace src/CMakeLists.txt \
--replace "DESTINATION \"\''${LXQT_ETC_XDG_DIR}" "DESTINATION \"etc/xdg"
for f in \
lxqt-config-file-associations/CMakeLists.txt \
lxqt-config-brightness/CMakeLists.txt \
lxqt-config-appearance/CMakeLists.txt \
lxqt-config-locale/CMakeLists.txt \
lxqt-config-monitor/CMakeLists.txt \
lxqt-config-input/CMakeLists.txt \
liblxqt-config-cursor/CMakeLists.txt \
src/CMakeLists.txt
do
substituteInPlace $f \
--replace "\''${LXQT_TRANSLATIONS_DIR}" "''${out}/share/lxqt/translations"
done
sed -i "/\''${XORG_LIBINPUT_INCLUDE_DIRS}/a ${xorg.xf86inputlibinput.dev}/include/xorg" lxqt-config-input/CMakeLists.txt
'';

Expand Down
10 changes: 0 additions & 10 deletions pkgs/desktops/lxqt/lxqt-globalkeys/default.nix
Expand Up @@ -26,16 +26,6 @@ mkDerivation rec {
libqtxdg
];

postPatch = ''
for dir in autostart xdg; do
substituteInPlace $dir/CMakeLists.txt \
--replace "DESTINATION \"\''${LXQT_ETC_XDG_DIR}" "DESTINATION \"etc/xdg"
done
substituteInPlace config/CMakeLists.txt \
--replace "\''${LXQT_TRANSLATIONS_DIR}" "''${out}/share/lxqt/translations"
'';

meta = with lib; {
description = "Daemon used to register global keyboard shortcuts";
homepage = https://github.com/lxqt/lxqt-globalkeys;
Expand Down
10 changes: 0 additions & 10 deletions pkgs/desktops/lxqt/lxqt-notificationd/default.nix
Expand Up @@ -16,16 +16,6 @@ mkDerivation rec {
lxqt-build-tools
];

postPatch = ''
substituteInPlace autostart/CMakeLists.txt \
--replace "DESTINATION \"\''${LXQT_ETC_XDG_DIR}" "DESTINATION \"etc/xdg"
for f in {config,src}/CMakeLists.txt; do
substituteInPlace $f \
--replace "\''${LXQT_TRANSLATIONS_DIR}" "''${out}/share/lxqt/translations"
done
'';

buildInputs = [
qtbase
qttools
Expand Down
5 changes: 0 additions & 5 deletions pkgs/desktops/lxqt/lxqt-openssh-askpass/default.nix
Expand Up @@ -26,11 +26,6 @@ mkDerivation rec {
libqtxdg
];

postPatch = ''
substituteInPlace CMakeLists.txt \
--replace "\''${LXQT_TRANSLATIONS_DIR}" "''${out}/share/lxqt/translations"
'';

meta = with lib; {
description = "GUI to query passwords on behalf of SSH agents";
homepage = https://github.com/lxqt/lxqt-openssh-askpass;
Expand Down
14 changes: 0 additions & 14 deletions pkgs/desktops/lxqt/lxqt-panel/default.nix
Expand Up @@ -49,20 +49,6 @@ mkDerivation rec {
libXdamage
];

postPatch = ''
for dir in autostart menu; do
substituteInPlace $dir/CMakeLists.txt \
--replace "DESTINATION \"\''${LXQT_ETC_XDG_DIR}" "DESTINATION \"etc/xdg"
done
substituteInPlace panel/CMakeLists.txt \
--replace "DESTINATION \''${LXQT_ETC_XDG_DIR}" "DESTINATION etc/xdg"
for f in cmake/BuildPlugin.cmake panel/CMakeLists.txt; do
substituteInPlace $f \
--replace "\''${LXQT_TRANSLATIONS_DIR}" "''${out}/share/lxqt/translations"
done
'';

meta = with lib; {
description = "The LXQt desktop panel";
homepage = https://github.com/lxqt/lxqt-panel;
Expand Down
8 changes: 0 additions & 8 deletions pkgs/desktops/lxqt/lxqt-policykit/default.nix
Expand Up @@ -33,14 +33,6 @@ mkDerivation rec {
pcre
];

postPatch = ''
substituteInPlace autostart/CMakeLists.txt \
--replace "DESTINATION \"\''${LXQT_ETC_XDG_DIR}" "DESTINATION \"etc/xdg"
substituteInPlace CMakeLists.txt \
--replace "\''${LXQT_TRANSLATIONS_DIR}" "''${out}/share/lxqt/translations"
'';

meta = with lib; {
description = "The LXQt PolicyKit agent";
homepage = https://github.com/lxqt/lxqt-policykit;
Expand Down
10 changes: 0 additions & 10 deletions pkgs/desktops/lxqt/lxqt-powermanagement/default.nix
Expand Up @@ -28,16 +28,6 @@ mkDerivation rec {
libqtxdg
];

postPatch = ''
substituteInPlace autostart/CMakeLists.txt \
--replace "DESTINATION \"\''${LXQT_ETC_XDG_DIR}" "DESTINATION \"etc/xdg"
for f in {config,src}/CMakeLists.txt; do
substituteInPlace $f \
--replace "\''${LXQT_TRANSLATIONS_DIR}" "''${out}/share/lxqt/translations"
done
'';

meta = with lib; {
description = "Power management module for LXQt";
homepage = https://github.com/lxqt/lxqt-powermanagement;
Expand Down
8 changes: 0 additions & 8 deletions pkgs/desktops/lxqt/lxqt-runner/default.nix
Expand Up @@ -32,14 +32,6 @@ mkDerivation rec {
pcre
];

postPatch = ''
substituteInPlace autostart/CMakeLists.txt \
--replace "DESTINATION \"\''${LXQT_ETC_XDG_DIR}" "DESTINATION \"etc/xdg"
substituteInPlace CMakeLists.txt \
--replace "\''${LXQT_TRANSLATIONS_DIR}" "''${out}/share/lxqt/translations"
'';

meta = with lib; {
description = "Tool used to launch programs quickly by typing their names";
homepage = https://github.com/lxqt/lxqt-runner;
Expand Down
12 changes: 0 additions & 12 deletions pkgs/desktops/lxqt/lxqt-session/default.nix
Expand Up @@ -30,18 +30,6 @@ mkDerivation rec {
xdg-user-dirs
];

postPatch = ''
for dir in autostart config; do
substituteInPlace $dir/CMakeLists.txt \
--replace "DESTINATION \"\''${LXQT_ETC_XDG_DIR}" "DESTINATION \"etc/xdg"
done
for f in lxqt-{config-session,leave,session}/CMakeLists.txt; do
substituteInPlace $f \
--replace "\''${LXQT_TRANSLATIONS_DIR}" "''${out}/share/lxqt/translations"
done
'';

meta = with lib; {
description = "An alternative session manager ported from the original razor-session";
homepage = https://github.com/lxqt/lxqt-session;
Expand Down
5 changes: 0 additions & 5 deletions pkgs/desktops/lxqt/lxqt-sudo/default.nix
Expand Up @@ -27,11 +27,6 @@ mkDerivation rec {
sudo
];

postPatch = ''
substituteInPlace CMakeLists.txt \
--replace "\''${LXQT_TRANSLATIONS_DIR}" "''${out}/share/lxqt/translations"
'';

meta = with lib; {
description = "GUI frontend for sudo/su";
homepage = https://github.com/lxqt/lxqt-sudo;
Expand Down
7 changes: 0 additions & 7 deletions pkgs/desktops/lxqt/lxqt-themes/default.nix
Expand Up @@ -16,13 +16,6 @@ mkDerivation rec {
lxqt-build-tools
];

postPatch = ''
substituteInPlace CMakeLists.txt \
--replace "DESTINATION \"\''${LXQT_GRAPHICS_DIR}" "DESTINATION \"share/lxqt/graphics"
substituteInPlace themes/CMakeLists.txt \
--replace "DESTINATION \"\''${LXQT_SHARE_DIR}" "DESTINATION \"share/lxqt"
'';

meta = with lib; {
description = "Themes, graphics and icons for LXQt";
homepage = https://github.com/lxqt/lxqt-themes;
Expand Down
7 changes: 0 additions & 7 deletions pkgs/desktops/lxqt/pcmanfm-qt/default.nix
Expand Up @@ -28,13 +28,6 @@ mkDerivation rec {
lxmenu-data
];

postPatch = ''
for dir in autostart config; do
substituteInPlace $dir/CMakeLists.txt \
--replace "DESTINATION \"\''${LXQT_ETC_XDG_DIR}" "DESTINATION \"etc/xdg"
done
'';

meta = with lib; {
description = "File manager and desktop icon manager (Qt port of PCManFM and libfm)";
homepage = https://github.com/lxqt/pcmanfm-qt;
Expand Down

0 comments on commit e34de04

Please sign in to comment.