From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 6Ni0JbyVxWaykQAAqHPOHw:P1 (envelope-from ) for ; Wed, 21 Aug 2024 07:22:36 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id 6Ni0JbyVxWaykQAAqHPOHw (envelope-from ) for ; Wed, 21 Aug 2024 09:22:36 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aJOj2Xz7; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1724224956; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=7YPe5Z+8Do8cSVgb3z97nR6cCeQqyt7n0kHYKMNxGls=; b=NMYgxwhPczD7Ped0GP+FCvQ7gVZzTP8M1q5jTa5taKvA7hO+ItAZIXm9P7ox0ypx19YFl8 dYRNWPWwaVBbLBb7WB8rJX4KpgTgq1fIzbovgIIy4+eQS8ORXzVJG1rz+7w/p2M4tTLeAl Tkwxy4ka07Hjq1EABLQXXgAGEjExnUmCP53ki8Rwb6cDC7I3ENsI85EYrBBrTKcA8H8vEU hlEwbhDgsNsvGqx5kkhe86btf/yHxQMP98wvZ9iMbwLSAeH0GQ3kuTxgO4gjdy319q/M+P Eeerg7iN/9ruTJX7+xdDYJFJqwP9+y9CbBjJtalagHEwH6KfUR6l1i0fbzTXbw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aJOj2Xz7; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1724224956; a=rsa-sha256; cv=none; b=lrlQAotdxZr/EwHKgVsLDlDGEdDGbn+XTNszvoOJSbkiLaipBFPWCx6ZHhaLDp3Z93kSZo zR1WqyKqWeaaC1mZeiiVHRy6S4Y8+GLArj6f45DJggLv0HdH3AWCdvD3EK+MKo8GeZiWyY gKYUH088TyStCtsF8g091V/ImA3ZCtVM1SV01MeVmSliWSDsILA2Z7RMC0SdT5XZvj/yxG dzf0EMhPY63KkWnbLmMWfe8Ox+M7EHvYlyyKh5OH+SdAqFhUQlHoYmkuDvpZXZ4gZB0oeq BDsjhjqoB+mhnoV/dq2Jh0s7oRvHVLYmpwM8PuYqtQSPUV3BR/F93OKk74042w== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6DA1DFDEF for ; Wed, 21 Aug 2024 09:22:36 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sgffJ-0001By-WE; Wed, 21 Aug 2024 03:21:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sgffJ-0001Bn-57 for guix-devel@gnu.org; Wed, 21 Aug 2024 03:21:57 -0400 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sgffG-00038B-Gg for guix-devel@gnu.org; Wed, 21 Aug 2024 03:21:56 -0400 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-52efd530a4eso9621480e87.0 for ; Wed, 21 Aug 2024 00:21:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724224912; x=1724829712; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=7YPe5Z+8Do8cSVgb3z97nR6cCeQqyt7n0kHYKMNxGls=; b=aJOj2Xz73MFXvA6O0irV2otgnyTUqeSP8ZxL+3AL77IqZlgT6s5WniqYq32dTBtNXC 8eJNNWD4c6HI+lpJuE8pj0CSOqiWtJ3M4oSBzzYdTvWOP/DAkLaeD2DXabeWkIpjaCig 43bKJoDEk08gpOqEHg//87o1NHxqU2998J8xLNWfukg7YSHfN6KlcKg6PRTwHrBg1F3q Y0OanfMnf2AbbMUHl0w1a5iopI292Wy46qxFm3xRail/DidM2TUASRiYPGr4+RsDScv4 k6SC8nuYNmRffyTQtNievKXs6uPKI2odQHlFlkAkUUJ6PQ7R6E77UJvib0mZQWWg+c/u 0XXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724224912; x=1724829712; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7YPe5Z+8Do8cSVgb3z97nR6cCeQqyt7n0kHYKMNxGls=; b=iFnTsGTxaZpITKGxFH8S9T2bjkSnVkubl1H6dGTe8wHPqizTR3+rxmrZvYEkcPm3SX /ZuerKydGcVb7qcHv8d3iUkuwYGzpYjE4sJmd97Rf+zzffALl8dBBq5sbkirBop9hsMh ycNb3YQCO6m6DZs/SmknU4J358QFGWyYgGIj69IOWtItjnUtcPOqJP5jV8cVp7A4bn1K 30ZnRqk+p/LJGiQs4Ru6PrzR0hc9y3uN1fSVPhD0McsfCoVD8UnFYT3syjo5p1b4PpTV ZrzmiZdbbpUeVus5H+omkq0mwHxyR2paQPtEqyd3CbQ7vbgirPRzMzdALdT04A0g1Ub7 zMXA== X-Gm-Message-State: AOJu0YyyvT71jcldAxkaBAGwYyMrIctrCdeeWJyW972ayWh9I11W9wfH Vy86Asv9yyQoymZdlFQY9wGEONrC6d/4+QpYV81UmnH+Q+ob2so7ax89e/ADRImpPT5gRKX3VJb 9QaTgXs9XVWUYCWzwN9sQG4v4FKDKK+cH X-Google-Smtp-Source: AGHT+IHuFK+NnLne/JdtEM3x9L2Fl6hbNDmyhTxxEfByhRicUcKJziGlnL/bOnRHCO3oOLt4GNZvb3Cb3fDtyiyKiwA= X-Received: by 2002:a05:6512:128b:b0:52c:deba:7e6e with SMTP id 2adb3069b0e04-533485656ebmr641962e87.29.1724224911969; Wed, 21 Aug 2024 00:21:51 -0700 (PDT) MIME-Version: 1.0 References: <87jzgbo6hp.fsf@marekpasnikowski.pl> <87h6bel5d0.fsf@marekpasnikowski.pl> In-Reply-To: <87h6bel5d0.fsf@marekpasnikowski.pl> From: Sarthak Shah Date: Wed, 21 Aug 2024 12:51:39 +0530 Message-ID: Subject: Re: Global modification of #:make-flags To: =?UTF-8?Q?Marek_Pa=C5=9Bnikowski?= Cc: guix-devel@gnu.org Content-Type: multipart/alternative; boundary="000000000000641ba406202c65bb" Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=shahsarthakw@gmail.com; helo=mail-lf1-x136.google.com 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, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -9.79 X-Migadu-Queue-Id: 6DA1DFDEF X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -9.79 X-TUID: JCH0y4OxjQHZ --000000000000641ba406202c65bb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hey Marek, It looks like I need to update the patch as it's failing to apply to Makefile.am In the meantime, you could try to apply the one failed hunk in Makefile.am.rej yourself, that should fix the problem. Another thing that needs a bit of fixing is that this doesn't work on fresh Guix repositories, you need to have built Guix once from a repository before applying the patch. I'll try and fix both of these problems as soon as I get the time to, but once you've taken care of this it should work smoothly. Regards, Sarthak. On Wed, Aug 21, 2024, 12:40 Marek Pa=C5=9Bnikowski wrote: > Sarthak Shah writes: > > > Hey Marek, > > You might find my work on Parameterized Packages interesting: > > > > > https://blog.lispy.tech/parameterized-packages-the-project-completion-upd= ate.html > > > > Unfortunately, it hasn't been merged into the main branch yet, however > you should be able to make everything use -Os with the > > patch. > > > > Thank you. > > I have read the blog post and the linked second update and I am not sure > how should I use it to apply CFLAGS to all the system packages. > > I really would like to give it a try on my system, but I am > struggling with the patch application. I have tried using both a patch > and a snippet fields of an origin record, with no success. > > On the snippet way I have no idea how to transform the (local-file) > object representing the patch file into a string to be part of (invoke > "patch"). > > On the patch way, the build process fails with the following error log: > ... > `File Makefile.am is read-only; trying to patch anyway > patching file Makefile.am > Hunk #1 FAILED at 17. > Hunk #2 succeeded at 117 (offset 3 lines). > 1 out of 2 hunks FAILED -- saving rejects to file Makefile.am.rej > patching file guix/parameters.scm > File guix/transformations.scm is read-only; trying to patch anyway > patching file guix/transformations.scm > Hunk #1 succeeded at 37 (offset 1 line). > Hunk #2 succeeded at 356 (offset 1 line). > Hunk #3 succeeded at 983 (offset 19 lines). > Hunk #4 succeeded at 1031 (offset 19 lines). > File guix/ui.scm is read-only; trying to patch anyway > patching file guix/ui.scm > Hunk #2 succeeded at 79 (offset 2 lines). > Hunk #3 succeeded at 1612 (offset 3 lines). > source is at 'guix-1.4.0-24.9a2ddcc-checkout' > applying > '/gnu/store/wld7aagwmygimf6rqllrmgyp97hrz70v-parameterization.patch'... > Backtrace: > 5 (primitive-load "/gnu/store/7l0mipjghp0f0k4652axgyyg2vi=E2= =80=A6") > In ice-9/eval.scm: > 619:8 4 (_ #(#(# "gui=E2=80=A6"= ) #)) > In ice-9/boot-9.scm: > 142:2 3 (dynamic-wind # =E2=80=A6) > In ice-9/eval.scm: > 619:8 2 (_ #(#(#))) > In srfi/srfi-1.scm: > 634:9 1 (for-each # ("/gnu/store/wl=E2=80= =A6")) > In guix/build/utils.scm: > 812:6 0 (invoke "/gnu/store/210yfax18r2g2inxrml9435ikhfcca6m-p=E2=80= =A6" =E2=80=A6) > > guix/build/utils.scm:812:6: In procedure invoke: > ERROR: > 1. &invoke-error: > program: > "/gnu/store/210yfax18r2g2inxrml9435ikhfcca6m-patch-2.7.6/bin/patch" > arguments: ("--force" "--no-backup-if-mismatch" "-p1" "--input" > "/gnu/store/wld7aagwmygimf6rqllrmgyp97hrz70v-parameterization.patch") > exit-status: 1 > term-signal: #f > stop-signal: #f > ... > > Here is the code I used to attempt the patch, excluding module imports: > > (define local-files > '(find-files ".")) > > (define guix-source > (package-source guix)) > > ;;; > > (define make-files-writable > `(for-each make-file-writable > ,local-files)) > > (define guix-origin-patches > (origin-patches guix-source)) > > (define guix-parameters-patches > (list "suweren/parameterization.patch")) > > (define patch-guix > '(invoke "patch" > "--force" > "--no-backup-if-mismatch" > "-p1" > "--input" > "suweren/parameterization.patch")) > > ;;; > > (define guix-parameters-origin-snippet > `(begin ,make-files-writable > ,patch-guix > #t)) > > (define guix-parameters-origin-snippet-modules > '((guix build utils))) > > (define guix-parameters-all-patches > (append guix-origin-patches > guix-parameters-patches)) > > ;;; > > (define guix-parameters-origin > (origin (inherit guix-source) > (sha256 (base32 > "0823vl88gbgqadc20in9qvxnrd7zhnq047bfvw4gvdsmgxpcpvpx")) > (patches guix-parameters-all-patches) > ;; (snippet guix-parameters-origin-snippet) > ;; (modules guix-parameters-origin-snippet-modules) > )) > > ;;; > > (define guix-extra-options > (list "--gc-keep-derivations=3Dyes" > "--gc-keep-outputs=3Dyes")) > > (define guix-parameters > (package (inherit guix) > (source guix-parameters-origin))) > > ;;; > > ;; This function is part of a modify-services clause, > ;; and it inherits the default guix configuration. > (define (guix-options configuration-record) > (guix-configuration (inherit configuration-record) > (guix guix-parameters) > (extra-options guix-extra-options))) > > --000000000000641ba406202c65bb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Hey Marek,
It looks like I need to update the patch as it's failing to apply to Ma= kefile.am
In the meantime, you could try to apply the one failed hunk in Makefile.am.= rej yourself, that should fix the problem.
Another thing that needs a bit of fixing is that this doesn't work on f= resh Guix repositories, you need to have built Guix once from a repository = before applying the patch. I'll try and fix both of these problems as s= oon as I get the time to, but once you've taken care of this it should = work smoothly.

