summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/ge/getopt/package.nix
blob: e0eada00728576c968eb98df1674f3113b621db5 (plain)
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
29
30
31
32
33
34
35
36
37
{
  lib,
  stdenv,
  fetchurl,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "getopt";
  version = "1.1.6";
  src = fetchurl {
    url = "https://frodo.looijaard.name/system/files/software/getopt/getopt-${finalAttrs.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__";

  strictDeps = true;

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

  __structuredAttrs = true;

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