summary refs log tree commit diff
path: root/gnu/packages/version-control.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/version-control.scm')
-rw-r--r--gnu/packages/version-control.scm57
1 files changed, 44 insertions, 13 deletions
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 514dfe7ab7..567e5e3818 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -144,6 +144,10 @@ changes to project files over time.  It supports both a distributed workflow
 as well as the classic centralized workflow.")
     (license license:gpl2+)))
 
+(define git-cross-configure-flags
+  '("ac_cv_fread_reads_directories=yes"
+    "ac_cv_snprintf_returns_bogus=no"))
+
 (define-public git
   (package
    (name "git")
@@ -160,6 +164,10 @@ as well as the classic centralized workflow.")
    (build-system gnu-build-system)
    (native-inputs
     `(("native-perl" ,perl)
+      ;; Add bash-minimal explicitly to ensure it comes before bash-for-tests,
+      ;; see <https://bugs.gnu.org/39513>.
+      ("bash" ,bash-minimal)
+      ("bash-for-tests" ,bash)
       ("gettext" ,gettext-minimal)
       ("git-manpages"
        ,(origin
@@ -182,10 +190,6 @@ as well as the classic centralized workflow.")
       ("python" ,python) ; for git-p4
       ("zlib" ,zlib)
 
-      ;; Note: we keep this in inputs rather than native-inputs to work around
-      ;; a problem in 'patch-shebangs'; see <https://bugs.gnu.org/31952>.
-      ("bash-for-tests" ,bash)
-
       ;; For PCRE support in git grep (USE_LIBPCRE2).
       ("pcre" ,pcre2)
 
@@ -241,7 +245,10 @@ as well as the classic centralized workflow.")
       ;; absolute file name to 'wish'.
       #:configure-flags (list (string-append "--with-tcltk="
                                              (assoc-ref %build-inputs "tk")
-                                             "/bin/wish8.6")) ; XXX
+                                             "/bin/wish8.6")  ; XXX
+                              ,@(if (%current-target-system)
+                                    git-cross-configure-flags
+                                    '()))
 
       #:modules ((srfi srfi-1)
                  (srfi srfi-26)
@@ -258,6 +265,15 @@ as well as the classic centralized workflow.")
                               (remove (cut string-prefix? bash-full <>) path)
                               ":"))
               #t)))
+        ;; Add cross curl-config script to PATH when cross-compiling.
+        ,@(if (%current-target-system)
+              '((add-before 'configure 'add-cross-curl-config
+                   (lambda* (#:key inputs #:allow-other-keys)
+                     (setenv "PATH"
+                             (string-append (assoc-ref inputs "curl") "/bin:"
+                                            (getenv "PATH")))
+                     #t)))
+              '())
         (add-after 'configure 'patch-makefiles
           (lambda _
             (substitute* "Makefile"
@@ -516,20 +532,24 @@ everything from small to very large projects with speed and efficiency.")
        ((#:make-flags flags)
         `(delete "USE_LIBPCRE2=yes" ,flags))
        ((#:configure-flags flags)
-        ''())
+        `(list
+          ,@(if (%current-target-system)
+                git-cross-configure-flags
+                '())))
        ((#:disallowed-references lst '())
         `(,perl ,@lst))))
     (outputs '("out"))
     (native-inputs
-     `(("native-perl" ,perl)
+     `(("bash" ,bash-minimal)
+       ("bash-for-tests" ,bash)
+       ("native-perl" ,perl)
        ("gettext" ,gettext-minimal)))
     (inputs
      `(("curl" ,curl)                             ;for HTTP(S) access
        ("expat" ,expat)                           ;for 'git push' over HTTP(S)
        ("openssl" ,openssl)
        ("perl" ,perl)
-       ("zlib" ,zlib)
-       ("bash-for-tests" ,bash)))))
+       ("zlib" ,zlib)))))
 
 (define-public libgit2
   (package
@@ -562,8 +582,15 @@ everything from small to very large projects with speed and efficiency.")
     (build-system cmake-build-system)
     (outputs '("out" "debug"))
     (arguments
-     `(#:configure-flags '("-DUSE_NTLMCLIENT=OFF" ;TODO: package this
-                           "-DREGEX_BACKEND=pcre2")
+     `(#:configure-flags
+       (list "-DUSE_NTLMCLIENT=OFF" ;TODO: package this
+             "-DREGEX_BACKEND=pcre2"
+             ,@(if (%current-target-system)
+                   `((string-append
+                      "-DPKG_CONFIG_EXECUTABLE="
+                      (assoc-ref %build-inputs "pkg-config")
+                      "/bin/" ,(%current-target-system) "-pkg-config"))
+                   '()))
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'fix-pcre2-reference
@@ -586,9 +613,13 @@ everything from small to very large projects with speed and efficiency.")
            (lambda _
              (for-each make-file-writable (find-files "."))
              #t))
-         ;; Run checks more verbosely.
+         ;; Run checks more verbosely, unless we are cross-compiling.
          (replace 'check
-           (lambda _ (invoke "./libgit2_clar" "-v" "-Q"))))))
+           (lambda* (#:key (tests? #t) #:allow-other-keys)
+             (if tests?
+                 (invoke "./libgit2_clar" "-v" "-Q")
+                 ;; Tests may be disabled if cross-compiling.
+                 (format #t "Test suite not run.~%")))))))
     (inputs
      `(("libssh2" ,libssh2)))
     (native-inputs