From owner-freebsd-ports@freebsd.org Tue Dec 29 08:07:38 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 3648A4D4C2D for ; Tue, 29 Dec 2020 08:07:38 +0000 (UTC) (envelope-from mat@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D4n8V113Nz3h78; Tue, 29 Dec 2020 08:07:38 +0000 (UTC) (envelope-from mat@freebsd.org) Received: from mail.j.mat.cc (owncloud.cube.mat.cc [79.143.240.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.mat.cc", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: mat/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id EDE1A26F4A; Tue, 29 Dec 2020 08:07:37 +0000 (UTC) (envelope-from mat@freebsd.org) Received: from aching.in.mat.cc (unknown [IPv6:2a01:678:42:0:5d26:6eae:5fa:5d36]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mat@mat.cc) by mail.j.mat.cc (Postfix) with ESMTPSA id 6CDD9942D86; Tue, 29 Dec 2020 08:07:35 +0000 (UTC) Date: Tue, 29 Dec 2020 09:07:34 +0100 From: Mathieu Arnold To: Nuno Teixeira Cc: freebsd-ports@freebsd.org Subject: Re: How to fix/patch hardcoded values Message-ID: <20201229080734.ibew4kwiejxihvob@aching.in.mat.cc> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qwretxefye7y2m4r" Content-Disposition: inline In-Reply-To: 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 08:07:38 -0000 --qwretxefye7y2m4r Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 inste= ad > of (hardcoded) ./ >=20 > --- 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"; >=20 > Now I'm thinking that this might not be the best fix in case PREFIX is a > different one. >=20 > 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 --=20 Mathieu Arnold --qwretxefye7y2m4r Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAABCgB9FiEEVhwchfRfuV0unqO5KesJApEdfgIFAl/q48FfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDU2 MUMxQzg1RjQ1RkI5NUQyRTlFQTNCOTI5RUIwOTAyOTExRDdFMDIACgkQKesJApEd fgKV1g//Q51WTKLI67QVBi3gTrq+B29p0D3/M8RlTPJYdCKVQx8ERUyYNnOsY6cp 5waQbsPiVIpiAg2JNBn4LQbF+kFG12/Hyn926XxYGg31t16BHYuGfLGWB3G8tbhk WuqpEQz0+YSigcLWxMuVSQdiatwYXve7sjTzlCkwTTMYK+QaiQPIGq6ch4raZCe4 OP3xh+NBQXkM9t4uK3BPdh0DpTtFs/3/5XQr+zLlpkicgh/jrrX3Bzasz2P5pljD i7DurrKD9830WyohxzRieSszdcEDRcosDoIHIxSPtzL1WIJbzP9m43dBlaTirLgs vdGY38DM9RS4cmAIH4ih7QlYjCbQAkwg+QOQKSvkOheImzyTltGZ2ZvNyTaftk9D wn8VFDfBEa0Po3g7u4x3rRVFRRdozZapr7AKAN4uH36Z0HK0nRVQx9AnCz2dmeJu kliXVgH/DgQNdL6iAqaWZEp8bj2uCaQiP031U7luZA34/PBX2uJV8oK1Y1D+fg/j CD0atYftiYN393qxVuUR7eY9CX7cEbTxsF/Z9dla24dU9o7E8afI0q31lzpxvF0v S85cu8qd16XVGSg5YxcAphzznG1Uz7mVQby3/Lg5cwBA321KqJ/QV/nNd/whPuoA fvbyhQpM4rRAdkpmYFE0zi0o2xLs25Fm8f+0PJHGz5Hjqo3quZE= =pKUx -----END PGP SIGNATURE----- --qwretxefye7y2m4r--