summary refs log tree commit diff
diff options
context:
space:
mode:
authorBenjamin Staffin <benley@gmail.com>2018-07-22 15:20:37 -0400
committerGitHub <noreply@github.com>2018-07-22 15:20:37 -0400
commit815ae70556075b6ebb0f6456e4a99ea854c7b966 (patch)
tree10568233981f53b595a27a9b3970f5974716b97b
parent4ea202d328d697c4453784c1faedf165b1591c3c (diff)
downloadnixlib-815ae70556075b6ebb0f6456e4a99ea854c7b966.tar
nixlib-815ae70556075b6ebb0f6456e4a99ea854c7b966.tar.gz
nixlib-815ae70556075b6ebb0f6456e4a99ea854c7b966.tar.bz2
nixlib-815ae70556075b6ebb0f6456e4a99ea854c7b966.tar.lz
nixlib-815ae70556075b6ebb0f6456e4a99ea854c7b966.tar.xz
nixlib-815ae70556075b6ebb0f6456e4a99ea854c7b966.tar.zst
nixlib-815ae70556075b6ebb0f6456e4a99ea854c7b966.zip
gitFull: build libsecret credential helper (#43616)
...except on Darwin, where it won't be useful.
-rw-r--r--pkgs/applications/version-management/git-and-tools/default.nix1
-rw-r--r--pkgs/applications/version-management/git-and-tools/git/default.nix34
2 files changed, 21 insertions, 14 deletions
diff --git a/pkgs/applications/version-management/git-and-tools/default.nix b/pkgs/applications/version-management/git-and-tools/default.nix
index c82a8d8ecc52..513ff4a8ecd5 100644
--- a/pkgs/applications/version-management/git-and-tools/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/default.nix
@@ -38,6 +38,7 @@ let
     svnSupport = true;
     guiSupport = true;
     sendEmailSupport = !stdenv.isDarwin;
+    withLibsecret = !stdenv.isDarwin;
   };
 
   # Git with SVN support, but without GUI.
diff --git a/pkgs/applications/version-management/git-and-tools/git/default.nix b/pkgs/applications/version-management/git-and-tools/git/default.nix
index 522a6fcd6a12..9ff0f4e6e9b9 100644
--- a/pkgs/applications/version-management/git-and-tools/git/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/git/default.nix
@@ -12,6 +12,8 @@
 , withpcre2 ? true
 , sendEmailSupport
 , darwin
+, withLibsecret ? false
+, pkgconfig, glib, libsecret
 }:
 
 assert sendEmailSupport -> perlSupport;
@@ -64,7 +66,8 @@ stdenv.mkDerivation {
     ++ stdenv.lib.optionals perlSupport [ perl ]
     ++ stdenv.lib.optionals guiSupport [tcl tk]
     ++ 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()
   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.optional withpcre2 "USE_LIBPCRE2=1";
 
-  # build git-credential-osxkeychain if darwin
-  postBuild = stdenv.lib.optionalString stdenv.isDarwin ''
-    pushd $PWD/contrib/credential/osxkeychain/
-    make
-    popd
-  '';
+
+  postBuild = ''
+    make -C contrib/subtree
+  '' + (stdenv.lib.optionalString stdenv.isDarwin ''
+    make -C contrib/credential/osxkeychain
+  '') + (stdenv.lib.optionalString withLibsecret ''
+    make -C contrib/credential/libsecret
+  '');
 
 
   ## Install
@@ -105,11 +110,15 @@ stdenv.mkDerivation {
 
   installFlags = "NO_INSTALL_HARDLINKS=1";
 
-  preInstall = stdenv.lib.optionalString stdenv.isDarwin ''
+  preInstall = (stdenv.lib.optionalString stdenv.isDarwin ''
     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
-  '';
+  '') + (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 =
     ''
@@ -118,10 +127,7 @@ stdenv.mkDerivation {
       }
 
       # Install git-subtree.
-      pushd contrib/subtree
-      make
-      make install ${stdenv.lib.optionalString withManual "install-doc"}
-      popd
+      make -C contrib/subtree install ${stdenv.lib.optionalString withManual "install-doc"}
       rm -rf contrib/subtree
 
       # Install contrib stuff.