diff --git a/pkgs/applications/graphics/pikopixel/default.nix b/pkgs/applications/graphics/pikopixel/default.nix index 816d9af62aa3..f8719cc0a4cd 100644 --- a/pkgs/applications/graphics/pikopixel/default.nix +++ b/pkgs/applications/graphics/pikopixel/default.nix @@ -1,9 +1,10 @@ { lib +, clangStdenv , fetchurl , gnustep }: -gnustep.gsmakeDerivation rec { +clangStdenv.mkDerivation rec { pname = "pikopixel"; version = "1.0-b10"; @@ -14,6 +15,11 @@ gnustep.gsmakeDerivation rec { sourceRoot = "PikoPixel.Sources.${version}/PikoPixel"; + nativeBuildInputs = [ + gnustep.make + gnustep.wrapGNUstepAppsHook + ]; + buildInputs = [ gnustep.base gnustep.gui diff --git a/pkgs/applications/window-managers/owl/default.nix b/pkgs/applications/window-managers/owl/default.nix index fa9ea8e8b6a1..d3f018eb1202 100644 --- a/pkgs/applications/window-managers/owl/default.nix +++ b/pkgs/applications/window-managers/owl/default.nix @@ -1,5 +1,5 @@ { lib -, stdenv +, clangStdenv , fetchFromGitHub , gnustep , libxkbcommon @@ -12,9 +12,10 @@ assert wayland.withLibraries; let - mkDerivation = if stdenv.isDarwin then stdenv.mkDerivation else gnustep.gsmakeDerivation; + stdenv = clangStdenv; in -mkDerivation { + +stdenv.mkDerivation { pname = "owl-compositor"; version = "unstable-2021-11-10"; @@ -43,6 +44,7 @@ mkDerivation { darwin.bootstrap_cmds ] ++ lib.optionals (!stdenv.isDarwin) [ gnustep.make + gnustep.wrapGNUstepAppsHook ]; buildInputs = [ diff --git a/pkgs/desktops/gnustep/back/default.nix b/pkgs/desktops/gnustep/back/default.nix index 867c82881c1a..370143e1269f 100644 --- a/pkgs/desktops/gnustep/back/default.nix +++ b/pkgs/desktops/gnustep/back/default.nix @@ -1,7 +1,11 @@ -{ gsmakeDerivation +{ lib +, stdenv +, make +, wrapGNUstepAppsHook , cairo , fetchzip -, base, gui +, base +, gui , fontconfig , freetype , pkg-config @@ -9,18 +13,23 @@ , libXmu }: -gsmakeDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "gnustep-back"; version = "0.30.0"; src = fetchzip { - url = "ftp://ftp.gnustep.org/pub/gnustep/core/${pname}-${version}.tar.gz"; + url = "ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-back-${finalAttrs.version}.tar.gz"; sha256 = "sha256-HD4PLdkE573nPWqFwffUmcHw8VYIl5rLiPKWrbnwpCI="; }; - nativeBuildInputs = [ pkg-config ]; + nativeBuildInputs = [ make pkg-config wrapGNUstepAppsHook ]; buildInputs = [ cairo base gui fontconfig freetype libXft libXmu ]; + meta = { description = "A generic backend for GNUstep"; + homepage = "https://gnustep.github.io/"; + license = lib.licenses.lgpl2Plus; + maintainers = with lib.maintainers; [ ashalkhakov matthewbauer dblsaiko ]; + platforms = lib.platforms.linux; }; -} +}) diff --git a/pkgs/desktops/gnustep/base/default.nix b/pkgs/desktops/gnustep/base/default.nix index 3803a88ce191..acda20c817d6 100644 --- a/pkgs/desktops/gnustep/base/default.nix +++ b/pkgs/desktops/gnustep/base/default.nix @@ -1,26 +1,40 @@ -{ aspell, audiofile -, gsmakeDerivation +{ lib +, stdenv +, aspell +, audiofile +, make +, wrapGNUstepAppsHook , cups , fetchzip , fetchpatch -, gmp, gnutls -, libffi, binutils-unwrapped -, libjpeg, libtiff, libpng, giflib -, libxml2, libxslt, libiconv -, libobjc, libgcrypt +, gmp +, gnutls +, libffi +, binutils-unwrapped +, libjpeg +, libtiff +, libpng +, giflib +, libxml2 +, libxslt +, libiconv +, libobjc +, libgcrypt , icu -, pkg-config, portaudio +, pkg-config +, portaudio , libiberty }: -gsmakeDerivation rec { + +stdenv.mkDerivation (finalAttrs: { pname = "gnustep-base"; version = "1.29.0"; src = fetchzip { - url = "ftp://ftp.gnustep.org/pub/gnustep/core/${pname}-${version}.tar.gz"; + url = "ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-base-${finalAttrs.version}.tar.gz"; hash = "sha256-4fjdsLBsYEDxLOFrq17dKii2sLKvOaFCu0cw3qQtM5U="; }; outputs = [ "out" "dev" "lib" ]; - nativeBuildInputs = [ pkg-config ]; + nativeBuildInputs = [ pkg-config make wrapGNUstepAppsHook ]; propagatedBuildInputs = [ aspell audiofile cups @@ -55,7 +69,11 @@ gsmakeDerivation rec { ]; meta = { + changelog = "https://github.com/gnustep/libs-base/releases/tag/base-${builtins.replaceStrings [ "." ] [ "_" ] finalAttrs.version}"; description = "An implementation of AppKit and Foundation libraries of OPENSTEP and Cocoa"; - changelog = "https://github.com/gnustep/libs-base/releases/tag/base-${builtins.replaceStrings [ "." ] [ "_" ] version}"; + homepage = "https://gnustep.github.io/"; + license = lib.licenses.lgpl2Plus; + maintainers = with lib.maintainers; [ ashalkhakov matthewbauer dblsaiko ]; + platforms = lib.platforms.linux; }; -} +}) diff --git a/pkgs/desktops/gnustep/default.nix b/pkgs/desktops/gnustep/default.nix index d337512dceca..53040ace672d 100644 --- a/pkgs/desktops/gnustep/default.nix +++ b/pkgs/desktops/gnustep/default.nix @@ -5,18 +5,21 @@ let callPackage = newScope self; - self = rec { + self = { stdenv = llvmPackages.stdenv; - gsmakeDerivation = callPackage ./make/gsmakeDerivation.nix {}; + wrapGNUstepAppsHook = callPackage ./wrapGNUstepAppsHook.nix {}; + + make = callPackage ./make {}; + + libobjc = callPackage ./libobjc2 {}; + base = callPackage ./base {}; + back = callPackage ./back {}; + gui = callPackage ./gui {}; + gorm = callPackage ./gorm {}; projectcenter = callPackage ./projectcenter {}; system_preferences = callPackage ./systempreferences {}; - libobjc = callPackage ./libobjc2 {}; - make = callPackage ./make {}; - back = callPackage ./back {}; - base = callPackage ./base { }; - gui = callPackage ./gui {}; gworkspace = callPackage ./gworkspace {}; }; diff --git a/pkgs/desktops/gnustep/gorm/default.nix b/pkgs/desktops/gnustep/gorm/default.nix index 0897ceefdba6..f48600263447 100644 --- a/pkgs/desktops/gnustep/gorm/default.nix +++ b/pkgs/desktops/gnustep/gorm/default.nix @@ -1,15 +1,31 @@ -{ fetchzip, base, back, gsmakeDerivation, gui }: -gsmakeDerivation rec { +{ lib +, stdenv +, fetchzip +, base +, back +, make +, wrapGNUstepAppsHook +, gui +}: + +stdenv.mkDerivation (finalAttrs: { pname = "gorm"; version = "1.3.1"; src = fetchzip { - url = "ftp://ftp.gnustep.org/pub/gnustep/dev-apps/gorm-${version}.tar.gz"; + url = "ftp://ftp.gnustep.org/pub/gnustep/dev-apps/gorm-${finalAttrs.version}.tar.gz"; sha256 = "sha256-W+NgbvLjt1PpDiauhzWFaU1/CUhmDACQz+GoyRUyWB8="; }; + + nativeBuildInputs = [ make wrapGNUstepAppsHook ]; buildInputs = [ base back gui ]; meta = { description = "Graphical Object Relationship Modeller is an easy-to-use interface designer for GNUstep"; + homepage = "https://gnustep.github.io/"; + license = lib.licenses.lgpl2Plus; + mainProgram = "Gorm"; + maintainers = with lib.maintainers; [ ashalkhakov matthewbauer dblsaiko ]; + platforms = lib.platforms.linux; }; -} +}) diff --git a/pkgs/desktops/gnustep/gui/default.nix b/pkgs/desktops/gnustep/gui/default.nix index 962d6eef7fde..448f4c60136a 100644 --- a/pkgs/desktops/gnustep/gui/default.nix +++ b/pkgs/desktops/gnustep/gui/default.nix @@ -1,19 +1,32 @@ -{ gsmakeDerivation, fetchzip, base }: +{ lib +, stdenv +, make +, wrapGNUstepAppsHook +, fetchzip +, base +}: -gsmakeDerivation rec { +stdenv.mkDerivation (finalAttrs: { version = "0.30.0"; pname = "gnustep-gui"; src = fetchzip { - url = "ftp://ftp.gnustep.org/pub/gnustep/core/${pname}-${version}.tar.gz"; + url = "ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-gui-${finalAttrs.version}.tar.gz"; sha256 = "sha256-24hL4TeIY6izlhQUcxKI0nXITysAPfRrncRqsDm2zNk="; }; + + nativeBuildInputs = [ make wrapGNUstepAppsHook ]; buildInputs = [ base ]; + patches = [ ./fixup-all.patch ]; meta = { + changelog = "https://github.com/gnustep/libs-gui/releases/tag/gui-${builtins.replaceStrings [ "." ] [ "_" ] finalAttrs.version}"; description = "A GUI class library of GNUstep"; - changelog = "https://github.com/gnustep/libs-gui/releases/tag/gui-${builtins.replaceStrings [ "." ] [ "_" ] version}"; + homepage = "https://gnustep.github.io/"; + license = lib.licenses.lgpl2Plus; + maintainers = with lib.maintainers; [ ashalkhakov matthewbauer dblsaiko ]; + platforms = lib.platforms.linux; }; -} +}) diff --git a/pkgs/desktops/gnustep/gworkspace/default.nix b/pkgs/desktops/gnustep/gworkspace/default.nix index cdc6612d1c06..d2343dfb0113 100644 --- a/pkgs/desktops/gnustep/gworkspace/default.nix +++ b/pkgs/desktops/gnustep/gworkspace/default.nix @@ -1,22 +1,36 @@ -{ back, base, gui, gsmakeDerivation +{ lib +, stdenv +, back +, base +, gui +, make +, wrapGNUstepAppsHook , fetchurl , system_preferences }: -let + +stdenv.mkDerivation (finalAttrs: { + pname = "gworkspace"; version = "1.0.0"; -in -gsmakeDerivation { - name = "gworkspace-${version}"; + src = fetchurl { - url = "ftp://ftp.gnustep.org/pub/gnustep/usr-apps/gworkspace-${version}.tar.gz"; + url = "ftp://ftp.gnustep.org/pub/gnustep/usr-apps/gworkspace-${finalAttrs.version}.tar.gz"; sha256 = "sha256-M7dV7RVatw8gdYHQlRi5wNBd6MGT9GqW04R/DoKNu6I="; }; + # additional dependencies: # - PDFKit framework from http://gap.nongnu.org/ # - TODO: to --enable-gwmetadata, need libDBKit as well as sqlite! + nativeBuildInputs = [ make wrapGNUstepAppsHook ]; buildInputs = [ back base gui system_preferences ]; configureFlags = [ "--with-inotify" ]; + meta = { description = "A workspace manager for GNUstep"; + homepage = "https://gnustep.github.io/"; + license = lib.licenses.lgpl2Plus; + mainProgram = "GWorkspace"; + maintainers = with lib.maintainers; [ ashalkhakov matthewbauer dblsaiko ]; + platforms = lib.platforms.linux; }; -} +}) diff --git a/pkgs/desktops/gnustep/libobjc2/default.nix b/pkgs/desktops/gnustep/libobjc2/default.nix index b44e60ce233d..2e487fddf431 100644 --- a/pkgs/desktops/gnustep/libobjc2/default.nix +++ b/pkgs/desktops/gnustep/libobjc2/default.nix @@ -1,13 +1,17 @@ -{ stdenv, lib, fetchFromGitHub, cmake }: +{ lib +, stdenv +, fetchFromGitHub +, cmake +}: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "libobjc2"; version = "2.1"; src = fetchFromGitHub { owner = "gnustep"; repo = "libobjc2"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-iDOVEDnTAfg9r3/kdHp7hzX2oIjO1ovaqgrlIV7V68M="; fetchSubmodules = true; }; @@ -19,9 +23,9 @@ stdenv.mkDerivation rec { meta = with lib; { broken = stdenv.isDarwin; description = "Objective-C runtime for use with GNUstep"; - homepage = "http://gnustep.org/"; + homepage = "https://gnustep.github.io/"; license = licenses.mit; - maintainers = with maintainers; [ ashalkhakov matthewbauer ]; + maintainers = with lib.maintainers; [ ashalkhakov matthewbauer dblsaiko ]; platforms = platforms.unix; }; -} +}) diff --git a/pkgs/desktops/gnustep/make/builder.sh b/pkgs/desktops/gnustep/make/builder.sh deleted file mode 100644 index 79ead3f7b729..000000000000 --- a/pkgs/desktops/gnustep/make/builder.sh +++ /dev/null @@ -1,127 +0,0 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - -providedPreConfigure="$preConfigure"; - -preConfigure() { - eval "$providedPreConfigure" - - . $GNUSTEP_MAKEFILES/GNUstep.sh -} - -wrapGSMake() { - local program="$1" - local config="$2" - local wrapped="$(dirname $program)/.$(basename $program)-wrapped" - - mv "$program" "$wrapped" - - cat > "$program"<> $conf - if [ -n "$NIX_GNUSTEP_SYSTEM_APPS" ]; then - echo NIX_GNUSTEP_SYSTEM_APPS="$NIX_GNUSTEP_SYSTEM_APPS" - fi - if [ -n "$NIX_GNUSTEP_SYSTEM_ADMIN_APPS" ]; then - echo NIX_GNUSTEP_SYSTEM_ADMIN_APPS="$NIX_GNUSTEP_SYSTEM_ADMIN_APPS" >> $conf - fi - if [ -n "$NIX_GNUSTEP_SYSTEM_WEB_APPS" ]; then - echo NIX_GNUSTEP_SYSTEM_WEB_APPS="$NIX_GNUSTEP_SYSTEM_WEB_APPS" >> $conf - fi - if [ -n "$NIX_GNUSTEP_SYSTEM_TOOLS" ]; then - echo NIX_GNUSTEP_SYSTEM_TOOLS="$NIX_GNUSTEP_SYSTEM_TOOLS" >> $conf - fi - if [ -n "$NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS" ]; then - echo NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS="$NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS" >> $conf - fi - if [ -n "$NIX_GNUSTEP_SYSTEM_LIBRARY" ]; then - echo NIX_GNUSTEP_SYSTEM_LIBRARY="$NIX_GNUSTEP_SYSTEM_LIBRARY" >> $conf - fi - if [ -n "$NIX_GNUSTEP_SYSTEM_HEADERS" ]; then - echo NIX_GNUSTEP_SYSTEM_HEADERS="$NIX_GNUSTEP_SYSTEM_HEADERS" >> $conf - fi - if [ -n "$NIX_GNUSTEP_SYSTEM_LIBRARIES" ]; then - echo NIX_GNUSTEP_SYSTEM_LIBRARIES="$NIX_GNUSTEP_SYSTEM_LIBRARIES" >> $conf - fi - if [ -n "$NIX_GNUSTEP_SYSTEM_DOC" ]; then - echo NIX_GNUSTEP_SYSTEM_DOC="$NIX_GNUSTEP_SYSTEM_DOC" >> $conf - fi - if [ -n "$NIX_GNUSTEP_SYSTEM_DOC_MAN" ]; then - echo NIX_GNUSTEP_SYSTEM_DOC_MAN="$NIX_GNUSTEP_SYSTEM_DOC_MAN" >> $conf - fi - if [ -n "$NIX_GNUSTEP_SYSTEM_DOC_INFO" ]; then - echo NIX_GNUSTEP_SYSTEM_DOC_INFO="$NIX_GNUSTEP_SYSTEM_DOC_INFO" >> $conf - fi - - for i in $out/bin/*; do - echo "wrapping $(basename $i)" - wrapGSMake "$i" "$out/share/.GNUstep.conf" - done -} - -genericBuild diff --git a/pkgs/desktops/gnustep/make/default.nix b/pkgs/desktops/gnustep/make/default.nix index f9b4ae553c85..290e3004497f 100644 --- a/pkgs/desktops/gnustep/make/default.nix +++ b/pkgs/desktops/gnustep/make/default.nix @@ -1,11 +1,16 @@ -{ lib, stdenv, fetchurl, clang, which, libobjc }: +{ lib +, stdenv +, fetchurl +, which +, libobjc +}: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "gnustep-make"; version = "2.9.1"; src = fetchurl { - url = "ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-make-${version}.tar.gz"; + url = "ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-make-${finalAttrs.version}.tar.gz"; sha256 = "sha256-w9bnDPFWsn59HtJQHFffP5bidIjOLzUbk+R5xYwB6uc="; }; @@ -22,17 +27,19 @@ stdenv.mkDerivation rec { "GNUSTEP_INSTALLATION_DOMAIN=SYSTEM" ]; - nativeBuildInputs = [ clang which ]; buildInputs = [ libobjc ]; + propagatedBuildInputs = [ which ]; + patches = [ ./fixup-paths.patch ]; setupHook = ./setup-hook.sh; + meta = { + changelog = "https://github.com/gnustep/tools-make/releases/tag/make-${builtins.replaceStrings [ "." ] [ "_" ] finalAttrs.version}"; description = "A build manager for GNUstep"; - homepage = "http://gnustep.org/"; - changelog = "https://github.com/gnustep/tools-make/releases/tag/make-${builtins.replaceStrings [ "." ] [ "_" ] version}"; + homepage = "https://gnustep.github.io/"; license = lib.licenses.lgpl2Plus; - maintainers = with lib.maintainers; [ ashalkhakov matthewbauer ]; + maintainers = with lib.maintainers; [ ashalkhakov matthewbauer dblsaiko ]; platforms = lib.platforms.unix; }; -} +}) diff --git a/pkgs/desktops/gnustep/make/gsmakeDerivation.nix b/pkgs/desktops/gnustep/make/gsmakeDerivation.nix deleted file mode 100644 index 04cfcc1ca343..000000000000 --- a/pkgs/desktops/gnustep/make/gsmakeDerivation.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ lib, stdenv, make, makeWrapper, which }: -{ nativeBuildInputs ? [], ...} @ args: -stdenv.mkDerivation (args // { - nativeBuildInputs = [ makeWrapper make which ] ++ nativeBuildInputs; - - builder = ./builder.sh; - setupHook = ./setup-hook.sh; - - GNUSTEP_MAKEFILES = "${make}/share/GNUstep/Makefiles"; - - meta = { - homepage = "http://gnustep.org/"; - - license = lib.licenses.lgpl2Plus; - - maintainers = with lib.maintainers; [ ashalkhakov matthewbauer ]; - platforms = lib.platforms.linux; - } // (lib.optionalAttrs (builtins.hasAttr "meta" args) args.meta); -}) diff --git a/pkgs/desktops/gnustep/make/setup-hook.sh b/pkgs/desktops/gnustep/make/setup-hook.sh index 83adfefc10cd..0bfbd35f45f5 100644 --- a/pkgs/desktops/gnustep/make/setup-hook.sh +++ b/pkgs/desktops/gnustep/make/setup-hook.sh @@ -20,62 +20,52 @@ addGnustepInstallFlags() { preInstallPhases+=" addGnustepInstallFlags" -addEnvVars() { +addGNUstepEnvVars() { local filename + gsAddToSearchPath() { + if [[ -d "$2" && "${!1-}" != *"$2"* ]]; then + addToSearchPath "$1" "$2" + fi + } + + gsAddToIncludeSearchPath() { + local -n ref="$1" + + # NOTE: contrary to the one in wrapGNUstepAppsHook, use -e here instead of -d since it's also used for the makefiles + if [[ -e "$2" && "${ref-}" != *"$2"* ]]; then + if [[ "${ref-}" != "" ]]; then + ref+=" " + fi + + ref+="$2" + fi + } + for filename in $1/share/GNUstep/Makefiles/Additional/*.make ; do - if case "${NIX_GNUSTEP_MAKEFILES_ADDITIONAL-}" in *"{$filename}"*) false;; *) true;; esac; then - export NIX_GNUSTEP_MAKEFILES_ADDITIONAL+=" $filename" - fi + gsAddToIncludeSearchPath NIX_GNUSTEP_MAKEFILES_ADDITIONAL "$filename" done - local tmp="$1/lib/GNUstep/Applications" - if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_APPS-}" in *"${tmp}"*) false;; *) true;; esac; then - addToSearchPath NIX_GNUSTEP_SYSTEM_APPS "$tmp" - fi - tmp="$1/lib/GNUstep/Applications" - if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_ADMIN_APPS-}" in *"${tmp}"*) false;; *) true;; esac; then - addToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_APPS "$tmp" - fi - tmp="$1/lib/GNUstep/WebApplications" - if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_WEB_APPS-}" in *"${tmp}"*) false;; *) true;; esac; then - addToSearchPath NIX_GNUSTEP_SYSTEM_WEB_APPS "$tmp" - fi - tmp="$1/bin" - if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_TOOLS-}" in *"${tmp}"*) false;; *) true;; esac; then - addToSearchPath NIX_GNUSTEP_SYSTEM_TOOLS "$tmp" - fi - tmp="$1/sbin" - if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS-}" in *"${tmp}"*) false;; *) true;; esac; then - addToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS "$tmp" - fi - tmp="$1/lib/GNUstep" - if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_LIBRARY-}" in *"${tmp}"*) false;; *) true;; esac; then - addToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARY "$tmp" - fi - tmp="$1/include" - if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_HEADERS-}" in *"${tmp}"*) false;; *) true;; esac; then - if [ -z "${NIX_GNUSTEP_SYSTEM_HEADERS-}" ]; then - export NIX_GNUSTEP_SYSTEM_HEADERS="$tmp" - else - export NIX_GNUSTEP_SYSTEM_HEADERS+=" $tmp" - fi - fi - tmp="$1/lib" - if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_LIBRARIES-}" in *"${tmp}"*) false;; *) true;; esac; then - addToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARIES "$tmp" - fi - tmp="$1/share/GNUstep/Documentation" - if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_DOC-}" in *"${tmp}"*) false;; *) true;; esac; then - addToSearchPath NIX_GNUSTEP_SYSTEM_DOC "$tmp" - fi - tmp="$1/share/man" - if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_DOC_MAN-}" in *"${tmp}"*) false;; *) true;; esac; then - addToSearchPath NIX_GNUSTEP_SYSTEM_DOC_MAN "$tmp" - fi - tmp="$1/share/info" - if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_DOC_INFO-}" in *"${tmp}"*) false;; *) true;; esac; then - addToSearchPath NIX_GNUSTEP_SYSTEM_DOC_INFO "$tmp" - fi + export NIX_GNUSTEP_MAKEFILES_ADDITIONAL + + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_APPS "$1/lib/GNUstep/Applications" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_APPS "$1/lib/GNUstep/Applications" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_WEB_APPS "$1/lib/GNUstep/WebApplications" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_TOOLS "$1/bin" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS "$1/sbin" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARY "$1/lib/GNUstep" + gsAddToIncludeSearchPath NIX_GNUSTEP_SYSTEM_HEADERS "$1/include" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARIES "$1/lib" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC "$1/share/GNUstep/Documentation" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC_MAN "$1/share/man" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC_INFO "$1/share/info" } -addEnvHooks "$targetOffset" addEnvVars +addEnvHooks "$targetOffset" addGNUstepEnvVars + +gsmakeSetup() { + export GNUSTEP_MAKEFILES="$(gnustep-config --variable=GNUSTEP_MAKEFILES)" + + . $GNUSTEP_MAKEFILES/GNUstep.sh +} + +preConfigureHooks+=(gsmakeSetup) diff --git a/pkgs/desktops/gnustep/make/wrapper.sh b/pkgs/desktops/gnustep/make/wrapper.sh deleted file mode 100644 index 1bc2e130d88d..000000000000 --- a/pkgs/desktops/gnustep/make/wrapper.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -. $GNUSTEP_MAKEFILES/GNUstep.sh -$1 diff --git a/pkgs/desktops/gnustep/projectcenter/default.nix b/pkgs/desktops/gnustep/projectcenter/default.nix index b535365b25d9..89f2e769a066 100644 --- a/pkgs/desktops/gnustep/projectcenter/default.nix +++ b/pkgs/desktops/gnustep/projectcenter/default.nix @@ -1,21 +1,29 @@ -{ lib, fetchFromGitHub -, base, back, gsmakeDerivation, gui, gorm -, gnumake, gdb +{ lib +, stdenv +, fetchFromGitHub +, make +, wrapGNUstepAppsHook +, base +, back +, gui +, gorm +, gnumake +, gdb }: -let - version = "0.7.0"; -in -gsmakeDerivation { + +stdenv.mkDerivation (finalAttrs: { pname = "projectcenter"; - inherit version; + version = "0.7.0"; src = fetchFromGitHub { owner = "gnustep"; repo = "apps-projectcenter"; - rev = "projectcenter-${lib.replaceStrings [ "." ] [ "_" ] version}"; + rev = "projectcenter-${lib.replaceStrings [ "." ] [ "_" ] finalAttrs.version}"; hash = "sha256-uXT2UUvMZNc6Fqi2BUXQimbZk8b3IqXzB+A2btBOmms="; }; + nativeBuildInputs = [ make wrapGNUstepAppsHook ]; + # NOTE: need a patch for ProjectCenter to help it locate some necessary tools: # 1. Framework/PCProjectLauncher.m, locate gdb (say among NIX_GNUSTEP_SYSTEM_TOOLS) # 2. Framework/PCProjectBuilder.m, locate gmake (similar) @@ -23,5 +31,10 @@ gsmakeDerivation { meta = { description = "GNUstep's integrated development environment"; + homepage = "https://gnustep.github.io/"; + license = lib.licenses.lgpl2Plus; + mainProgram = "ProjectCenter"; + maintainers = with lib.maintainers; [ ashalkhakov matthewbauer dblsaiko ]; + platforms = lib.platforms.linux; }; -} +}) diff --git a/pkgs/desktops/gnustep/systempreferences/default.nix b/pkgs/desktops/gnustep/systempreferences/default.nix index 096520f08f36..c08ad0fc8dbc 100644 --- a/pkgs/desktops/gnustep/systempreferences/default.nix +++ b/pkgs/desktops/gnustep/systempreferences/default.nix @@ -1,17 +1,31 @@ -{ back, base, gui, gsmakeDerivation, fetchurl }: -let +{ lib +, stdenv +, fetchurl +, make +, wrapGNUstepAppsHook +, back +, base +, gui +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "system-preferences"; version = "1.2.0"; -in -gsmakeDerivation { - name = "system_preferences-${version}"; + src = fetchurl { - url = "ftp://ftp.gnustep.org/pub/gnustep/usr-apps/SystemPreferences-${version}.tar.gz"; + url = "ftp://ftp.gnustep.org/pub/gnustep/usr-apps/SystemPreferences-${finalAttrs.version}.tar.gz"; sha256 = "1fg7c3ihfgvl6n21rd17fs9ivx3l8ps874m80vz86n1callgs339"; }; -# GNUSTEP_MAKEFILES = "${gnustep_make}/share/GNUstep/Makefiles"; + + nativeBuildInputs = [ make wrapGNUstepAppsHook ]; buildInputs = [ back base gui ]; -# propagatedBuildInputs = [ gnustep_back gnustep_base gnustep_gui ]; + meta = { description = "The settings manager for the GNUstep environment and its applications"; + homepage = "https://gnustep.github.io/"; + license = lib.licenses.lgpl2Plus; + mainProgram = "SystemPreferences"; + maintainers = with lib.maintainers; [ ashalkhakov matthewbauer dblsaiko ]; + platforms = lib.platforms.linux; }; -} +}) diff --git a/pkgs/desktops/gnustep/wrapGNUstepAppsHook.nix b/pkgs/desktops/gnustep/wrapGNUstepAppsHook.nix new file mode 100644 index 000000000000..8a2339ddeb52 --- /dev/null +++ b/pkgs/desktops/gnustep/wrapGNUstepAppsHook.nix @@ -0,0 +1,8 @@ +{makeBinaryWrapper, makeSetupHook}: + +makeSetupHook + { + name = "wrapGNUstepAppsHook"; + propagatedBuildInputs = [makeBinaryWrapper]; + } + ./wrapGNUstepAppsHook.sh diff --git a/pkgs/desktops/gnustep/wrapGNUstepAppsHook.sh b/pkgs/desktops/gnustep/wrapGNUstepAppsHook.sh new file mode 100644 index 000000000000..8218ff1e7746 --- /dev/null +++ b/pkgs/desktops/gnustep/wrapGNUstepAppsHook.sh @@ -0,0 +1,96 @@ +if [[ -z "${__nix_wrapGNUstepAppsHook-}" ]]; then + __nix_wrapGNUstepAppsHook=1 # Don't run this hook more than once. + + # Inherit arguments given in mkDerivation + gnustepWrapperArgs=(${gnustepWrapperArgs-}) + + gnustepConfigVars+=( + GNUSTEP_MAKEFILES + NIX_GNUSTEP_SYSTEM_APPS + NIX_GNUSTEP_SYSTEM_ADMIN_APPS + NIX_GNUSTEP_SYSTEM_WEB_APPS + NIX_GNUSTEP_SYSTEM_TOOLS + NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS + NIX_GNUSTEP_SYSTEM_LIBRARY + NIX_GNUSTEP_SYSTEM_HEADERS + NIX_GNUSTEP_SYSTEM_LIBRARIES + NIX_GNUSTEP_SYSTEM_DOC + NIX_GNUSTEP_SYSTEM_DOC_MAN + NIX_GNUSTEP_SYSTEM_DOC_INFO + ) + + wrapGNUstepApp() { + wrapProgram "$1" \ + --set GNUSTEP_CONFIG_FILE "$out/GNUstep.conf" \ + "${gnustepWrapperArgs[@]}" + } + + ensureGNUstepConfig() ( + if [[ -f "$out/GNUstep.conf" ]]; then + return + fi + + echo "writing GNUstep config file" + + gsAddToSearchPath() { + if [[ -d "$2" && "${!1-}" != *"$2"* ]]; then + addToSearchPath "$1" "$2" + fi + } + + gsAddToIncludeSearchPath() { + local -n ref="$1" + + if [[ -d "$2" && "${ref-}" != *"$2"* ]]; then + if [[ "${ref-}" != "" ]]; then + ref+=" " + fi + + ref+="$2" + fi + } + + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_APPS "$out/lib/GNUstep/Applications" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_APPS "$out/lib/GNUstep/Applications" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_WEB_APPS "$out/lib/GNUstep/WebApplications" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_TOOLS "$out/bin" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS "$out/sbin" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARY "$out/lib/GNUstep" + gsAddToIncludeSearchPath NIX_GNUSTEP_SYSTEM_HEADERS "$out/include" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARIES "$out/lib" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC "$out/share/GNUstep/Documentation" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC_MAN "$out/share/man" + gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC_INFO "$out/share/info" + + for var in "${gnustepConfigVars[@]}"; do + if [[ -n "${!var-}" ]]; then + printf '%s="%s"\n' "$var" "${!var}" + fi + done > "$out/GNUstep.conf" + ) + + # Note: $gnustepWrapperArgs still gets defined even if ${dontWrapGNUstepApps-} is set. + wrapGNUstepAppsHook() { + # skip this hook when requested + [[ -z "${dontWrapGNUstepApps-}" ]] || return 0 + + # guard against running multiple times (e.g. due to propagation) + [[ -z "$wrapGNUstepAppsHookHasRun" ]] || return 0 + wrapGNUstepAppsHookHasRun=1 + + local targetDirs=("$prefix/bin") + echo "wrapping GNUstep applications in ${targetDirs[@]}" + + for targetDir in "${targetDirs[@]}"; do + [[ -d "$targetDir" ]] || continue + + while IFS= read -r -d '' file; do + ensureGNUstepConfig + echo "wrapping $file" + wrapGNUstepApp "$file" + done < <(find "$targetDir" ! -type d -executable -print0) + done + } + + fixupOutputHooks+=(wrapGNUstepAppsHook) +fi