gnustep: replace custom builder with hooks

This commit is contained in:
Marco Rebhan 2023-12-18 03:10:46 +01:00
parent e5c677c31e
commit 4d3910b480
No known key found for this signature in database
18 changed files with 345 additions and 282 deletions

View File

@ -1,9 +1,10 @@
{ lib { lib
, clangStdenv
, fetchurl , fetchurl
, gnustep , gnustep
}: }:
gnustep.gsmakeDerivation rec { clangStdenv.mkDerivation rec {
pname = "pikopixel"; pname = "pikopixel";
version = "1.0-b10"; version = "1.0-b10";
@ -14,6 +15,11 @@ gnustep.gsmakeDerivation rec {
sourceRoot = "PikoPixel.Sources.${version}/PikoPixel"; sourceRoot = "PikoPixel.Sources.${version}/PikoPixel";
nativeBuildInputs = [
gnustep.make
gnustep.wrapGNUstepAppsHook
];
buildInputs = [ buildInputs = [
gnustep.base gnustep.base
gnustep.gui gnustep.gui

View File

@ -1,5 +1,5 @@
{ lib { lib
, stdenv , clangStdenv
, fetchFromGitHub , fetchFromGitHub
, gnustep , gnustep
, libxkbcommon , libxkbcommon
@ -12,9 +12,10 @@
assert wayland.withLibraries; assert wayland.withLibraries;
let let
mkDerivation = if stdenv.isDarwin then stdenv.mkDerivation else gnustep.gsmakeDerivation; stdenv = clangStdenv;
in in
mkDerivation {
stdenv.mkDerivation {
pname = "owl-compositor"; pname = "owl-compositor";
version = "unstable-2021-11-10"; version = "unstable-2021-11-10";
@ -43,6 +44,7 @@ mkDerivation {
darwin.bootstrap_cmds darwin.bootstrap_cmds
] ++ lib.optionals (!stdenv.isDarwin) [ ] ++ lib.optionals (!stdenv.isDarwin) [
gnustep.make gnustep.make
gnustep.wrapGNUstepAppsHook
]; ];
buildInputs = [ buildInputs = [

View File

@ -1,7 +1,11 @@
{ gsmakeDerivation { lib
, stdenv
, make
, wrapGNUstepAppsHook
, cairo , cairo
, fetchzip , fetchzip
, base, gui , base
, gui
, fontconfig , fontconfig
, freetype , freetype
, pkg-config , pkg-config
@ -9,18 +13,23 @@
, libXmu , libXmu
}: }:
gsmakeDerivation rec { stdenv.mkDerivation (finalAttrs: {
pname = "gnustep-back"; pname = "gnustep-back";
version = "0.30.0"; version = "0.30.0";
src = fetchzip { 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="; sha256 = "sha256-HD4PLdkE573nPWqFwffUmcHw8VYIl5rLiPKWrbnwpCI=";
}; };
nativeBuildInputs = [ pkg-config ]; nativeBuildInputs = [ make pkg-config wrapGNUstepAppsHook ];
buildInputs = [ cairo base gui fontconfig freetype libXft libXmu ]; buildInputs = [ cairo base gui fontconfig freetype libXft libXmu ];
meta = { meta = {
description = "A generic backend for GNUstep"; 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;
}; };
} })

View File

@ -1,26 +1,40 @@
{ aspell, audiofile { lib
, gsmakeDerivation , stdenv
, aspell
, audiofile
, make
, wrapGNUstepAppsHook
, cups , cups
, fetchzip , fetchzip
, fetchpatch , fetchpatch
, gmp, gnutls , gmp
, libffi, binutils-unwrapped , gnutls
, libjpeg, libtiff, libpng, giflib , libffi
, libxml2, libxslt, libiconv , binutils-unwrapped
, libobjc, libgcrypt , libjpeg
, libtiff
, libpng
, giflib
, libxml2
, libxslt
, libiconv
, libobjc
, libgcrypt
, icu , icu
, pkg-config, portaudio , pkg-config
, portaudio
, libiberty , libiberty
}: }:
gsmakeDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "gnustep-base"; pname = "gnustep-base";
version = "1.29.0"; version = "1.29.0";
src = fetchzip { 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="; hash = "sha256-4fjdsLBsYEDxLOFrq17dKii2sLKvOaFCu0cw3qQtM5U=";
}; };
outputs = [ "out" "dev" "lib" ]; outputs = [ "out" "dev" "lib" ];
nativeBuildInputs = [ pkg-config ]; nativeBuildInputs = [ pkg-config make wrapGNUstepAppsHook ];
propagatedBuildInputs = [ propagatedBuildInputs = [
aspell audiofile aspell audiofile
cups cups
@ -55,7 +69,11 @@ gsmakeDerivation rec {
]; ];
meta = { 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"; 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;
}; };
} })

View File

@ -5,18 +5,21 @@
let let
callPackage = newScope self; callPackage = newScope self;
self = rec { self = {
stdenv = llvmPackages.stdenv; 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 {}; gorm = callPackage ./gorm {};
projectcenter = callPackage ./projectcenter {}; projectcenter = callPackage ./projectcenter {};
system_preferences = callPackage ./systempreferences {}; system_preferences = callPackage ./systempreferences {};
libobjc = callPackage ./libobjc2 {};
make = callPackage ./make {};
back = callPackage ./back {};
base = callPackage ./base { };
gui = callPackage ./gui {};
gworkspace = callPackage ./gworkspace {}; gworkspace = callPackage ./gworkspace {};
}; };

View File

@ -1,15 +1,31 @@
{ fetchzip, base, back, gsmakeDerivation, gui }: { lib
gsmakeDerivation rec { , stdenv
, fetchzip
, base
, back
, make
, wrapGNUstepAppsHook
, gui
}:
stdenv.mkDerivation (finalAttrs: {
pname = "gorm"; pname = "gorm";
version = "1.3.1"; version = "1.3.1";
src = fetchzip { 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="; sha256 = "sha256-W+NgbvLjt1PpDiauhzWFaU1/CUhmDACQz+GoyRUyWB8=";
}; };
nativeBuildInputs = [ make wrapGNUstepAppsHook ];
buildInputs = [ base back gui ]; buildInputs = [ base back gui ];
meta = { meta = {
description = "Graphical Object Relationship Modeller is an easy-to-use interface designer for GNUstep"; 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;
}; };
} })

View File

@ -1,19 +1,32 @@
{ gsmakeDerivation, fetchzip, base }: { lib
, stdenv
, make
, wrapGNUstepAppsHook
, fetchzip
, base
}:
gsmakeDerivation rec { stdenv.mkDerivation (finalAttrs: {
version = "0.30.0"; version = "0.30.0";
pname = "gnustep-gui"; pname = "gnustep-gui";
src = fetchzip { 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="; sha256 = "sha256-24hL4TeIY6izlhQUcxKI0nXITysAPfRrncRqsDm2zNk=";
}; };
nativeBuildInputs = [ make wrapGNUstepAppsHook ];
buildInputs = [ base ]; buildInputs = [ base ];
patches = [ patches = [
./fixup-all.patch ./fixup-all.patch
]; ];
meta = { meta = {
changelog = "https://github.com/gnustep/libs-gui/releases/tag/gui-${builtins.replaceStrings [ "." ] [ "_" ] finalAttrs.version}";
description = "A GUI class library of GNUstep"; 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;
}; };
} })

View File

@ -1,22 +1,36 @@
{ back, base, gui, gsmakeDerivation { lib
, stdenv
, back
, base
, gui
, make
, wrapGNUstepAppsHook
, fetchurl , fetchurl
, system_preferences , system_preferences
}: }:
let
stdenv.mkDerivation (finalAttrs: {
pname = "gworkspace";
version = "1.0.0"; version = "1.0.0";
in
gsmakeDerivation {
name = "gworkspace-${version}";
src = fetchurl { 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="; sha256 = "sha256-M7dV7RVatw8gdYHQlRi5wNBd6MGT9GqW04R/DoKNu6I=";
}; };
# additional dependencies: # additional dependencies:
# - PDFKit framework from http://gap.nongnu.org/ # - PDFKit framework from http://gap.nongnu.org/
# - TODO: to --enable-gwmetadata, need libDBKit as well as sqlite! # - TODO: to --enable-gwmetadata, need libDBKit as well as sqlite!
nativeBuildInputs = [ make wrapGNUstepAppsHook ];
buildInputs = [ back base gui system_preferences ]; buildInputs = [ back base gui system_preferences ];
configureFlags = [ "--with-inotify" ]; configureFlags = [ "--with-inotify" ];
meta = { meta = {
description = "A workspace manager for GNUstep"; 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;
}; };
} })

View File

@ -1,13 +1,17 @@
{ stdenv, lib, fetchFromGitHub, cmake }: { lib
, stdenv
, fetchFromGitHub
, cmake
}:
stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: {
pname = "libobjc2"; pname = "libobjc2";
version = "2.1"; version = "2.1";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "gnustep"; owner = "gnustep";
repo = "libobjc2"; repo = "libobjc2";
rev = "v${version}"; rev = "v${finalAttrs.version}";
hash = "sha256-iDOVEDnTAfg9r3/kdHp7hzX2oIjO1ovaqgrlIV7V68M="; hash = "sha256-iDOVEDnTAfg9r3/kdHp7hzX2oIjO1ovaqgrlIV7V68M=";
fetchSubmodules = true; fetchSubmodules = true;
}; };
@ -19,9 +23,9 @@ stdenv.mkDerivation rec {
meta = with lib; { meta = with lib; {
broken = stdenv.isDarwin; broken = stdenv.isDarwin;
description = "Objective-C runtime for use with GNUstep"; description = "Objective-C runtime for use with GNUstep";
homepage = "http://gnustep.org/"; homepage = "https://gnustep.github.io/";
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; [ ashalkhakov matthewbauer ]; maintainers = with lib.maintainers; [ ashalkhakov matthewbauer dblsaiko ];
platforms = platforms.unix; platforms = platforms.unix;
}; };
} })

