Annotation of pkgsrc/lang/perl5/packlist.mk, Revision 1.13
1.13 ! rillig 1: # $NetBSD: packlist.mk,v 1.12 2007/01/15 05:36:04 rillig Exp $
1.1 jlam 2: #
3: # This Makefile fragment is intended to be included by packages that
4: # create packlist files. This file is automatically included by
5: # perl5/module.mk, so it is typically not necessary to include this
6: # file.
7: #
8: # The following variables should be set prior to including this file:
9: #
1.11 rillig 10: # PERL5_USE_PACKLIST
11: # When set to "yes" (the default), automatically generates the
12: # PLIST for the pkgsrc package from the Perl packlist.
13: #
1.1 jlam 14: # PERL5_PACKLIST_DIR "install*arch" directory under which packlist
15: # files are installed; defaults to
16: # ${PERL5_INSTALLVENDORARCH}.
17: #
18: # PERL5_PACKLIST list of packlist files relative to
19: # ${PERL5_PACKLIST_DIR}.
20:
21: .if !defined(_PERL5_PACKLIST_MK)
22: _PERL5_PACKLIST_MK= # defined
23:
24: .include "../../mk/bsd.prefs.mk"
25:
1.12 rillig 26: PERL5_USE_PACKLIST?= yes
1.11 rillig 27: .if !empty(PERL5_USE_PACKLIST:M[Yy][Ee][Ss])
28: # XXX: still experimental, but many packages already work
29: #PERL5_PACKLIST?= auto/${DISTNAME:C/-[0-9].*$//:C,-,/,g}/.packlist
30: .endif
31:
1.10 joerg 32: PERL5_PACKLIST_DESTDIR?= yes
33:
1.1 jlam 34: .if defined(PERL5_PACKLIST)
35: PERL5_PACKLIST_DIR?= ${PERL5_INSTALLVENDORARCH}
1.9 joerg 36: _PERL5_REAL_PACKLIST= ${PERL5_PACKLIST:S/^/${PERL5_PACKLIST_DIR}\//}
37: _PERL5_PACKLIST= ${_PERL5_REAL_PACKLIST:S/^/${DESTDIR}/}
1.1 jlam 38: .endif
39:
40:
41: ###########################################################################
42: ###
43: ### INSTALL/DEINSTALL scripts to manage symlinks
44: ###
45:
1.8 jlam 46: INSTALL_TEMPLATES+= ${.CURDIR}/../../lang/perl5/files/install.tmpl
47: DEINSTALL_TEMPLATES+= ${.CURDIR}/../../lang/perl5/files/deinstall.tmpl
1.1 jlam 48: FILES_SUBST+= PERL5_COMMENT=
1.9 joerg 49: FILES_SUBST+= PERL5_PACKLIST=${_PERL5_REAL_PACKLIST:Q}
1.1 jlam 50:
51:
52: ###########################################################################
53: ###
54: ### Packlist -> PLIST generation
55: ###
56:
57: # Generate the PLIST from the files listed in PERL5_PACKLIST.
58: .if defined(_PERL5_PACKLIST)
1.7 rillig 59: PERL5_PLIST_COMMENT_CMD= \
1.1 jlam 60: { ${ECHO} "@comment The following lines are automatically generated"; \
61: ${ECHO} "@comment from the installed .packlist files."; }
1.7 rillig 62: PERL5_PLIST_FILES_CMD= \
1.10 joerg 63: { ${CAT} ${_PERL5_PACKLIST}; for f in ${_PERL5_REAL_PACKLIST}; do ${TEST} ! -f "${DESTDIR}$$f" || ${ECHO} "$$f"; done; } \
1.7 rillig 64: | ${SED} -e "s,[ ].*,," -e "s,/\\./,/,g" -e "s,${PREFIX}/,," \
1.1 jlam 65: | ${SORT} -u
1.7 rillig 66: PERL5_PLIST_DIRS_CMD= \
1.10 joerg 67: { ${CAT} ${_PERL5_PACKLIST}; for f in ${_PERL5_REAL_PACKLIST}; do ${TEST} ! -f "${DESTDIR}$$f" || ${ECHO} "$$f"; done; } \
1.7 rillig 68: | ${SED} -e "s,[ ].*,," -e "s,/\\./,/,g" -e "s,${PREFIX}/,," \
69: -e "s,^,@unexec "${RMDIR:Q}" -p %D/," \
70: -e "s,/[^/]*\$$, 2>/dev/null || "${TRUE:Q}"," \
1.1 jlam 71: | ${SORT} -ur
1.7 rillig 72: PERL5_GENERATE_PLIST= ${PERL5_PLIST_COMMENT_CMD}; \
73: ${PERL5_PLIST_FILES_CMD}; \
74: ${PERL5_PLIST_DIRS_CMD};
75: GENERATE_PLIST+= ${PERL5_GENERATE_PLIST}
1.1 jlam 76: .endif
77:
1.2 jlam 78: ###########################################################################
79: ###
1.10 joerg 80: ### Packlist DESTDIR handling -- strip off the DESTDIR from each entry.
81: ###
82:
83: .if !empty(PERL5_PACKLIST_DESTDIR:M[Yy][Ee][Ss])
84: _PERL5_PACKLIST_AWK_STRIP_DESTDIR= \
85: BEGIN { destdir = "${DESTDIR}"; \
86: len_destdir = length(destdir); } \
87: { if (index($$1, destdir) == 1) \
88: $$1 = substr($$1, len_destdir + 1) }
89: .else
90: _PERL5_PACKLIST_AWK_STRIP_DESTDIR=
91: .endif
92:
93: ###########################################################################
94: ###
1.2 jlam 95: ### Packlist MANZ handling -- modify the .packlist so that it properly
96: ### records either compressed or uncompressed manpages depending on
97: ### how pkgsrc modifies them after installation.
98: ###
99:
100: _PERL5_PACKLIST_MANPAGE_RE= \
1.5 jlam 101: ^(\/[^ \/]*)+\/(man[1-9ln]\/[^ \/]*\.[1-9ln]|cat[1-9ln]\/[^ \/]*\.[0-9])
1.2 jlam 102:
103: _PERL5_PACKLIST_AWK_STRIP_MANZ= \
104: /${_PERL5_PACKLIST_MANPAGE_RE}\.gz/ \
105: { $$1 = substr($$1, 1, length($$1) - 3); }
106:
107: _PERL5_PACKLIST_AWK_ADD_MANZ.no= # empty
108: _PERL5_PACKLIST_AWK_ADD_MANZ.yes= \
109: /${_PERL5_PACKLIST_MANPAGE_RE}/ { $$1 = $$1 ".gz"; }
110:
111: .if defined(_PERL5_PACKLIST)
112: post-install: perl-packlist
113: .endif
114:
1.7 rillig 115: .PHONY: perl-packlist
1.2 jlam 116: perl-packlist:
1.13 ! rillig 117: ${RUN} \
1.2 jlam 118: ${TEST} -n ${_PERL5_PACKLIST:Q}"" || exit 0; \
119: for file in ${_PERL5_PACKLIST}; do \
1.6 jlam 120: if ${TEST} ! -f "$$file"; then \
121: ${ECHO} 1>&2 "Perl packlist $$file is missing."; \
122: exit 1; \
123: fi; \
1.10 joerg 124: ${AWK} '${_PERL5_PACKLIST_AWK_STRIP_DESTDIR} \
125: ${_PERL5_PACKLIST_AWK_STRIP_MANZ} \
1.2 jlam 126: ${_PERL5_PACKLIST_AWK_ADD_MANZ.${_MANZ}} \
127: { print $$0 }' \
128: $$file > $$file.new; \
129: ${MV} -f $$file.new $$file; \
130: done
131:
1.1 jlam 132: .endif # _PERL5_PACKLIST_MK
CVSweb <webmaster@jp.NetBSD.org>