3
0
Fork 0
forked from mirrors/nixpkgs

gitFull: build libsecret credential helper (#43616)

...except on Darwin, where it won't be useful.
This commit is contained in:
Benjamin Staffin 2018-07-22 15:20:37 -04:00 committed by GitHub
parent 4ea202d328
commit 815ae70556
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 14 deletions

View file

@ -38,6 +38,7 @@ let
svnSupport = true; svnSupport = true;
guiSupport = true; guiSupport = true;
sendEmailSupport = !stdenv.isDarwin; sendEmailSupport = !stdenv.isDarwin;
withLibsecret = !stdenv.isDarwin;
}; };
# Git with SVN support, but without GUI. # Git with SVN support, but without GUI.

View file

@ -12,6 +12,8 @@
, withpcre2 ? true , withpcre2 ? true
, sendEmailSupport , sendEmailSupport
, darwin , darwin
, withLibsecret ? false
, pkgconfig, glib, libsecret
}: }:
assert sendEmailSupport -> perlSupport; assert sendEmailSupport -> perlSupport;
@ -64,7 +66,8 @@ stdenv.mkDerivation {
++ stdenv.lib.optionals perlSupport [ perl ] ++ stdenv.lib.optionals perlSupport [ perl ]
++ stdenv.lib.optionals guiSupport [tcl tk] ++ stdenv.lib.optionals guiSupport [tcl tk]
++ stdenv.lib.optionals withpcre2 [ pcre2 ] ++ stdenv.lib.optionals withpcre2 [ pcre2 ]
++ stdenv.lib.optionals stdenv.isDarwin [ darwin.Security ]; ++ stdenv.lib.optionals stdenv.isDarwin [ darwin.Security ]
++ stdenv.lib.optionals withLibsecret [ pkgconfig glib libsecret ];
# required to support pthread_cancel() # required to support pthread_cancel()
NIX_LDFLAGS = stdenv.lib.optionalString (!stdenv.cc.isClang) "-lgcc_s" NIX_LDFLAGS = stdenv.lib.optionalString (!stdenv.cc.isClang) "-lgcc_s"
@ -90,12 +93,14 @@ stdenv.mkDerivation {
++ stdenv.lib.optionals stdenv.hostPlatform.isMusl ["NO_SYS_POLL_H=1" "NO_GETTEXT=YesPlease"] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl ["NO_SYS_POLL_H=1" "NO_GETTEXT=YesPlease"]
++ stdenv.lib.optional withpcre2 "USE_LIBPCRE2=1"; ++ stdenv.lib.optional withpcre2 "USE_LIBPCRE2=1";
# build git-credential-osxkeychain if darwin
postBuild = stdenv.lib.optionalString stdenv.isDarwin '' postBuild = ''
pushd $PWD/contrib/credential/osxkeychain/ make -C contrib/subtree
make '' + (stdenv.lib.optionalString stdenv.isDarwin ''
popd make -C contrib/credential/osxkeychain
''; '') + (stdenv.lib.optionalString withLibsecret ''
make -C contrib/credential/libsecret
'');
## Install ## Install
@ -105,11 +110,15 @@ stdenv.mkDerivation {
installFlags = "NO_INSTALL_HARDLINKS=1"; installFlags = "NO_INSTALL_HARDLINKS=1";
preInstall = stdenv.lib.optionalString stdenv.isDarwin '' preInstall = (stdenv.lib.optionalString stdenv.isDarwin ''
mkdir -p $out/bin mkdir -p $out/bin
cp -a $PWD/contrib/credential/osxkeychain/git-credential-osxkeychain $out/bin ln -s $out/share/git/contrib/credential/osxkeychain/git-credential-osxkeychain $out/bin/
rm -f $PWD/contrib/credential/osxkeychain/git-credential-osxkeychain.o rm -f $PWD/contrib/credential/osxkeychain/git-credential-osxkeychain.o
''; '') + (stdenv.lib.optionalString withLibsecret ''
mkdir -p $out/bin
ln -s $out/share/git/contrib/credential/libsecret/git-credential-libsecret $out/bin/
rm -f $PWD/contrib/credential/libsecret/git-credential-libsecret.o
'');
postInstall = postInstall =
'' ''
@ -118,10 +127,7 @@ stdenv.mkDerivation {
} }
# Install git-subtree. # Install git-subtree.
pushd contrib/subtree make -C contrib/subtree install ${stdenv.lib.optionalString withManual "install-doc"}
make
make install ${stdenv.lib.optionalString withManual "install-doc"}
popd
rm -rf contrib/subtree rm -rf contrib/subtree
# Install contrib stuff. # Install contrib stuff.