View File

@ -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"<<EOF
#! $SHELL -e
export GNUSTEP_CONFIG_FILE="$config"
exec "$wrapped" "\$@"
EOF
chmod +x "$program"
}
postInstall() {
local conf="$out/share/.GNUstep.conf"
mkdir -p "$out/share"
touch $conf
# add the current package to the paths
local tmp="$out/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="$out/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="$out/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="$out/bin"
if [ -d "$tmp" ] && case "$NIX_GNUSTEP_SYSTEM_TOOLS" in *"${tmp}"*) false;; *) true;; esac; then
addToSearchPath NIX_GNUSTEP_SYSTEM_TOOLS "$tmp"
fi
tmp="$out/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="$out/lib/GNUstep"
if [ -d "$tmp" ] && case "$NIX_GNUSTEP_SYSTEM_LIBRARY" in *"${tmp}"*) false;; *) true;; esac; then
addToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARY "$tmp"
fi
tmp="$out/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="$out/lib"
if [ -d "$tmp" ] && case "$NIX_GNUSTEP_SYSTEM_LIBRARIES" in *"${tmp}"*) false;; *) true;; esac; then
addToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARIES "$tmp"
fi
tmp="$out/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="$out/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="$out/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
# write the config file
echo GNUSTEP_MAKEFILES=$GNUSTEP_MAKEFILES >> $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

