unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#56253] [PATCH]: gnu: vpnc: Fix cross-compilation.
@ 2022-06-27 10:52 Jean Pierre De Jesus DIAZ via Guix-patches via
  2022-06-27 11:27 ` Maxime Devos
  2022-06-29 11:04 ` Jean Pierre De Jesus DIAZ via Guix-patches via
  0 siblings, 2 replies; 8+ messages in thread
From: Jean Pierre De Jesus DIAZ via Guix-patches via @ 2022-06-27 10:52 UTC (permalink / raw)
  To: 56253

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

Fix cross-compilation for `vpnc'.

The error was because the `Makefile' tried to execute the resulting binary and
failed as a result. This is done to generate the manpage.

The solution I found was to compile twice the binary, one for the host and the
other for the target, this way the manpage is generated and installed first and
the binary for the target is built later. When not cross-compiling this is not
done.

The error can be seen by executing:

guix build vpnc \
           --target=aarch64-linux-gnu

I'm not entirely sure that I've made a correct git message, so feel free to
modify it if doesn't match the standards.


—
Jean-Pierre De Jesus DIAZ

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

From d9379ceef2a7f6ed7bf49839ed066eca06d2b874 Mon Sep 17 00:00:00 2001
Message-Id: <d9379ceef2a7f6ed7bf49839ed066eca06d2b874.1656326922.git.me@jeandudey.tech>
From: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
Date: Mon, 27 Jun 2022 12:41:35 +0200
Subject: [PATCH] gnu: vpnc: Fix cross-compilation.

* gnu/packages/vpn.scm (vpnc): Fix cross-compilation of package. Use
  G-Exps. Remove substitutions in favour of `#:make-flags`. Fix manpage
  generation error when cross-compiling, as the manpage generation
  depends on the executable being built for the host machine it is built
  twice for the host and the target machine, when not cross-compiling
  the package is built only one time. Add bsd-2 to license section and
  list the files as comments that are bsd-2. Remove duplicate
  installation of license files.
---
 gnu/packages/vpn.scm | 95 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 76 insertions(+), 19 deletions(-)

diff --git a/gnu/packages/vpn.scm b/gnu/packages/vpn.scm
index e33821c97f..01f29996f2 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,76 @@ (define-public vpnc
             (sha256 (base32
                      "1128860lis89g1s21hqxvap2nq426c9j4bvgghncc1zj0ays7kj6"))))
    (build-system gnu-build-system)
