bsd.port.mk revision 16052
15810Sjoerg#-*- mode: Fundamental; tab-width: 4; -*- 25810Sjoerg# 35810Sjoerg# bsd.port.mk - 940820 Jordan K. Hubbard. 45810Sjoerg# This file is in the public domain. 55810Sjoerg# 65810Sjoerg# $Id: bsd.port.mk,v 1.204 1996/05/30 08:53:26 asami Exp $ 75810Sjoerg# 85810Sjoerg# Please view me with 4 column tabs! 95810Sjoerg 105810Sjoerg 115810Sjoerg# Supported Variables and their behaviors: 125810Sjoerg# 135810Sjoerg# Variables that typically apply to all ports: 145810Sjoerg# 155810Sjoerg# PORTSDIR - The root of the ports tree (default: /usr/ports). 165810Sjoerg# DISTDIR - Where to get gzip'd, tarballed copies of original sources 175810Sjoerg# (default: ${PORTSDIR}/distfiles/${DIST_SUBDIR}). 185810Sjoerg# PREFIX - Where to install things in general (default: /usr/local). 195810Sjoerg# MASTER_SITES - Primary location(s) for distribution files if not found 205810Sjoerg# locally (default: 215810Sjoerg# ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/) 225810Sjoerg# PATCH_SITES - Primary location(s) for distribution patch files 235810Sjoerg# (see PATCHFILES below) if not found locally (default: 245810Sjoerg# ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/) 255810Sjoerg# 265810Sjoerg# MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this 275810Sjoerg# value. 285810Sjoerg# MASTER_SITE_FREEBSD - If set, only use the FreeBSD master repository for 295810Sjoerg# MASTER_SITES. 305810Sjoerg# PACKAGES - A top level directory where all packages go (rather than 315810Sjoerg# going locally to each port). (default: ${PORTSDIR}/packages). 325810Sjoerg# GMAKE - Set to path of GNU make if not in $PATH (default: gmake). 335810Sjoerg# XMKMF - Set to path of `xmkmf' if not in $PATH (default: xmkmf -a ). 345810Sjoerg# MAINTAINER - The e-mail address of the contact person for this port 355810Sjoerg# (default: ports@FreeBSD.ORG). 365810Sjoerg# CATEGORIES - A list of descriptive categories into which this port falls 375810Sjoerg# (default: orphans). 385810Sjoerg# 3950479Speter# Variables that typically apply to an individual port. Non-Boolean 405810Sjoerg# variables without defaults are *mandatory*. 415810Sjoerg# 425810Sjoerg# 435810Sjoerg# WRKDIR - A temporary working directory that gets *clobbered* on clean 44194171Sbrian# (default: ${.CURDIR}/work). 45194171Sbrian# WRKSRC - A subdirectory of ${WRKDIR} where the distribution actually 465810Sjoerg# unpacks to. (Default: ${WRKDIR}/${DISTNAME} unless 475810Sjoerg# NO_WRKSUBDIR is set, in which case simply ${WRKDIR}). 485810Sjoerg# DISTNAME - Name of port or distribution. 495810Sjoerg# DISTFILES - Name(s) of archive file(s) containing distribution 505810Sjoerg# (default: ${DISTNAME}${EXTRACT_SUFX}). 515810Sjoerg# PATCHFILES - Name(s) of additional files that contain distribution 525810Sjoerg# patches (default: none). make will look for them at 5357816Ssheldonh# PATCH_SITES (see above). They will automatically be 5457816Ssheldonh# uncompressed before patching if the names end with 555810Sjoerg# ".gz" or ".Z". 56194171Sbrian# DIST_SUBDIR - Suffix to ${DISTDIR} (see above). If set, all ${DISTFILES} 575810Sjoerg# and ${PATCHFILES} will be put in this subdirectory of 585810Sjoerg# ${DISTDIR}. Also they will be fetched in this subdirectory 595810Sjoerg# from FreeBSD mirror sites. 605810Sjoerg# PKGNAME - Name of the package file to create if the DISTNAME 615810Sjoerg# isn't really relevant for the port/package 625810Sjoerg# (default: ${DISTNAME}). 635810Sjoerg# EXTRACT_ONLY - If defined, a subset of ${DISTFILES} you want to 64194171Sbrian# actually extract. 65194171Sbrian# PATCHDIR - A directory containing any additional patches you made 665810Sjoerg# to port this software to FreeBSD (default: 675810Sjoerg# ${.CURDIR}/patches) 685810Sjoerg# SCRIPTDIR - A directory containing any auxiliary scripts 695810Sjoerg# (default: ${.CURDIR}/scripts) 7057816Ssheldonh# FILESDIR - A directory containing any miscellaneous additional files. 7157816Ssheldonh# (default: ${.CURDIR}/files) 72194171Sbrian# PKGDIR - A direction containing any package creation files. 73197625Sjilles# (default: ${.CURDIR}/pkg) 745810Sjoerg# PKG_DBDIR - Where package installation is recorded (default: /var/db/pkg) 755810Sjoerg# FORCE_PKG_REGISTER - If set, it will overwrite any existing package 765810Sjoerg# registration information in ${PKG_DBDIR}/${PKGNAME}. 775810Sjoerg# NO_MTREE - If set, will not invoke mtree from bsd.port.mk from 785810Sjoerg# the "install" target. This is the default if 795810Sjoerg# USE_IMAKE or USE_X11 is set. 805810Sjoerg# 81197625Sjilles# NO_EXTRACT - Use a dummy (do-nothing) extract target. 82# NO_CONFIGURE - Use a dummy (do-nothing) configure target. 83# NO_BUILD - Use a dummy (do-nothing) build target. 84# NO_PACKAGE - Use a dummy (do-nothing) package target. 85# NO_INSTALL - Use a dummy (do-nothing) install target. 86# NO_CDROM - Use dummy (do-nothing) targets if FOR_CDROM is set. 87# NO_WRKSUBDIR - Assume port unpacks directly into ${WRKDIR}. 88# NO_WRKDIR - There's no work directory at all; port does this someplace 89# else. 90# NO_DEPENDS - Don't verify build of dependencies. 91# BROKEN - Port is broken. 92# RESTRICTED - Port is restricted. Set this string to the reason why. 93# USE_GMAKE - Says that the port uses gmake. 94# USE_IMAKE - Says that the port uses imake. 95# USE_X11 - Says that the port uses X11. 96# NO_INSTALL_MANPAGES - For imake ports that don't like the install.man 97# target. 98# HAS_CONFIGURE - Says that the port has its own configure script. 99# GNU_CONFIGURE - Set if you are using GNU configure (optional). 100# CONFIGURE_SCRIPT - Name of configure script, defaults to 'configure'. 101# CONFIGURE_ARGS - Pass these args to configure if ${HAS_CONFIGURE} is set. 102# CONFIGURE_ENV - Pass these env (shell-like) to configure if 103# ${HAS_CONFIGURE} is set. 104# IS_INTERACTIVE - Set this if your port needs to interact with the user 105# during a build. User can then decide to skip this port by 106# setting ${BATCH}, or compiling only the interactive ports 107# by setting ${INTERACTIVE}. 108# FETCH_DEPENDS - A list of "prog:dir" pairs of other ports this 109# package depends in the "fetch" stage. "prog" is the 110# name of an executable. make will search your $PATH 111# for it and go into "dir" to do a "make all install" 112# if it's not found. 113# BUILD_DEPENDS - A list of "prog:dir" pairs of other ports this 114# package depends to build (somewhere between the 115# "extract" to "build" stage). "prog" is the name 116# of an executable. make will search your $PATH for 117# it and go into "dir" to do a "make all install" if 118# it's not found. 119# RUN_DEPENDS - A list of "prog:dir" pairs of other ports this package 120# depends to run. "prog" is the name of an 121# executable. make will search your $PATH for it and 122# go into "dir" to do a "make all install" if it's not 123# found. This will be build during the "install" stage 124# and its name will be put into the package as well. 125# LIB_DEPENDS - A list of "lib:dir" pairs of other ports this package 126# depends on. "lib" is the name of a shared library. 127# make will use "ldconfig -r" to search for the 128# library. Note that lib can be any regular expression, 129# and you need two backslashes in front of dots (.) to 130# supress its special meaning (e.g., use 131# "foo\\.2\\.:${PORTSDIR}/utils/foo" to match "libfoo.2.*"). 132# DEPENDS - A list of other ports this package depends on being 133# made first. Use this for things that don't fall into 134# the above two categories. 135# EXTRACT_CMD - Command for extracting archive (default: tar). 136# EXTRACT_SUFX - Suffix for archive names (default: .tar.gz). 137# EXTRACT_BEFORE_ARGS - 138# Arguments to ${EXTRACT_CMD} before filename 139# (default: -C ${WRKDIR} -xzf). 140# EXTRACT_AFTER_ARGS - 141# Arguments to ${EXTRACT_CMD} following filename 142# (default: none). 143# 144# NCFTP - Full path to ncftp command if not in $PATH (default: ncftp). 145# NCFTPFLAGS - Arguments to ${NCFTP} (default: -N). 146# 147# Motif support: 148# 149# REQUIRES_MOTIF - Set this in your port if it requires Motif. It will be 150# built only if HAVE_MOTIF is set. 151# HAVE_MOTIF - If set, means system has Motif. Typically set in 152# /etc/make.conf. 153# MOTIF_STATIC - If set, link libXm statically; otherwise, link it 154# dynamically. 155# 156# Variables to change if you want a special behavior: 157# 158# ECHO_MSG - Used to print all the '===>' style prompts - override this 159# to turn them off (default: /bin/echo). 160# IS_DEPENDED_TARGET - 161# The target to execute when a port is called as a 162# dependency (default: install). E.g., "make fetch 163# IS_DEPENDED_TARGET=fetch" will fetch all the distfiles, 164# including those of dependencies, without actually building 165# any of them). 166# 167# 168# Default targets and their behaviors: 169# 170# fetch - Retrieves ${DISTFILES} (and ${PATCHFILES} if defined) 171# into ${DISTDIR} as necessary. 172# fetch-list - Show list of files that would be retrieved by fetch 173# extract - Unpacks ${DISTFILES} into ${WRKDIR}. 174# patch - Apply any provided patches to the source. 175# configure - Runs either GNU configure, one or more local configure 176# scripts or nothing, depending on what's available. 177# build - Actually compile the sources. 178# install - Install the results of a build. 179# reinstall - Install the results of a build, ignoring "already installed" 180# flag. 181# package - Create a package from an _installed_ port. 182# describe - Try to generate a one-line description for each port for 183# use in INDEX files and the like. 184# checkpatch - Do a "patch -C" instead of a "patch". Note that it may 185# give incorrect results if multiple patches deal with 186# the same file. 187# checksum - Use files/md5 to ensure that your distfiles are valid. 188# makesum - Generate files/md5 (only do this for your own ports!). 189# 190# Default sequence for "all" is: fetch checksum extract patch configure build 191# 192# Please read the comments in the targets section below, you 193# should be able to use the pre-* or post-* targets/scripts 194# (which are available for every stage except checksum) or 195# override the do-* targets to do pretty much anything you want. 196# 197# NEVER override the "regular" targets unless you want to open 198# a major can of worms. 199 200.if exists(${.CURDIR}/../Makefile.inc) 201.include "${.CURDIR}/../Makefile.inc" 202.endif 203 204# These need to be absolute since we don't know how deep in the ports 205# tree we are and thus can't go relative. They can, of course, be overridden 206# by individual Makefiles. 207PORTSDIR?= ${DESTDIR}/usr/ports 208LOCALBASE?= /usr/local 209X11BASE?= /usr/X11R6 210DISTDIR?= ${PORTSDIR}/distfiles/${DIST_SUBDIR} 211PACKAGES?= ${PORTSDIR}/packages 212TEMPLATES?= ${PORTSDIR}/templates 213.if !defined(NO_WRKDIR) 214WRKDIR?= ${.CURDIR}/work 215.else 216WRKDIR?= ${.CURDIR} 217.endif 218.if defined(NO_WRKSUBDIR) 219WRKSRC?= ${WRKDIR} 220.else 221WRKSRC?= ${WRKDIR}/${DISTNAME} 222.endif 223PATCHDIR?= ${.CURDIR}/patches 224SCRIPTDIR?= ${.CURDIR}/scripts 225FILESDIR?= ${.CURDIR}/files 226PKGDIR?= ${.CURDIR}/pkg 227.if defined(USE_IMAKE) || defined(USE_X11) 228PREFIX?= ${X11BASE} 229.else 230PREFIX?= ${LOCALBASE} 231.endif 232# The following 4 lines should go away as soon as the ports are all updated 233.if defined(EXEC_DEPENDS) 234BUILD_DEPENDS+= ${EXEC_DEPENDS} 235RUN_DEPENDS+= ${EXEC_DEPENDS} 236.endif 237.if defined(USE_GMAKE) 238BUILD_DEPENDS+= gmake:${PORTSDIR}/devel/gmake 239.endif 240 241.if exists(${PORTSDIR}/../Makefile.inc) 242.include "${PORTSDIR}/../Makefile.inc" 243.endif 244 245# Don't change these!!! These names are built into the _TARGET_USE macro, 246# there is no way to refer to them cleanly from within the macro AFAIK. 247EXTRACT_COOKIE?= ${WRKDIR}/.extract_done 248CONFIGURE_COOKIE?= ${WRKDIR}/.configure_done 249INSTALL_COOKIE?= ${WRKDIR}/.install_done 250BUILD_COOKIE?= ${WRKDIR}/.build_done 251PATCH_COOKIE?= ${WRKDIR}/.patch_done 252PACKAGE_COOKIE?= ${WRKDIR}/.package_done 253 254# How to do nothing. Override if you, for some strange reason, would rather 255# do something. 256DO_NADA?= echo -n 257 258# Miscellaneous overridable commands: 259GMAKE?= gmake 260XMKMF?= xmkmf -a 261MD5?= /sbin/md5 262MD5_FILE?= ${FILESDIR}/md5 263 264MAKE_FLAGS?= -f 265MAKEFILE?= Makefile 266MAKE_ENV+= PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} MOTIFLIB="${MOTIFLIB}" CFLAGS="${CFLAGS}" 267 268NCFTP?= /usr/bin/ncftp 269NCFTPFLAGS?= -N 270 271TOUCH?= /usr/bin/touch 272TOUCH_FLAGS?= -f 273 274PATCH?= /usr/bin/patch 275PATCH_STRIP?= -p0 276PATCH_DIST_STRIP?= -p0 277.if defined(PATCH_DEBUG) 278PATCH_ARGS?= -d ${WRKSRC} -E ${PATCH_STRIP} 279PATCH_DIST_ARGS?= -d ${WRKSRC} -E ${PATCH_DIST_STRIP} 280.else 281PATCH_ARGS?= -d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP} 282PATCH_DIST_ARGS?= -d ${WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP} 283.endif 284.if defined(BATCH) 285PATCH_ARGS+= --batch 286PATCH_DIST_ARGS+= --batch 287.endif 288 289.if defined(PATCH_CHECK_ONLY) 290PATCH_ARGS+= -C 291PATCH_DIST_ARGS+= -C 292.endif 293 294EXTRACT_CMD?= /usr/bin/tar 295EXTRACT_SUFX?= .tar.gz 296# Backwards compatability. 297.if defined(EXTRACT_ARGS) 298EXTRACT_BEFORE_ARGS?= ${EXTRACT_ARGS} 299.else 300EXTRACT_BEFORE_ARGS?= -xzf 301.endif 302 303# Figure out where the local mtree file is 304.if !defined(MTREE_LOCAL) && exists(/etc/mtree/BSD.local.dist) 305MTREE_LOCAL= /etc/mtree/BSD.local.dist 306.endif 307MTREE_CMD?= /usr/sbin/mtree 308MTREE_ARGS?= -U -f ${MTREE_LOCAL} -d -e -p 309.if defined(USE_X11) || defined(USE_IMAKE) || !defined(MTREE_LOCAL) 310NO_MTREE= yes 311.endif 312 313# The user can override the NO_PACKAGE by specifying this from 314# the make command line 315.if defined(FORCE_PACKAGE) 316.undef NO_PACKAGE 317.endif 318 319PKG_CMD?= /usr/sbin/pkg_create 320.if !defined(PKG_ARGS) 321PKG_ARGS= -v -c ${PKGDIR}/COMMENT -d ${PKGDIR}/DESCR -f ${PKGDIR}/PLIST -p ${PREFIX} -P "`${MAKE} package-depends|sort|uniq`" 322.if exists(${PKGDIR}/INSTALL) 323PKG_ARGS+= -i ${PKGDIR}/INSTALL 324.endif 325.if exists(${PKGDIR}/DEINSTALL) 326PKG_ARGS+= -k ${PKGDIR}/DEINSTALL 327.endif 328.if exists(${PKGDIR}/REQ) 329PKG_ARGS+= -r ${PKGDIR}/REQ 330.endif 331.if !defined(NO_MTREE) && defined(MTREE_LOCAL) 332PKG_ARGS+= -m ${MTREE_LOCAL} 333.endif 334.endif 335PKG_SUFX?= .tgz 336# where pkg_add records its dirty deeds. 337PKG_DBDIR?= /var/db/pkg 338 339# shared/dynamic motif libs 340.if defined(HAVE_MOTIF) 341.if defined(MOTIF_STATIC) 342MOTIFLIB?= ${X11BASE}/lib/libXm.a 343.else 344MOTIFLIB?= -L${X11BASE}/lib -lXm 345.endif 346.endif 347 348ECHO?= /bin/echo 349CAT+= /bin/cat 350CP?= /bin/cp 351SETENV?= /usr/bin/env 352RM?= /bin/rm 353MKDIR?= /bin/mkdir 354GZCAT?= /usr/bin/gzcat 355BASENAME?= /usr/bin/basename 356SED?= /usr/bin/sed 357CAT?= /bin/cat 358GREP?= /usr/bin/grep 359AWK?= /usr/bin/awk 360 361# Used to print all the '===>' style prompts - override this to turn them off. 362ECHO_MSG?= ${ECHO} 363 364ALL_TARGET?= all 365INSTALL_TARGET?= install 366 367# If the user has this set, go to the FreeBSD respository for everything. 368.if defined(MASTER_SITE_FREEBSD) 369MASTER_SITE_OVERRIDE= ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ 370.endif 371 372# I guess we're in the master distribution business! :) As we gain mirror 373# sites for distfiles, add them to this list. 374.if !defined(MASTER_SITE_OVERRIDE) 375MASTER_SITES+= ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ 376PATCH_SITES+= ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ 377.else 378MASTER_SITES:= ${MASTER_SITE_OVERRIDE} ${MASTER_SITES} 379PATCH_SITES:= ${MASTER_SITE_OVERRIDE} ${PATCH_SITES} 380.endif 381 382# Derived names so that they're easily overridable. 383DISTFILES?= ${DISTNAME}${EXTRACT_SUFX} 384PKGNAME?= ${DISTNAME} 385 386# This is what is actually going to be extracted, and is overridable 387# by user. 388EXTRACT_ONLY?= ${DISTFILES} 389 390# Documentation 391MAINTAINER?= ports@FreeBSD.ORG 392CATEGORIES?= orphans 393 394# Note this has to start with a capital letter (or more accurately, it 395# shouldn't match "[a-z]*"), see the target "delete-package-links" below. 396PKGREPOSITORYSUBDIR?= All 397PKGREPOSITORY?= ${PACKAGES}/${PKGREPOSITORYSUBDIR} 398.if exists(${PACKAGES}) 399PKGFILE?= ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX} 400.else 401PKGFILE?= ${PKGNAME}${PKG_SUFX} 402.endif 403 404CONFIGURE_SCRIPT?= configure 405 406.if defined(GNU_CONFIGURE) 407CONFIGURE_ARGS+= --prefix=${PREFIX} 408HAS_CONFIGURE= yes 409.endif 410 411.MAIN: all 412 413################################################################ 414# Many ways to disable a port. 415# 416# If we're in BATCH mode and the port is interactive, or we're 417# in interactive mode and the port is non-interactive, skip all 418# the important targets. The reason we have two modes is that 419# one might want to leave a build in BATCH mode running 420# overnight, then come back in the morning and do _only_ the 421# interactive ones that required your intervention. 422# 423# Don't attempt to build ports that require Motif if you don't 424# have Motif. 425# 426# Ignore ports that can't be resold if building for a CDROM. 427# 428# Don't build a port if it's restricted and we don't want to get 429# into that. 430# 431# Don't build a port if it's broken. 432################################################################ 433 434.if (defined(IS_INTERACTIVE) && defined(BATCH)) || \ 435 (!defined(IS_INTERACTIVE) && defined(INTERACTIVE)) || \ 436 (defined(REQUIRES_MOTIF) && !defined(HAVE_MOTIF)) || \ 437 (defined(NO_CDROM) && defined(FOR_CDROM)) || \ 438 (defined(RESTRICTED) && defined(NO_RESTRICTED)) || \ 439 defined(BROKEN) 440IGNORE= yes 441.endif 442 443.if defined(IGNORE) 444all: 445 @${DO_NADA} 446build: 447 @${DO_NADA} 448install: 449 @${DO_NADA} 450fetch: 451 @${DO_NADA} 452configure: 453 @${DO_NADA} 454package: 455 @${DO_NADA} 456.endif 457 458.if defined(ALL_HOOK) 459all: 460 @${SETENV} CURDIR=${.CURDIR} DISTNAME=${DISTNAME} \ 461 DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} \ 462 PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 463 FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 464 DEPENDS="${DEPENDS}" BUILD_DEPENDS="${BUILD_DEPENDS}" \ 465 RUN_DEPENDS="${RUN_DEPENDS}" X11BASE=${X11BASE} \ 466 ${ALL_HOOK} 467.endif 468 469.if !target(all) 470all: build 471.endif 472 473.if !defined(IS_DEPENDED_TARGET) 474IS_DEPENDED_TARGET= install 475.endif 476 477.if !target(is_depended) 478is_depended: ${IS_DEPENDED_TARGET} 479.endif 480 481################################################################ 482# The following are used to create easy dummy targets for 483# disabling some bit of default target behavior you don't want. 484# They still check to see if the target exists, and if so don't 485# do anything, since you might want to set this globally for a 486# group of ports in a Makefile.inc, but still be able to 487# override from an individual Makefile. 488################################################################ 489 490# Disable extract 491.if defined(NO_EXTRACT) && !target(extract) 492extract: checksum 493 @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE} 494checksum: fetch 495 @${DO_NADA} 496makesum: 497 @${DO_NADA} 498.endif 499 500# Disable configure 501.if defined(NO_CONFIGURE) && !target(configure) 502configure: patch 503 @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE} 504.endif 505 506# Disable build 507.if defined(NO_BUILD) && !target(build) 508build: configure 509 @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE} 510.endif 511 512# Disable package 513.if defined(NO_PACKAGE) && !target(package) 514package: 515 @${DO_NADA} 516.endif 517 518# Disable install 519.if defined(NO_INSTALL) && !target(install) 520install: build 521 @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE} 522.endif 523 524# Disable patch 525.if defined(NO_PATCH) && !target(patch) 526patch: extract 527 @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} 528.endif 529 530################################################################ 531# More standard targets start here. 532# 533# These are the body of the build/install framework. If you are 534# not happy with the default actions, and you can't solve it by 535# adding pre-* or post-* targets/scripts, override these. 536################################################################ 537 538# Fetch 539 540.if !target(do-fetch) 541do-fetch: 542 @if [ ! -d ${DISTDIR} ]; then ${MKDIR} -p ${DISTDIR}; fi 543 @(cd ${DISTDIR}; \ 544 for file in ${DISTFILES}; do \ 545 if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \ 546 if [ -h $$file -o -h `${BASENAME} $$file` ]; then \ 547 ${ECHO_MSG} ">> ${DISTDIR}/$$file is a broken symlink."; \ 548 ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \ 549 ${ECHO_MSG} ">> Please correct this problem and try again."; \ 550 exit 1; \ 551 fi ; \ 552 ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \ 553 for site in ${MASTER_SITES}; do \ 554 ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \ 555 (${NCFTP} ${NCFTPFLAGS} $${site}$${file} ${NCFTPTAIL} || true); \ 556 if [ -f $$file -o -f `${BASENAME} $$file` ]; then \ 557 continue 2; \ 558 fi \ 559 done; \ 560 ${ECHO_MSG} ">> Couldn't fetch it - please try to retreive this";\ 561 ${ECHO_MSG} ">> port manually into ${DISTDIR} and try again."; \ 562 exit 1; \ 563 fi \ 564 done) 565.if defined(PATCHFILES) 566 @if [ ! -d ${DISTDIR} ]; then ${MKDIR} -p ${DISTDIR}; fi 567 @(cd ${DISTDIR}; \ 568 for file in ${PATCHFILES}; do \ 569 if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \ 570 if [ -h $$file -o -h `${BASENAME} $$file` ]; then \ 571 ${ECHO_MSG} ">> ${DISTDIR}/$$file is a broken symlink."; \ 572 ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \ 573 ${ECHO_MSG} ">> Please correct this problem and try again."; \ 574 exit 1; \ 575 fi ; \ 576 ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \ 577 for site in ${PATCH_SITES}; do \ 578 ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \ 579 (${NCFTP} ${NCFTPFLAGS} $${site}$${file} ${NCFTPTAIL} || true); \ 580 if [ -f $$file -o -f `${BASENAME} $$file` ]; then \ 581 continue 2; \ 582 fi \ 583 done; \ 584 ${ECHO_MSG} ">> Couldn't fetch it - please try to retreive this";\ 585 ${ECHO_MSG} ">> port manually into ${DISTDIR} and try again."; \ 586 exit 1; \ 587 fi \ 588 done) 589.endif 590.endif 591 592# Extract 593 594.if !target(do-extract) 595do-extract: 596 @${RM} -rf ${WRKDIR} 597 @${MKDIR} -p ${WRKDIR} 598 @for file in ${EXTRACT_ONLY}; do \ 599 if ! (cd ${WRKDIR};${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\ 600 then \ 601 exit 1; \ 602 fi \ 603 done 604.endif 605 606# Patch 607 608.if !target(do-patch) 609do-patch: 610.if defined(PATCHFILES) 611 @${ECHO_MSG} "===> Applying distribution patches for ${PKGNAME}" 612.if defined(PATCH_DEBUG) 613 @(cd ${DISTDIR}; \ 614 for i in ${PATCHFILES}; do \ 615 ${ECHO_MSG} "===> Applying distribution patch $$i" ; \ 616 case $$i in \ 617 *.Z|*.gz) \ 618 ${GZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \ 619 ;; \ 620 *) \ 621 ${PATCH} ${PATCH_DIST_ARGS} < $$i; \ 622 ;; \ 623 esac; \ 624 done) 625.else 626 @(cd ${DISTDIR}; \ 627 for i in ${PATCHFILES}; do \ 628 case $$i in \ 629 *.Z|*.gz) \ 630 ${GZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \ 631 ;; \ 632 *) \ 633 ${PATCH} ${PATCH_DIST_ARGS} < $$i; \ 634 ;; \ 635 esac; \ 636 done) 637.endif 638.endif 639.if defined(PATCH_DEBUG) 640 @if [ -d ${PATCHDIR} ]; then \ 641 ${ECHO_MSG} "===> Applying FreeBSD patches for ${PKGNAME}" ; \ 642 for i in ${PATCHDIR}/patch-*; do \ 643 case $$i in \ 644 *.orig|*~) \ 645 ${ECHO_MSG} "===> Ignoring patchfile $$i" ; \ 646 ;; \ 647 *) \ 648 ${ECHO_MSG} "===> Applying FreeBSD patch $$i" ; \ 649 ${PATCH} ${PATCH_ARGS} < $$i; \ 650 ;; \ 651 esac; \ 652 done; \ 653 fi 654.else 655 @if [ -d ${PATCHDIR} ]; then \ 656 ${ECHO_MSG} "===> Applying FreeBSD patches for ${PKGNAME}" ; \ 657 for i in ${PATCHDIR}/patch-*; do \ 658 case $$i in \ 659 *.orig|*~) \ 660 ${ECHO_MSG} "===> Ignoring patchfile $$i" ; \ 661 ;; \ 662 *) \ 663 ${PATCH} ${PATCH_ARGS} < $$i; \ 664 ;; \ 665 esac; \ 666 done;\ 667 fi 668.endif 669.endif 670 671# Configure 672 673.if !target(do-configure) 674do-configure: 675 @if [ -f ${SCRIPTDIR}/configure ]; then \ 676 ${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 677 WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 678 FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 679 DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ 680 /bin/sh ${SCRIPTDIR}/configure; \ 681 fi 682.if defined(HAS_CONFIGURE) 683 @(cd ${WRKSRC}; CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \ 684 INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \ 685 INSTALL_PROGRAM="/usr/bin/install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}" \ 686 ${CONFIGURE_ENV} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}) 687.endif 688.if defined(USE_IMAKE) 689 @(cd ${WRKSRC}; ${XMKMF}) 690.endif 691.endif 692 693# Build 694 695.if !target(do-build) 696do-build: 697.if defined(USE_GMAKE) 698 @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET}) 699.else defined(USE_GMAKE) 700 @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET}) 701.endif 702.endif 703 704# Install 705 706.if !target(do-install) 707do-install: 708.if defined(USE_GMAKE) 709 @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET}) 710.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES) 711 @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man) 712.endif 713.else defined(USE_GMAKE) 714 @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET}) 715.if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES) 716 @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man) 717.endif 718.endif 719.endif 720 721# Package 722 723.if !target(do-package) 724do-package: 725 @if [ -e ${PKGDIR}/PLIST ]; then \ 726 ${ECHO_MSG} "===> Building package for ${PKGNAME}"; \ 727 if [ -d ${PACKAGES} ]; then \ 728 if [ ! -d ${PKGREPOSITORY} ]; then \ 729 if ! ${MKDIR} -p ${PKGREPOSITORY}; then \ 730 ${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \ 731 exit 1; \ 732 fi; \ 733 fi; \ 734 fi; \ 735 if ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; then \ 736 if [ -d ${PACKAGES} ]; then \ 737 ${MAKE} ${.MAKEFLAGS} package-links; \ 738 fi; \ 739 else \ 740 ${MAKE} ${.MAKEFLAGS} delete-package; \ 741 exit 1; \ 742 fi; \ 743 fi 744.endif 745 746# Some support rules for do-package 747 748.if !target(package-links) 749package-links: 750 @${MAKE} ${.MAKEFLAGS} delete-package-links 751 @for cat in ${CATEGORIES}; do \ 752 if [ ! -d ${PACKAGES}/$$cat ]; then \ 753 if ! ${MKDIR} -p ${PACKAGES}/$$cat; then \ 754 ${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \ 755 exit 1; \ 756 fi; \ 757 fi; \ 758 ln -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \ 759 done; 760.endif 761 762.if !target(delete-package-links) 763delete-package-links: 764 @${RM} -f ${PACKAGES}/[a-z]*/${PKGNAME}${PKG_SUFX}; 765.endif 766 767.if !target(delete-package) 768delete-package: 769 @${MAKE} ${.MAKEFLAGS} delete-package-links 770 @${RM} -f ${PKGFILE} 771.endif 772 773################################################################ 774# This is the "generic" port target, actually a macro used from the 775# six main targets. See below for more. 776################################################################ 777 778_PORT_USE: .USE 779.if make(real-fetch) 780 @${MAKE} ${.MAKEFLAGS} fetch-depends 781.endif 782.if make(real-extract) 783 @${MAKE} ${.MAKEFLAGS} build-depends lib-depends misc-depends 784.endif 785.if make(real-install) 786 @${MAKE} ${.MAKEFLAGS} run-depends 787.endif 788.if make(real-install) 789.if !defined(NO_MTREE) 790 @if [ `id -u` = 0 ]; then \ 791 ${MTREE_CMD} ${MTREE_ARGS} ${PREFIX}/; \ 792 else \ 793 ${ECHO_MSG} "Warning: not superuser, can't run mtree."; \ 794 ${ECHO_MSG} "Become root and try again to ensure correct permissions."; \ 795 fi 796.endif 797.endif 798 @${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/pre-/} 799 @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/} ]; then \ 800 ${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 801 WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 802 FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 803 DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ 804 /bin/sh ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/}; \ 805 fi 806 @${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/do-/} 807 @${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/post-/} 808 @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/post-/} ]; then \ 809 ${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ 810 WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ 811 FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ 812 DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ 813 /bin/sh ${SCRIPTDIR}/${.TARGET:S/^real-/post-/}; \ 814 fi 815.if make(real-install) 816 @${MAKE} ${.MAKEFLAGS} fake-pkg 817.endif 818.if !make(real-fetch) \ 819 && (!make(real-patch) || !defined(PATCH_CHECK_ONLY)) \ 820 && (!make(real-package) || !defined(PACKAGE_NOINSTALL)) 821 @${TOUCH} ${TOUCH_FLAGS} ${WRKDIR}/.${.TARGET:S/^real-//}_done 822.endif 823 824################################################################ 825# Skeleton targets start here 826# 827# You shouldn't have to change these. Either add the pre-* or 828# post-* targets/scripts or redefine the do-* targets. These 829# targets don't do anything other than checking for cookies and 830# call the necessary targets/scripts. 831################################################################ 832 833.if !target(fetch) 834fetch: 835 @${MAKE} ${.MAKEFLAGS} real-fetch 836.endif 837 838.if !target(extract) 839extract: checksum ${EXTRACT_COOKIE} 840.endif 841 842.if !target(patch) 843patch: extract ${PATCH_COOKIE} 844.endif 845 846.if !target(configure) 847configure: patch ${CONFIGURE_COOKIE} 848.endif 849 850.if !target(build) 851build: configure ${BUILD_COOKIE} 852.endif 853 854.if !target(install) 855install: build ${INSTALL_COOKIE} 856.endif 857 858.if !target(package) 859package: install ${PACKAGE_COOKIE} 860.endif 861 862${EXTRACT_COOKIE}: 863 @${MAKE} ${.MAKEFLAGS} real-extract 864${PATCH_COOKIE}: 865 @${MAKE} ${.MAKEFLAGS} real-patch 866${CONFIGURE_COOKIE}: 867 @${MAKE} ${.MAKEFLAGS} real-configure 868${BUILD_COOKIE}: 869 @${MAKE} ${.MAKEFLAGS} real-build 870${INSTALL_COOKIE}: 871 @${MAKE} ${.MAKEFLAGS} real-install 872${PACKAGE_COOKIE}: 873 @${MAKE} ${.MAKEFLAGS} real-package 874 875# And call the macros 876 877real-fetch: _PORT_USE 878real-extract: _PORT_USE 879 @${ECHO_MSG} "===> Extracting for ${PKGNAME}" 880real-patch: _PORT_USE 881 @${ECHO_MSG} "===> Patching for ${PKGNAME}" 882real-configure: _PORT_USE 883 @${ECHO_MSG} "===> Configuring for ${PKGNAME}" 884real-build: _PORT_USE 885 @${ECHO_MSG} "===> Building for ${PKGNAME}" 886real-install: _PORT_USE 887 @${ECHO_MSG} "===> Installing for ${PKGNAME}" 888real-package: _PORT_USE 889 890# Empty pre-* and post-* targets, note we can't use .if !target() 891# in the _PORT_USE macro 892 893.for name in fetch extract patch configure build install package 894 895.if !target(pre-${name}) 896pre-${name}: 897 @${DO_NADA} 898.endif 899 900.if !target(post-${name}) 901post-${name}: 902 @${DO_NADA} 903.endif 904 905.endfor 906 907# Checkpatch 908# 909# Special target to verify patches 910 911.if !target(checkpatch) 912checkpatch: 913 @${MAKE} PATCH_CHECK_ONLY=yes ${.MAKEFLAGS} patch 914.endif 915 916# Reinstall 917# 918# Special target to re-run install 919 920.if !target(reinstall) 921reinstall: pre-reinstall install 922 923pre-reinstall: 924 @${RM} -f ${INSTALL_COOKIE} 925 @${RM} -f ${PACKAGE_COOKIE} 926.endif 927 928################################################################ 929# Some more targets supplied for users' convenience 930################################################################ 931 932# Cleaning up 933 934.if !target(pre-clean) 935pre-clean: 936 @${DO_NADA} 937.endif 938 939.if !target(clean) 940clean: pre-clean 941 @${ECHO_MSG} "===> Cleaning for ${PKGNAME}" 942 @${RM} -f ${EXTRACT_COOKIE} ${CONFIGURE_COOKIE} ${INSTALL_COOKIE} \ 943 ${BUILD_COOKIE} ${PATCH_COOKIE} 944.if defined(NO_WRKDIR) 945 @${RM} -f ${WRKDIR}/.*_done 946.else 947 @${RM} -rf ${WRKDIR} 948.endif 949.endif 950 951# Prints out a list of files to fetch (useful to do a batch fetch) 952 953.if !target(fetch-list) 954fetch-list: 955 @if [ ! -d ${DISTDIR} ]; then ${MKDIR} -p ${DISTDIR}; fi 956 @(cd ${DISTDIR}; \ 957 for file in ${DISTFILES}; do \ 958 if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \ 959 for site in ${MASTER_SITES}; do \ 960 ${ECHO} -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} "${NCFTPTAIL}" '||' ; \ 961 break; \ 962 done; \ 963 ${ECHO} "echo $${file} not fetched" ; \ 964 fi \ 965 done) 966.if defined(PATCHFILES) 967 @(cd ${DISTDIR}; \ 968 for file in ${PATCHFILES}; do \ 969 if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \ 970 for site in ${PATCH_SITES}; do \ 971 ${ECHO} -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} "${NCFTPTAIL}" '||' ; \ 972 break; \ 973 done; \ 974 ${ECHO} "echo $${file} not fetched" ; \ 975 fi \ 976 done) 977.endif 978.endif 979 980# Checksumming utilities 981 982.if !target(makesum) 983makesum: fetch 984 @if [ ! -d ${FILESDIR} ]; then ${MKDIR} -p ${FILESDIR}; fi 985 @if [ -f ${MD5_FILE} ]; then ${RM} -f ${MD5_FILE}; fi 986 @(cd ${DISTDIR}; \ 987 for file in ${DISTFILES} ${PATCHFILES}; do \ 988 ${MD5} $$file >> ${MD5_FILE}; \ 989 done) 990.endif 991 992.if !target(checksum) 993checksum: fetch 994 @if [ ! -f ${MD5_FILE} ]; then \ 995 ${ECHO_MSG} ">> No MD5 checksum file."; \ 996 else \ 997 (cd ${DISTDIR}; OK=""; \ 998 for file in ${DISTFILES} ${PATCHFILES}; do \ 999 CKSUM=`${MD5} $$file | ${AWK} '{print $$4}'`; \ 1000 CKSUM2=`${GREP} "($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \ 1001 if [ "$$CKSUM2" = "" ]; then \ 1002 ${ECHO_MSG} ">> No checksum recorded for $$file"; \ 1003 OK="false"; \ 1004 elif [ "$$CKSUM" != "$$CKSUM2" ]; then \ 1005 ${ECHO_MSG} ">> Checksum mismatch for $$file"; \ 1006 exit 1; \ 1007 fi; \ 1008 done; \ 1009 if [ "$$OK" = "" ]; then \ 1010 ${ECHO_MSG} "Checksums OK."; \ 1011 else \ 1012 ${ECHO_MSG} "Checksums OK for files that have them."; \ 1013 fi) ; \ 1014 fi 1015.endif 1016 1017################################################################ 1018# The special package-building targets 1019# You probably won't need to touch these 1020################################################################ 1021 1022# Nobody should want to override this unless PKGNAME is simply bogus. 1023 1024.if !target(package-name) 1025package-name: 1026 @${ECHO} ${PKGNAME} 1027.endif 1028 1029# Show (recursively) all the packages this package depends on. 1030 1031.if !target(package-depends) 1032package-depends: 1033 @for i in ${RUN_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \ 1034 dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \ 1035 (cd $$dir ; ${MAKE} package-name package-depends); \ 1036 done 1037.endif 1038 1039# Build a package but don't check the package cookie 1040 1041.if !target(repackage) 1042repackage: pre-repackage package 1043 1044pre-repackage: 1045 @${RM} -f ${PACKAGE_COOKIE} 1046.endif 1047 1048# Build a package but don't check the cookie for installation, also don't 1049# install package cookie 1050 1051.if !target(package-noinstall) 1052package-noinstall: 1053 @${MAKE} ${.MAKEFLAGS} PACKAGE_NOINSTALL=yes real-package 1054.endif 1055 1056################################################################ 1057# Dependency checking 1058################################################################ 1059 1060.if !target(depends) 1061depends: lib-depends misc-depends 1062 @${MAKE} ${.MAKEFLAGS} fetch-depends 1063 @${MAKE} ${.MAKEFLAGS} build-depends 1064 @${MAKE} ${.MAKEFLAGS} run-depends 1065 1066.if make(fetch-depends) 1067DEPENDS_TMP+= ${FETCH_DEPENDS} 1068.endif 1069 1070.if make(build-depends) 1071DEPENDS_TMP+= ${BUILD_DEPENDS} 1072.endif 1073 1074.if make(run-depends) 1075DEPENDS_TMP+= ${RUN_DEPENDS} 1076.endif 1077 1078_DEPENDS_USE: .USE 1079.if defined(DEPENDS_TMP) 1080.if defined(NO_DEPENDS) 1081# Just print out messages 1082 @for i in ${DEPENDS_TMP}; do \ 1083 prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \ 1084 dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \ 1085 if expr "$$prog" : \\/ >/dev/null; then \ 1086 ${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog ($$dir)"; \ 1087 else \ 1088 ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog ($$dir)"; \ 1089 fi; \ 1090 done 1091.else 1092 @for i in ${DEPENDS_TMP}; do \ 1093 prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \ 1094 dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \ 1095 if expr "$$prog" : \\/ >/dev/null; then \ 1096 if [ -e "$$prog" ]; then \ 1097 ${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog - found"; \ 1098 notfound=0; \ 1099 else \ 1100 ${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog - not found"; \ 1101 notfound=1; \ 1102 fi; \ 1103 else \ 1104 if which -s "$$prog"; then \ 1105 ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog - found"; \ 1106 notfound=0; \ 1107 else \ 1108 ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog - not found"; \ 1109 notfound=1; \ 1110 fi; \ 1111 fi; \ 1112 if [ $$notfound != 0 ]; then \ 1113 ${ECHO_MSG} "===> Verifying build for $$prog in $$dir"; \ 1114 if [ ! -d "$$dir" ]; then \ 1115 ${ECHO_MSG} ">> No directory for $$prog. Skipping.."; \ 1116 else \ 1117 (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 1118 ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \ 1119 fi; \ 1120 fi; \ 1121 done 1122.endif 1123.else 1124 @${DO_NADA} 1125.endif 1126 1127fetch-depends: _DEPENDS_USE 1128build-depends: _DEPENDS_USE 1129run-depends: _DEPENDS_USE 1130 1131lib-depends: 1132.if defined(LIB_DEPENDS) 1133.if defined(NO_DEPENDS) 1134# Just print out messages 1135 @for i in ${LIB_DEPENDS}; do \ 1136 lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \ 1137 dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \ 1138 ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$lib ($$dir)"; \ 1139 done 1140.else 1141 @for i in ${LIB_DEPENDS}; do \ 1142 lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \ 1143 dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \ 1144 if /sbin/ldconfig -r | ${GREP} -q -e "-l$$lib"; then \ 1145 ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$lib - found"; \ 1146 else \ 1147 ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$lib - not found"; \ 1148 ${ECHO_MSG} "===> Verifying build for $$lib in $$dir"; \ 1149 if [ ! -d "$$dir" ]; then \ 1150 ${ECHO_MSG} ">> No directory for $$lib. Skipping.."; \ 1151 else \ 1152 (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 1153 ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \ 1154 fi; \ 1155 fi; \ 1156 done 1157.endif 1158.else 1159 @${DO_NADA} 1160.endif 1161 1162misc-depends: 1163.if defined(DEPENDS) 1164 @${ECHO_MSG} "===> ${PKGNAME} depends on: ${DEPENDS}" 1165.if !defined(NO_DEPENDS) 1166 @for i in ${DEPENDS}; do \ 1167 ${ECHO_MSG} "===> Verifying build for $$i"; \ 1168 if [ ! -d $$i ]; then \ 1169 ${ECHO_MSG} ">> No directory for $$i. Skipping.."; \ 1170 else \ 1171 (cd $$i; ${MAKE} ${.MAKEFLAGS} is_depended) ; \ 1172 fi \ 1173 done 1174 @${ECHO_MSG} "===> Returning to build of ${PKGNAME}" 1175.endif 1176.else 1177 @${DO_NADA} 1178.endif 1179 1180.endif 1181 1182.if !target(depends-list) 1183depends-list: 1184 @for i in ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \ 1185 dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \ 1186 (cd $$dir ; ${MAKE} package-name depends-list); \ 1187 done 1188.endif 1189 1190################################################################ 1191# Everything after here are internal targets and really 1192# shouldn't be touched by anybody but the release engineers. 1193################################################################ 1194 1195# This target generates an index entry suitable for aggregation into 1196# a large index. Format is: 1197# 1198# distribution-name|port-path|installation-prefix|comment| \ 1199# description-file|maintainer|categories|build deps|run deps 1200# 1201.if !target(describe) 1202describe: 1203 @${ECHO} -n "${PKGNAME}|${.CURDIR}/${PKGNAME}|" 1204 @${ECHO} -n "${PREFIX}|" 1205 @if [ -f ${PKGDIR}/COMMENT ]; then \ 1206 ${ECHO} -n "`${CAT} ${PKGDIR}/COMMENT`"; \ 1207 else \ 1208 ${ECHO} -n "** No Description"; \ 1209 fi 1210 @if [ -f ${PKGDIR}/DESCR ]; then \ 1211 ${ECHO} -n "|${PKGDIR}/DESCR"; \ 1212 else \ 1213 ${ECHO} -n "|/dev/null"; \ 1214 fi 1215 @${ECHO} -n "|${MAINTAINER}|${CATEGORIES}|" 1216 @${ECHO} -n `make depends-list|sort|uniq` 1217 @${ECHO} -n "|" 1218 @${ECHO} -n `make package-depends|sort|uniq` 1219 @${ECHO} "" 1220.endif 1221 1222.if !target(readmes) 1223readmes: readme 1224.endif 1225 1226.if !target(readme) 1227readme: 1228 @rm -f README.html 1229 @make README.html 1230.endif 1231 1232README.html: 1233 @${ECHO_MSG} "===> Creating README.html for ${PKGNAME}" 1234 @${CAT} ${TEMPLATES}/README.port | \ 1235 ${SED} -e 's%%PORT%%'`${ECHO} ${.CURDIR} | ${SED} -e 's.*/\([^/]*/[^/]*\)$$\1'`'g' \ 1236 -e 's%%PKG%%${PKGNAME}g' \ 1237 -e '/%%COMMENT%%/r${PKGDIR}/COMMENT' \ 1238 -e '/%%COMMENT%%/d' \ 1239 -e 's%%BUILD_DEPENDS%%'"`${MAKE} print-depends-list`"'' \ 1240 -e 's%%RUN_DEPENDS%%'"`${MAKE} print-package-depends`"'' \ 1241 >> $@ 1242 1243.if !target(print-depends-list) 1244print-depends-list: 1245.if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || \ 1246 defined(LIB_DEPENDS) || defined(DEPENDS) 1247 @${ECHO} -n 'This port requires package(s) "' 1248 @${ECHO} -n `make depends-list | sort | uniq` 1249 @${ECHO} '" to build.' 1250.endif 1251.endif 1252 1253.if !target(print-package-depends) 1254print-package-depends: 1255.if defined(RUN_DEPENDS) || defined(LIB_DEPENDS) || defined(DEPENDS) 1256 @${ECHO} -n 'This port requires package(s) "' 1257 @${ECHO} -n `make package-depends | sort | uniq` 1258 @${ECHO} '" to run.' 1259.endif 1260.endif 1261 1262# Fake installation of package so that user can pkg_delete it later. 1263# Also, make sure that an installed port is recognized correctly in 1264# accordance to the @pkgdep directive in the packing lists 1265 1266.if !target(fake-pkg) 1267fake-pkg: 1268 @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 1269 @if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} -p ${PKG_DBDIR}; fi 1270.if defined(FORCE_PKG_REGISTER) 1271 @${RM} -rf ${PKG_DBDIR}/${PKGNAME} 1272.endif 1273 @if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \ 1274 ${ECHO_MSG} "===> Registering installation for ${PKGNAME}"; \ 1275 ${MKDIR} -p ${PKG_DBDIR}/${PKGNAME}; \ 1276 ${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \ 1277 ${CP} ${PKGDIR}/DESCR ${PKG_DBDIR}/${PKGNAME}/+DESC; \ 1278 ${CP} ${PKGDIR}/COMMENT ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \ 1279 if [ -f ${PKGDIR}/INSTALL ]; then \ 1280 ${CP} ${PKGDIR}/INSTALL ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \ 1281 fi; \ 1282 if [ -f ${PKGDIR}/DEINSTALL ]; then \ 1283 ${CP} ${PKGDIR}/DEINSTALL ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \ 1284 fi; \ 1285 if [ -f ${PKGDIR}/REQ ]; then \ 1286 ${CP} ${PKGDIR}/REQ ${PKG_DBDIR}/${PKGNAME}/+REQ; \ 1287 fi; \ 1288 else \ 1289 ${ECHO_MSG} "===> ${PKGNAME} is already installed - perhaps an older version?"; \ 1290 ${ECHO_MSG} " If so, you may wish to \`\`pkg_delete ${PKGNAME}'' and install"; \ 1291 ${ECHO_MSG} " this port again by \`\`make reinstall'' to upgrade it properly."; \ 1292 fi 1293.endif 1294 1295# Depend is generally meaningless for arbitrary ports, but if someone wants 1296# one they can override this. This is just to catch people who've gotten into 1297# the habit of typing `make depend all install' as a matter of course. 1298# 1299.if !target(depend) 1300depend: 1301.endif 1302 1303# Same goes for tags 1304.if !target(tags) 1305tags: 1306.endif 1307