about summary refs log tree commit diff
path: root/pkgs/tools/misc/getopt/default.nix
blob: 6b6cbf66b13fb8bf50cd0e57bcedbd73a03c76e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{lib, stdenv, fetchurl}:

stdenv.mkDerivation rec {
  pname = "getopt";
  version = "1.1.6";
  src = fetchurl {
    url = "http://frodo.looijaard.name/system/files/software/${pname}/${pname}-${version}.tar.gz";
    sha256 = "1zn5kp8ar853rin0ay2j3p17blxy16agpp8wi8wfg4x98b31vgyh";
  };

  # This should be fine on Linux and Darwin. Clang 16 requires it because otherwise getopt will
  # attempt to use C library functions without declaring them, which is raised as an error.
  env.NIX_CFLAGS_COMPILE = "-D__GNU_LIBRARY__";

  makeFlags = [
    "WITHOUT_GETTEXT=1"
    "LIBCGETOPT=0"
    "prefix=${placeholder "out"}"
    "CC:=$(CC)"
  ];

  meta = {
    platforms = lib.platforms.unix;
    homepage = "http://frodo.looijaard.name/project/getopt";
    description = "Parses command-line arguments from shell scripts";
    mainProgram = "getopt";
  };
}