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