-   (inputs (list libgcrypt perl vpnc-scripts))
+   ;; libgcrypt and vpnc-scripts are duplicated on both inputs because when
+   ;; cross-compiling we build vpnc for the host (to generate the manpage)
+   ;; and the target system.
+   (native-inputs (list libgcrypt perl vpnc-scripts))
+   (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
+           #~(let ((out (assoc-ref %outputs "out")))
+               (list (string-append "CC=" #$(cc-for-target))
+                     (string-append "ETCDIR=" out "/etc/vpnc")
+                     (string-append "PREFIX=" out)))
+           #:phases
+           #~(modify-phases %standard-phases
+               (delete 'configure) ;; No configure script.
+               (add-after 'unpack 'use-store-paths
+                 (lambda* (#:key inputs outputs #: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-before 'build 'build-manpage
+                 (lambda* (#:key outputs parallel-build? target
+                           #:allow-other-keys)
+                   ;; The Makefile tries to generate the manpage by executing
+                   ;; the resulting binary, so, when cross-compiling the vpnc
+                   ;; package must be built first on the host to generate the
+                   ;; manpage. This step is not necessary when the target is
+                   ;; the host.
+                   (when target
+                     (apply invoke "make" "vpnc.8" "CC=gcc"
+                            (if parallel-build?
+                               (list "-j" (number->string (parallel-job-count)))
+                               '()))
+                     (install-file "vpnc.8"
+                                   (string-append (assoc-ref outputs "out")
+                                                  "/share/man/man8"))
+                     (invoke "make" "clean"))))
+               (replace 'build
+                 (lambda* (#:key inputs make-flags parallel-build? target
+                           #:allow-other-keys)
+                   ;; When cross-compiling, the bash script 'libgcrypt-config'
+                   ;; must be accessible during the configure phase.
+                   (when target
+                     (setenv "PATH"
+                             (string-append
+                               (dirname
+                                 (search-input-file inputs
+                                                    "bin/libgcrypt-config"))
+                               ":" (getenv "PATH"))))
+                   (apply invoke "make" "vpnc" "cisco-decrypt" "vpnc-script"
+                          (append make-flags
+                                  ;; Build manpage only if not cross-compiling.
+                                  (if (not target) (list "vpnc.8") '())
+                                  (if parallel-build?
+                                    (list "-j" (number->string (parallel-job-count)))
+                                    '())))))
+               (add-before 'install 'patch-install
+                 (lambda* (#:key target #:allow-other-keys)
+                   ;; When cross-compiling the manpage is already installed by
+                   ;; this point.
+                   (when target
+                     (substitute* "Makefile"
+                       (("all : \\$\\(BINS\\) vpnc\\.8 vpnc-script")
+                        "all : $(BINS) vpnc-script")
+                       (("install -m644 vpnc\\.8.*") "")))
+                   ;; Remove installation of COPYING as 'install-license-files
+                   ;; phase does it with a proper version number.
+                   (substitute* "Makefile"
+                     (("install -m644 COPYING.*") "")))))))
    (synopsis "Client for Cisco VPN concentrators")
    (description
     "vpnc is a VPN client compatible with Cisco's EasyVPN equipment.
@@ -503,7 +555,12 @@ (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+
+                  ;; dh.c
+                  ;; dh.h
+                  ;; math_group.c
+                  ;; math_group.h
+                  license:bsd-2))
    (home-page "https://www.unix-ag.uni-kl.de/~massar/vpnc/")))
 
 (define-public vpnc-scripts
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#56253] [PATCH]: gnu: vpnc: Fix cross-compilation.
  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
  1 sibling, 1 reply; 8+ messages in thread
From: Maxime Devos @ 2022-06-27 11:27 UTC (permalink / raw)
  To: Jean Pierre De Jesus DIAZ, 56253

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

Jean Pierre De Jesus DIAZ via Guix-patches via schreef op ma 27-06-2022
om 10:52 [+0000]:
> +               (replace 'build
> +                 (lambda* (#:key inputs make-flags parallel-build?
> target
> +                           #:allow-other-keys)
> +                   ;; When cross-compiling, the bash script
> 'libgcrypt-config'
> +                   ;; must be accessible during the configure phase.
> +                   (when target
> +                     (setenv "PATH"
> +                             (string-append
> +                               (dirname
> +                                 (search-input-file inputs
> +                                                    "bin/libgcrypt-
> config"))

It would be simpler to replace 'libgcrypt-config --libs' by 'pkg-config
--libs' (with a substitute*, post-unpack) and likewise for
'libgcrypt-config --libs', to avoid executing a script compiled for
another architecture locally (it works because of a preceding $(shell
..., though doesn't seem great to me).

(Additionally, maybe upstream would be interested in pkg-config which
mostly just works when cross-compiling, in constrast to ...-config
scripts?)

> +           #~(let ((out (assoc-ref %outputs "out")))

If you're using G-exps, you might as well replace (assoc-ref %outputs
"out") by #$output.  Also, there's no configure phase, it has been
removed.


>+                   ;; manpage. This step is not necessary when the target is
>+                   ;; the host.
>+                   (when target
>+                     (apply invoke "make" "vpnc.8" "CC=gcc"
>+                            (if parallel-build?
>+                               (list "-j" (number->string (parallel-job-count)))
>+                               '()))
>+                     (install-file "vpnc.8"
>+                                   (string-append (assoc-ref outputs "out")
>+                                                  "/share/man/man8"))
>+                     (invoke "make" "clean"))))

You can simplify this by adding vpnc itself to the native-inputs (conditional
on %current-target-system to avoid a cycle) and when cross-compiling, copy the
man page from the native input to vpnc.8 (pre-build, instead of replacing build,
then you don't needd to fiddle with parallelism flags or the install phase).

>+                   ;; Remove installation of COPYING as 'install-
license-files
>+                   ;; phase does it with a proper version number.
>+                   (substitute* "Makefile"
>+                     (("install -m644 COPYING.*") "")))))))

Independent change, so for a separate commit.  Also, I don't think it's
worth it to remove the double installation -- we would be deviating
from upstream and at most some KB would be saved but we have automated
depulication.  Or maybe it's nice for consistency, dunno.

>+   (license (list license:gpl2+
>+                  ;; dh.c
>+                  ;; dh.h
>+                  ;; math_group.c
>+                  ;; math_group.h
>+                  license:bsd-2))

Again independent change -- I don't think it was necessary to mention
the file names (but I don't think they have to be removed either). More
precise license information looks nice.

Greetings,
Maxime.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#56253] [PATCH]: gnu: vpnc: Fix cross-compilation.
  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:04 ` Jean Pierre De Jesus DIAZ via Guix-patches via
  2022-06-29 11:09   ` Maxime Devos
  1 sibling, 1 reply; 8+ messages in thread
From: Jean Pierre De Jesus DIAZ via Guix-patches via @ 2022-06-29 11:04 UTC (permalink / raw)
  To: 56253@debbugs.gnu.org

[-- 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#56253] [PATCH]: gnu: vpnc: Fix cross-compilation.
  2022-06-27 11:27 ` Maxime Devos
@ 2022-06-29 11:09   ` Maxime Devos
  0 siblings, 0 replies; 8+ messages in thread
From: Maxime Devos @ 2022-06-29 11:09 UTC (permalink / raw)
  To: Jean Pierre De Jesus DIAZ, 56253

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

Maxime Devos schreef op ma 27-06-2022 om 13:27 [+0200]:
> (Additionally, maybe upstream would be interested in pkg-config which
> mostly just works when cross-compiling, in constrast to ...-config
> scripts?)

TBC: those scripts can work, but things go messy if you both have a
native libgcrypt and a cross-compiled libgcrypt.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#56253] [PATCH]: gnu: vpnc: Fix cross-compilation.
  2022-06-29 11:04 ` Jean Pierre De Jesus DIAZ via Guix-patches via
@ 2022-06-29 11:09   ` Maxime Devos
       [not found]     ` <E8aSXjBDzXnEnG_vsKAVAnIJCpw8ynAH8Ea99oyvrOj7BSa_UM7a5jhnbz8qkgIO6MYnDVnv88hTaPmqRhj69gbbSOIpctK1gRD9MExRmp8=@jeandudey.tech>
  0 siblings, 1 reply; 8+ messages in thread
From: Maxime Devos @ 2022-06-29 11:09 UTC (permalink / raw)
  To: Jean Pierre De Jesus DIAZ, 56253@debbugs.gnu.org

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

Jean Pierre De Jesus DIAZ via Guix-patches via schreef op wo 29-06-2022
om 11:04 [+0000]:
> +                          (cflags (string-append pkg-config
> +                                                 " --cflags"
> +                                                 " liggcrypt"))

liggcrypt -> libgcrypt?

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#56253] [PATCH]: gnu: vpnc: Fix cross-compilation.
       [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
  0 siblings, 1 reply; 8+ messages in thread
From: Maxime Devos @ 2022-06-29 18:35 UTC (permalink / raw)
  To: Jean Pierre De Jesus DIAZ; +Cc: 56253@debbugs.gnu.org

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

Jean Pierre De Jesus DIAZ schreef op wo 29-06-2022 om 11:15 [+0000]:
> Sorry, fixed the typo and re-built again to verify and everything is
> in order.

Was just a typo, no need for apologies :).

It looks good to me (though TBC: didn't compile it myself) but you seem
to have forgotten to keep 56253@debbugs.gnu.org in CC, so people that
can actually commit it haven't seen it, so you'll have to resend it. 
(FWIW, reportedly the ‘reply all’ options of e-mail clients take care
of that)

Greeitngs,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#56253] [PATCH]: gnu: vpnc: Fix cross-compilation.
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Jean Pierre De Jesus DIAZ via Guix-patches via @ 2022-06-29 19:01 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 56253@debbugs.gnu.org

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

Has happened multiple times, always using normal Reply despite
getting same results :D.

Added patches again.

—
Jean-Pierre De Jesus DIAZ


------- Original Message -------
On Wednesday, June 29th, 2022 at 8:35 PM, Maxime Devos <maximedevos@telenet.be> wrote:


> Jean Pierre De Jesus DIAZ schreef op wo 29-06-2022 om 11:15 [+0000]:
>
> > Sorry, fixed the typo and re-built again to verify and everything is
> > in order.
>
>
> Was just a typo, no need for apologies :).
>
> It looks good to me (though TBC: didn't compile it myself) but you seem
> to have forgotten to keep 56253@debbugs.gnu.org in CC, so people that
> can actually commit it haven't seen it, so you'll have to resend it.
> (FWIW, reportedly the ‘reply all’ options of e-mail clients take care
> of that)
>
> Greeitngs,
> Maxime.

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

From 3d3cb006c249a303c59300f8760e7f7b103b1037 Mon Sep 17 00:00:00 2001
Message-Id: <3d3cb006c249a303c59300f8760e7f7b103b1037.1656501265.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..807e741bc0 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"
+                                                 " libgcrypt"))
+                          (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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 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 d94babd41579d19d9cbbb2cca2285e0f3c8c1e77 Mon Sep 17 00:00:00 2001
Message-Id: <d94babd41579d19d9cbbb2cca2285e0f3c8c1e77.1656501265.git.me@jeandudey.tech>
In-Reply-To: <3d3cb006c249a303c59300f8760e7f7b103b1037.1656501265.git.me@jeandudey.tech>
References: <3d3cb006c249a303c59300f8760e7f7b103b1037.1656501265.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 807e741bc0..259d21cb01 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#56253: [PATCH]: gnu: vpnc: Fix cross-compilation.
  2022-06-29 19:01         ` Jean Pierre De Jesus DIAZ via Guix-patches via
@ 2022-07-04 10:28           ` Ludovic Courtès
  0 siblings, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2022-07-04 10:28 UTC (permalink / raw)
  To: Jean Pierre De Jesus DIAZ; +Cc: Maxime Devos, 56253@debbugs.gnu.org

Hi,

Jean Pierre De Jesus DIAZ <me@jeandudey.tech> skribis:

> From 3d3cb006c249a303c59300f8760e7f7b103b1037 Mon Sep 17 00:00:00 2001
> Message-Id: <3d3cb006c249a303c59300f8760e7f7b103b1037.1656501265.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.

[...]

> From d94babd41579d19d9cbbb2cca2285e0f3c8c1e77 Mon Sep 17 00:00:00 2001
> Message-Id: <d94babd41579d19d9cbbb2cca2285e0f3c8c1e77.1656501265.git.me@jeandudey.tech>
> In-Reply-To: <3d3cb006c249a303c59300f8760e7f7b103b1037.1656501265.git.me@jeandudey.tech>
> References: <3d3cb006c249a303c59300f8760e7f7b103b1037.1656501265.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.

Applied, thanks, and thanks Maxime for reviewing!

Ludo’.




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-07-04 10:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).