Regards,
Sarthak.


On Wed= , Aug 21, 2024, 12:40 Marek Pa=C5=9Bnikowski <marek@marekpasnikowski.pl> wrote:
Sarthak Shah <shahsarthakw@gmail.com>= ; writes:

> Hey Marek,
> You might find my work on Parameterized Packages interesting:
>
> htt= ps://blog.lispy.tech/parameterized-packages-the-project-completion-update.h= tml
>
> Unfortunately, it hasn't been merged into the main branch yet, how= ever you should be able to make everything use -Os with the
> patch.
>

Thank you.

I have read the blog post and the linked second update and I am not sure how should I use it to apply CFLAGS to all the system packages.

I really would like to give it a try on my system, but I am
struggling with the patch application.=C2=A0 I have tried using both a patc= h
and a snippet fields of an origin record, with no success.

On the snippet way I have no idea how to transform the (local-file)
object representing the patch file into a string to be part of (invoke
"patch").

On the patch way, the build process fails with the following error log:
...
`File Makefile.am is read-only; trying to patch anyway
patching file Makefile.am
Hunk #1 FAILED at 17.
Hunk #2 succeeded at 117 (offset 3 lines).
1 out of 2 hunks FAILED -- saving rejects to file Makefile.am.rej
patching file guix/parameters.scm
File guix/transformations.scm is read-only; trying to patch anyway
patching file guix/transformations.scm
Hunk #1 succeeded at 37 (offset 1 line).
Hunk #2 succeeded at 356 (offset 1 line).
Hunk #3 succeeded at 983 (offset 19 lines).
Hunk #4 succeeded at 1031 (offset 19 lines).
File guix/ui.scm is read-only; trying to patch anyway
patching file guix/ui.scm
Hunk #2 succeeded at 79 (offset 2 lines).
Hunk #3 succeeded at 1612 (offset 3 lines).
source is at 'guix-1.4.0-24.9a2ddcc-checkout'
applying '/gnu/store/wld7aagwmygimf6rqllrmgyp97hrz70v-parameterization.= patch'...
Backtrace:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A05 (primitive-load "/gnu/store= /7l0mipjghp0f0k4652axgyyg2vi=E2=80=A6")
In ice-9/eval.scm:
=C2=A0 =C2=A0 619:8=C2=A0 4 (_ #(#(#<directory (guile-user) 7ffff77f7c80= > "gui=E2=80=A6") #))
In ice-9/boot-9.scm:
=C2=A0 =C2=A0 142:2=C2=A0 3 (dynamic-wind #<procedure 7ffff5472520 at ic= e-9/eval.s=E2=80=A6> =E2=80=A6)
In ice-9/eval.scm:
=C2=A0 =C2=A0 619:8=C2=A0 2 (_ #(#(#<directory (guile-user) 7ffff77f7c80= >)))
In srfi/srfi-1.scm:
=C2=A0 =C2=A0 634:9=C2=A0 1 (for-each #<procedure apply-patch (a)> (&= quot;/gnu/store/wl=E2=80=A6"))
In guix/build/utils.scm:
=C2=A0 =C2=A0 812:6=C2=A0 0 (invoke "/gnu/store/210yfax18r2g2inxrml943= 5ikhfcca6m-p=E2=80=A6" =E2=80=A6)

guix/build/utils.scm:812:6: In procedure invoke:
ERROR:
=C2=A0 1. &invoke-error:
=C2=A0 =C2=A0 =C2=A0 program: "/gnu/store/210yfax18r2g2inxrml9435ikhfc= ca6m-patch-2.7.6/bin/patch"
=C2=A0 =C2=A0 =C2=A0 arguments: ("--force" "--no-backup-if-m= ismatch" "-p1" "--input" "/gnu/store/wld7aagw= mygimf6rqllrmgyp97hrz70v-parameterization.patch")
=C2=A0 =C2=A0 =C2=A0 exit-status: 1
=C2=A0 =C2=A0 =C2=A0 term-signal: #f
=C2=A0 =C2=A0 =C2=A0 stop-signal: #f
...

Here is the code I used to attempt the patch, excluding module imports:

(define local-files
=C2=A0 '(find-files "."))

(define guix-source
=C2=A0 (package-source guix))

;;;

(define make-files-writable
=C2=A0 `(for-each make-file-writable
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0,local-files))

