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