linux_xanmod: 5.11.14 -> 5.11.15
[NixPkgs.git] / pkgs / development / libraries / libgpg-error / default.nix
blobda53a9916d05c3cac922a89ee66a7ee16636d367
1 { stdenv, lib, buildPackages, fetchurl, gettext
2 , genPosixLockObjOnly ? false
3 }: let
4   genPosixLockObjOnlyAttrs = lib.optionalAttrs genPosixLockObjOnly {
5     buildPhase = ''
6       cd src
7       make gen-posix-lock-obj
8     '';
10     installPhase = ''
11       mkdir -p $out/bin
12       install -m755 gen-posix-lock-obj $out/bin
13     '';
15     outputs = [ "out" ];
16     outputBin = "out";
17   };
18 in stdenv.mkDerivation (rec {
19   pname = "libgpg-error";
20   version = "1.41";
22   src = fetchurl {
23     url = "mirror://gnupg/${pname}/${pname}-${version}.tar.bz2";
24     sha256 = "0hi7jbcs1l9kxzhiqcs2iivsb048642mwaimgqyh1hy3bas7ic34";
25   };
27   postPatch = ''
28     sed '/BUILD_TIMESTAMP=/s/=.*/=1970-01-01T00:01+0000/' -i ./configure
29   '' + lib.optionalString (stdenv.hostPlatform.isAarch32 && stdenv.buildPlatform != stdenv.hostPlatform) ''
30     ln -s lock-obj-pub.arm-unknown-linux-gnueabi.h src/syscfg/lock-obj-pub.linux-gnueabihf.h
31     ln -s lock-obj-pub.arm-unknown-linux-gnueabi.h src/syscfg/lock-obj-pub.linux-gnueabi.h
32   '' + lib.optionalString (stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform.isMusl) ''
33     ln -s lock-obj-pub.x86_64-pc-linux-musl.h src/syscfg/lock-obj-pub.linux-musl.h
34   '' + lib.optionalString (stdenv.hostPlatform.isAarch32 && stdenv.hostPlatform.isMusl) ''
35     ln -s src/syscfg/lock-obj-pub.arm-unknown-linux-gnueabi.h src/syscfg/lock-obj-pub.arm-unknown-linux-musleabihf.h
36     ln -s src/syscfg/lock-obj-pub.arm-unknown-linux-gnueabi.h src/syscfg/lock-obj-pub.linux-musleabihf.h
37   ''
38   # This file was accidentally excluded from the sdist until
39   # 013720333c6ec1d38791689bc49ba039d98e16b3, post release.
40   # TODO make unconditional next mass rebuild
41   + lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
42     cp ${fetchurl {
43       url = "https://raw.githubusercontent.com/gpg/libgpg-error/50e62b36ea01ed25d12c443088b85d4f41a2b3e1/src/gen-lock-obj.sh";
44       sha256 = "10cslipa6npalj869asaamj0w941dhmx0yjafpyyh69ypsg2m2c3";
45     }} ./src/gen-lock-obj.sh
46     chmod +x ./src/gen-lock-obj.sh
47   '';
49   outputs = [ "out" "dev" "info" ];
50   outputBin = "dev"; # deps want just the lib, most likely
52   # If architecture-dependent MO files aren't available, they're generated
53   # during build, so we need gettext for cross-builds.
54   depsBuildBuild = [ buildPackages.stdenv.cc ];
55   nativeBuildInputs = [ gettext ];
57   postConfigure =
58     lib.optionalString stdenv.isSunOS
59     # For some reason, /bin/sh on OpenIndiana leads to this at the end of the
60     # `config.status' run:
61     #   ./config.status[1401]: shift: (null): bad number
62     # (See <https://hydra.nixos.org/build/2931046/nixlog/1/raw>.)
63     # Thus, re-run it with Bash.
64       "${stdenv.shell} config.status";
66   doCheck = true; # not cross
68   meta = with lib; {
69     homepage = "https://www.gnupg.org/software/libgpg-error/index.html";
70     changelog = "https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgpg-error.git;a=blob;f=NEWS;hb=refs/tags/libgpg-error-${version}";
71     description = "A small library that defines common error values for all GnuPG components";
73     longDescription = ''
74       Libgpg-error is a small library that defines common error values
75       for all GnuPG components.  Among these are GPG, GPGSM, GPGME,
76       GPG-Agent, libgcrypt, Libksba, DirMngr, Pinentry, SmartCard
77       Daemon and possibly more in the future.
78     '';
80     license = licenses.lgpl2Plus;
81     platforms = platforms.all;
82     maintainers = [ maintainers.vrthra ];
83   };
84 } // genPosixLockObjOnlyAttrs)