diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules')
3 files changed, 174 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/default.nix b/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/default.nix new file mode 100644 index 000000000000..0aa400c644d6 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/default.nix @@ -0,0 +1,22 @@ +{ mkDerivation, lib, cmake, pkg-config }: + +mkDerivation { + name = "extra-cmake-modules"; + + patches = [ + ./nix-lib-path.patch + ]; + + outputs = [ "out" ]; # this package has no runtime components + + propagatedBuildInputs = [ cmake pkg-config ]; + + setupHook = ./setup-hook.sh; + + meta = with lib; { + platforms = platforms.linux ++ platforms.darwin; + homepage = "http://www.kde.org"; + license = licenses.bsd2; + maintainers = [ maintainers.ttuegel ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/nix-lib-path.patch b/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/nix-lib-path.patch new file mode 100644 index 000000000000..804fffc8fdcb --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/nix-lib-path.patch @@ -0,0 +1,40 @@ +diff --git a/kde-modules/KDEInstallDirs.cmake b/kde-modules/KDEInstallDirs.cmake +index c1d056b..d9e19f0 100644 +--- a/kde-modules/KDEInstallDirs.cmake ++++ b/kde-modules/KDEInstallDirs.cmake +@@ -242,35 +242,6 @@ + # GNUInstallDirs code deals with re-configuring, but that is dealt with + # by the _define_* macros in this module). + set(_LIBDIR_DEFAULT "lib") +-# Override this default 'lib' with 'lib64' if: +-# - we are on a Linux, kFreeBSD or Hurd system but NOT cross-compiling +-# - we are NOT on debian +-# - we are NOT on flatpak +-# - we are on a 64 bits system +-# reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf +-# For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if +-# CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu" +-# See https://wiki.debian.org/Multiarch +-if((CMAKE_SYSTEM_NAME MATCHES "Linux|kFreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "GNU") +- AND NOT CMAKE_CROSSCOMPILING +- AND NOT EXISTS "/etc/arch-release" +- AND NOT DEFINED ENV{FLATPAK_ID}) +- if (EXISTS "/etc/debian_version") # is this a debian system ? +- if(CMAKE_LIBRARY_ARCHITECTURE) +- set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}") +- endif() +- else() # not debian, rely on CMAKE_SIZEOF_VOID_P: +- if(NOT DEFINED CMAKE_SIZEOF_VOID_P) +- message(AUTHOR_WARNING +- "Unable to determine default LIB_INSTALL_LIBDIR directory because no target architecture is known. " +- "Please enable at least one language before including KDEInstallDirs.") +- else() +- if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") +- set(_LIBDIR_DEFAULT "lib64") +- endif() +- endif() +- endif() +-endif() + + set(_gnu_install_dirs_vars + BINDIR diff --git a/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh b/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh new file mode 100644 index 000000000000..4135f6bfd7aa --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh @@ -0,0 +1,112 @@ +ecmEnvHook() { + addToSearchPath XDG_DATA_DIRS "$1/share" + addToSearchPath XDG_CONFIG_DIRS "$1/etc/xdg" +} +addEnvHooks "$targetOffset" ecmEnvHook + +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}/libexec" + cmakeFlags+=" -DKDE_INSTALL_CMAKEPACKAGEDIR=${!outputDev}/lib/cmake" + cmakeFlags+=" -DKDE_INSTALL_INCLUDEDIR=${!outputInclude}/include" + cmakeFlags+=" -DKDE_INSTALL_LOCALSTATEDIR=/var" + cmakeFlags+=" -DKDE_INSTALL_DATAROOTDIR=${!outputBin}/share" + cmakeFlags+=" -DKDE_INSTALL_DATADIR=${!outputBin}/share" + cmakeFlags+=" -DKDE_INSTALL_DOCBUNDLEDIR=${!outputBin}/share/doc/HTML" + cmakeFlags+=" -DKDE_INSTALL_KCFGDIR=${!outputBin}/share/config.kcfg" + cmakeFlags+=" -DKDE_INSTALL_KCONFUPDATEDIR=${!outputBin}/share/kconf_update" + cmakeFlags+=" -DKDE_INSTALL_KSERVICES5DIR=${!outputBin}/share/kservices5" + cmakeFlags+=" -DKDE_INSTALL_KSERVICETYPES5DIR=${!outputBin}/share/kservicetypes5" + cmakeFlags+=" -DKDE_INSTALL_KXMLGUI5DIR=${!outputBin}/share/kxmlgui5" + cmakeFlags+=" -DKDE_INSTALL_KNOTIFY5RCDIR=${!outputBin}/share/knotifications5" + cmakeFlags+=" -DKDE_INSTALL_ICONDIR=${!outputBin}/share/icons" + cmakeFlags+=" -DKDE_INSTALL_LOCALEDIR=${!outputLib}/share/locale" + cmakeFlags+=" -DKDE_INSTALL_SOUNDDIR=${!outputBin}/share/sounds" + cmakeFlags+=" -DKDE_INSTALL_TEMPLATEDIR=${!outputBin}/share/templates" + cmakeFlags+=" -DKDE_INSTALL_WALLPAPERDIR=${!outputBin}/share/wallpapers" + cmakeFlags+=" -DKDE_INSTALL_APPDIR=${!outputBin}/share/applications" + cmakeFlags+=" -DKDE_INSTALL_DESKTOPDIR=${!outputBin}/share/desktop-directories" + cmakeFlags+=" -DKDE_INSTALL_MIMEDIR=${!outputBin}/share/mime/packages" + cmakeFlags+=" -DKDE_INSTALL_METAINFODIR=${!outputBin}/share/appdata" + cmakeFlags+=" -DKDE_INSTALL_MANDIR=${!outputBin}/share/man" + cmakeFlags+=" -DKDE_INSTALL_INFODIR=${!outputBin}/share/info" + cmakeFlags+=" -DKDE_INSTALL_DBUSDIR=${!outputBin}/share/dbus-1" + cmakeFlags+=" -DKDE_INSTALL_DBUSINTERFACEDIR=${!outputBin}/share/dbus-1/interfaces" + cmakeFlags+=" -DKDE_INSTALL_DBUSSERVICEDIR=${!outputBin}/share/dbus-1/services" + cmakeFlags+=" -DKDE_INSTALL_DBUSSYSTEMSERVICEDIR=${!outputBin}/share/dbus-1/system-services" + cmakeFlags+=" -DKDE_INSTALL_SYSCONFDIR=${!outputBin}/etc" + cmakeFlags+=" -DKDE_INSTALL_CONFDIR=${!outputBin}/etc/xdg" + cmakeFlags+=" -DKDE_INSTALL_AUTOSTARTDIR=${!outputBin}/etc/xdg/autostart" + + if [ -n "${qtPluginPrefix-}" ]; then + cmakeFlags+=" -DKDE_INSTALL_QTPLUGINDIR=${!outputBin}/$qtPluginPrefix" + cmakeFlags+=" -DKDE_INSTALL_PLUGINDIR=${!outputBin}/$qtPluginPrefix" + fi + + if [ -n "${qtQmlPrefix-}" ]; then + cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/$qtQmlPrefix" + fi +} +postHooks+=(ecmPostHook) + +xdgDataSubdirs=( \ + "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 + + if [ -d "$1/dbus-1" ] + then + propagatedUserEnvPkgs+=" $1" + fi +} +addEnvHooks "$targetOffset" ecmHostPathHook |