bsd.port.mk revision 7548
1 -*- mode: Fundamental; tab-width: 4; -*- 2# 3# bsd.port.mk - 940820 Jordan K. Hubbard. 4# This file is in the public domain. 5# 6# $Id: bsd.port.mk,v 1.127 1995/03/28 01:14:29 asami Exp $ 7# 8# Please view me with 4 column tabs! 9 10 11# Supported Variables and their behaviors: 12# 13# Variables that typically apply to all ports: 14# 15# PORTSDIR - The root of the ports tree (default: /usr/ports). 16# DISTDIR - Where to get gzip'd, tarballed copies of original sources 17# (default: ${PORTSDIR}/distfiles). 18# PREFIX - Where to install things in general (default: /usr/local). 19# MASTER_SITES - Primary location(s) for distribution files if not found 20# locally (default: 21# ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles) 22# PATCH_SITES - Primary location(s) for distributed patch files 23# (see PATCHFILES below) if not found locally (default: 24# ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles) 25# 26# MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this 27# value. 28# MASTER_SITE_FREEBSD - If set, only use the FreeBSD master repository for 29# MASTER_SITES. 30# PACKAGES - A top level directory where all packages go (rather than 31# going locally to each port). (default: ${PORTSDIR}/packages). 32# GMAKE - Set to path of GNU make if not in $PATH (default: gmake). 33# XMKMF - Set to path of `xmkmf' if not in $PATH (default: xmkmf -a ). 34# MAINTAINER - The e-mail address of the contact person for this port 35# (default: ports@FreeBSD.ORG). 36# CATEGORIES - A list of descriptive categories into which this port falls 37# (no default - optional). 38# KEYWORDS - A list of descriptive keywords that might index well for this 39# port (no default - optional). 40# 41# Variables that typically apply to an individual port. Non-Boolean 42# variables without defaults are *mandatory*. 43# 44# 45# WRKDIR - A temporary working directory that gets *clobbered* on clean 46# (default: ${.CURDIR}/work). 47# WRKSRC - A subdirectory of ${WRKDIR} where the distribution actually 48# unpacks to. (Default: ${WRKDIR}/${DISTNAME} unless 49# NO_WRKSUBDIR is set, in which case simply ${WRKDIR}). 50# DISTNAME - Name of port or distribution. 51# DISTFILES - Name(s) of archive file(s) containing distribution 52# (default: ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}). 53# PATCHFILES - Name(s) of additional files that contain distributed 54# patches (default: none). make will look for them at 55# PATCH_SITES (see above). They will automatically be 56# uncompressed before patching if the names end with 57# ".gz" or ".Z". 58# PKGNAME - Name of the package file to create if the DISTNAME 59# isn't really relevant for the port/package 60# (default: ${DISTNAME}). 61# EXTRACT_ONLY - If defined, a subset of ${DISTFILES} you want to 62# actually extract. 63# PATCHDIR - A directory containing any additional patches you made 64# to port this software to FreeBSD (default: 65# ${.CURDIR}/patches) 66# SCRIPTDIR - A directory containing any auxiliary scripts 67# (default: ${.CURDIR}/scripts) 68# FILESDIR - A directory containing any miscellaneous additional files. 69# (default: ${.CURDIR}/files) 70# PKGDIR - A direction containing any package creation files. 71# (default: ${.CURDIR}/pkg) 72# 73# NO_EXTRACT - Use a dummy (do-nothing) extract target. 74# NO_CONFIGURE - Use a dummy (do-nothing) configure target. 75# NO_BUILD - Use a dummy (do-nothing) build target. 76# NO_PACKAGE - Use a dummy (do-nothing) package target. 77# NO_INSTALL - Use a dummy (do-nothing) install target. 78# NO_WRKSUBDIR - Assume port unpacks directly into ${WRKDIR}. 79# NO_WRKDIR - There's no work directory at all; port does this someplace 80# else. 81# NO_DEPENDS - Don't verify build of dependencies. 82# USE_GMAKE - Says that the port uses gmake. 83# USE_IMAKE - Says that the port uses imake. 84# NO_INSTALL_MANPAGES - For imake ports that don't like the install.man 85# target. 86# HAS_CONFIGURE - Says that the port has its own configure script. 87# GNU_CONFIGURE - Set if you are using GNU configure (optional). 88# CONFIGURE_SCRIPT - Name of configure script, defaults to 'configure'. 89# CONFIGURE_ARGS - Pass these args to configure, if ${HAS_CONFIGURE} set. 90# IS_INTERACTIVE - Set this if your port needs to interact with the user 91# during a build. User can then decide to skip this port by 92# setting ${BATCH}, or compiling only the interactive ports 93# by setting ${INTERACTIVE}. 94# EXEC_DEPENDS - A list of "prog:dir" pairs of other ports this 95# package depends on. "prog" is the name of an 96# executable. make will search your $PATH for it and go 97# into "dir" to do a "make all install" if it's not found. 98# LIB_DEPENDS - A list of "lib:dir" pairs of other ports this package 99# depends on. "lib" is the name of a shared library. 100# make will use "ldconfig -r" to search for the 101# library. Note that lib can be any regular expression, 102# and you need two backslashes in front of dots (.) to 103# supress its special meaning (e.g., use 104# "foo\\.2\\.:${PORTSDIR}/utils/foo" to match "libfoo.2.*"). 105# DEPENDS - A list of other ports this package depends on being 106# made first. Use this for things that don't fall into 107# the above two categories. 108# EXTRACT_CMD - Command for extracting archive (default: tar). 109# EXTRACT_SUFX - Suffix for archive names (default: .tar.gz). 110# EXTRACT_BEFORE_ARGS - 111# Arguments to ${EXTRACT_CMD} before filename 112# (default: -C ${WRKDIR} -xzf). 113# EXTRACT_AFTER_ARGS - 114# Arguments to ${EXTRACT_CMD} following filename 115# (default: none). 116# 117# NCFTP - Full path to ncftp command if not in $PATH (default: ncftp). 118# NCFTPFLAGS - Arguments to ${NCFTP} (default: -N). 119# 120# 121# Default targets and their behaviors: 122# 123# fetch - Retrieves ${DISTFILES} (and ${PATCHFILES} if defined) 124# into ${DISTDIR} as necessary. 125# fetch-list - Show list of files that would be retrieved by fetch 126# extract - Unpacks ${DISTFILES} into ${WRKDIR}. 127# patch - Apply any provided patches to the source. 128# configure - Runs either GNU configure, one or more local configure 129# scripts or nothing, depending on what's available. 130# build - Actually compile the sources. 131# install - Install the results of a build. 132# reinstall - Install the results of a build, ignoring "already installed" 133# flag. 134# package - Create a package from an _installed_ port. 135# describe - Try to generate a one-line description for each port for 136# use in INDEX files and the like. 137# checksum - Use files/md5 to ensure that your distfiles are valid 138# makesum - Generate files/md5 (only do this for your own ports!) 139# 140# Default sequence for "all" is: fetch extract patch configure build 141 142.if exists(${.CURDIR}/../Makefile.inc) 143.include "${.CURDIR}/../Makefile.inc" 144.endif 145 146# These need to be absolute since we don't know how deep in the ports 147# tree we are and thus can't go relative. They can, of course, be overridden 148# by individual Makefiles. 149PORTSDIR?= ${DESTDIR}/usr/ports 150X11BASE?= /usr/X11R6 151DISTDIR?= ${PORTSDIR}/distfiles 152PACKAGES?= ${PORTSDIR}/packages 153.if !defined(NO_WRKDIR) 154WRKDIR?= ${.CURDIR}/work 155.else 156WRKDIR?= ${.CURDIR} 157.endif 158.if defined(NO_WRKSUBDIR) 159WRKSRC?= ${WRKDIR} 160.else 161WRKSRC?= ${WRKDIR}/${DISTNAME} 162.endif 163PATCHDIR?= ${.CURDIR}/patches 164SCRIPTDIR?= ${.CURDIR}/scripts 165FILESDIR?= ${.CURDIR}/files 166PKGDIR?= ${.CURDIR}/pkg 167.if defined(USE_IMAKE) 168PREFIX?= ${X11BASE} 169.else 170PREFIX?= /usr/local 171.endif 172.if defined(USE_GMAKE) 173EXEC_DEPENDS+= gmake:${PORTSDIR}/devel/gmake 174.endif 175 176.if exists(${PORTSDIR}/../Makefile.inc) 177.include "${PORTSDIR}/../Makefile.inc" 178.endif 179 180 181# Change these if you'd prefer to keep the cookies someplace else. 182EXTRACT_COOKIE?= ${WRKDIR}/.extract_done 183CONFIGURE_COOKIE?= ${WRKDIR}/.configure_done 184INSTALL_COOKIE?= ${WRKDIR}/.install_done 185BUILD_COOKIE?= ${WRKDIR}/.build_done 186PATCH_COOKIE?= ${WRKDIR}/.patch_done 187 188# How to do nothing. Override if you, for some strange reason, would rather 189# do something. 190DO_NADA?= echo -n 191 192# Miscellaneous overridable commands: 193GMAKE?= gmake 194XMKMF?= xmkmf -a 195MD5?= /sbin/md5 196MD5_FILE?= ${FILESDIR}/md5 197MAKE_FLAGS?= -f 198MAKEFILE?= Makefile 199 200NCFTP?= ncftp 201NCFTPFLAGS?= -N 202 203TOUCH?= touch 204TOUCH_FLAGS?= -f 205 206PATCH?= patch 207PATCH_STRIP?= -p0 208PATCH_DIST_STRIP?= -p0 209.if defined(PATCH_DEBUG) 210PATCH_ARGS?= -d ${WRKSRC} -E ${PATCH_STRIP} 211PATCH_DIST_ARGS?= -d ${WRKSRC} -E ${PATCH_DIST_STRIP} 212.else 213PATCH_ARGS?= -d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP} 214PATCH_DIST_ARGS?= -d ${WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP} 215.endif 216 217EXTRACT_CMD?= tar 218EXTRACT_SUFX?= .tar.gz 219# Backwards compatability. 220.if defined(EXTRACT_ARGS) 221EXTRACT_BEFORE_ARGS?= ${EXTRACT_ARGS} 222.else 223EXTRACT_BEFORE_ARGS?= -xzf 224.endif 225 226PKG_CMD?= pkg_create 227.if !defined(PKG_ARGS) 228PKG_ARGS= -v -c ${PKGDIR}/COMMENT -d ${PKGDIR}/DESCR -f ${PKGDIR}/PLIST -p ${PREFIX} 229.if exists(${PKGDIR}/INSTALL) 230PKG_ARGS+= -i ${PKGDIR}/INSTALL 231.endif 232.if exists(${PKGDIR}/DEINSTALL) 233PKG_ARGS+= -k ${PKGDIR}/DEINSTALL 234.endif 235.if exists(${PKGDIR}/REQ) 236PKG_ARGS+= -r ${PKGDIR}/REQ 237.endif 238.endif 239PKG_SUFX?= .tgz 240 241ECHO_MSG?= echo 242 243ALL_TARGET?= all 244INSTALL_TARGET?= install 245 246.if defined(MASTER_SITE_FREEBSD) 247MASTER_SITE_OVERRIDE= ftp://freebsd.cdrom.com/pub/FreeBSD/FreeBSD-current/ports/distfiles/ 248.endif 249 250# I guess we're in the master distribution business! :) As we gain mirror 251# sites for distfiles, add them to this list. 252.if !defined(MASTER_SITE_OVERRIDE) 253MASTER_SITES+= ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports/distfiles/ 254PATCH_SITES+= ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports/distfiles/ 255.else 256MASTER_SITES= ${MASTER_SITE_OVERRIDE} 257PATCH_SITES= ${MASTER_SITE_OVERRIDE} 258.endif 259 260# Derived names so that they're easily overridable. 261DISTFILES?= ${DISTNAME}${EXTRACT_SUFX} 262PKGNAME?= ${DISTNAME} 263 264# Documentation 265MAINTAINER?= ports@FreeBSD.ORG 266CATEGORIES?= orphans 267KEYWORDS?= orphans 268 269.if exists(${PACKAGES}) 270PKGFILE?= ${PACKAGES}/${PKGNAME}${PKG_SUFX} 271.else 272PKGFILE?= ${PKGNAME}${PKG_SUFX} 273.endif 274 275CONFIGURE_SCRIPT?= configure 276 277.if defined(GNU_CONFIGURE) 278CONFIGURE_ARGS?= --prefix=${PREFIX} 279HAS_CONFIGURE= yes 280.endif 281 282.MAIN: all 283 284# If we're in BATCH mode and the port is interactive, or we're in 285# interactive mode and the port is non-interactive, skip all the important 286# targets. The reason we have two modes is that one might want to leave 287# a build in BATCH mode running overnight, then come back in the morning 288# and do _only_ the interactive ones that required your intervention. 289# This allows you to do both. 290# 291.if (defined(IS_INTERACTIVE) && defined(BATCH)) || (!defined(IS_INTERACTIVE) && defined(INTERACTIVE)) 292all: 293 @${DO_NADA} 294pre-build: 295 @${DO_NADA} 296build: 297 @${DO_NADA} 298pre-install: 299 @${DO_NADA} 300install: 301 @${DO_NADA} 302pre-fetch: 303 @${DO_NADA} 304fetch: 305 @${DO_NADA} 306pre-configure: 307 @${DO_NADA} 308configure: 309 @${DO_NADA} 310package: 311 @${DO_NADA} 312.endif 313 314.if !target(all) 315all: extract configure build 316.endif 317 318.if !target(is_depended) 319is_depended: all install 320.endif 321 322# The following are used to create easy dummy targets for disabling some 323# bit of default target behavior you don't want. They still check to see 324# if the target exists, and if so don't do anything, since you might want 325# to set this globally for a group of ports in a Makefile.inc, but still 326# be able to override from an individual Makefile (since you can't _undefine_ 327# a variable in make!). 328.if defined(NO_EXTRACT) && !target(extract) 329extract: 330 @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE} 331checksum: 332 @${DO_NADA} 333makesum: 334 @${DO_NADA} 335.endif 336.if defined(NO_CONFIGURE) && !target(configure) 337configure: 338 @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE} 339.endif 340.if defined(NO_BUILD) && !target(build) 341build: 342 @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE} 343.endif 344.if defined(NO_PACKAGE) && !target(package) 345package: 346 @${DO_NADA} 347.endif 348.if defined(NO_INSTALL) && !target(install) 349install: 350 @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE} 351.endif 352.if defined(NO_PATCH) && !target(patch) 353patch: 354 @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 355.endif 356 357# More standard targets start here. 358 359# This target generates an index entry suitable for aggregation into 360# a large index. Format is: 361# 362# distribution-name|port-path|installation-prefix|comment| \ 363# description-file|maintainer 364# 365.if !target(describe) 366describe: 367 @echo -n "${DISTNAME}|${.CURDIR}/${DISTNAME}|" 368 @echo -n "${PREFIX}|" 369 @if [ -f ${PKGDIR}/COMMENT ]; then \ 370 echo -n "`cat ${PKGDIR}/COMMENT`"; \ 371 else \ 372 echo -n "** No Description"; \ 373 fi 374 @if [ -f ${PKGDIR}/DESCR ]; then \ 375 echo -n "|${PKGDIR}/DESCR"; \ 376 else \ 377 echo -n "|/dev/null"; \ 378 fi 379 @echo -n "|${MAINTAINER}|${CATEGORIES}|${KEYWORDS}" 380 @echo "" 381.endif 382 383.if !target(reinstall) 384reinstall: pre-reinstall install 385 386pre-reinstall: 387 @rm -f ${INSTALL_COOKIE} 388.endif 389 390.if !target(pre-install) 391pre-install: 392 @${DO_NADA} 393.endif 394 395.if !target(install) 396install: build ${INSTALL_COOKIE} 397 398${INSTALL_COOKIE}: 399 @${ECHO_MSG} "===> Installing for ${DISTNAME}" 400 @${MAKE} ${.MAKEFLAGS} pre-install 401.if defined(USE_GMAKE) 402 @(cd ${WRKSRC}; ${GMAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET}) 403.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES) 404 @(cd ${WRKSRC}; ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man) 405.endif 406.else defined(USE_GMAKE) 407 @(cd ${WRKSRC}; ${MAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET}) 408.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES) 409 @(cd ${WRKSRC}; ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man) 410.endif 411.endif 412 @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE} 413.endif 414 415.if !target(pre-package) 416pre-package: 417 @${DO_NADA} 418.endif 419 420.if !target(package) 421package: pre-package 422# Makes some gross assumptions about a fairly simple package with no 423# install, require or deinstall scripts. Override the arguments with 424# PKG_ARGS if your package is anything but run-of-the-mill. 425 @if [ -d ${PKGDIR} ]; then \ 426 ${ECHO_MSG} "===> Building package for ${DISTNAME}"; \ 427 ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; \ 428 fi 429.endif 430 431.if !target(depends) 432depends: exec_depends lib_depends misc_depends 433 434exec_depends: 435.if defined(EXEC_DEPENDS) 436.if defined(NO_DEPENDS) 437# Just print out messages 438 @for i in ${EXEC_DEPENDS}; do \ 439 prog=`echo $$i | sed -e 's/:.*//'`; \ 440 dir=`echo $$i | sed -e 's/.*://'`; \ 441 ${ECHO_MSG} "===> ${DISTNAME} depends on executable: $$prog ($$dir)"; \ 442 done 443.else 444 @for i in ${EXEC_DEPENDS}; do \ 445 prog=`echo $$i | sed -e 's/:.*//'`; \ 446 dir=`echo $$i | sed -e 's/.*://'`; \ 447 if which -s "$$prog"; then \ 448 ${ECHO_MSG} "===> ${DISTNAME} depends on executable: $$prog - found"; \ 449 else \ 450 ${ECHO_MSG} "===> ${DISTNAME} depends on executable: $$prog - not found"; \ 451 ${ECHO_MSG} "===> Verifying build for $$prog in $$dir"; \ 452 if [ ! -d "$$dir" ]; then \ 453 ${ECHO_MSG} ">> No directory for $$prog. Skipping.."; \ 454 else \ 455 (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 456 ${ECHO_MSG} "===> Returning to build of ${DISTNAME}"; \ 457 fi; \ 458 fi; \ 459 done 460.endif 461.else 462 @${DO_NADA} 463.endif 464 465lib_depends: 466.if defined(LIB_DEPENDS) 467.if defined(NO_DEPENDS) 468# Just print out messages 469 @for i in ${LIB_DEPENDS}; do \ 470 lib=`echo $$i | sed -e 's/:.*//'`; \ 471 dir=`echo $$i | sed -e 's/.*://'`; \ 472 ${ECHO_MSG} "===> ${DISTNAME} depends on shared library: $$lib ($$dir)"; \ 473 done 474.else 475 @for i in ${LIB_DEPENDS}; do \ 476 lib=`echo $$i | sed -e 's/:.*//'`; \ 477 dir=`echo $$i | sed -e 's/.*://'`; \ 478 if ldconfig -r | grep -q -e "-l$$lib"; then \ 479 ${ECHO_MSG} "===> ${DISTNAME} depends on shared library: $$lib - found"; \ 480 else \ 481 ${ECHO_MSG} "===> ${DISTNAME} depends on shared library: $$lib - not found"; \ 482 ${ECHO_MSG} "===> Verifying build for $$lib in $$dir"; \ 483 if [ ! -d "$$dir" ]; then \ 484 ${ECHO_MSG} ">> No directory for $$lib. Skipping.."; \ 485 else \ 486 (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 487 ${ECHO_MSG} "===> Returning to build of ${DISTNAME}"; \ 488 fi; \ 489 fi; \ 490 done 491.endif 492.else 493 @${DO_NADA} 494.endif 495 496misc_depends: 497.if defined(DEPENDS) 498 @${ECHO_MSG} "===> ${DISTNAME} depends on: ${DEPENDS}" 499.if !defined(NO_DEPENDS) 500 @for i in ${DEPENDS}; do \ 501 ${ECHO_MSG} "===> Verifying build for $$i"; \ 502 if [ ! -d $$i ]; then \ 503 ${ECHO_MSG} ">> No directory for $$i. Skipping.."; \ 504 else \ 505 (cd $$i; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 506 fi \ 507 done 508 @${ECHO_MSG} "===> Returning to build of ${DISTNAME}" 509.endif 510.else 511 @${DO_NADA} 512.endif 513 514.endif 515 516.if !target(pre-build) 517pre-build: 518 @${DO_NADA} 519.endif 520 521.if !target(build) 522build: configure ${BUILD_COOKIE} 523 524${BUILD_COOKIE}: 525 @${ECHO_MSG} "===> Building for ${DISTNAME}" 526 @${MAKE} ${.MAKEFLAGS} pre-build 527.if defined(USE_GMAKE) 528 @(cd ${WRKSRC}; ${GMAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET}) 529.else defined(USE_GMAKE) 530 @(cd ${WRKSRC}; ${MAKE} PREFIX=${PREFIX} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET}) 531.endif 532 @if [ -f ${SCRIPTDIR}/post-build ]; then \ 533 env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 534 WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 535 FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 536 DEPENDS="${DEPENDS}" \ 537 sh ${SCRIPTDIR}/post-build; \ 538 fi 539 @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE} 540.endif 541 542.if !target(pre-patch) 543pre-patch: 544 @${DO_NADA} 545.endif 546 547.if !target(patch) 548patch: extract ${PATCH_COOKIE} 549 550${PATCH_COOKIE}: 551 @${MAKE} ${.MAKEFLAGS} pre-patch 552.if defined(PATCHFILES) 553 @${ECHO_MSG} "===> Applying distributed patches for ${DISTNAME}" 554.if defined(PATCH_DEBUG) 555 @(cd ${DISTDIR}; \ 556 for i in ${PATCHFILES}; do \ 557 ${ECHO_MSG} "===> Applying distributed patch $$i" ; \ 558 case $$i in \ 559 *.Z|*.gz) \ 560 zcat $$i | ${PATCH} ${PATCH_DIST_ARGS}; \ 561 ;; \ 562 *) \ 563 ${PATCH} ${PATCH_DIST_ARGS} < $$i; \ 564 ;; \ 565 esac; \ 566 done) 567.else 568 @(cd ${DISTDIR}; \ 569 for i in ${PATCHFILES}; do \ 570 case $$i in \ 571 *.Z|*.gz) \ 572 zcat $$i | ${PATCH} ${PATCH_DIST_ARGS}; \ 573 ;; \ 574 *) \ 575 ${PATCH} ${PATCH_DIST_ARGS} < $$i; \ 576 ;; \ 577 esac; \ 578 done) 579.endif 580.endif 581.if defined(PATCH_DEBUG) 582 @if [ -d ${PATCHDIR} ]; then \ 583 ${ECHO_MSG} "===> Applying FreeBSD patches for ${DISTNAME}" ; \ 584 for i in ${PATCHDIR}/patch-*; do \ 585 ${ECHO_MSG} "===> Applying FreeBSD patch $$i" ; \ 586 ${PATCH} ${PATCH_ARGS} < $$i; \ 587 done; \ 588 fi 589 @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 590.else 591 @if [ -d ${PATCHDIR} ]; then \ 592 ${ECHO_MSG} "===> Applying FreeBSD patches for ${DISTNAME}" ; \ 593 for i in ${PATCHDIR}/patch-*; \ 594 do ${PATCH} ${PATCH_ARGS} < $$i; \ 595 done;\ 596 fi 597 @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 598.endif 599.endif 600 601.if !target(pre-configure) 602pre-configure: 603 @${DO_NADA} 604.endif 605 606.if !target(configure) 607configure: depends patch ${CONFIGURE_COOKIE} 608 609${CONFIGURE_COOKIE}: 610 @${ECHO_MSG} "===> Configuring for ${DISTNAME}" 611 @${MAKE} ${.MAKEFLAGS} pre-configure 612 @if [ -f ${SCRIPTDIR}/pre-configure ]; then \ 613 env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 614 WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 615 FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 616 DEPENDS="${DEPENDS}" \ 617 sh ${SCRIPTDIR}/pre-configure; \ 618 fi 619 @if [ -f ${SCRIPTDIR}/configure ]; then \ 620 env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 621 WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 622 FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 623 DEPENDS="${DEPENDS}" \ 624 sh ${SCRIPTDIR}/configure; \ 625 fi 626.if defined(HAS_CONFIGURE) 627 @(cd ${WRKSRC}; CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \ 628 INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \ 629 INSTALL_PROGRAM="/usr/bin/install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}" \ 630 ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}) 631.endif 632.if defined(USE_IMAKE) 633.if defined(USE_GMAKE) 634 @(cd ${WRKSRC}; ${XMKMF} && ${GMAKE} Makefiles) 635.else 636 @(cd ${WRKSRC}; ${XMKMF} && ${MAKE} Makefiles) 637.endif 638.endif 639 @if [ -f ${SCRIPTDIR}/post-configure ]; then \ 640 env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 641 WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 642 FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 643 DEPENDS="${DEPENDS}" \ 644 sh ${SCRIPTDIR}/post-configure; \ 645 fi 646 @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE} 647.endif 648 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