(define guix-origin-patches
=C2=A0 (origin-patches guix-source))

(define guix-parameters-patches
=C2=A0 (list "suweren/parameterization.patch"))

(define patch-guix
=C2=A0 '(invoke "patch"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"--force"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"--no-backup-if-mismatch"= ;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"-p1"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"--input"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"suweren/parameterization.pat= ch"))

;;;

(define guix-parameters-origin-snippet
=C2=A0 `(begin ,make-files-writable
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ,patch-guix
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #t))

(define guix-parameters-origin-snippet-modules
=C2=A0 '((guix build utils)))

(define guix-parameters-all-patches
=C2=A0 (append guix-origin-patches
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 guix-parameters-patches))

;;;

(define guix-parameters-origin
=C2=A0 (origin (inherit guix-source)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (sha256 (base32 "0823vl88gbgqadc20i= n9qvxnrd7zhnq047bfvw4gvdsmgxpcpvpx"))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (patches guix-parameters-all-patches) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; (snippet guix-parameters-origin-snipp= et)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; (modules guix-parameters-origin-snipp= et-modules)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ))

;;;

(define guix-extra-options
=C2=A0 (list "--gc-keep-derivations=3Dyes"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 "--gc-keep-outputs=3Dyes"))

(define guix-parameters
=C2=A0 (package (inherit guix)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(source guix-parameters-origin)))<= br>
;;;

;; This function is part of a modify-services clause,
;; and it inherits the default guix configuration.
(define (guix-options configuration-record)
=C2=A0 (guix-configuration (inherit configuration-record)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (guix guix-parameters)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (extra-options guix-extra-options)))

--000000000000641ba406202c65bb--