Date: Tue, 29 Dec 2020 09:07:34 +0100 From: Mathieu Arnold <mat@freebsd.org> To: Nuno Teixeira <ed.arrakis@gmail.com> Cc: freebsd-ports@freebsd.org Subject: Re: How to fix/patch hardcoded values Message-ID: <20201229080734.ibew4kwiejxihvob@aching.in.mat.cc> In-Reply-To: <CAFDf7ULqj2pzPb7WX-3oee_HHye3jnk93nV-XGbr1cjAcwgYqQ@mail.gmail.com> References: <CAFDf7ULqj2pzPb7WX-3oee_HHye3jnk93nV-XGbr1cjAcwgYqQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 > <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D252220> 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20201229080734.ibew4kwiejxihvob>