bsd.port.mk revision 8368
1155131Srwatson#-*- mode: Fundamental; tab-width: 4; -*- 2155131Srwatson# 3155131Srwatson# bsd.port.mk - 940820 Jordan K. Hubbard. 4155131Srwatson# This file is in the public domain. 5155131Srwatson# 6155131Srwatson# $Id: bsd.port.mk,v 1.155 1995/05/04 18:53:26 adam Exp $ 7155131Srwatson# 8155131Srwatson# Please view me with 4 column tabs! 9155131Srwatson 10155131Srwatson 11155131Srwatson# Supported Variables and their behaviors: 12155131Srwatson# 13155131Srwatson# Variables that typically apply to all ports: 14155131Srwatson# 15155131Srwatson# PORTSDIR - The root of the ports tree (default: /usr/ports). 16155131Srwatson# DISTDIR - Where to get gzip'd, tarballed copies of original sources 17155131Srwatson# (default: ${PORTSDIR}/distfiles). 18155131Srwatson# PREFIX - Where to install things in general (default: /usr/local). 19155131Srwatson# MASTER_SITES - Primary location(s) for distribution files if not found 20155131Srwatson# locally (default: 21155131Srwatson# ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles) 22155131Srwatson# PATCH_SITES - Primary location(s) for distributed patch files 23155131Srwatson# (see PATCHFILES below) if not found locally (default: 24155131Srwatson# ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles) 25155131Srwatson# 26155131Srwatson# MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this 27155131Srwatson# value. 28155131Srwatson# MASTER_SITE_FREEBSD - If set, only use the FreeBSD master repository for 29155131Srwatson# MASTER_SITES. 30155131Srwatson# PACKAGES - A top level directory where all packages go (rather than 31155131Srwatson# going locally to each port). (default: ${PORTSDIR}/packages). 32155131Srwatson# GMAKE - Set to path of GNU make if not in $PATH (default: gmake). 33155131Srwatson# XMKMF - Set to path of `xmkmf' if not in $PATH (default: xmkmf -a ). 34155131Srwatson# MAINTAINER - The e-mail address of the contact person for this port 35155131Srwatson# (default: ports@FreeBSD.ORG). 36155131Srwatson# CATEGORIES - A list of descriptive categories into which this port falls 37155131Srwatson# (default: orphans). 38155131Srwatson# KEYWORDS - A list of descriptive keywords that might index well for this 39155131Srwatson# port (default: orphans). 40155131Srwatson# 41155131Srwatson# Variables that typically apply to an individual port. Non-Boolean 42155131Srwatson# variables without defaults are *mandatory*. 43155131Srwatson# 44155131Srwatson# 45155131Srwatson# WRKDIR - A temporary working directory that gets *clobbered* on clean 46155131Srwatson# (default: ${.CURDIR}/work). 47155131Srwatson# WRKSRC - A subdirectory of ${WRKDIR} where the distribution actually 48155131Srwatson# unpacks to. (Default: ${WRKDIR}/${DISTNAME} unless 49155131Srwatson# NO_WRKSUBDIR is set, in which case simply ${WRKDIR}). 50155131Srwatson# DISTNAME - Name of port or distribution. 51155131Srwatson# DISTFILES - Name(s) of archive file(s) containing distribution 52155131Srwatson# (default: ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}). 53155131Srwatson# PATCHFILES - Name(s) of additional files that contain distributed 54155131Srwatson# patches (default: none). make will look for them at 55155131Srwatson# PATCH_SITES (see above). They will automatically be 56155131Srwatson# uncompressed before patching if the names end with 57155131Srwatson# ".gz" or ".Z". 58155131Srwatson# PATCH_PRFX - Filename prefix for distribution patches (default: none) 59155131Srwatson# typically ${DISTNAME}/ or foo- 60155131Srwatson# PKGNAME - Name of the package file to create if the DISTNAME 61155131Srwatson# isn't really relevant for the port/package 62155131Srwatson# (default: ${DISTNAME}). 63155131Srwatson# EXTRACT_ONLY - If defined, a subset of ${DISTFILES} you want to 64155131Srwatson# actually extract. 65155131Srwatson# PATCHDIR - A directory containing any additional patches you made 66155131Srwatson# to port this software to FreeBSD (default: 67155131Srwatson# ${.CURDIR}/patches) 68155131Srwatson# SCRIPTDIR - A directory containing any auxiliary scripts 69155131Srwatson# (default: ${.CURDIR}/scripts) 70155131Srwatson# FILESDIR - A directory containing any miscellaneous additional files. 71155131Srwatson# (default: ${.CURDIR}/files) 72155131Srwatson# PKGDIR - A direction containing any package creation files. 73155131Srwatson# (default: ${.CURDIR}/pkg) 74155131Srwatson# PKG_DBDIR - Where package installation is recorded (default: /var/db/pkg) 75155131Srwatson# 76155131Srwatson# NO_EXTRACT - Use a dummy (do-nothing) extract target. 77155131Srwatson# NO_CONFIGURE - Use a dummy (do-nothing) configure target. 78155131Srwatson# NO_BUILD - Use a dummy (do-nothing) build target. 79155131Srwatson# NO_PACKAGE - Use a dummy (do-nothing) package target. 80155131Srwatson# NO_INSTALL - Use a dummy (do-nothing) install target. 81155131Srwatson# NO_WRKSUBDIR - Assume port unpacks directly into ${WRKDIR}. 82155131Srwatson# NO_WRKDIR - There's no work directory at all; port does this someplace 83155131Srwatson# else. 84155131Srwatson# NO_DEPENDS - Don't verify build of dependencies. 85155131Srwatson# USE_GMAKE - Says that the port uses gmake. 86155131Srwatson# USE_IMAKE - Says that the port uses imake. 87155131Srwatson# USE_X11 - Says that the port uses X11. 88155131Srwatson# NO_INSTALL_MANPAGES - For imake ports that don't like the install.man 89155131Srwatson# target. 90155131Srwatson# HAS_CONFIGURE - Says that the port has its own configure script. 91155131Srwatson# GNU_CONFIGURE - Set if you are using GNU configure (optional). 92155131Srwatson# CONFIGURE_SCRIPT - Name of configure script, defaults to 'configure'. 93155131Srwatson# CONFIGURE_ARGS - Pass these args to configure, if ${HAS_CONFIGURE} set. 94155131Srwatson# IS_INTERACTIVE - Set this if your port needs to interact with the user 95155131Srwatson# during a build. User can then decide to skip this port by 96155131Srwatson# setting ${BATCH}, or compiling only the interactive ports 97155131Srwatson# by setting ${INTERACTIVE}. 98155131Srwatson# EXEC_DEPENDS - A list of "prog:dir" pairs of other ports this 99155131Srwatson# package depends on. "prog" is the name of an 100155131Srwatson# executable. make will search your $PATH for it and go 101155131Srwatson# into "dir" to do a "make all install" if it's not found. 102155131Srwatson# LIB_DEPENDS - A list of "lib:dir" pairs of other ports this package 103155131Srwatson# depends on. "lib" is the name of a shared library. 104155131Srwatson# make will use "ldconfig -r" to search for the 105155131Srwatson# library. Note that lib can be any regular expression, 106155131Srwatson# and you need two backslashes in front of dots (.) to 107155131Srwatson# supress its special meaning (e.g., use 108155131Srwatson# "foo\\.2\\.:${PORTSDIR}/utils/foo" to match "libfoo.2.*"). 109155131Srwatson# DEPENDS - A list of other ports this package depends on being 110155131Srwatson# made first. Use this for things that don't fall into 111155131Srwatson# the above two categories. 112155131Srwatson# EXTRACT_CMD - Command for extracting archive (default: tar). 113155131Srwatson# EXTRACT_SUFX - Suffix for archive names (default: .tar.gz). 114155131Srwatson# EXTRACT_BEFORE_ARGS - 115155131Srwatson# Arguments to ${EXTRACT_CMD} before filename 116155131Srwatson# (default: -C ${WRKDIR} -xzf). 117155131Srwatson# EXTRACT_AFTER_ARGS - 118155131Srwatson# Arguments to ${EXTRACT_CMD} following filename 119155131Srwatson# (default: none). 120155131Srwatson# 121155131Srwatson# NCFTP - Full path to ncftp command if not in $PATH (default: ncftp). 122155131Srwatson# NCFTPFLAGS - Arguments to ${NCFTP} (default: -N). 123155131Srwatson# 124155131Srwatson# 125155131Srwatson# Default targets and their behaviors: 126155131Srwatson# 127155131Srwatson# fetch - Retrieves ${DISTFILES} (and ${PATCHFILES} if defined) 128155131Srwatson# into ${DISTDIR} as necessary. 129155131Srwatson# fetch-list - Show list of files that would be retrieved by fetch 130155131Srwatson# extract - Unpacks ${DISTFILES} into ${WRKDIR}. 131155131Srwatson# patch - Apply any provided patches to the source. 132155131Srwatson# configure - Runs either GNU configure, one or more local configure 133155131Srwatson# scripts or nothing, depending on what's available. 134155131Srwatson# build - Actually compile the sources. 135155131Srwatson# install - Install the results of a build. 136155131Srwatson# reinstall - Install the results of a build, ignoring "already installed" 137155131Srwatson# flag. 138155131Srwatson# package - Create a package from an _installed_ port. 139155131Srwatson# describe - Try to generate a one-line description for each port for 140155131Srwatson# use in INDEX files and the like. 141155131Srwatson# checksum - Use files/md5 to ensure that your distfiles are valid 142155131Srwatson# makesum - Generate files/md5 (only do this for your own ports!) 143155131Srwatson# 144155131Srwatson# Default sequence for "all" is: fetch checksum extract patch configure build 145155131Srwatson# 146155131Srwatson# Please read the comments in the targets section below, you 147155131Srwatson# should be able to use the pre-* or post-* targets/scripts 148155131Srwatson# (which are available for every stage except checksum) or 149155131Srwatson# override the do-* targets to do pretty much anything you want. 150155131Srwatson# 151155131Srwatson# NEVER override the "regular" targets unless you want to open 152155131Srwatson# a major can of worms. 153155131Srwatson 154155131Srwatson.if exists(${.CURDIR}/../Makefile.inc) 155155131Srwatson.include "${.CURDIR}/../Makefile.inc" 156155131Srwatson.endif 157155131Srwatson 158155131Srwatson# These need to be absolute since we don't know how deep in the ports 159155131Srwatson# tree we are and thus can't go relative. They can, of course, be overridden 160155131Srwatson# by individual Makefiles. 161155131SrwatsonPORTSDIR?= ${DESTDIR}/usr/ports 162155131SrwatsonX11BASE?= /usr/X11R6 163155131SrwatsonDISTDIR?= ${PORTSDIR}/distfiles 164155131SrwatsonPACKAGES?= ${PORTSDIR}/packages 165155131Srwatson.if !defined(NO_WRKDIR) 166155131SrwatsonWRKDIR?= ${.CURDIR}/work 167155131Srwatson.else 168155131SrwatsonWRKDIR?= ${.CURDIR} 169155131Srwatson.endif 170155131Srwatson.if defined(NO_WRKSUBDIR) 171155131SrwatsonWRKSRC?= ${WRKDIR} 172155131Srwatson.else 173155131SrwatsonWRKSRC?= ${WRKDIR}/${DISTNAME} 174155131Srwatson.endif 175155131SrwatsonPATCHDIR?= ${.CURDIR}/patches 176155131SrwatsonSCRIPTDIR?= ${.CURDIR}/scripts 177155131SrwatsonFILESDIR?= ${.CURDIR}/files 178155131SrwatsonPKGDIR?= ${.CURDIR}/pkg 179155131Srwatson.if defined(USE_IMAKE) || defined(USE_X11) 180155131SrwatsonPREFIX?= ${X11BASE} 181155131Srwatson.else 182155131SrwatsonPREFIX?= /usr/local 183155131Srwatson.endif 184155131Srwatson.if defined(USE_GMAKE) 185155131SrwatsonEXEC_DEPENDS+= gmake:${PORTSDIR}/devel/gmake 186155131Srwatson.endif 187155131Srwatson 188155131Srwatson.if exists(${PORTSDIR}/../Makefile.inc) 189155131Srwatson.include "${PORTSDIR}/../Makefile.inc" 190155131Srwatson.endif 191155131Srwatson 192155131Srwatson# Change these if you'd prefer to keep the cookies someplace else. 193155131SrwatsonEXTRACT_COOKIE?= ${WRKDIR}/.extract_done 194155131SrwatsonCONFIGURE_COOKIE?= ${WRKDIR}/.configure_done 195155131SrwatsonINSTALL_COOKIE?= ${WRKDIR}/.install_done 196155131SrwatsonBUILD_COOKIE?= ${WRKDIR}/.build_done 197155131SrwatsonPATCH_COOKIE?= ${WRKDIR}/.patch_done 198155131SrwatsonPACKAGE_COOKIE?= ${WRKDIR}/.package_done 199155131Srwatson 200155131Srwatson# How to do nothing. Override if you, for some strange reason, would rather 201155131Srwatson# do something. 202155131SrwatsonDO_NADA?= echo -n 203155131Srwatson 204155131Srwatson# Miscellaneous overridable commands: 205155131SrwatsonGMAKE?= gmake 206155131SrwatsonXMKMF?= xmkmf -a 207155131SrwatsonMD5?= /sbin/md5 208155131SrwatsonMD5_FILE?= ${FILESDIR}/md5 209155131SrwatsonMAKE_FLAGS?= -f 210155131SrwatsonMAKEFILE?= Makefile 211155131Srwatson 212155131SrwatsonNCFTP?= ncftp 213155131SrwatsonNCFTPFLAGS?= -N 214155131Srwatson 215155131SrwatsonTOUCH?= touch 216155131SrwatsonTOUCH_FLAGS?= -f 217155131Srwatson 218155131SrwatsonPATCH?= patch 219155131SrwatsonPATCH_STRIP?= -p0 220155131SrwatsonPATCH_DIST_STRIP?= -p0 221155131Srwatson.if defined(PATCH_DEBUG) 222155131SrwatsonPATCH_ARGS?= -d ${WRKSRC} -E ${PATCH_STRIP} 223155131SrwatsonPATCH_DIST_ARGS?= -d ${WRKSRC} -E ${PATCH_DIST_STRIP} 224155131Srwatson.else 225155131SrwatsonPATCH_ARGS?= -d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP} 226155131SrwatsonPATCH_DIST_ARGS?= -d ${WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP} 227155131Srwatson.endif 228155131Srwatson 229155131SrwatsonEXTRACT_CMD?= tar 230155131SrwatsonEXTRACT_SUFX?= .tar.gz 231155131Srwatson# Backwards compatability. 232155131Srwatson.if defined(EXTRACT_ARGS) 233155131SrwatsonEXTRACT_BEFORE_ARGS?= ${EXTRACT_ARGS} 234155131Srwatson.else 235155131SrwatsonEXTRACT_BEFORE_ARGS?= -xzf 236155131Srwatson.endif 237155131Srwatson 238155131Srwatson# Figure out where the local mtree file is 239155131Srwatson.if !defined(MTREE_LOCAL) && exists(/etc/mtree/BSD.local.dist) 240155131SrwatsonMTREE_LOCAL= /etc/mtree/BSD.local.dist 241155131Srwatson.endif 242155131SrwatsonMTREE_CMD?= mtree 243155131SrwatsonMTREE_ARGS?= -U -f ${MTREE_LOCAL} -d -e -p 244155131Srwatson 245155131SrwatsonPKG_CMD?= pkg_create 246155131Srwatson.if !defined(PKG_ARGS) 247155131SrwatsonPKG_ARGS= -v -c ${PKGDIR}/COMMENT -d ${PKGDIR}/DESCR -f ${PKGDIR}/PLIST -p ${PREFIX} -P "`${MAKE} package-depends|sort|uniq`" 248155131Srwatson.if exists(${PKGDIR}/INSTALL) 249155131SrwatsonPKG_ARGS+= -i ${PKGDIR}/INSTALL 250155131Srwatson.endif 251155131Srwatson.if exists(${PKGDIR}/DEINSTALL) 252155131SrwatsonPKG_ARGS+= -k ${PKGDIR}/DEINSTALL 253155131Srwatson.endif 254155131Srwatson.if exists(${PKGDIR}/REQ) 255155131SrwatsonPKG_ARGS+= -r ${PKGDIR}/REQ 256155131Srwatson.endif 257155131Srwatson.if !defined(USE_X11) && !defined(USE_IMAKE) && defined(MTREE_LOCAL) 258155131SrwatsonPKG_ARGS+= -m ${MTREE_LOCAL} 259155131Srwatson.endif 260155131Srwatson.endif 261155131SrwatsonPKG_SUFX?= .tgz 262155131Srwatson# where pkg_add records its dirty deeds. 263155131SrwatsonPKG_DBDIR?= /var/db/pkg 264155131Srwatson 265155131Srwatson# Used to print all the '===>' style prompts - override this to turn them off. 266155131SrwatsonECHO_MSG?= echo 267155131Srwatson 268155131SrwatsonALL_TARGET?= all 269155131SrwatsonINSTALL_TARGET?= install 270155131Srwatson 271155131Srwatson# If the user has this set, go to the FreeBSD respository for everything. 272155131Srwatson.if defined(MASTER_SITE_FREEBSD) 273155131SrwatsonMASTER_SITE_OVERRIDE= ftp://freebsd.cdrom.com/pub/FreeBSD/FreeBSD-current/ports/distfiles/ 274155131Srwatson.endif 275155131Srwatson 276155131Srwatson# I guess we're in the master distribution business! :) As we gain mirror 277155131Srwatson# sites for distfiles, add them to this list. 278155131Srwatson.if !defined(MASTER_SITE_OVERRIDE) 279155131SrwatsonMASTER_SITES+= ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports/distfiles/ 280155131SrwatsonPATCH_SITES+= ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports/distfiles/${PATCH_PRFX} 281155131Srwatson.else 282155131SrwatsonMASTER_SITES= ${MASTER_SITE_OVERRIDE} 283155131SrwatsonPATCH_SITES= ${MASTER_SITE_OVERRIDE}${PATCH_PRFX} 284155131Srwatson.endif 285155131Srwatson 286155131Srwatson.if defined(PATCH_PRFX) 287155131SrwatsonPATCHDIST!= echo ${PATCH_PRFX} | sed 's|^\(.*\)/$$|/\1|' 288155131SrwatsonPATCHDIST:= ${DISTDIR}${PATCHDIST} 289155131Srwatson.else 290155131SrwatsonPATCHDIST:= ${DISTDIR} 291155131Srwatson.endif 292155131Srwatson 293155131Srwatson# Derived names so that they're easily overridable. 294155131SrwatsonDISTFILES?= ${DISTNAME}${EXTRACT_SUFX} 295155131SrwatsonPKGNAME?= ${DISTNAME} 296155131Srwatson 297155131Srwatson# Documentation 298155131SrwatsonMAINTAINER?= ports@FreeBSD.ORG 299155131SrwatsonCATEGORIES?= orphans 300155131SrwatsonCATEGORIES+= all 301155131SrwatsonKEYWORDS+= ${CATEGORIES} 302155131Srwatson 303155131SrwatsonPKGREPOSITORYSUBDIR?= .packages 304155131SrwatsonPKGREPOSITORY?= ${PACKAGES}/${PKGREPOSITORYSUBDIR} 305155131Srwatson.if exists(${PACKAGES}) 306155131SrwatsonPKGFILE?= ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX} 307155131Srwatson.else 308155131SrwatsonPKGFILE?= ${PKGNAME}${PKG_SUFX} 309155131Srwatson.endif 310155131Srwatson 311155131SrwatsonCONFIGURE_SCRIPT?= configure 312155131Srwatson 313155131Srwatson.if defined(GNU_CONFIGURE) 314155131SrwatsonCONFIGURE_ARGS?= --prefix=${PREFIX} 315155131SrwatsonHAS_CONFIGURE= yes 316155131Srwatson.endif 317155131Srwatson 318155131Srwatson.MAIN: all 319155131Srwatson 320155131Srwatson################################################################ 321155131Srwatson# If we're in BATCH mode and the port is interactive, or we're 322155131Srwatson# in interactive mode and the port is non-interactive, skip all 323155131Srwatson# the important targets. The reason we have two modes is that 324155131Srwatson# one might want to leave a build in BATCH mode running 325155131Srwatson# overnight, then come back in the morning and do _only_ the 326155131Srwatson# interactive ones that required your intervention. 327155131Srwatson# 328155131Srwatson# This allows you to do both. 329155131Srwatson################################################################ 330155131Srwatson 331155131Srwatson.if (defined(IS_INTERACTIVE) && defined(BATCH)) || (!defined(IS_INTERACTIVE) && defined(INTERACTIVE)) 332155131Srwatsonall: 333155131Srwatson @${DO_NADA} 334155131Srwatsonbuild: 335155131Srwatson @${DO_NADA} 336155131Srwatsoninstall: 337155131Srwatson @${DO_NADA} 338155131Srwatsonfetch: 339155131Srwatson @${DO_NADA} 340155131Srwatsonconfigure: 341155131Srwatson @${DO_NADA} 342155131Srwatsonpackage: 343155131Srwatson @${DO_NADA} 344155131Srwatson.endif 345155131Srwatson 346155131Srwatson.if !target(all) 347155131Srwatsonall: build 348155131Srwatson.endif 349155131Srwatson 350155131Srwatson.if !target(is_depended) 351155131Srwatsonis_depended: install 352155131Srwatson.endif 353155131Srwatson 354155131Srwatson################################################################ 355155131Srwatson# The following are used to create easy dummy targets for 356155131Srwatson# disabling some bit of default target behavior you don't want. 357155131Srwatson# They still check to see if the target exists, and if so don't 358155131Srwatson# do anything, since you might want to set this globally for a 359155131Srwatson# group of ports in a Makefile.inc, but still be able to 360155131Srwatson# override from an individual Makefile (since you can't _ 361155131Srwatson# undefine_ a variable in make!). 362155131Srwatson################################################################ 363155131Srwatson 364155131Srwatson.if defined(NO_EXTRACT) && !target(extract) 365155131Srwatsonextract: checksum 366155131Srwatson @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE} 367155131Srwatsonchecksum: fetch 368155131Srwatson @${DO_NADA} 369155131Srwatsonmakesum: 370155131Srwatson @${DO_NADA} 371155131Srwatson.endif 372155131Srwatson.if defined(NO_CONFIGURE) && !target(configure) 373155131Srwatsonconfigure: patch 374155131Srwatson @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE} 375155131Srwatson.endif 376155131Srwatson.if defined(NO_BUILD) && !target(build) 377155131Srwatsonbuild: configure 378155131Srwatson @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE} 379155131Srwatson.endif 380155131Srwatson.if defined(NO_PACKAGE) && !target(package) 381155131Srwatsonpackage: install 382155131Srwatson @${DO_NADA} 383155131Srwatson.endif 384155131Srwatson.if defined(NO_PACKAGE) && !target(repackage) 385155131Srwatsonrepackage: install 386155131Srwatson @${DO_NADA} 387155131Srwatson.endif 388155131Srwatson.if defined(NO_INSTALL) && !target(install) 389155131Srwatsoninstall: build 390155131Srwatson @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE} 391155131Srwatson.endif 392155131Srwatson.if defined(NO_PATCH) && !target(patch) 393155131Srwatsonpatch: extract 394155131Srwatson @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 395155131Srwatson.endif 396155131Srwatson 397155131Srwatson################################################################ 398155131Srwatson# More standard targets start here. 399155131Srwatson# 400155131Srwatson# These are the body of the build/install framework. If you are 401155131Srwatson# not happy with the default actions, and you can't solve it by 402155131Srwatson# adding pre-* or post-* targets/scripts, override these. 403155131Srwatson################################################################ 404155131Srwatson 405155131Srwatson# Fetch 406155131Srwatson 407155131Srwatson.if !target(do-fetch) 408155131Srwatsondo-fetch: 409155131Srwatson @if [ ! -d ${DISTDIR} ]; then mkdir -p ${DISTDIR}; fi 410155131Srwatson @(cd ${DISTDIR}; \ 411155131Srwatson for file in ${DISTFILES}; do \ 412155131Srwatson if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 413155131Srwatson ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \ 414155131Srwatson for site in ${MASTER_SITES}; do \ 415155131Srwatson ${ECHO_MSG} ">> Attempting to fetch from $${site}"; \ 416155131Srwatson if ${NCFTP} ${NCFTPFLAGS} $${site}$${file}; then \ 417155131Srwatson break; \ 418155131Srwatson fi \ 419155131Srwatson done; \ 420155131Srwatson if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 421155131Srwatson ${ECHO_MSG} ">> Couldn't fetch it - please try to retreive this";\ 422155131Srwatson ${ECHO_MSG} ">> port manually into ${DISTDIR} and try again."; \ 423155131Srwatson exit 1; \ 424155131Srwatson fi; \ 425155131Srwatson fi \ 426155131Srwatson done) 427155131Srwatson.if defined(PATCHFILES) 428155131Srwatson @if [ ! -d ${PATCHDIST} ]; then mkdir -p ${PATCHDIST}; fi 429155131Srwatson @(cd ${PATCHDIST}; \ 430155131Srwatson for file in ${PATCHFILES}; do \ 431155131Srwatson if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 432155131Srwatson ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \ 433155131Srwatson for site in ${PATCH_SITES}; do \ 434155131Srwatson ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \ 435155131Srwatson if ${NCFTP} ${NCFTPFLAGS} $${site}$${file}; then \ 436155131Srwatson break; \ 437155131Srwatson fi \ 438155131Srwatson done; \ 439155131Srwatson if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 440155131Srwatson ${ECHO_MSG} ">> Couldn't fetch it - please try to retreive this";\ 441155131Srwatson ${ECHO_MSG} ">> port manually into ${PATCHDIST} and try again."; \ 442155131Srwatson exit 1; \ 443155131Srwatson fi; \ 444155131Srwatson fi \ 445155131Srwatson done) 446155131Srwatson.endif 447155131Srwatson.endif 448155131Srwatson 449155131Srwatson# Extract 450155131Srwatson 451155131Srwatson.if !target(do-extract) 452155131Srwatsondo-extract: 453155131Srwatson @rm -rf ${WRKDIR} 454155131Srwatson @mkdir -p ${WRKDIR} 455155131Srwatson.if defined(EXTRACT_ONLY) 456155131Srwatson @for file in ${EXTRACT_ONLY}; do \ 457155131Srwatson if ! (cd ${WRKDIR};${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\ 458155131Srwatson then \ 459155131Srwatson exit 1; \ 460155131Srwatson fi \ 461155131Srwatson done 462155131Srwatson.else 463155131Srwatson @for file in ${DISTFILES}; do \ 464155131Srwatson if ! (cd ${WRKDIR};${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\ 465155131Srwatson then \ 466155131Srwatson exit 1; \ 467155131Srwatson fi \ 468155131Srwatson done 469155131Srwatson.endif 470155131Srwatson.endif 471155131Srwatson 472155131Srwatson# Patch 473155131Srwatson 474155131Srwatson.if !target(do-patch) 475155131Srwatsondo-patch: 476155131Srwatson.if defined(PATCHFILES) 477155131Srwatson @${ECHO_MSG} "===> Applying distributed patches for ${PKGNAME}" 478155131Srwatson.if defined(PATCH_DEBUG) 479155131Srwatson @(cd ${PATCHDIST}; \ 480155131Srwatson for i in ${PATCHFILES}; do \ 481155131Srwatson ${ECHO_MSG} "===> Applying distributed patch $$i" ; \ 482155131Srwatson case $$i in \ 483155131Srwatson *.Z|*.gz) \ 484155131Srwatson zcat $$i | ${PATCH} ${PATCH_DIST_ARGS}; \ 485155131Srwatson ;; \ 486155131Srwatson *) \ 487155131Srwatson ${PATCH} ${PATCH_DIST_ARGS} < $$i; \ 488155131Srwatson ;; \ 489155131Srwatson esac; \ 490155131Srwatson done) 491155131Srwatson.else 492155131Srwatson @(cd ${PATCHDIST}; \ 493155131Srwatson for i in ${PATCHFILES}; do \ 494155131Srwatson case $$i in \ 495155131Srwatson *.Z|*.gz) \ 496155131Srwatson zcat $$i | ${PATCH} ${PATCH_DIST_ARGS}; \ 497155131Srwatson ;; \ 498155131Srwatson *) \ 499155131Srwatson ${PATCH} ${PATCH_DIST_ARGS} < $$i; \ 500155131Srwatson ;; \ 501155131Srwatson esac; \ 502155131Srwatson done) 503155131Srwatson.endif 504155131Srwatson.endif 505155131Srwatson.if defined(PATCH_DEBUG) 506155131Srwatson @if [ -d ${PATCHDIR} ]; then \ 507155131Srwatson ${ECHO_MSG} "===> Applying FreeBSD patches for ${PKGNAME}" ; \ 508155131Srwatson for i in ${PATCHDIR}/patch-*; do \ 509155131Srwatson ${ECHO_MSG} "===> Applying FreeBSD patch $$i" ; \ 510155131Srwatson ${PATCH} ${PATCH_ARGS} < $$i; \ 511155131Srwatson done; \ 512155131Srwatson fi 513155131Srwatson @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 514155131Srwatson.else 515155131Srwatson @if [ -d ${PATCHDIR} ]; then \ 516155131Srwatson ${ECHO_MSG} "===> Applying FreeBSD patches for ${PKGNAME}" ; \ 517155131Srwatson for i in ${PATCHDIR}/patch-*; \ 518155131Srwatson do ${PATCH} ${PATCH_ARGS} < $$i; \ 519155131Srwatson done;\ 520155131Srwatson fi 521155131Srwatson @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 522155131Srwatson.endif 523155131Srwatson.endif 524155131Srwatson 525155131Srwatson# Configure 526155131Srwatson 527155131Srwatson.if !target(do-configure) 528155131Srwatsondo-configure: 529155131Srwatson @if [ -f ${SCRIPTDIR}/configure ]; then \ 530155131Srwatson env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 531155131Srwatson WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 532155131Srwatson FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 533155131Srwatson DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ 534155131Srwatson sh ${SCRIPTDIR}/configure; \ 535155131Srwatson fi 536155131Srwatson.if defined(HAS_CONFIGURE) 537155131Srwatson @(cd ${WRKSRC}; CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \ 538155131Srwatson INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \ 539155131Srwatson INSTALL_PROGRAM="/usr/bin/install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}" \ 540155131Srwatson ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}) 541155131Srwatson.endif 542155131Srwatson.if defined(USE_IMAKE) 543155131Srwatson.if defined(USE_GMAKE) 544155131Srwatson @(cd ${WRKSRC}; ${XMKMF} && ${GMAKE} Makefiles) 545155131Srwatson.else 546155131Srwatson @(cd ${WRKSRC}; ${XMKMF} && ${MAKE} Makefiles) 547155131Srwatson.endif 548155131Srwatson.endif 549155131Srwatson.endif 550155131Srwatson 551155131Srwatson# Build 552155131Srwatson 553155131Srwatson.if !target(do-build) 554155131Srwatsondo-build: 555155131Srwatson.if defined(USE_GMAKE) 556155131Srwatson @(cd ${WRKSRC}; ${GMAKE} PREFIX=${PREFIX} X11BASE=${X11BASE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET}) 557155131Srwatson.else defined(USE_GMAKE) 558155131Srwatson @(cd ${WRKSRC}; ${MAKE} PREFIX=${PREFIX} X11BASE=${X11BASE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET}) 559155131Srwatson.endif 560155131Srwatson.endif 561155131Srwatson 562155131Srwatson# Install 563155131Srwatson 564155131Srwatson.if !target(do-install) 565155131Srwatsondo-install: 566155131Srwatson.if defined(USE_GMAKE) 567155131Srwatson @(cd ${WRKSRC}; ${GMAKE} PREFIX=${PREFIX} X11BASE=${X11BASE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET}) 568155131Srwatson.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES) 569155131Srwatson @(cd ${WRKSRC}; ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man) 570155131Srwatson.endif 571155131Srwatson.else defined(USE_GMAKE) 572155131Srwatson @(cd ${WRKSRC}; ${MAKE} PREFIX=${PREFIX} X11BASE=${X11BASE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET}) 573155131Srwatson.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES) 574155131Srwatson @(cd ${WRKSRC}; ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man) 575155131Srwatson.endif 576155131Srwatson.endif 577155131Srwatson.endif 578155131Srwatson 579155131Srwatson################################################################ 580155131Srwatson# Skeleton targets start here 581155131Srwatson# 582155131Srwatson# You shouldn't have to change these. Either add the pre-* or 583155131Srwatson# post-* targets/scripts or redefine the do-* targets. These 584155131Srwatson# targets don't do anything other than checking for cookies and 585155131Srwatson# call the necessary targets/scripts. 586155131Srwatson################################################################ 587155131Srwatson 588155131Srwatson# Fetch 589155131Srwatson 590155131Srwatson.if !target(fetch) 591155131Srwatsonfetch: depends 592155131Srwatson.if target(pre-fetch) 593155131Srwatson @${MAKE} ${.MAKEFLAGS} pre-fetch 594155131Srwatson.endif 595155131Srwatson @if [ -f ${SCRIPTDIR}/pre-fetch ]; then \ 596155131Srwatson env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 597155131Srwatson WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 598155131Srwatson FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 599155131Srwatson DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ 600155131Srwatson sh ${SCRIPTDIR}/pre-fetch; \ 601155131Srwatson fi 602155131Srwatson @${MAKE} ${.MAKEFLAGS} do-fetch 603155131Srwatson.if target(post-fetch) 604155131Srwatson @${MAKE} ${.MAKEFLAGS} post-fetch 605155131Srwatson.endif 606155131Srwatson @if [ -f ${SCRIPTDIR}/post-fetch ]; then \ 607155131Srwatson env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 608155131Srwatson WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 609155131Srwatson FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 610155131Srwatson DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ 611155131Srwatson sh ${SCRIPTDIR}/post-fetch; \ 612155131Srwatson fi 613155131Srwatson.endif 614155131Srwatson 615155131Srwatson# Extract 616155131Srwatson 617155131Srwatson.if !target(extract) 618155131Srwatsonextract: checksum ${EXTRACT_COOKIE} 619155131Srwatson 620155131Srwatson${EXTRACT_COOKIE}: 621155131Srwatson @${ECHO_MSG} "===> Extracting for ${PKGNAME}" 622155131Srwatson.if target(pre-extract) 623155131Srwatson @${MAKE} ${.MAKEFLAGS} pre-extract 624155131Srwatson.endif 625155131Srwatson @if [ -f ${SCRIPTDIR}/pre-extract ]; then \ 626155131Srwatson env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 627155131Srwatson WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 628155131Srwatson FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 629155131Srwatson DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ 630155131Srwatson sh ${SCRIPTDIR}/pre-extract; \ 631155131Srwatson fi 632155131Srwatson @${MAKE} ${.MAKEFLAGS} do-extract 633155131Srwatson.if target(post-extract) 634155131Srwatson @${MAKE} ${.MAKEFLAGS} post-extract 635155131Srwatson.endif 636155131Srwatson @if [ -f ${SCRIPTDIR}/post-extract ]; then \ 637155131Srwatson env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 638155131Srwatson WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 639155131Srwatson FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 640155131Srwatson DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ 641155131Srwatson sh ${SCRIPTDIR}/post-extract; \ 642155131Srwatson fi 643155131Srwatson @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE} 644155131Srwatson.endif 645155131Srwatson 646155131Srwatson# Patch 647155131Srwatson 648155131Srwatson.if !target(patch) 649155131Srwatsonpatch: extract ${PATCH_COOKIE} 650155131Srwatson 651155131Srwatson${PATCH_COOKIE}: 652155131Srwatson @${ECHO_MSG} "===> Patching for ${PKGNAME}" 653155131Srwatson.if target(pre-patch) 654155131Srwatson @${MAKE} ${.MAKEFLAGS} pre-patch 655155131Srwatson.endif 656155131Srwatson @if [ -f ${SCRIPTDIR}/pre-patch ]; then \ 657155131Srwatson env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 658155131Srwatson WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 659155131Srwatson FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 660155131Srwatson DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ 661155131Srwatson sh ${SCRIPTDIR}/pre-patch; \ 662155131Srwatson fi 663155131Srwatson @${MAKE} ${.MAKEFLAGS} do-patch 664155131Srwatson.if target(post-patch) 665155131Srwatson @${MAKE} ${.MAKEFLAGS} post-patch 666155131Srwatson.endif 667155131Srwatson @if [ -f ${SCRIPTDIR}/post-patch ]; then \ 668155131Srwatson env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 669155131Srwatson WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 670155131Srwatson FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 671155131Srwatson DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ 672155131Srwatson sh ${SCRIPTDIR}/post-patch; \ 673155131Srwatson fi 674155131Srwatson @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 675155131Srwatson.endif 676155131Srwatson 677155131Srwatson# Configure 678155131Srwatson 679155131Srwatson.if !target(configure) 680155131Srwatsonconfigure: patch ${CONFIGURE_COOKIE} 681155131Srwatson 682155131Srwatson${CONFIGURE_COOKIE}: 683155131Srwatson @${ECHO_MSG} "===> Configuring for ${PKGNAME}" 684155131Srwatson.if target(pre-configure) 685155131Srwatson @${MAKE} ${.MAKEFLAGS} pre-configure 686155131Srwatson.endif 687155131Srwatson @if [ -f ${SCRIPTDIR}/pre-configure ]; then \ 688155131Srwatson env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 689155131Srwatson WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 690155131Srwatson FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 691155131Srwatson DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ 692155131Srwatson sh ${SCRIPTDIR}/pre-configure; \ 693155131Srwatson fi 694155131Srwatson @${MAKE} ${.MAKEFLAGS} do-configure 695155131Srwatson.if target(post-configure) 696155131Srwatson @${MAKE} ${.MAKEFLAGS} post-configure 697155131Srwatson.endif 698155131Srwatson @if [ -f ${SCRIPTDIR}/post-configure ]; then \ 699155131Srwatson env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 700155131Srwatson WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 701155131Srwatson FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 702155131Srwatson DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ 703155131Srwatson sh ${SCRIPTDIR}/post-configure; \ 704155131Srwatson fi 705155131Srwatson @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE} 706155131Srwatson.endif 707155131Srwatson 708155131Srwatson# Build 709155131Srwatson 710155131Srwatson.if !target(build) 711155131Srwatsonbuild: configure ${BUILD_COOKIE} 712155131Srwatson 713155131Srwatson${BUILD_COOKIE}: 714155131Srwatson @${ECHO_MSG} "===> Building for ${PKGNAME}" 715155131Srwatson.if target(pre-build) 716155131Srwatson @${MAKE} ${.MAKEFLAGS} pre-build 717155131Srwatson.endif 718155131Srwatson @if [ -f ${SCRIPTDIR}/pre-build ]; then \ 719155131Srwatson env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 720155131Srwatson WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 721155131Srwatson FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 722155131Srwatson DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ 723155131Srwatson sh ${SCRIPTDIR}/pre-build; \ 724155131Srwatson fi 725155131Srwatson @${MAKE} ${.MAKEFLAGS} do-build 726155131Srwatson.if target(post-build) 727155131Srwatson @${MAKE} ${.MAKEFLAGS} post-build 728155131Srwatson.endif 729155131Srwatson @if [ -f ${SCRIPTDIR}/post-build ]; then \ 730155131Srwatson env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 731155131Srwatson WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 732155131Srwatson FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 733155131Srwatson DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ 734155131Srwatson sh ${SCRIPTDIR}/post-build; \ 735155131Srwatson fi 736155131Srwatson @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE} 737155131Srwatson.endif 738155131Srwatson 739155131Srwatson# Install 740155131Srwatson 741155131Srwatson.if !target(install) 742155131Srwatsoninstall: build ${INSTALL_COOKIE} 743155131Srwatson 744155131Srwatson${INSTALL_COOKIE}: 745155131Srwatson @${ECHO_MSG} "===> Installing for ${PKGNAME}" 746155131Srwatson.if !defined(USE_X11) && !defined(USE_IMAKE) && defined(MTREE_LOCAL) 747155131Srwatson @${MTREE_CMD} ${MTREE_ARGS} ${PREFIX}/; 748155131Srwatson.endif 749155131Srwatson.if target(pre-install) 750155131Srwatson @${MAKE} ${.MAKEFLAGS} pre-install 751155131Srwatson.endif 752155131Srwatson @if [ -f ${SCRIPTDIR}/pre-install ]; then \ 753155131Srwatson env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 754155131Srwatson WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 755155131Srwatson FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 756155131Srwatson DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ 757155131Srwatson sh ${SCRIPTDIR}/pre-install; \ 758155131Srwatson fi 759155131Srwatson @${MAKE} ${.MAKEFLAGS} do-install 760155131Srwatson.if target(post-install) 761155131Srwatson @${MAKE} ${.MAKEFLAGS} post-install 762155131Srwatson.endif 763155131Srwatson @if [ -f ${SCRIPTDIR}/post-install ]; then \ 764155131Srwatson env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 765155131Srwatson WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 766155131Srwatson FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 767155131Srwatson DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ 768155131Srwatson sh ${SCRIPTDIR}/post-install; \ 769155131Srwatson fi 770155131Srwatson.if !defined(NO_PACKAGE) 771155131Srwatson @${MAKE} ${.MAKEFLAGS} fake-pkg 772155131Srwatson.endif 773155131Srwatson @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE} 774155131Srwatson.endif 775155131Srwatson 776155131Srwatson# Reinstall 777155131Srwatson# 778155131Srwatson# This is a special target to re-run install 779155131Srwatson 780155131Srwatson.if !target(reinstall) 781155131Srwatsonreinstall: pre-reinstall install 782155131Srwatson 783155131Srwatsonpre-reinstall: 784155131Srwatson @rm -f ${INSTALL_COOKIE} 785155131Srwatson @rm -f ${PACKAGE_COOKIE} 786155131Srwatson.endif 787155131Srwatson 788155131Srwatson################################################################ 789155131Srwatson# Some more targets supplied for users' convenience 790155131Srwatson################################################################ 791155131Srwatson 792155131Srwatson# Cleaning up 793155131Srwatson 794155131Srwatson.if !target(pre-clean) 795155131Srwatsonpre-clean: 796155131Srwatson @${DO_NADA} 797155131Srwatson.endif 798155131Srwatson 799155131Srwatson.if !target(clean) 800155131Srwatsonclean: pre-clean 801155131Srwatson @${ECHO_MSG} "===> Cleaning for ${PKGNAME}" 802155131Srwatson @rm -f ${EXTRACT_COOKIE} ${CONFIGURE_COOKIE} ${INSTALL_COOKIE} \ 803155131Srwatson ${BUILD_COOKIE} ${PATCH_COOKIE} 804155131Srwatson.if defined(NO_WRKDIR) 805155131Srwatson @rm -f ${WRKDIR}/.*_done 806155131Srwatson.else 807155131Srwatson @rm -rf ${WRKDIR} 808155131Srwatson.endif 809155131Srwatson.endif 810155131Srwatson 811155131Srwatson# Prints out a list of files to fetch (useful to do a batch fetch) 812155131Srwatson 813155131Srwatson.if !target(fetch-list) 814155131Srwatsonfetch-list: 815155131Srwatson @if [ ! -d ${DISTDIR} ]; then mkdir -p ${DISTDIR}; fi 816155131Srwatson @(cd ${DISTDIR}; \ 817155131Srwatson for file in ${DISTFILES}; do \ 818155131Srwatson if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 819155131Srwatson for site in ${MASTER_SITES}; do \ 820155131Srwatson echo -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} '||' ; \ 821155131Srwatson break; \ 822155131Srwatson done; \ 823155131Srwatson echo "echo $${file} not fetched" ; \ 824155131Srwatson fi \ 825155131Srwatson done) 826155131Srwatson.if defined(PATCHFILES) 827155131Srwatson @(cd ${DISTDIR}; \ 828155131Srwatson for file in ${PATCHFILES}; do \ 829155131Srwatson if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 830155131Srwatson for site in ${PATCH_SITES}; do \ 831155131Srwatson echo -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} ${PATCH_PRFX}$${file} '||' ; \ 832155131Srwatson break; \ 833155131Srwatson done; \ 834155131Srwatson echo "echo $${file} not fetched" ; \ 835155131Srwatson fi \ 836155131Srwatson done) 837155131Srwatson.endif 838155131Srwatson.endif 839155131Srwatson 840155131Srwatson# Checksumming utilities 841155131Srwatson 842155131Srwatson.if !target(makesum) 843155131Srwatsonmakesum: fetch 844155131Srwatson @if [ ! -d ${FILESDIR} ]; then mkdir -p ${FILESDIR}; fi 845155131Srwatson @if [ -f ${MD5_FILE} ]; then rm -f ${MD5_FILE}; fi 846155131Srwatson @(cd ${DISTDIR}; \ 847155131Srwatson for file in ${DISTFILES} ${PATCHFILES:S|^|${PATCH_PRFX}|}; do \ 848155131Srwatson ${MD5} $$file >> ${MD5_FILE}; \ 849155131Srwatson done) 850155131Srwatson.endif 851155131Srwatson 852155131Srwatson.if !target(checksum) 853155131Srwatsonchecksum: fetch 854155131Srwatson @if [ ! -f ${MD5_FILE} ]; then \ 855155131Srwatson ${ECHO_MSG} ">> No MD5 checksum file."; \ 856155131Srwatson else \ 857155131Srwatson (cd ${DISTDIR}; OK=""; \ 858155131Srwatson for file in ${DISTFILES} ${PATCHFILES:S|^|${PATCH_PRFX}|}; do \ 859155131Srwatson CKSUM=`${MD5} $$file | awk '{print $$4}'`; \ 860155131Srwatson CKSUM2=`grep "($$file)" ${MD5_FILE} | awk '{print $$4}'`; \ 861155131Srwatson if [ "$$CKSUM2" = "" ]; then \ 862155131Srwatson ${ECHO_MSG} ">> No checksum recorded for $$file"; \ 863155131Srwatson OK="false"; \ 864155131Srwatson elif [ "$$CKSUM" != "$$CKSUM2" ]; then \ 865155131Srwatson ${ECHO_MSG} ">> Checksum mismatch for $$file"; \ 866155131Srwatson exit 1; \ 867155131Srwatson fi; \ 868155131Srwatson done; \ 869155131Srwatson if [ "$$OK" = "" ]; then \ 870155131Srwatson ${ECHO_MSG} "Checksums OK."; \ 871155131Srwatson else \ 872155131Srwatson ${ECHO_MSG} "Checksums OK for files that have them."; \ 873155131Srwatson fi) ; \ 874155131Srwatson fi 875155131Srwatson.endif 876155131Srwatson 877155131Srwatson################################################################ 878155131Srwatson# The package-building targets 879155131Srwatson# You probably won't need to touch these 880155131Srwatson################################################################ 881155131Srwatson 882155131Srwatson# Nobody should want to override this unless PKGNAME is simply bogus. 883155131Srwatson.if !target(package-name) 884155131Srwatsonpackage-name: 885155131Srwatson.if !defined(NO_PACKAGE) 886155131Srwatson @echo ${PKGNAME} 887155131Srwatson.endif 888155131Srwatson.endif 889155131Srwatson 890155131Srwatson# Show (recursively) all the packages this package depends on. 891155131Srwatson.if !target(package-depends) 892155131Srwatsonpackage-depends: 893155131Srwatson @for i in ${EXEC_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \ 894155131Srwatson dir=`echo $$i | sed -e 's/.*://'`; \ 895155131Srwatson (cd $$dir ; ${MAKE} package-name package-depends); \ 896155131Srwatson done 897155131Srwatson.endif 898155131Srwatson 899155131Srwatson# Build a package 900155131Srwatson 901155131Srwatson.if !target(package) 902155131Srwatsonpackage: install ${PACKAGE_COOKIE} 903155131Srwatson 904155131Srwatson${PACKAGE_COOKIE}: 905155131Srwatson.if target(pre-package) 906155131Srwatson @${MAKE} ${.MAKEFLAGS} pre-package 907155131Srwatson.endif 908155131Srwatson @${MAKE} ${.MAKEFLAGS} do-package 909155131Srwatson @${TOUCH} ${TOUCH_FLAGS} ${PACKAGE_COOKIE} 910155131Srwatson.endif 911155131Srwatson 912155131Srwatson# Build a package but don't check the package cookie 913155131Srwatson 914155131Srwatson.if !target(repackage) 915155131Srwatsonrepackage: pre-repackage package 916155131Srwatson 917155131Srwatsonpre-repackage: 918155131Srwatson @rm -f ${PACKAGE_COOKIE} 919155131Srwatson.endif 920155131Srwatson 921155131Srwatson# Build a package but don't check the cookie for installation, also don't 922155131Srwatson# install package cookie 923155131Srwatson 924155131Srwatson.if !target(package-noinstall) 925155131Srwatsonpackage-noinstall: 926155131Srwatson.if target(pre-package) 927155131Srwatson @${MAKE} ${.MAKEFLAGS} pre-package 928155131Srwatson.endif 929155131Srwatson @${MAKE} ${.MAKEFLAGS} do-package 930155131Srwatson.endif 931155131Srwatson 932155131Srwatson# The body of the package-building target 933155131Srwatson 934155131Srwatson.if !target(do-package) 935155131Srwatsondo-package: 936155131Srwatson @if [ -e ${PKGDIR}/PLIST ]; then \ 937155131Srwatson ${ECHO_MSG} "===> Building package for ${PKGNAME}"; \ 938155131Srwatson if [ -d ${PACKAGES} ]; then \ 939155131Srwatson if [ ! -d ${PKGREPOSITORY} ]; then \ 940155131Srwatson if ! mkdir -p ${PKGREPOSITORY}; then \ 941155131Srwatson ${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \ 942155131Srwatson exit 1; \ 943155131Srwatson fi; \ 944155131Srwatson fi; \ 945155131Srwatson fi; \ 946155131Srwatson ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; \ 947155131Srwatson if [ -d ${PACKAGES} ]; then \ 948155131Srwatson ${MAKE} ${.MAKEFLAGS} package-links; \ 949155131Srwatson fi; \ 950155131Srwatson fi 951155131Srwatson.endif 952155131Srwatson 953155131Srwatson.if !target(package-links) 954155131Srwatsonpackage-links: 955155131Srwatson @${MAKE} ${.MAKEFLAGS} delete-package-links 956155131Srwatson @for cat in ${CATEGORIES}; do \ 957155131Srwatson if [ ! -d ${PACKAGES}/$$cat ]; then \ 958155131Srwatson if ! mkdir -p ${PACKAGES}/$$cat; then \ 959155131Srwatson ${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \ 960155131Srwatson exit 1; \ 961155131Srwatson fi; \ 962155131Srwatson fi; \ 963155131Srwatson ln -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \ 964155131Srwatson done; 965155131Srwatson.endif 966155131Srwatson 967155131Srwatson.if !target(delete-package-links) 968155131Srwatsondelete-package-links: 969155131Srwatson @rm -f ${PACKAGES}/*/${PKGNAME}${PKG_SUFX}; 970155131Srwatson.endif 971155131Srwatson 972155131Srwatson.if !target(delete-package) 973155131Srwatsondelete-package: 974155131Srwatson @${MAKE} ${.MAKEFLAGS} delete-package-links 975155131Srwatson @rm -f ${PKGFILE} 976155131Srwatson.endif 977155131Srwatson 978155131Srwatson################################################################ 979155131Srwatson# Dependency checking 980155131Srwatson################################################################ 981155131Srwatson 982155131Srwatson.if !target(depends) 983155131Srwatsondepends: exec_depends lib_depends misc_depends 984155131Srwatson 985155131Srwatsonexec_depends: 986155131Srwatson.if defined(EXEC_DEPENDS) 987155131Srwatson.if defined(NO_DEPENDS) 988155131Srwatson# Just print out messages 989155131Srwatson @for i in ${EXEC_DEPENDS}; do \ 990155131Srwatson prog=`echo $$i | sed -e 's/:.*//'`; \ 991155131Srwatson dir=`echo $$i | sed -e 's/.*://'`; \ 992155131Srwatson ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog ($$dir)"; \ 993155131Srwatson done 994155131Srwatson.else 995155131Srwatson @for i in ${EXEC_DEPENDS}; do \ 996155131Srwatson prog=`echo $$i | sed -e 's/:.*//'`; \ 997155131Srwatson dir=`echo $$i | sed -e 's/.*://'`; \ 998155131Srwatson if which -s "$$prog"; then \ 999155131Srwatson ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog - found"; \ 1000155131Srwatson else \ 1001155131Srwatson ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog - not found"; \ 1002155131Srwatson ${ECHO_MSG} "===> Verifying build for $$prog in $$dir"; \ 1003155131Srwatson if [ ! -d "$$dir" ]; then \ 1004155131Srwatson ${ECHO_MSG} ">> No directory for $$prog. Skipping.."; \ 1005155131Srwatson else \ 1006155131Srwatson (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 1007155131Srwatson ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \ 1008155131Srwatson fi; \ 1009155131Srwatson fi; \ 1010155131Srwatson done 1011155131Srwatson.endif 1012155131Srwatson.else 1013155131Srwatson @${DO_NADA} 1014155131Srwatson.endif 1015155131Srwatson 1016155131Srwatsonlib_depends: 1017155131Srwatson.if defined(LIB_DEPENDS) 1018155131Srwatson.if defined(NO_DEPENDS) 1019155131Srwatson# Just print out messages 1020155131Srwatson @for i in ${LIB_DEPENDS}; do \ 1021155131Srwatson lib=`echo $$i | sed -e 's/:.*//'`; \ 1022155131Srwatson dir=`echo $$i | sed -e 's/.*://'`; \ 1023155131Srwatson ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$lib ($$dir)"; \ 1024155131Srwatson done 1025155131Srwatson.else 1026155131Srwatson @for i in ${LIB_DEPENDS}; do \ 1027155131Srwatson lib=`echo $$i | sed -e 's/:.*//'`; \ 1028155131Srwatson dir=`echo $$i | sed -e 's/.*://'`; \ 1029155131Srwatson if ldconfig -r | grep -q -e "-l$$lib"; then \ 1030155131Srwatson ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$lib - found"; \ 1031155131Srwatson else \ 1032155131Srwatson ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$lib - not found"; \ 1033155131Srwatson ${ECHO_MSG} "===> Verifying build for $$lib in $$dir"; \ 1034155131Srwatson if [ ! -d "$$dir" ]; then \ 1035155131Srwatson ${ECHO_MSG} ">> No directory for $$lib. Skipping.."; \ 1036155131Srwatson else \ 1037155131Srwatson (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 1038155131Srwatson ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \ 1039155131Srwatson fi; \ 1040155131Srwatson fi; \ 1041155131Srwatson done 1042155131Srwatson.endif 1043155131Srwatson.else 1044155131Srwatson @${DO_NADA} 1045155131Srwatson.endif 1046155131Srwatson 1047155131Srwatsonmisc_depends: 1048155131Srwatson.if defined(DEPENDS) 1049155131Srwatson @${ECHO_MSG} "===> ${PKGNAME} depends on: ${DEPENDS}" 1050155131Srwatson.if !defined(NO_DEPENDS) 1051155131Srwatson @for i in ${DEPENDS}; do \ 1052155131Srwatson ${ECHO_MSG} "===> Verifying build for $$i"; \ 1053155131Srwatson if [ ! -d $$i ]; then \ 1054155131Srwatson ${ECHO_MSG} ">> No directory for $$i. Skipping.."; \ 1055155131Srwatson else \ 1056155131Srwatson (cd $$i; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 1057155131Srwatson fi \ 1058155131Srwatson done 1059155131Srwatson @${ECHO_MSG} "===> Returning to build of ${PKGNAME}" 1060155131Srwatson.endif 1061155131Srwatson.else 1062155131Srwatson @${DO_NADA} 1063155131Srwatson.endif 1064155131Srwatson 1065155131Srwatson.endif 1066155131Srwatson 1067155131Srwatson################################################################ 1068155131Srwatson# Everything after here are internal targets and really 1069155131Srwatson# shouldn't be touched by anybody but the release engineers. 1070155131Srwatson################################################################ 1071155131Srwatson 1072155131Srwatson# This target generates an index entry suitable for aggregation into 1073155131Srwatson# a large index. Format is: 1074155131Srwatson# 1075155131Srwatson# distribution-name|port-path|installation-prefix|comment| \ 1076155131Srwatson# description-file|maintainer|categories|keywords 1077155131Srwatson# 1078155131Srwatson.if !target(describe) 1079155131Srwatsondescribe: 1080155131Srwatson @echo -n "${PKGNAME}|${.CURDIR}/${PKGNAME}|" 1081155131Srwatson @echo -n "${PREFIX}|" 1082155131Srwatson @if [ -f ${PKGDIR}/COMMENT ]; then \ 1083155131Srwatson echo -n "`cat ${PKGDIR}/COMMENT`"; \ 1084155131Srwatson else \ 1085155131Srwatson echo -n "** No Description"; \ 1086155131Srwatson fi 1087155131Srwatson @if [ -f ${PKGDIR}/DESCR ]; then \ 1088155131Srwatson echo -n "|${PKGDIR}/DESCR"; \ 1089155131Srwatson else \ 1090155131Srwatson echo -n "|/dev/null"; \ 1091155131Srwatson fi 1092155131Srwatson @echo -n "|${MAINTAINER}|${CATEGORIES}|${KEYWORDS}" 1093155131Srwatson @echo "" 1094155131Srwatson.endif 1095155131Srwatson 1096155131Srwatson# Fake installation of package so that user can pkg_delete it later. 1097155131Srwatson# Also, make sure that an installed port is recognized correctly in 1098155131Srwatson# accordance to the @pkgdep directive in the packing lists 1099155131Srwatson 1100155131Srwatson.if !target(fake-pkg) 1101155131Srwatson.if !defined(NO_PACKAGE) 1102155131Srwatsonfake-pkg: 1103155131Srwatson @if [ ! -f ${PKGDIR}/PLIST -o ! -f ${PKGDIR}/COMMENT -o ! -f ${PKGDIR}/DESCR ]; then echo "** Missing package files for ${PKGNAME} - installation not recorded."; exit 1; fi 1104155131Srwatson @if [ ! -d ${PKG_DBDIR} ]; then rm -f ${PKG_DBDIR}; mkdir -p ${PKG_DBDIR}; fi 1105155131Srwatson @if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \ 1106155131Srwatson ${ECHO_MSG} "===> Registering installation for ${PKGNAME}"; \ 1107155131Srwatson mkdir -p ${PKG_DBDIR}/${PKGNAME}; \ 1108155131Srwatson ${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \ 1109155131Srwatson cp ${PKGDIR}/DESCR ${PKG_DBDIR}/${PKGNAME}/+DESC; \ 1110155131Srwatson cp ${PKGDIR}/COMMENT ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \ 1111155131Srwatson if [ -f ${PKGDIR}/INSTALL ]; then cp ${PKGDIR}/INSTALL ${PKG_DBDIR}/${PKGNAME}/+INSTALL; fi; \ 1112155131Srwatson if [ -f ${PKGDIR}/DEINSTALL ]; then cp ${PKGDIR}/DEINSTALL ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; fi; \ 1113155131Srwatson if [ -f ${PKGDIR}/REQ ]; then cp ${PKGDIR}/REQ ${PKG_DBDIR}/${PKGNAME}/+REQ; fi; \ 1114155131Srwatson else \ 1115155131Srwatson ${ECHO_MSG} "===> ${PKGNAME} is already installed - perhaps an older version?"; \ 1116155131Srwatson ${ECHO_MSG} " If so, you may wish to \`\`pkg_delete ${PKGNAME}'' and install"; \ 1117155131Srwatson ${ECHO_MSG} " this port again to upgrade it properly."; \ 1118155131Srwatson fi 1119155131Srwatson.endif 1120155131Srwatson.endif 1121155131Srwatson 1122155131Srwatson# Depend is generally meaningless for arbitrary ports, but if someone wants 1123155131Srwatson# one they can override this. This is just to catch people who've gotten into 1124155131Srwatson# the habit of typing `make depend all install' as a matter of course. 1125155131Srwatson# 1126155131Srwatson.if !target(depend) 1127155131Srwatsondepend: 1128155131Srwatson.endif 1129155131Srwatson 1130155131Srwatson# Same goes for tags 1131155131Srwatson.if !target(tags) 1132155131Srwatsontags: 1133155131Srwatson.endif 1134155131Srwatson