pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/tv-derecurse]: pkgsrc/mk Factor out PLIST generation and handling int...
details: https://anonhg.NetBSD.org/pkgsrc/rev/9405fc4838dd
branches: tv-derecurse
changeset: 483966:9405fc4838dd
user: tv <tv%pkgsrc.org@localhost>
date: Tue Nov 23 17:15:22 2004 +0000
description:
Factor out PLIST generation and handling into its own morsel that's a
little easier to handle and maintain.
diffstat:
mk/bsd.pkg.mk | 642 +------------------------------------------------------
mk/bsd.prefs.mk | 9 +-
mk/plist.mk | 659 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 667 insertions(+), 643 deletions(-)
diffs (truncated from 1371 to 300 lines):
diff -r 1bc0f253dddc -r 9405fc4838dd mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk Tue Nov 23 16:50:18 2004 +0000
+++ b/mk/bsd.pkg.mk Tue Nov 23 17:15:22 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1540.2.3 2004/11/23 16:50:18 tv Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1540.2.4 2004/11/23 17:15:22 tv Exp $
#
# This file is in the public domain.
#
@@ -1162,25 +1162,7 @@
##### PLIST manipulation
-. if ${PKG_INSTALLATION_TYPE} == "pkgviews"
-#
-# _PLIST_IGNORE_FILES basically mirrors the list of ignored files found
-# in pkg_views(1). It's used by the dynamic PLIST generator to skip
-# adding the named files to the PLIST.
-#
-_PLIST_IGNORE_FILES= +* # package metadata files
-_PLIST_IGNORE_FILES+= info/dir
-. if defined(INFO_DIR) && empty(INFO_DIR:Minfo)
-_PLIST_IGNORE_FILES+= ${INFO_DIR}/dir
-. endif
-_PLIST_IGNORE_FILES+= *[~\#] *.OLD *.orig *,v # scratch config files
-_PLIST_IGNORE_FILES+= ${PLIST_IGNORE_FILES}
-
-PKG_ARGS_INSTALL+= -U # don't update the pkgdb.byfile.db
-PKG_ARGS_BINPKG+= -E # create an empty views file in the binpkg
-. endif # PKG_INSTALLATION_TYPE
-
-BUILD_DEFS_FIXED+= _PLIST_IGNORE_FILES
+. include "../../mk/plist.mk"
##### Make subtargets for non-su portion of "install".
@@ -2745,253 +2727,6 @@
delete-package: delete-package-links
${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${PKGFILE}
-
-
-# Do handling of shared libs for two cases:
-#
-# SHLIB_PLIST_MODE=1: when first called via the ${PLIST} target,
-# update the PLIST to contain ELF symlink, run
-# ldconfig on a.out, etc. (used when called via
-# the ${PLIST} target). Will update ${PLIST}.
-# SHLIB_PLIST_MODE=0: when called via the real-su-install target,
-# actually generate symlinks for ELF, run ldconfig
-# for a.out, etc. Will not modify ${PLIST}.
-#
-# XXX This target could need some cleanup after it was ripped out of
-# real-su-install
-#
-_AOUT_AWK = \
- BEGIN { linkc = 1 } \
- /^@/ { lines[NR] = $$0; next } \
- function libtool_release(lib) { \
- if (gsub("-[^-]+\\.so\\.", ".so.", lib)) { \
- if (system("${TEST} -h ${PREFIX}/" lib) == 0) { \
- rels[NR] = lib; \
- } \
- } \
- } \
- /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+\.[0-9]+$$/ { \
- libtool_release($$0); \
- lines[NR] = $$0; \
- sub("\\.[0-9]+$$", ""); \
- links[linkc++] = $$0; \
- sub("\\.[0-9]+$$", ""); \
- links[linkc++] = $$0; \
- sub("\\.[0-9]+$$", ""); \
- links[linkc++] = $$0; \
- if (sub("-[^-]+\\.so$$", ".so")) { \
- links[linkc++] = $$0; \
- } \
- next \
- } \
- /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+$$/ { \
- libtool_release($$0); \
- lines[NR] = $$0; \
- sub("\\.[0-9]+$$", ""); \
- links[linkc++] = $$0; \
- sub("\\.[0-9]+$$", ""); \
- links[linkc++] = $$0; \
- if (sub("-[^-]+\\.so$$", ".so")) { \
- links[linkc++] = $$0; \
- } \
- next \
- } \
- { lines[NR] = $$0 } \
- END { \
- for (i = 0 ; i <= linkc ; i++) \
- for (j = 1 ; j < NR ; j++) \
- if (lines[j] == links[i]) \
- lines[j] = "@comment " lines[j]; \
- if (${SHLIB_PLIST_MODE}) \
- for (i = 1 ; i <= NR ; i++) { \
- print lines[i]; \
- if (rels[i] != "") \
- print rels[i]; \
- } \
- }
-
-_DYLIB_AWK= \
- /^@/ { lines[NR] = $$0; next } \
- function libtool_release(lib) { \
- if (gsub("\\.so\\.", ".", lib) || gsub("\\.so$$", "", lib)) { \
- lib = lib ".dylib"; \
- if (system("${TEST} -h ${PREFIX}/" lib) == 0) { \
- rels[NR] = lib; \
- } \
- } \
- } \
- /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+\.[0-9]+$$/ { \
- libtool_release($$0); \
- lines[NR] = $$0; \
- links[linkc++] = $$0; \
- sub("\\.[0-9]+$$", ""); \
- links[linkc++] = $$0; \
- sub("\\.[0-9]+$$", ""); \
- links[linkc++] = $$0; \
- sub("\\.[0-9]+$$", ""); \
- links[linkc++] = $$0; \
- if (sub("-[^-]+\\.so$$", ".so")) { \
- links[linkc++] = $$0; \
- } \
- next \
- } \
- /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+$$/ { \
- libtool_release($$0); \
- lines[NR] = $$0; \
- links[linkc++] = $$0; \
- sub("\\.[0-9]+$$", ""); \
- links[linkc++] = $$0; \
- sub("\\.[0-9]+$$", ""); \
- links[linkc++] = $$0; \
- if (sub("-[^-]+\\.so$$", ".so")) { \
- links[linkc++] = $$0; \
- } \
- next \
- } \
- /.*\/lib[^\/]+\.so\.[0-9]+$$/ { \
- libtool_release($$0); \
- lines[NR] = $$0; \
- links[linkc++] = $$0; \
- sub("\\.[0-9]+$$", ""); \
- links[linkc++] = $$0; \
- if (sub("-[^-]+\\.so$$", ".so")) { \
- links[linkc++] = $$0; \
- } \
- next \
- } \
- /.*\/lib[^\/]+\.so$$/ { \
- lines[NR] = $$0; \
- if (system("${TEST} -f ${PREFIX}/" $$0) == 0) { \
- next; \
- } \
- libtool_release($$0); \
- links[linkc++] = $$0; \
- if (sub("-[^-]+\\.so$$", ".so")) { \
- links[linkc++] = $$0; \
- } \
- next \
- } \
- { lines[NR] = $$0 } \
- END { \
- for (i = 0 ; i <= linkc ; i++) \
- for (j = 1 ; j <= NR ; j++) \
- if (lines[j] == links[i]) \
- lines[j] = "@comment " lines[j]; \
- if (${SHLIB_PLIST_MODE}) \
- for (i = 1 ; i <= NR ; i++) { \
- print lines[i]; \
- if (rels[i] != "") { \
- print rels[i]; \
- cmd = "${LS} -l ${PREFIX}/" rels[i]; \
- cmd | getline tgt; \
- close(cmd); \
- gsub(".* ", "", tgt); \
- if (tgts[tgt] == "") { \
- tgts[tgt] = tgt; \
- if (index(tgt, "/") == 1) \
- print tgt; \
- else { \
- prefix=""; \
- if (match(rels[i], ".*/") != 0) \
- prefix=substr(rels[i],1,RLENGTH); \
- print prefix tgt; \
- } \
- } \
- } \
- } \
- }
-
-# Turn lib*.so.*, lib*.so into lib*.a. Drop duplicates.
-_AIXLIB_AWK= \
- /^@/ { lines[NR] = $$0; next } \
- /.*\/lib[^\/]+\.so(\.[0-9]+)*$$/ { \
- sub("(\\.[0-9]+)*$$", ""); \
- sub("\\.so$$", ".a"); \
- lines[NR] = $$0; \
- next \
- } \
- { lines[NR] = $$0 } \
- END { \
- nlibs = 0; \
- for (i = 1; i <= NR; i++) { \
- for (j = 0; j < nlibs; j++) { \
- if (libs[j] == lines[i]) \
- break; \
- } \
- if (j >= nlibs) \
- print lines[i]; \
- if (match(lines[i], ".*/lib[^/]+\\.a$$")) { \
- libs[nlibs] = lines[i]; \
- nlibs++; \
- } \
- } \
- }
-
-.PHONY: do-shlib-handling
-do-shlib-handling:
-.if ${SHLIB_HANDLING} == "YES"
- ${_PKG_SILENT}${_PKG_DEBUG} \
- sos=`${EGREP} -h '^.*/lib[^/]+\.so$$' ${PLIST} || ${TRUE}`; \
- if [ "$$sos" != "" ]; then \
- shlib_type=`${_GET_SHLIB_TYPE}`; \
- if [ "${SHLIB_PLIST_MODE}" = "0" ]; then \
- ${ECHO_MSG} "${_PKGSRC_IN}> [Automatic $$shlib_type shared object handling]"; \
- fi; \
- case "$$shlib_type" in \
- ELF) ;; \
- "a.out") \
- ${AWK} '${_AOUT_AWK}' <${PLIST} >${PLIST}.tmp ; \
- if [ "${SHLIB_PLIST_MODE}" = "1" ]; then \
- ${MV} ${PLIST}.tmp ${PLIST}; \
- else \
- ${RM} ${PLIST}.tmp ; \
- fi ; \
- cnt=`${EGREP} -c '^@exec[ ]*${LDCONFIG}$$' ${PLIST} || ${TRUE}`; \
- if [ "${SHLIB_PLIST_MODE}" = "1" ]; then \
- if [ $$cnt -eq 0 ]; then \
- ${ECHO} "@exec ${LDCONFIG}" >> ${PLIST}; \
- ${ECHO} "@unexec ${LDCONFIG}" >> ${PLIST}; \
- fi \
- fi; \
- if [ "${SHLIB_PLIST_MODE}" = "0" ]; then \
- if [ "${PKG_VERBOSE}" != "" ]; then \
- ${ECHO_MSG} "$$sos"; \
- ${ECHO_MSG} "Running ${LDCONFIG}"; \
- fi; \
- ${LDCONFIG} || ${TRUE}; \
- fi \
- ;; \
- "dylib") \
- ${AWK} '${_DYLIB_AWK}' <${PLIST} >${PLIST}.tmp && \
- if [ "${SHLIB_PLIST_MODE}" = "1" ]; then \
- ${MV} ${PLIST}.tmp ${PLIST}; \
- else \
- ${RM} ${PLIST}.tmp ; \
- fi ; \
- ;; \
- "aixlib") \
- ${AWK} '${_AIXLIB_AWK}' <${PLIST} >${PLIST}.tmp && \
- ${MV} ${PLIST}.tmp ${PLIST}; \
- ;; \
- "*") \
- if [ "${SHLIB_PLIST_MODE}" = "0" ]; then \
- ${ECHO_MSG} "No shared libraries for ${MACHINE_ARCH}"; \
- fi ; \
- if [ "${SHLIB_PLIST_MODE}" = "1" ]; then \
- for so in $$sos; do \
- if [ X"${PKG_VERBOSE}" != X"" ]; then \
- ${ECHO_MSG} >&2 "Ignoring $$so"; \
- fi; \
- ${SED} -e "s;^$$so$$;@comment No shared objects - &;" \
- ${PLIST} >${PLIST}.tmp && ${MV} ${PLIST}.tmp ${PLIST}; \
- done; \
- fi ; \
- ;; \
- esac; \
- fi
-.endif # SHLIB_HANDLING == "YES"
-
-
# Check if all binaries and shlibs find their needed libs
# Must be run after "make install", so that files are installed, and
# ${PLIST} exists.
@@ -3033,40 +2768,6 @@
fi
.endif # NO_PKG_REGISTER
-
-# Macro to print out the actual shared library type.
-.if defined(USE_LANGUAGES) && !empty(USE_LANGUAGES)
-. if ${_OPSYS_SHLIB_TYPE} == "ELF/a.out"
-. if (${OBJECT_FMT} == "ELF" || ${OBJECT_FMT} == "a.out")
-_GET_SHLIB_TYPE= ${ECHO} '${OBJECT_FMT}' # speedup if already known
Home |
Main Index |
Thread Index |
Old Index