1.\" 2.\" Copyright (c) 1997 David E. O'Brien 3.\" 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR 16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25.\" 26.\" $OpenBSD: ports.7,v 1.20 2001/08/03 15:21:16 mpech Exp $ 27.\" $FreeBSD: ports.7,v 1.7 1998/06/23 04:38:50 hoek Exp $ 28.\" 29.Dd January 25, 1998 30.Dt PORTS 7 31.Os 32.Sh NAME 33.Nm ports 34.Nd contributed applications 35.Sh DESCRIPTION 36The 37.Ox 38Ports Collection 39(shamelessly stolen from the 40.Fx 41Ports Collection) offers a simple way 42for users and administrators to install applications. 43Each port contains any patches necessary to make the original 44application source code compile and run on BSD. 45Compiling an application is as simple as typing 46.Ic make 47in the port directory! 48The 49.Pa Makefile 50automatically fetches the 51application source code, either from a local disk or via ftp, unpacks it 52on the local system, applies the patches, and compiles it. 53If all goes well, simply type 54.Ic sudo make install 55to install the application. 56.Pp 57For more information about using ports, see 58The 59.Ox 60Ports Mechanism 61(http://www.openbsd.org/ports.html). 62For information about creating new ports, see 63.\" .Xr porting 7 64.\" and 65Building an 66.Ox 67Port (http://www.openbsd.org/porting.html). 68Other excellent resources are the ports and porting sections of the 69.Fx 70Handbook (http://www.freebsd.org/handbook/ports.html and 71http://www.freebsd.org/handbook/porting.html) as well as the 72.Nx 73Package System documentation 74(http://www.netbsd.org/Documentation/netbsd/Packages.txt). 75.Pp 76For a detailed description of the build process, see 77.Xr bsd.port.mk 5 . 78.Sh PORTS MASTER MAKEFILE 79The ports master Makefile, normally located in 80.Pa /usr/ports/Makefile 81(but see 82.Ev PORTSDIR 83below) 84offers a few useful targets. 85.Bl -tag -width configure 86.It Ar index 87rebuild the ports complete index, 88.Pa /usr/ports/INDEX 89.It Ar mirror-maker 90see 91.Xr mirroring-ports 7 , 92.It Ar print-index 93display the contents of the index in a user-friendly way, 94.It Ar search 95invoked with a key, e.g., 96.Ic make search key=foo , 97retrieve information relevant to a given port (obsolescent). 98.El 99.Sh SELECTING A SET OF PORTS 100If 101.Pa /usr/ports/INDEX 102is up to date, it is possible to select subsets by setting the following 103variables on the command line: 104.Bl -tag -width category 105.It Va key 106package name matching the given key, 107.It Va category 108port belonging to category, 109.It Va maintainer 110port maintained by a given person. 111.El 112 113For instance, to invoke clean on all ports in the x11 category, one can say: 114.Bd -literal -offset indent 115 make category=x11 clean 116.Ed 117 118The index search is done by a perl script, so all regular expressions from 119.Xr perlre 1 120apply. 121.Sh TARGETS 122Individual ports are controlled through a few documented targets. 123Some of these targets work recursively through subdirectories, so that 124someone can, for examples, install all of the net 125ports. 126.Pp 127In case of failure in a subdirectory, the shell fragment held in 128.Ev REPORT_PROBLEM 129is executed. 130Default behavior is to call exit, but this can be overridden on the command 131line, e.g., to avoid stopping after each problem. 132.Bd -literal -offset indent 133 make REPORT_PROBLEM=true 134.Ed 135 136The targets that do this are 137.Ar build , checksum , clean , configure , extract , fake, fetch , 138.Ar install , distclean , deinstall, reinstall, mirror-distfiles, obj , 139.Ar package , cdrom-packages , link-categories, unlink-categories , 140and 141.Ar ftp-packages . 142.Pp 143Target names starting with _ are private to the ports infrastructure, 144should not be invoked directly, and are liable to change without notice. 145.Pp 146In the following list, each target will run the preceding targets 147in order automatically. 148That is, 149.Ar build 150will be run 151.Pq if necessary 152by 153.Ar install , 154and so on all the way to 155.Ar fetch . 156Typical use only runs 157.Ar install 158explicitly (if root or 159.Ev SUDO 160is defined in 161.Pa /etc/mk.conf ) , 162or 163.Ar build 164(as user), then 165.Ar install 166(as root). 167.Bl -tag -width configure 168.It Ar fetch 169Fetch all of the files needed to build this port from the site(s) 170listed in 171.Ev MASTER_SITES 172and 173.Ev PATCH_SITES . 174See 175.Ev FETCH_CMD 176and 177.Ev MASTER_SITE_OVERRIDE . 178.It Ar checksum 179Verify that the fetched distfile matches the one the port was tested against. 180Defining 181.Ev NO_CHECKSUM 182to 183.Dv Yes 184will skip this step. 185Sometimes, distfiles change without warning. 186The main 187.Ox 188mirror should still hold a copy of old distfiles, indexed by checksum. 189Using 190.Bd -literal -offset indent 191 make checksum REFETCH=true 192.Ed 193 194will try to get a set of distfiles that match the recorded checksum. 195.It Ar depends 196Install 197.Pq or package if only compilation is necessary 198any dependencies of the current port. 199When called by the 200.Ar extract, install 201or 202.Ar fetch 203targets, this is run in scattered pieces as 204.Ar fetch-depends , lib-depends , build-depends , run-depends 205and 206.Ar misc-depends . 207Defining 208.Ev NO_DEPENDS 209to 210.Dv Yes 211will skip this step. 212.It Ar extract 213Expand the distfile into a work directory. 214.It Ar patch 215Apply any patches that are necessary for the port. 216.It Ar configure 217Configure the port. 218Some ports will ask questions during this stage. 219See 220.Ev INTERACTIVE 221and 222.Ev BATCH . 223.It Ar build 224Build the port. 225This is the same as calling the 226.Ar all 227target. 228.It Ar fake 229Pretend to install the port under a subdirectory of the work directory. 230.It Ar package 231Create a binary package from the fake installation. 232The package is a .tgz file that can be used to 233install the port on several machines with 234.Xr pkg_add 1 . 235.It Ar install 236Install the resulting package. 237.El 238.Pp 239The following targets are not run during the normal install process. 240.Bl -tag -width fetch-list 241.It Ar depends-list package-depends 242Print an ordered list of all the compile and run dependencies. 243.It Ar clean 244Remove the expanded source code. 245This does not recurse to dependencies unless 246.Ev CLEANDEPENDS 247is defined to 248.Dv Yes . 249.It Ar distclean 250Remove the port's distfile(s) and perform the 251.Ar clean 252operation. 253This does not recurse to dependencies. 254.It Ar reinstall 255Use this to restore a port after using 256.Xr pkg_delete 1 . 257.It Ar link-categories 258Populate the ports tree with symbolic links for each category the port 259belongs to. 260.It Ar unlink-categories 261Remove the symbolic links created by 262.Ar link-categories . 263.El 264.Sh NETWORK CONFIGURATION 265The variables pertaining to network access have been marshalled into 266.Pa ${PORTSDIR}/infrastructure/template/network.conf.template . 267 268To customize that setup, copy that file into 269.Pa ${PORTSDIR}/infrastructure/db/network.conf 270and edit it. 271.Pp 272.Bl -tag -width MASTER_SITES 273.It Ev MASTER_SITE_OPENBSD 274If set to 275.Dv Yes , 276include the master 277.Ox 278site when fetching files. 279.It Ev MASTER_SITE_FREEBSD 280If set to 281.Dv Yes , 282include the master 283.Fx 284site when fetching files. 285.It Ev MASTER_SITE_OVERRIDE 286Go to this site first for all files. 287.El 288.Sh PORT VARIABLES 289These can be changed in the environment, or in 290.Pa /etc/mk.conf 291for persistence. 292They can also be set on make's command line, e.g., 293.Ic make VAR_FOO=foo 294.Pp 295Boolean variables should be set to 296.Dv Yes 297instead of simply being defined, for uniformity and future compatibility. 298.Pp 299Variable names starting with _ are private to the ports infrastructure, 300should not be changed by the user, and are liable to change without notice. 301.Pp 302.Bl -tag -width MASTER_SITES 303.It Ev PORTSDIR 304Location of the ports tree. 305This is 306.Pa /usr/ports 307on 308.Fx 309and 310.Ox 311and 312.Pa /usr/pkgsrc 313on 314.Nx . 315.It Ev DISTDIR 316Where to find/put distfiles, normally 317.Pa distfiles/ 318in 319.Ev PORTSDIR . 320.It Ev PACKAGES 321Used only for the 322.Ar package 323target; the base directory for the packages tree, normally 324.Pa packages/${ARCH} 325in 326.Ev PORTSDIR . 327If this directory exists, the package tree will be (partially) constructed. 328This directory does not have to exist; if it doesn't, packages will be 329placed into the current directory, or define one of 330.Bl -tag -width PKGREPOSITORY 331.It Ev PKGREPOSITORY 332Directory to put the package in. 333.It Ev PKGFILE 334The full path to the package. 335.El 336.It Ev PREFIX 337Where to install things in general 338.Po 339usually 340.Pa /usr/local 341.Pc 342.It Ev MASTER_SITES 343Primary sites for distribution files if not found locally. 344.It Ev PATCH_SITES 345Primary location(s) for distribution patch files if not found 346locally. 347.It Ev CLEANDEPENDS 348If set to 349.Dv Yes , 350let 351.Sq clean 352recurse to dependencies. 353.It Ev NOCLEANDEPENDS 354If defined, don't let 355.Sq clean 356recurse to dependencies (deprecated, use 357.Ev CLEANDEPENDS 358instead). 359.It Ev FETCH_CMD 360Command to use to fetch files. 361Normally 362.Xr ftp 1 . 363.It Ev FORCE_PKG_REGISTER 364If set, overwrite any existing package registration on the system. 365.It Ev MOTIFLIB 366Location of libXm.{a,so}. 367.It Ev PATCH_DEBUG 368If defined, display verbose output when applying each patch. 369.It Ev INTERACTIVE 370If defined, only operate on a port if it requires interaction. 371.It Ev BATCH 372If defined, only operate on a port if it can be installed 100% automatically. 373.El 374.Sh USING A READ-ONLY PORTS TREE 375Select read-write partition(s) that can accommodate working directories, the 376distfiles repository, and the built packages. 377Set 378.Ev WRKOBJDIR , 379.Ev PACKAGES 380and 381.Ev DISTDIR 382in 383.Pa /etc/mk.conf 384accordingly. 385do a 386.Li "cd /usr/ports && make obj" 387to create working directories stubs. 388.Pa /usr/ports 389may now be remounted read-only. 390.Sh FILES 391.Bl -tag -width /usr/ports/xxxxxxxx -compact 392.It Pa /usr/ports 393The default ports directory ( 394.Fx 395and 396.Ox 397). 398.It Pa /usr/pkgsrc 399The default ports directory ( 400.Nx 401). 402.It Pa /usr/ports/Makefile 403Ports master Makefile. 404.It Pa /usr/ports/INDEX 405Ports index. 406.It Pa /usr/ports/infrastructure/mk/bsd.port.mk 407The ports main engine ( 408.Ox 409). 410.It Pa /usr/ports/infrastructure/templates/network.conf.template 411Network configuration defaults ( 412.Ox 413). 414.It Pa /usr/ports/infrastructure/db/network.conf 415Local network configuration ( 416.Ox 417). 418.El 419.Sh SEE ALSO 420.Xr make 1 , 421.Xr pkg_add 1 , 422.Xr pkg_create 1 , 423.Xr pkg_delete 1 , 424.Xr pkg_info 1 , 425.Xr bsd.port.mk 5 , 426.Xr packages 7 427.Pp 428The 429.Fx 430handbook. 431.Sh AUTHORS 432This man page was originated by 433David O'Brien, from the 434.Fx 435project. 436.Sh HISTORY 437.Nm The Ports Collection 438appeared in 439.Fx 1.0 . 440It was introduced in 441.Ox 442by Ejovi Nuwere, with much initial effort by Angelos D. Keromytis. 443Maintenance passed then to Marco S Hyman, 444it is currently managed by Christopher Turan, 445with much help from Marc Espie, Kevin Lo, Brad Smith, Christian Weisgerber, 446and a host of others found at ports@openbsd.org. 447.Sh BUGS 448Ports documentation is split over several places --- 449.Pa /usr/share/mk/bsd.port.mk , 450the 451.Dq Ports Collection 452section of the 453.Fx 454handbook, the 455.Dq Porting Existing Software 456section of the 457.Fx 458handbook, 459and some man pages. 460.Ox 461adds a few web pages to further confuse the issue. 462