unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Jean Pierre De Jesus DIAZ via Guix-patches via <guix-patches@gnu.org>
To: "56253@debbugs.gnu.org" <56253@debbugs.gnu.org>
Subject: [bug#56253] [PATCH]: gnu: vpnc: Fix cross-compilation.
Date: Wed, 29 Jun 2022 11:04:49 +0000	[thread overview]
Message-ID: <GLlJUa75SYS6xoV29rej4ulOY7ojlZM7_CrnbERoAxpINvvOytcrLYkp6BWh8ABerbqWLR1pc41-yg5Ru5eNTFknSiHxLL2UL6fQD5p9Nww=@jeandudey.tech> (raw)
In-Reply-To: <FLlgKC6siW3VOq_B4lWQxjFA3AAfEeBHTzV6qw0FIAP_isJ8bLu0QF0hr3LNVzfW2lre7jAAb3AHD4UgIpGfGQDdGhtSSYwQ386OVu_U5tE=@jeandudey.tech>

[-- Attachment #1: Type: text/plain, Size: 399 bytes --]

Thanks for the review!

Did not know that packages could have themselves as an input.
Added it and modified the phases accordingly and made the use
of `pkg-config' in the build.

Made a separate patch for the license change.

And, I will try to push of `pkg-config' usage on upstream by
sending a patch (and hopefully reduce substitutions on the
package).

—
Jean-Pierre De Jesus DIAZ

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-vpnc-Add-bsd-2-license.patch --]
[-- Type: text/x-patch; name=0002-gnu-vpnc-Add-bsd-2-license.patch, Size: 1244 bytes --]

From 7fdc511ecb23a79a6b701f972864349db5247467 Mon Sep 17 00:00:00 2001
Message-Id: <7fdc511ecb23a79a6b701f972864349db5247467.1656500364.git.me@jeandudey.tech>
In-Reply-To: <e4c1daacb42b56099ccee3f80ec022980f19efc1.1656500364.git.me@jeandudey.tech>
References: <e4c1daacb42b56099ccee3f80ec022980f19efc1.1656500364.git.me@jeandudey.tech>
From: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
Date: Wed, 29 Jun 2022 12:57:02 +0200
Subject: [PATCH 2/2] gnu: vpnc: Add bsd-2 license.

* gnu/packages/vpn.scm (vpnc)[license]: Add bsd-2.
---
 gnu/packages/vpn.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/vpn.scm b/gnu/packages/vpn.scm
index c4399f232b..19c2837a71 100644
--- a/gnu/packages/vpn.scm
+++ b/gnu/packages/vpn.scm
@@ -547,7 +547,7 @@ (define-public vpnc
 shared-secret IPSec authentication with Xauth, AES (256, 192, 128), 3DES,
 1DES, MD5, SHA1, DH1/2/5 and IP tunneling.  It runs entirely in userspace.
 Only \"Universal TUN/TAP device driver support\" is needed in the kernel.")
-   (license license:gpl2+) ; some file are bsd-2, see COPYING
+   (license (list license:gpl2+ license:bsd-2))
    (home-page "https://www.unix-ag.uni-kl.de/~massar/vpnc/")))
 
 (define-public vpnc-scripts
-- 
2.36.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0001-gnu-vpnc-Fix-cross-compilation.patch --]
[-- Type: text/x-patch; name=0001-gnu-vpnc-Fix-cross-compilation.patch, Size: 6050 bytes --]

From e4c1daacb42b56099ccee3f80ec022980f19efc1 Mon Sep 17 00:00:00 2001
Message-Id: <e4c1daacb42b56099ccee3f80ec022980f19efc1.1656500364.git.me@jeandudey.tech>
From: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
Date: Wed, 29 Jun 2022 12:51:55 +0200
Subject: [PATCH 1/2] gnu: vpnc: Fix cross-compilation.

