rclone: build with 'cmount' support (#117119)

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
midchildan 2021-04-07 17:41:35 +09:00 committed by GitHub
parent b219457ac0
commit de679c57ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,7 @@
{ lib, stdenv, buildGoModule, fetchFromGitHub, buildPackages, installShellFiles }:
{ lib, stdenv, buildGoModule, fetchFromGitHub, buildPackages, installShellFiles
, makeWrapper
, enableCmount ? true, fuse, macfuse-stubs
}:
buildGoModule rec {
pname = "rclone";
@ -17,9 +20,11 @@ buildGoModule rec {
outputs = [ "out" "man" ];
nativeBuildInputs = [ installShellFiles ];
buildInputs = lib.optional enableCmount (if stdenv.isDarwin then macfuse-stubs else fuse);
nativeBuildInputs = [ installShellFiles makeWrapper ];
buildFlagsArray = [ "-ldflags=-s -w -X github.com/rclone/rclone/fs.Version=${version}" ];
buildFlagsArray = lib.optionals enableCmount [ "-tags=cmount" ]
++ [ "-ldflags=-s -w -X github.com/rclone/rclone/fs.Version=${version}" ];
postInstall =
let
@ -34,6 +39,8 @@ buildGoModule rec {
${rcloneBin}/bin/rclone genautocomplete $shell rclone.$shell
installShellCompletion rclone.$shell
done
'' + lib.optionalString (enableCmount && !stdenv.isDarwin) ''
wrapProgram $out/bin/rclone --prefix LD_LIBRARY_PATH : "${fuse}/lib"
'';
meta = with lib; {