nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchpatch,
6 texinfo,
7 nano,
8 autoreconfHook,
9}:
10
11let
12 version = "1.12.13";
13 debianRevision = "real-30";
14in
15
16stdenv.mkDerivation {
17 pname = "cvs";
18 version = "${version}+${debianRevision}";
19
20 src = fetchurl {
21 url = "mirror://savannah/cvs/source/feature/${version}/cvs-${version}.tar.bz2";
22 sha256 = "0pjir8cwn0087mxszzbsi1gyfc6373vif96cw4q3m1x6p49kd1bq";
23 };
24
25 patches = [
26 ./getcwd-chroot.patch
27 (fetchpatch {
28 url = "https://raw.githubusercontent.com/Homebrew/formula-patches/24118ec737c7/cvs/vasnprintf-high-sierra-fix.diff";
29 sha256 = "1ql6aaia7xkfq3vqhlw5bd2z2ywka82zk01njs1b2szn699liymg";
30 })
31 # Debian Patchset,
32 # contains patches for CVE-2017-12836 and CVE-2012-0804 among other things
33 (fetchurl {
34 url = "http://deb.debian.org/debian/pool/main/c/cvs/cvs_1.12.13+${debianRevision}.diff.gz";
35 sha256 = "085124619dfdcd3e53c726e049235791b67dcb9f71619f1e27c5f1cbdef0063e";
36 })
37 ];
38
39 hardeningDisable = [
40 "fortify"
41 "format"
42 ];
43
44 nativeBuildInputs = [
45 autoreconfHook
46 texinfo
47 ];
48
49 # Fix build with gcc15
50 # https://savannah.nongnu.org/bugs/index.php?66726
51 env.NIX_CFLAGS_COMPILE = "-std=gnu17";
52
53 configureFlags = [
54 "--with-editor=${nano}/bin/nano"
55
56 # Required for cross-compilation.
57 "cvs_cv_func_printf_ptr=yes"
58 ]
59 ++ lib.optionals (stdenv.hostPlatform.libc == "glibc") [
60 # So that fputs_unlocked is defined
61 "CFLAGS=-D_GNU_SOURCE"
62 ];
63
64 makeFlags = [
65 "AR=${stdenv.cc.targetPrefix}ar"
66 ]
67 ++ lib.optionals (!stdenv.cc.bintools.isGNU) [
68 # Don't pass --as-needed to linkers that don't support it
69 # (introduced in debian patchset)
70 "cvs_LDFLAGS="
71 ];
72
73 doCheck = false; # fails 1 of 1 tests
74
75 meta = {
76 homepage = "http://cvs.nongnu.org";
77 description = "Concurrent Versions System - a source control system";
78 license = lib.licenses.gpl2Plus; # library is GPLv2, main is GPLv1
79 platforms = lib.platforms.all;
80 };
81}