1 # $NetBSD: replace-localedir.mk,v 1.1 2006/07/05 06:09:15 jlam Exp $
3 ######################################################################
4 ### replace-localedir (PRIVATE)
5 ######################################################################
6 ### replace-localedir replaces the path to the locale directory in
7 ### various Makefiles with the one chosen by pkgsrc (PKGLOCALEDIR).
9 .PHONY
: replace-localedir
13 replace-localedir
: subst-pkglocaledir
15 _PKGLOCALEDIR
= ${PREFIX}/${PKGLOCALEDIR}/locale
17 REPLACE_LOCALEDIR_PATTERNS?
= # empty
18 _REPLACE_LOCALEDIR_PATTERNS
= ${REPLACE_LOCALEDIR_PATTERNS}
19 .if defined
(HAS_CONFIGURE
)
20 _REPLACE_LOCALEDIR_PATTERNS
+= [Mm
]akefile.in
*
22 _REPLACE_LOCALEDIR_PATTERNS
+= [Mm
]akefile
*
24 _REPLACE_LOCALEDIR_PATTERNS_FIND_cmd
= \
26 ${ECHO} "__dummy-entry__" && \
27 ${FIND} . \
( ${_REPLACE_LOCALEDIR_PATTERNS
:C
/.
*/-o
-name
"&"/g
:S
/-o
//1} \
) -print | \
28 ${SED} -e
's|^\./||' | \
31 REPLACE_LOCALEDIR?
= # empty
33 ${REPLACE_LOCALEDIR} \
34 ${_REPLACE_LOCALEDIR_PATTERNS_FIND_cmd
:sh
:N__dummy-entry__
:N
*.orig
}
36 .if empty
(USE_PKGLOCALEDIR
:M
[nN
][oO
])
37 SUBST_CLASSES
+= pkglocaledir
39 SUBST_STAGE.pkglocaledir
= do-configure-pre-hook
40 SUBST_MESSAGE.pkglocaledir
= Fixing locale directory references.
41 SUBST_FILES.pkglocaledir
= ${_REPLACE_LOCALEDIR}
42 SUBST_SED.pkglocaledir
= \
43 -e
's|^\(localedir[ :]*=\).*|\1 ${_PKGLOCALEDIR}|' \
44 -e
's|^\(itlocaledir[ :]*=\).*|\1 ${_PKGLOCALEDIR}|' \
45 -e
's|^\(gnulocaledir[ :]*=\).*|\1 ${_PKGLOCALEDIR}|' \
46 -e
's|\(-DLOCALEDIR[ ]*=\)[^ ]*\(\.\*\)|\1"\\"${_PKGLOCALEDIR}\\""\2|'