Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / libb64 / default.nix
blob3b24089e53c636dde6879e654c02a2132a361a62
1 { lib, stdenv, fetchFromGitHub, fetchpatch }:
3 stdenv.mkDerivation rec {
4   pname = "libb64";
5   version = "2.0.0.1";
7   src = fetchFromGitHub {
8     owner = "libb64";
9     repo = "libb64";
10     rev = "v${version}";
11     sha256 = "sha256-9loDftr769qnIi00MueO86kjha2EiG9pnCLogp0Iq3c=";
12   };
14   patches = [
15     # Fix parallel build failure: https://github.com/libb64/libb64/pull/9
16     #  make[1]: *** No rule to make target 'libb64.a', needed by 'c-example1'.  Stop.
17     (fetchpatch {
18       name = "parallel-make.patch";
19       url = "https://github.com/libb64/libb64/commit/4fe47c052e9123da8f751545deb48be08c3411f6.patch";
20       sha256 = "18b3np3gpyzimqmk6001riqv5n70wfbclky6zzsrvj5zl1dj4ljf";
21     })
22     # Fix i686-linux build failure.
23     (fetchpatch {
24       name = "elif.patch";
25       url = "https://github.com/libb64/libb64/commit/819e43c8b34261ea3ee694bdc27865a033966083.patch";
26       hash = "sha256-r2jI6Q3rWDtArLlkAuyy7vcjsuRvX+2fBd5yk8XOMcc";
27     })
28     (fetchpatch {
29       name = "size_t.patch";
30       url = "https://github.com/libb64/libb64/commit/b5edeafc89853c48fa41a4c16393a1fdc8638ab6.patch";
31       hash = "sha256-+bqfOOlT/t0FLQEMHuxW1BxJcx9rk0yYM3wD43mcymo";
32     })
33     # Fix build with Clang 16.
34     # https://github.com/libb64/libb64/pull/10
35     (fetchpatch {
36       name = "use-proper-function-prototype-for-main.patch";
37       url = "https://github.com/libb64/libb64/commit/98eaf510f40e384b32c01ad4bd5c3a697fdd8560.patch";
38       hash = "sha256-CGslJUw0og/bBBirLm0J5Q7cf2WW/vniVAkXHlb6lbQ=";
39     })
40   ] ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) (fetchpatch {
41     name = "0001-example-Do-not-run-the-tests.patch";
42     url = "https://cgit.openembedded.org/meta-openembedded/plain/meta-oe/recipes-support/libb64/libb64/0001-example-Do-not-run-the-tests.patch?id=484e0de1e4ee107f21ae2a5c5f976ed987978baf";
43     sha256 = "sha256-KTsiIWJe66BKlu/A43FWfW0XAu4E7lWX/RY4NITRrm4=";
44   });
46   enableParallelBuilding = true;
48   installPhase = ''
49     mkdir -p $out $out/lib $out/bin $out/include
50     cp -r include/* $out/include/
51     cp base64/base64 $out/bin/
52     cp src/libb64.a src/cencode.o src/cdecode.o $out/lib/
53   '';
55   meta = {
56     description = "ANSI C routines for fast base64 encoding/decoding";
57     homepage = "https://github.com/libb64/libb64";
58     license = lib.licenses.publicDomain;
59     mainProgram = "base64";
60     platforms = lib.platforms.unix;
61   };