diff options
author | hubertf <hubertf@pkgsrc.org> | 2000-06-16 09:18:26 +0000 |
---|---|---|
committer | hubertf <hubertf@pkgsrc.org> | 2000-06-16 09:18:26 +0000 |
commit | 23447f8eab271f491d72eab96b5ef347e14397c1 (patch) | |
tree | a4415f34e67d6167cd6c6c71e05de8368ac66057 /mk | |
parent | f6c706e84d8188820d590b1c1343b98cfdce6157 (diff) | |
download | pkgsrc-23447f8eab271f491d72eab96b5ef347e14397c1.tar.gz |
Add print-PLIST target for automatic PLIST generation:
- files & symlinks first
- @exec/@unexec calls are added for info files
- @dirrm statements last
- empty directories are handled properly
- dirs from mtree files are excluded
Usage:
- make install
- make print-PLIST | brain >pkg/PLIST
Moved over from bsd.hf-pkg.mk, after it's lived there for quite
some time now.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/bsd.pkg.mk | 75 |
1 files changed, 74 insertions, 1 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index 0c052b6bd53..a15478b16fc 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.479 2000/06/10 06:51:31 veego Exp $ +# $NetBSD: bsd.pkg.mk,v 1.480 2000/06/16 09:18:26 hubertf Exp $ # # This file is in the public domain. # @@ -2679,6 +2679,79 @@ print-pkg-depend-sizes: .endfor +### +### Automatic PLIST generation +### - files & symlinks first +### - @exec/@unexec calls are added for info files +### - @dirrm statements last +### - empty directories are handled properly +### - dirs from mtree files are excluded +### +### Usage: +### - make install +### - make print-PLIST | brain >pkg/PLIST +### + +# Common (system) directories not to generate @dirrm statements for +# Reads MTREE_FILE and extracts a list of sed commands that will +# sort out which directories NOT to include into the PLIST @dirrm list +.if make(print-PLIST) +COMMON_DIRS!= ${AWK} 'BEGIN { \ + i=0; \ + stack[i]="${PREFIX}" ; \ + cwd=""; \ + } \ + ! ( /^\// || /^\#/ || /^$$/ ) { \ + if ( $$1 == ".." ){ \ + i=i-1; \ + cwd = stack[i]; \ + } else if ( $$1 == "." ){ \ + } else { \ + stack[i] = cwd ; \ + if ( i == 0 ){ \ + cwd = $$1 ; \ + } else { \ + cwd = cwd "\\\\/" $$1 ; \ + } \ + print "-e \"/^" cwd "$$$$/d\""; \ + i=i+1 ; \ + } \ + } \ + ' <${MTREE_FILE} +.endif + + +# scan $PREFIX for any files/dirs modified since the package was extracted +# will emit "@exec mkdir"-statements for empty directories +# XXX will fail for data files that were copied using tar (e.g. emacs)! +# XXX should check $LOCALBASE and $X11BASE, and add @cwd statements + +.if !target(print-PLIST) +print-PLIST: + @${ECHO} '@comment $$NetBSD: bsd.pkg.mk,v 1.480 2000/06/16 09:18:26 hubertf Exp $$' + @${FIND} ${PREFIX}/. -newer ${EXTRACT_COOKIE} \! -type d \ + | ${SED} s@${PREFIX}/./@@ \ + | sort \ + | ${AWK} ' \ + { \ + if (/.info$$/) { \ + print "\@unexec install-info --delete --info-dir=%D/info %D/" $$1; \ + print $$1; \ + print "\@exec install-info --info-dir=%D/info %D/" $$1; \ + } else if (!/^info\/dir$$/) { \ + print $$1; \ + } \ + }' + @for i in `${FIND} ${PREFIX}/. -newer ${EXTRACT_COOKIE} -type d | ${SED} -e s@${PREFIX}/./@@ -e '/^${PREFIX:S/\//\\\//g}\/.$$/d' | sort -r | ${SED} ${COMMON_DIRS}` ; \ + do \ + if [ `ls -la ${PREFIX}/$$i | wc -l` = 3 ]; then \ + ${ECHO} @exec /bin/mkdir -p ${PREFIX}/$$i ; \ + fi ; \ + ${ECHO} @dirrm $$i ; \ + done +.endif # target(print-PLIST) + + # Fake installation of package so that user can pkg_delete it later. # Also, make sure that an installed package is recognized correctly in # accordance to the @pkgdep directive in the packing lists |