diff --git a/pkgs/development/compilers/swift/swiftpm/setup-hook.sh b/pkgs/development/compilers/swift/swiftpm/setup-hook.sh index 160fbb1ccca3..260d874ebfd7 100644 --- a/pkgs/development/compilers/swift/swiftpm/setup-hook.sh +++ b/pkgs/development/compilers/swift/swiftpm/setup-hook.sh @@ -1,3 +1,5 @@ +# shellcheck shell=bash + # Build using 'swift-build'. swiftpmBuildPhase() { runHook preBuild @@ -8,10 +10,10 @@ swiftpmBuildPhase() { fi local flagsArray=( - -j $buildCores + -j "$buildCores" -c "${swiftpmBuildConfig-release}" - $swiftpmFlags "${swiftpmFlagsArray[@]}" ) + concatTo flagsArray swiftpmFlags swiftpmFlagsArray echoCmd 'build flags' "${flagsArray[@]}" TERM=dumb swift-build "${flagsArray[@]}" @@ -33,10 +35,10 @@ swiftpmCheckPhase() { fi local flagsArray=( - -j $buildCores + -j "$buildCores" -c "${swiftpmBuildConfig-release}" - $swiftpmFlags "${swiftpmFlagsArray[@]}" ) + concatTo flagsArray swiftpmFlags swiftpmFlagsArray echoCmd 'check flags' "${flagsArray[@]}" TERM=dumb swift-test "${flagsArray[@]}" @@ -53,8 +55,8 @@ fi swiftpmBinPath() { local flagsArray=( -c "${swiftpmBuildConfig-release}" - $swiftpmFlags "${swiftpmFlagsArray[@]}" ) + concatTo flagsArray swiftpmFlags swiftpmFlagsArray swift-build --show-bin-path "${flagsArray[@]}" } diff --git a/pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh b/pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh index 6e57c7b1072e..7799d72873a0 100644 --- a/pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh +++ b/pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh @@ -54,7 +54,8 @@ setupCUDAToolkit_ROOT() { fi done - export cmakeFlags+=" -DCUDAToolkit_INCLUDE_DIR=$CUDAToolkit_INCLUDE_DIR -DCUDAToolkit_ROOT=$CUDAToolkit_ROOT" + appendToVar cmakeFlags "-DCUDAToolkit_INCLUDE_DIR=$CUDAToolkit_INCLUDE_DIR" + appendToVar cmakeFlags "-DCUDAToolkit_ROOT=$CUDAToolkit_ROOT" } preConfigureHooks+=(setupCUDAToolkit_ROOT) @@ -72,8 +73,8 @@ setupCUDAToolkitCompilers() { # https://cmake.org/cmake/help/latest/envvar/CUDAHOSTCXX.html # https://cmake.org/cmake/help/latest/variable/CMAKE_CUDA_HOST_COMPILER.html - export cmakeFlags+=" -DCUDA_HOST_COMPILER=@ccFullPath@" - export cmakeFlags+=" -DCMAKE_CUDA_HOST_COMPILER=@ccFullPath@" + appendToVar cmakeFlags "-DCUDA_HOST_COMPILER=@ccFullPath@" + appendToVar cmakeFlags "-DCMAKE_CUDA_HOST_COMPILER=@ccFullPath@" # For non-CMake projects: # We prepend --compiler-bindir to nvcc flags. @@ -85,7 +86,7 @@ setupCUDAToolkitCompilers() { export CUDAHOSTCXX="@ccFullPath@"; fi - export NVCC_PREPEND_FLAGS+=" --compiler-bindir=@ccRoot@/bin" + appendToVar NVCC_PREPEND_FLAGS "--compiler-bindir=@ccRoot@/bin" # NOTE: We set -Xfatbin=-compress-all, which reduces the size of the compiled # binaries. If binaries grow over 2GB, they will fail to link. This is a problem for us, as @@ -94,7 +95,7 @@ setupCUDAToolkitCompilers() { # # @SomeoneSerge: original comment was made by @ConnorBaker in .../cudatoolkit/common.nix if [[ -z "${dontCompressFatbin-}" ]]; then - export NVCC_PREPEND_FLAGS+=" -Xfatbin=-compress-all" + appendToVar NVCC_PREPEND_FLAGS "-Xfatbin=-compress-all" fi } preConfigureHooks+=(setupCUDAToolkitCompilers) diff --git a/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh index 8d86ab1d54ad..e576dbb4ec73 100644 --- a/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh +++ b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh @@ -6,53 +6,53 @@ 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" + appendToVar cmakeFlags "-DKDE_INSTALL_EXECROOTDIR=${!outputBin}" + appendToVar cmakeFlags "-DKDE_INSTALL_BINDIR=${!outputBin}/bin" + appendToVar cmakeFlags "-DKDE_INSTALL_SBINDIR=${!outputBin}/sbin" + appendToVar cmakeFlags "-DKDE_INSTALL_LIBDIR=${!outputLib}/lib" + appendToVar cmakeFlags "-DKDE_INSTALL_LIBEXECDIR=${!outputLib}/libexec" + appendToVar cmakeFlags "-DKDE_INSTALL_CMAKEPACKAGEDIR=${!outputDev}/lib/cmake" + appendToVar cmakeFlags "-DKDE_INSTALL_INCLUDEDIR=${!outputInclude}/include" + appendToVar cmakeFlags "-DKDE_INSTALL_LOCALSTATEDIR=/var" + appendToVar cmakeFlags "-DKDE_INSTALL_DATAROOTDIR=${!outputBin}/share" + appendToVar cmakeFlags "-DKDE_INSTALL_DATADIR=${!outputBin}/share" + appendToVar cmakeFlags "-DKDE_INSTALL_DOCBUNDLEDIR=${!outputBin}/share/doc/HTML" + appendToVar cmakeFlags "-DKDE_INSTALL_KCFGDIR=${!outputBin}/share/config.kcfg" + appendToVar cmakeFlags "-DKDE_INSTALL_KCONFUPDATEDIR=${!outputBin}/share/kconf_update" + appendToVar cmakeFlags "-DKDE_INSTALL_KSERVICES5DIR=${!outputBin}/share/kservices5" + appendToVar cmakeFlags "-DKDE_INSTALL_KSERVICETYPES5DIR=${!outputBin}/share/kservicetypes5" + appendToVar cmakeFlags "-DKDE_INSTALL_KXMLGUI5DIR=${!outputBin}/share/kxmlgui5" + appendToVar cmakeFlags "-DKDE_INSTALL_KNOTIFY5RCDIR=${!outputBin}/share/knotifications5" + appendToVar cmakeFlags "-DKDE_INSTALL_ICONDIR=${!outputBin}/share/icons" + appendToVar cmakeFlags "-DKDE_INSTALL_LOCALEDIR=${!outputLib}/share/locale" + appendToVar cmakeFlags "-DKDE_INSTALL_SOUNDDIR=${!outputBin}/share/sounds" + appendToVar cmakeFlags "-DKDE_INSTALL_TEMPLATEDIR=${!outputBin}/share/templates" + appendToVar cmakeFlags "-DKDE_INSTALL_WALLPAPERDIR=${!outputBin}/share/wallpapers" + appendToVar cmakeFlags "-DKDE_INSTALL_APPDIR=${!outputBin}/share/applications" + appendToVar cmakeFlags "-DKDE_INSTALL_DESKTOPDIR=${!outputBin}/share/desktop-directories" + appendToVar cmakeFlags "-DKDE_INSTALL_MIMEDIR=${!outputBin}/share/mime/packages" + appendToVar cmakeFlags "-DKDE_INSTALL_METAINFODIR=${!outputBin}/share/appdata" + appendToVar cmakeFlags "-DKDE_INSTALL_MANDIR=${!outputBin}/share/man" + appendToVar cmakeFlags "-DKDE_INSTALL_INFODIR=${!outputBin}/share/info" + appendToVar cmakeFlags "-DKDE_INSTALL_DBUSDIR=${!outputBin}/share/dbus-1" + appendToVar cmakeFlags "-DKDE_INSTALL_DBUSINTERFACEDIR=${!outputBin}/share/dbus-1/interfaces" + appendToVar cmakeFlags "-DKDE_INSTALL_DBUSSERVICEDIR=${!outputBin}/share/dbus-1/services" + appendToVar cmakeFlags "-DKDE_INSTALL_DBUSSYSTEMSERVICEDIR=${!outputBin}/share/dbus-1/system-services" + appendToVar cmakeFlags "-DKDE_INSTALL_SYSCONFDIR=${!outputBin}/etc" + appendToVar cmakeFlags "-DKDE_INSTALL_CONFDIR=${!outputBin}/etc/xdg" + appendToVar cmakeFlags "-DKDE_INSTALL_AUTOSTARTDIR=${!outputBin}/etc/xdg/autostart" if [ "$(uname)" = "Darwin" ]; then - cmakeFlags+=" -DKDE_INSTALL_BUNDLEDIR=${!outputBin}/Applications/KDE" + appendToVar cmakeFlags "-DKDE_INSTALL_BUNDLEDIR=${!outputBin}/Applications/KDE" fi if [ -n "${qtPluginPrefix-}" ]; then - cmakeFlags+=" -DKDE_INSTALL_QTPLUGINDIR=${!outputBin}/$qtPluginPrefix" - cmakeFlags+=" -DKDE_INSTALL_PLUGINDIR=${!outputBin}/$qtPluginPrefix" + appendToVar cmakeFlags "-DKDE_INSTALL_QTPLUGINDIR=${!outputBin}/$qtPluginPrefix" + appendToVar cmakeFlags "-DKDE_INSTALL_PLUGINDIR=${!outputBin}/$qtPluginPrefix" fi if [ -n "${qtQmlPrefix-}" ]; then - cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/$qtQmlPrefix" + appendToVar cmakeFlags "-DKDE_INSTALL_QMLDIR=${!outputBin}/$qtQmlPrefix" fi } postHooks+=(ecmPostHook) diff --git a/pkgs/development/tools/build-managers/gradle/setup-hook.sh b/pkgs/development/tools/build-managers/gradle/setup-hook.sh index a16742414b12..6c9c927f0c45 100644 --- a/pkgs/development/tools/build-managers/gradle/setup-hook.sh +++ b/pkgs/development/tools/build-managers/gradle/setup-hook.sh @@ -29,7 +29,9 @@ gradleConfigureHook() { } gradle() { - command gradle $gradleFlags "${gradleFlagsArray[@]}" "$@" + local flagsArray=() + concatTo flagsArray gradleFlags gradleFlagsArray + command gradle "${flagsArray[@]}" "$@" } gradleBuildPhase() { diff --git a/pkgs/development/tools/xcbuild/setup-hook.sh b/pkgs/development/tools/xcbuild/setup-hook.sh index f4b5abf2d8d3..cd8bfa59f1fb 100644 --- a/pkgs/development/tools/xcbuild/setup-hook.sh +++ b/pkgs/development/tools/xcbuild/setup-hook.sh @@ -3,9 +3,12 @@ xcbuildBuildPhase() { runHook preBuild - echo "running xcodebuild" + local flagsArray=() + concatTo flagsArray xcbuildFlags - xcodebuild SYMROOT=$PWD/Products OBJROOT=$PWD/Intermediates $xcbuildFlags build + echoCmd 'running xcodebuild' "${flagsArray[@]}" + + xcodebuild SYMROOT=$PWD/Products OBJROOT=$PWD/Intermediates "${flagsArray[@]}" build runHook postBuild } diff --git a/pkgs/kde/frameworks/extra-cmake-modules/ecm-hook.sh b/pkgs/kde/frameworks/extra-cmake-modules/ecm-hook.sh index 1f60ba1aed92..c635816777f5 100644 --- a/pkgs/kde/frameworks/extra-cmake-modules/ecm-hook.sh +++ b/pkgs/kde/frameworks/extra-cmake-modules/ecm-hook.sh @@ -12,60 +12,60 @@ ecmPostHook() { # Because we need to use absolute paths here, we must set *all* the paths. # Keep this in sync with https://github.com/KDE/extra-cmake-modules/blob/master/kde-modules/KDEInstallDirs6.cmake if [ "$(uname)" = "Darwin" ]; then - cmakeFlags+=" -DKDE_INSTALL_BUNDLEDIR=${!outputBin}/Applications/KDE" + appendToVar cmakeFlags "-DKDE_INSTALL_BUNDLEDIR=${!outputBin}/Applications/KDE" fi - 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" + appendToVar cmakeFlags "-DKDE_INSTALL_EXECROOTDIR=${!outputBin}" + appendToVar cmakeFlags "-DKDE_INSTALL_BINDIR=${!outputBin}/bin" + appendToVar cmakeFlags "-DKDE_INSTALL_SBINDIR=${!outputBin}/sbin" + appendToVar cmakeFlags "-DKDE_INSTALL_LIBDIR=${!outputLib}/lib" + appendToVar cmakeFlags "-DKDE_INSTALL_LIBEXECDIR=${!outputLib}/libexec" + appendToVar cmakeFlags "-DKDE_INSTALL_CMAKEPACKAGEDIR=${!outputDev}/lib/cmake" if [ -n "${qtPluginPrefix-}" ]; then - cmakeFlags+=" -DKDE_INSTALL_QTPLUGINDIR=${!outputBin}/$qtPluginPrefix" - cmakeFlags+=" -DKDE_INSTALL_PLUGINDIR=${!outputBin}/$qtPluginPrefix" + appendToVar cmakeFlags "-DKDE_INSTALL_QTPLUGINDIR=${!outputBin}/$qtPluginPrefix" + appendToVar cmakeFlags "-DKDE_INSTALL_PLUGINDIR=${!outputBin}/$qtPluginPrefix" fi if [ -n "${qtQmlPrefix-}" ]; then - cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/$qtQmlPrefix" + appendToVar cmakeFlags "-DKDE_INSTALL_QMLDIR=${!outputBin}/$qtQmlPrefix" fi - cmakeFlags+=" -DKDE_INSTALL_INCLUDEDIR=${!outputInclude}/include" - cmakeFlags+=" -DKDE_INSTALL_LOCALSTATEDIR=/var" - cmakeFlags+=" -DKDE_INSTALL_SHAREDSTATEDIR=/com" # ??? - 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_KAPPTEMPLATESDIR=${!outputDev}/share/kdevappwizard/templates" - cmakeFlags+=" -DKDE_INSTALL_KFILETEMPLATESDIR=${!outputDev}/share/kdevfiletemplates/templates" - cmakeFlags+=" -DKDE_INSTALL_KXMLGUIDIR=${!outputBin}/share/kxmlgui5" # Yes, this needs to be 5 and not 6. Don't ask. - cmakeFlags+=" -DKDE_INSTALL_KNOTIFYRCDIR=${!outputBin}/share/knotifications6" - 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_QTQCHDIR=${!outputLib}/share/doc/qch" - cmakeFlags+=" -DKDE_INSTALL_QCHDIR=${!outputLib}/share/doc/qch" - 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" - cmakeFlags+=" -DKDE_INSTALL_LOGGINGCATEGORIESDIR=${!outputLib}/share/qlogging-categories6" - cmakeFlags+=" -DKDE_INSTALL_SYSTEMDUNITDIR=${!outputBin}/lib/systemd" - cmakeFlags+=" -DKDE_INSTALL_SYSTEMDUSERUNITDIR=${!outputBin}/share/systemd/user" + appendToVar cmakeFlags "-DKDE_INSTALL_INCLUDEDIR=${!outputInclude}/include" + appendToVar cmakeFlags "-DKDE_INSTALL_LOCALSTATEDIR=/var" + appendToVar cmakeFlags "-DKDE_INSTALL_SHAREDSTATEDIR=/com" # ??? + appendToVar cmakeFlags "-DKDE_INSTALL_DATAROOTDIR=${!outputBin}/share" + appendToVar cmakeFlags "-DKDE_INSTALL_DATADIR=${!outputBin}/share" + appendToVar cmakeFlags "-DKDE_INSTALL_DOCBUNDLEDIR=${!outputBin}/share/doc/HTML" + appendToVar cmakeFlags "-DKDE_INSTALL_KCFGDIR=${!outputBin}/share/config.kcfg" + appendToVar cmakeFlags "-DKDE_INSTALL_KCONFUPDATEDIR=${!outputBin}/share/kconf_update" + appendToVar cmakeFlags "-DKDE_INSTALL_KAPPTEMPLATESDIR=${!outputDev}/share/kdevappwizard/templates" + appendToVar cmakeFlags "-DKDE_INSTALL_KFILETEMPLATESDIR=${!outputDev}/share/kdevfiletemplates/templates" + appendToVar cmakeFlags "-DKDE_INSTALL_KXMLGUIDIR=${!outputBin}/share/kxmlgui5" # Yes, this needs to be 5 and not 6. Don't ask. + appendToVar cmakeFlags "-DKDE_INSTALL_KNOTIFYRCDIR=${!outputBin}/share/knotifications6" + appendToVar cmakeFlags "-DKDE_INSTALL_ICONDIR=${!outputBin}/share/icons" + appendToVar cmakeFlags "-DKDE_INSTALL_LOCALEDIR=${!outputLib}/share/locale" + appendToVar cmakeFlags "-DKDE_INSTALL_SOUNDDIR=${!outputBin}/share/sounds" + appendToVar cmakeFlags "-DKDE_INSTALL_TEMPLATEDIR=${!outputBin}/share/templates" + appendToVar cmakeFlags "-DKDE_INSTALL_WALLPAPERDIR=${!outputBin}/share/wallpapers" + appendToVar cmakeFlags "-DKDE_INSTALL_APPDIR=${!outputBin}/share/applications" + appendToVar cmakeFlags "-DKDE_INSTALL_DESKTOPDIR=${!outputBin}/share/desktop-directories" + appendToVar cmakeFlags "-DKDE_INSTALL_MIMEDIR=${!outputBin}/share/mime/packages" + appendToVar cmakeFlags "-DKDE_INSTALL_METAINFODIR=${!outputBin}/share/appdata" + appendToVar cmakeFlags "-DKDE_INSTALL_QTQCHDIR=${!outputLib}/share/doc/qch" + appendToVar cmakeFlags "-DKDE_INSTALL_QCHDIR=${!outputLib}/share/doc/qch" + appendToVar cmakeFlags "-DKDE_INSTALL_MANDIR=${!outputBin}/share/man" + appendToVar cmakeFlags "-DKDE_INSTALL_INFODIR=${!outputBin}/share/info" + appendToVar cmakeFlags "-DKDE_INSTALL_DBUSDIR=${!outputBin}/share/dbus-1" + appendToVar cmakeFlags "-DKDE_INSTALL_DBUSINTERFACEDIR=${!outputBin}/share/dbus-1/interfaces" + appendToVar cmakeFlags "-DKDE_INSTALL_DBUSSERVICEDIR=${!outputBin}/share/dbus-1/services" + appendToVar cmakeFlags "-DKDE_INSTALL_DBUSSYSTEMSERVICEDIR=${!outputBin}/share/dbus-1/system-services" + appendToVar cmakeFlags "-DKDE_INSTALL_SYSCONFDIR=${!outputBin}/etc" + appendToVar cmakeFlags "-DKDE_INSTALL_CONFDIR=${!outputBin}/etc/xdg" + appendToVar cmakeFlags "-DKDE_INSTALL_AUTOSTARTDIR=${!outputBin}/etc/xdg/autostart" + appendToVar cmakeFlags "-DKDE_INSTALL_LOGGINGCATEGORIESDIR=${!outputLib}/share/qlogging-categories6" + appendToVar cmakeFlags "-DKDE_INSTALL_SYSTEMDUNITDIR=${!outputBin}/lib/systemd" + appendToVar cmakeFlags "-DKDE_INSTALL_SYSTEMDUSERUNITDIR=${!outputBin}/share/systemd/user" } postHooks+=(ecmPostHook) diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/freebsdSetupHook/setup-hook.sh b/pkgs/os-specific/bsd/freebsd/pkgs/freebsdSetupHook/setup-hook.sh index 96a3d14c80f7..ac6e9c12229a 100644 --- a/pkgs/os-specific/bsd/freebsd/pkgs/freebsdSetupHook/setup-hook.sh +++ b/pkgs/os-specific/bsd/freebsd/pkgs/freebsdSetupHook/setup-hook.sh @@ -1,22 +1,22 @@ setFreeBSDSrcTop() { - makeFlags="SRCTOP=$BSDSRCDIR $makeFlags" + prependToVar makeFlags "SRCTOP=$BSDSRCDIR" } addFreeBSDMakeFlags() { - makeFlags="SBINDIR=${!outputBin}/bin $makeFlags" - makeFlags="LIBEXECDIR=${!outputLib}/libexec $makeFlags" - makeFlags="LIBDATADIR=${!outputLib}/data $makeFlags" - makeFlags="INCLUDEDIR=${!outputDev}/include $makeFlags" - makeFlags="CONFDIR=${!outputBin}/etc $makeFlags" - makeFlags="MANDIR=${!outputMan}/share/man/man $makeFlags" + prependToVar makeFlags "SBINDIR=${!outputBin}/bin" + prependToVar makeFlags "LIBEXECDIR=${!outputLib}/libexec" + prependToVar makeFlags "LIBDATADIR=${!outputLib}/data" + prependToVar makeFlags "INCLUDEDIR=${!outputDev}/include" + prependToVar makeFlags "CONFDIR=${!outputBin}/etc" + prependToVar makeFlags "MANDIR=${!outputMan}/share/man/man" if [ -n "$debug" ]; then - makeFlags="DEBUGFILEDIR=${debug}/lib/debug $makeFlags" + prependToVar makeFlags "DEBUGFILEDIR=${debug}/lib/debug" else - makeFlags="DEBUGFILEDIR=${out}/lib/debug $makeFlags" + prependToVar makeFlags "DEBUGFILEDIR=${out}/lib/debug" fi - echo $makeFlags + echoCmd 'FreeBSD makeFlags' "${makeFlags[@]}" } postUnpackHooks+=(setFreeBSDSrcTop) diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix b/pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix index 40113028bbf1..56db4901c6a8 100644 --- a/pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix +++ b/pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix @@ -74,7 +74,7 @@ mkDerivation ( # Makefiles only invoke `$OBJCOPY -x/-X`, so cctools strip works here. "OBJCOPY=${cctools}/bin/strip" ]; - RENAME = "-D"; + env.RENAME = "-D"; passthru.tests = { netbsd-install = install; diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/netbsdSetupHook/setup-hook.sh b/pkgs/os-specific/bsd/netbsd/pkgs/netbsdSetupHook/setup-hook.sh index 8c3742a76534..d05461ad10cb 100644 --- a/pkgs/os-specific/bsd/netbsd/pkgs/netbsdSetupHook/setup-hook.sh +++ b/pkgs/os-specific/bsd/netbsd/pkgs/netbsdSetupHook/setup-hook.sh @@ -1,6 +1,6 @@ addNetBSDMakeFlags() { - makeFlags="INCSDIR=${!outputDev}/include $makeFlags" - makeFlags="MANDIR=${!outputMan}/share/man $makeFlags" + prependToVar makeFlags "INCSDIR=${!outputDev}/include" + prependToVar makeFlags "MANDIR=${!outputMan}/share/man" } preConfigureHooks+=(addNetBSDMakeFlags) diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/openbsdSetupHook/setup-hook.sh b/pkgs/os-specific/bsd/openbsd/pkgs/openbsdSetupHook/setup-hook.sh index c0fee276fea3..e06dbda37c40 100644 --- a/pkgs/os-specific/bsd/openbsd/pkgs/openbsdSetupHook/setup-hook.sh +++ b/pkgs/os-specific/bsd/openbsd/pkgs/openbsdSetupHook/setup-hook.sh @@ -1,6 +1,6 @@ addOpenBSDMakeFlags() { - makeFlags="INCSDIR=${!outputDev}/include $makeFlags" - makeFlags="MANDIR=${!outputMan}/share/man $makeFlags" + prependToVar makeFlags "INCSDIR=${!outputDev}/include" + prependToVar makeFlags "MANDIR=${!outputMan}/share/man" } fixOpenBSDInstallDirs() { diff --git a/pkgs/os-specific/bsd/setup-hook.sh b/pkgs/os-specific/bsd/setup-hook.sh index bc8d372ca8b8..08dfdd4b14b6 100644 --- a/pkgs/os-specific/bsd/setup-hook.sh +++ b/pkgs/os-specific/bsd/setup-hook.sh @@ -1,3 +1,5 @@ +# shellcheck shell=bash disable=SC2154,SC2164 + # BSD makefiles should be able to detect this # but without they end up using gcc on Darwin stdenv addMakeFlags() { @@ -35,38 +37,38 @@ addMakeFlags() { export MKUNPRIVED=yes export EXTERNAL_TOOLCHAIN=yes - makeFlags="MACHINE=$MACHINE $makeFlags" - makeFlags="MACHINE_ARCH=$MACHINE_ARCH $makeFlags" - makeFlags="AR=$AR $makeFlags" - makeFlags="CC=$CC $makeFlags" - makeFlags="CPP=$CPP $makeFlags" - makeFlags="CXX=$CXX $makeFlags" - makeFlags="LD=$LD $makeFlags" - makeFlags="STRIP=$STRIP $makeFlags" + prependToVar makeFlags "MACHINE=$MACHINE" + prependToVar makeFlags "MACHINE_ARCH=$MACHINE_ARCH" + prependToVar makeFlags "AR=$AR" + prependToVar makeFlags "CC=$CC" + prependToVar makeFlags "CPP=$CPP" + prependToVar makeFlags "CXX=$CXX" + prependToVar makeFlags "LD=$LD" + prependToVar makeFlags "STRIP=$STRIP" - makeFlags="BINDIR=${!outputBin}/bin $makeFlags" - makeFlags="LIBDIR=${!outputLib}/lib $makeFlags" - makeFlags="SHLIBDIR=${!outputLib}/lib $makeFlags" - makeFlags="SHAREDIR=${!outputLib}/share $makeFlags" - makeFlags="INFODIR=${!outputInfo}/share/info $makeFlags" - makeFlags="DOCDIR=${!outputDoc}/share/doc $makeFlags" - makeFlags="LOCALEDIR=${!outputLib}/share/locale $makeFlags" + prependToVar makeFlags "BINDIR=${!outputBin}/bin" + prependToVar makeFlags "LIBDIR=${!outputLib}/lib" + prependToVar makeFlags "SHLIBDIR=${!outputLib}/lib" + prependToVar makeFlags "SHAREDIR=${!outputLib}/share" + prependToVar makeFlags "INFODIR=${!outputInfo}/share/info" + prependToVar makeFlags "DOCDIR=${!outputDoc}/share/doc" + prependToVar makeFlags "LOCALEDIR=${!outputLib}/share/locale" # Parallel building. Needs the space. - makeFlags="-j $NIX_BUILD_CORES $makeFlags" + prependToVar makeFlags "-j $NIX_BUILD_CORES" } setBSDSourceDir() { sourceRoot=$PWD/$sourceRoot export BSDSRCDIR=$sourceRoot export _SRC_TOP_=$BSDSRCDIR - cd $sourceRoot + cd "$sourceRoot" } cdBSDPath() { if [ -d "$COMPONENT_PATH" ] then sourceRoot=$sourceRoot/$COMPONENT_PATH - cd $COMPONENT_PATH + cd "$COMPONENT_PATH" fi } @@ -74,10 +76,9 @@ includesPhase() { if [ -z "${skipIncludesPhase:-}" ]; then runHook preIncludes - local flagsArray=( - $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} - includes - ) + local flagsArray=() + concatTo flagsArray makeFlags makeFlagsArray + flagsArray+=(includes) echoCmd 'includes flags' "${flagsArray[@]}" make ${makefile:+-f $makefile} "${flagsArray[@]}" @@ -89,19 +90,19 @@ includesPhase() { } moveUsrDir() { - if [ -d $prefix ]; then + if [ -d "$prefix" ]; then # Remove lingering /usr references - if [ -d $prefix/usr ]; then + if [ -d "$prefix/usr" ]; then # Didn't try using rsync yet because per # https://unix.stackexchange.com/questions/127712/merging-folders-with-mv, # it's not neessarily better. - pushd $prefix/usr - find . -type d -exec mkdir -p $out/\{} \; - find . \( -type f -o -type l \) -exec mv \{} $out/\{} \; + pushd "$prefix/usr" + find . -type d -exec mkdir -p "$out/{}" \; + find . \( -type f -o -type l \) -exec mv "{}" "$out/{}" \; popd fi - find $prefix -type d -empty -delete + find "$prefix" -type d -empty -delete fi }