summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2021-03-12 14:16:21 -0500
committerLeo Famulari <leo@famulari.name>2021-03-12 14:22:21 -0500
commita39faf1abdac4ee518ed28bf6429e07eab0371ea (patch)
tree85ca7e8bad19af428c80f1935905f047ba80130a
parent35b3ab8e5748d9911ae7a0189065d0c25392895b (diff)
downloadguix-a39faf1abdac4ee518ed28bf6429e07eab0371ea.tar.gz
gnu: OpenSSL: Fix version number in build configuration.
Fixes <https://bugs.gnu.org/47108>.

This is a followup to commit 4a8b529ce15ddc69a9dd701e450fc85a0ed65910.

* gnu/packages/tls.scm (openssl/fixed)[arguments]: New field.
-rw-r--r--gnu/packages/tls.scm99
1 files changed, 98 insertions, 1 deletions
diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index 4572b39aa1..a5cffeb3e1 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -436,7 +436,104 @@ required structures.")
              (patches (search-patches "openssl-1.1-c-rehash-in.patch"))
              (sha256
               (base32
-               "1gw17520vh13izy1xf5q0a2fqgcayymjjj5bk0dlkxndfnszrwma"))))))
+               "1gw17520vh13izy1xf5q0a2fqgcayymjjj5bk0dlkxndfnszrwma"))))
+   (arguments
+    `(#:parallel-tests? #f
+      #:test-target "test"
+
+      ;; Changes to OpenSSL sometimes cause Perl to "sneak in" to the closure,
+      ;; so we explicitly disallow it here.
+      #:disallowed-references ,(list (canonical-package perl))
+      #:phases
+      (modify-phases %standard-phases
+       ,@(if (%current-target-system)
+           '((add-before
+               'configure 'set-cross-compile
+               (lambda* (#:key target outputs #:allow-other-keys)
+                 (setenv "CROSS_COMPILE" (string-append target "-"))
+                 (setenv "CONFIGURE_TARGET_ARCH"
+                         (cond
+                           ((string-prefix? "i586" target)
+                            "hurd-x86")
+                           ((string-prefix? "i686" target)
+                            "linux-x86")
+                           ((string-prefix? "x86_64" target)
+                            "linux-x86_64")
+                           ((string-prefix? "mips64el" target)
+                            "linux-mips64")
+                           ((string-prefix? "arm" target)
+                            "linux-armv4")
+                           ((string-prefix? "aarch64" target)
+                            "linux-aarch64")
+                           ((string-prefix? "powerpc64le" target)
+                            "linux-ppc64le")
+                           ((string-prefix? "powerpc64" target)
+                            "linux-ppc64")
+                           ((string-prefix? "powerpc" target)
+                            "linux-ppc")))
+                 #t)))
+           '())
+        (replace 'configure
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let* ((out (assoc-ref outputs "out"))
+                   (lib (string-append out "/lib")))
+              ;; It's not a shebang so patch-source-shebangs misses it.
+              (substitute* "config"
+                (("/usr/bin/env")
+                 (string-append (assoc-ref %build-inputs "coreutils")
+                                "/bin/env")))
+              (invoke ,@(if (%current-target-system)
+                          '("./Configure")
+                          '("./config"))
+                      "shared"       ;build shared libraries
+                      "--libdir=lib"
+
+                      ;; The default for this catch-all directory is
+                      ;; PREFIX/ssl.  Change that to something more
+                      ;; conventional.
+                      (string-append "--openssldir=" out
+                                     "/share/openssl-" ,version)
+
+                      (string-append "--prefix=" out)
+                      (string-append "-Wl,-rpath," lib)
+                      ,@(if (%current-target-system)
+                          '((getenv "CONFIGURE_TARGET_ARCH"))
+                          '())))))
+        (add-after 'install 'move-static-libraries
+          (lambda* (#:key outputs #:allow-other-keys)
+            ;; Move static libraries to the "static" output.
+            (let* ((out    (assoc-ref outputs "out"))
+                   (lib    (string-append out "/lib"))
+                   (static (assoc-ref outputs "static"))
+                   (slib   (string-append static "/lib")))
+              (for-each (lambda (file)
+                          (install-file file slib)
+                          (delete-file file))
+                        (find-files lib "\\.a$"))
+              #t)))
+        (add-after 'install 'move-extra-documentation
+          (lambda* (#:key outputs #:allow-other-keys)
+               ;; Move man3 pages and full HTML documentation to "doc".
+               (let* ((out    (assoc-ref outputs "out"))
+                      (man3   (string-append out "/share/man/man3"))
+                      (html (string-append out "/share/doc/openssl"))
+                      (doc    (assoc-ref outputs "doc"))
+                      (man-target (string-append doc "/share/man/man3"))
+                      (html-target (string-append doc "/share/doc/openssl")))
+                 (copy-recursively man3 man-target)
+                 (delete-file-recursively man3)
+                 (copy-recursively html html-target)
+                 (delete-file-recursively html)
+                 #t)))
+        (add-after
+         'install 'remove-miscellany
+         (lambda* (#:key outputs #:allow-other-keys)
+           ;; The 'misc' directory contains random undocumented shell and Perl
+           ;; scripts.  Remove them to avoid retaining a reference on Perl.
+           (let ((out (assoc-ref outputs "out")))
+             (delete-file-recursively (string-append out "/share/openssl-"
+                                                     ,version "/misc"))
+             #t))))))))
 
 (define-public openssl-1.0
   (package