Sun Mar 11 14:53:10 2018 UTC ()
mk/plist: make print-PLIST discoverable by "make help"

Because print-PLIST uses mixed case (unlike most of the other make
targets), it is not found by the keyword search of "make help".


(rillig)
diff -r1.33 -r1.34 pkgsrc/mk/plist/print-plist.mk

cvs diff -r1.33 -r1.34 pkgsrc/mk/plist/print-plist.mk (switch to unified diff)

--- pkgsrc/mk/plist/print-plist.mk 2017/06/14 16:23:09 1.33
+++ pkgsrc/mk/plist/print-plist.mk 2018/03/11 14:53:10 1.34
@@ -1,146 +1,146 @@ @@ -1,146 +1,146 @@
1# $NetBSD: print-plist.mk,v 1.33 2017/06/14 16:23:09 prlw1 Exp $ 1# $NetBSD: print-plist.mk,v 1.34 2018/03/11 14:53:10 rillig Exp $
2 2#
3### 3# Automatic PLIST generation
4### Automatic PLIST generation 4# - files & symlinks first
5### - files & symlinks first 5# - empty directories are handled properly
6### - empty directories are handled properly 6# - dirs from mtree files are excluded
7### - dirs from mtree files are excluded 7# - substitute for platform or package specifics substrings
8### - substitute for platform or package specifics substrings 8#
9### 9# Usage:
10### Usage: 10# - make install
11### - make install 11# - make print-PLIST | brain >PLIST
12### - make print-PLIST | brain >PLIST 12#
13### 13# Keywords: plist print-plist
14 14
15_PRINT_PLIST_AWK_SUBST={ 15_PRINT_PLIST_AWK_SUBST={
16_PRINT_PLIST_AWK_SUBST+= \ 16_PRINT_PLIST_AWK_SUBST+= \
17 gsub(/${PKGNAME_NOREV}/, "$${PKGNAME}"); \ 17 gsub(/${PKGNAME_NOREV}/, "$${PKGNAME}"); \
18 gsub(/${PKGVERSION:S/./\./g:C/nb[0-9]*$$//}/, "$${PKGVERSION}");\ 18 gsub(/${PKGVERSION:S/./\./g:C/nb[0-9]*$$//}/, "$${PKGVERSION}");\
19 gsub(/^${PKGLOCALEDIR}\/locale/, "share/locale"); \ 19 gsub(/^${PKGLOCALEDIR}\/locale/, "share/locale"); \
20 gsub("^${PKGGNUDIR:S/\/$$//}/", "gnu/"); \ 20 gsub("^${PKGGNUDIR:S/\/$$//}/", "gnu/"); \
21 gsub("^${PKGINFODIR}/", "info/"); \ 21 gsub("^${PKGINFODIR}/", "info/"); \
22 gsub("^${PKGMANDIR}/", "man/"); 22 gsub("^${PKGMANDIR}/", "man/");
23 23
24_PRINT_PLIST_AWK_SUBST+=} 24_PRINT_PLIST_AWK_SUBST+=}
25 25
26_PRINT_PLIST_AWK_IGNORE= ($$0 ~ /^${PKG_DBDIR:S|^${PREFIX}/||:S|/|\\/|g}\//) 26_PRINT_PLIST_AWK_IGNORE= ($$0 ~ /^${PKG_DBDIR:S|^${PREFIX}/||:S|/|\\/|g}\//)
27_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /emul\/linux\/proc/) 27_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /emul\/linux\/proc/)
28.if defined(INFO_FILES) 28.if defined(INFO_FILES)
29_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^${PKGINFODIR:S|/|\\/|g}\/dir$$/) 29_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^${PKGINFODIR:S|/|\\/|g}\/dir$$/)
30_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^${PKGINFODIR:S|/|\\/|g}\/[^\/]+(-[0-9]+)(\.gz)?$$/) 30_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^${PKGINFODIR:S|/|\\/|g}\/[^\/]+(-[0-9]+)(\.gz)?$$/)
31_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^([^\/]*\/)*(info\/[^\/]+|[^\/]+\.info)(-[0-9]+)(\.gz)?$$/) 31_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^([^\/]*\/)*(info\/[^\/]+|[^\/]+\.info)(-[0-9]+)(\.gz)?$$/)
32.endif 32.endif
33.if (defined(FONTS_DIRS.x11) && !empty(FONTS_DIRS.x11:M*)) 33.if (defined(FONTS_DIRS.x11) && !empty(FONTS_DIRS.x11:M*))
34_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^.*\/encodings\.dir/) 34_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^.*\/encodings\.dir/)
35_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^.*\/fonts\.dir/) 35_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^.*\/fonts\.dir/)
36.endif 36.endif
37.if (defined(FONTS_DIRS.ttf) && !empty(FONTS_DIRS.ttf:M*)) || \ 37.if (defined(FONTS_DIRS.ttf) && !empty(FONTS_DIRS.ttf:M*)) || \
38 (defined(FONTS_DIRS.type1) && !empty(FONTS_DIRS.type1:M*)) 38 (defined(FONTS_DIRS.type1) && !empty(FONTS_DIRS.type1:M*))
39_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^.*\/fonts\.scale/) 39_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^.*\/fonts\.scale/)
40.endif 40.endif
41.if (defined(FONTS_DIRS.ttf) && !empty(FONTS_DIRS.ttf:M*)) || \ 41.if (defined(FONTS_DIRS.ttf) && !empty(FONTS_DIRS.ttf:M*)) || \
42 (defined(FONTS_DIRS.type1) && !empty(FONTS_DIRS.type1:M*)) || \ 42 (defined(FONTS_DIRS.type1) && !empty(FONTS_DIRS.type1:M*)) || \
43 (defined(FONTS_DIRS.x11) && !empty(FONTS_DIRS.x11:M*)) 43 (defined(FONTS_DIRS.x11) && !empty(FONTS_DIRS.x11:M*))
44_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^.*\/fonts\.cache-1/) 44_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^.*\/fonts\.cache-1/)
45.endif 45.endif
46.if defined(ICON_THEMES) 46.if defined(ICON_THEMES)
47_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^share\/icons\/*\/icon-theme\.cache$$/) 47_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^share\/icons\/*\/icon-theme\.cache$$/)
48.endif 48.endif
49 49
50# List the content of $PREFIX and emit "@pkgdir " statements for 50# List the content of $PREFIX and emit "@pkgdir " statements for
51# empty directories. 51# empty directories.
52_PRINT_PLIST_FILES_CMD= \ 52_PRINT_PLIST_FILES_CMD= \
53 ${FIND} ${DESTDIR}${PREFIX}/. \! -type d -print 53 ${FIND} ${DESTDIR}${PREFIX}/. \! -type d -print
54_PRINT_PLIST_DIRS_CMD= \ 54_PRINT_PLIST_DIRS_CMD= \
55 ${FIND} ${DESTDIR}${PREFIX}/. -type d -print 55 ${FIND} ${DESTDIR}${PREFIX}/. -type d -print
56 56
57.if !empty(LIBTOOLIZE_PLIST:M[yY][eE][sS]) 57.if !empty(LIBTOOLIZE_PLIST:M[yY][eE][sS])
58_PRINT_PLIST_LIBTOOLIZE_FILTER?= \ 58_PRINT_PLIST_LIBTOOLIZE_FILTER?= \
59 ( \ 59 ( \
60 if ${TEST} -d ${WRKDIR}; then \ 60 if ${TEST} -d ${WRKDIR}; then \
61 tmpdir="${WRKDIR}"; \ 61 tmpdir="${WRKDIR}"; \
62 else \ 62 else \
63 tmpdir="$${TMPDIR-/tmp}"; \ 63 tmpdir="$${TMPDIR-/tmp}"; \
64 fi; \ 64 fi; \
65 fileslist="$$tmpdir/print.plist.files.$$$$"; \ 65 fileslist="$$tmpdir/print.plist.files.$$$$"; \
66 libslist="$$tmpdir/print.plist.libs.$$$$"; \ 66 libslist="$$tmpdir/print.plist.libs.$$$$"; \
67 while read file; do \ 67 while read file; do \
68 case $$file in \ 68 case $$file in \
69 *.la) \ 69 *.la) \
70 ${_LIBTOOL_EXPAND} $$file >> $$libslist; \ 70 ${_LIBTOOL_EXPAND} $$file >> $$libslist; \
71 ;; \ 71 ;; \
72 esac; \ 72 esac; \
73 ${ECHO} "$$file"; \ 73 ${ECHO} "$$file"; \
74 done > $$fileslist; \ 74 done > $$fileslist; \
75 if ${TEST} -f "$$libslist"; then \ 75 if ${TEST} -f "$$libslist"; then \
76 ${GREP} -hvxF "`${SORT} -u $$libslist`" "$$fileslist"; \ 76 ${GREP} -hvxF "`${SORT} -u $$libslist`" "$$fileslist"; \
77 else \ 77 else \
78 ${CAT} "$$fileslist"; \ 78 ${CAT} "$$fileslist"; \
79 fi; \ 79 fi; \
80 ${RM} -f "$$fileslist" "$$libslist"; \ 80 ${RM} -f "$$fileslist" "$$libslist"; \
81 ) 81 )
82.else 82.else
83_PRINT_PLIST_LIBTOOLIZE_FILTER?= ${CAT} 83_PRINT_PLIST_LIBTOOLIZE_FILTER?= ${CAT}
84.endif 84.endif
85 85
86.PHONY: print-PLIST 86.PHONY: print-PLIST
87.if !target(print-PLIST) 87.if !target(print-PLIST)
88print-PLIST: 88print-PLIST:
89 ${RUN} ${ECHO} '@comment $$'NetBSD'$$' 89 ${RUN} ${ECHO} '@comment $$'NetBSD'$$'
90 ${RUN} ${ALL_ENV}; \ 90 ${RUN} ${ALL_ENV}; \
91 shlib_type=${SHLIB_TYPE:Q}; \ 91 shlib_type=${SHLIB_TYPE:Q}; \
92 case $$shlib_type in \ 92 case $$shlib_type in \
93 "a.out") genlinks=1 ;; \ 93 "a.out") genlinks=1 ;; \
94 *) genlinks=0 ;; \ 94 *) genlinks=0 ;; \
95 esac; \ 95 esac; \
96 ${_PRINT_PLIST_FILES_CMD} \ 96 ${_PRINT_PLIST_FILES_CMD} \
97 | ${_PRINT_PLIST_LIBTOOLIZE_FILTER} \ 97 | ${_PRINT_PLIST_LIBTOOLIZE_FILTER} \
98 | ${SORT} \ 98 | ${SORT} \
99 | ${AWK} ' \ 99 | ${AWK} ' \
100 { sub("${DESTDIR:S|+|\\\\+|g}${PREFIX}/\\./", ""); } \ 100 { sub("${DESTDIR:S|+|\\\\+|g}${PREFIX}/\\./", ""); } \
101 ${_PRINT_PLIST_AWK_IGNORE} { next; } \ 101 ${_PRINT_PLIST_AWK_IGNORE} { next; } \
102 ${PRINT_PLIST_AWK} \ 102 ${PRINT_PLIST_AWK} \
103 ${_PRINT_PLIST_AWK_SUBST} \ 103 ${_PRINT_PLIST_AWK_SUBST} \
104 /^@/ { print $$0; next } \ 104 /^@/ { print $$0; next } \
105 /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+\.[0-9]+$$/ { \ 105 /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+\.[0-9]+$$/ { \
106 print $$0; \ 106 print $$0; \
107 sub("\\.[0-9]+$$", ""); \ 107 sub("\\.[0-9]+$$", ""); \
108 if ('$$genlinks') print $$0; \ 108 if ('$$genlinks') print $$0; \
109 sub("\\.[0-9]+$$", ""); \ 109 sub("\\.[0-9]+$$", ""); \
110 if ('$$genlinks') print $$0; \ 110 if ('$$genlinks') print $$0; \
111 sub("\\.[0-9]+$$", ""); \ 111 sub("\\.[0-9]+$$", ""); \
112 if ('$$genlinks') print $$0; \ 112 if ('$$genlinks') print $$0; \
113 next; \ 113 next; \
114 } \ 114 } \
115 /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+$$/ { \ 115 /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+$$/ { \
116 print $$0; \ 116 print $$0; \
117 sub("\\.[0-9]+$$", ""); \ 117 sub("\\.[0-9]+$$", ""); \
118 if ('$$genlinks') print $$0; \ 118 if ('$$genlinks') print $$0; \
119 sub("\\.[0-9]+$$", ""); \ 119 sub("\\.[0-9]+$$", ""); \
120 if ('$$genlinks') print $$0; \ 120 if ('$$genlinks') print $$0; \
121 next; \ 121 next; \
122 } \ 122 } \
123 /^man\// { sub("\\.gz$$", ""); } \ 123 /^man\// { sub("\\.gz$$", ""); } \
124 { print $$0; }' 124 { print $$0; }'
125 ${RUN}\ 125 ${RUN}\
126 for i in `${_PRINT_PLIST_DIRS_CMD} \ 126 for i in `${_PRINT_PLIST_DIRS_CMD} \
127 | ${SORT} -r \ 127 | ${SORT} -r \
128 | ${AWK} ' \ 128 | ${AWK} ' \
129 /emul\/linux\/proc/ { next; } \ 129 /emul\/linux\/proc/ { next; } \
130 /${DESTDIR:S|/|\\/|g:S/+/\\\\+/g}${PREFIX:S|/|\\/|g}\/\.$$/ { next; } \ 130 /${DESTDIR:S|/|\\/|g:S/+/\\\\+/g}${PREFIX:S|/|\\/|g}\/\.$$/ { next; } \
131 /${PKG_DBDIR:S|/|\\/|g}\// { next; } \ 131 /${PKG_DBDIR:S|/|\\/|g}\// { next; } \
132 { sub("${DESTDIR:S/+/\\\\\\+/g}${PREFIX}/\\\\./", ""); } \ 132 { sub("${DESTDIR:S/+/\\\\\\+/g}${PREFIX}/\\\\./", ""); } \
133 { sub("^${PKGINFODIR}/", "info/"); } \ 133 { sub("^${PKGINFODIR}/", "info/"); } \
134 { sub("^${PKGMANDIR}/", "man/"); } \ 134 { sub("^${PKGMANDIR}/", "man/"); } \
135 /^${PKG_DBDIR:S|^${PREFIX}/||:S|/|\\/|g}(\/|$$)/ { next; } \ 135 /^${PKG_DBDIR:S|^${PREFIX}/||:S|/|\\/|g}(\/|$$)/ { next; } \
136 /^${PKGINFODIR:S|/|\\/|g}$$/ { next; } \ 136 /^${PKGINFODIR:S|/|\\/|g}$$/ { next; } \
137 { print $$0; }'` ; \ 137 { print $$0; }'` ; \
138 do \ 138 do \
139 if [ `${LS} -la ${DESTDIR}${PREFIX}/$$i | ${WC} -l` = 3 ]; then \ 139 if [ `${LS} -la ${DESTDIR}${PREFIX}/$$i | ${WC} -l` = 3 ]; then \
140 ${ECHO} @pkgdir $$i | ${AWK} ' \ 140 ${ECHO} @pkgdir $$i | ${AWK} ' \
141 ${PRINT_PLIST_AWK} \ 141 ${PRINT_PLIST_AWK} \
142 { print $$0; }' ; \ 142 { print $$0; }' ; \
143 fi ; \ 143 fi ; \
144 done \ 144 done \
145 | ${AWK} '${_PRINT_PLIST_AWK_SUBST} { print $$0; }' 145 | ${AWK} '${_PRINT_PLIST_AWK_SUBST} { print $$0; }'
146.endif # target(print-PLIST) 146.endif # target(print-PLIST)