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