From patchwork Mon Jun 27 10:52:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jean Pierre De Jesus DIAZ X-Patchwork-Id: 40354 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4F8D127BBEA; Mon, 27 Jun 2022 11:59:50 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 999D027BBE9 for ; Mon, 27 Jun 2022 11:59:49 +0100 (BST) Received: from localhost ([::1]:42872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5mT6-0003sW-GB for patchwork@mira.cbaines.net; Mon, 27 Jun 2022 06:59:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5mNY-00047J-0y for guix-patches@gnu.org; Mon, 27 Jun 2022 06:54:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56101) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5mNW-00021U-Pk for guix-patches@gnu.org; Mon, 27 Jun 2022 06:54:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o5mNW-0006Mj-Mh for guix-patches@gnu.org; Mon, 27 Jun 2022 06:54:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56253] [PATCH]: gnu: vpnc: Fix cross-compilation. Resent-From: Jean Pierre De Jesus DIAZ Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 27 Jun 2022 10:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56253 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56253@debbugs.gnu.org X-Debbugs-Original-To: "guix-patches@gnu.org" Received: via spool by submit@debbugs.gnu.org id=B.165632719324374 (code B ref -1); Mon, 27 Jun 2022 10:54:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 Jun 2022 10:53:13 +0000 Received: from localhost ([127.0.0.1]:49998 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o5mMi-0006L3-ML for submit@debbugs.gnu.org; Mon, 27 Jun 2022 06:53:13 -0400 Received: from lists.gnu.org ([209.51.188.17]:36152) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o5mMe-0006Kp-DT for submit@debbugs.gnu.org; Mon, 27 Jun 2022 06:53:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5mMe-0002Vt-4D for guix-patches@gnu.org; Mon, 27 Jun 2022 06:53:08 -0400 Received: from mail-4317.proton.ch ([185.70.43.17]:24965) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5mMa-0001vN-5F for guix-patches@gnu.org; Mon, 27 Jun 2022 06:53:07 -0400 Date: Mon, 27 Jun 2022 10:52:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jeandudey.tech; s=protonmail3; t=1656327181; x=1656586381; bh=H5WWeuoLfdRnXhk4S6iNi4UPD+FeVYLMxkBqIuRec1A=; h=Date:To:From:Reply-To:Subject:Message-ID:Feedback-ID:From:To:Cc: Date:Subject:Reply-To:Feedback-ID:Message-ID; b=UXYFB00jvojYDIWM2MwrP9DWYYimS0AGdckCsSHgdfl6ocA1jCABpI5BpDwp6M9Rw mFGSFo7HsCoo2gssDW1qsLE4vasMICHh2Mm4972m8/49M51kc8TGmM6Rim2uplliEg dCAjfiPwZaAPun2jjHFjafc4IV2Ky/hTtAgGj5KNH+pkIF39WAwpfpc8P6Kh20WbHs 84+nNLvhwm11z/QZFXpZmgeQ8HgGF1PjgCo7RrQBH++YPfyP0WcBIwFey9QBrvHhZx 7rJx0U0OTGu1KwsAlC9UowAxOWHKm1pDK1fkmY/Dfyg6nj2gmU0SimS6W8Tn4JBz9e GHq5neArJYH+A== Message-ID: Feedback-ID: 20187791:user:proton MIME-Version: 1.0 Received-SPF: pass client-ip=185.70.43.17; envelope-from=me@jeandudey.tech; helo=mail-4317.proton.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Jean Pierre De Jesus DIAZ X-ACL-Warn: , Jean Pierre De Jesus DIAZ via Guix-patches X-Patchwork-Original-From: Jean Pierre De Jesus DIAZ via Guix-patches via From: Jean Pierre De Jesus DIAZ X-getmail-retrieved-from-mailbox: Patches 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 From d9379ceef2a7f6ed7bf49839ed066eca06d2b874 Mon Sep 17 00:00:00 2001 Message-Id: From: Jean-Pierre De Jesus DIAZ 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 ;;; Copyright © 2022 Lu hui ;;; Copyright © 2022 Maxim Cournoyer +;;; Copyright © 2022 Jean-Pierre De Jesus DIAZ ;;; ;;; 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