···11+From 3cc148e878b69fc3e0228f3e3bf1bbe689dad87c Mon Sep 17 00:00:00 2001
22+From: Thomas Tuegel <ttuegel@gmail.com>
33+Date: Fri, 20 Feb 2015 23:17:39 -0600
44+Subject: [PATCH] extra-cmake-modules paths
55+66+---
77+ kde-modules/KDEInstallDirs.cmake | 37 ++++---------------------------------
88+ 1 file changed, 4 insertions(+), 33 deletions(-)
99+1010+diff --git a/kde-modules/KDEInstallDirs.cmake b/kde-modules/KDEInstallDirs.cmake
1111+index b7cd34d..2f868ac 100644
1212+--- a/kde-modules/KDEInstallDirs.cmake
1313++++ b/kde-modules/KDEInstallDirs.cmake
1414+@@ -193,37 +193,8 @@
1515+ # (To distribute this file outside of extra-cmake-modules, substitute the full
1616+ # License text for the above reference.)
1717+1818+-# Figure out what the default install directory for libraries should be.
1919+-# This is based on the logic in GNUInstallDirs, but simplified (the
2020+-# GNUInstallDirs code deals with re-configuring, but that is dealt with
2121+-# by the _define_* macros in this module).
2222++# The default library directory on NixOS is *always* /lib.
2323+ set(_LIBDIR_DEFAULT "lib")
2424+-# Override this default 'lib' with 'lib64' iff:
2525+-# - we are on a Linux, kFreeBSD or Hurd system but NOT cross-compiling
2626+-# - we are NOT on debian
2727+-# - we are on a 64 bits system
2828+-# reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
2929+-# For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if
3030+-# CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu"
3131+-# See http://wiki.debian.org/Multiarch
3232+-if((CMAKE_SYSTEM_NAME MATCHES "Linux|kFreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "GNU")
3333+- AND NOT CMAKE_CROSSCOMPILING)
3434+- if (EXISTS "/etc/debian_version") # is this a debian system ?
3535+- if(CMAKE_LIBRARY_ARCHITECTURE)
3636+- set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
3737+- endif()
3838+- else() # not debian, rely on CMAKE_SIZEOF_VOID_P:
3939+- if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
4040+- message(AUTHOR_WARNING
4141+- "Unable to determine default LIB_INSTALL_LIBDIR directory because no target architecture is known. "
4242+- "Please enable at least one language before including KDEInstallDirs.")
4343+- else()
4444+- if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
4545+- set(_LIBDIR_DEFAULT "lib64")
4646+- endif()
4747+- endif()
4848+- endif()
4949+-endif()
5050+5151+ set(_gnu_install_dirs_vars
5252+ BINDIR
5353+@@ -445,15 +416,15 @@ if(KDE_INSTALL_USE_QT_SYS_PATHS)
5454+ "QtQuick2 imports"
5555+ QML_INSTALL_DIR)
5656+ else()
5757+- _define_relative(QTPLUGINDIR LIBDIR "plugins"
5858++ _define_relative(QTPLUGINDIR LIBDIR "qt5/plugins"
5959+ "Qt plugins"
6060+ QT_PLUGIN_INSTALL_DIR)
6161+6262+- _define_relative(QTQUICKIMPORTSDIR QTPLUGINDIR "imports"
6363++ _define_relative(QTQUICKIMPORTSDIR QTPLUGINDIR "qt5/imports"
6464+ "QtQuick1 imports"
6565+ IMPORTS_INSTALL_DIR)
6666+6767+- _define_relative(QMLDIR LIBDIR "qml"
6868++ _define_relative(QMLDIR LIBDIR "qt5/qml"
6969+ "QtQuick2 imports"
7070+ QML_INSTALL_DIR)
7171+ endif()
7272+--
7373+2.3.0
7474+
···11+{ kdeFramework, lib, stdenv, cmake, pkgconfig, qttools }:
22+33+kdeFramework {
44+ name = "extra-cmake-modules";
55+ patches = [ ./0001-extra-cmake-modules-paths.patch ];
66+77+ setupHook = ./setup-hook.sh;
88+99+ # It is OK to propagate these inputs as long as
1010+ # extra-cmake-modules is never a propagated input
1111+ # of some other derivation.
1212+ propagatedNativeBuildInputs = [ cmake pkgconfig qttools ];
1313+1414+ meta = {
1515+ license = stdenv.lib.licenses.bsd2;
1616+ maintainers = [ lib.maintainers.ttuegel ];
1717+ };
1818+}
···11+addMimePkg() {
22+ local propagated
33+44+ if [[ -d "$1/share/mime" ]]; then
55+ propagated=
66+ for pkg in $propagatedBuildInputs; do
77+ if [[ "z$pkg" == "z$1" ]]; then
88+ propagated=1
99+ fi
1010+ done
1111+ if [[ -z $propagated ]]; then
1212+ propagatedBuildInputs="$propagatedBuildInputs $1"
1313+ fi
1414+1515+ propagated=
1616+ for pkg in $propagatedUserEnvPkgs; do
1717+ if [[ "z$pkg" == "z$1" ]]; then
1818+ propagated=1
1919+ fi
2020+ done
2121+ if [[ -z $propagated ]]; then
2222+ propagatedUserEnvPkgs="$propagatedUserEnvPkgs $1"
2323+ fi
2424+ fi
2525+}
2626+2727+envHooks+=(addMimePkg)
···11+addServicePkg() {
22+ local propagated
33+ for dir in "share/kservices5" "share/kservicetypes5"; do
44+ if [[ -d "$1/$dir" ]]; then
55+ propagated=
66+ for pkg in $propagatedBuildInputs; do
77+ if [[ "z$pkg" == "z$1" ]]; then
88+ propagated=1
99+ break
1010+ fi
1111+ done
1212+ if [[ -z $propagated ]]; then
1313+ propagatedBuildInputs="$propagatedBuildInputs $1"
1414+ fi
1515+1616+ propagated=
1717+ for pkg in $propagatedUserEnvPkgs; do
1818+ if [[ "z$pkg" == "z$1" ]]; then
1919+ propagated=1
2020+ break
2121+ fi
2222+ done
2323+ if [[ -z $propagated ]]; then
2424+ propagatedUserEnvPkgs="$propagatedUserEnvPkgs $1"
2525+ fi
2626+2727+ break
2828+ fi
2929+ done
3030+}
3131+3232+envHooks+=(addServicePkg)
3333+3434+local propagated
3535+for pkg in $propagatedBuildInputs; do
3636+ if [[ "z$pkg" == "z@out@" ]]; then
3737+ propagated=1
3838+ break
3939+ fi
4040+done
4141+if [[ -z $propagated ]]; then
4242+ propagatedBuildInputs="$propagatedBuildInputs @out@"
4343+fi