nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 cmake,
7 brotli,
8}:
9
10stdenv.mkDerivation (finalAttrs: {
11 pname = "brunsli";
12 version = "0.1";
13
14 outputs = [
15 "out"
16 "dev"
17 ];
18
19 src = fetchFromGitHub {
20 owner = "google";
21 repo = "brunsli";
22 rev = "v${finalAttrs.version}";
23 hash = "sha256-ZcrRz2xSoRepgG8KZYY/JzgONerItW0e6mH1PYsko98=";
24 };
25
26 patches = [
27 # unvendor brotli
28 (fetchpatch {
29 url = "https://cgit.freebsd.org/ports/plain/graphics/brunsli/files/patch-CMakeLists.txt";
30 extraPrefix = "";
31 hash = "sha256-/WPOG9OcEDj9ObBSXEM8Luq4Rix+PS2MvsYyHhK5mns=";
32 })
33 (fetchpatch {
34 url = "https://cgit.freebsd.org/ports/plain/graphics/brunsli/files/patch-brunsli.cmake";
35 extraPrefix = "";
36 hash = "sha256-+HXA9Tin+l2St7rRUEBM0AfhAjSoFxz8UX7hsg12aFg=";
37 })
38 ];
39
40 postPatch = ''
41 rm -r third_party
42 ''
43 + lib.optionalString stdenv.hostPlatform.isDarwin ''
44 rm -r build
45 ''
46 # fix build with cmake v4, should be removed in next release
47 + ''
48 substituteInPlace CMakeLists.txt \
49 --replace-fail 'cmake_minimum_required(VERSION 3.1)' 'cmake_minimum_required(VERSION 3.10)'
50 '';
51
52 nativeBuildInputs = [
53 cmake
54 ];
55
56 buildInputs = [
57 brotli
58 ];
59
60 meta = {
61 description = "Lossless JPEG repacking library";
62 homepage = "https://github.com/google/brunsli";
63 license = lib.licenses.mit;
64 maintainers = with lib.maintainers; [ dotlambda ];
65 };
66})