nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 '';
9
10 installPhase = ''
11 mkdir -p $out/bin
12 install -m755 gen-posix-lock-obj $out/bin
13 '';
14
15 outputs = [ "out" ];
16 outputBin = "out";
17 };
18in stdenv.mkDerivation (rec {
19 pname = "libgpg-error";
20 version = "1.38";
21
22 src = fetchurl {
23 url = "mirror://gnupg/${pname}/${pname}-${version}.tar.bz2";
24 sha256 = "00px79xzyc5lj8aig7i4fhk29h1lkqp4840wjfgi9mv9m9sq566q";
25 };
26
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 '';
48
49 outputs = [ "out" "dev" "info" ];
50 outputBin = "dev"; # deps want just the lib, most likely
51
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 ];
56
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";
65
66 doCheck = true; # not cross
67
68 meta = with stdenv.lib; {
69 homepage = "https://www.gnupg.org/related_software/libgpg-error/index.html";
70 description = "A small library that defines common error values for all GnuPG components";
71
72 longDescription = ''
73 Libgpg-error is a small library that defines common error values
74 for all GnuPG components. Among these are GPG, GPGSM, GPGME,
75 GPG-Agent, libgcrypt, Libksba, DirMngr, Pinentry, SmartCard
76 Daemon and possibly more in the future.
77 '';
78
79 license = licenses.lgpl2Plus;
80 platforms = platforms.all;
81 maintainers = [ maintainers.vrthra ];
82 };
83} // genPosixLockObjOnlyAttrs)