guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Global modification of #:make-flags


From: Marek Paśnikowski
Subject: Re: Global modification of #:make-flags
Date: Wed, 21 Aug 2024 09:09:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]