btrbk: add mainProgram
[NixPkgs.git] / pkgs / by-name / bo / boxes / package.nix
blobd7ef5515480531cdec7813bc19c2b6923f60727a
1 { lib, gccStdenv, fetchFromGitHub, bison, flex, pcre2, libunistring, ncurses }:
3 gccStdenv.mkDerivation rec {
4   pname = "boxes";
5   version = "2.3.1";
7   src = fetchFromGitHub {
8     owner = "ascii-boxes";
9     repo = "boxes";
10     rev = "v${version}";
11     hash = "sha256-dvhb5KWBQt7g4n0ZTQMcJQljIfavV3g8i+P3PWB6Gwk=";
12   };
14   # Building instructions:
15   # https://boxes.thomasjensen.com/build.html#building-on-linux--unix
16   nativeBuildInputs = [ bison flex ];
18   buildInputs = [ pcre2 libunistring ncurses ];
20   dontConfigure = true;
22   # Makefile references a system wide config file in '/usr/share'. Instead, we
23   # move it within the store by default.
24   preBuild = ''
25     substituteInPlace Makefile \
26       --replace-fail "GLOBALCONF = /usr/share/boxes" \
27                 "GLOBALCONF=${placeholder "out"}/share/boxes/boxes-config"
28   '';
30   makeFlags = [ "CC=${gccStdenv.cc.targetPrefix}cc" ];
32   installPhase = ''
33     install -Dm755 -t $out/bin out/boxes
34     install -Dm644 -t $out/share/boxes boxes-config
35     install -Dm644 -t $out/share/man/man1 doc/boxes.1
36   '';
38   meta = with lib; {
39     description = "Command line program which draws, removes, and repairs ASCII art boxes";
40     mainProgram = "boxes";
41     homepage = "https://boxes.thomasjensen.com";
42     license = licenses.gpl2Plus;
43     maintainers = with maintainers; [ waiting-for-dev ];
44     platforms = platforms.unix;
45   };