Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib
2, stdenv
3, buildGoModule
4, rclone
5}:
6
7let
8 ext = stdenv.hostPlatform.extensions.sharedLibrary;
9in buildGoModule rec {
10 pname = "librclone";
11 inherit (rclone) version src vendorSha256;
12
13 buildPhase = ''
14 runHook preBuild
15 cd librclone
16 go build --buildmode=c-shared -o librclone${ext} github.com/rclone/rclone/librclone
17 runHook postBuild
18 '';
19
20 installPhase = ''
21 runHook preInstall
22 install -Dt $out/lib librclone${ext}
23 install -Dt $out/include librclone.h
24 runHook postInstall
25 '';
26
27 meta = {
28 description = "Rclone as a C library";
29 homepage = "https://github.com/rclone/rclone/tree/master/librclone";
30 maintainers = with lib.maintainers; [ dotlambda ];
31 inherit (rclone.meta) license platforms;
32 };
33}