# # On "make install", creates a binary package. # # Todo: # - properly handle MLINKs # # (c) Copyright 1999, 2000 Hubert Feyrer # All Rights Reserved, permission needed to use this code. # ########################################################################### # We get a list of files with this command INSTALL= echo ${.TARGET:S,${DESTDIR}/,,} >>.PLIST ; install # Figure out what version to give the packages VERS!= sh /sys/conf/osrelease.sh # Where to put binary packages (if DESTDIR is set) PACKAGES= ${RELEASEDIR}/binary/pkgs # Where to register installed packages (if DESTDIR is not set) PKG_DBDIR= /var/db/pkg # The name of the binary/installed package PKG= netbsd-${.CURDIR:C,.*src[^/]*/,,:S,/,-,g}-${VERS} beforeinstall: @\ rm -f .PLIST ; \ if [ "${DESTDIR}" = "" ] ; then \ pkg=${PKG}; \ pkg_delete $$pkg || true ; \ pkg_delete -O $$pkg || true ; \ fi afterinstall: pkgize pkgize: @\ touch .PLIST ; \ if [ "${MLINKS}" != "" ] ; then \ set ${MLINKS} ; \ while test $$# -ge 2; do \ name=$$1; \ shift; \ cdir=${DESTDIR}${MANDIR}/cat$${name##*.}; \ cl=$${cdir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \ mdir=${DESTDIR}${MANDIR}/man$${name##*.}; \ ml=$${mdir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \ name=$$1; \ shift; \ cdir=${DESTDIR}${MANDIR}/cat$${name##*.}; \ ct=$${cdir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \ mdir=${DESTDIR}${MANDIR}/man$${name##*.}; \ mt=$${mdir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \ echo cl=$$cl, ml=$$ml, ct=$$ct, mt=$$mt ; \ if [ -z "${UPDATE}" -o ! -f $$ct ]; then \ echo $$ct | sed 's,${DESTDIR}/,,' >>.PLIST; \ fi; \ if [ -z "${UPDATE}" -o ! -f $$mt ]; then \ echo $$mt | sed 's,${DESTDIR}/,,' >>.PLIST; \ fi; \ done; \ fi ; \ mkdir -p ${PACKAGES} ; \ id=${.CURDIR:C,.*src[^/]*/,,}; \ pkg=${PKG}; \ if [ "${SUBDIR}" != "" ] ; then \ deps='${SUBDIR:S,^,${.CURDIR:C,.*src[^/]*/,,:S,/,-,g}-,g:S,$,-${VERS},g}' ; \ fi ; \ if [ "${DESTDIR}" = "" ] ; then \ mkdir -p ${PKG_DBDIR}/$$pkg ; \ pkg_create \ -O \ -c-"$$id" \ -d-"$$id" \ -f .PLIST \ -P "$$deps" \ -p / \ $$id-${VERS} >${PKG_DBDIR}/$$pkg/+CONTENTS ; \ echo "$$id" >${PKG_DBDIR}/$$pkg/+DESC ; \ echo "$$id" >${PKG_DBDIR}/$$pkg/+COMMENT ; \ else \ pkg_create \ -c-"$$id" \ -d-"$$id" \ -f .PLIST \ -P "$$deps" \ -l \ -p / \ -L ${DESTDIR} \ ${PACKAGES}/$$pkg.tgz ; \ fi