Federico Beffa <be...@ieee.org> skribis:

> On Sat, Jan 10, 2015 at 10:13 PM, Ludovic Courtès <l...@gnu.org> wrote:
>>> +          (let ((sounds (string-append
>>> +                         (assoc-ref inputs "sound-theme-freedesktop")
>>> +                         "/share")))
>>> +            (substitute* "src/sound-theme-spec.c"
>>> +              (("return \"/usr/local/share:/usr/share\";")
>>> +               (string-append "return \"" sounds "\";\n"
>>> +                              "             else {\n"
>>> +                              "                const char *stp = \":"
>>> +                              sounds "\";\n"
>>> +                              "                size_t len =  strlen(stp) + 
>>> "
>>> +                              "strlen(g) + 1;\n"
>>> +                              "                "
>>> +                              "char *g2 = (char*) malloc(len);\n"
>>> +                              "                return "
>>> +                              "strcat(strcpy(g2, g), stp);\n"
>>> +                              "        }")))))
>>
>> Why not just:
>>
>>   (string-append "return \"" sounds "\";")
>>
>> ?
>
> The first "return" is used in an "if" clause that checks that
> XDG_DATA_DIRS is either empty, or not defined.  The variable "g" is a
> pointer to a string contains the value of XDG_DATA_DIRS. I'm adding an
> "else" with a second "return" to add the sounds directory even when
> XDG_DATA_DIRS is defined (the unpatched program does returns "g" in
> this case and therefore the sounds would not be found).

Hmm OK.

I’m a bit concerned about readability.  What about doing it this way:

  1. Make an actual patch for libcanberra, with @SOUND_THEME_DIRECTORY@
     as a placeholder for the sound-theme-freedesktop directory.

  2. Add this patch to libcanberra’s ‘patches’ field.

  3. Add a phase that replaces @SOUND_THEME_DIRECTORY@ with the actual
     directory.

?

Thanks,
Ludo’.

Reply via email to