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