bsd.port.mk revision 7549
165793Smsmith -*- mode: Fundamental; tab-width: 4; -*- 265793Smsmith# 381082Sscottl# bsd.port.mk - 940820 Jordan K. Hubbard. 465793Smsmith# This file is in the public domain. 581082Sscottl# 665793Smsmith# $Id: bsd.port.mk,v 1.128 1995/04/01 09:34:11 jkh Exp $ 765793Smsmith# 865793Smsmith# Please view me with 4 column tabs! 965793Smsmith 1065793Smsmith 1165793Smsmith# Supported Variables and their behaviors: 1265793Smsmith# 1365793Smsmith# Variables that typically apply to all ports: 1465793Smsmith# 1565793Smsmith# PORTSDIR - The root of the ports tree (default: /usr/ports). 1665793Smsmith# DISTDIR - Where to get gzip'd, tarballed copies of original sources 1765793Smsmith# (default: ${PORTSDIR}/distfiles). 1865793Smsmith# PREFIX - Where to install things in general (default: /usr/local). 1965793Smsmith# MASTER_SITES - Primary location(s) for distribution files if not found 2065793Smsmith# locally (default: 2165793Smsmith# ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles) 2265793Smsmith# PATCH_SITES - Primary location(s) for distributed patch files 2365793Smsmith# (see PATCHFILES below) if not found locally (default: 2465793Smsmith# ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles) 2565793Smsmith# 2665793Smsmith# MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this 2765793Smsmith# value. 2865793Smsmith# MASTER_SITE_FREEBSD - If set, only use the FreeBSD master repository for 2965793Smsmith# MASTER_SITES. 3065793Smsmith# PACKAGES - A top level directory where all packages go (rather than 3165793Smsmith# going locally to each port). (default: ${PORTSDIR}/packages). 32111691Sscottl# GMAKE - Set to path of GNU make if not in $PATH (default: gmake). 33188896Sattilio# XMKMF - Set to path of `xmkmf' if not in $PATH (default: xmkmf -a ). 34111691Sscottl# MAINTAINER - The e-mail address of the contact person for this port 35111691Sscottl# (default: ports@FreeBSD.ORG). 36247570Smarius# CATEGORIES - A list of descriptive categories into which this port falls 37247570Smarius# (default: orphans). 38111691Sscottl# KEYWORDS - A list of descriptive keywords that might index well for this 39112946Sphk# port (default: orphans). 40111691Sscottl# 41247570Smarius# Variables that typically apply to an individual port. Non-Boolean 42247570Smarius# variables without defaults are *mandatory*. 43203885Semaste# 44203885Semaste# 45203885Semaste# WRKDIR - A temporary working directory that gets *clobbered* on clean 46203885Semaste# (default: ${.CURDIR}/work). 47203885Semaste# WRKSRC - A subdirectory of ${WRKDIR} where the distribution actually 48203885Semaste# unpacks to. (Default: ${WRKDIR}/${DISTNAME} unless 49203885Semaste# NO_WRKSUBDIR is set, in which case simply ${WRKDIR}). 50203885Semaste# DISTNAME - Name of port or distribution. 51203885Semaste# DISTFILES - Name(s) of archive file(s) containing distribution 52203885Semaste# (default: ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}). 53151086Sscottl# PATCHFILES - Name(s) of additional files that contain distributed 54151086Sscottl# patches (default: none). make will look for them at 55151086Sscottl# PATCH_SITES (see above). They will automatically be 56112946Sphk# uncompressed before patching if the names end with 5783114Sscottl# ".gz" or ".Z". 5883114Sscottl# PKGNAME - Name of the package file to create if the DISTNAME 5983114Sscottl# isn't really relevant for the port/package 6065793Smsmith# (default: ${DISTNAME}). 6165793Smsmith# EXTRACT_ONLY - If defined, a subset of ${DISTFILES} you want to 62206534Semaste# actually extract. 6365793Smsmith# PATCHDIR - A directory containing any additional patches you made 6465793Smsmith# to port this software to FreeBSD (default: 65254004Smarius# ${.CURDIR}/patches) 6665793Smsmith# SCRIPTDIR - A directory containing any auxiliary scripts 6765793Smsmith# (default: ${.CURDIR}/scripts) 6865793Smsmith# FILESDIR - A directory containing any miscellaneous additional files. 6965793Smsmith# (default: ${.CURDIR}/files) 7065793Smsmith# PKGDIR - A direction containing any package creation files. 7165793Smsmith# (default: ${.CURDIR}/pkg) 7265793Smsmith# 7381082Sscottl# NO_EXTRACT - Use a dummy (do-nothing) extract target. 7481082Sscottl# NO_CONFIGURE - Use a dummy (do-nothing) configure target. 7565793Smsmith# NO_BUILD - Use a dummy (do-nothing) build target. 7665793Smsmith# NO_PACKAGE - Use a dummy (do-nothing) package target. 7765793Smsmith# NO_INSTALL - Use a dummy (do-nothing) install target. 7865793Smsmith# NO_WRKSUBDIR - Assume port unpacks directly into ${WRKDIR}. 7965793Smsmith# NO_WRKDIR - There's no work directory at all; port does this someplace 8065793Smsmith# else. 8165793Smsmith# NO_DEPENDS - Don't verify build of dependencies. 8265793Smsmith# USE_GMAKE - Says that the port uses gmake. 8365793Smsmith# USE_IMAKE - Says that the port uses imake. 84206534Semaste# NO_INSTALL_MANPAGES - For imake ports that don't like the install.man 8581082Sscottl# target. 8665793Smsmith# HAS_CONFIGURE - Says that the port has its own configure script. 8765793Smsmith# GNU_CONFIGURE - Set if you are using GNU configure (optional). 8865793Smsmith# CONFIGURE_SCRIPT - Name of configure script, defaults to 'configure'. 8965793Smsmith# CONFIGURE_ARGS - Pass these args to configure, if ${HAS_CONFIGURE} set. 9065793Smsmith# IS_INTERACTIVE - Set this if your port needs to interact with the user 9165793Smsmith# during a build. User can then decide to skip this port by 9270393Smsmith# setting ${BATCH}, or compiling only the interactive ports 9365793Smsmith# by setting ${INTERACTIVE}. 9465793Smsmith# EXEC_DEPENDS - A list of "prog:dir" pairs of other ports this 9570393Smsmith# package depends on. "prog" is the name of an 9670393Smsmith# executable. make will search your $PATH for it and go 97197011Semaste# into "dir" to do a "make all install" if it's not found. 9870393Smsmith# LIB_DEPENDS - A list of "lib:dir" pairs of other ports this package 9970393Smsmith# depends on. "lib" is the name of a shared library. 10070393Smsmith# make will use "ldconfig -r" to search for the 10170393Smsmith# library. Note that lib can be any regular expression, 10270393Smsmith# and you need two backslashes in front of dots (.) to 10382527Sscottl# supress its special meaning (e.g., use 10470393Smsmith# "foo\\.2\\.:${PORTSDIR}/utils/foo" to match "libfoo.2.*"). 10570393Smsmith# DEPENDS - A list of other ports this package depends on being 10665793Smsmith# made first. Use this for things that don't fall into 10765793Smsmith# the above two categories. 10865793Smsmith# EXTRACT_CMD - Command for extracting archive (default: tar). 10965793Smsmith# EXTRACT_SUFX - Suffix for archive names (default: .tar.gz). 11083114Sscottl# EXTRACT_BEFORE_ARGS - 11183114Sscottl# Arguments to ${EXTRACT_CMD} before filename 11283114Sscottl# (default: -C ${WRKDIR} -xzf). 11383114Sscottl# EXTRACT_AFTER_ARGS - 11465793Smsmith# Arguments to ${EXTRACT_CMD} following filename 11565793Smsmith# (default: none). 11665793Smsmith# 117110426Sscottl# NCFTP - Full path to ncftp command if not in $PATH (default: ncftp). 118110426Sscottl# NCFTPFLAGS - Arguments to ${NCFTP} (default: -N). 119213272Semaste# 120110426Sscottl# 121110426Sscottl# Default targets and their behaviors: 122110426Sscottl# 123110426Sscottl# fetch - Retrieves ${DISTFILES} (and ${PATCHFILES} if defined) 124110426Sscottl# into ${DISTDIR} as necessary. 125110426Sscottl# fetch-list - Show list of files that would be retrieved by fetch 126110426Sscottl# extract - Unpacks ${DISTFILES} into ${WRKDIR}. 127213272Semaste# patch - Apply any provided patches to the source. 128110426Sscottl# configure - Runs either GNU configure, one or more local configure 129110426Sscottl# scripts or nothing, depending on what's available. 130110426Sscottl# build - Actually compile the sources. 131110426Sscottl# install - Install the results of a build. 13265793Smsmith# reinstall - Install the results of a build, ignoring "already installed" 13365793Smsmith# flag. 134206534Semaste# package - Create a package from an _installed_ port. 13565793Smsmith# describe - Try to generate a one-line description for each port for 13683114Sscottl# use in INDEX files and the like. 13783114Sscottl# checksum - Use files/md5 to ensure that your distfiles are valid 13883114Sscottl# makesum - Generate files/md5 (only do this for your own ports!) 139125975Sphk# 14083114Sscottl# Default sequence for "all" is: fetch extract patch configure build 14165793Smsmith 14283114Sscottl.if exists(${.CURDIR}/../Makefile.inc) 14383114Sscottl.include "${.CURDIR}/../Makefile.inc" 14483114Sscottl.endif 145177619Semaste 14683114Sscottl# These need to be absolute since we don't know how deep in the ports 14765793Smsmith# tree we are and thus can't go relative. They can, of course, be overridden 14865793Smsmith# by individual Makefiles. 14965793SmsmithPORTSDIR?= ${DESTDIR}/usr/ports 15065793SmsmithX11BASE?= /usr/X11R6 15165793SmsmithDISTDIR?= ${PORTSDIR}/distfiles 15265793SmsmithPACKAGES?= ${PORTSDIR}/packages 15365793Smsmith.if !defined(NO_WRKDIR) 15483114SscottlWRKDIR?= ${.CURDIR}/work 15565793Smsmith.else 15683114SscottlWRKDIR?= ${.CURDIR} 15765793Smsmith.endif 15883114Sscottl.if defined(NO_WRKSUBDIR) 15981082SscottlWRKSRC?= ${WRKDIR} 160151086Sscottl.else 161251115SmariusWRKSRC?= ${WRKDIR}/${DISTNAME} 16281082Sscottl.endif 16383114SscottlPATCHDIR?= ${.CURDIR}/patches 16483114SscottlSCRIPTDIR?= ${.CURDIR}/scripts 16583114SscottlFILESDIR?= ${.CURDIR}/files 16681082SscottlPKGDIR?= ${.CURDIR}/pkg 167251115Smarius.if defined(USE_IMAKE) 16881082SscottlPREFIX?= ${X11BASE} 16981082Sscottl.else 17081082SscottlPREFIX?= /usr/local 17181082Sscottl.endif 17281082Sscottl.if defined(USE_GMAKE) 17381082SscottlEXEC_DEPENDS+= gmake:${PORTSDIR}/devel/gmake 17465793Smsmith.endif 17570393Smsmith 17681151Sscottl.if exists(${PORTSDIR}/../Makefile.inc) 17781151Sscottl.include "${PORTSDIR}/../Makefile.inc" 17881151Sscottl.endif 179151086Sscottl 180151086Sscottl 181151086Sscottl# Change these if you'd prefer to keep the cookies someplace else. 182117363SscottlEXTRACT_COOKIE?= ${WRKDIR}/.extract_done 183117363SscottlCONFIGURE_COOKIE?= ${WRKDIR}/.configure_done 184251116SmariusINSTALL_COOKIE?= ${WRKDIR}/.install_done 185251116SmariusBUILD_COOKIE?= ${WRKDIR}/.build_done 18665793SmsmithPATCH_COOKIE?= ${WRKDIR}/.patch_done 187251115Smarius 18883114Sscottl# How to do nothing. Override if you, for some strange reason, would rather 18983114Sscottl# do something. 19083114SscottlDO_NADA?= echo -n 191111152Sscottl 19265793Smsmith# Miscellaneous overridable commands: 19365793SmsmithGMAKE?= gmake 194110604SscottlXMKMF?= xmkmf -a 195110604SscottlMD5?= /sbin/md5 196110604SscottlMD5_FILE?= ${FILESDIR}/md5 197110604SscottlMAKE_FLAGS?= -f 198110604SscottlMAKEFILE?= Makefile 199110604Sscottl 200110604SscottlNCFTP?= ncftp 20165793SmsmithNCFTPFLAGS?= -N 20265793Smsmith 20365793SmsmithTOUCH?= touch 20465793SmsmithTOUCH_FLAGS?= -f 20565793Smsmith 20665793SmsmithPATCH?= patch 20765793SmsmithPATCH_STRIP?= -p0 20865793SmsmithPATCH_DIST_STRIP?= -p0 20965793Smsmith.if defined(PATCH_DEBUG) 21065793SmsmithPATCH_ARGS?= -d ${WRKSRC} -E ${PATCH_STRIP} 21165793SmsmithPATCH_DIST_ARGS?= -d ${WRKSRC} -E ${PATCH_DIST_STRIP} 21265793Smsmith.else 21365793SmsmithPATCH_ARGS?= -d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP} 21465793SmsmithPATCH_DIST_ARGS?= -d ${WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP} 21583114Sscottl.endif 21683114Sscottl 21765793SmsmithEXTRACT_CMD?= tar 21883114SscottlEXTRACT_SUFX?= .tar.gz 21983114Sscottl# Backwards compatability. 22065793Smsmith.if defined(EXTRACT_ARGS) 22183114SscottlEXTRACT_BEFORE_ARGS?= ${EXTRACT_ARGS} 22283114Sscottl.else 22383114SscottlEXTRACT_BEFORE_ARGS?= -xzf 22465793Smsmith.endif 22583114Sscottl 226206534SemastePKG_CMD?= pkg_create 227254004Smarius.if !defined(PKG_ARGS) 22883114SscottlPKG_ARGS= -v -c ${PKGDIR}/COMMENT -d ${PKGDIR}/DESCR -f ${PKGDIR}/PLIST -p ${PREFIX} 22983114Sscottl.if exists(${PKGDIR}/INSTALL) 23065793SmsmithPKG_ARGS+= -i ${PKGDIR}/INSTALL 23165793Smsmith.endif 23265793Smsmith.if exists(${PKGDIR}/DEINSTALL) 23365793SmsmithPKG_ARGS+= -k ${PKGDIR}/DEINSTALL 23465793Smsmith.endif 235206534Semaste.if exists(${PKGDIR}/REQ) 23665793SmsmithPKG_ARGS+= -r ${PKGDIR}/REQ 23783114Sscottl.endif 23883114Sscottl.endif 23983114SscottlPKG_SUFX?= .tgz 24087183Sscottl 24183114SscottlECHO_MSG?= echo 24283114Sscottl 24383114SscottlALL_TARGET?= all 244112679SscottlINSTALL_TARGET?= install 24583114Sscottl 246151086Sscottl.if defined(MASTER_SITE_FREEBSD) 247151086SscottlMASTER_SITE_OVERRIDE= ftp://freebsd.cdrom.com/pub/FreeBSD/FreeBSD-current/ports/distfiles/ 248151086Sscottl.endif 24965793Smsmith 250247570Smarius# I guess we're in the master distribution business! :) As we gain mirror 251247570Smarius# sites for distfiles, add them to this list. 252247570Smarius.if !defined(MASTER_SITE_OVERRIDE) 253247570SmariusMASTER_SITES+= ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports/distfiles/ 25465793SmsmithPATCH_SITES+= ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports/distfiles/ 255247570Smarius.else 256247570SmariusMASTER_SITES= ${MASTER_SITE_OVERRIDE} 257247570SmariusPATCH_SITES= ${MASTER_SITE_OVERRIDE} 258247570Smarius.endif 25981082Sscottl 26065793Smsmith# Derived names so that they're easily overridable. 261247570SmariusDISTFILES?= ${DISTNAME}${EXTRACT_SUFX} 26281082SscottlPKGNAME?= ${DISTNAME} 263247570Smarius 264112679Sscottl# Documentation 265247570SmariusMAINTAINER?= ports@FreeBSD.ORG 26683114SscottlCATEGORIES?= orphans 267247570SmariusKEYWORDS?= orphans 26883114Sscottl 269247570Smarius.if exists(${PACKAGES}) 270247570SmariusPKGFILE?= ${PACKAGES}/${PKGNAME}${PKG_SUFX} 271247570Smarius.else 27265793SmsmithPKGFILE?= ${PKGNAME}${PKG_SUFX} 273188896Sattilio.endif 274188896Sattilio 275188896SattilioCONFIGURE_SCRIPT?= configure 276188896Sattilio 277188896Sattilio.if defined(GNU_CONFIGURE) 278188896SattilioCONFIGURE_ARGS?= --prefix=${PREFIX} 279188896SattilioHAS_CONFIGURE= yes 280188896Sattilio.endif 281188896Sattilio 282188896Sattilio.MAIN: all 283188896Sattilio 284188896Sattilio# If we're in BATCH mode and the port is interactive, or we're in 28565793Smsmith# interactive mode and the port is non-interactive, skip all the important 286188896Sattilio# targets. The reason we have two modes is that one might want to leave 287188896Sattilio# a build in BATCH mode running overnight, then come back in the morning 288188896Sattilio# and do _only_ the interactive ones that required your intervention. 289188896Sattilio# This allows you to do both. 290188896Sattilio# 291188896Sattilio.if (defined(IS_INTERACTIVE) && defined(BATCH)) || (!defined(IS_INTERACTIVE) && defined(INTERACTIVE)) 292188896Sattilioall: 293188896Sattilio @${DO_NADA} 294188896Sattiliopre-build: 295188896Sattilio @${DO_NADA} 296188896Sattiliobuild: 297188896Sattilio @${DO_NADA} 298188896Sattiliopre-install: 299174385Semaste @${DO_NADA} 300174385Semasteinstall: 301174385Semaste @${DO_NADA} 302174385Semastepre-fetch: 303174385Semaste @${DO_NADA} 304174385Semastefetch: 305174385Semaste @${DO_NADA} 306174385Semastepre-configure: 30765793Smsmith @${DO_NADA} 30865793Smsmithconfigure: 30965793Smsmith @${DO_NADA} 310206534Semastepackage: 31165793Smsmith @${DO_NADA} 31283114Sscottl.endif 31383114Sscottl 314188896Sattilio.if !target(all) 315188896Sattilioall: extract configure build 316188896Sattilio.endif 31783114Sscottl 31883114Sscottl.if !target(is_depended) 31981082Sscottlis_depended: all install 32083114Sscottl.endif 32183114Sscottl 322110427Sscottl# The following are used to create easy dummy targets for disabling some 32365793Smsmith# bit of default target behavior you don't want. They still check to see 32483114Sscottl# if the target exists, and if so don't do anything, since you might want 32583114Sscottl# to set this globally for a group of ports in a Makefile.inc, but still 32665793Smsmith# be able to override from an individual Makefile (since you can't _undefine_ 327212661Sattilio# a variable in make!). 32865793Smsmith.if defined(NO_EXTRACT) && !target(extract) 32965793Smsmithextract: 33083114Sscottl @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE} 33165793Smsmithchecksum: 33283114Sscottl @${DO_NADA} 33383114Sscottlmakesum: 33465793Smsmith @${DO_NADA} 33565793Smsmith.endif 336133606Sscottl.if defined(NO_CONFIGURE) && !target(configure) 337188896Sattilioconfigure: 33870393Smsmith @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE} 33983114Sscottl.endif 34081082Sscottl.if defined(NO_BUILD) && !target(build) 34183114Sscottlbuild: 34281082Sscottl @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE} 34383114Sscottl.endif 34483114Sscottl.if defined(NO_PACKAGE) && !target(package) 345247570Smariuspackage: 34665793Smsmith @${DO_NADA} 34783114Sscottl.endif 34883114Sscottl.if defined(NO_INSTALL) && !target(install) 349110604Sscottlinstall: 350118607Sjhb @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE} 351110604Sscottl.endif 35265793Smsmith.if defined(NO_PATCH) && !target(patch) 35383114Sscottlpatch: 354206534Semaste @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 35581082Sscottl.endif 35683114Sscottl 35781082Sscottl# More standard targets start here. 35883114Sscottl 359151086Sscottl# This target generates an index entry suitable for aggregation into 36083114Sscottl# a large index. Format is: 36183114Sscottl# 36283114Sscottl# distribution-name|port-path|installation-prefix|comment| \ 36365793Smsmith# description-file|maintainer 36483114Sscottl# 36570393Smsmith.if !target(describe) 36683114Sscottldescribe: 367110426Sscottl @echo -n "${DISTNAME}|${.CURDIR}/${DISTNAME}|" 368133540Sscottl @echo -n "${PREFIX}|" 36965793Smsmith @if [ -f ${PKGDIR}/COMMENT ]; then \ 370130006Sscottl echo -n "`cat ${PKGDIR}/COMMENT`"; \ 371130006Sscottl else \ 372130006Sscottl echo -n "** No Description"; \ 373130006Sscottl fi 374133540Sscottl @if [ -f ${PKGDIR}/DESCR ]; then \ 375111532Sscottl echo -n "|${PKGDIR}/DESCR"; \ 37683114Sscottl else \ 37783114Sscottl echo -n "|/dev/null"; \ 37881082Sscottl fi 37983114Sscottl @echo -n "|${MAINTAINER}|${CATEGORIES}|${KEYWORDS}" 38065793Smsmith @echo "" 38183114Sscottl.endif 382130585Sphk 383133540Sscottl.if !target(reinstall) 384174385Semastereinstall: pre-reinstall install 385174385Semaste 386174385Semastepre-reinstall: 387174385Semaste @rm -f ${INSTALL_COOKIE} 38887183Sscottl.endif 38983114Sscottl 39083114Sscottl.if !target(pre-install) 39182527Sscottlpre-install: 392222951Sattilio @${DO_NADA} 39382527Sscottl.endif 39482527Sscottl 395222951Sattilio.if !target(install) 396111532Sscottlinstall: build ${INSTALL_COOKIE} 397222951Sattilio 398112679Sscottl${INSTALL_COOKIE}: 399112679Sscottl @${ECHO_MSG} "===> Installing for ${DISTNAME}" 400112679Sscottl @${MAKE} ${.MAKEFLAGS} pre-install 401112679Sscottl.if defined(USE_GMAKE) 402112679Sscottl @(cd ${WRKSRC}; ${GMAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET}) 403112679Sscottl.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES) 404112679Sscottl @(cd ${WRKSRC}; ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man) 405112679Sscottl.endif 406112679Sscottl.else defined(USE_GMAKE) 407112679Sscottl @(cd ${WRKSRC}; ${MAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET}) 408117361Sscottl.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES) 409254004Smarius @(cd ${WRKSRC}; ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man) 410151086Sscottl.endif 411151086Sscottl.endif 412151086Sscottl @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE} 413151086Sscottl.endif 414177619Semaste 415261455Seadler.if !target(pre-package) 41695536Sscottlpre-package: 417112679Sscottl @${DO_NADA} 41895536Sscottl.endif 419110426Sscottl 420151086Sscottl.if !target(package) 421188896Sattiliopackage: pre-package 422188896Sattilio# Makes some gross assumptions about a fairly simple package with no 423206534Semaste# install, require or deinstall scripts. Override the arguments with 424151086Sscottl# PKG_ARGS if your package is anything but run-of-the-mill. 425151086Sscottl @if [ -d ${PKGDIR} ]; then \ 426151086Sscottl ${ECHO_MSG} "===> Building package for ${DISTNAME}"; \ 427151086Sscottl ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; \ 428213272Semaste fi 429213272Semaste.endif 430213272Semaste 43165793Smsmith.if !target(depends) 43265793Smsmithdepends: exec_depends lib_depends misc_depends 433151086Sscottl 434151086Sscottlexec_depends: 435151086Sscottl.if defined(EXEC_DEPENDS) 436151086Sscottl.if defined(NO_DEPENDS) 437151086Sscottl# Just print out messages 438151086Sscottl @for i in ${EXEC_DEPENDS}; do \ 439151086Sscottl prog=`echo $$i | sed -e 's/:.*//'`; \ 44065793Smsmith dir=`echo $$i | sed -e 's/.*://'`; \ 441151086Sscottl ${ECHO_MSG} "===> ${DISTNAME} depends on executable: $$prog ($$dir)"; \ 442151086Sscottl done 443151086Sscottl.else 444151086Sscottl @for i in ${EXEC_DEPENDS}; do \ 445151086Sscottl prog=`echo $$i | sed -e 's/:.*//'`; \ 446151086Sscottl dir=`echo $$i | sed -e 's/.*://'`; \ 447151086Sscottl if which -s "$$prog"; then \ 448151086Sscottl ${ECHO_MSG} "===> ${DISTNAME} depends on executable: $$prog - found"; \ 449151086Sscottl else \ 45065793Smsmith ${ECHO_MSG} "===> ${DISTNAME} depends on executable: $$prog - not found"; \ 45165793Smsmith ${ECHO_MSG} "===> Verifying build for $$prog in $$dir"; \ 45265793Smsmith if [ ! -d "$$dir" ]; then \ 45365793Smsmith ${ECHO_MSG} ">> No directory for $$prog. Skipping.."; \ 45465793Smsmith else \ 45565793Smsmith (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 45665793Smsmith ${ECHO_MSG} "===> Returning to build of ${DISTNAME}"; \ 457206534Semaste fi; \ 45865793Smsmith fi; \ 459151086Sscottl done 460198593Semaste.endif 46165793Smsmith.else 46270393Smsmith @${DO_NADA} 46395536Sscottl.endif 46495536Sscottl 46595536Sscottllib_depends: 46695536Sscottl.if defined(LIB_DEPENDS) 46795350Sscottl.if defined(NO_DEPENDS) 46895350Sscottl# Just print out messages 46995350Sscottl @for i in ${LIB_DEPENDS}; do \ 470151086Sscottl lib=`echo $$i | sed -e 's/:.*//'`; \ 471151086Sscottl dir=`echo $$i | sed -e 's/.*://'`; \ 47265793Smsmith ${ECHO_MSG} "===> ${DISTNAME} depends on shared library: $$lib ($$dir)"; \ 47365793Smsmith done 474177567Semaste.else 475177567Semaste @for i in ${LIB_DEPENDS}; do \ 476177567Semaste lib=`echo $$i | sed -e 's/:.*//'`; \ 477177567Semaste dir=`echo $$i | sed -e 's/.*://'`; \ 478177567Semaste if ldconfig -r | grep -q -e "-l$$lib"; then \ 479177567Semaste ${ECHO_MSG} "===> ${DISTNAME} depends on shared library: $$lib - found"; \ 480177567Semaste else \ 481177567Semaste ${ECHO_MSG} "===> ${DISTNAME} depends on shared library: $$lib - not found"; \ 482177567Semaste ${ECHO_MSG} "===> Verifying build for $$lib in $$dir"; \ 483177567Semaste if [ ! -d "$$dir" ]; then \ 484177567Semaste ${ECHO_MSG} ">> No directory for $$lib. Skipping.."; \ 48565793Smsmith else \ 48665793Smsmith (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 48765793Smsmith ${ECHO_MSG} "===> Returning to build of ${DISTNAME}"; \ 48881082Sscottl fi; \ 48997214Speter fi; \ 49081082Sscottl done 49181082Sscottl.endif 49265793Smsmith.else 49395350Sscottl @${DO_NADA} 49465793Smsmith.endif 49565793Smsmith 496177567Semastemisc_depends: 49765793Smsmith.if defined(DEPENDS) 49870393Smsmith @${ECHO_MSG} "===> ${DISTNAME} depends on: ${DEPENDS}" 49970393Smsmith.if !defined(NO_DEPENDS) 50065793Smsmith @for i in ${DEPENDS}; do \ 50170393Smsmith ${ECHO_MSG} "===> Verifying build for $$i"; \ 50282527Sscottl if [ ! -d $$i ]; then \ 50365793Smsmith ${ECHO_MSG} ">> No directory for $$i. Skipping.."; \ 50465793Smsmith else \ 50565793Smsmith (cd $$i; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 506247570Smarius fi \ 50783114Sscottl done 50865793Smsmith @${ECHO_MSG} "===> Returning to build of ${DISTNAME}" 50965793Smsmith.endif 51083114Sscottl.else 51170393Smsmith @${DO_NADA} 51265793Smsmith.endif 51370393Smsmith 51470393Smsmith.endif 51583114Sscottl 51670393Smsmith.if !target(pre-build) 51783114Sscottlpre-build: 51883114Sscottl @${DO_NADA} 51983114Sscottl.endif 52083114Sscottl 52183114Sscottl.if !target(build) 52283114Sscottlbuild: configure ${BUILD_COOKIE} 52365793Smsmith 52470393Smsmith${BUILD_COOKIE}: 52583114Sscottl @${ECHO_MSG} "===> Building for ${DISTNAME}" 52683114Sscottl @${MAKE} ${.MAKEFLAGS} pre-build 52783114Sscottl.if defined(USE_GMAKE) 52883114Sscottl @(cd ${WRKSRC}; ${GMAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET}) 52983114Sscottl.else defined(USE_GMAKE) 53065793Smsmith @(cd ${WRKSRC}; ${MAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET}) 53170393Smsmith.endif 53270393Smsmith @if [ -f ${SCRIPTDIR}/post-build ]; then \ 53370393Smsmith env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 53470393Smsmith WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 53583114Sscottl FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 53683114Sscottl DEPENDS="${DEPENDS}" \ 53770393Smsmith sh ${SCRIPTDIR}/post-build; \ 53870393Smsmith fi 53970393Smsmith @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE} 54070393Smsmith.endif 54183114Sscottl 542218280Semaste.if !target(pre-patch) 543218280Semastepre-patch: 54483114Sscottl @${DO_NADA} 54583114Sscottl.endif 54683114Sscottl 54783114Sscottl.if !target(patch) 54870393Smsmithpatch: extract ${PATCH_COOKIE} 54970393Smsmith 55070393Smsmith${PATCH_COOKIE}: 55170393Smsmith @${MAKE} ${.MAKEFLAGS} pre-patch 55283114Sscottl.if defined(PATCHFILES) 553218280Semaste @${ECHO_MSG} "===> Applying distributed patches for ${DISTNAME}" 554218280Semaste.if defined(PATCH_DEBUG) 55583114Sscottl @(cd ${DISTDIR}; \ 55683114Sscottl for i in ${PATCHFILES}; do \ 55783114Sscottl ${ECHO_MSG} "===> Applying distributed patch $$i" ; \ 55883114Sscottl case $$i in \ 55970393Smsmith *.Z|*.gz) \ 56070393Smsmith zcat $$i | ${PATCH} ${PATCH_DIST_ARGS}; \ 56170393Smsmith ;; \ 56270393Smsmith *) \ 56383114Sscottl ${PATCH} ${PATCH_DIST_ARGS} < $$i; \ 56470393Smsmith ;; \ 56583114Sscottl esac; \ 56683114Sscottl done) 567218280Semaste.else 568218280Semaste @(cd ${DISTDIR}; \ 56983114Sscottl for i in ${PATCHFILES}; do \ 57083114Sscottl case $$i in \ 57183114Sscottl *.Z|*.gz) \ 57283114Sscottl zcat $$i | ${PATCH} ${PATCH_DIST_ARGS}; \ 57381151Sscottl ;; \ 57483114Sscottl *) \ 57570393Smsmith ${PATCH} ${PATCH_DIST_ARGS} < $$i; \ 57670393Smsmith ;; \ 57770393Smsmith esac; \ 57870393Smsmith done) 57983114Sscottl.endif 580218280Semaste.endif 581218280Semaste.if defined(PATCH_DEBUG) 58283114Sscottl @if [ -d ${PATCHDIR} ]; then \ 58383114Sscottl ${ECHO_MSG} "===> Applying FreeBSD patches for ${DISTNAME}" ; \ 58483114Sscottl for i in ${PATCHDIR}/patch-*; do \ 58583114Sscottl ${ECHO_MSG} "===> Applying FreeBSD patch $$i" ; \ 58670393Smsmith ${PATCH} ${PATCH_ARGS} < $$i; \ 58765793Smsmith done; \ 58870393Smsmith fi 58970393Smsmith @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 59070393Smsmith.else 59165793Smsmith @if [ -d ${PATCHDIR} ]; then \ 59270393Smsmith ${ECHO_MSG} "===> Applying FreeBSD patches for ${DISTNAME}" ; \ 59370393Smsmith for i in ${PATCHDIR}/patch-*; \ 59470393Smsmith do ${PATCH} ${PATCH_ARGS} < $$i; \ 59565793Smsmith done;\ 59670393Smsmith fi 59765793Smsmith @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 59883114Sscottl.endif 59983114Sscottl.endif 60065793Smsmith 60165793Smsmith.if !target(pre-configure) 60265793Smsmithpre-configure: 60370393Smsmith @${DO_NADA} 60465793Smsmith.endif 60583114Sscottl 60683114Sscottl.if !target(configure) 60765793Smsmithconfigure: depends patch ${CONFIGURE_COOKIE} 60865793Smsmith 60970393Smsmith${CONFIGURE_COOKIE}: 61070393Smsmith @${ECHO_MSG} "===> Configuring for ${DISTNAME}" 61165793Smsmith @${MAKE} ${.MAKEFLAGS} pre-configure 61283114Sscottl @if [ -f ${SCRIPTDIR}/pre-configure ]; then \ 61365793Smsmith env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 61483114Sscottl WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 61587183Sscottl FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 61687183Sscottl DEPENDS="${DEPENDS}" \ 61783114Sscottl sh ${SCRIPTDIR}/pre-configure; \ 61883114Sscottl fi 61965793Smsmith @if [ -f ${SCRIPTDIR}/configure ]; then \ 62082527Sscottl env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 62182527Sscottl WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 62282527Sscottl FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 62382527Sscottl DEPENDS="${DEPENDS}" \ 62487183Sscottl sh ${SCRIPTDIR}/configure; \ 62587183Sscottl fi 62687183Sscottl.if defined(HAS_CONFIGURE) 62787183Sscottl @(cd ${WRKSRC}; CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \ 62882527Sscottl INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \ 62982527Sscottl INSTALL_PROGRAM="/usr/bin/install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}" \ 630125225Sscottl ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}) 63182527Sscottl.endif 63282527Sscottl.if defined(USE_IMAKE) 633130006Sscottl.if defined(USE_GMAKE) 634130006Sscottl @(cd ${WRKSRC}; ${XMKMF} && ${GMAKE} Makefiles) 635130006Sscottl.else 636130006Sscottl @(cd ${WRKSRC}; ${XMKMF} && ${MAKE} Makefiles) 637130006Sscottl.endif 638151086Sscottl.endif 639130006Sscottl @if [ -f ${SCRIPTDIR}/post-configure ]; then \ 640130006Sscottl env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 641130006Sscottl WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 642130006Sscottl FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 643130006Sscottl DEPENDS="${DEPENDS}" \ 644130006Sscottl sh ${SCRIPTDIR}/post-configure; \ 645130006Sscottl fi 646130006Sscottl @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE} 647151086Sscottl.endif 648130006Sscottl 649.if !target(pre-fetch) 650pre-fetch: 651 @${DO_NADA} 652.endif 653 654.if !target(fetch) 655fetch: pre-fetch 656 @if [ ! -d ${DISTDIR} ]; then mkdir -p ${DISTDIR}; fi 657 @(cd ${DISTDIR}; \ 658 for file in ${DISTFILES}; do \ 659 if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 660 ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \ 661 for site in ${MASTER_SITES}; do \ 662 ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \ 663 if ${NCFTP} ${NCFTPFLAGS} $${site}$${file}; then \ 664 break; \ 665 fi \ 666 done; \ 667 if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 668 ${ECHO_MSG} ">> Couldn't fetch it - please try to retreive this";\ 669 ${ECHO_MSG} ">> port manually into ${DISTDIR} and try again."; \ 670 exit 1; \ 671 fi; \ 672 fi \ 673 done) 674.if defined(PATCHFILES) 675 @(cd ${DISTDIR}; \ 676 for file in ${PATCHFILES}; do \ 677 if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 678 ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \ 679 for site in ${PATCH_SITES}; do \ 680 ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \ 681 if ${NCFTP} ${NCFTPFLAGS} $${site}$${file}; then \ 682 break; \ 683 fi \ 684 done; \ 685 if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 686 ${ECHO_MSG} ">> Couldn't fetch it - please try to retreive this";\ 687 ${ECHO_MSG} ">> port manually into ${DISTDIR} and try again."; \ 688 exit 1; \ 689 fi; \ 690 fi \ 691 done) 692.endif 693.endif 694 695.if !target(fetch-list) 696fetch-list: 697 @if [ ! -d ${DISTDIR} ]; then mkdir -p ${DISTDIR}; fi 698 @(cd ${DISTDIR}; \ 699 for file in ${DISTFILES}; do \ 700 if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 701 for site in ${MASTER_SITES}; do \ 702 echo -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} '||' ; \ 703 break; \ 704 done; \ 705 echo "echo $${file} not fetched" ; \ 706 fi \ 707 done) 708.if defined(PATCHFILES) 709 @(cd ${DISTDIR}; \ 710 for file in ${PATCHFILES}; do \ 711 if [ ! -f $$file -a ! -f `basename $$file` ]; then \ 712 for site in ${PATCH_SITES}; do \ 713 echo -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} '||' ; \ 714 break; \ 715 done; \ 716 echo "echo $${file} not fetched" ; \ 717 fi \ 718 done) 719.endif 720.endif 721 722.if !target(makesum) 723makesum: fetch 724 @if [ ! -d ${FILESDIR} ]; then mkdir -p ${FILESDIR}; fi 725 @if [ -f ${MD5_FILE} ]; then rm -f ${MD5_FILE}; fi 726 @(cd ${DISTDIR}; \ 727 for file in ${DISTFILES} ${PATCHFILES}; do \ 728 ${MD5} $$file >> ${MD5_FILE}; \ 729 done) 730.endif 731 732.if !target(checksum) 733checksum: fetch 734 @if [ ! -f ${MD5_FILE} ]; then \ 735 ${ECHO_MSG} ">> No MD5 checksum file."; \ 736 else \ 737 (cd ${DISTDIR}; OK=""; \ 738 for file in ${DISTFILES} ${PATCHFILES}; do \ 739 CKSUM=`${MD5} $$file | awk '{print $$4}'`; \ 740 CKSUM2=`grep "($$file)" ${MD5_FILE} | awk '{print $$4}'`; \ 741 if [ "$$CKSUM2" = "" ]; then \ 742 ${ECHO_MSG} ">> No checksum recorded for $$file"; \ 743 OK="false"; \ 744 elif [ "$$CKSUM" != "$$CKSUM2" ]; then \ 745 ${ECHO_MSG} ">> Checksum mismatch for $$file"; \ 746 exit 1; \ 747 fi; \ 748 done; \ 749 if [ "$$OK" = "" ]; then \ 750 ${ECHO_MSG} "Checksums OK."; \ 751 else \ 752 ${ECHO_MSG} "Checksums OK for files that have them."; \ 753 fi) ; \ 754 fi 755.endif 756 757.if !target(pre-extract) 758pre-extract: 759 @${DO_NADA} 760.endif 761 762.if !target(extract) 763# We need to depend on .extract_done rather than the presence of ${WRKDIR} 764# because if the user interrupts the extract in the middle (and it's often 765# a long procedure), we get tricked into thinking that we've got a good dist 766# in ${WRKDIR}. 767extract: fetch ${EXTRACT_COOKIE} 768 769${EXTRACT_COOKIE}: 770 @${MAKE} ${.MAKEFLAGS} checksum pre-extract 771 @${ECHO_MSG} "===> Extracting for ${DISTNAME}" 772 @rm -rf ${WRKDIR} 773 @mkdir -p ${WRKDIR} 774.if defined(EXTRACT_ONLY) 775 @for file in ${EXTRACT_ONLY}; do \ 776 if ! (cd ${WRKDIR};${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\ 777 then \ 778 exit 1; \ 779 fi \ 780 done 781.else 782 @for file in ${DISTFILES}; do \ 783 if ! (cd ${WRKDIR};${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\ 784 then \ 785 exit 1; \ 786 fi \ 787 done 788.endif 789 @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE} 790.endif 791 792.if !target(pre-clean) 793pre-clean: 794 @${DO_NADA} 795.endif 796 797.if !target(clean) 798clean: pre-clean 799 @${ECHO_MSG} "===> Cleaning for ${DISTNAME}" 800 @rm -f ${EXTRACT_COOKIE} ${CONFIGURE_COOKIE} ${INSTALL_COOKIE} \ 801 ${BUILD_COOKIE} ${PATCH_COOKIE} 802.if !defined(NO_WRKDIR) 803 @rm -rf ${WRKDIR} 804.endif 805.endif 806 807# No pre-targets for depend or tags. It would be silly. 808 809# Depend is generally meaningless for arbitrary ports, but if someone wants 810# one they can override this. This is just to catch people who've gotten into 811# the habit of typing `make depend all install' as a matter of course. 812# 813.if !target(depend) 814depend: 815.endif 816 817# Same goes for tags 818.if !target(tags) 819tags: 820.endif 821