about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHerwig Hochleitner <herwig@bendlas.net>2022-02-08 02:33:52 +0100
committerHerwig Hochleitner <herwig@bendlas.net>2022-02-08 02:36:18 +0100
commit08836b254e9bbb684d50b2320e0969466e2bda75 (patch)
tree9d7bf1f29862be71cb468169cbdf4a99f588813e
parent1a5c6d8d551c44242d2d31965534dcb2cf5b79cb (diff)
gforth: enable swig bindings
-rw-r--r--pkgs/development/compilers/gforth/default.nix33
-rw-r--r--pkgs/development/compilers/gforth/fix-install-txt.patch25
-rw-r--r--pkgs/development/compilers/gforth/swig.nix16
3 files changed, 28 insertions, 46 deletions
diff --git a/pkgs/development/compilers/gforth/default.nix b/pkgs/development/compilers/gforth/default.nix
index 22a7d35ec8f9e..d184ec3748f7f 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"
-  #   ];
-  # });
+  swig = callPackage ./swig.nix { };
   bootForth = callPackage ./boot-forth.nix { };
+in stdenv.mkDerivation rec {
+
+  name = "gforth-${version}";
+  version = "0.7.9_20220127";
 
-in stdenv.mkDerivation {
-  pname = "gforth";
-  inherit version;
   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 71f67e6fe65ee..0000000000000
--- 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 <herwig@bendlas.net>
-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 0000000000000..8de29407cc46d
--- /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"
+  ];
+})