git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #162395 from nepet/clightning/darwin

clightning: add darwin support

commitb2f1f7087223ca980102d4293fe5a3ca0cfd5469 authorPavol Rusnak <pavol@rusnak.io> dateWed 9 Mar 2022, 12:09 (5 years ago) parentd44916dd39c8a2
1 file changed+13−3
pkgs/applications/blockchains/clightning/default.nix+13−3
pkgs/applications/blockchains/clightning/default.nix+13−3
@@ -1,5 +1,6 @@
11{ lib
22, stdenv
3+, darwin
34, fetchurl
45, autoconf
56, automake
@@ -27,16 +28,25 @@ stdenv.mkDerivation rec {
2728 sha256 = "3c9dcb686217b2efe0e988e90b95777c4591e3335e259e01a94af87e0bf01809";
2829 };
2930
30− nativeBuildInputs = [ autogen autoconf automake gettext libtool pkg-config py3 unzip which ];
31+ # when building on darwin we need dawin.cctools to provide the correct libtool
32+ # as libwally-core detects the host as darwin and tries to add the -static
33+ # option to libtool, also we have to add the modified gsed package.
34+ nativeBuildInputs = [ autogen autoconf automake gettext pkg-config py3 unzip which ]
35+ ++ lib.optionals stdenv.isDarwin [ darwin.cctools darwin.autoSignDarwinBinariesHook ] ++ [ libtool ];
3136
3237 buildInputs = [ gmp libsodium sqlite zlib ];
3338
34− postPatch = ''
39+ # this causes some python trouble on a darwin host so we skip this step.
40+ # also we have to tell libwally-core to use sed instead of gsed.
41+ postPatch = if !stdenv.isDarwin then ''
3542 patchShebangs \
3643 tools/generate-wire.py \
3744 tools/update-mocks.sh \
3845 tools/mockup.sh \
3946 devtools/sql-rewrite.py
47+ '' else ''
48+ substituteInPlace external/libwally-core/tools/autogen.sh --replace gsed sed && \
49+ substituteInPlace external/libwally-core/configure.ac --replace gsed sed
4050 '';
4151
4252 configureFlags = [ "--disable-developer" "--disable-valgrind" ];
@@ -56,6 +66,6 @@ stdenv.mkDerivation rec {
5666 homepage = "https://github.com/ElementsProject/lightning";
5767 maintainers = with maintainers; [ jb55 prusnak ];
5868 license = licenses.mit;
59− platforms = platforms.linux;
69+ platforms = platforms.linux ++ platforms.darwin;
6070 };
6171}