about summary refs log tree commit diff
path: root/pkgs/by-name/cd/cdecl/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/cd/cdecl/package.nix')
-rw-r--r--pkgs/by-name/cd/cdecl/package.nix68
1 files changed, 68 insertions, 0 deletions
diff --git a/pkgs/by-name/cd/cdecl/package.nix b/pkgs/by-name/cd/cdecl/package.nix
new file mode 100644
index 0000000000000..f23e6b833ae46
--- /dev/null
+++ b/pkgs/by-name/cd/cdecl/package.nix
@@ -0,0 +1,68 @@
+{
+  lib,
+  stdenv,
+  fetchFromGitHub,
+  autoconf,
+  automake,
+  bison,
+  flex,
+  readline,
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "cdecl";
+  version = "16.3";
+
+  src = fetchFromGitHub {
+    owner = "paul-j-lucas";
+    repo = "cdecl";
+    rev = "refs/tags/cdecl-${finalAttrs.version}";
+    hash = "sha256-4rysv/iLohx2y7WEaP4BG7lT1tm4FfU0NWcxI4gvUsg=";
+  };
+
+  strictDeps = true;
+  preConfigure = "./bootstrap";
+
+  nativeBuildInputs = [ autoconf automake bison flex ];
+  buildInputs = [ readline ];
+
+  env = {
+    NIX_CFLAGS_COMPILE = toString (
+      [
+        "-DBSD"
+        "-DUSE_READLINE"
+      ]
+      ++ lib.optionals stdenv.cc.isClang [
+        "-Wno-error=int-conversion"
+        "-Wno-error=incompatible-function-pointer-types"
+      ]
+    );
+    NIX_LDFLAGS = "-lreadline";
+  };
+
+  makeFlags = [
+    "CC=${stdenv.cc.targetPrefix}cc"
+    "PREFIX=${placeholder "out"}"
+    "BINDIR=${placeholder "out"}/bin"
+    "MANDIR=${placeholder "out"}/man1"
+    "CATDIR=${placeholder "out"}/cat1"
+  ];
+
+  doCheck = true;
+  checkTarget = "test";
+
+  preInstall = ''
+    mkdir -p $out/bin;
+  '';
+
+  outputs = [ "out" "man" ];
+
+  meta = {
+    description = "Composing and deciphering C (or C++) declarations or casts, aka ''gibberish.''";
+    homepage = "https://github.com/paul-j-lucas/cdecl";
+    license = lib.licenses.gpl3Only;
+    maintainers = with lib.maintainers; [ sigmanificient ];
+    platforms = lib.platforms.unix;
+    mainProgram = "cdecl";
+  };
+})