summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorHerwig Hochleitner <herwig@bendlas.net>2022-02-08 09:09:55 +0100
committerGitHub <noreply@github.com>2022-02-08 09:09:55 +0100
commit7a31aa05e4baee33e9170cfbd09e98996041380b (patch)
treee20f6330b88ac64d5a4d505f20472b889f561f9c /pkgs/development/compilers
parentb9029d8341112b208a4e980461111fb63efd74bb (diff)
parent3b050bd9c3a972cf090211a0767dded75ab9a572 (diff)
downloadnixpkgs-7a31aa05e4baee33e9170cfbd09e98996041380b.tar
nixpkgs-7a31aa05e4baee33e9170cfbd09e98996041380b.tar.gz
nixpkgs-7a31aa05e4baee33e9170cfbd09e98996041380b.tar.bz2
nixpkgs-7a31aa05e4baee33e9170cfbd09e98996041380b.tar.lz
nixpkgs-7a31aa05e4baee33e9170cfbd09e98996041380b.tar.xz
nixpkgs-7a31aa05e4baee33e9170cfbd09e98996041380b.tar.zst
nixpkgs-7a31aa05e4baee33e9170cfbd09e98996041380b.zip
Merge pull request #146234 from NixOS/update-gforth-forthy42
gforth: 0.7.3 -> 0.7.9_20220127
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/gforth/boot-forth.nix24
-rw-r--r--pkgs/development/compilers/gforth/default.nix33
-rw-r--r--pkgs/development/compilers/gforth/swig.nix16
3 files changed, 63 insertions, 10 deletions
diff --git a/pkgs/development/compilers/gforth/boot-forth.nix b/pkgs/development/compilers/gforth/boot-forth.nix
new file mode 100644
index 00000000000..fc7b5ffa982
--- /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 bdf172cb9b9..3b60d9fb179 100644
--- a/pkgs/development/compilers/gforth/default.nix
+++ b/pkgs/development/compilers/gforth/default.nix
@@ -1,17 +1,30 @@
-{ lib, stdenv, fetchurl, m4 }:
+{ lib, stdenv, fetchFromGitHub, callPackage
+, autoreconfHook, texinfo, libffi
+}:
 
 let
-  version = "0.7.3";
-in
-stdenv.mkDerivation {
+  swig = callPackage ./swig.nix { };
+  bootForth = callPackage ./boot-forth.nix { };
+in stdenv.mkDerivation rec {
+
   pname = "gforth";
-  inherit version;
-  src = fetchurl {
-    url = "https://ftp.gnu.org/gnu/gforth/gforth-${version}.tar.gz";
-    sha256 = "1c1bahc9ypmca8rv2dijiqbangm1d9av286904yw48ph7ciz4qig";
+  version = "0.7.9_20220127";
+
+  src = fetchFromGitHub {
+    owner = "forthy42";
+    repo = "gforth";
+    rev = version;
+    sha256 = "sha256-3+ObHhsPvW44UFiN0GWOhwo7aiqhjwxNY8hw2Wv4MK0=";
   };
 
-  buildInputs = [ m4 ];
+  nativeBuildInputs = [
+    autoreconfHook texinfo bootForth swig
+  ];
+  buildInputs = [
+    libffi
+  ];
+
+  passthru = { inherit bootForth; };
 
   configureFlags = lib.optional stdenv.isDarwin [ "--build=x86_64-apple-darwin" ];
 
@@ -22,7 +35,7 @@ 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/swig.nix b/pkgs/development/compilers/gforth/swig.nix
new file mode 100644
index 00000000000..8de29407cc4
--- /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"
+  ];
+})