forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / by-name / tu / tup / package.nix
blobdb6a6058a00b536dc4fd5133d0e9ad57f9c332fb
1 { lib, stdenv, fetchFromGitHub, fuse3, macfuse-stubs, pkg-config, sqlite, pcre2 }:
3 let
4   fuse = if stdenv.hostPlatform.isDarwin then macfuse-stubs else fuse3;
5 in stdenv.mkDerivation rec {
6   pname = "tup";
7   version = "0.8";
8   outputs = [ "bin" "man" "out" ];
10   src = fetchFromGitHub {
11     owner = "gittup";
12     repo = "tup";
13     rev = "v${version}";
14     hash = "sha256-biVR932wHiUG56mvXoKWFzrzpkclbW9RWM4vY1+OMZ0=";
15   };
17   nativeBuildInputs = [ pkg-config ];
18   buildInputs = [ fuse pcre2 sqlite ];
20   patches = [ ./fusermount-setuid.patch ];
22   configurePhase = ''
23     substituteInPlace  src/tup/link.sh --replace '`git describe' '`echo ${version}'
25     cat << EOF > tup.config
26     CONFIG_CC=${stdenv.cc.targetPrefix}cc
27     CONFIG_AR=${stdenv.cc.targetPrefix}ar
28     CONFIG_TUP_USE_SYSTEM_SQLITE=y
29     EOF
30   '';
32   # Regular tup builds require fusermount to have suid, which nix cannot
33   # currently provide in a build environment, so we bootstrap and use 'tup
34   # generate' instead
35   buildPhase = ''
36     runHook preBuild
37     ./build.sh
38     ./build/tup init
39     ./build/tup generate script.sh
40     ./script.sh
41     runHook postBuild
42   '';
44   installPhase = ''
45     runHook preInstall
46     install -D tup -t $bin/bin/
47     install -D tup.1 -t $man/share/man/man1/
48     runHook postInstall
49   '';
51   setupHook = ./setup-hook.sh;
53   meta = with lib; {
54     description = "Fast, file-based build system";
55     mainProgram = "tup";
56     longDescription = ''
57       Tup is a file-based build system for Linux, OSX, and Windows. It inputs a list
58       of file changes and a directed acyclic graph (DAG), then processes the DAG to
59       execute the appropriate commands required to update dependent files. Updates are
60       performed with very little overhead since tup implements powerful build
61       algorithms to avoid doing unnecessary work. This means you can stay focused on
62       your project rather than on your build system.
63     '';
64     homepage = "https://gittup.org/tup/";
65     license = licenses.gpl2;
66     maintainers = with maintainers; [ ehmry ];
67     platforms = platforms.unix;
69     # TODO: Remove once nixpkgs uses newer SDKs that supports '*at' functions.
70     # Probably MacOS SDK 10.13 or later. Check the current version in
71     # ../../../../os-specific/darwin/apple-sdk/default.nix
72     #
73     # https://github.com/gittup/tup/commit/3697c74
74     broken = stdenv.hostPlatform.isDarwin;
75   };