Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/syspkg/mk Import syspkg make infrastructure from dra...



details:   https://anonhg.NetBSD.org/src/rev/f0dd5c8f1291
branches:  trunk
changeset: 520340:f0dd5c8f1291
user:      jwise <jwise%NetBSD.org@localhost>
date:      Mon Jan 07 22:48:30 2002 +0000

description:
Import syspkg make infrastructure from draga.com CVS.

This is the latest version of <bsd.syspkg.mk>, and forms the basis of
NetBSD System Packages (syspkg).  Further development of this codebase
will occur within TNF's cvs repository, and copyright will be assigned
to TNF when the relevant paperwork is complete.

diffstat:

 distrib/syspkg/mk/bsd.syspkg.mk |  651 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 651 insertions(+), 0 deletions(-)

diffs (truncated from 655 to 300 lines):

diff -r a43ecbd004f5 -r f0dd5c8f1291 distrib/syspkg/mk/bsd.syspkg.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/syspkg/mk/bsd.syspkg.mk   Mon Jan 07 22:48:30 2002 +0000
@@ -0,0 +1,651 @@
+#      $NetBSD: bsd.syspkg.mk,v 1.1.1.1 2002/01/07 22:48:30 jwise Exp $
+#
+#      This file is derived from:
+#
+#      NetBSD: bsd.pkg.mk,v 1.636 2001/01/05 18:03:14 jlam Exp
+#
+#      Plus many fixes and improvements from later revisions.
+#      
+#      However, it has been pared down to a minimum of targets, and
+#      adapted to the standard bsd.*.mk world order.
+#
+#      Portions of this code are copyright (c) 2000-2002 Jim Wise
+#
+
+.if !target(__initialized__)
+__initialized__:
+.if exists(${.CURDIR}/../Makefile.inc)
+.include "${.CURDIR}/../Makefile.inc"
+.endif
+.include <bsd.own.mk>
+.include <bsd.obj.mk>
+.MAIN:         all
+.endif
+
+OPSYS=                 NetBSD
+OS_VERSION!=           sh ${.PARSEDIR}/../../../sys/conf/osrelease.sh
+
+# keep bsd.own.mk from generating an install: target.
+NEED_OWN_INSTALL_TARGET=no
+
+##### Some overrides of defaults below on a per-OS basis.
+
+DEINSTALLDEPENDS?=     NO      # add -R to pkg_delete
+
+X11BASE?=              ${DESTDIR}/usr/X11R6
+
+PKGSRCDIR?=            ${.CURDIR:C|/[^/]*/[^/]*$||}
+PKGVERSION?=           ${OS_VERSION}.${TINY_VERSION}
+PKGWILDCARD?=          ${PKGBASE}-[0-9]*
+
+# For system packages, we set this here, as the version is auto-generated.
+PKGNAME?=              ${PKGBASE}-${PKGVERSION}
+
+PACKAGES?=             ${PKGSRCDIR}/../packages
+PKGDIR?=               ${.CURDIR}
+
+# Don't change these!!!  These names are built into the _TARGET_USE macro,
+# there is no way to refer to them cleanly from within the macro AFAIK.
+PACKAGE_COOKIE=                ${WRKDIR}/.package_done
+
+# Miscellaneous overridable commands:
+SHCOMMENT?=            ${ECHO_MSG} >/dev/null '***'
+
+MAKE_ENV+=             PREFIX=${PREFIX} X11BASE=${X11BASE} CFLAGS="${CFLAGS}"
+
+TOUCH_FLAGS?=          -f
+
+# Debugging levels for this file, dependent on PKG_DEBUG_LEVEL definition
+# 0 == normal, default, quiet operation
+# 1 == all shell commands echoed before invocation
+# 2 == shell "set -x" operation
+PKG_DEBUG_LEVEL?=      0
+_PKG_SILENT=           @
+_PKG_DEBUG=            
+
+.if ${PKG_DEBUG_LEVEL} > 0
+_PKG_SILENT=   
+.endif
+
+.if ${PKG_DEBUG_LEVEL} > 1
+_PKG_DEBUG=            set -x;
+.endif
+
+# In point of fact, this will often be ./obj, as per bsd.obj.mk
+WRKDIR?=               .
+
+COMMENT?=              ${PKGDIR}/COMMENT
+DESCR=                 ${PKGDIR}/DESCR
+PLIST=                 ${WRKDIR}/PLIST
+PLIST_SRC?=            ${PKGDIR}/PLIST
+
+
+# Set PKG_INSTALL_FILE to be the name of any INSTALL file
+.if !defined(PKG_INSTALL_FILE) && exists(${PKGDIR}/INSTALL)
+PKG_INSTALL_FILE=              ${PKGDIR}/INSTALL
+.endif
+
+# Set PKG_DEINSTALL_FILE to be the name of any DEINSTALL file
+.if !defined(PKG_DEINSTALL_FILE) && exists(${PKGDIR}/DEINSTALL)
+PKG_DEINSTALL_FILE=            ${PKGDIR}/DEINSTALL
+.endif
+
+# Set MESSAGE_FILE to be the name of any MESSAGE file
+.if !defined(MESSAGE_FILE) && exists(${PKGDIR}/MESSAGE)
+MESSAGE_FILE=          ${PKGDIR}/MESSAGE
+.endif
+
+AWK?=          /usr/bin/awk
+CAT?=          /bin/cat
+CP?=           /bin/cp
+DC?=           /usr/bin/dc
+ECHO?=         echo                            # Shell builtin
+FALSE?=                false                           # Shell builtin
+FIND?=         /usr/bin/find
+GREP?=         /usr/bin/grep
+IDENT?=                /usr/bin/ident
+LN?=           /bin/ln
+LS?=           /bin/ls
+MKDIR?=                /bin/mkdir -p
+MV?=           /bin/mv
+PKG_TOOLS_BIN?= /usr/sbin
+RM?=           /bin/rm
+SED?=          /usr/bin/sed
+SETENV?=       /usr/bin/env
+SH?=           /bin/sh
+TEST?=         test                            # Shell builtin
+TOUCH?=                /usr/bin/touch
+TRUE?=         true                            # Shell builtin
+
+PKG_ADD?=      PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_add
+PKG_ADMIN?=    PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_admin
+PKG_CREATE?=   PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_create
+PKG_DELETE?=   PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_delete
+PKG_INFO?=     PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_info
+
+.if !defined(PKGTOOLS_VERSION)
+.if !exists(${IDENT})
+PKGTOOLS_VERSION=${PKGTOOLS_REQD}
+.else
+PKGTOOLS_VERSION!=${IDENT} ${PKG_TOOLS_BIN}/pkg_add ${PKG_TOOLS_BIN}/pkg_admin ${PKG_TOOLS_BIN}/pkg_create ${PKG_TOOLS_BIN}/pkg_delete ${PKG_TOOLS_BIN}/pkg_info | ${AWK} 'BEGIN {n = 0;}; $$1 ~ 
/\$$NetBSD/ && $$2 !~ /^crt0/ {gsub("/", "", $$4); if ($$4 > n) {n = $$4;}}; END {print n;}'
+.endif
+.endif
+MAKEFLAGS+=    PKGTOOLS_VERSION="${PKGTOOLS_VERSION}"
+
+# Latest version of pkgtools required for this file.
+PKGTOOLS_REQD=         20000202
+
+# Check that we're using up-to-date pkg_* tools with this file.
+uptodate-pkgtools:
+       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
+       if [ ${PKGTOOLS_VERSION} -lt ${PKGTOOLS_REQD} ]; then           \
+               case ${PKGNAME} in                                      \
+               pkg_install-*)                                          \
+                       ;;                                              \
+               *)                                                      \
+                       ${ECHO} "Your package tools need to be updated to ${PKGTOOLS_REQD:C|(....)(..)(..)|\1/\2/\3|} versions."; \
+                       ${ECHO} "The installed package tools were last updated on ${PKGTOOLS_VERSION:C|(....)(..)(..)|\1/\2/\3|}."; \
+                       ${FALSE} ;;                                     \
+               esac                                                    \
+       fi
+
+# Files to create for versioning and build information
+BUILD_VERSION_FILE=    ${WRKDIR}/.build_version
+BUILD_INFO_FILE=       ${WRKDIR}/.build_info
+
+# Files containing size of pkg w/o and w/ all required pkgs
+SIZE_PKG_FILE=         ${WRKDIR}/.SizePkg
+SIZE_ALL_FILE=         ${WRKDIR}/.SizeAll
+
+.ifndef PKG_ARGS_COMMON
+PKG_ARGS_COMMON=       -v -c ${COMMENT} -d ${DESCR} -f ${PLIST} -l
+PKG_ARGS_COMMON+=      -b ${BUILD_VERSION_FILE} -B ${BUILD_INFO_FILE}
+PKG_ARGS_COMMON+=      -s ${SIZE_PKG_FILE} -S ${SIZE_ALL_FILE}
+PKG_ARGS_COMMON+=      -P "`${MAKE} ${MAKEFLAGS} run-depends-list PACKAGE_DEPENDS_QUICK=true|sort -u`"
+.ifdef CONFLICTS
+PKG_ARGS_COMMON+=      -C "${CONFLICTS}"
+.endif
+.ifdef PKG_INSTALL_FILE
+PKG_ARGS_COMMON+=      -i ${PKG_INSTALL_FILE}
+.endif
+.ifdef PKG_DEINSTALL_FILE
+PKG_ARGS_COMMON+=      -k ${PKG_DEINSTALL_FILE}
+.endif
+.ifdef MESSAGE_FILE
+PKG_ARGS_COMMON+=      -D ${MESSAGE_FILE}
+.endif
+
+PKG_ARGS_INSTALL=      -p ${PREFIX} ${PKG_ARGS_COMMON}
+PKG_ARGS_BINPKG=       -p ${PREFIX:C/^${DESTDIR}//} -L ${PREFIX} ${PKG_ARGS_COMMON}
+.endif # !PKG_ARGS_COMMON
+
+PKG_SUFX?=             .tgz
+#PKG_SUFX?=            .tbz            # bzip2(1) pkgs
+# where pkg_add records its dirty deeds.
+PKG_DBDIR?=            ${DESTDIR}/var/db/syspkg
+
+# Define SMART_MESSAGES in /etc/mk.conf for messages giving the tree
+# of depencies for building, and the current target.
+.ifdef SMART_MESSAGES
+_PKGSRC_IN?=           ===> ${.TARGET} [${PKGNAME}${_PKGSRC_DEPS}] ===
+.else
+_PKGSRC_IN?=           ===
+.endif
+
+# Used to print all the '===>' style prompts - override this to turn them off.
+ECHO_MSG?=             ${ECHO}
+
+# How to do nothing.  Override if you, for some strange reason, would rather
+# do something.
+DO_NADA?=              ${TRUE}
+
+.if !defined(PKGBASE) || !defined(SETNAME)
+.BEGIN:
+       @${ECHO_MSG} "PKGBASE and SETNAME are mandatory."
+       @${FALSE}
+.endif
+
+PKGREPOSITORY?=                ${PACKAGES}
+PKGFILE?=              ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
+
+.MAIN: all
+
+# Add these defs to the ones dumped into +BUILD_DEFS
+BUILD_DEFS+=   OPSYS OS_VERSION MACHINE_ARCH OBJECT_FMT
+
+.if !target(all)
+# We don't build here
+all:
+.endif
+
+################################################################
+# More standard targets start here.
+#
+# These are the body of the build/install framework.  If you are
+# not happy with the default actions, and you can't solve it by
+# adding pre-* or post-* targets/scripts, override these.
+################################################################
+
+.if !target(show-downlevel)
+show-downlevel:
+       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
+       found="`${PKG_INFO} -e \"${PKGBASE}<${PKGVERSION}\" || ${TRUE}`";\
+       if [ "X$$found" != "X" -a "X$$found" != "X${PKGNAME}" ]; then   \
+               ${ECHO} "${PKGBASE} package: $$found installed, pkgsrc version ${PKGNAME}"; \
+       fi
+.endif
+
+# Package
+
+.if !target(do-package)
+do-package: ${PLIST}
+       ${_PKG_SILENT}${_PKG_DEBUG}\
+       ${ECHO_MSG} "${_PKGSRC_IN}> Building binary package for ${PKGNAME}"; \
+       if [ ! -d ${PKGREPOSITORY} ]; then                      \
+               ${MKDIR} ${PKGREPOSITORY};                      \
+               if [ $$? -ne 0 ]; then                          \
+                       ${ECHO_MSG} "=> Can't create directory ${PKGREPOSITORY}."; \
+                       exit 1;                                 \
+               fi;                                             \
+       fi;                                                     \
+       if ${PKG_CREATE} ${PKG_ARGS_BINPKG} ${PKGFILE}; then            \
+               (cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} package-links);          \
+       else                                                    \
+               (cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} delete-package);         \
+               exit 1;                                         \
+       fi
+.endif
+
+# Some support rules for do-package
+
+.if !target(package-links)
+package-links:
+       ${_PKG_SILENT}${_PKG_DEBUG}(cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} delete-package-links)
+       ${_PKG_SILENT}${_PKG_DEBUG}for cat in ${CATEGORIES}; do         \
+               if [ ! -d ${PACKAGES}/$$cat ]; then                     \
+                       ${MKDIR} ${PACKAGES}/$$cat;                     \
+                       if [ $$? -ne 0 ]; then                          \
+                               ${ECHO_MSG} "=> Can't create directory ${PACKAGES}/$$cat."; \
+                               exit 1;                                 \
+                       fi;                                             \
+               fi;                                                     \
+               ${RM} -f ${PACKAGES}/$$cat/${PKGNAME}${PKG_SUFX};       \
+               ${LN} -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \
+       done;
+.endif
+
+.if !target(delete-package-links)
+delete-package-links:
+       ${_PKG_SILENT}${_PKG_DEBUG}\
+       ${FIND} ${PACKAGES} -type l -name ${PKGNAME}${PKG_SUFX} | xargs ${RM} -f
+.endif
+
+.if !target(delete-package)
+delete-package:
+       ${_PKG_SILENT}${_PKG_DEBUG}(cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} delete-package-links)
+       ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${PKGFILE}
+.endif
+
+################################################################
+# This is the "generic" package target, actually a macro used from the
+# six main targets.  See below for more.
+################################################################
+
+real-package:
+       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKEFLAGS} ${.TARGET:S/^real-/pre-/}
+       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKEFLAGS} ${.TARGET:S/^real-/do-/}



Home | Main Index | Thread Index | Old Index