btrbk: add mainProgram
[NixPkgs.git] / pkgs / by-name / st / stellar-core / package.nix
blob16865f7709f3429bf65072e934bc1f7a1755da06
1 { autoconf
2 , automake
3 , bison
4 , fetchFromGitHub
5 , fetchpatch
6 , flex
7 , git
8 , lib
9 , libtool
10 , libunwind
11 , pkg-config
12 , postgresql
13 , ripgrep
14 , stdenv
17 stdenv.mkDerivation (finalAttrs: {
18   pname = "stellar-core";
19   version = "19.14.0";
21   src = fetchFromGitHub {
22     owner = "stellar";
23     repo = "stellar-core";
24     rev = "v${finalAttrs.version}";
25     hash = "sha256-lxBn/T01Tsa7tid3mRJUigUwv9d3BAPZhV9Mp1lywBU=";
26     fetchSubmodules = true;
27   };
29   patches = [
30     # Fix gcc-13 build failure due to missing <stdexcept> include
31     #   https://github.com/stellar/medida/pull/34
32     (fetchpatch {
33       name = "gcc-13-p1.patch";
34       url = "https://github.com/stellar/medida/commit/f91354b0055de939779d392999975d611b1b1ad5.patch";
35       stripLen = 1;
36       extraPrefix = "lib/libmedida/";
37       hash = "sha256-iVeSUY5Rcy62apIKJdbcHGgxAxpQCkygf85oSjbTTXU=";
38     })
39     (fetchpatch {
40       name = "gcc-13-p2.patch";
41       url = "https://github.com/stellar/stellar-core/commit/477b3135281b629554cabaeacfcdbcdc170aa335.patch";
42       hash = "sha256-UVRcAIA5LEaCn16lWfhg19UU7b/apigzTsfPROLZtYg=";
43     })
44   ];
46   nativeBuildInputs = [
47     automake
48     autoconf
49     git
50     libtool
51     pkg-config
52     ripgrep
53   ];
55   buildInputs = [
56     libunwind
57   ];
59   propagatedBuildInputs = [
60     bison
61     flex
62     postgresql
63   ];
65   enableParallelBuilding = true;
67   preConfigure = ''
68     # Due to https://github.com/NixOS/nixpkgs/issues/8567 we cannot rely on
69     # having the .git directory present, so directly provide the version
70     substituteInPlace src/Makefile.am --replace '$$vers' 'stellar-core ${finalAttrs.version}';
72     # Everything needs to be staged in git because the build uses
73     # `git ls-files` to search for source files to compile.
74     git init
75     git add .
77     ./autogen.sh
78   '';
80   meta = {
81     description = "Implements the Stellar Consensus Protocol, a federated consensus protocol";
82     homepage = "https://www.stellar.org/";
83     license = lib.licenses.asl20;
84     longDescription = ''
85       Stellar-core is the backbone of the Stellar network. It maintains a
86       local copy of the ledger, communicating and staying in sync with other
87       instances of stellar-core on the network. Optionally, stellar-core can
88       store historical records of the ledger and participate in consensus.
89     '';
90     maintainers = [ ];
91     platforms = lib.platforms.linux;
92     mainProgram = "stellar-core";
93   };