From owner-freebsd-ports@freebsd.org Tue Dec 29 10:48:58 2020 Return-Path: Delivered-To: freebsd-ports@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61F064B80FD for ; Tue, 29 Dec 2020 10:48:58 +0000 (UTC) (envelope-from ed.arrakis@gmail.com) Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D4rkf2CGqz3qwR; Tue, 29 Dec 2020 10:48:58 +0000 (UTC) (envelope-from ed.arrakis@gmail.com) Received: by mail-ed1-x536.google.com with SMTP id c7so12200485edv.6; Tue, 29 Dec 2020 02:48:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QmI9xqmSraPSOClTVV8jlq7PJ5vskPzIzWgDX+ygVYU=; b=oZNjl2q3Wj8ILdzJe1a7krpt6Mpp5bLaoJQG34P/BoHapiB4cpo7bF0RZdukKSCFuE SkXa8z1qXznedCMtByddBHKUFe8ETRGQqA4qnlXooBQtd2X5aPyaGd0TBVBy12zu1jZY 3iAP+glDz0eLOamRLMgWdNJ2O6rM+ul3uTaF/loJRBJ8QOCoPPM2Lrie5JRxvgP/oFQI DBj/cB6tYlB8XVtvaJoEQTlodtEMYuojnWd5kRczkG8w6KVZ3K7GqiItMPvKmWZXIe7Q OtHQUEwpxSXeeHFgAPHokHCwObg6DpZdigvBUmdEAFiXFWcZVUSC0B+NDK1/uKZb2Jk2 HL5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QmI9xqmSraPSOClTVV8jlq7PJ5vskPzIzWgDX+ygVYU=; b=aS3vJifHqghJBuFbNv3jKTcoKKoTYc7gJB3lOyd6niAlqBxGEaDiPaQQJugD9FolWq xOwWXs95v2vADCx7B8bm9O5Xy5OBkMwJNzMemeoIQrCsJRQYl0D5mkl2vKlXR1CB4dgQ rq9x8/lvqrEuFQKScMzpFI5kc42Df56NYA/vkzSht4HAJOwwozPUQ2XXsUUmsvuKeM8y A6Y9iL7Iu0KH2Hn6cXZLrLOEclJGCaIzQkOHSFZIHsanI94MUKVSQl6W/VME3AlHxpTT Fj5lDbbaekt5XV0PViWTG40WPgeh/1qzAC21qT51cr5YT7vwgol6C3g5pSqIb/IflJpv Uhzw== X-Gm-Message-State: AOAM532JV2B/fPduzd3CaT++8LXkygsDXGbVoUu7vDmNK3J3IVTu5xnC SaY0jYIB5T+9Lg9SG98c9XwUttvxjBTFd/Y0k0OeIL7WQc3noA== X-Google-Smtp-Source: ABdhPJwoT/D8fGOsnz0d5S9wt53hkekRsMtEYftxQycH7M4cRTYhwGTFxTWdCMQK0UUz3DqSJbe8VCG9PivNSBxcQGc= X-Received: by 2002:a50:8741:: with SMTP id 1mr46330361edv.349.1609238936915; Tue, 29 Dec 2020 02:48:56 -0800 (PST) MIME-Version: 1.0 References: <20201229080734.ibew4kwiejxihvob@aching.in.mat.cc> In-Reply-To: <20201229080734.ibew4kwiejxihvob@aching.in.mat.cc> From: Nuno Teixeira Date: Tue, 29 Dec 2020 10:48:44 +0000 Message-ID: Subject: Re: How to fix/patch hardcoded values To: Mathieu Arnold Cc: freebsd-ports@freebsd.org X-Rspamd-Queue-Id: 4D4rkf2CGqz3qwR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2020 10:48:58 -0000 Hello, I'm using: ${REINPLACE_CMD} 's,\./gitup.conf,${PREFIX}/etc/gitup.conf,' ${WRKSRC}/gitup.c I didn't know about that sintax with "%": ${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX}' ${WRKSRC}/githup.c Does it make any difference between the two expressions? Thanks Mathieu Arnold escreveu no dia ter=C3=A7a, 29/12/2020 =C3= =A0(s) 08:07: > On Sun, Dec 27, 2020 at 09:58:13PM +0000, Nuno Teixeira wrote: > > Hello I've just submited a new port net/gitup > > and I used= a > > simple workaround to help program find its config in /usr/local/etc > instead > > of (hardcoded) ./ > > > > --- gitup.c.orig 2020-12-27 21:16:22 UTC > > +++ gitup.c > > @@ -2030,7 +2030,7 @@ main(int argc, char **argv) > > ... > > - const char *configuration_file =3D "./gitup.conf"; > > + const char *configuration_file =3D "/usr/local/etc/gitup.conf= "; > > > > Now I'm thinking that this might not be the best fix in case PREFIX is = a > > different one. > > > > Could I have an opinion on this? > > You need to change the patch to use %%PREFIX%% or %%LOCALBASE%% > depending on whether this is a reference to a path/file installed by the > software or by one of its dependency. Then, in a post-patch target, you > need to use REINPLACE_CMD to replace those to by they variables > equivalent, something like: > > post-patch: > ${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX}' ${WRKSRC}/githup.c > > -- > Mathieu Arnold >