View File

@ -1,11 +1,16 @@
{ lib, stdenv, fetchurl, clang, which, libobjc }: { lib
, stdenv
, fetchurl
, which
, libobjc
}:
stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: {
pname = "gnustep-make"; pname = "gnustep-make";
version = "2.9.1"; version = "2.9.1";
src = fetchurl { 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="; sha256 = "sha256-w9bnDPFWsn59HtJQHFffP5bidIjOLzUbk+R5xYwB6uc=";
}; };
@ -22,17 +27,19 @@ stdenv.mkDerivation rec {
"GNUSTEP_INSTALLATION_DOMAIN=SYSTEM" "GNUSTEP_INSTALLATION_DOMAIN=SYSTEM"
]; ];
nativeBuildInputs = [ clang which ];
buildInputs = [ libobjc ]; buildInputs = [ libobjc ];
propagatedBuildInputs = [ which ];
patches = [ ./fixup-paths.patch ]; patches = [ ./fixup-paths.patch ];
setupHook = ./setup-hook.sh; setupHook = ./setup-hook.sh;
meta = { meta = {
changelog = "https://github.com/gnustep/tools-make/releases/tag/make-${builtins.replaceStrings [ "." ] [ "_" ] finalAttrs.version}";
description = "A build manager for GNUstep"; description = "A build manager for GNUstep";
homepage = "http://gnustep.org/"; homepage = "https://gnustep.github.io/";
changelog = "https://github.com/gnustep/tools-make/releases/tag/make-${builtins.replaceStrings [ "." ] [ "_" ] version}";
license = lib.licenses.lgpl2Plus; license = lib.licenses.lgpl2Plus;
maintainers = with lib.maintainers; [ ashalkhakov matthewbauer ]; maintainers = with lib.maintainers; [ ashalkhakov matthewbauer dblsaiko ];
platforms = lib.platforms.unix; platforms = lib.platforms.unix;
}; };
} })

