pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk (*) Nuke the _BUILDLINK_SUBST_USE target now that s...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/8aa99fa1e531
branches:  trunk
changeset: 460305:8aa99fa1e531
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Wed Aug 27 11:29:56 2003 +0000

description:
(*) Nuke the _BUILDLINK_SUBST_USE target now that subst.mk does the same
    thing.

(*) Move the code to adjust Makefiles to refer to the correct
    PKGLOCALEDIR into bsd.pkg.mk and reimplement it using subst.mk so
    that it's non-USE_BUILDLINK2 packages can use it, too.

(*) Reimplement the PKGCONFIG_OVERRIDE code in bsd.pkg.mk using subst.mk.

(*) Reimplement the unbuildlink code in bsd.buildlink2.mk using subst.mk.

diffstat:

 mk/bsd.pkg.mk                   |  56 +++++++++++++++++------
 mk/buildlink2/bsd.buildlink2.mk |  96 ++--------------------------------------
 2 files changed, 47 insertions(+), 105 deletions(-)

diffs (209 lines):

diff -r 2d52fb0dd411 -r 8aa99fa1e531 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Wed Aug 27 11:24:37 2003 +0000
+++ b/mk/bsd.pkg.mk     Wed Aug 27 11:29:56 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1247 2003/08/27 01:01:25 jlam Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1248 2003/08/27 11:29:56 jlam Exp $
 #
 # This file is in the public domain.
 #
@@ -620,9 +620,6 @@
 MESSAGE_SUBST_SED=     ${MESSAGE_SUBST:S/=/}!/:S/$/!g/:S/^/ -e s!\\\${/}
 .endif
 
-PKGCONFIG_OVERRIDE_SED=        \
-               '-e s|^\(Libs:.*[       ]\)-L\([        ]*[^    ]*\)\(.*\)$$|\1-Wl,${RPATH_FLAG}\2 -L\2\3|'
-
 # Latest version of digest(1) required for pkgsrc
 DIGEST_REQD=           20010302
 
@@ -2078,6 +2075,34 @@
 #      post-configure.  These targets typically edit the files generated by
 #      the do-configure target that are used during the build phase.
 
