From 43cab046883d2869f57a440047cefd6ab945cb0a Mon Sep 17 00:00:00 2001 From: Herwig Hochleitner Date: Thu, 21 Oct 2021 16:27:36 +0200 Subject: [PATCH 1/5] gforth: 0.7.3 -> 0.7.9_20211111 This updates to forthy42's version, which the community seems to have transitioned to. --- .../compilers/gforth/boot-forth.nix | 24 ++++++++++ pkgs/development/compilers/gforth/default.nix | 46 ++++++++++++++----- .../compilers/gforth/fix-install-txt.patch | 25 ++++++++++ 3 files changed, 83 insertions(+), 12 deletions(-) create mode 100644 pkgs/development/compilers/gforth/boot-forth.nix create mode 100644 pkgs/development/compilers/gforth/fix-install-txt.patch diff --git a/pkgs/development/compilers/gforth/boot-forth.nix b/pkgs/development/compilers/gforth/boot-forth.nix new file mode 100644 index 000000000000..fc7b5ffa982d --- /dev/null +++ b/pkgs/development/compilers/gforth/boot-forth.nix @@ -0,0 +1,24 @@ +{ lib, stdenv, fetchurl, m4 }: + +let + version = "0.7.3"; +in +stdenv.mkDerivation { + pname = "gforth-boot"; + inherit version; + src = fetchurl { + url = "https://ftp.gnu.org/gnu/gforth/gforth-${version}.tar.gz"; + sha256 = "1c1bahc9ypmca8rv2dijiqbangm1d9av286904yw48ph7ciz4qig"; + }; + + buildInputs = [ m4 ]; + + configureFlags = lib.optional stdenv.isDarwin [ "--build=x86_64-apple-darwin" ]; + + meta = { + description = "The Forth implementation of the GNU project (outdated version used to bootstrap)"; + homepage = "https://www.gnu.org/software/gforth/"; + license = lib.licenses.gpl3; + platforms = lib.platforms.all; + }; +} diff --git a/pkgs/development/compilers/gforth/default.nix b/pkgs/development/compilers/gforth/default.nix index bdf172cb9b99..a36f8f4a2d38 100644 --- a/pkgs/development/compilers/gforth/default.nix +++ b/pkgs/development/compilers/gforth/default.nix @@ -1,19 +1,40 @@ -{ lib, stdenv, fetchurl, m4 }: - +{ lib, stdenv, callPackage, autoreconfHook, texinfo, fetchFromGitHub +, swig, libffi +}: let - version = "0.7.3"; -in -stdenv.mkDerivation { - pname = "gforth"; + version = "0.7.9_20211111"; + sha256 = "sha256-KwYPMWdsL9o8SVcNdENMs4C9ioFBEfyVMqe5bgIrfzs="; + ## FIXME build https://github.com/GeraldWodni/swig with gforth, then rebuild + #### This will get rid of the configuration warning + # swigf = swig.overrideDerivation (old: { + # configureFlags = old.configureFlags ++ [ + # "--enable-forth" + # ]; + # }); + bootForth = callPackage ./boot-forth.nix { }; + +in stdenv.mkDerivation { + name = "gforth-${version}"; inherit version; - src = fetchurl { - url = "https://ftp.gnu.org/gnu/gforth/gforth-${version}.tar.gz"; - sha256 = "1c1bahc9ypmca8rv2dijiqbangm1d9av286904yw48ph7ciz4qig"; + src = fetchFromGitHub { + owner = "forthy42"; + repo = "gforth"; + rev = version; + inherit sha256; }; + patches = [ ./fix-install-txt.patch ]; - buildInputs = [ m4 ]; + nativeBuildInputs = [ + autoreconfHook texinfo bootForth + ]; + buildInputs = [ + swig libffi + ]; - configureFlags = lib.optional stdenv.isDarwin [ "--build=x86_64-apple-darwin" ]; + passthru = { inherit bootForth; }; + + configureFlags = # [ "--enable-lib" ] ++ + lib.optional stdenv.isDarwin [ "--build=x86_64-apple-darwin" ]; postInstall = '' mkdir -p $out/share/emacs/site-lisp @@ -22,8 +43,9 @@ stdenv.mkDerivation { meta = { description = "The Forth implementation of the GNU project"; - homepage = "https://www.gnu.org/software/gforth/"; + homepage = "https://github.com/forthy42/gforth"; license = lib.licenses.gpl3; platforms = lib.platforms.all; }; + } diff --git a/pkgs/development/compilers/gforth/fix-install-txt.patch b/pkgs/development/compilers/gforth/fix-install-txt.patch new file mode 100644 index 000000000000..71f67e6fe65e --- /dev/null +++ b/pkgs/development/compilers/gforth/fix-install-txt.patch @@ -0,0 +1,25 @@ +From c03408921ee8f5592e19cfcb64132a320fbd6279 Mon Sep 17 00:00:00 2001 +From: Herwig Hochleitner +Date: Thu, 9 Sep 2021 18:19:42 +0200 +Subject: [PATCH 1/2] fix install-txt task + +--- + Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile.in b/Makefile.in +index 5fe49787..51ad67c6 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -839,7 +839,7 @@ install-gensources: + done + echo "\\ empty site-init" > $(siteforthdir)/siteinit.fs + +-install-txt: doc ++install-txt: txt + $(INSTALL_DATA) doc/gforth.txt $(datadir)/gforth/$(VERSION)/doc/gforth.txt + + install-images: install-txt +-- +2.33.0 + From 0e00c0b8f3c2f3eea9ef70daa2eaf02aac2fa464 Mon Sep 17 00:00:00 2001 From: Herwig Hochleitner Date: Fri, 26 Nov 2021 02:42:32 +0100 Subject: [PATCH 2/5] gforth: replace name with pname Co-authored-by: Ben Siraphob --- pkgs/development/compilers/gforth/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/gforth/default.nix b/pkgs/development/compilers/gforth/default.nix index a36f8f4a2d38..9b59167d3139 100644 --- a/pkgs/development/compilers/gforth/default.nix +++ b/pkgs/development/compilers/gforth/default.nix @@ -14,7 +14,7 @@ let bootForth = callPackage ./boot-forth.nix { }; in stdenv.mkDerivation { - name = "gforth-${version}"; + pname = "gforth"; inherit version; src = fetchFromGitHub { owner = "forthy42"; From 1a5c6d8d551c44242d2d31965534dcb2cf5b79cb Mon Sep 17 00:00:00 2001 From: Herwig Hochleitner Date: Fri, 26 Nov 2021 03:22:47 +0100 Subject: [PATCH 3/5] gforth: remove useless comment Co-authored-by: Dmitry Kalinkin --- pkgs/development/compilers/gforth/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/gforth/default.nix b/pkgs/development/compilers/gforth/default.nix index 9b59167d3139..22a7d35ec8f9 100644 --- a/pkgs/development/compilers/gforth/default.nix +++ b/pkgs/development/compilers/gforth/default.nix @@ -33,7 +33,7 @@ in stdenv.mkDerivation { passthru = { inherit bootForth; }; - configureFlags = # [ "--enable-lib" ] ++ + configureFlags = lib.optional stdenv.isDarwin [ "--build=x86_64-apple-darwin" ]; postInstall = '' From 08836b254e9bbb684d50b2320e0969466e2bda75 Mon Sep 17 00:00:00 2001 From: Herwig Hochleitner Date: Tue, 8 Feb 2022 02:33:52 +0100 Subject: [PATCH 4/5] gforth: enable swig bindings --- pkgs/development/compilers/gforth/default.nix | 37 +++++++------------ .../compilers/gforth/fix-install-txt.patch | 25 ------------- pkgs/development/compilers/gforth/swig.nix | 16 ++++++++ 3 files changed, 30 insertions(+), 48 deletions(-) delete mode 100644 pkgs/development/compilers/gforth/fix-install-txt.patch create mode 100644 pkgs/development/compilers/gforth/swig.nix diff --git a/pkgs/development/compilers/gforth/default.nix b/pkgs/development/compilers/gforth/default.nix index 22a7d35ec8f9..d184ec3748f7 100644 --- a/pkgs/development/compilers/gforth/default.nix +++ b/pkgs/development/compilers/gforth/default.nix @@ -1,40 +1,32 @@ -{ lib, stdenv, callPackage, autoreconfHook, texinfo, fetchFromGitHub -, swig, libffi +{ lib, stdenv, fetchFromGitHub, callPackage +, autoreconfHook, texinfo, libffi }: -let - version = "0.7.9_20211111"; - sha256 = "sha256-KwYPMWdsL9o8SVcNdENMs4C9ioFBEfyVMqe5bgIrfzs="; - ## FIXME build https://github.com/GeraldWodni/swig with gforth, then rebuild - #### This will get rid of the configuration warning - # swigf = swig.overrideDerivation (old: { - # configureFlags = old.configureFlags ++ [ - # "--enable-forth" - # ]; - # }); - bootForth = callPackage ./boot-forth.nix { }; -in stdenv.mkDerivation { - pname = "gforth"; - inherit version; +let + swig = callPackage ./swig.nix { }; + bootForth = callPackage ./boot-forth.nix { }; +in stdenv.mkDerivation rec { + + name = "gforth-${version}"; + version = "0.7.9_20220127"; + src = fetchFromGitHub { owner = "forthy42"; repo = "gforth"; rev = version; - inherit sha256; + sha256 = "sha256-3+ObHhsPvW44UFiN0GWOhwo7aiqhjwxNY8hw2Wv4MK0="; }; - patches = [ ./fix-install-txt.patch ]; nativeBuildInputs = [ - autoreconfHook texinfo bootForth + autoreconfHook texinfo bootForth swig ]; buildInputs = [ - swig libffi + libffi ]; passthru = { inherit bootForth; }; - configureFlags = - lib.optional stdenv.isDarwin [ "--build=x86_64-apple-darwin" ]; + configureFlags = lib.optional stdenv.isDarwin [ "--build=x86_64-apple-darwin" ]; postInstall = '' mkdir -p $out/share/emacs/site-lisp @@ -47,5 +39,4 @@ in stdenv.mkDerivation { license = lib.licenses.gpl3; platforms = lib.platforms.all; }; - } diff --git a/pkgs/development/compilers/gforth/fix-install-txt.patch b/pkgs/development/compilers/gforth/fix-install-txt.patch deleted file mode 100644 index 71f67e6fe65e..000000000000 --- a/pkgs/development/compilers/gforth/fix-install-txt.patch +++ /dev/null @@ -1,25 +0,0 @@ -From c03408921ee8f5592e19cfcb64132a320fbd6279 Mon Sep 17 00:00:00 2001 -From: Herwig Hochleitner -Date: Thu, 9 Sep 2021 18:19:42 +0200 -Subject: [PATCH 1/2] fix install-txt task - ---- - Makefile.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile.in b/Makefile.in -index 5fe49787..51ad67c6 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -839,7 +839,7 @@ install-gensources: - done - echo "\\ empty site-init" > $(siteforthdir)/siteinit.fs - --install-txt: doc -+install-txt: txt - $(INSTALL_DATA) doc/gforth.txt $(datadir)/gforth/$(VERSION)/doc/gforth.txt - - install-images: install-txt --- -2.33.0 - diff --git a/pkgs/development/compilers/gforth/swig.nix b/pkgs/development/compilers/gforth/swig.nix new file mode 100644 index 000000000000..8de29407cc46 --- /dev/null +++ b/pkgs/development/compilers/gforth/swig.nix @@ -0,0 +1,16 @@ +{ swig3, fetchFromGitHub }: + +## for updating to swig4, see +## https://github.com/GeraldWodni/swig/pull/6 +swig3.overrideDerivation (old: { + version = "3.0.9-forth"; + src = fetchFromGitHub { + owner = "GeraldWodni"; + repo = "swig"; + rev = "a45b807e5f9d8ca1a43649c8265d2741a393862a"; + sha256 = "sha256-6nOOPFGFNaQInEkul0ZAh+ks9n3wqCQ6/tbduvG/To0="; + }; + configureFlags = old.configureFlags ++ [ + "--enable-forth" + ]; +}) From 3b050bd9c3a972cf090211a0767dded75ab9a572 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Mon, 7 Feb 2022 21:50:20 -0500 Subject: [PATCH 5/5] gforth: use pname --- pkgs/development/compilers/gforth/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/gforth/default.nix b/pkgs/development/compilers/gforth/default.nix index d184ec3748f7..3b60d9fb179f 100644 --- a/pkgs/development/compilers/gforth/default.nix +++ b/pkgs/development/compilers/gforth/default.nix @@ -7,7 +7,7 @@ let bootForth = callPackage ./boot-forth.nix { }; in stdenv.mkDerivation rec { - name = "gforth-${version}"; + pname = "gforth"; version = "0.7.9_20220127"; src = fetchFromGitHub {