From patchwork Wed Jun 29 11:04:49 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: 40402 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 5CA8627BBE9; Wed, 29 Jun 2022 12:06:13 +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 086C327BBEA for ; Wed, 29 Jun 2022 12:06:12 +0100 (BST) Received: from localhost ([::1]:60418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o6VWN-0004gv-5O for patchwork@mira.cbaines.net; Wed, 29 Jun 2022 07:06:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6VWE-0004gX-1t for guix-patches@gnu.org; Wed, 29 Jun 2022 07:06:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35618) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o6VWD-0002r4-Pf for guix-patches@gnu.org; Wed, 29 Jun 2022 07:06:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o6VWD-0004qz-Ka for guix-patches@gnu.org; Wed, 29 Jun 2022 07:06:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56253] [PATCH]: gnu: vpnc: Fix cross-compilation. References: In-Reply-To: Resent-From: Jean Pierre De Jesus DIAZ Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 29 Jun 2022 11:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56253 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: "56253@debbugs.gnu.org" <56253@debbugs.gnu.org> Received: via spool by 56253-submit@debbugs.gnu.org id=B56253.165650070518579 (code B ref 56253); Wed, 29 Jun 2022 11:06:01 +0000 Received: (at 56253) by debbugs.gnu.org; 29 Jun 2022 11:05:05 +0000 Received: from localhost ([127.0.0.1]:57748 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6VVI-0004pZ-G0 for submit@debbugs.gnu.org; Wed, 29 Jun 2022 07:05:05 -0400 Received: from mail-4018.proton.ch ([185.70.40.18]:25300) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6VVD-0004ot-Qp for 56253@debbugs.gnu.org; Wed, 29 Jun 2022 07:05:02 -0400 Date: Wed, 29 Jun 2022 11:04:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jeandudey.tech; s=protonmail3; t=1656500692; x=1656759892; bh=oA4WrbiZfWiEyiLGksn/Ym7kLW7FVKtXfLPxC/APdQ8=; h=Date:To:From:Reply-To:Subject:Message-ID:Feedback-ID:From:To:Cc: Date:Subject:Reply-To:Feedback-ID:Message-ID; b=DNyWnX4Uj9ndsz4Q6BeNgvlw3jy4eHW3LqI2pFLIcKs6KMSlC5NfNDivW3exkvnWq aw9R/fVtx1gxBefAqf15qqVJ5CV0i9+ISykWw/IrUpZ7wPToCsQCT2buqviWNYGfmH ImL632ysE/0zgHJIe8K9Sy+5EpMxSpO9ygWdyPvB2QycaV4S7/MBUKnMNxJD8US3wd z6jp55sdMllVwvBPlwKx3TLlcjCsCcw007Rf7xGWmb9wSZuER/yHaWtQAKxEBdHHCS jFPCDDa5S/5NQDNgT+nKx6fQ4V8/ckQMWWT97x8fRcUjlw26iau2v3l091bf2Co+Hk 9IpqMHMYS4PQQ== Message-ID: Feedback-ID: 20187791:user:proton MIME-Version: 1.0 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 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 From e4c1daacb42b56099ccee3f80ec022980f19efc1 Mon Sep 17 00:00:00 2001 Message-Id: From: Jean-Pierre De Jesus DIAZ 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 ;;; 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,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