guix-devel
[Top][All Lists]
Advanced

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

Re: New build-system quest (premake4 t-engine)


From: Ricardo Wurmus
Subject: Re: New build-system quest (premake4 t-engine)
Date: Wed, 26 Jul 2017 10:51:49 +0200
User-agent: mu4e 0.9.18; emacs 25.2.1

Oleg Pykhalov <address@hidden> writes:

> I'm a little bit confusing about kinda patching in “snippet” vs “phase”.
> After I made both in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27691
> I thought maybe I could move “snippet” to “phase”.  What is the
> difference?
>
> Right now I think that “snippet” is for patching and “phase”
> modification is for “make” modification.  Could be both I guess, but
> what about best practice?

Snippets modify the sources that are provided to users when they run
“guix build -S the-package”.  We usually do this in cases where the
original sources contain non-free software, or when the patching is not
Guix-specific (though we tend to use the “patches” field for the latter
case).

In cases where the modifications are only needed to build the thing on
Guix and it’s better to keep the original soruces unchanged for users
who want to inspect them we use build phases instead.


> (snippet
>  '(for-each (lambda (file)
>               (substitute* file
>                 (("#elif defined(__FreeBSD__)" line)
>                  (string-append
>                   line " || defined(__GNUC__)"))))
>             '("src/music.h" "src/tSDL.h")))

Note that “substitute*” can take a list of files, so the above can be
written as:

               (substitute* '("src/music.h" "src/tSDL.h")
                 (("#elif defined(__FreeBSD__)" line)
                  (string-append
                   line " || defined(__GNUC__)")))

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net




reply via email to

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