2023-02-10 04:05:07 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildGoModule
|
|
|
|
, rclone
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
ext = stdenv.hostPlatform.extensions.sharedLibrary;
|
|
|
|
in buildGoModule rec {
|
|
|
|
pname = "librclone";
|
2023-07-18 08:44:39 +00:00
|
|
|
inherit (rclone) version src vendorHash;
|
|
|
|
|
|
|
|
patches = rclone.patches or [ ];
|
2023-02-10 04:05:07 +00:00
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
cd librclone
|
|
|
|
go build --buildmode=c-shared -o librclone${ext} github.com/rclone/rclone/librclone
|
2023-05-24 16:20:22 +00:00
|
|
|
runHook postBuild
|
2023-02-10 04:05:07 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|