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