xref: /freebsd/share/man/man7/ports.7 (revision d056fa046c6a91b90cd98165face0e42a33a5173)
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.\" $FreeBSD$
27.\"
28.Dd July 5, 2006
29.Dt PORTS 7
30.Os
31.Sh NAME
32.Nm ports
33.Nd contributed applications
34.Sh DESCRIPTION
35The
36.Fx
37Ports Collection
38offers a simple way for users and
39administrators to install applications.
40Each
41.Em port
42contains any patches necessary to make the original
43application source code compile and run on
44.Bx .
45Compiling an
46application is as simple as typing
47.Nm make Cm build
48in the port directory!
49The
50.Pa Makefile
51automatically fetches the
52application source code, either from a local disk or via FTP, unpacks it
53on your system, applies the patches, and compiles it.
54If all goes well,
55simply type
56.Nm make Cm install
57to install the application.
58.Pp
59It is possible to download and use ports from the
60.Fx
61repository
62that are newer than the installed system; however it is important to
63install the appropriate
64.Dq "Upgrade Kit"
65from
66.Pa http://www.FreeBSD.org/ports/
67first!
68The
69.Xr portcheckout 1 Pq Pa ports/devel/portcheckout
70script (also a port, of course!) will help to download new ports.
71.Pp
72For more information about using ports, see
73.Dq "Packages and Ports"
74in
75.%B "The FreeBSD Handbook" ,
76.Pa ( file:/usr/share/doc/en_US.ISO8859-1/books/handbook/ports.html
77or
78.Pa http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/ports.html ) .
79For information about creating new ports, see
80.%B "The Porter's Handbook"
81.Pa ( file:/usr/share/doc/en_US.ISO8859-1/books/porters-handbook/index.html
82or
83.Pa http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/porters-handbook/ ) .
84.Sh TARGETS
85Some of the targets work recursively through subdirectories.
86This lets you, for example, install all of the
87.Dq Li biology
88ports.
89The targets that do this are
90.Cm build , checksum , clean , configure ,
91.Cm depends , extract , fetch , install ,
92and
93.Cm package .
94.Pp
95The following targets will be run automatically by each proceeding
96target in order.
97That is,
98.Cm build
99will be run
100(if necessary)
101by
102.Cm install ,
103and so on all the way to
104.Cm fetch .
105Usually, you will only use the
106.Cm install
107target.
108.Bl -tag -width ".Cm configure"
109.It Cm config
110Configure
111.Va OPTIONS
112for this port using
113.Xr dialog 1 .
114.It Cm config-recursive
115Configure
116.Va OPTIONS
117for this port and all its dependencies using
118.Xr dialog 1 .
119.It Cm fetch
120Fetch all of the files needed to build this port from the sites
121listed in
122.Va MASTER_SITES
123and
124.Va PATCH_SITES .
125See
126.Va FETCH_CMD , MASTER_SITE_OVERRIDE
127and
128.Va MASTER_SITE_BACKUP .
129.It Cm checksum
130Verify that the fetched distfile's checksum matches the one the port was
131tested against.
132Defining
133.Va NO_CHECKSUM
134will skip this step.
135.It Cm depends
136Install
137(or compile if only compilation is necessary)
138any dependencies of the current port.
139When called by the
140.Cm extract
141or
142.Cm fetch
143targets, this is run in piecemeal as
144.Cm fetch-depends , build-depends ,
145etc.
146Defining
147.Va NO_DEPENDS
148will skip this step.
149.It Cm extract
150Expand the distfile into a work directory.
151.It Cm patch
152Apply any patches that are necessary for the port.
153.It Cm configure
154Configure the port.
155Some ports will ask you questions during this stage.
156See
157.Va INTERACTIVE
158and
159.Va BATCH .
160.It Cm build
161Build the port.
162This is the same as calling the
163.Cm all
164target.
165.It Cm install
166Install the port and register it with the package system.
167This is all you really need to do.
168.El
169.Pp
170The following targets are not run during the normal install process.
171.Bl -tag -width ".Cm fetch-recursive"
172.It Cm showconfig
173Display
174.Va OPTIONS
175config for this port.
176.It Cm showconfig-recursive
177Display
178.Va OPTIONS
179config for this port and all its dependencies.
180.It Cm rmconfig
181Remove
182.Va OPTIONS
183config for this port.
184.It Cm rmconfig-recursive
185Remove
186.Va OPTIONS
187config for this port and all its dependencies.
188.It Cm config-conditional
189Skip the ports which have already had their
190.Va OPTIONS
191configured.
192.It Cm fetch-list
193Show list of files to be fetched in order to build the port.
194.It Cm fetch-recursive
195Fetch the distfiles of the port and all its dependencies.
196.It Cm fetch-recursive-list
197Show list of files that would be retrieved by
198.Cm fetch-recursive .
199.It Cm pretty-print-run-depends-list , pretty-print-build-depends-list
200Print a list of all the compile and run dependencies, and dependencies
201of those dependencies.
202.It Cm missing
203Print a list of missing dependencies to be installed for the port.
204.It Cm clean
205Remove the expanded source code.
206This recurses to dependencies unless
207.Va NOCLEANDEPENDS
208is defined.
209.It Cm distclean
210Remove the port's distfiles and perform the
211.Cm clean
212target.
213The
214.Cm clean
215portion recurses to dependencies unless
216.Va NOCLEANDEPENDS
217is defined, but the
218.Cm distclean
219portion never recurses
220(this is perhaps a bug).
221.It Cm reinstall
222Use this to restore a port after using
223.Xr pkg_delete 1
224when you should have used
225.Cm deinstall .
226.It Cm deinstall
227Remove an installed port from the system, similar to
228.Xr pkg_delete 1 .
229.It Cm deinstall-all
230Remove all installed ports with the same
231.Va PKGORIGIN
232from the system.
233.It Cm package
234Make a binary package for the port.
235The port will be installed if it has not already been.
236The package is a
237.Pa .tbz
238file that you can use to
239install the port on other machines with
240.Xr pkg_add 1 .
241If the directory specified by
242.Va PACKAGES
243does not exist, the package will be put into the current directory.
244See
245.Va PKGREPOSITORY
246and
247.Va PKGFILE .
248.It Cm package-recursive
249Like
250.Cm package ,
251but makes a package for each depending port as well.
252.It Cm readmes
253Create a port's
254.Pa README.html .
255This can be used from
256.Pa /usr/ports
257to create a browsable web of all ports on your system!
258.It Cm search
259Search the
260.Pa INDEX
261file for the pattern specified by the
262.Va key
263(searches the port name, comment, and dependencies),
264.Va name
265(searches the port name only),
266.Va path
267(searches the port path),
268.Va info
269(searches the port info),
270.Va maint
271(searches the port maintainer),
272.Va cat
273(searches the port category),
274.Va bdeps
275(searches the port build-time dependency),
276.Va rdeps
277(searches the port run-time dependency)
278.Xr make 1
279variables, and their exclusion counterparts:
280.Va xname , xkey
281etc.
282For example, one would type:
283.Pp
284.Dl "cd /usr/ports && make search name=query"
285.Pp
286to find all ports whose
287name matches
288.Dq Li query .
289Results include the matching ports' path, comment, maintainer,
290build dependencies, and run dependencies.
291.Bd -literal -offset indent
292cd /usr/ports && make search name=pear- \e
293    xbdeps=apache
294.Ed
295.Pp
296To find all ports whose
297names contain
298.Dq Li pear-
299and which do not have apache
300listed in build-time dependencies.
301.Bd -literal -offset indent
302cd /usr/ports && make search name=pear- \e
303    xname='ht(tp|ml)'
304.Ed
305.Pp
306To find all ports whose names contain
307.Dq Li pear- ,
308but not
309.Dq Li html
310or
311.Dq Li http .
312.Bd -literal -offset indent
313make search key=apache display=name,path,info keylim=1
314.Ed
315.Pp
316To find ports that contain
317.Dq Li apache
318in either of the name, path, info
319fields, ignore the rest of the record.
320.It Cm describe
321Generate a one-line description of each port for use in the
322.Pa INDEX
323file.
324.It Cm index
325Create
326.Pa /usr/ports/INDEX ,
327which is used by the
328.Cm pretty-print-*
329and
330.Cm search
331targets.
332Running the
333.Cm index
334target will ensure your
335.Pa INDEX
336file is up to date with your ports tree.
337.It Cm fetchindex
338Fetch the
339.Pa INDEX
340file from the
341.Fx
342cluster.
343.El
344.Sh ENVIRONMENT
345You can change all of these.
346.Bl -tag -width ".Va MASTER_SITES"
347.It Va PORTSDIR
348Location of the ports tree.
349This is
350.Pa /usr/ports
351on
352.Fx
353and
354.Ox ,
355and
356.Pa /usr/pkgsrc
357on
358.Nx .
359.It Va WRKDIRPREFIX
360Where to create any temporary files.
361Useful if
362.Va PORTSDIR
363is read-only (perhaps mounted from a CD-ROM).
364.It Va DISTDIR
365Where to find/put distfiles, normally
366.Pa distfiles/
367in
368.Va PORTSDIR .
369.It Va PACKAGES
370Used only for the
371.Cm package
372target; the base directory for the packages tree, normally
373.Pa packages/
374in
375.Va PORTSDIR .
376If this directory exists, the package tree will be (partially) constructed.
377This directory does not have to exist; if it does not, packages will be
378placed into the current directory, or you can define one of
379.Bl -tag -width ".Va PKGREPOSITORY"
380.It Va PKGREPOSITORY
381Directory to put the package in.
382.It Va PKGFILE
383The full path to the package.
384.El
385.It Va PREFIX
386Where to install things in general
387(usually
388.Pa /usr/local
389or
390.Pa /usr/X11R6 ) .
391.It Va MASTER_SITES
392Primary sites for distribution files if not found locally.
393.It Va PATCH_SITES
394Primary locations for distribution patch files if not found
395locally.
396.It Va MASTER_SITE_FREEBSD
397If set, go to the master
398.Fx
399site for all files.
400.It Va MASTER_SITE_OVERRIDE
401Try going to these sites for all files and patches, first.
402.It Va MASTER_SITE_BACKUP
403Try going to these sites for all files and patches, last.
404.It Va RANDOMIZE_MASTER_SITES
405Try the download locations in a random order.
406.It Va MASTER_SORT
407Sort the download locations according to user supplied pattern.
408Example:
409.Dl .dk .sunet.se .se dk.php.net .no .de heanet.dl.sourceforge.net
410.It Va MASTER_SITE_INDEX
411Where to get
412.Pa INDEX
413source built on
414.Fx
415cluster (for
416.Cm fetchindex
417target).
418Defaults to
419.Pa http://www.FreeBSD.org/ports/ .
420.It Va FETCHINDEX
421Command to get
422.Pa INDEX
423(for
424.Cm fetchindex
425target).
426Defaults to
427.Dq Nm fetch Fl am .
428.It Va NOCLEANDEPENDS
429If defined, do not let
430.Cm clean
431recurse to dependencies.
432.It Va FETCH_CMD
433Command to use to fetch files.
434Normally
435.Xr fetch 1 .
436.It Va FORCE_PKG_REGISTER
437If set, overwrite any existing package registration on the system.
438.It Va MOTIFLIB
439Location of
440.Pa libXm. Ns Brq Pa a , Ns Pa so .
441.It Va INTERACTIVE
442If defined, only operate on a port if it requires interaction.
443.It Va BATCH
444If defined, only operate on a port if it can be installed 100% automatically.
445.It Va DISABLE_VULNERABILITIES
446If defined, disable check for security vulnerabilities using
447.Xr portaudit 1 Pq Pa ports/security/portaudit
448when installing new ports.
449.El
450.Sh FILES
451.Bl -tag -width ".Pa /usr/ports/Mk/bsd.port.mk" -compact
452.It Pa /usr/ports
453The default ports directory
454.No ( Fx
455and
456.Ox ) .
457.It Pa /usr/pkgsrc
458The default ports directory
459.Pq Nx .
460.It Pa /usr/ports/Mk/bsd.port.mk
461The big Kahuna.
462.El
463.Sh SEE ALSO
464.Xr make 1 ,
465.Xr pkg_add 1 ,
466.Xr pkg_create 1 ,
467.Xr pkg_delete 1 ,
468.Xr pkg_info 1 ,
469.Xr pkg_version 1
470.Pp
471The following are part of the ports collection:
472.Pp
473.Xr pib 1 ,
474.Xr portaudit 1 ,
475.Xr portcheckout 1 ,
476.Xr portlint 1
477.Rs
478.%B "The FreeBSD Handbook"
479.Re
480.Pp
481.Pa http://www.FreeBSD.org/ports
482(searchable index of all ports)
483.Sh HISTORY
484The Ports Collection
485appeared in
486.Fx 1.0 .
487It has since spread to
488.Nx
489and
490.Ox .
491.Sh AUTHORS
492.An -nosplit
493This manual page was originated by
494.An David O'Brien .
495.Sh BUGS
496Ports documentation is split over four places \(em
497.Pa /usr/ports/Mk/bsd.port.mk ,
498.%B "The Porter's Handbook" ,
499the
500.Dq "Packages and Ports"
501chapter of
502.%B "The FreeBSD Handbook" ,
503and
504this manual page.
505