all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Marek Paśnikowski" <marek@marekpasnikowski.pl>
To: guix-devel@gnu.org
Subject: Re: Global modification of #:make-flags
Date: Wed, 21 Aug 2024 09:09:15 +0200	[thread overview]
Message-ID: <87h6bel5d0.fsf@marekpasnikowski.pl> (raw)
In-Reply-To: <CADBZEV=u1_toNNCFgpHSk=YWAA8b=woXRkSt+FrPuxEA4G1cxA@mail.gmail.com> (Sarthak Shah's message of "Tue, 20 Aug 2024 15:59:10 +0530")

Sarthak Shah <shahsarthakw@gmail.com> writes:

> Hey Marek,
> You might find my work on Parameterized Packages interesting:
>
> https://blog.lispy.tech/parameterized-packages-the-project-completion-update.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…")
In ice-9/eval.scm:
    619:8  4 (_ #(#(#<directory (guile-user) 7ffff77f7c80> "gui…") #))
In ice-9/boot-9.scm:
    142:2  3 (dynamic-wind #<procedure 7ffff5472520 at ice-9/eval.s…> …)
In ice-9/eval.scm:
    619:8  2 (_ #(#(#<directory (guile-user) 7ffff77f7c80>)))
In srfi/srfi-1.scm:
    634:9  1 (for-each #<procedure apply-patch (a)> ("/gnu/store/wl…"))
In guix/build/utils.scm:
    812:6  0 (invoke "/gnu/store/210yfax18r2g2inxrml9435ikhfcca6m-p…" …)

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=yes"
	"--gc-keep-outputs=yes"))

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


  parent reply	other threads:[~2024-08-21  7:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-20 10:04 Global modification of #:make-flags Marek Paśnikowski
2024-08-20 10:29 ` Sarthak Shah
2024-08-20 13:13   ` Suhail Singh
2024-08-20 23:42     ` Sarthak Shah
2024-08-21  6:54       ` Suhail Singh
2024-08-21  7:27         ` Sarthak Shah
2024-08-21 14:37           ` Suhail Singh
2024-08-22 16:14             ` Sergio Pastor Pérez
2024-08-23  9:01               ` Sarthak Shah
2024-08-21  7:09   ` Marek Paśnikowski [this message]
2024-08-21  7:21     ` Sarthak Shah
2024-08-21  7:34       ` Marek Paśnikowski
2024-08-21  7:45         ` Sarthak Shah
2024-08-21  8:42           ` Marek Paśnikowski
2024-08-21 21:00 ` Ludovic Courtès
2024-09-06 16:27   ` Marek Paśnikowski
2024-08-22 16:35 ` Sergio Pastor Pérez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h6bel5d0.fsf@marekpasnikowski.pl \
    --to=marek@marekpasnikowski.pl \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.