diff options
author | joerg <joerg@pkgsrc.org> | 2006-10-09 12:25:44 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2006-10-09 12:25:44 +0000 |
commit | 5b374e445d1af7cb5c191eded8e436c25ef84c54 (patch) | |
tree | 9814d8b785561d4625d3535aa344ea9c5b84ef85 /mk/install/install.mk | |
parent | a8e70089029ef60b4f74d3451dfa967cab20e71e (diff) | |
download | pkgsrc-5b374e445d1af7cb5c191eded8e436c25ef84c54.tar.gz |
Main infrastructure for DESTDIR support.
Packages may set PKG_DESTDIR_SUPPORT to either "destdir" or
"user-destdir" to flag support for this, following the same
rules as PKG_INSTALLATION_TYPES (e.g. define before first include
of bsd.prefs.mk).
The user activates it via USE_DESTDIR. When set to "yes",
packages with "user-destdir" are handled as "destdir".
The installation of the package will not go to ${LOCALBASE},
but a subdirectory of ${WRKDIR} instead. pre/post install scripts are
not run and the package is not registered either. A binary package
can be created instead to be installed normally with pkg_add.
For "user-destdir" packages, everything is run as normal user and
ownership is supposed to be correctled by pkg_create later. Since
the current pkg_install code uses pax and it doesn't allow overwriting
owners, this does not work yet.
For "destdir" packages, installation, packaging and cleaning is run as
root.
This commit does not change the handling of DEPENDS_TARGET or
bin-install to allow recursive usage.
Diffstat (limited to 'mk/install/install.mk')
-rw-r--r-- | mk/install/install.mk | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/mk/install/install.mk b/mk/install/install.mk index a09fde24288..99bed60bcf7 100644 --- a/mk/install/install.mk +++ b/mk/install/install.mk @@ -1,4 +1,4 @@ -# $NetBSD: install.mk,v 1.21 2006/10/09 11:59:08 joerg Exp $ +# $NetBSD: install.mk,v 1.22 2006/10/09 12:25:44 joerg Exp $ ###################################################################### ### install (PUBLIC) @@ -121,8 +121,10 @@ release-install-localbase-lock: release-localbase-lock ### the built software, register the software installation, and run ### some sanity checks. ### +.if ${_USE_DESTDIR} != "user-destdir" _INSTALL_ALL_TARGETS+= acquire-install-localbase-lock -.if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER) +.endif +.if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER) && ${_USE_DESTDIR} == "no" _INSTALL_ALL_TARGETS+= install-check-conflicts _INSTALL_ALL_TARGETS+= install-check-installed .endif @@ -131,7 +133,9 @@ _INSTALL_ALL_TARGETS+= install-check-umask _INSTALL_ALL_TARGETS+= check-files-pre .endif _INSTALL_ALL_TARGETS+= install-makedirs +.if ${_USE_DESTDIR} == "no" _INSTALL_ALL_TARGETS+= pre-install-script +.endif _INSTALL_ALL_TARGETS+= pre-install _INSTALL_ALL_TARGETS+= do-install _INSTALL_ALL_TARGETS+= post-install @@ -141,12 +145,16 @@ _INSTALL_ALL_TARGETS+= install-script-data .if empty(CHECK_FILES:M[nN][oO]) && !empty(CHECK_FILES_SUPPORTED:M[Yy][Ee][Ss]) _INSTALL_ALL_TARGETS+= check-files-post .endif +.if ${_USE_DESTDIR} == "no" _INSTALL_ALL_TARGETS+= post-install-script -.if !defined(NO_PKG_REGISTER) +.endif +.if !defined(NO_PKG_REGISTER) && ${_USE_DESTDIR} == "no" _INSTALL_ALL_TARGETS+= register-pkg .endif _INSTALL_ALL_TARGETS+= privileged-install-hook +.if ${_USE_DESTDIR} != "user-destdir" _INSTALL_ALL_TARGETS+= release-install-localbase-lock +.endif _INSTALL_ALL_TARGETS+= error-check .if empty(CHECK_SHLIBS:M[nN][oO]) @@ -225,18 +233,18 @@ MTREE_ARGS?= -U -f ${MTREE_FILE} -d -e -p .PHONY: install-makedirs install-makedirs: - ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -d ${PREFIX} || ${MKDIR} ${PREFIX} + ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -d ${DESTDIR}${PREFIX} || ${MKDIR} ${DESTDIR}${PREFIX} .if !defined(NO_MTREE) ${_PKG_SILENT}${_PKG_DEBUG}${TEST} ! -f ${MTREE_FILE} || \ - ${MTREE} ${MTREE_ARGS} ${PREFIX}/ + ${MTREE} ${MTREE_ARGS} ${DESTDIR}${PREFIX}/ .endif .if defined(INSTALLATION_DIRS) && !empty(INSTALLATION_DIRS) @${STEP_MSG} "Creating installation directories" ${_PKG_SILENT}${_PKG_DEBUG} \ for dir in ${INSTALLATION_DIRS}; do \ case "$$dir" in \ - ${PREFIX}/*) \ - dir=`${ECHO} $$dir | ${SED} "s|^${PREFIX}/||"` ;; \ + ${DESTDIR}${PREFIX}/*) \ + dir=`${ECHO} $$dir | ${SED} "s|^${DESTDIR}${PREFIX}/||"` ;; \ /*) continue ;; \ esac; \ if [ -f "${PREFIX}/$$dir" ]; then \ @@ -245,11 +253,11 @@ install-makedirs: fi; \ case "$$dir" in \ *bin|*bin/*|*libexec|*libexec/*) \ - ${INSTALL_PROGRAM_DIR} ${PREFIX}/$$dir ;; \ + ${INSTALL_PROGRAM_DIR} ${DESTDIR}${PREFIX}/$$dir ;; \ ${PKGMANDIR}/*) \ - ${INSTALL_MAN_DIR} ${PREFIX}/$$dir ;; \ + ${INSTALL_MAN_DIR} ${DESTDIR}${PREFIX}/$$dir ;; \ *) \ - ${INSTALL_DATA_DIR} ${PREFIX}/$$dir ;; \ + ${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/$$dir ;; \ esac; \ done .endif # INSTALLATION_DIRS @@ -265,14 +273,19 @@ install-makedirs: INSTALL_DIRS?= ${BUILD_DIRS} INSTALL_MAKE_FLAGS?= ${MAKE_FLAGS} INSTALL_TARGET?= install ${USE_IMAKE:D${NO_INSTALL_MANPAGES:D:Uinstall.man}} +.if ${_USE_DESTDIR} != "no" +INSTALL_ENV+= DESTDIR=${DESTDIR:Q} +INSTALL_MAKE_FLAGS+= DESTDIR=${DESTDIR:Q} +.endif .if !target(do-install) do-install: . for _dir_ in ${INSTALL_DIRS} ${_PKG_SILENT}${_PKG_DEBUG}${_ULIMIT_CMD} \ cd ${WRKSRC} && cd ${_dir_} && \ - ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \ - -f ${MAKE_FILE} ${INSTALL_TARGET} + ${SETENV} ${INSTALL_ENV} ${MAKE_ENV} \ + ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \ + -f ${MAKE_FILE} ${INSTALL_TARGET} . endfor .endif @@ -301,7 +314,7 @@ _DOC_COMPRESS= \ MANZ=${_MANZ} \ PKG_VERBOSE=${PKG_VERBOSE} \ TEST=${TOOLS_TEST:Q} \ - ${SH} ${PKGSRCDIR}/mk/plist/doc-compress ${PREFIX} + ${SH} ${PKGSRCDIR}/mk/plist/doc-compress ${DESTDIR}${PREFIX} .PHONY: install-doc-handling install-doc-handling: plist |