summary refs log tree commit diff
path: root/pkgs/development/libraries/argp-standalone
diff options
context:
space:
mode:
authorAmar1729 <amar.paul16@gmail.com>2018-12-18 18:29:28 -0500
committerworldofpeace <worldofpeace@users.noreply.github.com>2019-04-09 22:32:04 -0400
commit2fe4ab320096e43ac4f8f382901701d63dc66ef2 (patch)
treebafde2bf77cf231ee1d3715963b05f4055635e16 /pkgs/development/libraries/argp-standalone
parent11a6d01db6685344d1ef6d1363e2437be3a60614 (diff)
downloadnixpkgs-2fe4ab320096e43ac4f8f382901701d63dc66ef2.tar
nixpkgs-2fe4ab320096e43ac4f8f382901701d63dc66ef2.tar.gz
nixpkgs-2fe4ab320096e43ac4f8f382901701d63dc66ef2.tar.bz2
nixpkgs-2fe4ab320096e43ac4f8f382901701d63dc66ef2.tar.lz
nixpkgs-2fe4ab320096e43ac4f8f382901701d63dc66ef2.tar.xz
nixpkgs-2fe4ab320096e43ac4f8f382901701d63dc66ef2.tar.zst
nixpkgs-2fe4ab320096e43ac4f8f382901701d63dc66ef2.zip
argp-standalone: add x86_64-linux support
Diffstat (limited to 'pkgs/development/libraries/argp-standalone')
-rw-r--r--pkgs/development/libraries/argp-standalone/default.nix54
1 files changed, 34 insertions, 20 deletions
diff --git a/pkgs/development/libraries/argp-standalone/default.nix b/pkgs/development/libraries/argp-standalone/default.nix
index f14c77f666b..4b8093f7403 100644
--- a/pkgs/development/libraries/argp-standalone/default.nix
+++ b/pkgs/development/libraries/argp-standalone/default.nix
@@ -1,5 +1,24 @@
 { stdenv, fetchurl, fetchpatch }:
 
+let
+  patch-argp-fmtstream = fetchpatch {
+    name = "patch-argp-fmtstream.h";
+    url = "https://raw.githubusercontent.com/Homebrew/formula-patches/b5f0ad3/argp-standalone/patch-argp-fmtstream.h";
+    sha256 = "5656273f622fdb7ca7cf1f98c0c9529bed461d23718bc2a6a85986e4f8ed1cb8";
+  };
+
+  patch-throw-in-funcdef = fetchpatch {
+    name = "argp-standalone-1.3-throw-in-funcdef.patch";
+    url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-libs/argp-standalone/files/argp-standalone-1.3-throw-in-funcdef.patch?id=409d0e2a9c9c899fb1fb04cc808fe0aff3f745ca";
+    sha256 = "0b2b4l1jkvmnffl22jcn4ydzxy2i7fnmmnfim12f0yg5pb8fs43c";
+  };
+
+  patch-shared = fetchpatch {
+    name = "argp-standalone-1.3-shared.patch";
+    url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-libs/argp-standalone/files/argp-standalone-1.3-shared.patch?id=409d0e2a9c9c899fb1fb04cc808fe0aff3f745ca";
+    sha256 = "1xx2zdc187a1m2x6c1qs62vcrycbycw7n0q3ks2zkxpaqzx2dgkw";
+  };
+in
 stdenv.mkDerivation rec {
   name = "argp-standalone-1.3";
 
@@ -8,24 +27,19 @@ stdenv.mkDerivation rec {
     sha256 = "dec79694da1319acd2238ce95df57f3680fea2482096e483323fddf3d818d8be";
   };
 
-  patches = [
-    (if stdenv.hostPlatform.isDarwin then
-    fetchpatch {
-      name = "patch-argp-fmtstream.h";
-      url = "https://raw.githubusercontent.com/Homebrew/formula-patches/b5f0ad3/argp-standalone/patch-argp-fmtstream.h";
-      sha256 = "5656273f622fdb7ca7cf1f98c0c9529bed461d23718bc2a6a85986e4f8ed1cb8";
-    }
-    else null)
-  ];
-
-  patchFlags = "-p0";
-
-  postInstall = 
-    ''
-      mkdir -p $out/lib $out/include
-      cp libargp.a $out/lib
-      cp argp.h $out/include
-    '';
+  patches =
+       stdenv.lib.optionals stdenv.hostPlatform.isDarwin [ patch-argp-fmtstream ]
+    ++ stdenv.lib.optionals stdenv.hostPlatform.isLinux [ patch-throw-in-funcdef patch-shared ];
+
+  patchFlags = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin "-p0";
+
+  preConfigure = stdenv.lib.optionalString stdenv.hostPlatform.isLinux "export CFLAGS='-fgnu89-inline'";
+
+  postInstall = ''
+    mkdir -p $out/lib $out/include
+    cp libargp.a $out/lib
+    cp argp.h $out/include
+  '';
 
   doCheck = true;
 
@@ -34,8 +48,8 @@ stdenv.mkDerivation rec {
   meta = with stdenv.lib; {
     homepage = "https://www.lysator.liu.se/~nisse/misc/";
     description = "Standalone version of arguments parsing functions from GLIBC";
-    platforms = platforms.darwin;
+    platforms = with platforms; darwin ++ [ "x86_64-linux" ];
     maintainers = with maintainers; [ amar1729 ];
-    license = stdenv.lib.licenses.gpl2;
+    license = licenses.gpl2;
   };
 }