From patchwork Thu Aug 26 11:10:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Prikler X-Patchwork-Id: 32303 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 8133727BBE3; Thu, 26 Aug 2021 12:11:24 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 4644727BBE1 for ; Thu, 26 Aug 2021 12:11:24 +0100 (BST) Received: from localhost ([::1]:37394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mJDI3-0005JG-66 for patchwork@mira.cbaines.net; Thu, 26 Aug 2021 07:11:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJDHk-0005GQ-Iq for guix-patches@gnu.org; Thu, 26 Aug 2021 07:11:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36956) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mJDHi-0001MH-3I for guix-patches@gnu.org; Thu, 26 Aug 2021 07:11:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mJDHh-0001Du-Ue for guix-patches@gnu.org; Thu, 26 Aug 2021 07:11:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50157] [PATCH v2 1/2] build-system: linux-module: Support source-directory. References: <20210821220053.31441-1-leo.prikler@student.tugraz.at> In-Reply-To: <20210821220053.31441-1-leo.prikler@student.tugraz.at> Resent-From: Leo Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 26 Aug 2021 11:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50157 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50157@debbugs.gnu.org Cc: maximedevos@telenet.be, efraim@flashner.co.il Received: via spool by 50157-submit@debbugs.gnu.org id=B50157.16299762564675 (code B ref 50157); Thu, 26 Aug 2021 11:11:01 +0000 Received: (at 50157) by debbugs.gnu.org; 26 Aug 2021 11:10:56 +0000 Received: from localhost ([127.0.0.1]:48499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mJDHb-0001DK-Ow for submit@debbugs.gnu.org; Thu, 26 Aug 2021 07:10:56 -0400 Received: from mailrelay.tugraz.at ([129.27.2.202]:8478) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mJDHZ-0001DB-Uw for 50157@debbugs.gnu.org; Thu, 26 Aug 2021 07:10:55 -0400 Received: from localhost.localdomain (194-118-34-199.adsl.highway.telekom.at [194.118.34.199]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4GwKs62b0Cz1LZWB; Thu, 26 Aug 2021 13:10:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4GwKs62b0Cz1LZWB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1629976250; bh=xPqcyspfjmWUi3voxvSui17aL5Sm8k62LvHvmmG6qwY=; h=From:To:Cc:Subject:Date:From; b=TywMdG6uRjyhmTLAzHekjd1wUm2yFc9y64rJkfrqzBduzEMaXdg40rsK6u2HdihK0 s9xHAZIY68DFn4N7HAC4OCXkSQrq9RjPTrfukhCj2+nBK7i1Czs0OFhJHO2uaxaDGT IWwPfaf9NSUAgRW0zMtChksXDfYWEWV5xsJ5TBQ0= From: Leo Prikler Date: Thu, 26 Aug 2021 13:10:34 +0200 Message-Id: <20210826111035.20464-1-leo.prikler@student.tugraz.at> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116 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" X-getmail-retrieved-from-mailbox: Patches As with guile-build-system, the module to be build need not necessarily live at the root of the build tree. * guix/build/linux-module-build-system.scm (build, install): Add source-directory argument and append it to "M" variable when invoking make. * guix/build-system/linux-module.scm (linux-module-build): Add source-directory argument. --- guix/build-system/linux-module.scm | 4 +++- guix/build/linux-module-build-system.scm | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/guix/build-system/linux-module.scm b/guix/build-system/linux-module.scm index fc3d959ce7..33bc8c95df 100644 --- a/guix/build-system/linux-module.scm +++ b/guix/build-system/linux-module.scm @@ -158,6 +158,7 @@ (outputs '("out")) (make-flags ''()) (system (%current-system)) + (source-directory ".") (guile #f) (substitutable? #t) (imported-modules @@ -175,7 +176,8 @@ ((source) source) (source - source)) + source)) + #:source-directory ,source-directory #:search-paths ',(map search-path-specification->sexp search-paths) #:phases ,phases diff --git a/guix/build/linux-module-build-system.scm b/guix/build/linux-module-build-system.scm index d51d76f94b..729ab6154f 100644 --- a/guix/build/linux-module-build-system.scm +++ b/guix/build/linux-module-build-system.scm @@ -49,16 +49,17 @@ ; TODO: kernel ".config". #t) -(define* (build #:key inputs make-flags #:allow-other-keys) +(define* (build #:key inputs make-flags (source-directory ".") #:allow-other-keys) (apply invoke "make" "-C" (string-append (assoc-ref inputs "linux-module-builder") "/lib/modules/build") - (string-append "M=" (getcwd)) + (string-append "M=" (getcwd) "/" source-directory) (or make-flags '()))) ;; This block was copied from make-linux-libre--only took the "modules_install" ;; part. -(define* (install #:key make-flags inputs native-inputs outputs +(define* (install #:key make-flags (source-directory ".") + inputs native-inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (moddir (string-append out "/lib/modules"))) @@ -67,7 +68,7 @@ (apply invoke "make" "-C" (string-append (assoc-ref inputs "linux-module-builder") "/lib/modules/build") - (string-append "M=" (getcwd)) + (string-append "M=" (getcwd) "/" source-directory) ;; Disable depmod because the Guix system's module directory ;; is an union of potentially multiple packages. It is not ;; possible to use depmod to usefully calculate a dependency