nixpkgs/pkgs/by-name/li/libcork/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

53 lines
1.5 KiB
Nix

{ stdenv
, fetchFromGitHub
, cmake
, lib
, pkg-config
, check
}:
stdenv.mkDerivation rec {
pname = "libcork";
version = "1.0.0--rc3";
src = fetchFromGitHub {
owner = "dcreager";
repo = pname;
rev = version;
sha256 = "152gqnmr6wfmflf5l6447am4clmg3p69pvy3iw7yhaawjqa797sk";
};
postPatch = ''
# N.B. We need to create this file, otherwise it tries to use git to
# determine the package version, which we do not want.
echo "${version}" > .version-stamp
echo "${version}" > .commit-stamp
# N.B. We disable tests by force, since their build is broken.
sed -i '/add_subdirectory(tests)/d' ./CMakeLists.txt
# https://github.com/dcreager/libcork/issues/173
substituteInPlace cmake/FindCTargets.cmake \
--replace '\$'{exec_prefix}/'$'{CMAKE_INSTALL_LIBDIR} '$'{CMAKE_INSTALL_FULL_LIBDIR} \
--replace '\$'{prefix}/'$'{CMAKE_INSTALL_INCLUDEDIR} '$'{CMAKE_INSTALL_FULL_INCLUDEDIR} \
--replace '\$'{datarootdir}/'$'{base_docdir} '$'{CMAKE_INSTALL_FULL_DOCDIR}
'';
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ check ];
doCheck = false;
postInstall = ''
ln -s $out/lib/libcork.so $out/lib/libcork.so.1
'';
meta = with lib; {
homepage = "https://github.com/dcreager/libcork";
description = "Simple, easily embeddable cross-platform C library";
mainProgram = "cork-hash";
license = licenses.bsd3;
platforms = platforms.unix;
maintainers = with maintainers; [ lovesegfault ];
};
}