@@ -0,0 +1,41 @@
1+{ stdenv, fetchurl, fetchpatch }:
2+
3+stdenv.mkDerivation rec {
4+ name = "argp-standalone-1.3";
5+
6+ src = fetchurl {
7+ url = "https://www.lysator.liu.se/~nisse/misc/argp-standalone-1.3.tar.gz";
8+ sha256 = "dec79694da1319acd2238ce95df57f3680fea2482096e483323fddf3d818d8be";
9+ };
10+
11+ patches = [
12+ (if stdenv.hostPlatform.isDarwin then
13+ fetchpatch {
14+ name = "patch-argp-fmtstream.h";
15+ url = "https://raw.githubusercontent.com/Homebrew/formula-patches/b5f0ad3/argp-standalone/patch-argp-fmtstream.h";
16+ sha256 = "5656273f622fdb7ca7cf1f98c0c9529bed461d23718bc2a6a85986e4f8ed1cb8";
17+ }
18+ else null)
19+ ];
20+
21+ patchFlags = "-p0";
22+
23+ postInstall =
24+ ''
25+ mkdir -p $out/lib $out/include
26+ cp libargp.a $out/lib
27+ cp argp.h $out/include
28+ '';
29+
30+ doCheck = true;
31+
32+ enableParallelBuilding = true;
33+
34+ meta = with stdenv.lib; {
35+ homepage = "https://www.lysator.liu.se/~nisse/misc/";
36+ description = "Standalone version of arguments parsing functions from GLIBC";
37+ platforms = platforms.darwin;
38+ maintainers = with maintainers; [ amar1729 ];
39+ license = stdenv.lib.licenses.gpl2;
40+ };
41+}