1{lib, stdenv, fetchurl}:
2
3stdenv.mkDerivation rec {
4 pname = "getopt";
5 version = "1.1.6";
6 src = fetchurl {
7 url = "http://frodo.looijaard.name/system/files/software/${pname}/${pname}-${version}.tar.gz";
8 sha256 = "1zn5kp8ar853rin0ay2j3p17blxy16agpp8wi8wfg4x98b31vgyh";
9 };
10
11 # This should be fine on Linux and Darwin. Clang 16 requires it because otherwise getopt will
12 # attempt to use C library functions without declaring them, which is raised as an error.
13 env.NIX_CFLAGS_COMPILE = "-D__GNU_LIBRARY__";
14
15 makeFlags = [
16 "WITHOUT_GETTEXT=1"
17 "LIBCGETOPT=0"
18 "prefix=${placeholder "out"}"
19 "CC:=$(CC)"
20 ];
21
22 meta = {
23 platforms = lib.platforms.unix;
24 homepage = "http://frodo.looijaard.name/project/getopt";
25 description = "Parses command-line arguments from shell scripts";
26 };
27}