* gnu/packages/vpn.scm (vpnc): Fix cross-compilation.
  [native-inputs]: Add conditional input of `this-package' (vpnc)
  to reuse the man page and add `pkg-config'.
  [arguments]: Use G-Expressions.
  [arguments]: Make use of `make-flags' instead of using substitutions.
  [arguments]: Remove unneeded deletion of `configure'.
  [arguments]: Use `pkg-config' to search for libgcrypt.
---
 gnu/packages/vpn.scm | 80 ++++++++++++++++++++++++++++++++++----------
 1 file changed, 62 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/vpn.scm b/gnu/packages/vpn.scm
index e33821c97f..c4399f232b 100644
--- a/gnu/packages/vpn.scm
+++ b/gnu/packages/vpn.scm
@@ -21,6 +21,7 @@
 ;;; Copyright © 2022 Josselin Poiret <josselin.poiret@protonmail.ch>
 ;;; Copyright © 2022 Lu hui <luhux76@gmail.com>
 ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2022 Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -477,25 +478,68 @@ (define-public vpnc
             (sha256 (base32
                      "1128860lis89g1s21hqxvap2nq426c9j4bvgghncc1zj0ays7kj6"))))
    (build-system gnu-build-system)
-   (inputs (list libgcrypt perl vpnc-scripts))
+   (native-inputs (append (list perl pkg-config vpnc-scripts)
+                          (if (%current-target-system)
+                            (list this-package)
+                            '())))
+   (inputs (list libgcrypt vpnc-scripts))
    (arguments
-    `(#:tests? #f ; there is no check target
-      #:phases
-      (modify-phases %standard-phases
-        (add-after 'unpack 'use-store-paths
-          (lambda* (#:key inputs outputs #:allow-other-keys)
-            (let ((out          (assoc-ref outputs "out"))
-                  (vpnc-scripts (assoc-ref inputs  "vpnc-scripts")))
-              (substitute* "config.c"
-                (("/etc/vpnc/vpnc-script")
-                 (string-append vpnc-scripts "/etc/vpnc/vpnc-script")))
-              (substitute* "Makefile"
-                (("ETCDIR=.*")
-                 (string-append "ETCDIR=" out "/etc/vpnc\n"))
-                (("PREFIX=.*")
-                 (string-append "PREFIX=" out "\n")))
-              #t)))
-        (delete 'configure))))          ; no configure script
+     (list #:tests? #f ;; There is no check target
+           #:make-flags
+           #~(list (string-append "CC=" #$(cc-for-target))
+                   (string-append "ETCDIR=" #$output "/etc/vpnc")
+                   (string-append "PREFIX=" #$output))
+           #:phases
+           #~(modify-phases %standard-phases
+               (delete 'configure) ;; No configure script.
+               (add-after 'unpack 'use-store-paths
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   (let ((vpnc-scripts (assoc-ref inputs  "vpnc-scripts")))
+                     (substitute* "config.c"
+                       (("/etc/vpnc/vpnc-script")
+                        (string-append vpnc-scripts
+                                       "/etc/vpnc/vpnc-script"))))))
+               (add-after 'unpack 'patch-Makefile
+                 (lambda* (#:key target #:allow-other-keys)
+                   (let* ((pkg-config #$(pkg-config-for-target))
+                          (includedir (string-append pkg-config
+                                                     " --variable=includedir"
+                                                     " libgcrypt"))
+                          (cflags (string-append pkg-config
+                                                 " --cflags"
+                                                 " liggcrypt"))
+                          (libdir (string-append pkg-config
+                                                 " --variable=libdir"
+                                                 " libgcrypt"))
+                          (libs (string-append pkg-config
+                                               " --libs"
+                                               " libgcrypt")))
+                     (substitute* "Makefile"
+                       (("\\$\\(shell libgcrypt-config --cflags\\)")
+                        (string-append "-I$(shell " includedir ") "
+                                       "$(shell " cflags ")"))
+                       (("\\$\\(shell libgcrypt-config --libs\\)")
+                        (string-append
+                          "-L$(shell " libdir ") "
+                          "$(shell " libs ")")))
+                     ;; When cross-compiling the manpage can't be generated as the
+                     ;; Makefile needs to execute the resulting `vpnc' binary.
+                     (when target
+                       (substitute* "Makefile"
+                         (("all : \\$\\(BINS\\) vpnc\\.8 vpnc-script")
+                          "all : $(BINS) vpnc-script")
+                         (("install -m644 vpnc\\.8.*") ""))))))
+               (add-after 'unpack 'install-manpage
+                 (lambda* (#:key native-inputs inputs target
+                           #:allow-other-keys)
+                   ;; As the manpage is not generated. Instead install it from
+                   ;; the input vpnc package.
+                   (when target
+                     (let* ((vpnc (assoc-ref native-inputs "vpnc"))
+                            (man (string-append vpnc
+                                                "/share/man/man8/vpnc.8.gz"))
+                            (output (string-append #$output "/share/man/man8")))
+                       (install-file man output))))))))
    (synopsis "Client for Cisco VPN concentrators")
    (description
     "vpnc is a VPN client compatible with Cisco's EasyVPN equipment.
-- 
2.36.1


  parent reply	other threads:[~2022-06-29 11:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27 10:52 [bug#56253] [PATCH]: gnu: vpnc: Fix cross-compilation Jean Pierre De Jesus DIAZ via Guix-patches via
2022-06-27 11:27 ` Maxime Devos
2022-06-29 11:09   ` Maxime Devos
2022-06-29 11:04 ` Jean Pierre De Jesus DIAZ via Guix-patches via [this message]
2022-06-29 11:09   ` Maxime Devos
     [not found]     ` <E8aSXjBDzXnEnG_vsKAVAnIJCpw8ynAH8Ea99oyvrOj7BSa_UM7a5jhnbz8qkgIO6MYnDVnv88hTaPmqRhj69gbbSOIpctK1gRD9MExRmp8=@jeandudey.tech>
2022-06-29 18:35       ` Maxime Devos
2022-06-29 19:01         ` Jean Pierre De Jesus DIAZ via Guix-patches via
2022-07-04 10:28           ` bug#56253: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='GLlJUa75SYS6xoV29rej4ulOY7ojlZM7_CrnbERoAxpINvvOytcrLYkp6BWh8ABerbqWLR1pc41-yg5Ru5eNTFknSiHxLL2UL6fQD5p9Nww=@jeandudey.tech' \
    --to=guix-patches@gnu.org \
    --cc=56253@debbugs.gnu.org \
    --cc=me@jeandudey.tech \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).