nixpkgs/pkgs/by-name/sn/snappy/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

64 lines
1.8 KiB
Nix

{ lib, stdenv, fetchFromGitHub, cmake
, fetchpatch
, static ? stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec {
pname = "snappy";
version = "1.2.1";
src = fetchFromGitHub {
owner = "google";
repo = "snappy";
rev = version;
hash = "sha256-IzKzrMDjh+Weor+OrKdX62cAKYTdDXgldxCgNE2/8vk=";
};
patches = [
# Re-enable RTTI, without which other applications can't subclass
# snappy::Source (this breaks Ceph, as one example)
# https://tracker.ceph.com/issues/53060
# https://build.opensuse.org/package/show/openSUSE:Factory/snappy
(fetchpatch {
url = "https://build.opensuse.org/public/source/openSUSE:Factory/snappy/reenable-rtti.patch?rev=a759aa6fba405cd40025e3f0ab89941d";
sha256 = "sha256-RMuM5yd6zP1eekN/+vfS54EyY4cFbGDVor1E1vj3134=";
})
];
outputs = [ "out" "dev" ];
nativeBuildInputs = [ cmake ];
cmakeFlags = [
"-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
"-DSNAPPY_BUILD_TESTS=OFF"
"-DSNAPPY_BUILD_BENCHMARKS=OFF"
];
postInstall = ''
substituteInPlace "$out"/lib/cmake/Snappy/SnappyTargets.cmake \
--replace 'INTERFACE_INCLUDE_DIRECTORIES "''${_IMPORT_PREFIX}/include"' 'INTERFACE_INCLUDE_DIRECTORIES "'$dev'"'
mkdir -p $dev/lib/pkgconfig
cat <<EOF > $dev/lib/pkgconfig/snappy.pc
Name: snappy
Description: Fast compressor/decompressor library.
Version: ${version}
Libs: -L$out/lib -lsnappy
Cflags: -I$dev/include
EOF
'';
#checkTarget = "test";
# requires gbenchmark and gtest but it also installs them out $dev
doCheck = false;
meta = with lib; {
homepage = "https://google.github.io/snappy/";
license = licenses.bsd3;
description = "Compression/decompression library for very high speeds";
platforms = platforms.all;
};
}