2022-10-31 23:17:33 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fuse3, macfuse-stubs, pkg-config, sqlite, pcre }:
|
2015-01-09 06:06:22 +00:00
|
|
|
|
2021-03-25 16:40:28 +00:00
|
|
|
let
|
|
|
|
fuse = if stdenv.isDarwin then macfuse-stubs else fuse3;
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "tup";
|
2021-05-15 20:24:01 +00:00
|
|
|
version = "0.7.11";
|
2020-10-31 10:21:04 +00:00
|
|
|
outputs = [ "bin" "man" "out" ];
|
2015-01-09 06:06:22 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "gittup";
|
|
|
|
repo = "tup";
|
|
|
|
rev = "v${version}";
|
2021-05-15 20:24:01 +00:00
|
|
|
hash = "sha256-Q2Y5ErcfhLChi9Wezn8+7eNXYX2UXW1fBOqEclmgzOo=";
|
2015-01-09 06:06:22 +00:00
|
|
|
};
|
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2022-10-31 23:17:33 +00:00
|
|
|
buildInputs = [ fuse pcre sqlite ];
|
2015-01-09 06:06:22 +00:00
|
|
|
|
2022-04-29 18:24:38 +00:00
|
|
|
patches = [ ./fusermount-setuid.patch ];
|
|
|
|
|
2015-01-09 06:06:22 +00:00
|
|
|
configurePhase = ''
|
2021-05-15 20:24:01 +00:00
|
|
|
substituteInPlace src/tup/link.sh --replace '`git describe' '`echo ${version}'
|
2022-10-31 23:08:02 +00:00
|
|
|
|
|
|
|
for f in Tupfile Tuprules.tup src/tup/server/Tupfile build.sh; do
|
|
|
|
substituteInPlace "$f" \
|
|
|
|
--replace "pkg-config" "${stdenv.cc.targetPrefix}pkg-config" \
|
|
|
|
--replace "pcre-config" "${stdenv.cc.targetPrefix}pkg-config libpcre"
|
|
|
|
done
|
|
|
|
|
|
|
|
cat << EOF > tup.config
|
|
|
|
CONFIG_CC=${stdenv.cc.targetPrefix}cc
|
|
|
|
CONFIG_AR=${stdenv.cc.targetPrefix}ar
|
2022-10-31 23:17:33 +00:00
|
|
|
CONFIG_TUP_USE_SYSTEM_SQLITE=y
|
2022-10-31 23:08:02 +00:00
|
|
|
EOF
|
2015-01-09 06:06:22 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# Regular tup builds require fusermount to have suid, which nix cannot
|
|
|
|
# currently provide in a build environment, so we bootstrap and use 'tup
|
|
|
|
# generate' instead
|
|
|
|
buildPhase = ''
|
2021-05-15 20:24:01 +00:00
|
|
|
runHook preBuild
|
2015-01-09 06:06:22 +00:00
|
|
|
./build.sh
|
2018-12-28 01:14:11 +00:00
|
|
|
./build/tup init
|
2015-01-09 06:06:22 +00:00
|
|
|
./build/tup generate script.sh
|
|
|
|
./script.sh
|
2021-05-15 20:24:01 +00:00
|
|
|
runHook postBuild
|
2015-01-09 06:06:22 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2021-05-15 20:24:01 +00:00
|
|
|
runHook preInstall
|
2020-10-31 10:21:04 +00:00
|
|
|
install -D tup -t $bin/bin/
|
|
|
|
install -D tup.1 -t $man/share/man/man1/
|
2021-05-15 20:24:01 +00:00
|
|
|
runHook postInstall
|
2015-01-09 06:06:22 +00:00
|
|
|
'';
|
|
|
|
|
2020-06-13 05:33:55 +00:00
|
|
|
setupHook = ./setup-hook.sh;
|
2020-06-13 05:26:20 +00:00
|
|
|
|
2021-01-23 12:26:19 +00:00
|
|
|
meta = with lib; {
|
2015-01-09 06:06:22 +00:00
|
|
|
description = "A fast, file-based build system";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "tup";
|
2015-01-09 06:06:22 +00:00
|
|
|
longDescription = ''
|
|
|
|
Tup is a file-based build system for Linux, OSX, and Windows. It inputs a list
|
|
|
|
of file changes and a directed acyclic graph (DAG), then processes the DAG to
|
|
|
|
execute the appropriate commands required to update dependent files. Updates are
|
|
|
|
performed with very little overhead since tup implements powerful build
|
|
|
|
algorithms to avoid doing unnecessary work. This means you can stay focused on
|
|
|
|
your project rather than on your build system.
|
|
|
|
'';
|
2023-01-21 21:41:12 +00:00
|
|
|
homepage = "https://gittup.org/tup/";
|
2015-01-09 06:06:22 +00:00
|
|
|
license = licenses.gpl2;
|
2020-06-13 05:25:22 +00:00
|
|
|
maintainers = with maintainers; [ ehmry ];
|
2021-03-25 16:40:28 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
|
|
|
|
# TODO: Remove once nixpkgs uses newer SDKs that supports '*at' functions.
|
|
|
|
# Probably MacOS SDK 10.13 or later. Check the current version in
|
|
|
|
# ../../../../os-specific/darwin/apple-sdk/default.nix
|
|
|
|
#
|
|
|
|
# https://github.com/gittup/tup/commit/3697c74
|
|
|
|
broken = stdenv.isDarwin;
|
2015-01-09 06:06:22 +00:00
|
|
|
};
|
|
|
|
}
|