From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH 3/4] gnu: libcanberra: Add propagated-input. Date: Sun, 11 Jan 2015 11:59:25 +0100 Message-ID: <87zj9pbn1u.fsf@gnu.org> References: <87oaqxqn2h.fsf@gnu.org> <87zj9uz6z2.fsf@gnu.org> <87y4pd57o9.fsf@gnu.org> <87fvbifiej.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAGF5-00047Z-SZ for guix-devel@gnu.org; Sun, 11 Jan 2015 05:59:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YAGF2-0003IK-N4 for guix-devel@gnu.org; Sun, 11 Jan 2015 05:59:35 -0500 Received: from hera.aquilenet.fr ([2a01:474::1]:35733) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAGF2-0003IG-Fs for guix-devel@gnu.org; Sun, 11 Jan 2015 05:59:32 -0500 In-Reply-To: (Federico Beffa's message of "Sun, 11 Jan 2015 09:34:38 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Federico Beffa Cc: Guix-devel Federico Beffa skribis: > On Sat, Jan 10, 2015 at 10:13 PM, Ludovic Court=C3=A8s wro= te: >>> + (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 =3D \":" >>> + sounds "\";\n" >>> + " size_t len =3D strlen(= stp) + " >>> + "strlen(g) + 1;\n" >>> + " " >>> + "char *g2 =3D (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=E2=80=99m a bit concerned about readability. What about doing it this wa= y: 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=E2=80=99s =E2=80=98patches=E2=80=99 fiel= d. 3. Add a phase that replaces @SOUND_THEME_DIRECTORY@ with the actual directory. ? Thanks, Ludo=E2=80=99.