freebsd-ports/Mk/bsd.pkgng.mk

283 lines
10 KiB
Makefile
Raw Normal View History

#-*- tab-width: 4; -*-
# ex:ts=4
#
# $FreeBSD$
#
.if defined(_POSTMKINCLUDED)
PKGNG_Include_MAINTAINER= portmgr@FreeBSD.org
METADIR= ${WRKDIR}/.metadir
MANIFESTF= ${METADIR}/+MANIFEST
PKGPREINSTALL?= ${PKGDIR}/pkg-pre-install
PKGPOSTINSTALL?= ${PKGDIR}/pkg-post-install
PKGPREDEINSTALL?= ${PKGDIR}/pkg-pre-deinstall
PKGPOSTDEINSTALL?= ${PKGDIR}/pkg-post-deinstall
PKGPREUPGRADE?= ${PKGDIR}/pkg-pre-upgrade
PKGPOSTUPGRADE?= ${PKGDIR}/pkg-post-upgrade
PKGUPGRADE?= ${PKGDIR}/pkg-upgrade
_FORCE_POST_PATTERNS= rmdir kldxref mkfontscale mkfontdir fc-cache \
2013-03-28 03:45:02 -04:00
fonts.dir fonts.scale gtk-update-icon-cache \
gio-querymodules \
gtk-query-immodules \
ldconfig \
load-octave-pkg \
update-desktop-database update-mime-database \
gdk-pixbuf-query-loaders catalog.ports \
glib-compile-schemas
PLIST_REINPLACE:= ${PLIST_REINPLACE:Ndirrmtry}
PLIST_REINPLACE:= ${PLIST_REINPLACE:Nstopdaemon}
ACTUAL-PACKAGE-DEPENDS?= \
if [ "${_LIB_RUN_DEPENDS}" != " " ]; then \
${PKG_QUERY} "%n: {origin: %o, version: \"%v\"}" " " ${_LIB_RUN_DEPENDS:C,[^:]*:([^:]*):?.*,\1,:C,${PORTSDIR}/,,} 2>/dev/null || : ; \
${PKG_QUERY} "%dn: {origin: %do, version: \"%dv\"}" " " ${_LIB_RUN_DEPENDS:C,[^:]*:([^:]*):?.*,\1,:C,${PORTSDIR}/,,} 2>/dev/null || : ; \
fi
.if !target(fake-pkg)
fake-pkg:
.if !defined(NO_PKG_REGISTER)
.if defined(INSTALLS_DEPENDS)
@${ECHO_MSG} "===> Registering installation for ${PKGNAME} as automatic"
.else
@${ECHO_MSG} "===> Registering installation for ${PKGNAME}"
.endif
@${MKDIR} ${METADIR}
@${ECHO_CMD} "name: ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}" > ${MANIFESTF}
@${ECHO_CMD} "version: ${PKGVERSION}" >> ${MANIFESTF}
@${ECHO_CMD} "origin: ${PKGORIGIN}" >> ${MANIFESTF}
@${ECHO_CMD} "comment: |" >> ${MANIFESTF}
@${ECHO_CMD} " "${COMMENT:Q} >> ${MANIFESTF}
@${ECHO_CMD} "maintainer: ${MAINTAINER}" >> ${MANIFESTF}
@${ECHO_CMD} "prefix: ${PREFIX}" >> ${MANIFESTF}
.if defined(WWW)
@${ECHO_CMD} "www: ${WWW}" >> ${MANIFESTF}
.endif
@${ECHO_CMD} "deps: " >> ${MANIFESTF}
@${ACTUAL-PACKAGE-DEPENDS} | ${GREP} -v -E ${PKG_IGNORE_DEPENDS} | ${SORT} -u | ${SED} 's/^/ /' >> ${MANIFESTF}
@${ECHO_CMD} -n "categories: [" >> ${MANIFESTF}
.for cat in ${CATEGORIES:u}
@${ECHO_CMD} -n "${cat}," >> ${MANIFESTF}
.endfor
@${ECHO_CMD} "]" >> ${MANIFESTF}
.if defined(LICENSE_COMB)
@${ECHO_CMD} "licenselogic: ${LICENSE_COMB}" >> ${MANIFESTF}
.else
@${ECHO_CMD} "licenselogic: single" >> ${MANIFESTF}
.endif
@${ECHO_CMD} -n "licenses: [" >> ${MANIFESTF}
.for lic in ${LICENSE:u}
@${ECHO_CMD} -n "${lic}," >> ${MANIFESTF}
.endfor
@${ECHO_CMD} "]" >> ${MANIFESTF}
@${ECHO_CMD} -n "users: [" >> ${MANIFESTF}
.for user in ${USERS:u}
@${ECHO_CMD} -n "${user}, " >> ${MANIFESTF}
.endfor
@${ECHO_CMD} "]" >> ${MANIFESTF}
@${ECHO_CMD} -n "groups: [" >> ${MANIFESTF}
.for group in ${GROUPS:u}
@${ECHO_CMD} -n "${group}, " >> ${MANIFESTF}
.endfor
@${ECHO_CMD} "]" >> ${MANIFESTF}
@${ECHO_CMD} -n "options: {" >> ${MANIFESTF}
.for opt in ${COMPLETE_OPTIONS_LIST}
@[ -z "${PORT_OPTIONS:M${opt}}" ] || match="on" ; ${ECHO_MSG} -n " ${opt}: $${match:-off}," >> ${MANIFESTF}
.endfor
.undef opt
@${ECHO_CMD} "}" >> ${MANIFESTF}
@[ -f ${PKGINSTALL} ] && ${CP} ${PKGINSTALL} ${METADIR}/+INSTALL; \
[ -f ${PKGPREINSTALL} ] && ${CP} ${PKGPREINSTALL} ${METADIR}/+PRE_INSTALL; \
[ -f ${PKGPOSTINSTALL} ] && ${CP} ${PKGPOSTINSTALL} ${METADIR}/+POST_INSTALL; \
[ -f ${PKGDEINSTALL} ] && ${CP} ${PKGDEINSTALL} ${METADIR}/+DEINSTALL; \
[ -f ${PKGPREDEINSTALL} ] && ${CP} ${PKGPREDEINSTALL} ${METADIR}/+PRE_DEINSTALL; \
[ -f ${PKGPOSTDEINSTALL} ] && ${CP} ${PKGPOSTDEINSTALL} ${METADIR}/+POST_DEINSTALL; \
[ -f ${PKGUPGRADE} ] && ${CP} ${PKGUPGRADE} ${METADIR}/+UPGRADE; \
[ -f ${PKGPREUPGRADE} ] && ${CP} ${PKGPREUPGRADE} ${METADIR}/+PRE_UPGRADE; \
[ -f ${PKGPOSTUPGRADE} ] && ${CP} ${PKGPOSTUPGRADE} ${METADIR}/+POST_UPGRADE; \
${CP} ${DESCR} ${METADIR}/+DESC; \
[ -f ${PKGMESSAGE} ] && ${CP} ${PKGMESSAGE} ${METADIR}/+DISPLAY || return 0
.if !defined(NO_MTREE)
@[ -f ${MTREE_FILE} ] && ${CP} ${MTREE_FILE} ${METADIR}/+MTREE_DIRS || return 0
.endif
.if defined(INSTALLS_DEPENDS)
@${SETENV} FORCE_POST="${_FORCE_POST_PATTERNS}" ${PKG_CMD} -d -l -m ${METADIR} -f ${TMPPLIST}
.else
@${SETENV} FORCE_POST="${_FORCE_POST_PATTERNS}" ${PKG_CMD} -l -m ${METADIR} -f ${TMPPLIST}
.endif
@${RM} -rf ${METADIR}
.else
@${DO_NADA}
.endif
.endif
.if !target(check-build-conflicts)
check-build-conflicts:
.if ( defined(CONFLICTS) || defined(CONFLICTS_BUILD) ) && !defined(DISABLE_CONFLICTS) && !defined(DEFER_CONFLICTS_CHECK)
@conflicts_with=$$( \
{ ${PKG_QUERY} -g "%n-%v %p %o" ${CONFLICTS:C/.+/'&'/} ${CONFLICTS_BUILD:C/.+/'&'/} 2>/dev/null || : ; } \
| while read pkgname prfx orgn; do \
if [ "/${PREFIX}" = "/$${prfx}" -a "/${PKGORIGIN}" != "/$${orgn}" ]; then \
${ECHO_CMD} -n " $${pkgname}"; \
fi; \
done); \
if [ -n "$${conflicts_with}" ]; then \
${ECHO_MSG}; \
${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s): "; \
for entry in $${conflicts_with}; do \
${ECHO_MSG} " $${entry}"; \
done; \
${ECHO_MSG}; \
${ECHO_MSG} " They will not build together."; \
${ECHO_MSG} " Please remove them first with pkg delete."; \
exit 1;\
fi
.endif
.endif
.if !target(identify-install-conflicts)
identify-install-conflicts:
.if ( defined(CONFLICTS) || defined(CONFLICTS_INSTALL) ) && !defined(DISABLE_CONFLICTS)
@conflicts_with=$$( \
{ ${PKG_QUERY} -g "%n-%v %p %o" ${CONFLICTS:C/.+/'&'/} ${CONFLICTS_INSTALL:C/.+/'&'/} 2>/dev/null || : ; } \
| while read pkgname prfx orgn; do \
if [ "/${PREFIX}" = "/$${prfx}" -a "/${PKGORIGIN}" != "/$${orgn}" ]; then \
${ECHO_CMD} -n " $${pkgname}"; \
fi; \
done); \
if [ -n "$${conflicts_with}" ]; then \
${ECHO_MSG}; \
${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s): "; \
for entry in $${conflicts_with}; do \
${ECHO_MSG} " $${entry}"; \
done; \
${ECHO_MSG}; \
${ECHO_MSG} " They install files into the same place."; \
${ECHO_MSG} " You may want to stop build with Ctrl + C."; \
sleep 10; \
fi
.endif
.endif
.if !target(check-install-conflicts)
check-install-conflicts:
.if ( defined(CONFLICTS) || defined(CONFLICTS_INSTALL) || ( defined(CONFLICTS_BUILD) && defined(DEFER_CONFLICTS_CHECK) ) ) && !defined(DISABLE_CONFLICTS)
.if defined(DEFER_CONFLICTS_CHECK)
@conflicts_with=$$( \
{ ${PKG_QUERY} -g "%n-%v %p %o" ${CONFLICTS:C/.+/'&'/} ${CONFLICTS_BUILD:C/.+/'&'/} ${CONFLICTS_INSTALL:C/.+/'&'/} 2>/dev/null || : ; } \
| while read pkgname prfx orgn; do \
if [ "/${PREFIX}" = "/$${prfx}" -a "/${PKGORIGIN}" != "/$${orgn}" ]; then \
${ECHO_CMD} -n " $${pkgname}"; \
fi; \
done); \
if [ -n "$${conflicts_with}" ]; then \
${ECHO_MSG}; \
${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s): "; \
for entry in $${conflicts_with}; do \
${ECHO_MSG} " $${entry}"; \
done; \
${ECHO_MSG}; \
${ECHO_MSG} " Please remove them first with pkg_delete(1)."; \
exit 1; \
fi
.else
@conflicts_with=$$( \
{ ${PKG_QUERY} -g "%n-%v %p %o" ${CONFLICTS:C/.+/'&'/} ${CONFLICTS_INSTALL:C/.+/'&'/} 2>/dev/null || : ; } \
| while read pkgname prfx orgn; do \
if [ "/${PREFIX}" = "/$${prfx}" -a "/${PKGORIGIN}" != "/$${orgn}" ]; then \
${ECHO_CMD} -n " $${pkgname}"; \
fi; \
done); \
if [ -n "$${conflicts_with}" ]; then \
${ECHO_MSG}; \
${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s): "; \
for entry in $${conflicts_with}; do \
${ECHO_MSG} " $${entry}"; \
done; \
${ECHO_MSG}; \
${ECHO_MSG} " They install files into the same place."; \
${ECHO_MSG} " Please remove them first with pkg_delete(1)."; \
exit 1; \
fi
.endif # defined(DEFER_CONFLICTS_CHECK)
.endif
.endif
.if !target(do-package)
do-package: ${TMPPLIST}
@if [ -d ${PACKAGES} ]; then \
if [ ! -d ${PKGREPOSITORY} ]; then \
if ! ${MKDIR} ${PKGREPOSITORY}; then \
${ECHO_MSG} "=> Can't create directory ${PKGREPOSITORY}."; \
exit 1; \
fi; \
fi; \
fi;
@for cat in ${CATEGORIES}; do \
${RM} -f ${PACKAGES}/$$cat/${PKGNAMEPREFIX}${PORTNAME}*${PKG_SUFX} ; \
done
@if ${PKG_CREATE} -o ${PKGREPOSITORY} ${PKGNAME}; then \
The pkg developement team is proud to announce the new 1.1.0 beta1 release of pkg. Here is the list of new features that happened in pkg 1.1: - new simpler and more reliable solver - shared libraries are now always tracked - ssh:// is supported as a protocol to distribute packages (needs pkg 1.1+ on the server hosting the packages) - multirepository is no longer considered experimental and works by default. - incremental update of the catalog (only if the repository was created by pkg 1.1+) - simplification of the public API - stabilisation of the public API (we will now try to keep it stable and if change are needed there will be deprecation time before removal of some old functions) - new experimental pkg convert (can convert from and to legacy pkg database) pkg2ng now uses pkg convert (still recommanded to use pkg2ng) - new pkg lock/unlock to prevent any manipulation of a given package (no upgrade,delete,etc) - improved UI (now you can see the progress of an upgrade what is left to be done) - new pkg annotation to allow one to add annotations (free form key/value) to a package) - pkg audit is now able to directly parse the vuxml native format and not only the compact version - pkg -vv now shows all available options and their current settings - pkg -vvv now shows a description of all the available options - pkg info now automatically considers the query as globbing if * is in the requested pattern - new hook plugin interface (allows users to create hooks that get called at anytime during and upgrade/installation/deletion of a package) - new cmd plugin interface (allows users to create new sub command available for pkg) - pkg register can now register a port installation in the legacy database format - repository can be defined in simple yaml files Internal: - massive usage of hash tables (uthash), which simplifies a lot of the code, and improves performances - lots of optimisation in plist and manifest parsing - lots of optimisation in loading packages (mmap used when possible) - lots of cleanup in memory usage - regression test framework is now ready (using atf) regression test are slowly being added and populated. To use this new version: Ports users (or in building factories: poudriere/tinderbox): Add WITH_PKGNG=devel to your make.conf pkg set -o ports-mgmt/pkg:ports-mgmt/pkg-devel Binary package users, if the remote repository is providing pkg 1.1: pkg set -o ports-mgmt/pkg:ports-mgmt/pkg-devel pkg upgrade Note that pkg 1.1 can use a repository created for pkg 1.0 and vis versa. Huge thanks to all the people that have contributed to the pkg developement: - may that be by code - documentation - bug report - feedback - ideas List of people who contributed code: Baptiste Daroussin, Matthew Seaman, Bryan Drewery, Vsevolod Stakhov, Marin Atanasov Nikolov, Alexandre Perrin, Romain Tartière, Julien Laffaye, Glen Barber, John Marino, Alex Kozlov, Roman Naumann, Sofian Brabez, Alberto Villa, Will Andrews, Eitan Adler, Dan McGregor, namor, niamtokik, Arthur Gautier, Garrett Cooper, Andrew Turner, Jeremy Chadwick, Hajimu UMEMOTO, Mark Lokowich, Eygene Ryabinkin, Pietro Cerutti, Rolf Grossmann, Ed Schouten, Dimitry Andric, David Forsythe, Stefan Grundmann, Craig Rodrigues, Antoine Brodin, Andrey Zonov, Joel Dahl Stats between 1.0 and 1.1: 287 files changed, 63418 insertions(+), 18763 deletions(-) 1198 commits
2013-05-30 11:17:29 -04:00
if [ "${PKGORIGIN}" = "ports-mgmt/pkg" -o "${PKGORIGIN}" = "ports-mgmt/pkg-devel" ]; then \
if [ ! -d ${PKGLATESTREPOSITORY} ]; then \
if ! ${MKDIR} ${PKGLATESTREPOSITORY}; then \
${ECHO_MSG} "=> Can't create directory ${PKGLATESTREPOSITORY}."; \
exit 1; \
fi; \
fi ; \
${LN} -sf ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PKGLATESTFILE} ; \
fi; \
else \
cd ${.CURDIR} && eval ${MAKE} delete-package; \
exit 1; \
fi
.endif
.if !target(check-already-installed)
check-already-installed:
.if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER)
@${ECHO_MSG} "===> Checking if ${PKGORIGIN} already installed"; \
pkgname=`${PKG_INFO} -q -O ${PKGORIGIN}`; \
if [ -n "$${pkgname}" ]; then \
v=`${PKG_VERSION} -t $${pkgname} ${PKGNAME}`; \
if [ "w$${v}" = "x<" ]; then \
${ECHO_CMD} "===> An older version of ${PKGORIGIN} is already installed ($${found_package})"; \
else \
${ECHO_CMD} "===> ${PKGNAME} is already installed"; \
fi; \
${ECHO_MSG} " You may wish to \`\`make deinstall'' and install this port again"; \
${ECHO_MSG} " by \`\`make reinstall'' to upgrade it properly."; \
${ECHO_MSG} " If you really wish to overwrite the old port of ${PKGORIGIN}"; \
${ECHO_MSG} " without deleting it first, set the variable \"FORCE_PKG_REGISTER\""; \
${ECHO_MSG} " in your environment or the \"make install\" command line."; \
exit 1; \
fi
.else
@${DO_NADA}
.endif
.endif
.if !target(deinstall)
deinstall:
.if defined(UID) && ${UID} != 0 && !defined(INSTALL_AS_USER)
@${ECHO_MSG} "===> Switching to root credentials for '${.TARGET}' target"
@cd ${.CURDIR} && \
${SU_CMD} "${MAKE} ${.TARGET}"
@${ECHO_MSG} "===> Returning to user credentials"
.else
@${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN}"
@if ${PKG_INFO} -e ${PKGORIGIN}; then \
p=`${PKG_INFO} -q ${PKGORIGIN}`; \
${ECHO_MSG} "===> Deinstalling $${p}"; \
${PKG_DELETE} -f ${PKGORIGIN} ; \
else \
${ECHO_MSG} "===> ${PKGBASE} not installed, skipping"; \
fi
@${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
.endif
.endif
.endif # defined(_POSTMKINCLUDED)