View File

@ -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);
})

View File

@ -20,62 +20,52 @@ addGnustepInstallFlags() {
preInstallPhases+=" addGnustepInstallFlags" preInstallPhases+=" addGnustepInstallFlags"
addEnvVars() { addGNUstepEnvVars() {
local filename 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 for filename in $1/share/GNUstep/Makefiles/Additional/*.make ; do
if case "${NIX_GNUSTEP_MAKEFILES_ADDITIONAL-}" in *"{$filename}"*) false;; *) true;; esac; then gsAddToIncludeSearchPath NIX_GNUSTEP_MAKEFILES_ADDITIONAL "$filename"
export NIX_GNUSTEP_MAKEFILES_ADDITIONAL+=" $filename"
fi
done done
local tmp="$1/lib/GNUstep/Applications" export NIX_GNUSTEP_MAKEFILES_ADDITIONAL
if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_APPS-}" in *"${tmp}"*) false;; *) true;; esac; then
addToSearchPath NIX_GNUSTEP_SYSTEM_APPS "$tmp" gsAddToSearchPath NIX_GNUSTEP_SYSTEM_APPS "$1/lib/GNUstep/Applications"
fi gsAddToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_APPS "$1/lib/GNUstep/Applications"
tmp="$1/lib/GNUstep/Applications" gsAddToSearchPath NIX_GNUSTEP_SYSTEM_WEB_APPS "$1/lib/GNUstep/WebApplications"
if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_ADMIN_APPS-}" in *"${tmp}"*) false;; *) true;; esac; then gsAddToSearchPath NIX_GNUSTEP_SYSTEM_TOOLS "$1/bin"
addToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_APPS "$tmp" gsAddToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS "$1/sbin"
fi gsAddToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARY "$1/lib/GNUstep"
tmp="$1/lib/GNUstep/WebApplications" gsAddToIncludeSearchPath NIX_GNUSTEP_SYSTEM_HEADERS "$1/include"
if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_WEB_APPS-}" in *"${tmp}"*) false;; *) true;; esac; then gsAddToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARIES "$1/lib"
addToSearchPath NIX_GNUSTEP_SYSTEM_WEB_APPS "$tmp" gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC "$1/share/GNUstep/Documentation"
fi gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC_MAN "$1/share/man"
tmp="$1/bin" gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC_INFO "$1/share/info"
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
} }
addEnvHooks "$targetOffset" addEnvVars addEnvHooks "$targetOffset" addGNUstepEnvVars
gsmakeSetup() {
export GNUSTEP_MAKEFILES="$(gnustep-config --variable=GNUSTEP_MAKEFILES)"
. $GNUSTEP_MAKEFILES/GNUstep.sh
}
preConfigureHooks+=(gsmakeSetup)

View File

@ -1,4 +0,0 @@
#!/bin/sh
. $GNUSTEP_MAKEFILES/GNUstep.sh
$1

View File

@ -1,21 +1,29 @@
{ lib, fetchFromGitHub { lib
, base, back, gsmakeDerivation, gui, gorm , stdenv
, gnumake, gdb , fetchFromGitHub
, make
, wrapGNUstepAppsHook
, base
, back
, gui
, gorm
, gnumake
, gdb
}: }:
let
version = "0.7.0"; stdenv.mkDerivation (finalAttrs: {
in
gsmakeDerivation {
pname = "projectcenter"; pname = "projectcenter";
inherit version; version = "0.7.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "gnustep"; owner = "gnustep";
repo = "apps-projectcenter"; repo = "apps-projectcenter";
rev = "projectcenter-${lib.replaceStrings [ "." ] [ "_" ] version}"; rev = "projectcenter-${lib.replaceStrings [ "." ] [ "_" ] finalAttrs.version}";
hash = "sha256-uXT2UUvMZNc6Fqi2BUXQimbZk8b3IqXzB+A2btBOmms="; hash = "sha256-uXT2UUvMZNc6Fqi2BUXQimbZk8b3IqXzB+A2btBOmms=";
}; };
nativeBuildInputs = [ make wrapGNUstepAppsHook ];
# NOTE: need a patch for ProjectCenter to help it locate some necessary tools: # 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) # 1. Framework/PCProjectLauncher.m, locate gdb (say among NIX_GNUSTEP_SYSTEM_TOOLS)
# 2. Framework/PCProjectBuilder.m, locate gmake (similar) # 2. Framework/PCProjectBuilder.m, locate gmake (similar)
@ -23,5 +31,10 @@ gsmakeDerivation {
meta = { meta = {
description = "GNUstep's integrated development environment"; 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;
}; };
} })

View File

@ -1,17 +1,31 @@
{ back, base, gui, gsmakeDerivation, fetchurl }: { lib
let , stdenv
, fetchurl
, make
, wrapGNUstepAppsHook
, back
, base
, gui
}:
stdenv.mkDerivation (finalAttrs: {
pname = "system-preferences";
version = "1.2.0"; version = "1.2.0";
in
gsmakeDerivation {
name = "system_preferences-${version}";
src = fetchurl { 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"; sha256 = "1fg7c3ihfgvl6n21rd17fs9ivx3l8ps874m80vz86n1callgs339";
}; };
# GNUSTEP_MAKEFILES = "${gnustep_make}/share/GNUstep/Makefiles";
nativeBuildInputs = [ make wrapGNUstepAppsHook ];
buildInputs = [ back base gui ]; buildInputs = [ back base gui ];
# propagatedBuildInputs = [ gnustep_back gnustep_base gnustep_gui ];
meta = { meta = {
description = "The settings manager for the GNUstep environment and its applications"; 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;
}; };
} })

View File

@ -0,0 +1,8 @@
{makeBinaryWrapper, makeSetupHook}:
makeSetupHook
{
name = "wrapGNUstepAppsHook";
propagatedBuildInputs = [makeBinaryWrapper];
}
./wrapGNUstepAppsHook.sh

View File

@ -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