xref: /freebsd/share/man/man7/ports.7 (revision 30d239bc4c510432e65a84fa1c14ed67a3ab1c92)
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 Aug 22, 2007
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/ports-mgmt/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 quicksearch
321Reduced
322.Cm search
323output.
324Only display name, path and info.
325.It Cm describe
326Generate a one-line description of each port for use in the
327.Pa INDEX
328file.
329.It Cm index
330Create
331.Pa /usr/ports/INDEX ,
332which is used by the
333.Cm pretty-print-*
334and
335.Cm search
336targets.
337Running the
338.Cm index
339target will ensure your
340.Pa INDEX
341file is up to date with your ports tree.
342.It Cm fetchindex
343Fetch the
344.Pa INDEX
345file from the
346.Fx
347cluster.
348.El
349.Sh ENVIRONMENT
350You can change all of these.
351.Bl -tag -width ".Va MASTER_SITES"
352.It Va PORTSDIR
353Location of the ports tree.
354This is
355.Pa /usr/ports
356on
357.Fx
358and
359.Ox ,
360and
361.Pa /usr/pkgsrc
362on
363.Nx .
364.It Va WRKDIRPREFIX
365Where to create any temporary files.
366Useful if
367.Va PORTSDIR
368is read-only (perhaps mounted from a CD-ROM).
369.It Va DISTDIR
370Where to find/put distfiles, normally
371.Pa distfiles/
372in
373.Va PORTSDIR .
374.It Va PACKAGES
375Used only for the
376.Cm package
377target; the base directory for the packages tree, normally
378.Pa packages/
379in
380.Va PORTSDIR .
381If this directory exists, the package tree will be (partially) constructed.
382This directory does not have to exist; if it does not, packages will be
383placed into the current directory, or you can define one of
384.Bl -tag -width ".Va PKGREPOSITORY"
385.It Va PKGREPOSITORY
386Directory to put the package in.
387.It Va PKGFILE
388The full path to the package.
389.El
390.It Va PREFIX
391Where to install things in general
392(usually
393.Pa /usr/local ) .
394.It Va MASTER_SITES
395Primary sites for distribution files if not found locally.
396.It Va PATCH_SITES
397Primary locations for distribution patch files if not found
398locally.
399.It Va MASTER_SITE_FREEBSD
400If set, go to the master
401.Fx
402site for all files.
403.It Va MASTER_SITE_OVERRIDE
404Try going to these sites for all files and patches, first.
405.It Va MASTER_SITE_BACKUP
406Try going to these sites for all files and patches, last.
407.It Va RANDOMIZE_MASTER_SITES
408Try the download locations in a random order.
409.It Va MASTER_SORT
410Sort the download locations according to user supplied pattern.
411Example:
412.Dl .dk .sunet.se .se dk.php.net .no .de heanet.dl.sourceforge.net
413.It Va MASTER_SITE_INDEX
414Where to get
415.Pa INDEX
416source built on
417.Fx
418cluster (for
419.Cm fetchindex
420target).
421Defaults to
422.Pa http://www.FreeBSD.org/ports/ .
423.It Va FETCHINDEX
424Command to get
425.Pa INDEX
426(for
427.Cm fetchindex
428target).
429Defaults to
430.Dq Nm fetch Fl am .
431.It Va NOCLEANDEPENDS
432If defined, do not let
433.Cm clean
434recurse to dependencies.
435.It Va FETCH_CMD
436Command to use to fetch files.
437Normally
438.Xr fetch 1 .
439.It Va FORCE_PKG_REGISTER
440If set, overwrite any existing package registration on the system.
441.It Va MOTIFLIB
442Location of
443.Pa libXm. Ns Brq Pa a , Ns Pa so .
444.It Va INTERACTIVE
445If defined, only operate on a port if it requires interaction.
446.It Va BATCH
447If defined, only operate on a port if it can be installed 100% automatically.
448.It Va DISABLE_VULNERABILITIES
449If defined, disable check for security vulnerabilities using
450.Xr portaudit 1 Pq Pa ports/ports-mgmt/portaudit
451when installing new ports.
452.It Va NO_IGNORE
453If defined, allow installation of ports marked as
454.Aq Va FORBIDDEN .
455The default behavior of the Ports framework is to abort when the
456installation of a forbidden port is attempted.
457Setting
458.Va NO_IGNORE
459Of course, these ports may not work as expected, but if you really know
460what you are doing and are sure about installing a forbidden port, then
461.Va NO_IGNORE
462lets you do it.
463.El
464.Sh FILES
465.Bl -tag -width ".Pa /usr/ports/Mk/bsd.port.mk" -compact
466.It Pa /usr/ports
467The default ports directory
468.No ( Fx
469and
470.Ox ) .
471.It Pa /usr/pkgsrc
472The default ports directory
473.Pq Nx .
474.It Pa /usr/ports/Mk/bsd.port.mk
475The big Kahuna.
476.El
477.Sh SEE ALSO
478.Xr make 1 ,
479.Xr pkg_add 1 ,
480.Xr pkg_create 1 ,
481.Xr pkg_delete 1 ,
482.Xr pkg_info 1 ,
483.Xr pkg_version 1
484.Pp
485The following are part of the ports collection:
486.Pp
487.Xr portaudit 1 ,
488.Xr portcheckout 1 ,
489.Xr portlint 1
490.Rs
491.%B "The FreeBSD Handbook"
492.Re
493.Pp
494.Pa http://www.FreeBSD.org/ports
495(searchable index of all ports)
496.Sh HISTORY
497The Ports Collection
498appeared in
499.Fx 1.0 .
500It has since spread to
501.Nx
502and
503.Ox .
504.Sh AUTHORS
505.An -nosplit
506This manual page was originated by
507.An David O'Brien .
508.Sh BUGS
509Ports documentation is split over four places \(em
510.Pa /usr/ports/Mk/bsd.port.mk ,
511.%B "The Porter's Handbook" ,
512the
513.Dq "Packages and Ports"
514chapter of
515.%B "The FreeBSD Handbook" ,
516and
517this manual page.
518