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