+.if defined(USE_PKGLOCALEDIR)
+_PKGLOCALEDIR=                 ${PREFIX}/${PKGLOCALEDIR}/locale
+REPLACE_LOCALEDIR_PATTERNS?=   # empty
+_REPLACE_LOCALEDIR_PATTERNS=   ${REPLACE_LOCALEDIR_PATTERNS}
+.  if defined(HAS_CONFIGURE) || defined(GNU_CONFIGURE)
+_REPLACE_LOCALEDIR_PATTERNS+=  Makefile.in*
+.  else
+_REPLACE_LOCALEDIR_PATTERNS+=  Makefile*
+.  endif
+_REPLACE_LOCALEDIR_PATTERNS_FIND= \
+       \( ${_REPLACE_LOCALEDIR_PATTERNS:S/$/!/:S/^/-o -name !/:S/!/"/g:S/-o//1} \)
+REPLACE_LOCALEDIR?=            # empty
+_REPLACE_LOCALEDIR=            \
+       ${REPLACE_LOCALEDIR}    \
+       `${FIND} . ${_REPLACE_LOCALEDIR_PATTERNS_FIND} -print | ${SED} -e 's|^\./||' | ${GREP} -v '\.orig' | ${SORT} -u`
+
+_CONFIGURE_PREREQ+=            subst-pkglocaledir
+.  if empty(USE_PKGLOCALEDIR:M[nN][oO])
+SUBST_CLASSES+=                        pkglocaledir
+.  endif
+SUBST_MESSAGE.pkglocaledir=    "Fixing locale directory references."
+SUBST_FILES.pkglocaledir=      ${_REPLACE_LOCALEDIR}
+SUBST_SED.pkglocaledir=                \
+       -e 's|^\(localedir[     :]*=\).*|\1 ${_PKGLOCALEDIR}|'          \
+       -e 's|^\(gnulocaledir[  :]*=\).*|\1 ${_PKGLOCALEDIR}|'          \
+       -e 's|\(-DLOCALEDIR[    ]*=\)[^         ]*\(.*\)|\1"\\"${_PKGLOCALEDIR}\\""\2|'
+.endif
+
 .if defined(REPLACE_PERL)
 REPLACE_INTERPRETER+=  perl
 _REPLACE.perl.old=     .*/bin/perl
@@ -2144,18 +2169,15 @@
 .  endif
 .endif
 
-.if defined(PKGCONFIG_OVERRIDE)
-_CONFIGURE_PREREQ+=    do-pkgconfig-override
-.PHONY: do-pkgconfig-override
-do-pkgconfig-override:
-.  for pkgconfig in ${PKGCONFIG_OVERRIDE}
-       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
-       if [ -f ${pkgconfig} ]; then                                    \
-               ${MV} ${pkgconfig} ${pkgconfig}.norpath ;               \
-               ${SED} ${PKGCONFIG_OVERRIDE_SED}                        \
-                       < ${pkgconfig}.norpath > ${pkgconfig} ;         \
-       fi
-.  endfor
+PKGCONFIG_OVERRIDE_SED= \
+       -e 's|^\(Libs:.*[       ]\)-L\([        ]*[^    ]*\)\(.*\)$$|\1${_COMPILER_LD_FLAG}${RPATH_FLAG}\2 -L\2\3|'
+
+.if defined(PKGCONFIG_OVERRIDE) && !empty(PKGCONFIG_OVERRIDE)
+_CONFIGURE_PREREQ+=            subst-pkgconfig
+SUBST_CLASSES+=                        pkgconfig
+SUBST_MESSAGE.pkgconfig=       "Adding rpaths to pkgconfig files."
+SUBST_FILES.pkgconfig=         ${PKGCONFIG_OVERRIDE:S/^${WRKSRC}\///}
+SUBST_SED.pkgconfig=           ${PKGCONFIG_OVERRIDE_SED}
 .endif
 
 # By adding this target, it makes sure the the above PREREQ's work.
@@ -4588,6 +4610,8 @@
        ${ECHO} '${HOMEPAGE}'   >>${DESCR}      
 .endif
 
+.include "../../mk/subst.mk"
+
 #
 # For bulk build targets (bulk-install, bulk-package), the
 # BATCH variable must be set in /etc/mk.conf:
diff -r 2d52fb0dd411 -r 8aa99fa1e531 mk/buildlink2/bsd.buildlink2.mk
--- a/mk/buildlink2/bsd.buildlink2.mk   Wed Aug 27 11:24:37 2003 +0000
+++ b/mk/buildlink2/bsd.buildlink2.mk   Wed Aug 27 11:29:56 2003 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink2.mk,v 1.94 2003/08/16 08:50:20 jlam Exp $
+# $NetBSD: bsd.buildlink2.mk,v 1.95 2003/08/27 11:29:57 jlam Exp $
 #
 # An example package buildlink2.mk file:
 #
@@ -383,54 +383,6 @@
 _BLNK_TRANSFORM_SED+=  -f ${_BLNK_TRANSFORM_SEDFILE}
 _BLNK_UNTRANSFORM_SED+=        -f ${_BLNK_UNTRANSFORM_SEDFILE}
 
-_BLNK_CHECK_IS_TEXT_FILE?= \
-       ${FILE_CMD} $${file} | ${EGREP} "(shell script|text)" >/dev/null 2>&1
-
-# _BUILDLINK_SUBST_USE is a make macro that executes code to do general text
-# replacement in files in ${WRKSRC}.  The following variables are used:
-#
-# BUILDLINK_SUBST_MESSAGE.<package>    message to display, noting what is
-#                                      being substituted
-#                                      
-# BUILDLINK_SUBST_FILES.<package>      files on which to run the substitution;
-#                                      these are relative to ${WRKSRC}
-#
-# BUILDLINK_SUBST_SED.<package>                sed(1) substitution expression to run
-#                                      on the specified files.
-#
-# The _BUILDLINK_SUBST_USE macro code will try to verify that a file is a text
-# file before attempting any substitutions.
-#
-_BUILDLINK_SUBST_USE: .USE
-       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
-       cookie=${BUILDLINK_DIR}/.${.TARGET:S/-buildlink-subst//:S/-/_/g}_buildlink_subst_done; \
-       if [ ! -f $${cookie} ]; then                                    \
-               ${MKDIR} ${BUILDLINK_DIR};                              \
-               if [ -n "${BUILDLINK_SUBST_SED.${.TARGET:S/-buildlink-subst//}:C/[      ]//g:Q}" ]; then \
-                       cd ${WRKSRC};                                   \
-                       files="${BUILDLINK_SUBST_FILES.${.TARGET:S/-buildlink-subst//}}"; \
-                       if [ -n "$${files}" ]; then                     \
-                               ${ECHO_BUILDLINK_MSG} ${BUILDLINK_SUBST_MESSAGE.${.TARGET:S/-buildlink-subst//}}; \
-                               cd ${WRKSRC};                           \
-                               for file in $${files}; do               \
-                                       if ${_BLNK_CHECK_IS_TEXT_FILE}; then \
-                                               ${MV} -f $${file} $${file}.blsav; \
-                                               ${SED}  ${BUILDLINK_SUBST_SED.${.TARGET:S/-buildlink-subst//}} \
-                                                       $${file}.blsav > $${file}; \
-                                               if [ -x $${file}.blsav ]; then \
-                                                       ${CHMOD} +x $${file}; \
-                                               fi;                     \
-                                               if ${CMP} -s $${file}.blsav $${file}; then \
-                                                       ${MV} -f $${file}.blsav $${file}; \
-                                               else                    \
-                                                       ${ECHO} $${file} >> $${cookie}; \
-                                               fi;                     \
-                                       fi;                             \
-                               done;                                   \
-                       fi;                                             \
-               fi;                                                     \
-       fi
-
 REPLACE_BUILDLINK_PATTERNS?=   # empty
 _REPLACE_BUILDLINK_PATTERNS=   ${REPLACE_BUILDLINK_PATTERNS}
 _REPLACE_BUILDLINK_PATTERNS+=  *-config
@@ -453,47 +405,13 @@
 _REPLACE_BUILDLINK_SED=                ${REPLACE_BUILDLINK_SED}
 _REPLACE_BUILDLINK_SED+=       ${LIBTOOL_ARCHIVE_UNTRANSFORM_SED}
 
-BUILDLINK_SUBST_MESSAGE.unbuildlink= \
+SUBST_CLASSES+=                        unbuildlink
+SUBST_STAGE.unbuildlink=       post-build
+SUBST_MESSAGE.unbuildlink= \
        "Fixing buildlink references in files-to-be-installed."
-BUILDLINK_SUBST_FILES.unbuildlink=     ${_REPLACE_BUILDLINK}
-BUILDLINK_SUBST_SED.unbuildlink=       ${_REPLACE_BUILDLINK_SED}
-BUILDLINK_SUBST_SED.unbuildlink+=      ${_BLNK_UNTRANSFORM_SED}
-
-post-build: unbuildlink-buildlink-subst
-unbuildlink-buildlink-subst: _BUILDLINK_SUBST_USE
-
-# Fix locale directory references.
-#
-USE_PKGLOCALEDIR?=             no
-_PKGLOCALEDIR=                 ${PREFIX}/${PKGLOCALEDIR}/locale
-REPLACE_LOCALEDIR_PATTERNS?=   # empty
-_REPLACE_LOCALEDIR_PATTERNS=   ${REPLACE_LOCALEDIR_PATTERNS}
-.if defined(HAS_CONFIGURE) || defined(GNU_CONFIGURE)
-_REPLACE_LOCALEDIR_PATTERNS+=  Makefile.in*
-.else
-_REPLACE_LOCALEDIR_PATTERNS+=  Makefile*
-.endif
-_REPLACE_LOCALEDIR_PATTERNS_FIND= \
-       \( ${_REPLACE_LOCALEDIR_PATTERNS:S/$/!/:S/^/-o -name !/:S/!/"/g:S/-o//1} \)
-
-REPLACE_LOCALEDIR?=            # empty
-_REPLACE_LOCALEDIR= \
-       ${REPLACE_LOCALEDIR}                                            \
-       `${FIND} . ${_REPLACE_LOCALEDIR_PATTERNS_FIND} -print | ${SED} -e 's|^\./||' | ${GREP} -v '\.orig' | ${SORT} -u`
-
-BUILDLINK_SUBST_MESSAGE.pkglocaledir= \
-       "Fixing locale directory references."
-BUILDLINK_SUBST_FILES.pkglocaledir= \
-       ${_REPLACE_LOCALEDIR}
-BUILDLINK_SUBST_SED.pkglocaledir= \
-       -e 's|^\(localedir[     :]*=\).*|\1 ${_PKGLOCALEDIR}|' \
-       -e 's|^\(gnulocaledir[  :]*=\).*|\1 ${_PKGLOCALEDIR}|' \
-       -e 's|\(-DLOCALEDIR[    ]*=\)[^         ]*\(.*\)|\1"\\"${_PKGLOCALEDIR}\\""\2|'
-
-.if empty(USE_PKGLOCALEDIR:M[nN][oO])
-pre-configure: pkglocaledir-buildlink-subst
-.endif
-pkglocaledir-buildlink-subst: _BUILDLINK_SUBST_USE
+SUBST_FILES.unbuildlink=       ${_REPLACE_BUILDLINK}
+SUBST_SED.unbuildlink=         ${_REPLACE_BUILDLINK_SED}
+SUBST_SED.unbuildlink+=                ${_BLNK_UNTRANSFORM_SED}
 
 .if !defined(USE_LIBTOOL)
 BUILDLINK_FAKE_LA=     ${TRUE}



Home | Main Index | Thread Index | Old Index