lol
1{ lib, stdenv
2, build2
3, fetchpatch
4, fetchurl
5, git
6, libbpkg
7, libbutl
8, libodb
9, libodb-sqlite
10, openssl
11, enableShared ? !stdenv.hostPlatform.isStatic
12, enableStatic ? !enableShared
13}:
14
15stdenv.mkDerivation rec {
16 pname = "bpkg";
17 version = "0.15.0";
18
19 outputs = [ "out" "doc" "man" ];
20
21 src = fetchurl {
22 url = "https://pkg.cppget.org/1/alpha/build2/bpkg-${version}.tar.gz";
23 sha256 = "sha256-3F4Pv8YX++cNa6aKhPM67mrt/5oE1IeoZUSmljHqBfI=";
24 };
25
26 patches = [
27 # Patch git tests for git v2.38+
28 # Remove when bumping to v0.16.0 or greater
29 (fetchpatch {
30 url = "https://github.com/build2/bpkg/commit/a97b12a027546b37f66d3e08064f92f5539cf79.patch";
31 sha256 = "sha256-x5iJQXt84XyjZYdAmYO4FymSV2vi7nfIoeMOxFm/2eQ=";
32 })
33 ];
34
35 strictDeps = true;
36 nativeBuildInputs = [
37 build2
38 ];
39 buildInputs = [
40 build2
41 libbpkg
42 libbutl
43 libodb
44 libodb-sqlite
45 ];
46 nativeCheckInputs = [
47 git
48 openssl
49 ];
50
51 doCheck = !stdenv.isDarwin; # tests hang
52
53 # Failing test
54 postPatch = ''
55 rm tests/rep-create.testscript
56 '';
57
58 build2ConfigureFlags = [
59 "config.bin.lib=${build2.configSharedStatic enableShared enableStatic}"
60 ];
61
62 postInstall = lib.optionalString stdenv.isDarwin ''
63 install_name_tool -add_rpath '${lib.getLib build2}/lib' "''${!outputBin}/bin/bpkg"
64 '';
65
66 meta = with lib; {
67 description = "build2 package dependency manager";
68 # https://build2.org/bpkg/doc/bpkg.xhtml
69 longDescription = ''
70 The build2 package dependency manager is used to manipulate build
71 configurations, packages, and repositories.
72 '';
73 homepage = "https://build2.org/";
74 changelog = "https://git.build2.org/cgit/bpkg/tree/NEWS";
75 license = licenses.mit;
76 maintainers = with maintainers; [ r-burns ];
77 platforms = platforms.all;
78 };
79}