Subject: Re: automatic replacement of locale directories in buildlink2
To: Johnny C. Lam <jlam@netbsd.org>
From: Lubomir Sedlacik <salo@Xtrmntr.org>
List: tech-pkg
Date: 11/27/2002 05:00:27
--FkmkrVfFsRoUs1wW
Content-Type: multipart/mixed; boundary="PEIAKu/WMn1b1Hv9"
Content-Disposition: inline


--PEIAKu/WMn1b1Hv9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Nov 26, 2002 at 06:12:59PM -0800, Johnny C. Lam wrote:
> On Wed, Nov 27, 2002 at 01:03:58PM +1100, grant beattie wrote:
> >=20
> > Is it worth turning on USE_PKGLOCALEDIR automatically if
> > GNU_CONFIGURE=3Dyes?
> >=20
> > We could, of course, create a list of OPSYSs which need to be hacked
> > on, so that it is not invoked unnecessarily. That would create far
> > less maintenance, since we would no longer need to know about broken
> > packages and modify them accordingly.
>=20
> It's better to just grep through the PLISTs in pkgsrc to see if they
> install locale files, and set USE_PKGLOCALEDIR in those packages'
> Makefiles.

i'd favor the following:

- make it conditional and use only when PKGLOCALEDIR !=3D share, since
  that's what we want to override on e.g. Solaris

- mark packages with USE_PKGLOCALEDIR.  this is really very small
  maintenance overload since PKGLOCALEDIR must be set it PLISTs for
  these packages anyway and it's one-time only.  this saves some
  buildlink2ify time for packages with GNU_CONFIGURE but no locale
  catalogues

this will make it painless on systems where it's not needed at all.  the
new patch is attached (it also has corrected quoting and simplified file
list generation).

> > Is there any possibility of screwing up a package by turning on this
> > behaviour automatically?
>=20
> I don't know, and I don't really want to find out ;)

it should not. ..unless the regexs aren't correct ;)

btw. thanks to johnny for helping me with _BUILDLINK_SUBST_USE!


regards,

--=20
-- Lubomir Sedlacik <salo@Xtrmntr.org>                   --
--                  <salo@silcnet.org>                   --

--PEIAKu/WMn1b1Hv9
Content-Type: text/plain; charset=us-ascii
Content-Description: pkglocaledir2.diff
Content-Disposition: attachment; filename=pkgl
Content-Transfer-Encoding: quoted-printable

Index: bsd.buildlink2.mk
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/pkgsrc/mk/buildlink2/bsd.buildlink2.mk,v
retrieving revision 1.57
diff -u -r1.57 bsd.buildlink2.mk
--- bsd.buildlink2.mk	2002/11/26 22:46:59	1.57
+++ bsd.buildlink2.mk	2002/11/27 03:55:52
@@ -412,6 +412,25 @@
 	${REPLACE_BUILDLINK}						\
 	`${FIND} . ${_REPLACE_BUILDLINK_PATTERNS_FIND} -print | ${SED} -e 's|^\./=
||' | ${SORT} -u`
=20
+# Fix locale directory references.
+#
+USE_PKGLOCALEDIR?=3D		no
+_PKGLOCALEDIR=3D			${PREFIX}/${PKGLOCALEDIR}/locale
+BUILDLINK_SUBST_MESSAGE.pkglocaledir=3D \
+	"Fixing locale directory references."
+BUILDLINK_SUBST_FILES.pkglocaledir=3D \
+	`${FIND} . -name "Makefile.in*" -print | ${GREP} -v "\.orig"`
+BUILDLINK_SUBST_SED.pkglocaledir=3D \
+	-e 's|^\(localedir[     ]*=3D\).*|\1 ${_PKGLOCALEDIR}|' \
+	-e 's|^\(gnulocaledir[  ]*=3D\).*|\1 ${_PKGLOCALEDIR}|' \
+	-e 's|\(-DLOCALEDIR[    ]*=3D\)[^ 	]*\(.*\)|\1"\\"${_PKGLOCALEDIR}\\""\2|'
+
+pkglocaledir-buildlink-subst: _BUILDLINK_SUBST_USE
+
+.if empty(USE_PKGLOCALEDIR:M[nN][oO]) && (${PKGLOCALEDIR} !=3D "share")
+pre-configure: pkglocaledir-buildlink-subst
+.endif
+
 # When "unbuildlinkifying" a file, we must remove references to the
 # buildlink directories and change any -llib to the proper replacement
 # libraries (-lreadline -> -ledit, etc.).  Redundant -Idir and -Ldir

--PEIAKu/WMn1b1Hv9--

--FkmkrVfFsRoUs1wW
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (NetBSD)

iD8DBQE95ENaiwjDDlS8cmMRAiX8AJ4rjCvaHBgE4I33fqauZtaJNasYqACfXjsl
FogYu6UwXnQIbd5XRbJ9tSk=
=dJzX
-----END PGP SIGNATURE-----

--FkmkrVfFsRoUs1wW--