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