1#-*- mode: Fundamental; tab-width: 4; -*- 2# ex:ts=4 3# 4# $NetBSD: $ 5# 6# bsd.port.mk - 940820 Jordan K. Hubbard. 7# This file is in the public domain. 8# 9# $Id: bsd.port.mk,v 1.242 1996/12/25 18:19:22 imp Exp $ 10# 11# Please view me with 4 column tabs! 12 13# This is for this file, not for the ports that includes it, so it's 14# commented out -- the person to contact if you have questions/ 15# suggestions about bsd.port.mk. 16# 17# If you are not him, you are not allowed to commit to this file without 18# his permission. :) 19# 20# MAINTAINER= asami@FreeBSD.ORG 21# 22 23# Supported Variables and their behaviors: 24# 25# Variables that typically apply to all ports: 26# 27# OPSYS - Portability clause. This is the operating system the 28# makefile is being used on. Automatically set to 29# "FreeBSD" or "NetBSD" as appropriate. 30# PORTSDIR - The root of the ports tree. Defaults: 31# FreeBSD: /usr/ports 32# NetBSD: /usr/opt 33# DISTDIR - Where to get gzip'd, tarballed copies of original sources 34# (default: ${PORTSDIR}/distfiles). 35# PREFIX - Where to install things in general (default: /usr/local). 36# MASTER_SITES - Primary location(s) for distribution files if not found 37# locally. 38# PATCH_SITES - Primary location(s) for distribution patch files 39# (see PATCHFILES below) if not found locally. 40# 41# MASTER_SITE_BACKUP - Backup location(s) for distribution files and patch 42# files if not found locally and ${MASTER_SITES}/${PATCH_SITES} 43# (default: 44# ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/) 45# MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this 46# value. 47# MASTER_SITE_FREEBSD - If set, only use ${MASTER_SITE_BACKUP} for 48# MASTER_SITES. 49# PACKAGES - A top level directory where all packages go (rather than 50# going locally to each port). (default: ${PORTSDIR}/packages). 51# GMAKE - Set to path of GNU make if not in $PATH (default: gmake). 52# XMKMF - Set to path of `xmkmf' if not in $PATH (default: xmkmf -a ). 53# MAINTAINER - The e-mail address of the contact person for this port 54# (default: ports@FreeBSD.ORG). 55# CATEGORIES - A list of descriptive categories into which this port falls. 56# 57# Variables that typically apply to an individual port. Non-Boolean 58# variables without defaults are *mandatory*. 59# 60# WRKDIR - A temporary working directory that gets *clobbered* on clean 61# (default: ${.CURDIR}/work). 62# WRKSRC - A subdirectory of ${WRKDIR} where the distribution actually 63# unpacks to. (Default: ${WRKDIR}/${DISTNAME} unless 64# NO_WRKSUBDIR is set, in which case simply ${WRKDIR}). 65# DISTNAME - Name of port or distribution. 66# DISTFILES - Name(s) of archive file(s) containing distribution 67# (default: ${DISTNAME}${EXTRACT_SUFX}). 68# PATCHFILES - Name(s) of additional files that contain distribution 69# patches (default: none). make will look for them at 70# PATCH_SITES (see above). They will automatically be 71# uncompressed before patching if the names end with 72# ".gz" or ".Z". 73# DIST_SUBDIR - Suffix to ${DISTDIR}. If set, all ${DISTFILES} 74# and ${PATCHFILES} will be put in this subdirectory of 75# ${DISTDIR}. Also they will be fetched in this subdirectory 76# from FreeBSD mirror sites. 77# ALLFILES - All of ${DISTFILES} and ${PATCHFILES}. 78# IGNOREFILES - If some of the ${ALLFILES} are not checksum-able, set 79# this variable to their names. 80# PKGNAME - Name of the package file to create if the DISTNAME 81# isn't really relevant for the port/package 82# (default: ${DISTNAME}). 83# EXTRACT_ONLY - If defined, a subset of ${DISTFILES} you want to 84# actually extract. 85# PATCHDIR - A directory containing any additional patches you made 86# to port this software to FreeBSD (default: 87# ${.CURDIR}/patches) 88# SCRIPTDIR - A directory containing any auxiliary scripts 89# (default: ${.CURDIR}/scripts) 90# FILESDIR - A directory containing any miscellaneous additional files. 91# (default: ${.CURDIR}/files) 92# PKGDIR - A direction containing any package creation files. 93# (default: ${.CURDIR}/pkg) 94# PKG_DBDIR - Where package installation is recorded (default: /var/db/pkg) 95# FORCE_PKG_REGISTER - If set, it will overwrite any existing package 96# registration information in ${PKG_DBDIR}/${PKGNAME}. 97# NO_MTREE - If set, will not invoke mtree from bsd.port.mk from 98# the "install" target. This is the default if 99# USE_IMAKE or USE_X11 is set. 100# 101# NO_BUILD - Use a dummy (do-nothing) build target. 102# NO_CONFIGURE - Use a dummy (do-nothing) configure target. 103# NO_CDROM - Port may not go on CDROM. Set this string to reason. 104# NO_DESCRIBE - Use a dummy (do-nothing) describe target. 105# NO_EXTRACT - Use a dummy (do-nothing) extract target. 106# NO_INSTALL - Use a dummy (do-nothing) install target. 107# NO_PACKAGE - Use a dummy (do-nothing) package target. 108# NO_PKG_REGISTER - Don't register a port install as a package. 109# NO_WRKSUBDIR - Assume port unpacks directly into ${WRKDIR}. 110# NO_WRKDIR - There's no work directory at all; port does this someplace 111# else. 112# NO_DEPENDS - Don't verify build of dependencies. 113# BROKEN - Port is broken. Set this string to the reason why. 114# RESTRICTED - Port is restricted. Set this string to the reason why. 115# USE_GMAKE - Says that the port uses gmake. 116# USE_IMAKE - Says that the port uses imake. 117# USE_X11 - Says that the port uses X11. 118# NO_INSTALL_MANPAGES - For imake ports that don't like the install.man 119# target. 120# HAS_CONFIGURE - Says that the port has its own configure script. 121# GNU_CONFIGURE - Set if you are using GNU configure (optional). 122# CONFIGURE_SCRIPT - Name of configure script, defaults to 'configure'. 123# CONFIGURE_ARGS - Pass these args to configure if ${HAS_CONFIGURE} is set. 124# CONFIGURE_ENV - Pass these env (shell-like) to configure if 125# ${HAS_CONFIGURE} is set. 126# IS_INTERACTIVE - Set this if your port needs to interact with the user 127# during a build. User can then decide to skip this port by 128# setting ${BATCH}, or compiling only the interactive ports 129# by setting ${INTERACTIVE}. 130# FETCH_DEPENDS - A list of "path:dir" pairs of other ports this 131# package depends in the "fetch" stage. "path" is the 132# name of a file if it starts with a slash (/), an 133# executable otherwise. make will test for the 134# existence (if it is a full pathname) or search for 135# it in your $PATH (if it is an executable) and go 136# into "dir" to do a "make all install" if it's not 137# found. 138# BUILD_DEPENDS - A list of "path:dir" pairs of other ports this 139# package depends to build (between the "extract" and 140# "build" stages, inclusive). The test done to 141# determine the existence of the dependency is the 142# same as FETCH_DEPENDS. 143# RUN_DEPENDS - A list of "path:dir" pairs of other ports this 144# package depends to run. The test done to determine 145# the existence of the dependency is the same as 146# FETCH_DEPENDS. This will be checked during the 147# "install" stage and the name of the dependency will 148# be put into the package as well. 149# LIB_DEPENDS - A list of "lib:dir" pairs of other ports this package 150# depends on. "lib" is the name of a shared library. 151# make will use "ldconfig -r" to search for the 152# library. Note that lib can be any regular expression, 153# and you need two backslashes in front of dots (.) to 154# supress its special meaning (e.g., use 155# "foo\\.2\\.:${PORTSDIR}/utils/foo" to match "libfoo.2.*"). 156# DEPENDS - A list of other ports this package depends on being 157# made first. Use this for things that don't fall into 158# the above two categories. 159# EXTRACT_CMD - Command for extracting archive (default: tar). 160# EXTRACT_SUFX - Suffix for archive names (default: .tar.gz). 161# EXTRACT_BEFORE_ARGS - 162# Arguments to ${EXTRACT_CMD} before filename 163# (default: -C ${WRKDIR} -xzf). 164# EXTRACT_AFTER_ARGS - 165# Arguments to ${EXTRACT_CMD} following filename 166# (default: none). 167# 168# FETCH_CMD - Full path to ftp/http fetch command if not in $PATH 169# (default: /usr/bin/fetch). 170# FETCH_BEFORE_ARGS - 171# Arguments to ${FETCH_CMD} before filename (default: none). 172# FETCH_AFTER_ARGS - 173# Arguments to ${FETCH_CMD} following filename (default: none). 174# 175# Motif support: 176# 177# REQUIRES_MOTIF - Set this in your port if it requires Motif. It will be 178# built only if HAVE_MOTIF is set. 179# HAVE_MOTIF - If set, means system has Motif. Typically set in 180# /etc/make.conf. 181# MOTIF_STATIC - If set, link libXm statically; otherwise, link it 182# dynamically. Typically set in /etc/make.conf. 183# MOTIFLIB - Set automatically to appropriate value depending on 184# ${MOTIF_STATIC}. Substitute references to -lXm with 185# patches to make your port conform to our standards. 186# 187# Variables to change if you want a special behavior: 188# 189# ECHO_MSG - Used to print all the '===>' style prompts - override this 190# to turn them off (default: /bin/echo). 191# IS_DEPENDED_TARGET - 192# The target to execute when a port is called as a 193# dependency (default: install). E.g., "make fetch 194# IS_DEPENDED_TARGET=fetch" will fetch all the distfiles, 195# including those of dependencies, without actually building 196# any of them). 197# PATCH_DEBUG - If set, print out more information about the patches as 198# it attempts to apply them. 199# 200# Variables that serve as convenient "aliases" for your *-install targets. 201# Use these like: "${INSTALL_PROGRAM} ${WRKSRC}/prog ${PREFIX}/bin". 202# 203# INSTALL_PROGRAM - A command to install binary executables. 204# INSTALL_SCRIPT - A command to install executable scripts. 205# INSTALL_DATA - A command to install sharable data. 206# INSTALL_MAN - A command to install manpages (doesn't compress). 207# 208# If your port doesn't automatically compress manpages, set the following. 209# Depending on the setting of NOMANCOMPRESS, the make rules will compress 210# the manpages for you. 211# 212# MAN<sect> - A list of manpages, categorized by section. For 213# example, if your port has "man/man1/foo.1" and 214# "man/mann/bar.n", set "MAN1=foo.1" and "MANN=bar.n". 215# The available sections chars are "123456789LN". 216# MANPREFIX - The directory prefix for ${MAN<sect>} (default: ${PREFIX}). 217# 218# Default targets and their behaviors: 219# 220# fetch - Retrieves ${DISTFILES} (and ${PATCHFILES} if defined) 221# into ${DISTDIR} as necessary. 222# fetch-list - Show list of files that would be retrieved by fetch 223# extract - Unpacks ${DISTFILES} into ${WRKDIR}. 224# patch - Apply any provided patches to the source. 225# configure - Runs either GNU configure, one or more local configure 226# scripts or nothing, depending on what's available. 227# build - Actually compile the sources. 228# install - Install the results of a build. 229# reinstall - Install the results of a build, ignoring "already installed" 230# flag. 231# package - Create a package from an _installed_ port. 232# describe - Try to generate a one-line description for each port for 233# use in INDEX files and the like. 234# checkpatch - Do a "patch -C" instead of a "patch". Note that it may 235# give incorrect results if multiple patches deal with 236# the same file. 237# checksum - Use files/md5 to ensure that your distfiles are valid. 238# makesum - Generate files/md5 (only do this for your own ports!). 239# 240# Default sequence for "all" is: fetch checksum extract patch configure build 241# 242# Please read the comments in the targets section below, you 243# should be able to use the pre-* or post-* targets/scripts 244# (which are available for every stage except checksum) or 245# override the do-* targets to do pretty much anything you want. 246# 247# NEVER override the "regular" targets unless you want to open 248# a major can of worms. 249 250# Get the operating system type 251OPSYS!= uname -s 252 253.if exists(${.CURDIR}/../Makefile.inc) 254.include "${.CURDIR}/../Makefile.inc" 255.endif 256 257 258# These need to be absolute since we don't know how deep in the ports 259# tree we are and thus can't go relative. They can, of course, be overridden 260# by individual Makefiles or local system make configuration. 261.if (${OPSYS} == "NetBSD") 262PORTSDIR?= ${DESTDIR}/usr/opt 263.else 264PORTSDIR?= ${DESTDIR}/usr/ports 265.endif 266LOCALBASE?= /usr/local 267X11BASE?= /usr/X11R6 268DISTDIR?= ${PORTSDIR}/distfiles 269_DISTDIR?= ${DISTDIR}/${DIST_SUBDIR} 270PACKAGES?= ${PORTSDIR}/packages 271TEMPLATES?= ${PORTSDIR}/templates 272.if !defined(NO_WRKDIR) 273WRKDIR?= ${.CURDIR}/work 274.else 275WRKDIR?= ${.CURDIR} 276.endif 277.if defined(NO_WRKSUBDIR) 278WRKSRC?= ${WRKDIR} 279.else 280WRKSRC?= ${WRKDIR}/${DISTNAME} 281.endif 282PATCHDIR?= ${.CURDIR}/patches 283SCRIPTDIR?= ${.CURDIR}/scripts 284FILESDIR?= ${.CURDIR}/files 285PKGDIR?= ${.CURDIR}/pkg 286.if defined(USE_IMAKE) || defined(USE_X11) 287PREFIX?= ${X11BASE} 288.else 289PREFIX?= ${LOCALBASE} 290.endif 291# The following 4 lines should go away as soon as the ports are all updated 292.if defined(EXEC_DEPENDS) 293BUILD_DEPENDS+= ${EXEC_DEPENDS} 294RUN_DEPENDS+= ${EXEC_DEPENDS} 295.endif 296.if defined(USE_GMAKE) 297BUILD_DEPENDS+= gmake:${PORTSDIR}/devel/gmake 298.endif 299 300.if exists(${PORTSDIR}/../Makefile.inc) 301.include "${PORTSDIR}/../Makefile.inc" 302.endif 303 304# Don't change these!!! These names are built into the _TARGET_USE macro, 305# there is no way to refer to them cleanly from within the macro AFAIK. 306EXTRACT_COOKIE?= ${WRKDIR}/.extract_done 307CONFIGURE_COOKIE?= ${WRKDIR}/.configure_done 308INSTALL_COOKIE?= ${WRKDIR}/.install_done 309BUILD_COOKIE?= ${WRKDIR}/.build_done 310PATCH_COOKIE?= ${WRKDIR}/.patch_done 311PACKAGE_COOKIE?= ${WRKDIR}/.package_done 312 313# How to do nothing. Override if you, for some strange reason, would rather 314# do something. 315DO_NADA?= /usr/bin/true 316 317# Miscellaneous overridable commands: 318GMAKE?= gmake 319XMKMF?= xmkmf -a 320.if (${OPSYS} == "NetBSD") 321MD5?= /usr/bin/md5 322.else 323MD5?= /sbin/md5 324.endif 325MD5_FILE?= ${FILESDIR}/md5 326 327MAKE_FLAGS?= -f 328MAKEFILE?= Makefile 329MAKE_ENV+= PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} MOTIFLIB="${MOTIFLIB}" CFLAGS="${CFLAGS}" 330 331FETCH_CMD?= /usr/bin/fetch 332 333TOUCH?= /usr/bin/touch 334TOUCH_FLAGS?= -f 335 336PATCH?= /usr/bin/patch 337PATCH_STRIP?= -p0 338PATCH_DIST_STRIP?= -p0 339.if defined(PATCH_DEBUG) 340PATCH_DEBUG_TMP= yes 341PATCH_ARGS?= -d ${WRKSRC} -E ${PATCH_STRIP} 342PATCH_DIST_ARGS?= -d ${WRKSRC} -E ${PATCH_DIST_STRIP} 343.else 344PATCH_DEBUG_TMP= no 345PATCH_ARGS?= -d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP} 346PATCH_DIST_ARGS?= -d ${WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP} 347.endif 348.if defined(BATCH) 349PATCH_ARGS+= --batch 350PATCH_DIST_ARGS+= --batch 351.endif 352 353.if defined(PATCH_CHECK_ONLY) 354PATCH_ARGS+= -C 355PATCH_DIST_ARGS+= -C 356.endif 357 358EXTRACT_CMD?= /usr/bin/tar 359EXTRACT_SUFX?= .tar.gz 360# Backwards compatability. 361.if defined(EXTRACT_ARGS) 362EXTRACT_BEFORE_ARGS?= ${EXTRACT_ARGS} 363.else 364EXTRACT_BEFORE_ARGS?= -xzf 365.endif 366 367# Figure out where the local mtree file is 368.if !defined(MTREE_LOCAL) && exists(/etc/mtree/BSD.local.dist) 369MTREE_LOCAL= /etc/mtree/BSD.local.dist 370.endif 371MTREE_CMD?= /usr/sbin/mtree 372MTREE_ARGS?= -U -f ${MTREE_LOCAL} -d -e -p 373.if defined(USE_X11) || defined(USE_IMAKE) || !defined(MTREE_LOCAL) 374NO_MTREE= yes 375.endif 376 377# A few aliases for *-install targets 378INSTALL_PROGRAM= \ 379 ${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} 380INSTALL_SCRIPT= \ 381 ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} 382INSTALL_DATA= \ 383 ${INSTALL} ${COPY} -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE} 384INSTALL_MAN= \ 385 ${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} 386 387# The user can override the NO_PACKAGE by specifying this from 388# the make command line 389.if defined(FORCE_PACKAGE) 390.undef NO_PACKAGE 391.endif 392 393PKG_CMD?= /usr/sbin/pkg_create 394.if !defined(PKG_ARGS) 395PKG_ARGS= -v -c ${PKGDIR}/COMMENT -d ${PKGDIR}/DESCR -f ${PKGDIR}/PLIST -p ${PREFIX} -P "`${MAKE} package-depends|sort -u`" 396.if exists(${PKGDIR}/INSTALL) 397PKG_ARGS+= -i ${PKGDIR}/INSTALL 398.endif 399.if exists(${PKGDIR}/DEINSTALL) 400PKG_ARGS+= -k ${PKGDIR}/DEINSTALL 401.endif 402.if exists(${PKGDIR}/REQ) 403PKG_ARGS+= -r ${PKGDIR}/REQ 404.endif 405.if exists(${PKGDIR}/MESSAGE) 406PKG_ARGS+= -D ${PKGDIR}/MESSAGE 407.endif 408.if !defined(NO_MTREE) && defined(MTREE_LOCAL) 409PKG_ARGS+= -m ${MTREE_LOCAL} 410.endif 411.endif 412PKG_SUFX?= .tgz 413# where pkg_add records its dirty deeds. 414PKG_DBDIR?= /var/db/pkg 415 416# shared/dynamic motif libs 417.if defined(HAVE_MOTIF) 418.if defined(MOTIF_STATIC) 419MOTIFLIB?= ${X11BASE}/lib/libXm.a 420.else 421MOTIFLIB?= -L${X11BASE}/lib -lXm 422.endif 423.endif 424 425ECHO?= /bin/echo 426CAT?= /bin/cat 427CP?= /bin/cp 428SETENV?= /usr/bin/env 429RM?= /bin/rm 430MKDIR?= /bin/mkdir -p 431RMDIR?= /bin/rmdir 432AWK?= /usr/bin/awk 433BASENAME?= /usr/bin/basename 434FALSE?= /usr/bin/false 435GREP?= /usr/bin/grep 436GZCAT?= /usr/bin/gzcat 437GZIP?= -9 438GZIP_CMD?= /usr/bin/gzip -nf ${GZIP} 439GUNZIP_CMD?= /usr/bin/gunzip -f 440SED?= /usr/bin/sed 441 442# Used to print all the '===>' style prompts - override this to turn them off. 443ECHO_MSG?= ${ECHO} 444 445ALL_TARGET?= all 446INSTALL_TARGET?= install 447 448# Popular master sites 449MASTER_SITE_XCONTRIB?= \ 450 ftp://ftp.x.org/contrib/${MASTER_SITE_SUBDIR}/ \ 451 ftp://crl.dec.com/pub/X11/contrib/${MASTER_SITE_SUBDIR}/ 452 453MASTER_SITE_GNU?= \ 454 ftp://prep.ai.mit.edu/pub/gnu/${MASTER_SITE_SUBDIR}/ \ 455 ftp://wuarchive.wustl.edu/systems/gnu/${MASTER_SITE_SUBDIR}/ 456 457MASTER_SITE_PERL_CPAN?= \ 458 ftp://ftp.digital.com/pub/plan/perl/CPAN/modules/by-module/${MASTER_SITE_SUBDIR}/ \ 459 ftp://ftp.cdrom.com/pub/perl/CPAN/modules/by-module/${MASTER_SITE_SUBDIR}/ 460 461MASTER_SITE_TEX_CTAN?= \ 462 ftp://ftp.cdrom.com/pub/tex/ctan/${MASTER_SITE_SUBDIR}/ \ 463 ftp://wuarchive.wustl.edu/packages/TeX/${MASTER_SITE_SUBDIR}/ \ 464 ftp://ftp.funet.fi/pub/TeX/CTAN/${MASTER_SITE_SUBDIR}/ \ 465 ftp.tex.ac.uk/public/ctan/tex-archive/${MASTER_SITE_SUBDIR}/ 466 467MASTER_SITE_SUNSITE?= \ 468 ftp://sunsite.unc.edu/pub/Linux/${MASTER_SITE_SUBDIR}/ \ 469 ftp://ftp.infomagic.com/pub/mirrors/linux/sunsite/${MASTER_SITE_SUBDIR}/ \ 470 ftp://ftp.funet.fi/pub/mirrors/sunsite.unc.edu/pub/Linux/${MASTER_SITE_SUBDIR}/ 471 472# The primary backup site. 473MASTER_SITE_BACKUP?= \ 474 ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ 475 476# If the user has this set, go to the FreeBSD repository for everything. 477.if defined(MASTER_SITE_FREEBSD) 478MASTER_SITE_OVERRIDE= ${MASTER_SITE_BACKUP} 479.endif 480 481# Empty declaration to avoid "variable MASTER_SITES recursive" error 482MASTER_SITES?= 483PATCH_SITES?= 484# I guess we're in the master distribution business! :) As we gain mirror 485# sites for distfiles, add them to this list. 486.if !defined(MASTER_SITE_OVERRIDE) 487MASTER_SITES+= ${MASTER_SITE_BACKUP} 488PATCH_SITES+= ${MASTER_SITE_BACKUP} 489.else 490MASTER_SITES:= ${MASTER_SITE_OVERRIDE} ${MASTER_SITES} 491PATCH_SITES:= ${MASTER_SITE_OVERRIDE} ${PATCH_SITES} 492.endif 493 494# Search CDROM first if mounted, symlink instead of copy if 495# FETCH_SYMLINK_DISTFILES is set 496.if exists(/cdrom/ports/distfiles) 497MASTER_SITES:= file:/cdrom/ports/distfiles/${DIST_SUBDIR}/ ${MASTER_SITES} 498PATCH_SITES:= file:/cdrom/ports/distfiles/${DIST_SUBDIR}/ ${PATCH_SITES} 499.if defined(FETCH_SYMLINK_DISTFILES) 500FETCH_BEFORE_ARGS+= -l 501.endif 502.endif 503 504# Derived names so that they're easily overridable. 505DISTFILES?= ${DISTNAME}${EXTRACT_SUFX} 506PKGNAME?= ${DISTNAME} 507 508ALLFILES?= ${DISTFILES} ${PATCHFILES} 509 510.if defined(IGNOREFILES) 511CKSUMFILES!= \ 512 for file in ${ALLFILES}; do \ 513 ignore=0; \ 514 for tmp in ${IGNOREFILES}; do \ 515 if [ "$$file" = "$$tmp" ]; then \ 516 ignore=1; \ 517 fi; \ 518 done; \ 519 if [ "$$ignore" = 0 ]; then \ 520 echo "$$file"; \ 521 fi; \ 522 done 523.else 524CKSUMFILES= ${ALLFILES} 525.endif 526 527# List of all files, with ${DIST_SUBDIR} in front. Used for checksum. 528.if defined(DIST_SUBDIR) 529_CKSUMFILES?= ${CKSUMFILES:S/^/${DIST_SUBDIR}\//} 530_IGNOREFILES?= ${IGNOREFILES:S/^/${DIST_SUBDIR}\//} 531.else 532_CKSUMFILES?= ${CKSUMFILES} 533_IGNOREFILES?= ${IGNOREFILES} 534.endif 535 536# This is what is actually going to be extracted, and is overridable 537# by user. 538EXTRACT_ONLY?= ${DISTFILES} 539 540# Documentation 541MAINTAINER?= ports@FreeBSD.ORG 542 543.if !defined(CATEGORIES) 544.BEGIN: 545 @${ECHO_MSG} "CATEGORIES is mandatory." 546 @${FALSE} 547.endif 548 549# Note this has to start with a capital letter (or more accurately, it 550# shouldn't match "[a-z]*"), see the target "delete-package-links" below. 551PKGREPOSITORYSUBDIR?= All 552PKGREPOSITORY?= ${PACKAGES}/${PKGREPOSITORYSUBDIR} 553.if exists(${PACKAGES}) 554PKGFILE?= ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX} 555.else 556PKGFILE?= ${PKGNAME}${PKG_SUFX} 557.endif 558 559CONFIGURE_SCRIPT?= configure 560 561.if defined(GNU_CONFIGURE) 562CONFIGURE_ARGS+= --prefix=${PREFIX} 563HAS_CONFIGURE= yes 564.endif 565 566MANPREFIX?= ${PREFIX} 567 568.for sect in 1 2 3 4 5 6 7 8 9 569MAN${sect}PREFIX?= ${MANPREFIX} 570.endfor 571MANLPREFIX?= ${MANPREFIX} 572MANNPREFIX?= ${MANPREFIX} 573 574MANLANG?= "" # english only by default 575 576.for lang in ${MANLANG} 577 578.for sect in 1 2 3 4 5 6 7 8 9 579.if defined(MAN${sect}) 580_MANPAGES+= ${MAN${sect}:S%^%${MAN${sect}PREFIX}/man/${lang}/man${sect}/%} 581.endif 582.endfor 583 584.if defined(MANL) 585_MANPAGES+= ${MANL:S%^%${MANLPREFIX}/man/${lang}/manl/%} 586.endif 587 588.if defined(MANN) 589_MANPAGES+= ${MANN:S%^%${MANNPREFIX}/man/${lang}/mann/%} 590.endif 591 592.endfor 593 594.if defined(_MANPAGES) && defined(MANCOMPRESSED) 595_MANPAGES:= ${_MANPAGES:S/$/.gz/} 596.endif 597 598.MAIN: all 599 600################################################################ 601# Many ways to disable a port. 602# 603# If we're in BATCH mode and the port is interactive, or we're 604# in interactive mode and the port is non-interactive, skip all 605# the important targets. The reason we have two modes is that 606# one might want to leave a build in BATCH mode running 607# overnight, then come back in the morning and do _only_ the 608# interactive ones that required your intervention. 609# 610# Don't attempt to build ports that require Motif if you don't 611# have Motif. 612# 613# Ignore ports that can't be resold if building for a CDROM. 614# 615# Don't build a port if it's restricted and we don't want to get 616# into that. 617# 618# Don't build a port if it's broken. 619################################################################ 620 621.if (defined(IS_INTERACTIVE) && defined(BATCH)) 622IGNORE= "is an interactive port" 623.elif (!defined(IS_INTERACTIVE) && defined(INTERACTIVE)) 624IGNORE= "is not an interactive port" 625.elif (defined(REQUIRES_MOTIF) && !defined(HAVE_MOTIF)) 626IGNORE= "requires Motif" 627.elif (defined(NO_CDROM) && defined(FOR_CDROM)) 628IGNORE= "may not be placed on a CDROM: ${NO_CDROM}" 629.elif (defined(RESTRICTED) && defined(NO_RESTRICTED)) 630IGNORE= "is restricted: ${RESTRICTED}" 631.elif defined(BROKEN) 632IGNORE= "is marked as broken: ${BROKEN}" 633.endif 634 635.if defined(IGNORE) 636.if defined(IGNORE_SILENT) 637IGNORECMD= ${DO_NADA} 638.else 639IGNORECMD= ${ECHO_MSG} "===> ${PKGNAME} ${IGNORE}." 640.endif 641fetch: 642 @${IGNORECMD} 643checksum: 644 @${IGNORECMD} 645extract: 646 @${IGNORECMD} 647patch: 648 @${IGNORECMD} 649configure: 650 @${IGNORECMD} 651all: 652 @${IGNORECMD} 653build: 654 @${IGNORECMD} 655install: 656 @${IGNORECMD} 657package: 658 @${IGNORECMD} 659.endif 660 661.if defined(ALL_HOOK) 662all: 663 @cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTNAME=${DISTNAME} \ 664 DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} \ 665 PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 666 FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 667 DEPENDS="${DEPENDS}" BUILD_DEPENDS="${BUILD_DEPENDS}" \ 668 RUN_DEPENDS="${RUN_DEPENDS}" X11BASE=${X11BASE} \ 669 ${ALL_HOOK} 670.endif 671 672.if !target(all) 673all: build 674.endif 675 676.if !defined(IS_DEPENDED_TARGET) 677IS_DEPENDED_TARGET= install 678.endif 679 680.if !target(is_depended) 681is_depended: ${IS_DEPENDED_TARGET} 682.endif 683 684################################################################ 685# The following are used to create easy dummy targets for 686# disabling some bit of default target behavior you don't want. 687# They still check to see if the target exists, and if so don't 688# do anything, since you might want to set this globally for a 689# group of ports in a Makefile.inc, but still be able to 690# override from an individual Makefile. 691################################################################ 692 693# Disable checksum 694.if defined(NO_CHECKSUM) && !target(checksum) 695checksum: fetch 696 @${DO_NADA} 697.endif 698 699# Disable extract 700.if defined(NO_EXTRACT) && !target(extract) 701extract: checksum 702 @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE} 703checksum: fetch 704 @${DO_NADA} 705makesum: 706 @${DO_NADA} 707.endif 708 709# Disable patch 710.if defined(NO_PATCH) && !target(patch) 711patch: extract 712 @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 713.endif 714 715# Disable configure 716.if defined(NO_CONFIGURE) && !target(configure) 717configure: patch 718 @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE} 719.endif 720 721# Disable build 722.if defined(NO_BUILD) && !target(build) 723build: configure 724 @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE} 725.endif 726 727# Disable install 728.if defined(NO_INSTALL) && !target(install) 729install: build 730 @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE} 731.endif 732 733# Disable package 734.if defined(NO_PACKAGE) && !target(package) 735package: 736.if defined(IGNORE_SILENT) 737 @${DO_NADA} 738.else 739 @${ECHO_MSG} "===> ${PKGNAME} may not be packaged: ${NO_PACKAGE}." 740.endif 741.endif 742 743# Disable describe 744.if defined(NO_DESCRIBE) && !target(describe) 745describe: 746 @${DO_NADA} 747.endif 748 749################################################################ 750# More standard targets start here. 751# 752# These are the body of the build/install framework. If you are 753# not happy with the default actions, and you can't solve it by 754# adding pre-* or post-* targets/scripts, override these. 755################################################################ 756 757# Fetch 758 759.if !target(do-fetch) 760do-fetch: 761 @${MKDIR} ${_DISTDIR} 762 @(cd ${_DISTDIR}; \ 763 for file in ${DISTFILES}; do \ 764 if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \ 765 if [ -h $$file -o -h `${BASENAME} $$file` ]; then \ 766 ${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \ 767 ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \ 768 ${ECHO_MSG} ">> Please correct this problem and try again."; \ 769 exit 1; \ 770 fi ; \ 771 ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \ 772 for site in ${MASTER_SITES}; do \ 773 ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \ 774 if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \ 775 continue 2; \ 776 fi \ 777 done; \ 778 ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\ 779 ${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \ 780 exit 1; \ 781 fi \ 782 done) 783.if defined(PATCHFILES) 784 @(cd ${_DISTDIR}; \ 785 for file in ${PATCHFILES}; do \ 786 if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \ 787 if [ -h $$file -o -h `${BASENAME} $$file` ]; then \ 788 ${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \ 789 ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \ 790 ${ECHO_MSG} ">> Please correct this problem and try again."; \ 791 exit 1; \ 792 fi ; \ 793 ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \ 794 for site in ${PATCH_SITES}; do \ 795 ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \ 796 if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \ 797 continue 2; \ 798 fi \ 799 done; \ 800 ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\ 801 ${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \ 802 exit 1; \ 803 fi \ 804 done) 805.endif 806.endif 807 808# Extract 809 810.if !target(do-extract) 811do-extract: 812.if !defined(NO_WRKDIR) 813 @${RM} -rf ${WRKDIR} 814 @${MKDIR} ${WRKDIR} 815.endif 816 @for file in ${EXTRACT_ONLY}; do \ 817 if !(cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\ 818 then \ 819 exit 1; \ 820 fi \ 821 done 822.endif 823 824# Patch 825 826.if !target(do-patch) 827do-patch: 828.if defined(PATCHFILES) 829 @${ECHO_MSG} "===> Applying distribution patches for ${PKGNAME}" 830 @(cd ${_DISTDIR}; \ 831 for i in ${PATCHFILES}; do \ 832 if [ ${PATCH_DEBUG_TMP} = yes ]; then \ 833 ${ECHO_MSG} "===> Applying distribution patch $$i" ; \ 834 fi; \ 835 case $$i in \ 836 *.Z|*.gz) \ 837 ${GZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \ 838 ;; \ 839 *) \ 840 ${PATCH} ${PATCH_DIST_ARGS} < $$i; \ 841 ;; \ 842 esac; \ 843 done) 844.endif 845 @if [ -d ${PATCHDIR} ]; then \ 846 if [ "`echo ${PATCHDIR}/patch-*`" = "${PATCHDIR}/patch-*" ]; then \ 847 ${ECHO_MSG} "===> Ignoring empty patch directory"; \ 848 if [ -d ${PATCHDIR}/CVS ]; then \ 849 ${ECHO_MSG} "===> Perhaps you forgot the -P flag to cvs co or update?"; \ 850 fi; \ 851 else \ 852 ${ECHO_MSG} "===> Applying ${OPSYS} patches for ${PKGNAME}" ; \ 853 for i in ${PATCHDIR}/patch-*; do \ 854 case $$i in \ 855 *.orig|*~) \ 856 ${ECHO_MSG} "===> Ignoring patchfile $$i" ; \ 857 ;; \ 858 *) \ 859 if [ ${PATCH_DEBUG_TMP} = yes ]; then \ 860 ${ECHO_MSG} "===> Applying ${OPSYS} patch $$i" ; \ 861 fi; \ 862 ${PATCH} ${PATCH_ARGS} < $$i; \ 863 ;; \ 864 esac; \ 865 done; \ 866 fi; \ 867 fi 868.endif 869 870# Configure 871 872.if !target(do-configure) 873do-configure: 874 @if [ -f ${SCRIPTDIR}/configure ]; then \ 875 cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR}\ 876 WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} \ 877 SCRIPTDIR=${SCRIPTDIR} FILESDIR=${FILESDIR} \ 878 PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} DEPENDS="${DEPENDS}" \ 879 X11BASE=${X11BASE} /bin/sh ${SCRIPTDIR}/configure; \ 880 fi 881.if defined(HAS_CONFIGURE) 882 @(cd ${WRKSRC} && CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \ 883 INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \ 884 INSTALL_PROGRAM="${INSTALL_PROGRAM}" \ 885 ${CONFIGURE_ENV} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}) 886.endif 887.if defined(USE_IMAKE) 888 @(cd ${WRKSRC} && ${XMKMF}) 889.endif 890.endif 891 892# Build 893 894.if !target(do-build) 895do-build: 896.if defined(USE_GMAKE) 897 @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET}) 898.else defined(USE_GMAKE) 899 @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET}) 900.endif 901.endif 902 903# Install 904 905.if !target(do-install) 906do-install: 907 @if [ `/bin/sh -c umask` != 0022 ]; then \ 908 ${ECHO_MSG} "===> Warning: your umask is \"`/bin/sh -c umask`"\".; \ 909 ${ECHO_MSG} " If this is not desired, set it to an appropriate value"; \ 910 ${ECHO_MSG} " and install this port again by \`\`make reinstall''."; \ 911 fi 912.if defined(USE_GMAKE) 913 @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET}) 914.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES) 915 @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man) 916.endif 917.else defined(USE_GMAKE) 918 @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET}) 919.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES) 920 @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man) 921.endif 922.endif 923.endif 924 925# Package 926 927.if !target(do-package) 928do-package: 929 @if [ -e ${PKGDIR}/PLIST ]; then \ 930 ${ECHO_MSG} "===> Building package for ${PKGNAME}"; \ 931 if [ -d ${PACKAGES} ]; then \ 932 if [ ! -d ${PKGREPOSITORY} ]; then \ 933 if ! ${MKDIR} ${PKGREPOSITORY}; then \ 934 ${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \ 935 exit 1; \ 936 fi; \ 937 fi; \ 938 fi; \ 939 if ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; then \ 940 if [ -d ${PACKAGES} ]; then \ 941 ${MAKE} ${.MAKEFLAGS} package-links; \ 942 fi; \ 943 else \ 944 ${MAKE} ${.MAKEFLAGS} delete-package; \ 945 exit 1; \ 946 fi; \ 947 fi 948.endif 949 950# Some support rules for do-package 951 952.if !target(package-links) 953package-links: 954 @${MAKE} ${.MAKEFLAGS} delete-package-links 955 @for cat in ${CATEGORIES}; do \ 956 if [ ! -d ${PACKAGES}/$$cat ]; then \ 957 if ! ${MKDIR} ${PACKAGES}/$$cat; then \ 958 ${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \ 959 exit 1; \ 960 fi; \ 961 fi; \ 962 ln -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \ 963 done; 964.endif 965 966.if !target(delete-package-links) 967delete-package-links: 968 @${RM} -f ${PACKAGES}/[a-z]*/${PKGNAME}${PKG_SUFX}; 969.endif 970 971.if !target(delete-package) 972delete-package: 973 @${MAKE} ${.MAKEFLAGS} delete-package-links 974 @${RM} -f ${PKGFILE} 975.endif 976 977################################################################ 978# This is the "generic" port target, actually a macro used from the 979# six main targets. See below for more. 980################################################################ 981 982_PORT_USE: .USE 983.if make(real-fetch) 984 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends 985.endif 986.if make(real-extract) 987 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends lib-depends misc-depends 988.endif 989.if make(real-install) 990 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends lib-depends 991.endif 992.if make(real-install) 993.if !defined(NO_MTREE) 994 @if [ `id -u` = 0 ]; then \ 995 ${MTREE_CMD} ${MTREE_ARGS} ${PREFIX}/; \ 996 else \ 997 ${ECHO_MSG} "Warning: not superuser, can't run mtree."; \ 998 ${ECHO_MSG} "Become root and try again to ensure correct permissions."; \ 999 fi 1000.endif 1001.endif 1002 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/pre-/} 1003 @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/} ]; then \ 1004 cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 1005 WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 1006 FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 1007 DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ 1008 /bin/sh ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/}; \ 1009 fi 1010 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/do-/} 1011 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/post-/} 1012 @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/post-/} ]; then \ 1013 cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR}\ 1014 WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} \ 1015 SCRIPTDIR=${SCRIPTDIR} FILESDIR=${FILESDIR} \ 1016 PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} DEPENDS="${DEPENDS}" \ 1017 X11BASE=${X11BASE} \ 1018 /bin/sh ${SCRIPTDIR}/${.TARGET:S/^real-/post-/}; \ 1019 fi 1020.if make(real-install) && defined(_MANPAGES) 1021.if defined(MANCOMPRESSED) && defined(NOMANCOMPRESS) 1022 @${ECHO_MSG} "===> Uncompressing manual pages for ${PKGNAME}" 1023.for manpage in ${_MANPAGES} 1024 @${GUNZIP_CMD} ${manpage} 1025.endfor 1026.elif !defined(MANCOMPRESSED) && !defined(NOMANCOMPRESS) 1027 @${ECHO_MSG} "===> Compressing manual pages for ${PKGNAME}" 1028.for manpage in ${_MANPAGES} 1029 @${GZIP_CMD} ${manpage} 1030.endfor 1031.endif 1032.endif 1033.if make(real-install) && !defined(NO_PKG_REGISTER) 1034 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fake-pkg 1035.endif 1036.if !make(real-fetch) \ 1037 && (!make(real-patch) || !defined(PATCH_CHECK_ONLY)) \ 1038 && (!make(real-package) || !defined(PACKAGE_NOINSTALL)) 1039 @${TOUCH} ${TOUCH_FLAGS} ${WRKDIR}/.${.TARGET:S/^real-//}_done 1040.endif 1041 1042################################################################ 1043# Skeleton targets start here 1044# 1045# You shouldn't have to change these. Either add the pre-* or 1046# post-* targets/scripts or redefine the do-* targets. These 1047# targets don't do anything other than checking for cookies and 1048# call the necessary targets/scripts. 1049################################################################ 1050 1051.if !target(fetch) 1052fetch: 1053 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-fetch 1054.endif 1055 1056.if !target(extract) 1057extract: checksum ${EXTRACT_COOKIE} 1058.endif 1059 1060.if !target(patch) 1061patch: extract ${PATCH_COOKIE} 1062.endif 1063 1064.if !target(configure) 1065configure: patch ${CONFIGURE_COOKIE} 1066.endif 1067 1068.if !target(build) 1069build: configure ${BUILD_COOKIE} 1070.endif 1071 1072.if !target(install) 1073install: build ${INSTALL_COOKIE} 1074.endif 1075 1076.if !target(package) 1077package: install ${PACKAGE_COOKIE} 1078.endif 1079 1080${EXTRACT_COOKIE}: 1081 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-extract 1082${PATCH_COOKIE}: 1083 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-patch 1084${CONFIGURE_COOKIE}: 1085 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-configure 1086${BUILD_COOKIE}: 1087 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-build 1088${INSTALL_COOKIE}: 1089 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-install 1090${PACKAGE_COOKIE}: 1091 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-package 1092 1093# And call the macros 1094 1095real-fetch: _PORT_USE 1096real-extract: _PORT_USE 1097 @${ECHO_MSG} "===> Extracting for ${PKGNAME}" 1098real-patch: _PORT_USE 1099 @${ECHO_MSG} "===> Patching for ${PKGNAME}" 1100real-configure: _PORT_USE 1101 @${ECHO_MSG} "===> Configuring for ${PKGNAME}" 1102real-build: _PORT_USE 1103 @${ECHO_MSG} "===> Building for ${PKGNAME}" 1104real-install: _PORT_USE 1105 @${ECHO_MSG} "===> Installing for ${PKGNAME}" 1106real-package: _PORT_USE 1107 1108# Empty pre-* and post-* targets, note we can't use .if !target() 1109# in the _PORT_USE macro 1110 1111.for name in fetch extract patch configure build install package 1112 1113.if !target(pre-${name}) 1114pre-${name}: 1115 @${DO_NADA} 1116.endif 1117 1118.if !target(post-${name}) 1119post-${name}: 1120 @${DO_NADA} 1121.endif 1122 1123.endfor 1124 1125# Checkpatch 1126# 1127# Special target to verify patches 1128 1129.if !target(checkpatch) 1130checkpatch: 1131 @cd ${.CURDIR} && ${MAKE} PATCH_CHECK_ONLY=yes ${.MAKEFLAGS} patch 1132.endif 1133 1134# Reinstall 1135# 1136# Special target to re-run install 1137 1138.if !target(reinstall) 1139reinstall: pre-reinstall install 1140 1141pre-reinstall: 1142 @${RM} -f ${INSTALL_COOKIE} 1143 @${RM} -f ${PACKAGE_COOKIE} 1144.endif 1145 1146################################################################ 1147# Some more targets supplied for users' convenience 1148################################################################ 1149 1150# Cleaning up 1151 1152.if !target(pre-clean) 1153pre-clean: 1154 @${DO_NADA} 1155.endif 1156 1157.if !target(clean) 1158clean: pre-clean 1159.if !defined(NOCLEANDEPENDS) 1160 @${MAKE} clean-depends 1161.endif 1162 @${ECHO_MSG} "===> Cleaning for ${PKGNAME}" 1163.if !defined(NO_WRKDIR) 1164 @if [ -d ${WRKDIR} ]; then \ 1165 if [ -w ${WRKDIR} ]; then \ 1166 ${RM} -rf ${WRKDIR}; \ 1167 else \ 1168 ${ECHO_MSG} "===> ${WRKDIR} not writable, skipping"; \ 1169 fi; \ 1170 fi 1171.else 1172 @${RM} -f ${WRKDIR}/.*_done 1173.endif 1174.endif 1175 1176.if !target(pre-distclean) 1177pre-distclean: 1178 @${DO_NADA} 1179.endif 1180 1181.if !target(distclean) 1182distclean: pre-distclean clean 1183 @${ECHO_MSG} "===> Dist cleaning for ${PKGNAME}" 1184 @(cd ${_DISTDIR}; \ 1185 ${RM} -f ${DISTFILES} ${PATCHFILES}) 1186.if defined(DIST_SUBDIR) 1187 @${RMDIR} ${_DISTDIR} 1188.endif 1189.endif 1190 1191# Prints out a list of files to fetch (useful to do a batch fetch) 1192 1193.if !target(fetch-list) 1194fetch-list: 1195 @${MKDIR} ${_DISTDIR} 1196 @(cd ${_DISTDIR}; \ 1197 for file in ${DISTFILES}; do \ 1198 if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \ 1199 for site in ${MASTER_SITES}; do \ 1200 ${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \ 1201 break; \ 1202 done; \ 1203 ${ECHO} "echo $${file} not fetched" ; \ 1204 fi \ 1205 done) 1206.if defined(PATCHFILES) 1207 @(cd ${_DISTDIR}; \ 1208 for file in ${PATCHFILES}; do \ 1209 if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \ 1210 for site in ${PATCH_SITES}; do \ 1211 ${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \ 1212 break; \ 1213 done; \ 1214 ${ECHO} "echo $${file} not fetched" ; \ 1215 fi \ 1216 done) 1217.endif 1218.endif 1219 1220# Checksumming utilities 1221 1222.if !target(makesum) 1223makesum: fetch 1224 @${MKDIR} ${FILESDIR} 1225 @if [ -f ${MD5_FILE} ]; then ${RM} -f ${MD5_FILE}; fi 1226 @(cd ${DISTDIR}; \ 1227 for file in ${_CKSUMFILES}; do \ 1228 ${MD5} $$file >> ${MD5_FILE}; \ 1229 done) 1230 @for file in ${_IGNOREFILES}; do \ 1231 ${ECHO} "MD5 ($$file) = IGNORE" >> ${MD5_FILE}; \ 1232 done 1233.endif 1234 1235.if !target(checksum) 1236checksum: fetch 1237 @if [ ! -f ${MD5_FILE} ]; then \ 1238 ${ECHO_MSG} ">> No MD5 checksum file."; \ 1239 else \ 1240 (cd ${DISTDIR}; OK="true"; \ 1241 for file in ${_CKSUMFILES}; do \ 1242 CKSUM=`${MD5} < $$file`; \ 1243 CKSUM2=`${GREP} "^MD5 ($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \ 1244 if [ "$$CKSUM2" = "" ]; then \ 1245 ${ECHO_MSG} ">> No checksum recorded for $$file."; \ 1246 OK="false"; \ 1247 elif [ "$$CKSUM2" = "IGNORE" ]; then \ 1248 ${ECHO_MSG} ">> Checksum for $$file is set to IGNORE in md5 file even though"; \ 1249 ${ECHO_MSG} " the file is not in the "'$$'"{IGNOREFILES} list."; \ 1250 OK="false"; \ 1251 elif [ "$$CKSUM" = "$$CKSUM2" ]; then \ 1252 ${ECHO_MSG} ">> Checksum OK for $$file."; \ 1253 else \ 1254 ${ECHO_MSG} ">> Checksum mismatch for $$file."; \ 1255 OK="false"; \ 1256 fi; \ 1257 done; \ 1258 for file in ${_IGNOREFILES}; do \ 1259 CKSUM2=`${GREP} "($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \ 1260 if [ "$$CKSUM2" = "" ]; then \ 1261 ${ECHO_MSG} ">> No checksum recorded for $$file, file is in "'$$'"{IGNOREFILES} list."; \ 1262 OK="false"; \ 1263 elif [ "$$CKSUM2" != "IGNORE" ]; then \ 1264 ${ECHO_MSG} ">> Checksum for $$file is not set to IGNORE in md5 file even though"; \ 1265 ${ECHO_MSG} " the file is in the "'$$'"{IGNOREFILES} list."; \ 1266 OK="false"; \ 1267 fi; \ 1268 done; \ 1269 if [ "$$OK" != "true" ]; then \ 1270 ${ECHO_MSG} "Make sure the Makefile and md5 file (${MD5_FILE})"; \ 1271 ${ECHO_MSG} "are up to date. If you want to override this check, type"; \ 1272 ${ECHO_MSG} "\"make NO_CHECKSUM=yes [other args]\"."; \ 1273 exit 1; \ 1274 fi) ; \ 1275 fi 1276.endif 1277 1278################################################################ 1279# The special package-building targets 1280# You probably won't need to touch these 1281################################################################ 1282 1283# Nobody should want to override this unless PKGNAME is simply bogus. 1284 1285.if !target(package-name) 1286package-name: 1287 @${ECHO} ${PKGNAME} 1288.endif 1289 1290# Show (recursively) all the packages this package depends on. 1291 1292.if !target(package-depends) 1293package-depends: 1294 @for i in ${RUN_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \ 1295 dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \ 1296 (cd $$dir ; ${MAKE} package-name package-depends); \ 1297 done 1298.endif 1299 1300# Build a package but don't check the package cookie 1301 1302.if !target(repackage) 1303repackage: pre-repackage package 1304 1305pre-repackage: 1306 @${RM} -f ${PACKAGE_COOKIE} 1307.endif 1308 1309# Build a package but don't check the cookie for installation, also don't 1310# install package cookie 1311 1312.if !target(package-noinstall) 1313package-noinstall: 1314 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} PACKAGE_NOINSTALL=yes real-package 1315.endif 1316 1317################################################################ 1318# Dependency checking 1319################################################################ 1320 1321.if !target(depends) 1322depends: lib-depends misc-depends 1323 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends 1324 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends 1325 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends 1326 1327.if make(fetch-depends) 1328DEPENDS_TMP+= ${FETCH_DEPENDS} 1329.endif 1330 1331.if make(build-depends) 1332DEPENDS_TMP+= ${BUILD_DEPENDS} 1333.endif 1334 1335.if make(run-depends) 1336DEPENDS_TMP+= ${RUN_DEPENDS} 1337.endif 1338 1339_DEPENDS_USE: .USE 1340.if defined(DEPENDS_TMP) 1341.if defined(NO_DEPENDS) 1342# Just print out messages 1343 @for i in ${DEPENDS_TMP}; do \ 1344 prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \ 1345 dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \ 1346 if expr "$$prog" : \\/ >/dev/null; then \ 1347 ${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog ($$dir)"; \ 1348 else \ 1349 ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog ($$dir)"; \ 1350 fi; \ 1351 done 1352.else 1353 @for i in ${DEPENDS_TMP}; do \ 1354 prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \ 1355 dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \ 1356 if expr "$$prog" : \\/ >/dev/null; then \ 1357 if [ -e "$$prog" ]; then \ 1358 ${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog - found"; \ 1359 notfound=0; \ 1360 else \ 1361 ${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog - not found"; \ 1362 notfound=1; \ 1363 fi; \ 1364 else \ 1365 if which "$$prog" > /dev/null 2>&1 ; then \ 1366 ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog - found"; \ 1367 notfound=0; \ 1368 else \ 1369 ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog - not found"; \ 1370 notfound=1; \ 1371 fi; \ 1372 fi; \ 1373 if [ $$notfound != 0 ]; then \ 1374 ${ECHO_MSG} "===> Verifying build for $$prog in $$dir"; \ 1375 if [ ! -d "$$dir" ]; then \ 1376 ${ECHO_MSG} ">> No directory for $$prog. Skipping.."; \ 1377 else \ 1378 (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 1379 ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \ 1380 fi; \ 1381 fi; \ 1382 done 1383.endif 1384.else 1385 @${DO_NADA} 1386.endif 1387 1388fetch-depends: _DEPENDS_USE 1389build-depends: _DEPENDS_USE 1390run-depends: _DEPENDS_USE 1391 1392lib-depends: 1393.if defined(LIB_DEPENDS) 1394.if defined(NO_DEPENDS) 1395# Just print out messages 1396 @for i in ${LIB_DEPENDS}; do \ 1397 lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \ 1398 dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \ 1399 ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$lib ($$dir)"; \ 1400 done 1401.else 1402 @for i in ${LIB_DEPENDS}; do \ 1403 lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \ 1404 dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \ 1405 if /sbin/ldconfig -r | ${GREP} -q -e "-l$$lib"; then \ 1406 ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$lib - found"; \ 1407 else \ 1408 ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$lib - not found"; \ 1409 ${ECHO_MSG} "===> Verifying build for $$lib in $$dir"; \ 1410 if [ ! -d "$$dir" ]; then \ 1411 ${ECHO_MSG} ">> No directory for $$lib. Skipping.."; \ 1412 else \ 1413 (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 1414 ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \ 1415 fi; \ 1416 fi; \ 1417 done 1418.endif 1419.else 1420 @${DO_NADA} 1421.endif 1422 1423misc-depends: 1424.if defined(DEPENDS) 1425 @${ECHO_MSG} "===> ${PKGNAME} depends on: ${DEPENDS}" 1426.if !defined(NO_DEPENDS) 1427 @for i in ${DEPENDS}; do \ 1428 ${ECHO_MSG} "===> Verifying build for $$i"; \ 1429 if [ ! -d $$i ]; then \ 1430 ${ECHO_MSG} ">> No directory for $$i. Skipping.."; \ 1431 else \ 1432 (cd $$i; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 1433 fi \ 1434 done 1435 @${ECHO_MSG} "===> Returning to build of ${PKGNAME}" 1436.endif 1437.else 1438 @${DO_NADA} 1439.endif 1440 1441.endif 1442 1443.if !target(clean-depends) 1444clean-depends: 1445.if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || defined(LIB_DEPENDS) \ 1446 || defined(RUN_DEPENDS) 1447 @for i in ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS}; do \ 1448 dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \ 1449 if [ -d $$dir ] ; then (cd $$dir; ${MAKE} clean); fi \ 1450 done 1451.endif 1452.if defined(DEPENDS) 1453 @for dir in ${DEPENDS}; do \ 1454 if [ -d $$dir ] ; then (cd $$dir; ${MAKE} clean); fi \ 1455 done 1456.endif 1457.endif 1458 1459.if !target(depends-list) 1460depends-list: 1461 @for i in ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS}; do \ 1462 dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \ 1463 (cd $$dir; ${MAKE} package-name depends-list); \ 1464 done 1465 @for dir in ${DEPENDS}; do \ 1466 (cd $$dir; ${MAKE} package-name depends-list); \ 1467 done 1468.endif 1469 1470################################################################ 1471# Everything after here are internal targets and really 1472# shouldn't be touched by anybody but the release engineers. 1473################################################################ 1474 1475# This target generates an index entry suitable for aggregation into 1476# a large index. Format is: 1477# 1478# distribution-name|port-path|installation-prefix|comment| \ 1479# description-file|maintainer|categories|build deps|run deps 1480# 1481.if !target(describe) 1482describe: 1483 @${ECHO} -n "${PKGNAME}|${.CURDIR}|" 1484 @${ECHO} -n "${PREFIX}|" 1485 @if [ -f ${PKGDIR}/COMMENT ]; then \ 1486 ${ECHO} -n "`${CAT} ${PKGDIR}/COMMENT`"; \ 1487 else \ 1488 ${ECHO} -n "** No Description"; \ 1489 fi 1490 @if [ -f ${PKGDIR}/DESCR ]; then \ 1491 ${ECHO} -n "|${PKGDIR}/DESCR"; \ 1492 else \ 1493 ${ECHO} -n "|/dev/null"; \ 1494 fi 1495 @${ECHO} -n "|${MAINTAINER}|${CATEGORIES}|" 1496 @cd ${.CURDIR} && ${ECHO} -n `make depends-list|sort -u` 1497 @${ECHO} -n "|" 1498 @cd ${.CURDIR} && ${ECHO} -n `make package-depends|sort -u` 1499 @${ECHO} "" 1500.endif 1501 1502.if !target(readmes) 1503readmes: readme 1504.endif 1505 1506.if !target(readme) 1507readme: 1508 @rm -f README.html 1509 @cd ${.CURDIR} && make README.html 1510.endif 1511 1512README.html: 1513 @${ECHO_MSG} "===> Creating README.html for ${PKGNAME}" 1514 @${CAT} ${TEMPLATES}/README.port | \ 1515 ${SED} -e 's%%PORT%%'`${ECHO} ${.CURDIR} | ${SED} -e 's.*/\([^/]*/[^/]*\)$$\1'`'g' \ 1516 -e 's%%PKG%%${PKGNAME}g' \ 1517 -e '/%%COMMENT%%/r${PKGDIR}/COMMENT' \ 1518 -e '/%%COMMENT%%/d' \ 1519 -e 's%%BUILD_DEPENDS%%'"`${MAKE} print-depends-list`"'' \ 1520 -e 's%%RUN_DEPENDS%%'"`${MAKE} print-package-depends`"'' \ 1521 >> $@ 1522 1523.if !target(print-depends-list) 1524print-depends-list: 1525.if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || \ 1526 defined(LIB_DEPENDS) || defined(DEPENDS) 1527 @${ECHO} -n 'This port requires package(s) "' 1528 @${ECHO} -n `make depends-list | sort -u` 1529 @${ECHO} '" to build.' 1530.endif 1531.endif 1532 1533.if !target(print-package-depends) 1534print-package-depends: 1535.if defined(RUN_DEPENDS) || defined(LIB_DEPENDS) || defined(DEPENDS) 1536 @${ECHO} -n 'This port requires package(s) "' 1537 @${ECHO} -n `make package-depends | sort -u` 1538 @${ECHO} '" to run.' 1539.endif 1540.endif 1541 1542# Fake installation of package so that user can pkg_delete it later. 1543# Also, make sure that an installed port is recognized correctly in 1544# accordance to the @pkgdep directive in the packing lists 1545 1546.if !target(fake-pkg) 1547fake-pkg: 1548 @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 1549 @if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} ${PKG_DBDIR}; fi 1550.if defined(FORCE_PKG_REGISTER) 1551 @${RM} -rf ${PKG_DBDIR}/${PKGNAME} 1552.endif 1553 @if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \ 1554 ${ECHO_MSG} "===> Registering installation for ${PKGNAME}"; \ 1555 ${MKDIR} ${PKG_DBDIR}/${PKGNAME}; \ 1556 ${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \ 1557 ${CP} ${PKGDIR}/DESCR ${PKG_DBDIR}/${PKGNAME}/+DESC; \ 1558 ${CP} ${PKGDIR}/COMMENT ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \ 1559 if [ -f ${PKGDIR}/INSTALL ]; then \ 1560 ${CP} ${PKGDIR}/INSTALL ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \ 1561 fi; \ 1562 if [ -f ${PKGDIR}/DEINSTALL ]; then \ 1563 ${CP} ${PKGDIR}/DEINSTALL ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \ 1564 fi; \ 1565 if [ -f ${PKGDIR}/REQ ]; then \ 1566 ${CP} ${PKGDIR}/REQ ${PKG_DBDIR}/${PKGNAME}/+REQ; \ 1567 fi; \ 1568 else \ 1569 ${ECHO_MSG} "===> ${PKGNAME} is already installed - perhaps an older version?"; \ 1570 ${ECHO_MSG} " If so, you may wish to \`\`pkg_delete ${PKGNAME}'' and install"; \ 1571 ${ECHO_MSG} " this port again by \`\`make reinstall'' to upgrade it properly."; \ 1572 fi 1573.endif 1574 1575# Depend is generally meaningless for arbitrary ports, but if someone wants 1576# one they can override this. This is just to catch people who've gotten into 1577# the habit of typing `make depend all install' as a matter of course. 1578# 1579.if !target(depend) 1580depend: 1581.endif 1582 1583# Same goes for tags 1584.if !target(tags) 1585tags: 1586.endif 1587