Annual simplification drive:

1. DISTFILE is gone and replaced by DISTFILES, which can contain one or
   more file specifications.
2. MASTER_SITE created, which points to the distfiles directory on
   freebsd.cdrom.com (which I'll set up in a moment).
3. HOME_LOCATION is now simply a hint, and is never directly used except
   to inform the user when ncftp unable to transfer a file from
   MASTER_SITE.
4. ncftp is now assumed to live somewhere in the path, in preparation for
   Andrew bringing it in on a more permanant basis.
5. XMKMF defined - it was not before.

Thanks to Andrew (ache) for many helpful suggestions.
This commit is contained in:
Jordan K. Hubbard 1994-09-10 22:26:47 +00:00
parent c9fd22b07e
commit 43497b9f75
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2651

View File

@ -1,74 +1,75 @@
# bsd.port.mk - 940820 Jordan K. Hubbard.
# This file is in the public domain.
#
# $Id: bsd.port.mk,v 1.28 1994/09/09 00:17:47 jkh Exp $
# $Id: bsd.port.mk,v 1.29 1994/09/09 06:21:43 jkh Exp $
#
# Please view me with 4 column tabs!
# Supported Variables and their behaviors:
#
# Variables that typically apply to all ports:
#
# PORTSDIR - The root of the ports tree (default: /usr/ports).
# DISTDIR - Where to get gzip'd, tarballed copies of original sources
# - (default: ${PORTSDIR}/distfiles).
# PACKAGES - A top level directory where all packages go (rather than
# - going locally to each port). (default: ${PORTSDIR}/packages).
# GMAKE - Set to path of GNU make if not in $PATH (default: gmake).
# XMKMF - Set to path of `xmkmf' if not in $PATH (default: xmkmf).
# PORTSDIR - The root of the ports tree (default: /usr/ports).
# DISTDIR - Where to get gzip'd, tarballed copies of original sources
# (default: ${PORTSDIR}/distfiles).
# MASTER_SITE - Primary location for distribution files if not found
# locally.
# PACKAGES - A top level directory where all packages go (rather than
# going locally to each port). (default: ${PORTSDIR}/packages).
# GMAKE - Set to path of GNU make if not in $PATH (default: gmake).
# XMKMF - Set to path of `xmkmf' if not in $PATH (default: xmkmf).
#
# Variables that typically apply to an individual port:
#
# WRKDIR - A temporary working directory that gets *clobbered* on clean.
# WRKSRC - A subdirectory of ${WRKDIR} where the distribution actually
# unpacks to. (Default: ${WRKDIR}/${DISTNAME} unless
# NO_WRKSUBDIR is set, in which case simply ${WRKDIR}).
# DISTNAME - Name of port or distribution.
# DISTFILE - Name of archive file containing distribution
# (default: ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}).
# PATCHDIR - A directory containing any required patches.
# WRKDIR - A temporary working directory that gets *clobbered* on clean.
# WRKSRC - A subdirectory of ${WRKDIR} where the distribution actually
# unpacks to. (Default: ${WRKDIR}/${DISTNAME} unless
# NO_WRKSUBDIR is set, in which case simply ${WRKDIR}).
# DISTNAME - Name of port or distribution.
# DISTFILES - Name(s) of archive file(s) containing distribution
# (default: ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}).
# PATCHDIR - A directory containing any required patches.
# SCRIPTDIR - A directory containing any auxilliary scripts.
# FILESDIR - A directory containing any miscellaneous additional files.
# PKGDIR - A direction containing any package creation files.
# FILESDIR - A directory containing any miscellaneous additional files.
# PKGDIR - A direction containing any package creation files.
#
# NO_EXTRACT - Use a dummy (do-nothing) extract target.
# NO_CONFIGURE - Use a dummy (do-nothing) configure target.
# NO_BUILD - Use a dummy (do-nothing) build target.
# NO_BUILD - Use a dummy (do-nothing) build target.
# NO_PACKAGE - Use a dummy (do-nothing) package target.
# NO_INSTALL - Use a dummy (do-nothing) install target.
# NO_WRKSUBDIR - Assume port unpacks directly into ${WRKDIR}.
# USE_GMAKE - Says that the port uses gmake.
# USE_IMAKE - Says that the port uses imake.
# USE_GMAKE - Says that the port uses gmake.
# USE_IMAKE - Says that the port uses imake.
# HAS_CONFIGURE - Says that the port has its own configure script.
# CONFIGURE_ARGS - Pass these args to configure, if $HAS_CONFIGURE.
# HOME_LOCATION - site/path name (or user's email address) describing
# where this port came from or can be obtained if the
# tarball is missing.
# DEPENDS - A list of other ports this package depends on being
# made first, relative to ${PORTSDIR} (e.g. x11/tk, lang/tcl,
# etc).
# where this port came from or can be obtained if the
# tarball is missing and there is no MASTER_SITE.
# DEPENDS - A list of other ports this package depends on being
# made first, relative to ${PORTSDIR} (e.g. x11/tk, lang/tcl,
# etc).
# EXTRACT_CMD - Command for extracting archive (default: tar).
# EXTRACT_SUFX - Suffix for archive names (default: .tar.gz).
# EXTRACT_ARGS - Arguments to ${EXTRACT_CMD} (default: -C ${WRKDIR} -xzf).
#
# NCFTP - Full path to ncftp command if not in $PATH (default: ncftp).
# NCFTP - Full path to ncftp command if not in $PATH (default: ncftp).
# NCFTP_ARGS - Arguments to ${NCFTP} (default: -N).
#
#
# Default targets and their behaviors:
#
# fetch - Retrieves ${DISTNAME}/${DISTNAME}${EXTRACT_SUFX} as and if
# necessary.
# extract - Unpacks ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX} into ${WRKDIR}.
# configure - Applys patches, if any, and runs either GNU configure, one
# or more local configure scripts or nothing, depending on
# what's available.
# build - Actually compile the sources.
# install - Install the results of a build.
# package - Create a package from a build.
# fetch - Retrieves ${DISTFILES} into ${DISTDIR} as necessary.
# extract - Unpacks ${DISTFILES} into ${WRKDIR}.
# configure - Applies patches, if any, and runs either GNU configure, one
# or more local configure scripts or nothing, depending on
# what's available.
# build - Actually compile the sources.
# install - Install the results of a build.
# package - Create a package from a build.
#
# Default sequence for "all" is: fetch extract configure build
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
@ -76,20 +77,20 @@
# These need to be absolute since we don't know how deep in the ports
# tree we are and thus can't go relative. They can, of course, be overridden
# by individual Makefiles.
PORTSDIR?= /usr/ports
DISTDIR?= ${PORTSDIR}/distfiles
PACKAGES?= ${PORTSDIR}/packages
WRKDIR?= ${.CURDIR}/work
PORTSDIR?= /usr/ports
DISTDIR?= ${PORTSDIR}/distfiles
PACKAGES?= ${PORTSDIR}/packages
HOME
WRKDIR?= ${.CURDIR}/work
.if defined(NO_WRKSUBDIR)
WRKSRC?= ${WRKDIR}
WRKSRC?= ${WRKDIR}
.else
WRKSRC?= ${WRKDIR}/${DISTNAME}
WRKSRC?= ${WRKDIR}/${DISTNAME}
.endif
PATCHDIR?= ${.CURDIR}/patches
SCRIPTDIR?= ${.CURDIR}/scripts
FILESDIR?= ${.CURDIR}/files
PKGDIR?= ${.CURDIR}/pkg
PATCHDIR?= ${.CURDIR}/patches
SCRIPTDIR?= ${.CURDIR}/scripts
FILESDIR?= ${.CURDIR}/files
PKGDIR?= ${.CURDIR}/pkg
# Change these if you'd prefer to keep the cookies someplace else.
EXTRACT_COOKIE?= ${.CURDIR}/.extract_done
@ -100,26 +101,32 @@ CONFIGURE_COOKIE?= ${.CURDIR}/.configure_done
DO_NADA?= echo -n
# Miscellaneous overridable commands:
GMAKE?= gmake
XMKMF?= xmkmf
GMAKE?= gmake
XMKMF?= xmkmf
NCFTP?= ncftp
NCFTP?= ncftp
NCFTPFLAGS?= -N
EXTRACT_CMD?= tar
EXTRACT_SUFX?= .tar.gz
EXTRACT_ARGS?= -C ${WRKDIR} -xzf
PKG_CMD?= pkg_create
PKG_ARGS?= -v -c ${PKGDIR}/COMMENT -d ${PKGDIR}/DESCR -f ${PKGDIR}/PLIST
PKG_SUFX?= .tgz
PKG_CMD?= pkg_create
PKG_ARGS?= -v -c ${PKGDIR}/COMMENT -d ${PKGDIR}/DESCR -f ${PKGDIR}/PLIST
PKG_SUFX?= .tgz
# Set no default value for this so we can easily detect its absence.
#HOME_LOCATION?= <original site unknown>
# I guess we're in the master distribution business! :)
MASTER_SITE?= ftp://freebsd.cdrom.com/pub/FreeBSD/FreeBSD-current/ports/distfiles
HOME_LOCATION?= <original site unknown>
# Derived names so that they're easily overridable.
DISTFILE?= ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}
PKGFILE?= ${PACKAGES}/${DISTNAME}${PKG_SUFX}
DISTFILES?= ${DISTNAME}${EXTRACT_SUFX}
.if exists(${PACKAGES})
PKGFILE?= ${PACKAGES}/${DISTNAME}${PKG_SUFX}
.else
PKGFILE?= ${DISTNAME}${PKG_SUFX}
.endif
.MAIN: all
all: extract configure build
@ -179,13 +186,8 @@ package: pre-package
# install, require or deinstall scripts. Override the arguments with
# PKG_ARGS if your package is anything but run-of-the-mill.
@if [ -d ${PKGDIR} ]; then \
if [ -d ${PACKAGES} ]; then \
echo "===> Building package for ${DISTNAME} in ${PACKAGES}"; \
${PKG_CMD} ${PKG_ARGS} ${PACKAGES}/${DISTNAME}${PKG_SUFX}; \
else \
echo "===> Building package for ${DISTNAME} in ${.CURDIR}"; \
${PKG_CMD} ${PKG_ARGS} ${DISTNAME}${PKG_SUFX}; \
fi; \
echo "===> Building package for ${DISTNAME}"; \
${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; \
fi
.endif
@ -200,12 +202,12 @@ build: configure pre-build
.if defined(DEPENDS)
@echo "===> ${DISTNAME} depends on: ${DEPENDS}"
@for i in $(DEPENDS); do \
echo "===> Verifying build for $$i"; \
if [ ! -d ${PORTSDIR}/$$i ]; then \
echo ">> No directory for ${PORTSDIR}/$$i. Skipping.."; \
else \
(cd ${PORTSDIR}/$$i; ${MAKE}) ; \
fi \
echo "===> Verifying build for $$i"; \
if [ ! -d ${PORTSDIR}/$$i ]; then \
echo ">> No directory for ${PORTSDIR}/$$i. Skipping.."; \
else \
(cd ${PORTSDIR}/$$i; ${MAKE}) ; \
fi \
done
@echo "===> Returning to build of ${DISTNAME}"
.endif
@ -215,7 +217,7 @@ build: configure pre-build
@(cd ${WRKSRC}; ${MAKE} all)
.endif
@if [ -f ${SCRIPTDIR}/post-build ]; then \
sh ${SCRIPTDIR}/post-build ${PORTSDIR} ${.CURDIR} ${WRKSRC}; \
sh ${SCRIPTDIR}/post-build ${PORTSDIR} ${.CURDIR} ${WRKSRC}; \
fi
.endif
@ -233,20 +235,20 @@ configure: pre-configure extract ${CONFIGURE_COOKIE}
${CONFIGURE_COOKIE}:
@echo "===> Configuring for ${DISTNAME}"
@if [ -d ${PATCHDIR} ]; then \
echo "===> Applying patches for ${DISTNAME}" ; \
for i in ${PATCHDIR}/patch-*; do \
patch -d ${WRKSRC} --quiet -E -p0 < $$i; \
done; \
echo "===> Applying patches for ${DISTNAME}" ; \
for i in ${PATCHDIR}/patch-*; do \
patch -d ${WRKSRC} --quiet -E -p0 < $$i; \
done; \
fi
# We have a small convention for our local configure scripts, which
# is that ${PORTSDIR}, ${.CURDIR} and ${WRKSRC} get passed as
# command-line arguments since all other methods are a little
# problematic.
@if [ -f ${SCRIPTDIR}/pre-configure ]; then \
sh ${SCRIPTDIR}/pre-configure ${PORTSDIR} ${.CURDIR} ${WRKSRC}; \
sh ${SCRIPTDIR}/pre-configure ${PORTSDIR} ${.CURDIR} ${WRKSRC}; \
fi
@if [ -f ${SCRIPTDIR}/configure ]; then \
sh ${SCRIPTDIR}/configure ${PORTSDIR} ${.CURDIR} ${WRKSRC}; \
sh ${SCRIPTDIR}/configure ${PORTSDIR} ${.CURDIR} ${WRKSRC}; \
fi
.if defined(HAS_CONFIGURE)
@(cd ${WRKSRC}; ./configure ${CONFIGURE_ARGS})
@ -255,7 +257,7 @@ ${CONFIGURE_COOKIE}:
@(cd ${WRKSRC}; ${XMKMF} && make Makefiles)
.endif
@if [ -f ${SCRIPTDIR}/post-configure ]; then \
sh ${SCRIPTDIR}/post-configure ${PORTSDIR} ${.CURDIR} ${WRKSRC}; \
sh ${SCRIPTDIR}/post-configure ${PORTSDIR} ${.CURDIR} ${WRKSRC}; \
fi
@touch -f ${CONFIGURE_COOKIE}
.endif
@ -267,39 +269,20 @@ pre-fetch:
.if !target(fetch)
fetch: pre-fetch
.if defined(HOME_LOCATION)
@if [ ! -f ${DISTFILE} ]; then \
echo ">> Sorry, I can't seem to find: ${DISTFILE}"; \
echo ">> on this system."; \
if [ -f ${NCFTP} ]; then \
echo ">> Attempting to fetch ${HOME_LOCATION}."; \
if [ ! -d `dirname ${DISTFILE}` ]; then \
mkdir -p `dirname ${DISTFILE}`; \
fi; \
if cd `dirname ${DISTFILE}`; then \
if ${NCFTP} ${NCFTPFLAGS} ${HOME_LOCATION}; then \
@for file in ${DISTFILES}; do \
if [ -f ${DISTDIR}/$$file ]; then \
echo ">> $$file doesn't seem to exist on this system."; \
echo ">> Attempting to fetch it from master site."; \
if [ ! -d ${DISTDIR} ]; then mkdir -p ${DISTDIR}; fi \
cd ${DISTDIR}; \
if ${NCFTP} ${NCFTPFLAGS} ${MASTER_SITE}/$$file; then \
${EXTRACT_CMD} ${EXTRACT_ARGS} ${DISTFILE}; \
else \
echo ">> Couldn't fetch it - please retreive ${DISTFILE} manually and try again."; \
echo ">> Couldn't fetch it - please retreive $$file manually from ${HOME_LOCATION} and try again."; \
exit 1; \
fi \
else \
echo ">> Couldn't cd to `dirname ${DISTFILE}`. Please correct and try again."; \
exit 1; \
fi \
else \
echo ">> Please fetch it from ${HOME_LOCATION} and try again.";\
echo ">> Installing ${NCFTP} can also make this easier in the future."; \
exit 1; \
fi; \
fi \
fi
.else
@if [ ! -f ${DISTFILE} ]; then \
echo ">> Sorry, I can't seem to find: ${DISTFILE}"; \
echo ">> on this system and the original site is unknown."; \
exit 1; \
fi
.endif
done
.endif
.if !target(pre-extract)
@ -318,7 +301,9 @@ ${EXTRACT_COOKIE}:
@echo "===> Extracting for ${DISTNAME}"
@rm -rf ${WRKDIR}
@mkdir -p ${WRKDIR}
@${EXTRACT_CMD} ${EXTRACT_ARGS} ${DISTFILE}
@for file in ${DISTFILES}; do \
@${EXTRACT_CMD} ${EXTRACT_ARGS} ${DISTDIR}/$$file ; \
done
@touch -f ${EXTRACT_COOKIE}
.endif