forked from jsonn/pkgsrc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pkgsrc.txt
8500 lines (6140 loc) · 336 KB
/
pkgsrc.txt
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
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
The pkgsrc guide
Documentation on the NetBSD packages system
Alistair Crooks
Hubert Feyrer
The pkgsrc Developers
Copyright 1994-2016 The NetBSD Foundation, Inc
$NetBSD: pkgsrc.xml,v 1.30 2016/06/11 18:14:42 rillig Exp $
Abstract
pkgsrc is a centralized package management system for Unix-like operating
systems. This guide provides information for users and developers of pkgsrc. It
covers installation of binary and source packages, creation of binary and
source packages and a high-level overview about the infrastructure.
-------------------------------------------------------------------------------
Table of Contents
1. What is pkgsrc?
1.1. Introduction
1.1.1. Why pkgsrc?
1.1.2. Supported platforms
1.2. Overview
1.3. Terminology
1.3.1. Roles involved in pkgsrc
1.4. Typography
I. The pkgsrc user's guide
2. Where to get pkgsrc and how to keep it up-to-date
2.1. Getting pkgsrc for the first time
2.1.1. As tar archive
2.1.2. Via anonymous CVS
2.2. Keeping pkgsrc up-to-date
2.2.1. Via tar files
2.2.2. Via CVS
3. Using pkgsrc on systems other than NetBSD
3.1. Binary distribution
3.2. Bootstrapping pkgsrc
4. Using pkgsrc
4.1. Using binary packages
4.1.1. Finding binary packages
4.1.2. Installing binary packages
4.1.3. Deinstalling packages
4.1.4. Getting information about installed packages
4.1.5. Checking for security vulnerabilities in installed packages
4.1.6. Finding if newer versions of your installed packages are in
pkgsrc
4.1.7. Other administrative functions
4.2. Building packages from source
4.2.1. Requirements
4.2.2. Fetching distfiles
4.2.3. How to build and install
5. Configuring pkgsrc
5.1. General configuration
5.2. Variables affecting the build process
5.3. Variables affecting the installation process
5.4. Selecting and configuring the compiler
5.4.1. Selecting the compiler
5.4.2. Additional flags to the compiler (CFLAGS)
5.4.3. Additional flags to the linker (LDFLAGS)
5.5. Developer/advanced settings
5.6. Selecting Build Options
6. Creating binary packages
6.1. Building a single binary package
6.2. Settings for creation of binary packages
7. Creating binary packages for everything in pkgsrc (bulk builds)
7.1. Preparations
7.2. Running a pbulk-style bulk build
7.2.1. Configuration
7.3. Requirements of a full bulk build
7.4. Creating a multiple CD-ROM packages collection
7.4.1. Example of cdpack
8. Directory layout of the installed files
8.1. File system layout in ${LOCALBASE}
8.2. File system layout in ${VARBASE}
9. Frequently Asked Questions
9.1. Are there any mailing lists for pkg-related discussion?
9.2. Utilities for package management (pkgtools)
9.3. How to use pkgsrc as non-root
9.4. How to resume transfers when fetching distfiles?
9.5. How can I install/use modular X.org from pkgsrc?
9.6. How to fetch files from behind a firewall
9.7. How to fetch files from HTTPS sites
9.8. How do I tell make fetch to do passive FTP?
9.9. How to fetch all distfiles at once
9.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc"
mean?
9.11. What does "Could not find bsd.own.mk" mean?
9.12. Using 'sudo' with pkgsrc
9.13. How do I change the location of configuration files?
9.14. Automated security checks
9.15. Why do some packages ignore my CFLAGS?
9.16. A package does not build. What shall I do?
9.17. What does "Makefile appears to contain unresolved cvs/rcs/???
merge conflicts" mean?
II. The pkgsrc developer's guide
10. Creating a new pkgsrc package from scratch
10.1. Common types of packages
10.1.1. Perl modules
10.1.2. KDE3 & KDE4 applications
10.1.3. Python modules and programs
10.2. Examples
10.2.1. How the www/nvu package came into pkgsrc
11. Package components - files, directories and contents
11.1. Makefile
11.2. distinfo
11.3. patches/*
11.3.1. Structure of a single patch file
11.3.2. Creating patch files
11.3.3. Sources where the patch files come from
11.3.4. Patching guidelines
11.3.5. Feedback to the author
11.4. Other mandatory files
11.5. Optional files
11.5.1. Files affecting the binary package
11.5.2. Files affecting the build process
11.5.3. Files affecting nothing at all
11.6. work*
11.7. files/*
12. Programming in Makefiles
12.1. Caveats
12.2. Makefile variables
12.2.1. Naming conventions
12.3. Code snippets
12.3.1. Adding things to a list
12.3.2. Echoing a string exactly as-is
12.3.3. Passing CFLAGS to GNU configure scripts
12.3.4. Handling possibly empty variables
13. PLIST issues
13.1. RCS ID
13.2. Semi-automatic PLIST generation
13.3. Tweaking output of make print-PLIST
13.4. Variable substitution in PLIST
13.5. Man page compression
13.6. Changing PLIST source with PLIST_SRC
13.7. Platform-specific and differing PLISTs
13.8. Build-specific PLISTs
13.9. Sharing directories between packages
14. Buildlink methodology
14.1. Converting packages to use buildlink3
14.2. Writing buildlink3.mk files
14.2.1. Anatomy of a buildlink3.mk file
14.2.2. Updating BUILDLINK_API_DEPENDS.pkg and
BUILDLINK_ABI_DEPENDS.pkg in buildlink3.mk files
14.3. Writing builtin.mk files
14.3.1. Anatomy of a builtin.mk file
14.3.2. Global preferences for native or pkgsrc software
15. The pkginstall framework
15.1. Files and directories outside the installation prefix
15.1.1. Directory manipulation
15.1.2. File manipulation
15.2. Configuration files
15.2.1. How PKG_SYSCONFDIR is set
15.2.2. Telling the software where configuration files are
15.2.3. Patching installations
15.2.4. Disabling handling of configuration files
15.3. System startup scripts
15.3.1. Disabling handling of system startup scripts
15.4. System users and groups
15.5. System shells
15.5.1. Disabling shell registration
15.6. Fonts
15.6.1. Disabling automatic update of the fonts databases
16. Options handling
16.1. Global default options
16.2. Converting packages to use bsd.options.mk
16.3. Option Names
16.4. Determining the options of dependencies
17. The build process
17.1. Introduction
17.2. Program location
17.3. Directories used during the build process
17.4. Running a phase
17.5. The fetch phase
17.5.1. What to fetch and where to get it from
17.5.2. How are the files fetched?
17.6. The checksum phase
17.7. The extract phase
17.8. The patch phase
17.9. The tools phase
17.10. The wrapper phase
17.11. The configure phase
17.12. The build phase
17.13. The test phase
17.14. The install phase
17.15. The package phase
17.16. Cleaning up
17.17. Other helpful targets
18. Tools needed for building or running
18.1. Tools for pkgsrc builds
18.2. Tools needed by packages
18.3. Tools provided by platforms
19. Making your package work
19.1. General operation
19.1.1. How to pull in user-settable variables from mk.conf
19.1.2. User interaction
19.1.3. Handling licenses
19.1.4. Restricted packages
19.1.5. Handling dependencies
19.1.6. Handling conflicts with other packages
19.1.7. Packages that cannot or should not be built
19.1.8. Packages which should not be deleted, once installed
19.1.9. Handling packages with security problems
19.1.10. How to handle incrementing versions when fixing an
existing package
19.1.11. Substituting variable text in the package files (the SUBST
framework)
19.2. The fetch phase
19.2.1. Packages whose distfiles aren't available for plain
downloading
19.2.2. How to handle modified distfiles with the 'old' name
19.2.3. Packages hosted on github.com
19.3. The configure phase
19.3.1. Shared libraries - libtool
19.3.2. Using libtool on GNU packages that already support libtool
19.3.3. GNU Autoconf/Automake
19.4. Programming languages
19.4.1. C, C++, and Fortran
19.4.2. Java
19.4.3. Packages containing perl scripts
19.4.4. Packages containing shell scripts
19.4.5. Other programming languages
19.5. The build phase
19.5.1. Compiling C and C++ code conditionally
19.5.2. How to handle compiler bugs
19.5.3. Undefined reference to "..."
19.5.4. Running out of memory
19.6. The install phase
19.6.1. Creating needed directories
19.6.2. Where to install documentation
19.6.3. Installing highscore files
19.6.4. Adding DESTDIR support to packages
19.6.5. Packages with hardcoded paths to other interpreters
19.6.6. Packages installing perl modules
19.6.7. Packages installing info files
19.6.8. Packages installing man pages
19.6.9. Packages installing GConf data files
19.6.10. Packages installing scrollkeeper/rarian data files
19.6.11. Packages installing X11 fonts
19.6.12. Packages installing GTK2 modules
19.6.13. Packages installing SGML or XML data
19.6.14. Packages installing extensions to the MIME database
19.6.15. Packages using intltool
19.6.16. Packages installing startup scripts
19.6.17. Packages installing TeX modules
19.6.18. Packages supporting running binaries in emulation
19.6.19. Packages installing hicolor theme icons
19.6.20. Packages installing desktop files
19.7. Marking packages as having problems
20. Debugging
21. Submitting and Committing
21.1. Submitting binary packages
21.2. Submitting source packages (for non-NetBSD-developers)
21.3. General notes when adding, updating, or removing packages
21.4. Committing: Adding a package to CVS
21.5. Updating a package to a newer version
21.6. Renaming a package in pkgsrc
21.7. Moving a package in pkgsrc
22. Frequently Asked Questions
23. GNOME packaging and porting
23.1. Meta packages
23.2. Packaging a GNOME application
23.3. Updating GNOME to a newer version
23.4. Patching guidelines
III. The pkgsrc infrastructure internals
24. Design of the pkgsrc infrastructure
24.1. The meaning of variable definitions
24.2. Avoiding problems before they arise
24.3. Variable evaluation
24.3.1. At load time
24.3.2. At runtime
24.4. How can variables be specified?
24.5. Designing interfaces for Makefile fragments
24.5.1. Procedures with parameters
24.5.2. Actions taken on behalf of parameters
24.6. The order in which files are loaded
24.6.1. The order in bsd.prefs.mk
24.6.2. The order in bsd.pkg.mk
25. Regression tests
25.1. Running the regression tests
25.2. Adding a new regression test
25.2.1. Overridable functions
25.2.2. Helper functions
26. Porting pkgsrc
26.1. Porting pkgsrc to a new operating system
A. A simple example package: bison
A.1. files
A.1.1. Makefile
A.1.2. DESCR
A.1.3. PLIST
A.1.4. Checking a package with pkglint
A.2. Steps for building, installing, packaging
B. Build logs
B.1. Building figlet
B.2. Packaging figlet
C. Directory layout of the pkgsrc FTP server
C.1. distfiles: The distributed source files
C.2. misc: Miscellaneous things
C.3. packages: Binary packages
C.4. reports: Bulk build reports
C.5. current, pkgsrc-20xxQy: source packages
D. Editing guidelines for the pkgsrc guide
D.1. Make targets
D.2. Procedure
List of Tables
1.1. Platforms supported by pkgsrc
11.1. Patching examples
23.1. PLIST handling for GNOME packages
Chapter 1. What is pkgsrc?
Table of Contents
1.1. Introduction
1.1.1. Why pkgsrc?
1.1.2. Supported platforms
1.2. Overview
1.3. Terminology
1.3.1. Roles involved in pkgsrc
1.4. Typography
1.1. Introduction
There is a lot of software freely available for Unix-based systems, which is
usually available in form of the source code. Before such software can be used,
it needs to be configured to the local system, compiled and installed, and this
is exactly what The NetBSD Packages Collection (pkgsrc) does. pkgsrc also has
some basic commands to handle binary packages, so that not every user has to
build the packages for himself, which is a time-costly task.
pkgsrc currently contains several thousand packages, including:
* www/apache24 - The Apache web server
* www/firefox - The Firefox web browser
* meta-pkgs/gnome - The GNOME Desktop Environment
* meta-pkgs/kde4 - The K Desktop Environment
? just to name a few.
pkgsrc has built-in support for handling varying dependencies, such as pthreads
and X11, and extended features such as IPv6 support on a range of platforms.
1.1.1. Why pkgsrc?
pkgsrc provides the following key features:
* Easy building of software from source as well as the creation and
installation of binary packages. The source and latest patches are
retrieved from a master or mirror download site, checksum verified, then
built on your system. Support for binary-only distributions is available
for both native platforms and NetBSD emulated platforms.
* All packages are installed in a consistent directory tree, including
binaries, libraries, man pages and other documentation.
* Tracking of package dependencies automatically, including when performing
updates, to ensure required packages are installed. The configuration files
of various packages are handled automatically during updates, so local
changes are preserved.
* Like NetBSD, pkgsrc is designed with portability in mind and consists of
highly portable code. This allows the greatest speed of development when
porting to a new platform. This portability also ensures that pkgsrc is
consistent across all platforms.
* The installation prefix, acceptable software licenses, international
encryption requirements and build-time options for a large number of
packages are all set in a simple, central configuration file.
* The entire source (not including the distribution files) is freely
available under a BSD license, so you may extend and adapt pkgsrc to your
needs. Support for local packages and patches is available right out of the
box, so you can configure it specifically for your environment.
The following principles are basic to pkgsrc:
* "It should only work if it's right." ? That means, if a package contains
bugs, it's better to find them and to complain about them rather than to
just install the package and hope that it works. There are numerous checks
in pkgsrc that try to find such bugs: Static analysis tools (pkgtools/
pkglint), build-time checks (portability of shell scripts), and
post-installation checks (installed files, references to shared libraries,
script interpreters).
* "If it works, it should work everywhere" ? Like NetBSD has been ported to
many hardware architectures, pkgsrc has been ported to many operating
systems. Care is taken that packages behave the same on all platforms.
1.1.2. Supported platforms
pkgsrc consists of both a source distribution and a binary distribution for
these operating systems. After retrieving the required source or binaries, you
can be up and running with pkgsrc in just minutes!
pkgsrc was derived from FreeBSD's ports system, and initially developed for
NetBSD only. Since then, pkgsrc has grown a lot, and now supports the following
platforms:
Table 1.1. Platforms supported by pkgsrc
+-----------------------------------------------------------------------------+
| Platform | Date Support | Notes |
| | Added | |
|--------------------------------------+---------------+----------------------|
|NetBSD | Aug 1997 | |
|--------------------------------------+---------------+----------------------|
|Solaris | Mar 1999 |README.Solaris |
|--------------------------------------+---------------+----------------------|
|Linux | Jun 1999 |README.Linux |
|--------------------------------------+---------------+----------------------|
|Darwin / Mac OS X / OS X / macOS | Oct 2001 |README.MacOSX |
|--------------------------------------+---------------+----------------------|
|FreeBSD | Nov 2002 |README.FreeBSD |
|--------------------------------------+---------------+----------------------|
|OpenBSD | Nov 2002 |README.OpenBSD |
|--------------------------------------+---------------+----------------------|
|IRIX | Dec 2002 |README.IRIX |
| | |README.IRIX5.3 |
|--------------------------------------+---------------+----------------------|
|BSD/OS | Dec 2003 | |
|--------------------------------------+---------------+----------------------|
|AIX | Dec 2003 |README.AIX |
|--------------------------------------+---------------+----------------------|
|Interix (Microsoft Windows Services | Mar 2004 |README.Interix |
|for Unix) | | |
|--------------------------------------+---------------+----------------------|
|DragonFlyBSD | Oct 2004 | |
|--------------------------------------+---------------+----------------------|
|OSF/1 | Nov 2004 |README.OSF1 |
|--------------------------------------+---------------+----------------------|
|HP-UX | Apr 2007 |README.HPUX |
|--------------------------------------+---------------+----------------------|
|Haiku | Sep 2010 |README.Haiku |
|--------------------------------------+---------------+----------------------|
|MirBSD | Jan 2011 | |
|--------------------------------------+---------------+----------------------|
|Minix3 | Nov 2011 |README.Minix3 |
|--------------------------------------+---------------+----------------------|
|Cygwin | Mar 2013 |README.Cygwin |
|--------------------------------------+---------------+----------------------|
|GNU/kFreeBSD | Jul 2013 |README.GNUkFreeBSD |
|--------------------------------------+---------------+----------------------|
|Bitrig | Jun 2014 |README.Bitrig |
+-----------------------------------------------------------------------------+
1.2. Overview
This document is divided into three parts. The first, The pkgsrc user's guide,
describes how one can use one of the packages in the Package Collection, either
by installing a precompiled binary package, or by building one's own copy using
the NetBSD package system. The second part, The pkgsrc developer's guide,
explains how to prepare a package so it can be easily built by other NetBSD
users without knowing about the package's building details. The third part, The
pkgsrc infrastructure internals is intended for those who want to understand
how pkgsrc is implemented.
This document is available in various formats: HTML, PDF, PS, TXT.
1.3. Terminology
There has been a lot of talk about "ports", "packages", etc. so far. Here is a
description of all the terminology used within this document.
Package
A set of files and building instructions that describe what's necessary to
build a certain piece of software using pkgsrc. Packages are traditionally
stored under /usr/pkgsrc.
The NetBSD package system
This is the former name of "pkgsrc". It is part of the NetBSD operating
system and can be bootstrapped to run on non-NetBSD operating systems as
well. It handles building (compiling), installing, and removing of
packages.
Distfile
This term describes the file or files that are provided by the author of
the piece of software to distribute his work. All the changes necessary to
build on NetBSD are reflected in the corresponding package. Usually the
distfile is in the form of a compressed tar-archive, but other types are
possible, too. Distfiles are usually stored below /usr/pkgsrc/distfiles.
Port
This is the term used by FreeBSD and OpenBSD people for what we call a
package. In NetBSD terminology, "port" refers to a different architecture.
Precompiled/binary package
A set of binaries built with pkgsrc from a distfile and stuffed together in
a single .tgz file so it can be installed on machines of the same machine
architecture without the need to recompile. Packages are usually generated
in /usr/pkgsrc/packages; there is also an archive on ftp.NetBSD.org.
Sometimes, this is referred to by the term "package" too, especially in the
context of precompiled packages.
Program
The piece of software to be installed which will be constructed from all
the files in the distfile by the actions defined in the corresponding
package.
1.3.1. Roles involved in pkgsrc
pkgsrc users
The pkgsrc users are people who use the packages provided by pkgsrc.
Typically they are system administrators. The people using the software
that is inside the packages (maybe called "end users") are not covered by
the pkgsrc guide.
There are two kinds of pkgsrc users: Some only want to install pre-built
binary packages. Others build the pkgsrc packages from source, either for
installing them directly or for building binary packages themselves. For
pkgsrc users Part I, "The pkgsrc user's guide" should provide all necessary
documentation.
package maintainers
A package maintainer creates packages as described in Part II, "The pkgsrc
developer's guide".
infrastructure developers
These people are involved in all those files that live in the mk/ directory
and below. Only these people should need to read through Part III, "The
pkgsrc infrastructure internals", though others might be curious, too.
1.4. Typography
When giving examples for commands, shell prompts are used to show if the
command should/can be issued as root, or if "normal" user privileges are
sufficient. We use a # for root's shell prompt, a % for users' shell prompt,
assuming they use the C-shell or tcsh and a $ for bourne shell and derivatives.
Part I. The pkgsrc user's guide
Table of Contents
2. Where to get pkgsrc and how to keep it up-to-date
2.1. Getting pkgsrc for the first time
2.1.1. As tar archive
2.1.2. Via anonymous CVS
2.2. Keeping pkgsrc up-to-date
2.2.1. Via tar files
2.2.2. Via CVS
3. Using pkgsrc on systems other than NetBSD
3.1. Binary distribution
3.2. Bootstrapping pkgsrc
4. Using pkgsrc
4.1. Using binary packages
4.1.1. Finding binary packages
4.1.2. Installing binary packages
4.1.3. Deinstalling packages
4.1.4. Getting information about installed packages
4.1.5. Checking for security vulnerabilities in installed packages
4.1.6. Finding if newer versions of your installed packages are in
pkgsrc
4.1.7. Other administrative functions
4.2. Building packages from source
4.2.1. Requirements
4.2.2. Fetching distfiles
4.2.3. How to build and install
5. Configuring pkgsrc
5.1. General configuration
5.2. Variables affecting the build process
5.3. Variables affecting the installation process
5.4. Selecting and configuring the compiler
5.4.1. Selecting the compiler
5.4.2. Additional flags to the compiler (CFLAGS)
5.4.3. Additional flags to the linker (LDFLAGS)
5.5. Developer/advanced settings
5.6. Selecting Build Options
6. Creating binary packages
6.1. Building a single binary package
6.2. Settings for creation of binary packages
7. Creating binary packages for everything in pkgsrc (bulk builds)
7.1. Preparations
7.2. Running a pbulk-style bulk build
7.2.1. Configuration
7.3. Requirements of a full bulk build
7.4. Creating a multiple CD-ROM packages collection
7.4.1. Example of cdpack
8. Directory layout of the installed files
8.1. File system layout in ${LOCALBASE}
8.2. File system layout in ${VARBASE}
9. Frequently Asked Questions
9.1. Are there any mailing lists for pkg-related discussion?
9.2. Utilities for package management (pkgtools)
9.3. How to use pkgsrc as non-root
9.4. How to resume transfers when fetching distfiles?
9.5. How can I install/use modular X.org from pkgsrc?
9.6. How to fetch files from behind a firewall
9.7. How to fetch files from HTTPS sites
9.8. How do I tell make fetch to do passive FTP?
9.9. How to fetch all distfiles at once
9.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
9.11. What does "Could not find bsd.own.mk" mean?
9.12. Using 'sudo' with pkgsrc
9.13. How do I change the location of configuration files?
9.14. Automated security checks
9.15. Why do some packages ignore my CFLAGS?
9.16. A package does not build. What shall I do?
9.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
conflicts" mean?
Chapter 2. Where to get pkgsrc and how to keep it up-to-date
Table of Contents
2.1. Getting pkgsrc for the first time
2.1.1. As tar archive
2.1.2. Via anonymous CVS
2.2. Keeping pkgsrc up-to-date
2.2.1. Via tar files
2.2.2. Via CVS
Before you download and extract the files, you need to decide where you want to
extract them. When using pkgsrc as root user, pkgsrc is usually installed in /
usr/pkgsrc. You are though free to install the sources and binary packages
wherever you want in your filesystem, provided that the pathname does not
contain white-space or other characters that are interpreted specially by the
shell and some other programs. A safe bet is to use only letters, digits,
underscores and dashes.
2.1. Getting pkgsrc for the first time
Before you download any pkgsrc files, you should decide whether you want the
current branch or the stable branch. The latter is forked on a quarterly basis
from the current branch and only gets modified for security updates. The names
of the stable branches are built from the year and the quarter, for example
2016Q4.
The second step is to decide how you want to download pkgsrc. You can get it as
a tar file or via CVS. Both ways are described here.
Note that tar archive contains CVS working copy. Thus you can switch to using
CVS at any later time.
2.1.1. As tar archive
The primary download location for all pkgsrc files is http://ftp.NetBSD.org/pub
/pkgsrc/ or ftp://ftp.NetBSD.org/pub/pkgsrc/ (it points to the same location).
There are a number of subdirectories for different purposes, which are
described in detail in Appendix C, Directory layout of the pkgsrc FTP server.
The tar archive for the current branch is in the directory current and is
called pkgsrc.tar.gz. It is autogenerated weekly.
To save download time we provide bzip2- and xz-compressed archives which are
published at pkgsrc.tar.bz2 and pkgsrc.tar.xz respectively.
You can fetch the same files using FTP.
The tar file for the stable branch 2016Q4 is in the directory pkgsrc-2016Q4 and
is also called pkgsrc.tar.gz.
To download a pkgsrc stable tarball, run:
$ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-20xxQy/pkgsrc.tar.gz
Where pkgsrc-20xxQy is the stable branch to be downloaded, for example, "
pkgsrc-2016Q4".
If you prefer, you can also fetch it using "wget", "curl", or your web browser.
Then, extract it with:
$ tar -xzf pkgsrc.tar.gz -C /usr
This will create the directory pkgsrc/ in /usr/ and all the package source will
be stored under /usr/pkgsrc/.
To download pkgsrc-current, run:
$ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz
2.1.2. Via anonymous CVS
To fetch a specific pkgsrc stable branch, run:
$ cd /usr && cvs -q -z2 -d [email protected]:/cvsroot checkout -r pkgsrc-20xxQy -P pkgsrc
Where pkgsrc-20xxQy is the stable branch to be checked out, for example, "
pkgsrc-2016Q4"
This will create the directory pkgsrc/ in your /usr/ directory and all the
package source will be stored under /usr/pkgsrc/.
To fetch the pkgsrc current branch, run:
$ cd /usr && cvs -q -z2 -d [email protected]:/cvsroot checkout -P pkgsrc
Refer to the list of available mirrors to choose a faster CVS mirror, if
needed.
If you get error messages from rsh, you need to set CVS_RSH variable. E.g.:
$ cd /usr && env CVS_RSH=ssh cvs -q -z2 -d [email protected]:/cvsroot checkout -P pkgsrc
Refer to documentation on your command shell how to set CVS_RSH=ssh
permanently. For Bourne shells, you can set it in your .profile or better
globally in /etc/profile:
# set CVS remote shell command
CVS_RSH=ssh
export CVS_RSH
By default, CVS doesn't do things like most people would expect it to do. But
there is a way to convince CVS, by creating a file called .cvsrc in your home
directory and saving the following lines to it. This file will save you lots of
headache and some bug reports, so we strongly recommend it. You can find an
explanation of this file in the CVS documentation.
# recommended CVS configuration file from the pkgsrc guide
cvs -q -z2
checkout -P
update -dP
diff -upN
rdiff -u
release -d
2.2. Keeping pkgsrc up-to-date
The preferred way to keep pkgsrc up-to-date is via CVS (which also works if you
have first installed it via a tar file). It saves bandwidth and hard disk
activity, compared to downloading the tar file again.
2.2.1. Via tar files
Warning
When updating from a tar file, you first need to completely remove the old
pkgsrc directory. Otherwise those files that have been removed from pkgsrc in
the mean time will not be removed on your local disk, resulting in
inconsistencies. When removing the old files, any changes that you have done to
the pkgsrc files will be lost after updating. Therefore updating via CVS is
strongly recommended.
Note that by default the distfiles and the binary packages are saved in the
pkgsrc tree, so don't forget to rescue them before updating. You can also
configure pkgsrc to store distfiles and packages in directories outside the
pkgsrc tree by setting the DISTDIR and PACKAGES variables. See Chapter 5,
Configuring pkgsrc for the details.
To update pkgsrc from a tar file, download the tar file as explained above.
Then, make sure that you have not made any changes to the files in the pkgsrc
directory. Remove the pkgsrc directory and extract the new tar file. Done.
2.2.2. Via CVS
To update pkgsrc via CVS, change to the pkgsrc directory and run cvs:
$ cd /usr/pkgsrc && cvs update -dP
If you get error messages from rsh, you need to set CVS_RSH variable as
described above. E.g.:
$ cd /usr/pkgsrc && env CVS_RSH=ssh cvs up -dP
2.2.2.1. Switching between different pkgsrc branches
When updating pkgsrc, the CVS program keeps track of the branch you selected.
But if you, for whatever reason, want to switch from the stable branch to the
current one, you can do it by adding the option "-A" after the "update"
keyword. To switch from the current branch back to the stable branch, add the "
-rpkgsrc-2016Q4" option.
2.2.2.2. What happens to my changes when updating?
When you update pkgsrc, the CVS program will only touch those files that are
registered in the CVS repository. That means that any packages that you created
on your own will stay unmodified. If you change files that are managed by CVS,
later updates will try to merge your changes with those that have been done by
others. See the CVS manual, chapter "update" for details.
Chapter 3. Using pkgsrc on systems other than NetBSD
Table of Contents
3.1. Binary distribution
3.2. Bootstrapping pkgsrc
3.1. Binary distribution
See Section 4.1, "Using binary packages".
3.2. Bootstrapping pkgsrc
pkgsrc can be bootstrapped for use in two different modes: privileged and
unprivileged one. In unprivileged mode in contrast to privileged one all
programs are installed under one particular user and cannot utilise privileged
operations (packages don't create special users and all special file
permissions like setuid are ignored).
Installing the bootstrap kit from source should be as simple as:
# env CVS_RSH=ssh cvs -d [email protected]:/cvsroot checkout -P pkgsrc
# cd pkgsrc/bootstrap
# ./bootstrap
To bootstrap in unprivileged mode pass "--unprivileged" flag to bootstrap
By default, in privileged mode pkgsrc uses /usr/pkg for prefix where programs
will be installed in, and /usr/pkg/pkgdb for the package database directory
where pkgsrc will do its internal bookkeeping, /var is used as varbase, where
packages install their persistent data. In unprivileged mode pkgsrc uses ~/pkg
for prefix, ~/pkg/pkgdb for the package database, and ~/pkg/var for varbase.
You can change default layout using command-line arguments. Run "./bootstrap
--help" to get details.
Note
The bootstrap installs a bmake tool. Use this bmake when building via pkgsrc.
For examples in this guide, use bmake instead of "make".
Note
It is possible to bootstrap multiple instances of pkgsrc using non-intersecting
directories. Use bmake corresponding to the installation you're working with to
build and install packages.
Chapter 4. Using pkgsrc
Table of Contents
4.1. Using binary packages
4.1.1. Finding binary packages