base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / li / libcork / package.nix
blobc013775fcaeb0b4d75789d33cdc1afd909ed03a1
1 { stdenv
2 , fetchFromGitHub
3 , cmake
4 , lib
5 , pkg-config
6 , check
7 }:
8 stdenv.mkDerivation rec {
9   pname = "libcork";
10   version = "1.0.0--rc3";
12   src = fetchFromGitHub {
13     owner = "dcreager";
14     repo = pname;
15     rev = version;
16     sha256 = "152gqnmr6wfmflf5l6447am4clmg3p69pvy3iw7yhaawjqa797sk";
17   };
19   postPatch = ''
20     # N.B. We need to create this file, otherwise it tries to use git to
21     # determine the package version, which we do not want.
22     echo "${version}" > .version-stamp
23     echo "${version}" > .commit-stamp
25     # N.B. We disable tests by force, since their build is broken.
26     sed -i '/add_subdirectory(tests)/d' ./CMakeLists.txt
28     # https://github.com/dcreager/libcork/issues/173
29     substituteInPlace cmake/FindCTargets.cmake \
30       --replace '\$'{exec_prefix}/'$'{CMAKE_INSTALL_LIBDIR} '$'{CMAKE_INSTALL_FULL_LIBDIR} \
31       --replace '\$'{prefix}/'$'{CMAKE_INSTALL_INCLUDEDIR} '$'{CMAKE_INSTALL_FULL_INCLUDEDIR} \
32       --replace '\$'{datarootdir}/'$'{base_docdir} '$'{CMAKE_INSTALL_FULL_DOCDIR}
33   '';
35   nativeBuildInputs = [ cmake pkg-config ];
36   buildInputs = [ check ];
38   doCheck = false;
40   postInstall = ''
41     ln -s $out/lib/libcork.so $out/lib/libcork.so.1
42   '';
44   meta = with lib; {
45     homepage = "https://github.com/dcreager/libcork";
46     description = "Simple, easily embeddable cross-platform C library";
47     mainProgram = "cork-hash";
48     license = licenses.bsd3;
49     platforms = platforms.unix;
50     maintainers = with maintainers; [ lovesegfault ];
51   };