about summary refs log tree commit diff
path: root/pkgs/development/compilers/gnu-cobol
diff options
context:
space:
mode:
authorMoritz Ulrich <moritz@tarn-vedra.de>2017-12-21 10:28:52 +0100
committerMoritz Ulrich <moritz@tarn-vedra.de>2017-12-21 10:40:02 +0100
commite222d21eed9ea6b83b08162ec49f7850aa64a299 (patch)
tree07430dd004e9ab63e3ddea73a73a941ae3ec8d6f /pkgs/development/compilers/gnu-cobol
parent362244787fc1d629fe9500f440affd263c142903 (diff)
downloadnixlib-e222d21eed9ea6b83b08162ec49f7850aa64a299.tar
nixlib-e222d21eed9ea6b83b08162ec49f7850aa64a299.tar.gz
nixlib-e222d21eed9ea6b83b08162ec49f7850aa64a299.tar.bz2
nixlib-e222d21eed9ea6b83b08162ec49f7850aa64a299.tar.lz
nixlib-e222d21eed9ea6b83b08162ec49f7850aa64a299.tar.xz
nixlib-e222d21eed9ea6b83b08162ec49f7850aa64a299.tar.zst
nixlib-e222d21eed9ea6b83b08162ec49f7850aa64a299.zip
gnu-cobol: 2.0-rc2 -> 2.2
Instead of wrapping `cobc` and setting NIX_{LDFLAGS,CFLAGS_COMPILE}
set `COB_CC`, `COB_CFLAGS` and `COB_LDFLAGS` to make `cobc` find the
necessary libraries.
Diffstat (limited to 'pkgs/development/compilers/gnu-cobol')
-rw-r--r--pkgs/development/compilers/gnu-cobol/default.nix29
1 files changed, 17 insertions, 12 deletions
diff --git a/pkgs/development/compilers/gnu-cobol/default.nix b/pkgs/development/compilers/gnu-cobol/default.nix
index f82fc17634da..3ac14565946c 100644
--- a/pkgs/development/compilers/gnu-cobol/default.nix
+++ b/pkgs/development/compilers/gnu-cobol/default.nix
@@ -1,35 +1,40 @@
 { stdenv, fetchurl, gcc, makeWrapper
 , db, gmp, ncurses }:
 
-let version = {
-  maj = "2.0";
-  min = "rc-2";
-};
-in 
+let
+  version = "2.2";
+  lib = stdenv.lib;
+in
 stdenv.mkDerivation rec {
-  name = "gnu-cobol-${version.maj}${version.min}";
+  name = "gnu-cobol-${version}";
+  inherit version;
 
   src = fetchurl {
-    url = "https://sourceforge.com/projects/open-cobol/files/gnu-cobol/${version.maj}/gnu-cobol-${version.maj}_${version.min}.tar.gz";
-    sha256 = "1pj7mjnp3l76zvzrh1xa6d4kw3jkvzqh39sbf02kiinq4y65s7zj";
+    url = "https://sourceforge.com/projects/open-cobol/files/gnu-cobol/${version}/gnucobol-${version}.tar.gz";
+    sha256 = "1jrjmdx0swssjh388pp08awhiisbrs2i7gx4lcm4p1k5rpg3hn4j";
   };
 
   nativeBuildInputs = [ makeWrapper ];
 
   buildInputs = [ db gmp ncurses ];
 
+  cflags  = stdenv.lib.concatMapStringsSep " " (p: "-L" + (lib.getLib p) + "/lib ") buildInputs;
+  ldflags = stdenv.lib.concatMapStringsSep " " (p: "-I" + (lib.getDev p) + "/include ") buildInputs;
+
+  cobolCCFlags = "-I$out/include ${ldflags} -L$out/lib ${cflags}";
+
   postInstall = with stdenv.lib; ''
     wrapProgram "$out/bin/cobc" \
-      --prefix PATH ':' "${gcc}/bin" \
-      --prefix NIX_LDFLAGS ' ' "'$NIX_LDFLAGS'" \
-      --prefix NIX_CFLAGS_COMPILE ' ' "'$NIX_CFLAGS_COMPILE'"
+      --set COB_CC "${gcc}/bin/gcc" \
+      --prefix COB_LDFLAGS " " "${cobolCCFlags}" \
+      --prefix COB_CFLAGS " " "${cobolCCFlags}"
   '';
 
   meta = with stdenv.lib; {
     description = "An open-source COBOL compiler";
     homepage = https://sourceforge.net/projects/open-cobol/;
     license = licenses.gpl3;
-    maintainers = with maintainers; [ ericsagnes ];
+    maintainers = with maintainers; [ ericsagnes the-kenny ];
     platforms = platforms.linux;
   };
 }