about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/librclone/default.nix
blob: bb3053e19d53be572fc4b1ce89d47036e32ba275 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ lib
, stdenv
, buildGoModule
, rclone
}:

let
  ext = stdenv.hostPlatform.extensions.sharedLibrary;
in buildGoModule rec {
  pname = "librclone";
  inherit (rclone) version src vendorHash;

  patches = rclone.patches or [ ];

  buildPhase = ''
    runHook preBuild
    cd librclone
    go build --buildmode=c-shared -o librclone${ext} github.com/rclone/rclone/librclone
    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall
    install -Dt $out/lib librclone${ext}
    install -Dt $out/include librclone.h
    runHook postInstall
  '';

  meta = {
    description = "Rclone as a C library";
    homepage = "https://github.com/rclone/rclone/tree/master/librclone";
    maintainers = with lib.maintainers; [ dotlambda ];
    inherit (rclone.meta) license platforms;
  };
}