1{
2 cmake,
3 doxygen,
4 fetchFromGitHub,
5 graphviz,
6 lib,
7 libogg,
8 nix-update-script,
9 buildPackages,
10 pkg-config,
11 stdenv,
12 versionCheckHook,
13 enableManpages ? buildPackages.pandoc.compiler.bootstrapAvailable,
14}:
15stdenv.mkDerivation (finalAttrs: {
16 pname = "flac";
17 version = "1.5.0";
18
19 src = fetchFromGitHub {
20 owner = "xiph";
21 repo = "flac";
22 tag = finalAttrs.version;
23 hash = "sha256-B6XRai5UOAtY/7JXNbI3YuBgazi1Xd2ZOs6vvLq9LIs=";
24 };
25
26 hardeningDisable = [ "trivialautovarinit" ];
27
28 nativeBuildInputs = [
29 cmake
30 doxygen
31 graphviz
32 pkg-config
33 ]
34 ++ lib.optional enableManpages buildPackages.pandoc;
35
36 buildInputs = [ libogg ];
37
38 cmakeFlags =
39 lib.optionals (!stdenv.hostPlatform.isStatic) [
40 "-DBUILD_SHARED_LIBS=ON"
41 ]
42 ++ lib.optionals (!enableManpages) [
43 "-DINSTALL_MANPAGES=OFF"
44 ];
45
46 CFLAGS = [
47 "-O3"
48 "-funroll-loops"
49 ];
50 CXXFLAGS = [ "-O3" ];
51
52 patches = [ ./package.patch ];
53 doCheck = true;
54
55 outputs = [
56 "bin"
57 "dev"
58 "doc"
59 "out"
60 ]
61 ++ lib.optionals enableManpages [
62 "man"
63 ];
64
65 nativeInstallCheckInputs = [ versionCheckHook ];
66 doInstallCheck = true;
67 versionCheckProgramArg = "--version";
68
69 passthru.updateScript = nix-update-script { };
70
71 meta = {
72 homepage = "https://xiph.org/flac/";
73 description = "Library and tools for encoding and decoding the FLAC lossless audio file format";
74 changelog = "https://github.com/xiph/flac/releases/tag/${finalAttrs.version}";
75 mainProgram = "flac";
76 platforms = lib.platforms.all;
77 license = with lib.licenses; [
78 bsd3
79 fdl13Plus
80 gpl2Plus
81 lgpl21Plus
82 ];
83 maintainers = with lib.maintainers; [ ruuda ];
84 };
85})