| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: print-plist.mk,v 1.26 2014/01/24 12:42:52 obache Exp $ | | 1 | # $NetBSD: print-plist.mk,v 1.27 2015/06/07 03:39:08 joerg Exp $ |
2 | | | 2 | |
3 | ### | | 3 | ### |
4 | ### Automatic PLIST generation | | 4 | ### Automatic PLIST generation |
5 | ### - files & symlinks first | | 5 | ### - files & symlinks first |
6 | ### - empty directories are handled properly | | 6 | ### - empty directories are handled properly |
7 | ### - dirs from mtree files are excluded | | 7 | ### - dirs from mtree files are excluded |
8 | ### - substitute for platform or package specifics substrings | | 8 | ### - substitute for platform or package specifics substrings |
9 | ### | | 9 | ### |
10 | ### Usage: | | 10 | ### Usage: |
11 | ### - make install | | 11 | ### - make install |
12 | ### - make print-PLIST | brain >PLIST | | 12 | ### - make print-PLIST | brain >PLIST |
13 | ### | | 13 | ### |
14 | | | 14 | |
| @@ -43,57 +43,26 @@ _PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^([ | | | @@ -43,57 +43,26 @@ _PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^([ |
43 | _PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^.*\/encodings\.dir/) | | 43 | _PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^.*\/encodings\.dir/) |
44 | _PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^.*\/fonts\.dir/) | | 44 | _PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^.*\/fonts\.dir/) |
45 | .endif | | 45 | .endif |
46 | .if (defined(FONTS_DIRS.ttf) && !empty(FONTS_DIRS.ttf:M*)) || \ | | 46 | .if (defined(FONTS_DIRS.ttf) && !empty(FONTS_DIRS.ttf:M*)) || \ |
47 | (defined(FONTS_DIRS.type1) && !empty(FONTS_DIRS.type1:M*)) | | 47 | (defined(FONTS_DIRS.type1) && !empty(FONTS_DIRS.type1:M*)) |
48 | _PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^.*\/fonts\.scale/) | | 48 | _PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^.*\/fonts\.scale/) |
49 | .endif | | 49 | .endif |
50 | .if (defined(FONTS_DIRS.ttf) && !empty(FONTS_DIRS.ttf:M*)) || \ | | 50 | .if (defined(FONTS_DIRS.ttf) && !empty(FONTS_DIRS.ttf:M*)) || \ |
51 | (defined(FONTS_DIRS.type1) && !empty(FONTS_DIRS.type1:M*)) || \ | | 51 | (defined(FONTS_DIRS.type1) && !empty(FONTS_DIRS.type1:M*)) || \ |
52 | (defined(FONTS_DIRS.x11) && !empty(FONTS_DIRS.x11:M*)) | | 52 | (defined(FONTS_DIRS.x11) && !empty(FONTS_DIRS.x11:M*)) |
53 | _PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^.*\/fonts\.cache-1/) | | 53 | _PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^.*\/fonts\.cache-1/) |
54 | .endif | | 54 | .endif |
55 | | | 55 | |
56 | # Common (system) directories not to generate @dirrm statements for | | | |
57 | # Reads _MTREE_FILE and generate awk statements that will | | | |
58 | # sort out which directories NOT to include into the PLIST @dirrm list | | | |
59 | _COMMON_MTREE_FILE= ${PKGSRCDIR}/mk/plist/common-dirs.mtree | | | |
60 | | | | |
61 | .if make(print-PLIST) | | | |
62 | _PRINT_PLIST_COMMON_DIRS!= ${AWK} 'BEGIN { \ | | | |
63 | i=0; \ | | | |
64 | stack[i]="${PREFIX}" ; \ | | | |
65 | cwd=""; \ | | | |
66 | } \ | | | |
67 | ! ( /^\// || /^\#/ || /^$$/ ) { \ | | | |
68 | if ( $$1 == ".." ){ \ | | | |
69 | i=i-1; \ | | | |
70 | cwd = stack[i]; \ | | | |
71 | } else if ( $$1 == "." ){ \ | | | |
72 | } else { \ | | | |
73 | stack[i] = cwd ; \ | | | |
74 | if ( i == 0 ){ \ | | | |
75 | cwd = $$1 ; \ | | | |
76 | } else { \ | | | |
77 | cwd = cwd "\\/" $$1 ; \ | | | |
78 | } \ | | | |
79 | print "/^" cwd "$$$$/ { next; }"; \ | | | |
80 | i=i+1 ; \ | | | |
81 | } \ | | | |
82 | } \ | | | |
83 | END { print "{ print $$$$0; }"; } \ | | | |
84 | ' <${_COMMON_MTREE_FILE} | | | |
85 | .endif | | | |
86 | | | | |
87 | # scan $PREFIX for any files/dirs modified since the package was extracted | | 56 | # scan $PREFIX for any files/dirs modified since the package was extracted |
88 | # will emit "@exec mkdir"-statements for empty directories | | 57 | # will emit "@exec mkdir"-statements for empty directories |
89 | # XXX will fail for data files that were copied using tar (e.g. emacs)! | | 58 | # XXX will fail for data files that were copied using tar (e.g. emacs)! |
90 | # XXX should check $LOCALBASE and $X11BASE, and add @cwd statements | | 59 | # XXX should check $LOCALBASE and $X11BASE, and add @cwd statements |
91 | | | 60 | |
92 | .if ${_USE_DESTDIR} == "no" | | 61 | .if ${_USE_DESTDIR} == "no" |
93 | _PRINT_PLIST_FILES_CMD= \ | | 62 | _PRINT_PLIST_FILES_CMD= \ |
94 | ${FIND} ${DESTDIR}${PREFIX}/. -xdev -newer ${_COOKIE.extract} \! -type d -print | | 63 | ${FIND} ${DESTDIR}${PREFIX}/. -xdev -newer ${_COOKIE.extract} \! -type d -print |
95 | _PRINT_PLIST_DIRS_CMD= \ | | 64 | _PRINT_PLIST_DIRS_CMD= \ |
96 | ${FIND} ${DESTDIR}${PREFIX}/. -xdev -newer ${_COOKIE.extract} -type d -print | | 65 | ${FIND} ${DESTDIR}${PREFIX}/. -xdev -newer ${_COOKIE.extract} -type d -print |
97 | .else | | 66 | .else |
98 | _PRINT_PLIST_FILES_CMD= \ | | 67 | _PRINT_PLIST_FILES_CMD= \ |
99 | ${FIND} ${DESTDIR}${PREFIX}/. \! -type d -print | | 68 | ${FIND} ${DESTDIR}${PREFIX}/. \! -type d -print |
| @@ -169,24 +138,23 @@ print-PLIST: | | | @@ -169,24 +138,23 @@ print-PLIST: |
169 | } \ | | 138 | } \ |
170 | { print $$0; }' | | 139 | { print $$0; }' |
171 | ${RUN}\ | | 140 | ${RUN}\ |
172 | for i in `${_PRINT_PLIST_DIRS_CMD} \ | | 141 | for i in `${_PRINT_PLIST_DIRS_CMD} \ |
173 | | ${SORT} -r \ | | 142 | | ${SORT} -r \ |
174 | | ${AWK} ' \ | | 143 | | ${AWK} ' \ |
175 | /emul\/linux\/proc/ { next; } \ | | 144 | /emul\/linux\/proc/ { next; } \ |
176 | /${DESTDIR:S|/|\\/|g:S/+/\\\\+/g}${PREFIX:S|/|\\/|g}\/\.$$/ { next; } \ | | 145 | /${DESTDIR:S|/|\\/|g:S/+/\\\\+/g}${PREFIX:S|/|\\/|g}\/\.$$/ { next; } \ |
177 | /${PKG_DBDIR:S|/|\\/|g}\// { next; } \ | | 146 | /${PKG_DBDIR:S|/|\\/|g}\// { next; } \ |
178 | { sub("${DESTDIR:S/+/\\\\\\+/g}${PREFIX}/\\\\./", ""); } \ | | 147 | { sub("${DESTDIR:S/+/\\\\\\+/g}${PREFIX}/\\\\./", ""); } \ |
179 | { sub("^${PKGINFODIR}/", "info/"); } \ | | 148 | { sub("^${PKGINFODIR}/", "info/"); } \ |
180 | { sub("^${PKGMANDIR}/", "man/"); } \ | | 149 | { sub("^${PKGMANDIR}/", "man/"); } \ |
181 | /^${PKG_DBDIR:S|^${PREFIX}/||:S|/|\\/|g}(\/|$$)/ { next; } \ | | 150 | /^${PKG_DBDIR:S|^${PREFIX}/||:S|/|\\/|g}(\/|$$)/ { next; } \ |
182 | /^${PKGINFODIR:S|/|\\/|g}$$/ { next; } \ | | 151 | /^${PKGINFODIR:S|/|\\/|g}$$/ { next; }'` ; \ |
183 | ${_PRINT_PLIST_COMMON_DIRS}'` ; \ | | | |
184 | do \ | | 152 | do \ |
185 | if [ `${LS} -la ${DESTDIR}${PREFIX}/$$i | ${WC} -l` = 3 ]; then \ | | 153 | if [ `${LS} -la ${DESTDIR}${PREFIX}/$$i | ${WC} -l` = 3 ]; then \ |
186 | ${ECHO} @pkgdir $$i | ${AWK} ' \ | | 154 | ${ECHO} @pkgdir $$i | ${AWK} ' \ |
187 | ${PRINT_PLIST_AWK} \ | | 155 | ${PRINT_PLIST_AWK} \ |
188 | { print $$0; }' ; \ | | 156 | { print $$0; }' ; \ |
189 | fi ; \ | | 157 | fi ; \ |
190 | done \ | | 158 | done \ |
191 | | ${AWK} '${_PRINT_PLIST_AWK_SUBST} { print $$0; }' | | 159 | | ${AWK} '${_PRINT_PLIST_AWK_SUBST} { print $$0; }' |
192 | .endif # target(print-PLIST) | | 160 | .endif # target(print-PLIST) |