bsd.port.mk revision 7988
1163953Srrs#-*- mode: Fundamental; tab-width: 4; -*- 2185694Srrs# 3235828Stuexen# bsd.port.mk - 940820 Jordan K. Hubbard. 4235828Stuexen# This file is in the public domain. 5163953Srrs# 6163953Srrs# $Id: bsd.port.mk,v 1.146 1995/04/22 00:05:46 jkh Exp $ 7163953Srrs# 8163953Srrs# Please view me with 4 column tabs! 9163953Srrs 10228653Stuexen 11163953Srrs# Supported Variables and their behaviors: 12163953Srrs# 13163953Srrs# Variables that typically apply to all ports: 14228653Stuexen# 15163953Srrs# PORTSDIR - The root of the ports tree (default: /usr/ports). 16163953Srrs# DISTDIR - Where to get gzip'd, tarballed copies of original sources 17163953Srrs# (default: ${PORTSDIR}/distfiles). 18163953Srrs# PREFIX - Where to install things in general (default: /usr/local). 19163953Srrs# MASTER_SITES - Primary location(s) for distribution files if not found 20163953Srrs# locally (default: 21163953Srrs# ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles) 22163953Srrs# PATCH_SITES - Primary location(s) for distributed patch files 23163953Srrs# (see PATCHFILES below) if not found locally (default: 24163953Srrs# ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles) 25163953Srrs# 26163953Srrs# MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this 27163953Srrs# value. 28163953Srrs# MASTER_SITE_FREEBSD - If set, only use the FreeBSD master repository for 29163953Srrs# MASTER_SITES. 30163953Srrs# PACKAGES - A top level directory where all packages go (rather than 31163953Srrs# going locally to each port). (default: ${PORTSDIR}/packages). 32163953Srrs# GMAKE - Set to path of GNU make if not in $PATH (default: gmake). 33163953Srrs# XMKMF - Set to path of `xmkmf' if not in $PATH (default: xmkmf -a ). 34163953Srrs# MAINTAINER - The e-mail address of the contact person for this port 35163953Srrs# (default: ports@FreeBSD.ORG). 36163953Srrs# CATEGORIES - A list of descriptive categories into which this port falls 37163953Srrs# (default: orphans). 38163953Srrs# KEYWORDS - A list of descriptive keywords that might index well for this 39163953Srrs# port (default: orphans). 40167598Srrs# 41163953Srrs# Variables that typically apply to an individual port. Non-Boolean 42243186Stuexen# variables without defaults are *mandatory*. 43163953Srrs# 44163953Srrs# 45163953Srrs# WRKDIR - A temporary working directory that gets *clobbered* on clean 46163953Srrs# (default: ${.CURDIR}/work). 47163953Srrs# WRKSRC - A subdirectory of ${WRKDIR} where the distribution actually 48163953Srrs# unpacks to. (Default: ${WRKDIR}/${DISTNAME} unless 49163953Srrs# NO_WRKSUBDIR is set, in which case simply ${WRKDIR}). 50163953Srrs# DISTNAME - Name of port or distribution. 51208160Srrs# DISTFILES - Name(s) of archive file(s) containing distribution 52243186Stuexen# (default: ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}). 53243186Stuexen# PATCHFILES - Name(s) of additional files that contain distributed 54243186Stuexen# patches (default: none). make will look for them at 55163953Srrs# PATCH_SITES (see above). They will automatically be 56163953Srrs# uncompressed before patching if the names end with 57170791Srrs# ".gz" or ".Z". 58170791Srrs# PKGNAME - Name of the package file to create if the DISTNAME 59170744Srrs# isn't really relevant for the port/package 60163953Srrs# (default: ${DISTNAME}). 61217611Stuexen# EXTRACT_ONLY - If defined, a subset of ${DISTFILES} you want to 62217760Stuexen# actually extract. 63217611Stuexen# PATCHDIR - A directory containing any additional patches you made 64163953Srrs# to port this software to FreeBSD (default: 65240507Stuexen# ${.CURDIR}/patches) 66163953Srrs# SCRIPTDIR - A directory containing any auxiliary scripts 67170744Srrs# (default: ${.CURDIR}/scripts) 68163953Srrs# FILESDIR - A directory containing any miscellaneous additional files. 69170744Srrs# (default: ${.CURDIR}/files) 70170744Srrs# PKGDIR - A direction containing any package creation files. 71163953Srrs# (default: ${.CURDIR}/pkg) 72170744Srrs# PKG_DBDIR - Where package installation is recorded (default: /var/db/pkg) 73163953Srrs# 74170744Srrs# NO_EXTRACT - Use a dummy (do-nothing) extract target. 75170744Srrs# NO_CONFIGURE - Use a dummy (do-nothing) configure target. 76171943Srrs# NO_BUILD - Use a dummy (do-nothing) build target. 77170744Srrs# NO_PACKAGE - Use a dummy (do-nothing) package target. 78170744Srrs# NO_INSTALL - Use a dummy (do-nothing) install target. 79170744Srrs# NO_WRKSUBDIR - Assume port unpacks directly into ${WRKDIR}. 80170744Srrs# NO_WRKDIR - There's no work directory at all; port does this someplace 81170744Srrs# else. 82170744Srrs# NO_DEPENDS - Don't verify build of dependencies. 83163953Srrs# USE_GMAKE - Says that the port uses gmake. 84163953Srrs# USE_IMAKE - Says that the port uses imake. 85163953Srrs# USE_X11 - Says that the port uses X11. 86163953Srrs# NO_INSTALL_MANPAGES - For imake ports that don't like the install.man 87163953Srrs# target. 88170744Srrs# HAS_CONFIGURE - Says that the port has its own configure script. 89163953Srrs# GNU_CONFIGURE - Set if you are using GNU configure (optional). 90170744Srrs# CONFIGURE_SCRIPT - Name of configure script, defaults to 'configure'. 91170744Srrs# CONFIGURE_ARGS - Pass these args to configure, if ${HAS_CONFIGURE} set. 92163953Srrs# IS_INTERACTIVE - Set this if your port needs to interact with the user 93170744Srrs# during a build. User can then decide to skip this port by 94170744Srrs# setting ${BATCH}, or compiling only the interactive ports 95163953Srrs# by setting ${INTERACTIVE}. 96170744Srrs# EXEC_DEPENDS - A list of "prog:dir" pairs of other ports this 97170744Srrs# package depends on. "prog" is the name of an 98163953Srrs# executable. make will search your $PATH for it and go 99170744Srrs# into "dir" to do a "make all install" if it's not found. 100171943Srrs# LIB_DEPENDS - A list of "lib:dir" pairs of other ports this package 101170744Srrs# depends on. "lib" is the name of a shared library. 102170744Srrs# make will use "ldconfig -r" to search for the 103170744Srrs# library. Note that lib can be any regular expression, 104170744Srrs# and you need two backslashes in front of dots (.) to 105170744Srrs# supress its special meaning (e.g., use 106170744Srrs# "foo\\.2\\.:${PORTSDIR}/utils/foo" to match "libfoo.2.*"). 107163953Srrs# DEPENDS - A list of other ports this package depends on being 108163953Srrs# made first. Use this for things that don't fall into 109163953Srrs# the above two categories. 110163953Srrs# EXTRACT_CMD - Command for extracting archive (default: tar). 111163953Srrs# EXTRACT_SUFX - Suffix for archive names (default: .tar.gz). 112170744Srrs# EXTRACT_BEFORE_ARGS - 113163953Srrs# Arguments to ${EXTRACT_CMD} before filename 114179141Srrs# (default: -C ${WRKDIR} -xzf). 115170744Srrs# EXTRACT_AFTER_ARGS - 116219013Stuexen# Arguments to ${EXTRACT_CMD} following filename 117171943Srrs# (default: none). 118170744Srrs# 119170744Srrs# NCFTP - Full path to ncftp command if not in $PATH (default: ncftp). 120170744Srrs# NCFTPFLAGS - Arguments to ${NCFTP} (default: -N). 121170744Srrs# 122170744Srrs# 123170744Srrs# Default targets and their behaviors: 124163953Srrs# 125163953Srrs# fetch - Retrieves ${DISTFILES} (and ${PATCHFILES} if defined) 126163953Srrs# into ${DISTDIR} as necessary. 127164181Srrs# fetch-list - Show list of files that would be retrieved by fetch 128163953Srrs# extract - Unpacks ${DISTFILES} into ${WRKDIR}. 129170744Srrs# patch - Apply any provided patches to the source. 130163953Srrs# configure - Runs either GNU configure, one or more local configure 131170744Srrs# scripts or nothing, depending on what's available. 132170744Srrs# build - Actually compile the sources. 133170744Srrs# install - Install the results of a build. 134170744Srrs# reinstall - Install the results of a build, ignoring "already installed" 135170744Srrs# flag. 136170744Srrs# package - Create a package from an _installed_ port. 137171943Srrs# describe - Try to generate a one-line description for each port for 138170744Srrs# use in INDEX files and the like. 139170744Srrs# checksum - Use files/md5 to ensure that your distfiles are valid 140170744Srrs# makesum - Generate files/md5 (only do this for your own ports!) 141170744Srrs# 142170744Srrs# Default sequence for "all" is: fetch checksum extract patch configure build 143170744Srrs# 144163953Srrs# Please read the comments in the targets section below, you 145163953Srrs# should be able to use the pre-* or post-* targets/scripts 146163953Srrs# (which are available for every stage except checksum) or 147163953Srrs# override the do-* targets to do pretty much anything you want. 148163953Srrs# 149170744Srrs# NEVER override the "regular" targets unless you want to open 150163953Srrs# a major can of worms. 151170744Srrs 152170744Srrs.if exists(${.CURDIR}/../Makefile.inc) 153170744Srrs.include "${.CURDIR}/../Makefile.inc" 154170744Srrs.endif 155170744Srrs 156171943Srrs# These need to be absolute since we don't know how deep in the ports 157170744Srrs# tree we are and thus can't go relative. They can, of course, be overridden 158170744Srrs# by individual Makefiles. 159170744SrrsPORTSDIR?= ${DESTDIR}/usr/ports 160170744SrrsX11BASE?= /usr/X11R6 161170744SrrsDISTDIR?= ${PORTSDIR}/distfiles 162170744SrrsPACKAGES?= ${PORTSDIR}/packages 163163953Srrs.if !defined(NO_WRKDIR) 164163953SrrsWRKDIR?= ${.CURDIR}/work 165163953Srrs.else 166163953SrrsWRKDIR?= ${.CURDIR} 167163953Srrs.endif 168170744Srrs.if defined(NO_WRKSUBDIR) 169163953SrrsWRKSRC?= ${WRKDIR} 170170744Srrs.else 171170744SrrsWRKSRC?= ${WRKDIR}/${DISTNAME} 172170744Srrs.endif 173170744SrrsPATCHDIR?= ${.CURDIR}/patches 174170744SrrsSCRIPTDIR?= ${.CURDIR}/scripts 175171943SrrsFILESDIR?= ${.CURDIR}/files 176170744SrrsPKGDIR?= ${.CURDIR}/pkg 177170744Srrs.if defined(USE_IMAKE) || defined(USE_X11) 178170744SrrsPREFIX?= ${X11BASE} 179170744Srrs.else 180170744SrrsPREFIX?= /usr/local 181170744Srrs.endif 182163953Srrs.if defined(USE_GMAKE) 183163953SrrsEXEC_DEPENDS+= gmake:${PORTSDIR}/devel/gmake 184163953Srrs.endif 185163953Srrs 186163953Srrs.if exists(${PORTSDIR}/../Makefile.inc) 187170744Srrs.include "${PORTSDIR}/../Makefile.inc" 188163953Srrs.endif 189179141Srrs 190170744Srrs# Change these if you'd prefer to keep the cookies someplace else. 191170744SrrsEXTRACT_COOKIE?= ${WRKDIR}/.extract_done 192170744SrrsCONFIGURE_COOKIE?= ${WRKDIR}/.configure_done 193171943SrrsINSTALL_COOKIE?= ${WRKDIR}/.install_done 194170744SrrsBUILD_COOKIE?= ${WRKDIR}/.build_done 195170744SrrsPATCH_COOKIE?= ${WRKDIR}/.patch_done 196170744Srrs 197170744Srrs# How to do nothing. Override if you, for some strange reason, would rather 198170744Srrs# do something. 199170744SrrsDO_NADA?= echo -n 200163953Srrs 201163953Srrs# Miscellaneous overridable commands: 202163953SrrsGMAKE?= gmake 203240507StuexenXMKMF?= xmkmf -a 204163953SrrsMD5?= /sbin/md5 205170744SrrsMD5_FILE?= ${FILESDIR}/md5 206163953SrrsMAKE_FLAGS?= -f 207179141SrrsMAKEFILE?= Makefile 208170744Srrs 209170744SrrsNCFTP?= ncftp 210170744SrrsNCFTPFLAGS?= -N 211171943Srrs 212170744SrrsTOUCH?= touch 213170744SrrsTOUCH_FLAGS?= -f 214170744Srrs 215170744SrrsPATCH?= patch 216170744SrrsPATCH_STRIP?= -p0 217170744SrrsPATCH_DIST_STRIP?= -p0 218163953Srrs.if defined(PATCH_DEBUG) 219163953SrrsPATCH_ARGS?= -d ${WRKSRC} -E ${PATCH_STRIP} 220283708StuexenPATCH_DIST_ARGS?= -d ${WRKSRC} -E ${PATCH_DIST_STRIP} 221163953Srrs.else 222163953SrrsPATCH_ARGS?= -d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP} 223163953SrrsPATCH_DIST_ARGS?= -d ${WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP} 224170744Srrs.endif 225163953Srrs 226170744SrrsEXTRACT_CMD?= tar 227170744SrrsEXTRACT_SUFX?= .tar.gz 228170744Srrs# Backwards compatability. 229170744Srrs.if defined(EXTRACT_ARGS) 230165647SrrsEXTRACT_BEFORE_ARGS?= ${EXTRACT_ARGS} 231170744Srrs.else 232170744SrrsEXTRACT_BEFORE_ARGS?= -xzf 233163953Srrs.endif 234170744Srrs 235170744Srrs# Figure out where the local mtree file is 236163953Srrs.if !defined(MTREE_LOCAL) && exists(/etc/mtree/BSD.local.dist) 237171943SrrsMTREE_LOCAL= /etc/mtree/BSD.local.dist 238170744Srrs.endif 239170744Srrs 240170744SrrsPKG_CMD?= pkg_create 241170744Srrs.if !defined(PKG_ARGS) 242170744SrrsPKG_ARGS= -v -c ${PKGDIR}/COMMENT -d ${PKGDIR}/DESCR -f ${PKGDIR}/PLIST -p ${PREFIX} -P "`${MAKE} package-depends|sort|uniq`" 243170744Srrs.if exists(${PKGDIR}/INSTALL) 244163953SrrsPKG_ARGS+= -i ${PKGDIR}/INSTALL 245163953Srrs.endif 246163953Srrs.if exists(${PKGDIR}/DEINSTALL) 247283708StuexenPKG_ARGS+= -k ${PKGDIR}/DEINSTALL 248283708Stuexen.endif 249283708Stuexen.if exists(${PKGDIR}/REQ) 250283708StuexenPKG_ARGS+= -r ${PKGDIR}/REQ 251283708Stuexen.endif 252283708Stuexen.if !defined(USE_X11) && !defined(USE_IMAKE) && defined(MTREE_LOCAL) 253283708StuexenPKG_ARGS+= -m ${MTREE_LOCAL} 254283708Stuexen.endif 255283708Stuexen.endif 256283708StuexenPKG_SUFX?= .tgz 257283708Stuexen# where pkg_add records its dirty deeds. 258283708StuexenPKG_DBDIR?= /var/db/pkg 259240507Stuexen 260163953Srrs# Used to print all the '===>' style prompts - override this to turn them off. 261170744SrrsECHO_MSG?= echo 262163953Srrs 263163953SrrsALL_TARGET?= all 264169420SrrsINSTALL_TARGET?= install 265163953Srrs 266163953Srrs# If the user has this set, go to the FreeBSD respository for everything. 267170744Srrs.if defined(MASTER_SITE_FREEBSD) 268170744SrrsMASTER_SITE_OVERRIDE= ftp://freebsd.cdrom.com/pub/FreeBSD/FreeBSD-current/ports/distfiles/ 269170744Srrs.endif 270170744Srrs 271163953Srrs# I guess we're in the master distribution business! :) As we gain mirror 272170744Srrs# sites for distfiles, add them to this list. 273170744Srrs.if !defined(MASTER_SITE_OVERRIDE) 274163953SrrsMASTER_SITES+= ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports/distfiles/ 275170744SrrsPATCH_SITES+= ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports/distfiles/ 276170744Srrs.else 277163953SrrsMASTER_SITES= ${MASTER_SITE_OVERRIDE} 278171943SrrsPATCH_SITES= ${MASTER_SITE_OVERRIDE} 279170744Srrs.endif 280170744Srrs 281170744Srrs# Derived names so that they're easily overridable. 282170744SrrsDISTFILES?= ${DISTNAME}${EXTRACT_SUFX} 283170744SrrsPKGNAME?= ${DISTNAME} 284170744Srrs 285163953Srrs# Documentation 286163953SrrsMAINTAINER?= ports@FreeBSD.ORG 287163953SrrsCATEGORIES?= orphans 288163953SrrsCATEGORIES+= all 289163953SrrsKEYWORDS+= ${CATEGORIES} 290170744Srrs 291163953SrrsPKGREPOSITORYSUBDIR?= .packages 292170744SrrsPKGREPOSITORY?= ${PACKAGES}/${PKGREPOSITORYSUBDIR} 293163953Srrs.if exists(${PACKAGES}) 294170744SrrsPKGFILE?= ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX} 295163953Srrs.else 296170744SrrsPKGFILE?= ${PKGNAME}${PKG_SUFX} 297163953Srrs.endif 298170744Srrs 299163953SrrsCONFIGURE_SCRIPT?= configure 300170744Srrs 301163953Srrs.if defined(GNU_CONFIGURE) 302163953SrrsCONFIGURE_ARGS?= --prefix=${PREFIX} 303170744SrrsHAS_CONFIGURE= yes 304170744Srrs.endif 305170744Srrs 306170744Srrs.MAIN: all 307170744Srrs 308163953Srrs################################################################ 309163953Srrs# If we're in BATCH mode and the port is interactive, or we're 310170744Srrs# in interactive mode and the port is non-interactive, skip all 311163953Srrs# the important targets. The reason we have two modes is that 312170744Srrs# one might want to leave a build in BATCH mode running 313171943Srrs# overnight, then come back in the morning and do _only_ the 314170744Srrs# interactive ones that required your intervention. 315170744Srrs# 316170744Srrs# This allows you to do both. 317170744Srrs################################################################ 318170744Srrs 319170744Srrs.if (defined(IS_INTERACTIVE) && defined(BATCH)) || (!defined(IS_INTERACTIVE) && defined(INTERACTIVE)) 320163953Srrsall: 321163953Srrs @${DO_NADA} 322163953Srrsbuild: 323163953Srrs @${DO_NADA} 324163953Srrsinstall: 325170744Srrs @${DO_NADA} 326163953Srrsfetch: 327179141Srrs @${DO_NADA} 328164085Srrsconfigure: 329170744Srrs @${DO_NADA} 330164085Srrspackage: 331164085Srrs @${DO_NADA} 332170744Srrs.endif 333164085Srrs 334170744Srrs.if !target(all) 335163953Srrsall: build 336170744Srrs.endif 337163953Srrs 338170744Srrs.if !target(is_depended) 339163953Srrsis_depended: install 340163953Srrs.endif 341170744Srrs 342170744Srrs################################################################ 343163953Srrs# The following are used to create easy dummy targets for 344170744Srrs# disabling some bit of default target behavior you don't want. 345170744Srrs# They still check to see if the target exists, and if so don't 346163953Srrs# do anything, since you might want to set this globally for a 347179783Srrs# group of ports in a Makefile.inc, but still be able to 348212225Srrs# override from an individual Makefile (since you can't _ 349170744Srrs# undefine_ a variable in make!). 350170744Srrs################################################################ 351170744Srrs 352163953Srrs.if defined(NO_EXTRACT) && !target(extract) 353170744Srrsextract: 354170744Srrs @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE} 355170744Srrschecksum: 356163953Srrs @${DO_NADA} 357171943Srrsmakesum: 358170744Srrs @${DO_NADA} 359170744Srrs.endif 360170744Srrs.if defined(NO_CONFIGURE) && !target(configure) 361170744Srrsconfigure: 362170744Srrs @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE} 363170744Srrs.endif 364163953Srrs.if defined(NO_BUILD) && !target(build) 365163953Srrsbuild: 366163953Srrs @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE} 367163953Srrs.endif 368163953Srrs.if defined(NO_PACKAGE) && !target(package) 369170744Srrspackage: 370163953Srrs @${DO_NADA} 371179141Srrs.endif 372170744Srrs.if defined(NO_PACKAGE) && !target(repackage) 373170744Srrsrepackage: 374170744Srrs @${DO_NADA} 375170744Srrs.endif 376163953Srrs.if defined(NO_INSTALL) && !target(install) 377170744Srrsinstall: 378163953Srrs @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE} 379170744Srrs.endif 380163953Srrs.if defined(NO_PATCH) && !target(patch) 381170744Srrspatch: 382163953Srrs @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 383170744Srrs.endif 384171943Srrs 385170744Srrs################################################################ 386170744Srrs# More standard targets start here. 387170744Srrs# 388170744Srrs# These are the body of the build/install framework. If you are 389170744Srrs# not happy with the default actions, and you can't solve it by 390170744Srrs# adding pre-* or post-* targets/scripts, override these. 391163953Srrs################################################################ 392163953Srrs 393163953Srrs# Fetch 394163953Srrs 395163953Srrs.if !target(do-fetch) 396170744Srrsdo-fetch: 397163953Srrs @if [ ! -d ${DISTDIR} ]; then mkdir -p ${DISTDIR}; fi 398170744Srrs @(cd ${DISTDIR}; \ 399170744Srrs for file in ${DISTFILES}; do \ 400170744Srrs if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 401170744Srrs ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \ 402171943Srrs for site in ${MASTER_SITES}; do \ 403170744Srrs ${ECHO_MSG} ">> Attempting to fetch from $${site}"; \ 404170744Srrs if ${NCFTP} ${NCFTPFLAGS} $${site}$${file}; then \ 405170744Srrs break; \ 406170744Srrs fi \ 407170744Srrs done; \ 408170744Srrs if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 409163953Srrs ${ECHO_MSG} ">> Couldn't fetch it - please try to retreive this";\ 410163953Srrs ${ECHO_MSG} ">> port manually into ${DISTDIR} and try again."; \ 411163953Srrs exit 1; \ 412163953Srrs fi; \ 413163953Srrs fi \ 414170744Srrs done) 415163953Srrs.if defined(PATCHFILES) 416170744Srrs @(cd ${DISTDIR}; \ 417170744Srrs for file in ${PATCHFILES}; do \ 418170744Srrs if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 419170744Srrs ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \ 420171943Srrs for site in ${PATCH_SITES}; do \ 421170744Srrs ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \ 422170744Srrs if ${NCFTP} ${NCFTPFLAGS} $${site}$${file}; then \ 423170744Srrs break; \ 424170744Srrs fi \ 425170744Srrs done; \ 426170744Srrs if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 427163953Srrs ${ECHO_MSG} ">> Couldn't fetch it - please try to retreive this";\ 428163953Srrs ${ECHO_MSG} ">> port manually into ${DISTDIR} and try again."; \ 429283708Stuexen exit 1; \ 430283708Stuexen fi; \ 431163953Srrs fi \ 432163953Srrs done) 433170744Srrs.endif 434163953Srrs.endif 435170744Srrs 436170744Srrs# Extract 437170744Srrs 438170744Srrs.if !target(do-extract) 439171943Srrsdo-extract: 440170744Srrs @rm -rf ${WRKDIR} 441170744Srrs @mkdir -p ${WRKDIR} 442170744Srrs.if defined(EXTRACT_ONLY) 443170744Srrs @for file in ${EXTRACT_ONLY}; do \ 444170744Srrs if ! (cd ${WRKDIR};${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\ 445170744Srrs then \ 446163953Srrs exit 1; \ 447163953Srrs fi \ 448283708Stuexen done 449283708Stuexen.else 450163953Srrs @for file in ${DISTFILES}; do \ 451163953Srrs if ! (cd ${WRKDIR};${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\ 452163953Srrs then \ 453171943Srrs exit 1; \ 454170744Srrs fi \ 455170744Srrs done 456170744Srrs.endif 457163953Srrs.endif 458163953Srrs 459163953Srrs# Patch 460228653Stuexen 461163953Srrs.if !target(do-patch) 462170744Srrsdo-patch: 463163953Srrs.if defined(PATCHFILES) 464170744Srrs @${ECHO_MSG} "===> Applying distributed patches for ${PKGNAME}" 465170744Srrs.if defined(PATCH_DEBUG) 466170744Srrs @(cd ${DISTDIR}; \ 467170744Srrs for i in ${PATCHFILES}; do \ 468170744Srrs ${ECHO_MSG} "===> Applying distributed patch $$i" ; \ 469163953Srrs case $$i in \ 470163953Srrs *.Z|*.gz) \ 471170744Srrs zcat $$i | ${PATCH} ${PATCH_DIST_ARGS}; \ 472163953Srrs ;; \ 473170744Srrs *) \ 474163953Srrs ${PATCH} ${PATCH_DIST_ARGS} < $$i; \ 475163953Srrs ;; \ 476170744Srrs esac; \ 477163953Srrs done) 478170744Srrs.else 479163953Srrs @(cd ${DISTDIR}; \ 480170744Srrs for i in ${PATCHFILES}; do \ 481163953Srrs case $$i in \ 482163953Srrs *.Z|*.gz) \ 483170744Srrs zcat $$i | ${PATCH} ${PATCH_DIST_ARGS}; \ 484163953Srrs ;; \ 485170744Srrs *) \ 486163953Srrs ${PATCH} ${PATCH_DIST_ARGS} < $$i; \ 487170744Srrs ;; \ 488163953Srrs esac; \ 489163953Srrs done) 490163953Srrs.endif 491163953Srrs.endif 492170744Srrs.if defined(PATCH_DEBUG) 493163953Srrs @if [ -d ${PATCHDIR} ]; then \ 494170744Srrs ${ECHO_MSG} "===> Applying FreeBSD patches for ${PKGNAME}" ; \ 495163953Srrs for i in ${PATCHDIR}/patch-*; do \ 496171943Srrs ${ECHO_MSG} "===> Applying FreeBSD patch $$i" ; \ 497170744Srrs ${PATCH} ${PATCH_ARGS} < $$i; \ 498170744Srrs done; \ 499170744Srrs fi 500170744Srrs @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 501170744Srrs.else 502170744Srrs @if [ -d ${PATCHDIR} ]; then \ 503163953Srrs ${ECHO_MSG} "===> Applying FreeBSD patches for ${PKGNAME}" ; \ 504163953Srrs for i in ${PATCHDIR}/patch-*; \ 505163953Srrs do ${PATCH} ${PATCH_ARGS} < $$i; \ 506228653Stuexen done;\ 507163953Srrs fi 508170744Srrs @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 509163953Srrs.endif 510170744Srrs.endif 511170744Srrs 512170744Srrs# Configure 513170744Srrs 514170744Srrs.if !target(do-configure) 515170744Srrsdo-configure: 516170744Srrs @if [ -f ${SCRIPTDIR}/configure ]; then \ 517171943Srrs env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 518170744Srrs WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 519170744Srrs FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 520170744Srrs DEPENDS="${DEPENDS}" \ 521170744Srrs sh ${SCRIPTDIR}/configure; \ 522170744Srrs fi 523170744Srrs.if defined(HAS_CONFIGURE) 524163953Srrs @(cd ${WRKSRC}; CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \ 525163953Srrs INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \ 526163953Srrs INSTALL_PROGRAM="/usr/bin/install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}" \ 527228653Stuexen ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}) 528163953Srrs.endif 529170744Srrs.if defined(USE_IMAKE) 530163953Srrs.if defined(USE_GMAKE) 531163953Srrs @(cd ${WRKSRC}; ${XMKMF} && ${GMAKE} Makefiles) 532163953Srrs.else 533163953Srrs @(cd ${WRKSRC}; ${XMKMF} && ${MAKE} Makefiles) 534163953Srrs.endif 535163953Srrs.endif 536163953Srrs.endif 537163953Srrs 538163953Srrs# Build 539163953Srrs 540163953Srrs.if !target(do-build) 541163953Srrsdo-build: 542163953Srrs.if defined(USE_GMAKE) 543163953Srrs @(cd ${WRKSRC}; ${GMAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET}) 544163953Srrs.else defined(USE_GMAKE) 545163953Srrs @(cd ${WRKSRC}; ${MAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET}) 546163953Srrs.endif 547163953Srrs.endif 548163953Srrs 549169420Srrs# Install 550163953Srrs 551163953Srrs.if !target(do-install) 552169420Srrsdo-install: 553163953Srrs.if defined(USE_GMAKE) 554163953Srrs @(cd ${WRKSRC}; ${GMAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET}) 555169420Srrs.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES) 556163953Srrs @(cd ${WRKSRC}; ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man) 557163953Srrs.endif 558169420Srrs.else defined(USE_GMAKE) 559163953Srrs @(cd ${WRKSRC}; ${MAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET}) 560163953Srrs.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES) 561163953Srrs @(cd ${WRKSRC}; ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man) 562169420Srrs.endif 563163953Srrs.endif 564163953Srrs.if !defined(NO_PACKAGE) 565163953Srrs @${MAKE} ${.MAKEFLAGS} fake-pkg 566163953Srrs.endif 567163953Srrs.endif 568169420Srrs 569163953Srrs################################################################ 570163953Srrs# Skeleton targets start here 571169420Srrs# 572163953Srrs# You shouldn't have to change these. Either add the pre-* or 573163953Srrs# post-* targets/scripts or redefine the do-* targets. These 574169420Srrs# targets don't do anything other than checking for cookies and 575163953Srrs# call the necessary targets/scripts. 576163953Srrs################################################################ 577169420Srrs 578163953Srrs# Fetch 579163953Srrs 580163953Srrs.if !target(fetch) 581169420Srrsfetch: depends 582163953Srrs.if target(pre-fetch) 583169420Srrs @${MAKE} ${.MAKEFLAGS} pre-fetch 584163953Srrs.endif 585163953Srrs @if [ -f ${SCRIPTDIR}/pre-fetch ]; then \ 586163953Srrs env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 587163953Srrs WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 588163953Srrs FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 589163953Srrs DEPENDS="${DEPENDS}" \ 590163953Srrs sh ${SCRIPTDIR}/pre-fetch; \ 591163953Srrs fi 592163953Srrs @${MAKE} ${.MAKEFLAGS} do-fetch 593163953Srrs.if target(post-fetch) 594163953Srrs @${MAKE} ${.MAKEFLAGS} post-fetch 595163953Srrs.endif 596163953Srrs @if [ -f ${SCRIPTDIR}/post-fetch ]; then \ 597163953Srrs env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 598163953Srrs WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 599163953Srrs FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 600163953Srrs DEPENDS="${DEPENDS}" \ 601163953Srrs sh ${SCRIPTDIR}/post-fetch; \ 602163953Srrs fi 603163953Srrs.endif 604163953Srrs 605163953Srrs# Extract 606163953Srrs 607163953Srrs.if !target(extract) 608163953Srrsextract: checksum ${EXTRACT_COOKIE} 609163953Srrs 610163953Srrs${EXTRACT_COOKIE}: 611163953Srrs @${ECHO_MSG} "===> Extracting for ${PKGNAME}" 612163953Srrs.if target(pre-extract) 613163953Srrs @${MAKE} ${.MAKEFLAGS} pre-extract 614163953Srrs.endif 615163953Srrs @if [ -f ${SCRIPTDIR}/pre-extract ]; then \ 616163953Srrs env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 617163953Srrs WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 618163953Srrs FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 619163953Srrs DEPENDS="${DEPENDS}" \ 620163953Srrs sh ${SCRIPTDIR}/pre-extract; \ 621163953Srrs fi 622163953Srrs @${MAKE} ${.MAKEFLAGS} do-extract 623163953Srrs.if target(post-extract) 624163953Srrs @${MAKE} ${.MAKEFLAGS} post-extract 625163953Srrs.endif 626163953Srrs @if [ -f ${SCRIPTDIR}/post-extract ]; then \ 627163953Srrs env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 628163953Srrs WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 629163953Srrs FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 630163953Srrs DEPENDS="${DEPENDS}" \ 631163953Srrs sh ${SCRIPTDIR}/post-extract; \ 632163953Srrs fi 633163953Srrs @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE} 634163953Srrs.endif 635163953Srrs 636163953Srrs# Patch 637163953Srrs 638163953Srrs.if !target(patch) 639163953Srrspatch: extract ${PATCH_COOKIE} 640163953Srrs 641163953Srrs${PATCH_COOKIE}: 642163953Srrs @${ECHO_MSG} "===> Patching for ${PKGNAME}" 643169420Srrs.if target(pre-patch) 644163953Srrs @${MAKE} ${.MAKEFLAGS} pre-patch 645163953Srrs.endif 646163953Srrs @if [ -f ${SCRIPTDIR}/pre-patch ]; then \ 647163953Srrs env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 648163953Srrs WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 649163953Srrs FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 650163953Srrs DEPENDS="${DEPENDS}" \ 651163953Srrs sh ${SCRIPTDIR}/pre-patch; \ 652163953Srrs fi 653163953Srrs @${MAKE} ${.MAKEFLAGS} do-patch 654163953Srrs.if target(post-patch) 655163953Srrs @${MAKE} ${.MAKEFLAGS} post-patch 656163953Srrs.endif 657163953Srrs @if [ -f ${SCRIPTDIR}/post-patch ]; then \ 658163953Srrs env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 659163953Srrs WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 660163953Srrs FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 661163953Srrs DEPENDS="${DEPENDS}" \ 662163953Srrs sh ${SCRIPTDIR}/post-patch; \ 663169420Srrs fi 664163953Srrs @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 665163953Srrs.endif 666163953Srrs 667163953Srrs# Configure 668163953Srrs 669163953Srrs.if !target(configure) 670163953Srrsconfigure: patch ${CONFIGURE_COOKIE} 671163953Srrs 672163953Srrs${CONFIGURE_COOKIE}: 673163953Srrs @${ECHO_MSG} "===> Configuring for ${PKGNAME}" 674163953Srrs.if target(pre-configure) 675207099Stuexen @${MAKE} ${.MAKEFLAGS} pre-configure 676163953Srrs.endif 677163953Srrs @if [ -f ${SCRIPTDIR}/pre-configure ]; then \ 678163953Srrs env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 679163953Srrs WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 680163953Srrs FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 681163953Srrs DEPENDS="${DEPENDS}" \ 682163953Srrs sh ${SCRIPTDIR}/pre-configure; \ 683163953Srrs fi 684163953Srrs @${MAKE} ${.MAKEFLAGS} do-configure 685163953Srrs.if target(post-configure) 686163953Srrs @${MAKE} ${.MAKEFLAGS} post-configure 687163953Srrs.endif 688163953Srrs @if [ -f ${SCRIPTDIR}/post-configure ]; then \ 689163953Srrs env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 690163953Srrs WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 691169420Srrs FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 692163953Srrs DEPENDS="${DEPENDS}" \ 693163953Srrs sh ${SCRIPTDIR}/post-configure; \ 694163953Srrs fi 695163953Srrs @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE} 696163953Srrs.endif 697163953Srrs 698163953Srrs# Build 699163953Srrs 700163953Srrs.if !target(build) 701163953Srrsbuild: configure ${BUILD_COOKIE} 702163953Srrs 703163953Srrs${BUILD_COOKIE}: 704207099Stuexen @${ECHO_MSG} "===> Building for ${PKGNAME}" 705240148Stuexen.if target(pre-build) 706169420Srrs @${MAKE} ${.MAKEFLAGS} pre-build 707163953Srrs.endif 708163953Srrs @if [ -f ${SCRIPTDIR}/pre-build ]; then \ 709163953Srrs env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 710163953Srrs WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 711163953Srrs FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 712163953Srrs DEPENDS="${DEPENDS}" \ 713163953Srrs sh ${SCRIPTDIR}/pre-build; \ 714163953Srrs fi 715163953Srrs @${MAKE} ${.MAKEFLAGS} do-build 716163953Srrs.if target(post-build) 717163953Srrs @${MAKE} ${.MAKEFLAGS} post-build 718163953Srrs.endif 719163953Srrs @if [ -f ${SCRIPTDIR}/post-build ]; then \ 720163953Srrs env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 721163953Srrs WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 722163953Srrs FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 723163953Srrs DEPENDS="${DEPENDS}" \ 724163953Srrs sh ${SCRIPTDIR}/post-build; \ 725163953Srrs fi 726163953Srrs @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE} 727163953Srrs.endif 728163953Srrs 729163953Srrs# Install 730163953Srrs 731214918Stuexen.if !target(install) 732214918Stuexeninstall: build ${INSTALL_COOKIE} 733214918Stuexen 734214918Stuexen${INSTALL_COOKIE}: 735214918Stuexen @${ECHO_MSG} "===> Installing for ${PKGNAME}" 736214918Stuexen.if target(pre-install) 737214918Stuexen @${MAKE} ${.MAKEFLAGS} pre-install 738214918Stuexen.endif 739214918Stuexen @if [ -f ${SCRIPTDIR}/pre-install ]; then \ 740214918Stuexen env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 741214918Stuexen WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 742214918Stuexen FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 743214918Stuexen DEPENDS="${DEPENDS}" \ 744214918Stuexen sh ${SCRIPTDIR}/pre-install; \ 745214918Stuexen fi 746214918Stuexen @${MAKE} ${.MAKEFLAGS} do-install 747214918Stuexen.if target(post-install) 748214918Stuexen @${MAKE} ${.MAKEFLAGS} post-install 749214918Stuexen.endif 750224641Stuexen @if [ -f ${SCRIPTDIR}/post-install ]; then \ 751214918Stuexen env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 752214918Stuexen WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 753214918Stuexen FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 754214918Stuexen DEPENDS="${DEPENDS}" \ 755163953Srrs sh ${SCRIPTDIR}/post-install; \ 756163953Srrs fi 757163953Srrs @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE} 758214939Stuexen.endif 759163953Srrs 760163953Srrs# Reinstall 761163953Srrs# 762163953Srrs# This is a special target to re-run install 763163953Srrs 764163953Srrs.if !target(reinstall) 765163953Srrsreinstall: pre-reinstall install 766163953Srrs 767163953Srrspre-reinstall: 768163953Srrs @rm -f ${INSTALL_COOKIE} 769163953Srrs.endif 770163953Srrs 771163953Srrs################################################################ 772163953Srrs# Some more targets supplied for users' convenience 773163953Srrs################################################################ 774163953Srrs 775163953Srrs# Cleaning up 776163953Srrs 777163953Srrs.if !target(pre-clean) 778163953Srrspre-clean: 779214939Stuexen @${DO_NADA} 780214939Stuexen.endif 781214939Stuexen 782214939Stuexen.if !target(clean) 783214939Stuexenclean: pre-clean 784214939Stuexen @${ECHO_MSG} "===> Cleaning for ${PKGNAME}" 785163953Srrs @rm -f ${EXTRACT_COOKIE} ${CONFIGURE_COOKIE} ${INSTALL_COOKIE} \ 786214939Stuexen ${BUILD_COOKIE} ${PATCH_COOKIE} 787163953Srrs.if !defined(NO_WRKDIR) 788214939Stuexen @rm -rf ${WRKDIR} 789214939Stuexen.endif 790214939Stuexen.endif 791214939Stuexen 792214939Stuexen# Prints out a list of files to fetch (useful to do a batch fetch) 793163953Srrs 794163953Srrs.if !target(fetch-list) 795163953Srrsfetch-list: 796214939Stuexen @if [ ! -d ${DISTDIR} ]; then mkdir -p ${DISTDIR}; fi 797163953Srrs @(cd ${DISTDIR}; \ 798163953Srrs for file in ${DISTFILES}; do \ 799214939Stuexen if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 800214939Stuexen for site in ${MASTER_SITES}; do \ 801214939Stuexen echo -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} '||' ; \ 802214939Stuexen break; \ 803214939Stuexen done; \ 804228653Stuexen echo "echo $${file} not fetched" ; \ 805214939Stuexen fi \ 806214939Stuexen done) 807214939Stuexen.if defined(PATCHFILES) 808214939Stuexen @(cd ${DISTDIR}; \ 809214939Stuexen for file in ${PATCHFILES}; do \ 810214939Stuexen if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 811214939Stuexen for site in ${PATCH_SITES}; do \ 812214939Stuexen echo -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} '||' ; \ 813214939Stuexen break; \ 814214939Stuexen done; \ 815214939Stuexen echo "echo $${file} not fetched" ; \ 816214939Stuexen fi \ 817163953Srrs done) 818163953Srrs.endif 819163953Srrs.endif 820163953Srrs 821163953Srrs# Checksumming utilities 822163953Srrs 823163953Srrs.if !target(makesum) 824163953Srrsmakesum: fetch 825169352Srrs @if [ ! -d ${FILESDIR} ]; then mkdir -p ${FILESDIR}; fi 826163953Srrs @if [ -f ${MD5_FILE} ]; then rm -f ${MD5_FILE}; fi 827163953Srrs @(cd ${DISTDIR}; \ 828163953Srrs for file in ${DISTFILES} ${PATCHFILES}; do \ 829163953Srrs ${MD5} $$file >> ${MD5_FILE}; \ 830169420Srrs done) 831163953Srrs.endif 832163953Srrs 833163953Srrs.if !target(checksum) 834163953Srrschecksum: fetch 835163953Srrs @if [ ! -f ${MD5_FILE} ]; then \ 836163953Srrs ${ECHO_MSG} ">> No MD5 checksum file."; \ 837172091Srrs else \ 838163953Srrs (cd ${DISTDIR}; OK=""; \ 839163953Srrs for file in ${DISTFILES} ${PATCHFILES}; do \ 840163953Srrs CKSUM=`${MD5} $$file | awk '{print $$4}'`; \ 841163953Srrs CKSUM2=`grep "($$file)" ${MD5_FILE} | awk '{print $$4}'`; \ 842163953Srrs if [ "$$CKSUM2" = "" ]; then \ 843163953Srrs ${ECHO_MSG} ">> No checksum recorded for $$file"; \ 844165647Srrs OK="false"; \ 845163953Srrs elif [ "$$CKSUM" != "$$CKSUM2" ]; then \ 846172091Srrs ${ECHO_MSG} ">> Checksum mismatch for $$file"; \ 847163953Srrs exit 1; \ 848172091Srrs fi; \ 849163953Srrs done; \ 850163953Srrs if [ "$$OK" = "" ]; then \ 851172091Srrs ${ECHO_MSG} "Checksums OK."; \ 852172091Srrs else \ 853163953Srrs ${ECHO_MSG} "Checksums OK for files that have them."; \ 854163953Srrs fi) ; \ 855172091Srrs fi 856172091Srrs.endif 857172091Srrs 858172091Srrs################################################################ 859172091Srrs# The package-building targets 860172091Srrs# You probably won't need to touch these 861172091Srrs################################################################ 862172091Srrs 863172091Srrs# Nobody should want to override this unless PKGNAME is simply bogus. 864172091Srrs.if !target(package-name) 865163953Srrspackage-name: 866172091Srrs.if !defined(NO_PACKAGE) 867163953Srrs @echo ${PKGNAME} 868172091Srrs.endif 869165647Srrs.endif 870163953Srrs 871163953Srrs# Show (recursively) all the packages this package depends on. 872163953Srrs.if !target(package-depends) 873163953Srrspackage-depends: 874163953Srrs @for i in ${EXEC_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \ 875228653Stuexen dir=`echo $$i | sed -e 's/.*://'`; \ 876163953Srrs (cd $$dir ; ${MAKE} package-name package-depends); \ 877228653Stuexen done 878163953Srrs.endif 879163953Srrs 880228653Stuexen# Build a package 881228653Stuexen 882228653Stuexen.if !target(package) 883228653Stuexenpackage: install 884172091Srrs.if target(pre-package) 885163953Srrs @${MAKE} ${.MAKEFLAGS} pre-package 886163953Srrs.endif 887163953Srrs @${MAKE} ${.MAKEFLAGS} do-package 888163953Srrs.endif 889228653Stuexen 890228653Stuexen# Build a package but don't check the cookie for installation 891163953Srrs 892163953Srrs.if !target(repackage) 893163953Srrsrepackage: 894163953Srrs.if target(pre-package) 895163953Srrs @${MAKE} ${.MAKEFLAGS} pre-package 896294149Stuexen.endif 897294149Stuexen @${MAKE} ${.MAKEFLAGS} do-package 898294149Stuexen.endif 899294149Stuexen 900294149Stuexen# The body of the package-building target 901294149Stuexen 902294149Stuexen.if !target(do-package) 903294149Stuexendo-package: 904294149Stuexen @if [ -e ${PKGDIR}/PLIST ]; then \ 905294149Stuexen ${ECHO_MSG} "===> Building package for ${PKGNAME}"; \ 906294149Stuexen if [ -d ${PACKAGES} ]; then \ 907294149Stuexen if [ ! -d ${PKGREPOSITORY} ]; then \ 908294149Stuexen if ! mkdir -p ${PKGREPOSITORY}; then \ 909294149Stuexen ${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \ 910294149Stuexen exit 1; \ 911294149Stuexen fi; \ 912294149Stuexen fi; \ 913294149Stuexen fi; \ 914294149Stuexen ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; \ 915294149Stuexen if [ -d ${PACKAGES} ]; then \ 916294149Stuexen rm -f ${PACKAGES}/*/${PKGNAME}${PKG_SUFX}; \ 917294149Stuexen for cat in ${CATEGORIES}; do \ 918294149Stuexen if [ ! -d ${PACKAGES}/$$cat ]; then \ 919294149Stuexen if ! mkdir -p ${PACKAGES}/$$cat; then \ 920294149Stuexen ${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \ 921294149Stuexen exit 1; \ 922294149Stuexen fi; \ 923294149Stuexen fi; \ 924294149Stuexen ln -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \ 925294149Stuexen done; \ 926294149Stuexen fi; \ 927294149Stuexen fi 928294149Stuexen.endif 929294149Stuexen 930294149Stuexen################################################################ 931294149Stuexen# Dependency checking 932294149Stuexen################################################################ 933294149Stuexen 934294149Stuexen.if !target(depends) 935294149Stuexendepends: exec_depends lib_depends misc_depends 936294149Stuexen 937294149Stuexenexec_depends: 938294149Stuexen.if defined(EXEC_DEPENDS) 939163953Srrs.if defined(NO_DEPENDS) 940246595Stuexen# Just print out messages 941294215Stuexen @for i in ${EXEC_DEPENDS}; do \ 942163953Srrs prog=`echo $$i | sed -e 's/:.*//'`; \ 943170138Srrs dir=`echo $$i | sed -e 's/.*://'`; \ 944170138Srrs ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog ($$dir)"; \ 945163953Srrs done 946163953Srrs.else 947163953Srrs @for i in ${EXEC_DEPENDS}; do \ 948163953Srrs prog=`echo $$i | sed -e 's/:.*//'`; \ 949163953Srrs dir=`echo $$i | sed -e 's/.*://'`; \ 950163953Srrs if which -s "$$prog"; then \ 951163953Srrs ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog - found"; \ 952163953Srrs else \ 953163953Srrs ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog - not found"; \ 954163953Srrs ${ECHO_MSG} "===> Verifying build for $$prog in $$dir"; \ 955163953Srrs if [ ! -d "$$dir" ]; then \ 956163953Srrs ${ECHO_MSG} ">> No directory for $$prog. Skipping.."; \ 957163953Srrs else \ 958270363Stuexen (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 959270363Stuexen ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \ 960270363Stuexen fi; \ 961270363Stuexen fi; \ 962270363Stuexen done 963170138Srrs.endif 964163953Srrs.else 965171943Srrs @${DO_NADA} 966246595Stuexen.endif 967246595Stuexen 968246595Stuexenlib_depends: 969246595Stuexen.if defined(LIB_DEPENDS) 970246595Stuexen.if defined(NO_DEPENDS) 971270356Stuexen# Just print out messages 972270357Stuexen @for i in ${LIB_DEPENDS}; do \ 973270362Stuexen lib=`echo $$i | sed -e 's/:.*//'`; \ 974270362Stuexen dir=`echo $$i | sed -e 's/.*://'`; \ 975270361Stuexen ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$lib ($$dir)"; \ 976270359Stuexen done 977270360Stuexen.else 978224641Stuexen @for i in ${LIB_DEPENDS}; do \ 979246595Stuexen lib=`echo $$i | sed -e 's/:.*//'`; \ 980246595Stuexen dir=`echo $$i | sed -e 's/.*://'`; \ 981246595Stuexen if ldconfig -r | grep -q -e "-l$$lib"; then \ 982283724Stuexen ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$lib - found"; \ 983167598Srrs else \ 984246595Stuexen ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$lib - not found"; \ 985246595Stuexen ${ECHO_MSG} "===> Verifying build for $$lib in $$dir"; \ 986225549Stuexen if [ ! -d "$$dir" ]; then \ 987246595Stuexen ${ECHO_MSG} ">> No directory for $$lib. Skipping.."; \ 988246595Stuexen else \ 989225549Stuexen (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 990225549Stuexen ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \ 991225549Stuexen fi; \ 992225549Stuexen fi; \ 993225549Stuexen done 994225549Stuexen.endif 995163953Srrs.else 996174257Srrs @${DO_NADA} 997163953Srrs.endif 998185694Srrs 999163953Srrsmisc_depends: 1000246595Stuexen.if defined(DEPENDS) 1001163953Srrs @${ECHO_MSG} "===> ${PKGNAME} depends on: ${DEPENDS}" 1002164144Srrs.if !defined(NO_DEPENDS) 1003246595Stuexen @for i in ${DEPENDS}; do \ 1004246595Stuexen ${ECHO_MSG} "===> Verifying build for $$i"; \ 1005167598Srrs if [ ! -d $$i ]; then \ 1006164144Srrs ${ECHO_MSG} ">> No directory for $$i. Skipping.."; \ 1007171477Srrs else \ 1008171477Srrs (cd $$i; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 1009171477Srrs fi \ 1010171477Srrs done 1011171477Srrs @${ECHO_MSG} "===> Returning to build of ${PKGNAME}" 1012171477Srrs.endif 1013172703Srrs.else 1014171477Srrs @${DO_NADA} 1015171477Srrs.endif 1016171477Srrs 1017171477Srrs.endif 1018163953Srrs 1019163953Srrs################################################################ 1020163953Srrs# Everything after here are internal targets and really 1021246595Stuexen# shouldn't be touched by anybody but the release engineers. 1022179157Srrs################################################################ 1023163953Srrs 1024185694Srrs# This target generates an index entry suitable for aggregation into 1025163953Srrs# a large index. Format is: 1026163953Srrs# 1027163953Srrs# distribution-name|port-path|installation-prefix|comment| \ 1028190689Srrs# description-file|maintainer|categories|keywords 1029163953Srrs# 1030163953Srrs.if !target(describe) 1031163953Srrsdescribe: 1032163953Srrs @echo -n "${PKGNAME}|${.CURDIR}/${PKGNAME}|" 1033163953Srrs @echo -n "${PREFIX}|" 1034163953Srrs @if [ -f ${PKGDIR}/COMMENT ]; then \ 1035163953Srrs echo -n "`cat ${PKGDIR}/COMMENT`"; \ 1036163953Srrs else \ 1037163953Srrs echo -n "** No Description"; \ 1038246595Stuexen fi 1039246595Stuexen @if [ -f ${PKGDIR}/DESCR ]; then \ 1040163953Srrs echo -n "|${PKGDIR}/DESCR"; \ 1041246595Stuexen else \ 1042246595Stuexen echo -n "|/dev/null"; \ 1043246595Stuexen fi 1044246595Stuexen @echo -n "|${MAINTAINER}|${CATEGORIES}|${KEYWORDS}" 1045163953Srrs @echo "" 1046163953Srrs.endif 1047163953Srrs 1048246595Stuexen# Fake installation of package so that user can pkg_delete it later. 1049246595Stuexen# Also, make sure that an installed port is recognized correctly in 1050246595Stuexen# accordance to the @pkgdep directive in the packing lists 1051246595Stuexen 1052246595Stuexen.if !target(fake-pkg) 1053163953Srrs.if !defined(NO_PACKAGE) 1054163953Srrsfake-pkg: 1055163953Srrs @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 1056246595Stuexen @if [ ! -d ${PKG_DBDIR} ]; then rm -f ${PKG_DBDIR}; mkdir -p ${PKG_DBDIR}; fi 1057246595Stuexen @if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \ 1058246595Stuexen ${ECHO_MSG} "===> Registering installation for ${PKGNAME}"; \ 1059246595Stuexen mkdir -p ${PKG_DBDIR}/${PKGNAME}; \ 1060163953Srrs ${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \ 1061246595Stuexen cp ${PKGDIR}/DESCR ${PKG_DBDIR}/${PKGNAME}/+DESC; \ 1062163953Srrs cp ${PKGDIR}/COMMENT ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \ 1063163953Srrs else \ 1064246595Stuexen ${ECHO_MSG} "===> ${PKGNAME} is already installed - perhaps an older version?"; \ 1065246595Stuexen ${ECHO_MSG} " If so, you may wish to \`\`pkg_delete ${PKGNAME}'' and install"; \ 1066163953Srrs ${ECHO_MSG} " this port again to upgrade it properly."; \ 1067163953Srrs fi 1068246595Stuexen.endif 1069246595Stuexen.endif 1070163953Srrs 1071246595Stuexen# Depend is generally meaningless for arbitrary ports, but if someone wants 1072246595Stuexen# one they can override this. This is just to catch people who've gotten into 1073246595Stuexen# the habit of typing `make depend all install' as a matter of course. 1074163953Srrs# 1075163953Srrs.if !target(depend) 1076163953Srrsdepend: 1077163953Srrs.endif 1078163953Srrs 1079163953Srrs# Same goes for tags 1080167598Srrs.if !target(tags) 1081167598Srrstags: 1082167598Srrs.endif 1083167598Srrs