1 # $NetBSD: views.mk,v 1.6 2009/03/17 22:13:36 rillig Exp $
3 # By default, all packages attempt to link into the views.
4 .if
${PKG_INSTALLATION_TYPE} == "pkgviews"
8 # DEFAULT_VIEW.${PKGBASE} default view for ${PKGBASE}
9 # VIEWBASE base location of files at run-time
11 DEFAULT_VIEW.
${PKGBASE}?
= ${DEFAULT_VIEW}
12 .if
${PKG_INSTALLATION_TYPE} == "pkgviews"
13 . if empty
(DEFAULT_VIEW.
${PKGBASE}:M
"")
14 VIEWBASE
= ${LOCALBASE}/${DEFAULT_VIEW.
${PKGBASE}}
16 VIEWBASE
= ${LOCALBASE}
18 .elif
${PKG_INSTALLATION_TYPE} == "overwrite"
21 MAKE_ENV
+= VIEWBASE
=${VIEWBASE}
23 PKGVIEWS
+= ${DEFAULT_VIEW.
${PKGBASE}}
25 .if
${PKG_INSTALLATION_TYPE} == "pkgviews"
26 privileged-install-hook
: build-views
29 ######################################################################
30 ### build-views, su-build-views (PRIVATE)
31 ######################################################################
32 ### build-views adds the package to each view in PKGVIEWS.
34 .PHONY
: build-views su-build-views
35 build-views
: su-target
36 @
${STEP_MSG} "Building views for ${PKGNAME}"
40 ${MKDIR} ${LOCALBASE}; \
41 for v in
${PKGVIEWS}; do \
43 "") dbdir
=${PKG_DBDIR}; viewname
=standard
;; \
44 *) dbdir
=${LOCALBASE}/$$v/.dbdir
; viewname
=$$v ;; \
46 ${STEP_MSG} "Performing package view clash check for ${PKGNAME} in $$viewname view"; \
47 pkg
=`${PKG_INFO_CMD} -K $$dbdir -e ${PKGBASE} || ${TRUE}`; \
50 *) ${WARNING_MSG} "${PKGBASE} exists in $$viewname view - package $$pkg ***"; \
51 ${WARNING_MSG} "Not hoisting ${PKGNAME} into $$viewname view"; \
55 ${STEP_MSG} "Performing package view overwrite check for ${PKGNAME} in $$viewname view"; \
56 dups
=`${PKGSRC_SETENV} PLIST_IGNORE_FILES=${_PLIST_IGNORE_FILES:Q} ${PKG_VIEW} --view=$$v check ${PKGNAME} || ${TRUE}`; \
59 *) ${WARNING_MSG} "***********************************************************"; \
60 ${WARNING_MSG} "**** The following symbolic links will be overwritten *****"; \
62 ${LS} -l
${LOCALBASE}/$$v/$$f |
${WARNING_CAT}; \
64 ${WARNING_MSG} "***********************************************************"; \
67 ${STEP_MSG} "Linking package into $$viewname view"; \
68 ${PKGSRC_SETENV} PLIST_IGNORE_FILES
=${_PLIST_IGNORE_FILES
:Q
} ${PKG_VIEW} --view
=$$v add
${PKGNAME}; \
71 ######################################################################
72 ### remove-views, su-remove-views (PRIVATE)
73 ######################################################################
74 ### remove-views removes the package from each view in PKGVIEWS.
76 .PHONY
: remove-views su-remove-views
77 remove-views
: su-target
78 @
${STEP_MSG} "Removing ${PKGNAME} from views"
82 for v in
"" ${PKGVIEWS}; do \
83 ${TEST} -n
"$$v" || continue
; \
85 "") dbdir
=${PKG_DBDIR}; viewname
=standard
;; \
86 *) dbdir
=${LOCALBASE}/$$v/.dbdir
; viewname
=$$v ;; \
88 ${STEP_MSG} "Removing package from $$viewname view"; \
89 ${PKGSRC_SETENV} PLIST_IGNORE_FILES
=${_PLIST_IGNORE_FILES
:Q
} ${PKG_VIEW} --view
=$$v delete
${PKGNAME}; \