nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 gettext,
6}:
7
8stdenv.mkDerivation rec {
9 pname = "checkinstall";
10 version = "1.6.2";
11
12 src = fetchurl {
13 url = "https://www.asic-linux.com.mx/~izto/checkinstall/files/source/checkinstall-${version}.tar.gz";
14 sha256 = "1x4kslyvfd6lm6zd1ylbq2pjxrafb77ydfjaqi16sa5qywn1jqfw";
15 };
16
17 patches = [
18 # Include empty directories created by the installation script in
19 # generated packages. (E.g., if a `make install' does `mkdir
20 # /var/lib/mystuff', then /var/lib/mystuff should be included in
21 # the package.)
22 ./empty-dirs.patch
23
24 # Implement the getxattr(), lgetxattr(), __open_2() and
25 # __open64_2() functions. Needed for doing builds on Ubuntu 8.10.
26 ./missing-functions.patch
27
28 # Don't include directories in the Debian `conffiles' file.
29 ./etc-dirs.patch
30
31 # Support Glibc >= 2.8.
32 ./glibc-check.patch
33
34 # Fix a `conflicting types for 'scandir'' error on Glibc 2.11.
35 ./scandir.patch
36
37 # Fix a `conflicting types for 'readlink'' error since Glibc 2.19
38 ./readlink-types.patch
39
40 # Fix BuildRoot handling in RPM builds.
41 ./set-buildroot.patch
42
43 (fetchurl {
44 url = "https://salsa.debian.org/debian/checkinstall/-/raw/7175ae9de0e45f42fdd7f185ab9a12043d5efeeb/debian/patches/0016-Define-_STAT_VER-_MKNOD_VER-locally-dropped-in-glibc.patch";
45 hash = "sha256-InodEfvVMuN708yjXPrVXb+q8aUcyFhCLx35PHls0Eo=";
46 })
47 ]
48
49 ++
50 lib.optional (stdenv.hostPlatform.system == "x86_64-linux")
51 # Force use of old memcpy so that installwatch works on Glibc <
52 # 2.14.
53 ./use-old-memcpy.patch;
54
55 buildInputs = [ gettext ];
56
57 hardeningDisable = [ "fortify" ];
58
59 preBuild = ''
60 makeFlagsArray=(PREFIX=$out)
61
62 substituteInPlace checkinstall --replace /usr/local/lib/checkinstall $out/lib/checkinstall
63 substituteInPlace checkinstallrc-dist --replace /usr/local $out
64
65 substituteInPlace installwatch/create-localdecls \
66 --replace /usr/include/unistd.h ${stdenv.cc.libc.dev}/include/unistd.h
67 '';
68
69 postInstall =
70 # Clear the RPATH, otherwise installwatch.so won't work properly
71 # as an LD_PRELOADed library on applications that load against a
72 # different Glibc.
73 ''
74 patchelf --set-rpath "" $out/lib/installwatch.so
75 '';
76
77 meta = {
78 homepage = "https://checkinstall.izto.org/";
79 description = "Tool for automatically generating Slackware, RPM or Debian packages when doing `make install`";
80 maintainers = [ ];
81 platforms = lib.platforms.linux;
82 license = lib.licenses.gpl2Plus;
83 knownVulnerabilities = [
84 "CVE-2020-25031"
85 ];
86 };
87}