Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 117 lines 4.7 kB view raw
1ecmEnvHook() { 2 addToSearchPath XDG_DATA_DIRS "$1/share" 3 addToSearchPath XDG_CONFIG_DIRS "$1/etc/xdg" 4} 5addEnvHooks "$targetOffset" ecmEnvHook 6 7ecmPostHook() { 8 # Because we need to use absolute paths here, we must set *all* the paths. 9 cmakeFlags+=" -DKDE_INSTALL_EXECROOTDIR=${!outputBin}" 10 cmakeFlags+=" -DKDE_INSTALL_BINDIR=${!outputBin}/bin" 11 cmakeFlags+=" -DKDE_INSTALL_SBINDIR=${!outputBin}/sbin" 12 cmakeFlags+=" -DKDE_INSTALL_LIBDIR=${!outputLib}/lib" 13 cmakeFlags+=" -DKDE_INSTALL_LIBEXECDIR=${!outputLib}/libexec" 14 cmakeFlags+=" -DKDE_INSTALL_CMAKEPACKAGEDIR=${!outputDev}/lib/cmake" 15 cmakeFlags+=" -DKDE_INSTALL_INCLUDEDIR=${!outputInclude}/include" 16 cmakeFlags+=" -DKDE_INSTALL_LOCALSTATEDIR=/var" 17 cmakeFlags+=" -DKDE_INSTALL_DATAROOTDIR=${!outputBin}/share" 18 cmakeFlags+=" -DKDE_INSTALL_DATADIR=${!outputBin}/share" 19 cmakeFlags+=" -DKDE_INSTALL_DOCBUNDLEDIR=${!outputBin}/share/doc/HTML" 20 cmakeFlags+=" -DKDE_INSTALL_KCFGDIR=${!outputBin}/share/config.kcfg" 21 cmakeFlags+=" -DKDE_INSTALL_KCONFUPDATEDIR=${!outputBin}/share/kconf_update" 22 cmakeFlags+=" -DKDE_INSTALL_KSERVICES5DIR=${!outputBin}/share/kservices5" 23 cmakeFlags+=" -DKDE_INSTALL_KSERVICETYPES5DIR=${!outputBin}/share/kservicetypes5" 24 cmakeFlags+=" -DKDE_INSTALL_KXMLGUI5DIR=${!outputBin}/share/kxmlgui5" 25 cmakeFlags+=" -DKDE_INSTALL_KNOTIFY5RCDIR=${!outputBin}/share/knotifications5" 26 cmakeFlags+=" -DKDE_INSTALL_ICONDIR=${!outputBin}/share/icons" 27 cmakeFlags+=" -DKDE_INSTALL_LOCALEDIR=${!outputLib}/share/locale" 28 cmakeFlags+=" -DKDE_INSTALL_SOUNDDIR=${!outputBin}/share/sounds" 29 cmakeFlags+=" -DKDE_INSTALL_TEMPLATEDIR=${!outputBin}/share/templates" 30 cmakeFlags+=" -DKDE_INSTALL_WALLPAPERDIR=${!outputBin}/share/wallpapers" 31 cmakeFlags+=" -DKDE_INSTALL_APPDIR=${!outputBin}/share/applications" 32 cmakeFlags+=" -DKDE_INSTALL_DESKTOPDIR=${!outputBin}/share/desktop-directories" 33 cmakeFlags+=" -DKDE_INSTALL_MIMEDIR=${!outputBin}/share/mime/packages" 34 cmakeFlags+=" -DKDE_INSTALL_METAINFODIR=${!outputBin}/share/appdata" 35 cmakeFlags+=" -DKDE_INSTALL_MANDIR=${!outputBin}/share/man" 36 cmakeFlags+=" -DKDE_INSTALL_INFODIR=${!outputBin}/share/info" 37 cmakeFlags+=" -DKDE_INSTALL_DBUSDIR=${!outputBin}/share/dbus-1" 38 cmakeFlags+=" -DKDE_INSTALL_DBUSINTERFACEDIR=${!outputBin}/share/dbus-1/interfaces" 39 cmakeFlags+=" -DKDE_INSTALL_DBUSSERVICEDIR=${!outputBin}/share/dbus-1/services" 40 cmakeFlags+=" -DKDE_INSTALL_DBUSSYSTEMSERVICEDIR=${!outputBin}/share/dbus-1/system-services" 41 cmakeFlags+=" -DKDE_INSTALL_SYSCONFDIR=${!outputBin}/etc" 42 cmakeFlags+=" -DKDE_INSTALL_CONFDIR=${!outputBin}/etc/xdg" 43 cmakeFlags+=" -DKDE_INSTALL_AUTOSTARTDIR=${!outputBin}/etc/xdg/autostart" 44 45 if [ "$(uname)" = "Darwin" ]; then 46 cmakeFlags+=" -DKDE_INSTALL_BUNDLEDIR=${!outputBin}/Applications/KDE" 47 fi 48 49 if [ -n "${qtPluginPrefix-}" ]; then 50 cmakeFlags+=" -DKDE_INSTALL_QTPLUGINDIR=${!outputBin}/$qtPluginPrefix" 51 cmakeFlags+=" -DKDE_INSTALL_PLUGINDIR=${!outputBin}/$qtPluginPrefix" 52 fi 53 54 if [ -n "${qtQmlPrefix-}" ]; then 55 cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/$qtQmlPrefix" 56 fi 57} 58postHooks+=(ecmPostHook) 59 60xdgDataSubdirs=( \ 61 "config.kcfg" "kconf_update" "kservices5" "kservicetypes5" \ 62 "kxmlgui5" "knotifications5" "icons" "locale" "sounds" "templates" \ 63 "wallpapers" "applications" "desktop-directories" "mime" "appdata" "dbus-1" \ 64) 65 66# ecmHostPathsSeen is an associative array of the paths that have already been 67# seen by ecmHostPathHook. 68declare -gA ecmHostPathsSeen 69 70ecmHostPathIsNotSeen() { 71 if [[ -n "${ecmHostPathsSeen["$1"]:-}" ]]; then 72 # The path has been seen before. 73 return 1 74 else 75 # The path has not been seen before. 76 # Now it is seen, so record it. 77 ecmHostPathsSeen["$1"]=1 78 return 0 79 fi 80} 81 82ecmHostPathHook() { 83 ecmHostPathIsNotSeen "$1" || return 0 84 85 local xdgConfigDir="$1/etc/xdg" 86 if [ -d "$xdgConfigDir" ] 87 then 88 qtWrapperArgs+=(--prefix XDG_CONFIG_DIRS : "$xdgConfigDir") 89 fi 90 91 for xdgDataSubdir in "${xdgDataSubdirs[@]}" 92 do 93 if [ -d "$1/share/$xdgDataSubdir" ] 94 then 95 qtWrapperArgs+=(--prefix XDG_DATA_DIRS : "$1/share") 96 break 97 fi 98 done 99 100 local manDir="$1/man" 101 if [ -d "$manDir" ] 102 then 103 qtWrapperArgs+=(--prefix MANPATH : "$manDir") 104 fi 105 106 local infoDir="$1/info" 107 if [ -d "$infoDir" ] 108 then 109 qtWrapperArgs+=(--prefix INFOPATH : "$infoDir") 110 fi 111 112 if [ -d "$1/dbus-1" ] 113 then 114 propagatedUserEnvPkgs+=" $1" 115 fi 116} 117addEnvHooks "$targetOffset" ecmHostPathHook