Annotation of htdocs/docs/pkgsrc/pkgsrc.txt, revision 1.260
1.1 dsieger 1: The pkgsrc guide
2:
3: Documentation on the NetBSD packages system
4:
5: Alistair Crooks
6:
7: <agc@NetBSD.org>
8:
9: Hubert Feyrer
10:
11: <hubertf@NetBSD.org>
12:
13: The pkgsrc Developers
14:
1.259 leot 15: Copyright 1994-2025 The NetBSD Foundation, Inc
1.1 dsieger 16:
1.259 leot 17: $NetBSD: pkgsrc.xml,v 1.44 2025/01/01 01:39:11 jnemeth Exp $
1.1 dsieger 18:
19: Abstract
20:
21: pkgsrc is a centralized package management system for Unix-like operating
22: systems. This guide provides information for users and developers of pkgsrc. It
23: covers installation of binary and source packages, creation of binary and
24: source packages and a high-level overview about the infrastructure.
25:
26: -------------------------------------------------------------------------------
27:
28: Table of Contents
29:
30: 1. What is pkgsrc?
31: 1.1. Introduction
32: 1.1.1. Why pkgsrc?
33: 1.1.2. Supported platforms
34: 1.2. Overview
35: 1.3. Terminology
36: 1.3.1. Roles involved in pkgsrc
37: 1.4. Typography
38: I. The pkgsrc user's guide
1.154 rillig 39: 2. Getting help
40: 3. Where to get pkgsrc and how to keep it up-to-date
41: 3.1. Getting pkgsrc for the first time
42: 3.1.1. As tar archive
43: 3.1.2. Via anonymous CVS
44: 3.2. Keeping pkgsrc up-to-date
45: 3.2.1. Via tar files
46: 3.2.2. Via CVS
47: 4. Using pkgsrc on systems other than NetBSD
48: 4.1. Binary distribution
49: 4.2. Bootstrapping pkgsrc
50: 5. Using pkgsrc
51: 5.1. Using binary packages
52: 5.1.1. Finding binary packages
53: 5.1.2. Installing binary packages
1.202 nia 54: 5.1.3. Updating packages
55: 5.1.4. Deinstalling packages
56: 5.1.5. Getting information about installed packages
57: 5.1.6. Checking for security vulnerabilities in installed packages
58: 5.1.7. Finding if newer versions of your installed packages are in
1.259 leot 59: pkgsrc
1.202 nia 60: 5.1.8. Other administrative functions
1.154 rillig 61: 5.2. Building packages from source
62: 5.2.1. Requirements
63: 5.2.2. Fetching distfiles
64: 5.2.3. How to build and install
65: 6. Configuring pkgsrc
66: 6.1. General configuration
67: 6.2. Variables affecting the build process
1.241 rillig 68: 6.3. Preferences for native or pkgsrc software
69: 6.4. Variables affecting the installation process
70: 6.5. Selecting and configuring the compiler
71: 6.5.1. Selecting the compiler
72: 6.5.2. Additional flags to the compiler (CFLAGS)
73: 6.5.3. Additional flags to the linker (LDFLAGS)
74: 6.6. Developer/advanced settings
75: 6.7. Selecting Build Options
1.154 rillig 76: 7. Creating binary packages
77: 7.1. Building a single binary package
78: 7.2. Settings for creation of binary packages
79: 8. Creating binary packages for everything in pkgsrc (bulk builds)
80: 8.1. Preparations
1.180 rillig 81: 8.2. Running a bulk build
1.154 rillig 82: 8.2.1. Configuration
83: 8.3. Requirements of a full bulk build
1.178 rillig 84: 8.4. Bulk build variants
1.179 rillig 85: 8.4.1. Detect unknown configure options
86: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 87: 8.4.3. Force compiler options only in the build phase
88: 8.4.4. Use custom directories
89: 8.4.5. Turn warnings into errors
90: 8.4.6. Reject packages for which pkglint reports errors
91: 8.4.7. Reject packages that contain forbidden strings
92: 8.4.8. Reject packages whose self-test fails
93: 8.4.9. Reject packages that use undefined shell variables
94: 8.4.10. Turn off verbose logging
1.178 rillig 95: 8.5. Creating a multiple CD-ROM packages collection
96: 8.5.1. Example of cdpack
1.154 rillig 97: 9. Directory layout of the installed files
98: 9.1. File system layout in ${LOCALBASE}
99: 9.2. File system layout in ${VARBASE}
100: 10. Frequently Asked Questions
101: 10.1. Are there any mailing lists for pkg-related discussion?
102: 10.2. Utilities for package management (pkgtools)
103: 10.3. How to use pkgsrc as non-root
104: 10.4. How to resume transfers when fetching distfiles?
105: 10.5. How can I install/use modular X.org from pkgsrc?
106: 10.6. How to fetch files from behind a firewall
107: 10.7. How to fetch files from HTTPS sites
108: 10.8. How do I tell make fetch to do passive FTP?
109: 10.9. How to fetch all distfiles at once
110: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc"
1.259 leot 111: mean?
1.154 rillig 112: 10.11. What does "Could not find bsd.own.mk" mean?
1.221 nia 113: 10.12. Using 'sudo' or `priv` with pkgsrc
1.154 rillig 114: 10.13. How do I change the location of configuration files?
115: 10.14. Automated security checks
116: 10.15. Why do some packages ignore my CFLAGS?
117: 10.16. A package does not build. What shall I do?
118: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/???
1.259 leot 119: merge conflicts" mean?
1.1 dsieger 120: II. The pkgsrc developer's guide
1.154 rillig 121: 11. Getting help
1.184 rillig 122: 12. Package components - files, directories and contents
123: 12.1. Makefile
124: 12.2. distinfo
125: 12.3. patches/*
126: 12.3.1. Structure of a single patch file
127: 12.3.2. Creating patch files
128: 12.3.3. Sources where the patch files come from
129: 12.3.4. Patching guidelines
130: 12.3.5. Feedback to the author
131: 12.4. Other mandatory files
132: 12.5. Optional files
133: 12.5.1. Files affecting the binary package
134: 12.5.2. Files affecting the build process
135: 12.5.3. Files affecting nothing at all
136: 12.6. work*
137: 12.7. files/*
138: 13. The build process
139: 13.1. Introduction
140: 13.2. Program location
141: 13.3. Directories used during the build process
142: 13.4. Running a phase
143: 13.5. The fetch phase
144: 13.5.1. What to fetch and where to get it from
145: 13.5.2. How are the files fetched?
146: 13.6. The checksum phase
147: 13.7. The extract phase
148: 13.8. The patch phase
149: 13.9. The tools phase
150: 13.10. The wrapper phase
151: 13.11. The configure phase
152: 13.12. The build phase
153: 13.13. The test phase
154: 13.14. The install phase
155: 13.15. The package phase
156: 13.16. Cleaning up
157: 13.17. Other helpful targets
158: 14. Creating a new pkgsrc package from scratch
159: 14.1. Common types of packages
1.219 nia 160: 14.1.1. Python modules and programs
161: 14.1.2. R packages
162: 14.1.3. TeXlive packages
1.184 rillig 163: 14.2. Examples
164: 14.2.1. How the www/nvu package came into pkgsrc
165: 15. Programming in Makefiles
166: 15.1. Caveats
167: 15.2. Makefile variables
168: 15.2.1. Naming conventions
169: 15.3. Code snippets
170: 15.3.1. Adding things to a list
171: 15.3.2. Echoing a string exactly as-is
172: 15.3.3. Passing CFLAGS to GNU configure scripts
173: 15.3.4. Handling possibly empty variables
1.229 gutterid 174: 15.3.5. Testing yes/no variables in conditions
1.184 rillig 175: 16. Options handling
176: 16.1. Global default options
177: 16.2. Converting packages to use bsd.options.mk
178: 16.3. Option Names
179: 16.4. Determining the options of dependencies
180: 17. Tools needed for building or running
181: 17.1. Tools for pkgsrc builds
182: 17.2. Tools needed by packages
183: 17.3. Tools provided by platforms
184: 18. Buildlink methodology
185: 18.1. Converting packages to use buildlink3
186: 18.2. Writing buildlink3.mk files
187: 18.2.1. Anatomy of a buildlink3.mk file
188: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and
1.259 leot 189: BUILDLINK_ABI_DEPENDS.pkg in buildlink3.mk files
1.184 rillig 190: 18.3. Writing builtin.mk files
191: 18.3.1. Anatomy of a builtin.mk file
192: 19. PLIST issues
193: 19.1. RCS ID
194: 19.2. Semi-automatic PLIST generation
195: 19.3. Tweaking output of make print-PLIST
196: 19.4. Variable substitution in PLIST
197: 19.5. Man page compression
198: 19.6. Changing PLIST source with PLIST_SRC
199: 19.7. Platform-specific and differing PLISTs
200: 19.8. Build-specific PLISTs
201: 19.9. Sharing directories between packages
202: 20. The pkginstall framework
203: 20.1. Files and directories outside the installation prefix
204: 20.1.1. Directory manipulation
205: 20.1.2. File manipulation
206: 20.2. Configuration files
207: 20.2.1. How PKG_SYSCONFDIR is set
208: 20.2.2. Telling the software where configuration files are
1.239 dholland 209: 20.2.3. Patching installation
210: 20.2.4. Declaring configuration files
211: 20.2.5. Disabling handling of configuration files
1.184 rillig 212: 20.3. System startup scripts
213: 20.3.1. Disabling handling of system startup scripts
214: 20.4. System users and groups
215: 20.5. System shells
216: 20.5.1. Disabling shell registration
217: 20.6. Fonts
218: 20.6.1. Disabling automatic update of the fonts databases
1.154 rillig 219: 21. Making your package work
220: 21.1. General operation
221: 21.1.1. How to pull in user-settable variables from mk.conf
222: 21.1.2. User interaction
223: 21.1.3. Handling licenses
224: 21.1.4. Restricted packages
225: 21.1.5. Handling dependencies
226: 21.1.6. Handling conflicts with other packages
227: 21.1.7. Packages that cannot or should not be built
228: 21.1.8. Packages which should not be deleted, once installed
229: 21.1.9. Handling packages with security problems
230: 21.1.10. How to handle incrementing versions when fixing an
1.259 leot 231: existing package
1.154 rillig 232: 21.1.11. Substituting variable text in the package files (the SUBST
1.259 leot 233: framework)
1.154 rillig 234: 21.2. The fetch phase
235: 21.2.1. Packages whose distfiles aren't available for plain
1.259 leot 236: downloading
1.154 rillig 237: 21.2.2. How to handle modified distfiles with the 'old' name
238: 21.2.3. Packages hosted on github.com
239: 21.3. The configure phase
240: 21.3.1. Shared libraries - libtool
241: 21.3.2. Using libtool on GNU packages that already support libtool
242: 21.3.3. GNU Autoconf/Automake
1.223 nia 243: 21.3.4. Meson / ninja
1.260 ! wiz 244: 21.3.5. Determining the endianness
1.154 rillig 245: 21.4. Programming languages
246: 21.4.1. C, C++, and Fortran
247: 21.4.2. Java
1.205 wiz 248: 21.4.3. Go
1.223 nia 249: 21.4.4. Rust
250: 21.4.5. Packages containing Perl scripts
251: 21.4.6. Packages containing shell scripts
252: 21.4.7. Other programming languages
1.154 rillig 253: 21.5. The build phase
254: 21.5.1. Compiling C and C++ code conditionally
255: 21.5.2. How to handle compiler bugs
1.172 rillig 256: 21.5.3. No such file or directory
257: 21.5.4. Undefined reference to "..."
258: 21.5.5. Running out of memory
1.154 rillig 259: 21.6. The install phase
260: 21.6.1. Creating needed directories
261: 21.6.2. Where to install documentation
262: 21.6.3. Installing highscore files
263: 21.6.4. Adding DESTDIR support to packages
264: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 265: 21.6.6. Packages installing Perl modules
1.254 wiz 266: 21.6.7. Packages installing pkg-config files
267: 21.6.8. Packages installing info files
268: 21.6.9. Packages installing man pages
269: 21.6.10. Packages installing X11 fonts
270: 21.6.11. Packages installing SGML or XML data
271: 21.6.12. Packages installing extensions to the MIME database
272: 21.6.13. Packages using intltool
273: 21.6.14. Packages installing startup scripts
274: 21.6.15. Packages installing TeX modules
275: 21.6.16. Packages supporting running binaries in emulation
276: 21.6.17. Packages installing hicolor icons
277: 21.6.18. Packages installing desktop files
1.154 rillig 278: 21.7. Marking packages as having problems
1.184 rillig 279: 22. GNOME packaging and porting
280: 22.1. Meta packages
281: 22.2. Packaging a GNOME application
282: 22.3. Updating GNOME to a newer version
283: 22.4. Patching guidelines
1.154 rillig 284: 23. Submitting and Committing
285: 23.1. Submitting binary packages
286: 23.2. Submitting source packages (for non-NetBSD-developers)
287: 23.3. General notes when adding, updating, or removing packages
288: 23.4. Commit Messages
289: 23.5. Committing: Adding a package to CVS
290: 23.6. Updating a package to a newer version
291: 23.7. Renaming a package in pkgsrc
292: 23.8. Moving a package in pkgsrc
293: 24. Frequently Asked Questions
1.1 dsieger 294: III. The pkgsrc infrastructure internals
1.184 rillig 295: 25. Design of the pkgsrc infrastructure
296: 25.1. The meaning of variable definitions
297: 25.2. Avoiding problems before they arise
298: 25.3. Variable evaluation
299: 25.3.1. At load time
300: 25.3.2. At runtime
301: 25.4. How can variables be specified?
302: 25.5. Designing interfaces for Makefile fragments
303: 25.5.1. Procedures with parameters
304: 25.5.2. Actions taken on behalf of parameters
305: 25.6. The order in which files are loaded
306: 25.6.1. The order in bsd.prefs.mk
307: 25.6.2. The order in bsd.pkg.mk
308: 26. Regression tests
309: 26.1. Running the regression tests
310: 26.2. Adding a new regression test
311: 26.2.1. Overridable functions
312: 26.2.2. Helper functions
313: 27. Porting pkgsrc
314: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 315: A. A simple example package: bison
316: A.1. files
317: A.1.1. Makefile
318: A.1.2. DESCR
319: A.1.3. PLIST
320: A.1.4. Checking a package with pkglint
321: A.2. Steps for building, installing, packaging
1.207 leot 322: B. Security hardening
323: B.1. Mechanisms
324: B.1.1. Enabled by default
325: B.1.2. Not enabled by default
326: B.2. Caveats
327: B.2.1. Problems with PKGSRC_MKPIE
328: B.2.2. Problems with PKGSRC_USE_FORTIFY
329: B.2.3. Problems with PKGSRC_USE_RELRO
330: B.2.4. Problems with PKGSRC_USE_SSP
331: B.3. Auditing the system
332: B.3.1. Checking for PIE
333: B.3.2. Checking for partial RELRO
334: B.3.3. Checking for full RELRO
335: B.3.4. Checking for SSP
336: C. Build logs
337: C.1. Building figlet
338: C.2. Packaging figlet
339: D. Directory layout of the pkgsrc FTP server
340: D.1. distfiles: The distributed source files
341: D.2. misc: Miscellaneous things
342: D.3. packages: Binary packages
343: D.4. reports: Bulk build reports
344: D.5. current, stable, pkgsrc-20xxQy: source packages
345: E. Help topics
346: F. Editing guidelines for the pkgsrc guide
347: F.1. Make targets
348: F.2. Procedure
1.1 dsieger 349:
350: List of Tables
351:
352: 1.1. Platforms supported by pkgsrc
1.184 rillig 353: 12.1. Patching examples
354: 22.1. PLIST handling for GNOME packages
1.1 dsieger 355:
356: Chapter 1. What is pkgsrc?
357:
358: Table of Contents
359:
360: 1.1. Introduction
361: 1.1.1. Why pkgsrc?
362: 1.1.2. Supported platforms
363: 1.2. Overview
364: 1.3. Terminology
365: 1.3.1. Roles involved in pkgsrc
366: 1.4. Typography
367:
368: 1.1. Introduction
369:
370: There is a lot of software freely available for Unix-based systems, which is
371: usually available in form of the source code. Before such software can be used,
372: it needs to be configured to the local system, compiled and installed, and this
373: is exactly what The NetBSD Packages Collection (pkgsrc) does. pkgsrc also has
374: some basic commands to handle binary packages, so that not every user has to
375: build the packages for himself, which is a time-costly task.
376:
377: pkgsrc currently contains several thousand packages, including:
378:
1.104 sevan 379: * www/apache24 - The Apache web server
1.1 dsieger 380:
381: * www/firefox - The Firefox web browser
382:
383: * meta-pkgs/gnome - The GNOME Desktop Environment
384:
1.102 ryoon 385: * meta-pkgs/kde4 - The K Desktop Environment
1.1 dsieger 386:
1.108 rillig 387: ? just to name a few.
1.1 dsieger 388:
389: pkgsrc has built-in support for handling varying dependencies, such as pthreads
390: and X11, and extended features such as IPv6 support on a range of platforms.
391:
392: 1.1.1. Why pkgsrc?
393:
394: pkgsrc provides the following key features:
395:
396: * Easy building of software from source as well as the creation and
397: installation of binary packages. The source and latest patches are
398: retrieved from a master or mirror download site, checksum verified, then
399: built on your system. Support for binary-only distributions is available
400: for both native platforms and NetBSD emulated platforms.
401:
402: * All packages are installed in a consistent directory tree, including
403: binaries, libraries, man pages and other documentation.
404:
1.104 sevan 405: * Tracking of package dependencies automatically, including when performing
406: updates, to ensure required packages are installed. The configuration files
407: of various packages are handled automatically during updates, so local
408: changes are preserved.
1.1 dsieger 409:
410: * Like NetBSD, pkgsrc is designed with portability in mind and consists of
411: highly portable code. This allows the greatest speed of development when
1.26 spz 412: porting to a new platform. This portability also ensures that pkgsrc is
1.1 dsieger 413: consistent across all platforms.
414:
415: * The installation prefix, acceptable software licenses, international
416: encryption requirements and build-time options for a large number of
417: packages are all set in a simple, central configuration file.
418:
419: * The entire source (not including the distribution files) is freely
420: available under a BSD license, so you may extend and adapt pkgsrc to your
421: needs. Support for local packages and patches is available right out of the
422: box, so you can configure it specifically for your environment.
423:
424: The following principles are basic to pkgsrc:
425:
1.198 leot 426: * "It should only work if it's right." -- That means, if a package contains
1.1 dsieger 427: bugs, it's better to find them and to complain about them rather than to
428: just install the package and hope that it works. There are numerous checks
1.175 gutterid 429: in pkgsrc that try to find such bugs: static analysis tools (pkgtools/
1.1 dsieger 430: pkglint), build-time checks (portability of shell scripts), and
431: post-installation checks (installed files, references to shared libraries,
432: script interpreters).
433:
1.198 leot 434: * "If it works, it should work everywhere" -- Like NetBSD has been ported to
1.1 dsieger 435: many hardware architectures, pkgsrc has been ported to many operating
436: systems. Care is taken that packages behave the same on all platforms.
437:
438: 1.1.2. Supported platforms
439:
440: pkgsrc consists of both a source distribution and a binary distribution for
441: these operating systems. After retrieving the required source or binaries, you
442: can be up and running with pkgsrc in just minutes!
443:
444: pkgsrc was derived from FreeBSD's ports system, and initially developed for
445: NetBSD only. Since then, pkgsrc has grown a lot, and now supports the following
446: platforms:
447:
448: Table 1.1. Platforms supported by pkgsrc
449:
1.92 sevan 450: +-----------------------------------------------------------------------------+
1.229 gutterid 451: | Platform | Date Support | Notes |
452: | | Added | |
453: |-------------------------------------+---------------+-----------------------|
454: |NetBSD | Aug 1997 | |
455: |-------------------------------------+---------------+-----------------------|
456: |Solaris | Mar 1999 |README.Solaris |
457: |-------------------------------------+---------------+-----------------------|
458: |Linux | Jun 1999 |README.Linux |
459: |-------------------------------------+---------------+-----------------------|
460: |Darwin / Mac OS X / OS X / macOS | Oct 2001 |README.macOS |
461: |-------------------------------------+---------------+-----------------------|
462: |FreeBSD | Nov 2002 |README.FreeBSD |
463: |-------------------------------------+---------------+-----------------------|
464: |OpenBSD | Nov 2002 |README.OpenBSD |
465: |-------------------------------------+---------------+-----------------------|
466: |IRIX | Dec 2002 |README.IRIX |
467: |-------------------------------------+---------------+-----------------------|
468: |BSD/OS | Dec 2003 | |
469: |-------------------------------------+---------------+-----------------------|
470: |AIX | Dec 2003 |README.AIX |
471: |-------------------------------------+---------------+-----------------------|
472: |Interix (Microsoft Windows Services | Mar 2004 |README.Interix |
473: |for Unix) | | |
474: |-------------------------------------+---------------+-----------------------|
475: |DragonFlyBSD | Oct 2004 | |
476: |-------------------------------------+---------------+-----------------------|
477: |OSF/1 | Nov 2004 |README.OSF1 |
478: |-------------------------------------+---------------+-----------------------|
479: |HP-UX | Apr 2007 |README.HPUX |
480: |-------------------------------------+---------------+-----------------------|
481: |Haiku | Sep 2010 |README.Haiku |
482: |-------------------------------------+---------------+-----------------------|
483: |MirBSD | Jan 2011 | |
484: |-------------------------------------+---------------+-----------------------|
485: |Minix3 | Nov 2011 |README.Minix3 |
486: |-------------------------------------+---------------+-----------------------|
487: |Cygwin | Mar 2013 |README.Cygwin |
488: |-------------------------------------+---------------+-----------------------|
489: |GNU/kFreeBSD | Jul 2013 |README.GNUkFreeBSD |
490: |-------------------------------------+---------------+-----------------------|
491: |Bitrig | Jun 2014 |Removed from pkgsrc Sep|
492: | | |2022 |
1.92 sevan 493: +-----------------------------------------------------------------------------+
1.1 dsieger 494:
495:
496: 1.2. Overview
497:
498: This document is divided into three parts. The first, The pkgsrc user's guide,
499: describes how one can use one of the packages in the Package Collection, either
500: by installing a precompiled binary package, or by building one's own copy using
501: the NetBSD package system. The second part, The pkgsrc developer's guide,
502: explains how to prepare a package so it can be easily built by other NetBSD
503: users without knowing about the package's building details. The third part, The
504: pkgsrc infrastructure internals is intended for those who want to understand
505: how pkgsrc is implemented.
506:
507: This document is available in various formats: HTML, PDF, PS, TXT.
508:
509: 1.3. Terminology
510:
511: There has been a lot of talk about "ports", "packages", etc. so far. Here is a
512: description of all the terminology used within this document.
513:
514: Package
515:
516: A set of files and building instructions that describe what's necessary to
517: build a certain piece of software using pkgsrc. Packages are traditionally
1.123 wiz 518: stored under /usr/pkgsrc, but may be stored in any location, referred to as
519: PKGSRCDIR.
1.1 dsieger 520:
521: The NetBSD package system
522:
523: This is the former name of "pkgsrc". It is part of the NetBSD operating
524: system and can be bootstrapped to run on non-NetBSD operating systems as
525: well. It handles building (compiling), installing, and removing of
526: packages.
527:
528: Distfile
529:
530: This term describes the file or files that are provided by the author of
531: the piece of software to distribute his work. All the changes necessary to
532: build on NetBSD are reflected in the corresponding package. Usually the
533: distfile is in the form of a compressed tar-archive, but other types are
534: possible, too. Distfiles are usually stored below /usr/pkgsrc/distfiles.
535:
536: Port
537:
538: This is the term used by FreeBSD and OpenBSD people for what we call a
539: package. In NetBSD terminology, "port" refers to a different architecture.
540:
541: Precompiled/binary package
542:
543: A set of binaries built with pkgsrc from a distfile and stuffed together in
544: a single .tgz file so it can be installed on machines of the same machine
545: architecture without the need to recompile. Packages are usually generated
546: in /usr/pkgsrc/packages; there is also an archive on ftp.NetBSD.org.
547:
548: Sometimes, this is referred to by the term "package" too, especially in the
549: context of precompiled packages.
550:
551: Program
552:
553: The piece of software to be installed which will be constructed from all
554: the files in the distfile by the actions defined in the corresponding
555: package.
556:
557: 1.3.1. Roles involved in pkgsrc
558:
559: pkgsrc users
560:
561: The pkgsrc users are people who use the packages provided by pkgsrc.
562: Typically they are system administrators. The people using the software
563: that is inside the packages (maybe called "end users") are not covered by
564: the pkgsrc guide.
565:
566: There are two kinds of pkgsrc users: Some only want to install pre-built
567: binary packages. Others build the pkgsrc packages from source, either for
568: installing them directly or for building binary packages themselves. For
569: pkgsrc users Part I, "The pkgsrc user's guide" should provide all necessary
570: documentation.
571:
572: package maintainers
573:
574: A package maintainer creates packages as described in Part II, "The pkgsrc
575: developer's guide".
576:
577: infrastructure developers
578:
579: These people are involved in all those files that live in the mk/ directory
580: and below. Only these people should need to read through Part III, "The
581: pkgsrc infrastructure internals", though others might be curious, too.
582:
583: 1.4. Typography
584:
585: When giving examples for commands, shell prompts are used to show if the
586: command should/can be issued as root, or if "normal" user privileges are
1.115 sevan 587: sufficient. We use a # for root's shell prompt, a % for users' shell prompt,
1.229 gutterid 588: assuming they use the C-shell or tcsh and a $ for Bourne shell and derivatives.
1.1 dsieger 589:
590: Part I. The pkgsrc user's guide
591:
592: Table of Contents
593:
1.154 rillig 594: 2. Getting help
595: 3. Where to get pkgsrc and how to keep it up-to-date
596: 3.1. Getting pkgsrc for the first time
597: 3.1.1. As tar archive
598: 3.1.2. Via anonymous CVS
599: 3.2. Keeping pkgsrc up-to-date
600: 3.2.1. Via tar files
601: 3.2.2. Via CVS
602: 4. Using pkgsrc on systems other than NetBSD
603: 4.1. Binary distribution
604: 4.2. Bootstrapping pkgsrc
605: 5. Using pkgsrc
606: 5.1. Using binary packages
607: 5.1.1. Finding binary packages
608: 5.1.2. Installing binary packages
1.202 nia 609: 5.1.3. Updating packages
610: 5.1.4. Deinstalling packages
611: 5.1.5. Getting information about installed packages
612: 5.1.6. Checking for security vulnerabilities in installed packages
613: 5.1.7. Finding if newer versions of your installed packages are in
1.259 leot 614: pkgsrc
1.202 nia 615: 5.1.8. Other administrative functions
1.154 rillig 616: 5.2. Building packages from source
617: 5.2.1. Requirements
618: 5.2.2. Fetching distfiles
619: 5.2.3. How to build and install
620: 6. Configuring pkgsrc
621: 6.1. General configuration
622: 6.2. Variables affecting the build process
1.241 rillig 623: 6.3. Preferences for native or pkgsrc software
624: 6.4. Variables affecting the installation process
625: 6.5. Selecting and configuring the compiler
626: 6.5.1. Selecting the compiler
627: 6.5.2. Additional flags to the compiler (CFLAGS)
628: 6.5.3. Additional flags to the linker (LDFLAGS)
629: 6.6. Developer/advanced settings
630: 6.7. Selecting Build Options
1.154 rillig 631: 7. Creating binary packages
632: 7.1. Building a single binary package
633: 7.2. Settings for creation of binary packages
634: 8. Creating binary packages for everything in pkgsrc (bulk builds)
635: 8.1. Preparations
1.180 rillig 636: 8.2. Running a bulk build
1.154 rillig 637: 8.2.1. Configuration
638: 8.3. Requirements of a full bulk build
1.178 rillig 639: 8.4. Bulk build variants
1.179 rillig 640: 8.4.1. Detect unknown configure options
641: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 642: 8.4.3. Force compiler options only in the build phase
643: 8.4.4. Use custom directories
644: 8.4.5. Turn warnings into errors
645: 8.4.6. Reject packages for which pkglint reports errors
646: 8.4.7. Reject packages that contain forbidden strings
647: 8.4.8. Reject packages whose self-test fails
648: 8.4.9. Reject packages that use undefined shell variables
649: 8.4.10. Turn off verbose logging
1.178 rillig 650: 8.5. Creating a multiple CD-ROM packages collection
651: 8.5.1. Example of cdpack
1.154 rillig 652: 9. Directory layout of the installed files
653: 9.1. File system layout in ${LOCALBASE}
654: 9.2. File system layout in ${VARBASE}
655: 10. Frequently Asked Questions
656: 10.1. Are there any mailing lists for pkg-related discussion?
657: 10.2. Utilities for package management (pkgtools)
658: 10.3. How to use pkgsrc as non-root
659: 10.4. How to resume transfers when fetching distfiles?
660: 10.5. How can I install/use modular X.org from pkgsrc?
661: 10.6. How to fetch files from behind a firewall
662: 10.7. How to fetch files from HTTPS sites
663: 10.8. How do I tell make fetch to do passive FTP?
664: 10.9. How to fetch all distfiles at once
665: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
666: 10.11. What does "Could not find bsd.own.mk" mean?
1.221 nia 667: 10.12. Using 'sudo' or `priv` with pkgsrc
1.154 rillig 668: 10.13. How do I change the location of configuration files?
669: 10.14. Automated security checks
670: 10.15. Why do some packages ignore my CFLAGS?
671: 10.16. A package does not build. What shall I do?
672: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.259 leot 673: conflicts" mean?
1.1 dsieger 674:
1.154 rillig 675: Chapter 2. Getting help
676:
677: To get help when using pkgsrc, the definitive source is this document, the
678: pkgsrc guide. If you don't find anything here, there are alternatives:
679:
680: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
681: Run bmake help topic=? to get help for any topic, such as a variable name
682: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
683: like strcasecmp or any other topic.
684:
1.207 leot 685: The available help topics are listed in Appendix E, Help topics.
1.154 rillig 686:
1.163 rillig 687: * To see the value of a single variable, run bmake show-var VARNAME=X.
688:
689: * To see the values of the most common variables, run bmake show-all. These
690: variables are grouped by topic. To see the variables for a single topic,
691: run bmake show-all-topic, for example bmake show-all-fetch.
692:
1.154 rillig 693: * The pkgsrc-users mailing list, to which you can subscribe and then ask your
694: questions.
695:
696: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
697: a specialized chat program such as XChat. Pick any user name and join the
698: channel #pkgsrc.
699:
700: Chapter 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 701:
702: Table of Contents
703:
1.154 rillig 704: 3.1. Getting pkgsrc for the first time
705: 3.1.1. As tar archive
706: 3.1.2. Via anonymous CVS
707: 3.2. Keeping pkgsrc up-to-date
708: 3.2.1. Via tar files
709: 3.2.2. Via CVS
1.1 dsieger 710:
711: Before you download and extract the files, you need to decide where you want to
712: extract them. When using pkgsrc as root user, pkgsrc is usually installed in /
713: usr/pkgsrc. You are though free to install the sources and binary packages
714: wherever you want in your filesystem, provided that the pathname does not
715: contain white-space or other characters that are interpreted specially by the
716: shell and some other programs. A safe bet is to use only letters, digits,
717: underscores and dashes.
718:
1.154 rillig 719: 3.1. Getting pkgsrc for the first time
1.1 dsieger 720:
1.25 wiz 721: Before you download any pkgsrc files, you should decide whether you want the
1.1 dsieger 722: current branch or the stable branch. The latter is forked on a quarterly basis
723: from the current branch and only gets modified for security updates. The names
724: of the stable branches are built from the year and the quarter, for example
1.259 leot 725: 2024Q4.
1.1 dsieger 726:
727: The second step is to decide how you want to download pkgsrc. You can get it as
1.24 wiz 728: a tar file or via CVS. Both ways are described here.
1.1 dsieger 729:
1.52 asau 730: Note that tar archive contains CVS working copy. Thus you can switch to using
731: CVS at any later time.
1.1 dsieger 732:
1.154 rillig 733: 3.1.1. As tar archive
1.52 asau 734:
1.151 sevan 735: The primary download location for all pkgsrc files is https://cdn.NetBSD.org/
736: pub/pkgsrc/ or ftp://ftp.NetBSD.org/pub/pkgsrc/ (it points to the same
737: location). There are a number of subdirectories for different purposes, which
1.207 leot 738: are described in detail in Appendix D, Directory layout of the pkgsrc FTP
1.151 sevan 739: server.
1.1 dsieger 740:
1.52 asau 741: The tar archive for the current branch is in the directory current and is
1.118 sevan 742: called pkgsrc.tar.gz. It is autogenerated weekly.
1.52 asau 743:
744: To save download time we provide bzip2- and xz-compressed archives which are
745: published at pkgsrc.tar.bz2 and pkgsrc.tar.xz respectively.
746:
747: You can fetch the same files using FTP.
1.1 dsieger 748:
1.259 leot 749: The tar file for the stable branch 2024Q4 is in the directory pkgsrc-2024Q4 and
1.59 jnemeth 750: is also called pkgsrc.tar.gz.
1.1 dsieger 751:
1.136 leot 752: To download the latest pkgsrc stable tarball, run:
1.12 weinem 753:
1.259 leot 754: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2024Q4/pkgsrc.tar.gz
1.12 weinem 755:
1.78 snj 756: If you prefer, you can also fetch it using "wget", "curl", or your web browser.
1.52 asau 757:
1.12 weinem 758: Then, extract it with:
759:
1.78 snj 760: $ tar -xzf pkgsrc.tar.gz -C /usr
1.12 weinem 761:
762: This will create the directory pkgsrc/ in /usr/ and all the package source will
763: be stored under /usr/pkgsrc/.
764:
765: To download pkgsrc-current, run:
766:
767: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz
1.1 dsieger 768:
1.154 rillig 769: 3.1.2. Via anonymous CVS
1.1 dsieger 770:
1.24 wiz 771: To fetch a specific pkgsrc stable branch, run:
1.1 dsieger 772:
1.259 leot 773: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2024Q4 -P pkgsrc
1.13 weinem 774:
1.24 wiz 775: This will create the directory pkgsrc/ in your /usr/ directory and all the
776: package source will be stored under /usr/pkgsrc/.
777:
778: To fetch the pkgsrc current branch, run:
1.1 dsieger 779:
1.40 wiz 780: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 781:
1.30 dholland 782: Refer to the list of available mirrors to choose a faster CVS mirror, if
783: needed.
1.1 dsieger 784:
1.24 wiz 785: If you get error messages from rsh, you need to set CVS_RSH variable. E.g.:
1.1 dsieger 786:
1.40 wiz 787: $ cd /usr && env CVS_RSH=ssh cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 788:
1.24 wiz 789: Refer to documentation on your command shell how to set CVS_RSH=ssh
790: permanently. For Bourne shells, you can set it in your .profile or better
791: globally in /etc/profile:
792:
793: # set CVS remote shell command
794: CVS_RSH=ssh
795: export CVS_RSH
1.12 weinem 796:
1.13 weinem 797: By default, CVS doesn't do things like most people would expect it to do. But
798: there is a way to convince CVS, by creating a file called .cvsrc in your home
1.12 weinem 799: directory and saving the following lines to it. This file will save you lots of
800: headache and some bug reports, so we strongly recommend it. You can find an
801: explanation of this file in the CVS documentation.
1.2 rillig 802:
803: # recommended CVS configuration file from the pkgsrc guide
1.155 sevan 804: cvs -q
1.2 rillig 805: checkout -P
1.4 rillig 806: update -dP
807: diff -upN
1.2 rillig 808: rdiff -u
1.24 wiz 809: release -d
1.1 dsieger 810:
1.154 rillig 811: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 812:
813: The preferred way to keep pkgsrc up-to-date is via CVS (which also works if you
814: have first installed it via a tar file). It saves bandwidth and hard disk
815: activity, compared to downloading the tar file again.
816:
1.154 rillig 817: 3.2.1. Via tar files
1.1 dsieger 818:
819: Warning
820:
821: When updating from a tar file, you first need to completely remove the old
822: pkgsrc directory. Otherwise those files that have been removed from pkgsrc in
823: the mean time will not be removed on your local disk, resulting in
824: inconsistencies. When removing the old files, any changes that you have done to
825: the pkgsrc files will be lost after updating. Therefore updating via CVS is
826: strongly recommended.
827:
828: Note that by default the distfiles and the binary packages are saved in the
829: pkgsrc tree, so don't forget to rescue them before updating. You can also
1.78 snj 830: configure pkgsrc to store distfiles and packages in directories outside the
1.154 rillig 831: pkgsrc tree by setting the DISTDIR and PACKAGES variables. See Chapter 6,
1.78 snj 832: Configuring pkgsrc for the details.
1.1 dsieger 833:
834: To update pkgsrc from a tar file, download the tar file as explained above.
835: Then, make sure that you have not made any changes to the files in the pkgsrc
836: directory. Remove the pkgsrc directory and extract the new tar file. Done.
837:
1.154 rillig 838: 3.2.2. Via CVS
1.1 dsieger 839:
1.26 spz 840: To update pkgsrc via CVS, change to the pkgsrc directory and run cvs:
1.12 weinem 841:
1.26 spz 842: $ cd /usr/pkgsrc && cvs update -dP
843:
844: If you get error messages from rsh, you need to set CVS_RSH variable as
845: described above. E.g.:
846:
847: $ cd /usr/pkgsrc && env CVS_RSH=ssh cvs up -dP
1.1 dsieger 848:
1.154 rillig 849: 3.2.2.1. Switching between different pkgsrc branches
1.1 dsieger 850:
851: When updating pkgsrc, the CVS program keeps track of the branch you selected.
852: But if you, for whatever reason, want to switch from the stable branch to the
853: current one, you can do it by adding the option "-A" after the "update"
1.25 wiz 854: keyword. To switch from the current branch back to the stable branch, add the "
1.259 leot 855: -rpkgsrc-2024Q4" option.
1.1 dsieger 856:
1.154 rillig 857: 3.2.2.2. What happens to my changes when updating?
1.1 dsieger 858:
859: When you update pkgsrc, the CVS program will only touch those files that are
860: registered in the CVS repository. That means that any packages that you created
861: on your own will stay unmodified. If you change files that are managed by CVS,
862: later updates will try to merge your changes with those that have been done by
863: others. See the CVS manual, chapter "update" for details.
864:
1.154 rillig 865: Chapter 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 866:
867: Table of Contents
868:
1.154 rillig 869: 4.1. Binary distribution
870: 4.2. Bootstrapping pkgsrc
1.1 dsieger 871:
1.154 rillig 872: 4.1. Binary distribution
1.1 dsieger 873:
1.154 rillig 874: See Section 5.1, "Using binary packages".
1.1 dsieger 875:
1.154 rillig 876: 4.2. Bootstrapping pkgsrc
1.1 dsieger 877:
1.44 asau 878: pkgsrc can be bootstrapped for use in two different modes: privileged and
879: unprivileged one. In unprivileged mode in contrast to privileged one all
1.45 asau 880: programs are installed under one particular user and cannot utilise privileged
1.44 asau 881: operations (packages don't create special users and all special file
882: permissions like setuid are ignored).
883:
1.1 dsieger 884: Installing the bootstrap kit from source should be as simple as:
885:
1.60 asau 886: # env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 887: # cd pkgsrc/bootstrap
888: # ./bootstrap
889:
890:
1.44 asau 891: To bootstrap in unprivileged mode pass "--unprivileged" flag to bootstrap
892:
893: By default, in privileged mode pkgsrc uses /usr/pkg for prefix where programs
1.118 sevan 894: will be installed in, and /usr/pkg/pkgdb for the package database directory
895: where pkgsrc will do its internal bookkeeping, /var is used as varbase, where
1.44 asau 896: packages install their persistent data. In unprivileged mode pkgsrc uses ~/pkg
1.118 sevan 897: for prefix, ~/pkg/pkgdb for the package database, and ~/pkg/var for varbase.
1.44 asau 898:
899: You can change default layout using command-line arguments. Run "./bootstrap
900: --help" to get details.
1.1 dsieger 901:
902: Note
903:
904: The bootstrap installs a bmake tool. Use this bmake when building via pkgsrc.
905: For examples in this guide, use bmake instead of "make".
906:
1.44 asau 907: Note
908:
909: It is possible to bootstrap multiple instances of pkgsrc using non-intersecting
910: directories. Use bmake corresponding to the installation you're working with to
911: build and install packages.
912:
1.154 rillig 913: Chapter 5. Using pkgsrc
1.1 dsieger 914:
915: Table of Contents
916:
1.154 rillig 917: 5.1. Using binary packages
918: 5.1.1. Finding binary packages
919: 5.1.2. Installing binary packages
1.202 nia 920: 5.1.3. Updating packages
921: 5.1.4. Deinstalling packages
922: 5.1.5. Getting information about installed packages
923: 5.1.6. Checking for security vulnerabilities in installed packages
924: 5.1.7. Finding if newer versions of your installed packages are in pkgsrc
925: 5.1.8. Other administrative functions
1.154 rillig 926: 5.2. Building packages from source
927: 5.2.1. Requirements
928: 5.2.2. Fetching distfiles
929: 5.2.3. How to build and install
1.1 dsieger 930:
931: Basically, there are two ways of using pkgsrc. The first is to only install the
932: package tools and to use binary packages that someone else has prepared. This
933: is the "pkg" in pkgsrc. The second way is to install the "src" of pkgsrc, too.
934: Then you are able to build your own packages, and you can still use binary
935: packages from someone else.
936:
1.154 rillig 937: 5.1. Using binary packages
1.1 dsieger 938:
1.151 sevan 939: On the cdn.NetBSD.org site and mirrors, there are collections of binary
1.9 rillig 940: packages, ready to be installed. These binary packages have been built using
941: the default settings for the directories, that is:
942:
943: * /usr/pkg for LOCALBASE, where most of the files are installed,
944:
945: * /usr/pkg/etc for configuration files,
946:
947: * /var for VARBASE, where those files are installed that may change after
948: installation.
949:
950: If you cannot use these directories for whatever reasons (maybe because you're
951: not root), you cannot use these binary packages, but have to build the packages
1.154 rillig 952: yourself, which is explained in Section 4.2, "Bootstrapping pkgsrc".
1.1 dsieger 953:
1.154 rillig 954: 5.1.1. Finding binary packages
1.1 dsieger 955:
1.5 weinem 956: To install binary packages, you first need to know from where to get them. The
1.202 nia 957: first place where you should look is on the main pkgsrc CDN in the directory /
958: pub/pkgsrc/packages.
1.5 weinem 959:
960: This directory contains binary packages for multiple platforms. First, select
1.226 gutterid 961: your operating system. Then, select your hardware architecture, and in the
962: third step, the OS version and the "version" of pkgsrc.
1.9 rillig 963:
1.226 gutterid 964: In this directory, you may find a file called bootstrap.tar.gz which contains
1.9 rillig 965: the package management tools. If the file is missing, it is likely that your
966: operating system already provides those tools. Download the file and extract it
967: in the / directory. It will create the directories /usr/pkg (containing the
1.118 sevan 968: tools for managing binary packages and the database of installed packages).
1.1 dsieger 969:
1.154 rillig 970: 5.1.2. Installing binary packages
1.1 dsieger 971:
1.85 wiz 972: In the directory from the last section, there is a subdirectory called All/,
1.9 rillig 973: which contains all the binary packages that are available for the platform,
1.202 nia 974: excluding those that may not be distributed via HTTP or FTP.
1.9 rillig 975:
976: To install packages directly from an FTP or HTTP server, run the following
977: commands in a Bourne-compatible shell (be sure to su to root first):
978:
1.202 nia 979: # PATH="/usr/pkg/sbin:/usr/pkg/bin:$PATH"
980: # PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages"
1.169 rillig 981: # PKG_PATH="$PKG_PATH/OPSYS/ARCH/VERSIONS/All/"
1.9 rillig 982: # export PATH PKG_PATH
1.202 nia 983: # pkg_add pkgin
1.9 rillig 984:
985: Instead of URLs, you can also use local paths, for example if you are
986: installing from a set of CDROMs, DVDs or an NFS-mounted repository. If you want
987: to install packages from multiple sources, you can separate them by a semicolon
988: in PKG_PATH.
989:
990: After these preparations, installing a package is very easy:
991:
1.202 nia 992: # pkgin search nginx
993: nginx-1.19.6 Lightweight HTTP server and mail proxy server
994: nginx-1.18.0nb8 Lightweight HTTP server and mail proxy server
995: # pkgin install zsh nginx-1.19.6 vim
1.1 dsieger 996:
1.202 nia 997: Note that pkgin is a user-friendly frontend to the pkg_* tools.
1.1 dsieger 998:
1.202 nia 999: Any prerequisite packages needed to run the package in question will be
1000: installed, too, assuming they are present in the repository.
1.1 dsieger 1001:
1002: After you've installed packages, be sure to have /usr/pkg/bin and /usr/pkg/sbin
1003: in your PATH so you can actually start the just installed program.
1004:
1.202 nia 1005: 5.1.3. Updating packages
1.1 dsieger 1006:
1.202 nia 1007: To update binary packages, it is recommended that you use pkgin upgrade. This
1008: will compare the remote package repository to your locally installed packages
1009: and safely replace any older packages.
1.1 dsieger 1010:
1.202 nia 1011: Note that pkgsrc is released as quarterly branches. If you are updating to a
1012: newer quarterly branch of pkgsrc, you may need to adjust the repository in /usr
1013: /pkg/etc/pkgin/repositories.conf.
1.1 dsieger 1014:
1.202 nia 1015: 5.1.4. Deinstalling packages
1.1 dsieger 1016:
1.202 nia 1017: To deinstall a package, it does not matter whether it was installed from source
1018: code or from a binary package. Neither the pkgin or the pkg_delete command need
1019: to know.
1.1 dsieger 1020:
1.202 nia 1021: To delete a package, you can just run pkgin remove package-name. The package
1022: name can be given with or without version number.
1.1 dsieger 1023:
1.202 nia 1024: 5.1.5. Getting information about installed packages
1.1 dsieger 1025:
1026: The pkg_info shows information about installed packages or binary package
1.202 nia 1027: files. As with other management tools, it works with packages installed from
1028: source or binaries.
1.1 dsieger 1029:
1.202 nia 1030: 5.1.6. Checking for security vulnerabilities in installed packages
1.1 dsieger 1031:
1.202 nia 1032: The pkgsrc Security Team and Packages Groups maintain a list of known
1.164 leot 1033: vulnerabilities to packages which are (or have been) included in pkgsrc. The
1.202 nia 1034: list is available from the NetBSD CDN at https://cdn.NetBSD.org/pub/NetBSD/
1.179 rillig 1035: packages/vulns/pkg-vulnerabilities.
1.1 dsieger 1036:
1.202 nia 1037: Please note that not every "vulnerability" with a CVE assignment is exploitable
1038: in every configuration. Some bugs are marked as active simply because an fix
1039: was not marked as such. Operating system specific hardening and mitigation
1040: features may also reduce the impact of bugs.
1041:
1.23 jakllsch 1042: Through pkg_admin fetch-pkg-vulnerabilities, this list can be downloaded
1043: automatically, and a security audit of all packages installed on a system can
1044: take place.
1045:
1046: There are two components to auditing. The first step, pkg_admin
1047: fetch-pkg-vulnerabilities, is for downloading the list of vulnerabilities from
1048: the NetBSD FTP site. The second step, pkg_admin audit, checks to see if any of
1049: your installed packages are vulnerable. If a package is vulnerable, you will
1050: see output similar to the following:
1.1 dsieger 1051:
1052: Package samba-2.0.9 has a local-root-shell vulnerability, see
1.174 leot 1053: https://www.samba.org/samba/whatsnew/macroexploit.html
1.1 dsieger 1054:
1.23 jakllsch 1055: You may wish to have the vulnerabilities file downloaded daily so that it
1056: remains current. This may be done by adding an appropriate entry to the root
1057: users crontab(5) entry. For example the entry
1058:
1.121 sevan 1059: # Download vulnerabilities file
1.118 sevan 1060: 0 3 * * * /usr/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities >/dev/null 2>&1
1.121 sevan 1061: # Audit the installed packages and email results to root
1062: 9 3 * * * /usr/pkg/sbin/pkg_admin audit |mail -s "Installed package audit result" \
1063: root >/dev/null 2>&1
1.118 sevan 1064:
1065:
1066: will update the vulnerability list every day at 3AM, followed by an audit at
1067: 3:09AM. The result of the audit are then emailed to root. On NetBSD this may be
1068: accomplished instead by adding the following line to /etc/daily.conf:
1069:
1070: fetch_pkg_vulnerabilities=YES
1071:
1.23 jakllsch 1072:
1.118 sevan 1073: to fetch the vulnerability list from the daily security script. The system is
1074: set to audit the packages by default but can be set explicitly, if desired (not
1.123 wiz 1075: required), by adding the following line to /etc/security.conf:
1.23 jakllsch 1076:
1.118 sevan 1077: check_pkg_vulnerabilities=YES
1.23 jakllsch 1078:
1079:
1.118 sevan 1080: see daily.conf(5) and security.conf(5) for more details.
1.1 dsieger 1081:
1.202 nia 1082: 5.1.7. Finding if newer versions of your installed packages are in pkgsrc
1.1 dsieger 1083:
1.12 weinem 1084: Install pkgtools/lintpkgsrc and run lintpkgsrc with the "-i" argument to check
1.202 nia 1085: if any packages are stale, e.g.
1.1 dsieger 1086:
1087: % lintpkgsrc -i
1088: ...
1089: Version mismatch: 'tcsh' 6.09.00 vs 6.10.00
1090:
1091:
1.202 nia 1092: 5.1.8. Other administrative functions
1.1 dsieger 1093:
1094: The pkg_admin executes various administrative functions on the package system.
1095:
1.154 rillig 1096: 5.2. Building packages from source
1.1 dsieger 1097:
1098: After obtaining pkgsrc, the pkgsrc directory now contains a set of packages,
1.25 wiz 1099: organized into categories. You can browse the online index of packages, or run
1.1 dsieger 1100: make readme from the pkgsrc directory to build local README.html files for all
1101: packages, viewable with any web browser such as www/lynx or www/firefox.
1102:
1103: The default prefix for installed packages is /usr/pkg. If you wish to change
1104: this, you should do so by setting LOCALBASE in mk.conf. You should not try to
1105: use multiple different LOCALBASE definitions on the same system (inside a
1106: chroot is an exception).
1107:
1108: The rest of this chapter assumes that the package is already in pkgsrc. If it
1109: is not, see Part II, "The pkgsrc developer's guide" for instructions how to
1110: create your own packages.
1111:
1.154 rillig 1112: 5.2.1. Requirements
1.1 dsieger 1113:
1114: To build packages from source, you need a working C compiler. On NetBSD, you
1115: need to install the "comp" and the "text" distribution sets. If you want to
1116: build X11-related packages, the "xbase" and "xcomp" distribution sets are
1117: required, too.
1118:
1.154 rillig 1119: 5.2.2. Fetching distfiles
1.1 dsieger 1120:
1121: The first step for building a package is downloading the distfiles (i.e. the
1122: unmodified source). If they have not yet been downloaded, pkgsrc will fetch
1123: them automatically.
1124:
1125: If you have all files that you need in the distfiles directory, you don't need
1126: to connect. If the distfiles are on CD-ROM, you can mount the CD-ROM on /cdrom
1127: and add:
1128:
1129: DISTDIR=/cdrom/pkgsrc/distfiles
1130:
1131: to your mk.conf.
1132:
1133: By default a list of distribution sites will be randomly intermixed to prevent
1134: huge load on servers which holding popular packages (for example,
1135: SourceForge.net mirrors). Thus, every time when you need to fetch yet another
1136: distfile all the mirrors will be tried in new (random) order. You can turn this
1137: feature off by setting MASTER_SORT_RANDOM=NO (for PKG_DEVELOPERs it's already
1138: disabled).
1139:
1140: You can overwrite some of the major distribution sites to fit to sites that are
1141: close to your own. By setting one or two variables you can modify the order in
1142: which the master sites are accessed. MASTER_SORT contains a whitespace
1143: delimited list of domain suffixes. MASTER_SORT_REGEX is even more flexible, it
1144: contains a whitespace delimited list of regular expressions. It has higher
1145: priority than MASTER_SORT. Have a look at pkgsrc/mk/defaults/mk.conf to find
1146: some examples. This may save some of your bandwidth and time.
1147:
1148: You can change these settings either in your shell's environment, or, if you
1.4 rillig 1149: want to keep the settings, by editing the mk.conf file, and adding the
1.1 dsieger 1150: definitions there.
1151:
1.132 wiz 1152: If a package depends on many other packages (such as meta-pkgs/kde4), the build
1.1 dsieger 1153: process may alternate between periods of downloading source, and compiling. To
1154: ensure you have all the source downloaded initially you can run the command:
1155:
1156: % make fetch-list | sh
1157:
1158: which will output and run a set of shell commands to fetch the necessary files
1159: into the distfiles directory. You can also choose to download the files
1160: manually.
1161:
1.154 rillig 1162: 5.2.3. How to build and install
1.1 dsieger 1163:
1164: Once the software has downloaded, any patches will be applied, then it will be
1165: compiled for you. This may take some time depending on your computer, and how
1166: many other packages the software depends on and their compile time.
1167:
1168: Note
1169:
1170: If using bootstrap or pkgsrc on a non-NetBSD system, use the pkgsrc bmake
1171: command instead of "make" in the examples in this guide.
1172:
1173: For example, type
1174:
1175: % cd misc/figlet
1176: % make
1177:
1178:
1179: at the shell prompt to build the various components of the package.
1180:
1181: The next stage is to actually install the newly compiled program onto your
1182: system. Do this by entering:
1183:
1184: % make install
1185:
1186:
1187: while you are still in the directory for whatever package you are installing.
1188:
1189: Installing the package on your system may require you to be root. However,
1190: pkgsrc has a just-in-time-su feature, which allows you to only become root for
1191: the actual installation step.
1192:
1193: That's it, the software should now be installed and setup for use. You can now
1194: enter:
1195:
1196: % make clean
1197:
1198:
1199: to remove the compiled files in the work directory, as you shouldn't need them
1200: any more. If other packages were also added to your system (dependencies) to
1201: allow your program to compile, you can tidy these up also with the command:
1202:
1203: % make clean-depends
1204:
1205:
1206: Taking the figlet utility as an example, we can install it on our system by
1.207 leot 1207: building as shown in Appendix C, Build logs.
1.1 dsieger 1208:
1209: The program is installed under the default root of the packages tree - /usr/
1210: pkg. Should this not conform to your tastes, set the LOCALBASE variable in your
1211: environment, and it will use that value as the root of your packages tree. So,
1212: to use /usr/local, set LOCALBASE=/usr/local in your environment. Please note
1213: that you should use a directory which is dedicated to packages and not shared
1214: with other programs (i.e., do not try and use LOCALBASE=/usr). Also, you should
1215: not try to add any of your own files or directories (such as src/, obj/, or
1216: pkgsrc/) below the LOCALBASE tree. This is to prevent possible conflicts
1217: between programs and other files installed by the package system and whatever
1218: else may have been installed there.
1219:
1.4 rillig 1220: Some packages look in mk.conf to alter some configuration options at build
1.1 dsieger 1221: time. Have a look at pkgsrc/mk/defaults/mk.conf to get an overview of what will
1222: be set there by default. Environment variables such as LOCALBASE can be set in
1.4 rillig 1223: mk.conf to save having to remember to set them each time you want to use
1.1 dsieger 1224: pkgsrc.
1225:
1226: Occasionally, people want to "look under the covers" to see what is going on
1227: when a package is building or being installed. This may be for debugging
1228: purposes, or out of simple curiosity. A number of utility values have been
1229: added to help with this.
1230:
1231: 1. If you invoke the make(1) command with PKG_DEBUG_LEVEL=2, then a huge
1232: amount of information will be displayed. For example,
1233:
1234: make patch PKG_DEBUG_LEVEL=2
1235:
1.25 wiz 1236: will show all the commands that are invoked, up to and including the "patch
1237: " stage.
1.1 dsieger 1238:
1239: 2. If you want to know the value of a certain make(1) definition, then the
1240: VARNAME definition should be used, in conjunction with the show-var target.
1241: e.g. to show the expansion of the make(1) variable LOCALBASE:
1242:
1243: % make show-var VARNAME=LOCALBASE
1244: /usr/pkg
1245: %
1246:
1247:
1248: If you want to install a binary package that you've either created yourself
1249: (see next section), that you put into pkgsrc/packages manually or that is
1250: located on a remote FTP server, you can use the "bin-install" target. This
1251: target will install a binary package - if available - via pkg_add(1), else do a
1252: make package. The list of remote FTP sites searched is kept in the variable
1253: BINPKG_SITES, which defaults to ftp.NetBSD.org. Any flags that should be added
1254: to pkg_add(1) can be put into BIN_INSTALL_FLAGS. See pkgsrc/mk/defaults/mk.conf
1255: for more details.
1256:
1257: A final word of warning: If you set up a system that has a non-standard setting
1258: for LOCALBASE, be sure to set that before any packages are installed, as you
1259: cannot use several directories for the same purpose. Doing so will result in
1260: pkgsrc not being able to properly detect your installed packages, and fail
1261: miserably. Note also that precompiled binary packages are usually built with
1262: the default LOCALBASE of /usr/pkg, and that you should not install any if you
1263: use a non-standard LOCALBASE.
1264:
1.154 rillig 1265: Chapter 6. Configuring pkgsrc
1.1 dsieger 1266:
1267: Table of Contents
1268:
1.154 rillig 1269: 6.1. General configuration
1270: 6.2. Variables affecting the build process
1.241 rillig 1271: 6.3. Preferences for native or pkgsrc software
1272: 6.4. Variables affecting the installation process
1273: 6.5. Selecting and configuring the compiler
1274: 6.5.1. Selecting the compiler
1275: 6.5.2. Additional flags to the compiler (CFLAGS)
1276: 6.5.3. Additional flags to the linker (LDFLAGS)
1277: 6.6. Developer/advanced settings
1278: 6.7. Selecting Build Options
1.1 dsieger 1279:
1280: The whole pkgsrc system is configured in a single file, usually called mk.conf.
1281: In which directory pkgsrc looks for that file depends on the installation. On
1282: NetBSD, when you use make(1) from the base system, it is in the directory /etc
1283: /. In all other cases the default location is ${PREFIX}/etc/, depending on
1284: where you told the bootstrap program to install the binary packages.
1285:
1286: The format of the configuration file is that of the usual BSD-style Makefiles.
1287: The whole pkgsrc configuration is done by setting variables in this file. Note
1288: that you can define all kinds of variables, and no special error checking (for
1.112 rillig 1289: example for spelling mistakes) takes place.
1.1 dsieger 1290:
1.154 rillig 1291: 6.1. General configuration
1.1 dsieger 1292:
1.112 rillig 1293: The following variables apply to all pkgsrc packages. A complete list of the
1294: variables that can be configured by the user is available in mk/defaults/
1295: mk.conf, together with some comments that describe each variable's intent.
1.1 dsieger 1296:
1297: * LOCALBASE: Where packages will be installed. The default is /usr/pkg. Do
1298: not mix binary packages with different LOCALBASEs!
1299:
1300: * CROSSBASE: Where "cross" category packages will be installed. The default
1301: is ${LOCALBASE}/cross.
1302:
1.84 wiz 1303: * X11BASE: Where X11 is installed on the system. The default is /usr/X11R7.
1.1 dsieger 1304:
1305: * DISTDIR: Where to store the downloaded copies of the original source
1306: distributions used for building pkgsrc packages. The default is $
1307: {PKGSRCDIR}/distfiles.
1308:
1309: * PKG_DBDIR: Where the database about installed packages is stored. The
1.118 sevan 1310: default is /usr/pkg/pkgdb.
1.1 dsieger 1311:
1312: * MASTER_SITE_OVERRIDE: If set, override the packages' MASTER_SITES with this
1313: value.
1314:
1315: * MASTER_SITE_BACKUP: Backup location(s) for distribution files and patch
1316: files if not found locally or in ${MASTER_SITES} or ${PATCH_SITES}
1.118 sevan 1317: respectively. The defaults is ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/$
1.1 dsieger 1318: {DIST_SUBDIR}/.
1319:
1320: * BINPKG_SITES: List of sites carrying binary pkgs. rel and arch are replaced
1321: with OS release ("2.0", etc.) and architecture ("mipsel", etc.).
1322:
1.23 jakllsch 1323: * ACCEPTABLE_LICENSES: List of acceptable licenses. License names are
1324: case-sensitive. Whenever you try to build a package whose license is not in
1325: this list, you will get an error message. If the license condition is
1326: simple enough, the error message will include specific instructions on how
1327: to change this variable.
1.1 dsieger 1328:
1.154 rillig 1329: 6.2. Variables affecting the build process
1.1 dsieger 1330:
1331: * PACKAGES: The top level directory for the binary packages. The default is $
1332: {PKGSRCDIR}/packages.
1333:
1334: * WRKOBJDIR: The top level directory where, if defined, the separate working
1335: directories will get created, and symbolically linked to from ${WRKDIR}
1336: (see below). This is useful for building packages on several architectures,
1337: then ${PKGSRCDIR} can be NFS-mounted while ${WRKOBJDIR} is local to every
1338: architecture. (It should be noted that PKGSRCDIR should not be set by the
1.198 leot 1339: user -- it is an internal definition which refers to the root of the pkgsrc
1.1 dsieger 1340: tree. It is possible to have many pkgsrc tree instances.)
1341:
1342: * LOCALPATCHES: Directory for local patches that aren't part of pkgsrc. See
1.184 rillig 1343: Section 12.3, "patches/*" for more information.
1.1 dsieger 1344:
1345: * PKGMAKECONF: Location of the mk.conf file used by a package's BSD-style
1346: Makefile. If this is not set, MAKECONF is set to /dev/null to avoid picking
1347: up settings used by builds in /usr/src.
1348:
1.241 rillig 1349: 6.3. Preferences for native or pkgsrc software
1350:
1351: Whenever a package depends on a package that has a builtin.mk file, the
1352: dependent package can either use the built-in (native) version from the base
1353: system or the pkgsrc-provided version. This only affects dependencies, so it is
1354: still possible to build the pkgsrc package devel/pcre++ even when other
1355: packages depend on the native pcre++ version instead.
1356:
1357: To force using the pkgsrc-provided version for a particular package, define "
1358: PREFER_PKGSRC = package-ID" in mk.conf. To force using the native package,
1359: define "PREFER_NATIVE = package-ID". In both cases, the package-ID is the one
1360: from the buildlink3.mk of the package. In most cases, this ID is the same as
1361: the directory name of the package, but for example, devel/pcre++ has the
1362: package ID "pcrexx".
1363:
1364: For the packages that are not listed by their package ID, pkgsrc uses the
1365: pkgsrc-provided version if PREFER_PKGSRC contains the word "yes". Otherwise, if
1366: PREFER_NATIVE contains the word "yes", pkgsrc uses the native version. For
1367: example, to require using the pkgsrc-provided versions for all but the most
1368: basic bits on a NetBSD system, you can set:
1369:
1370: PREFER_PKGSRC= yes
1371: PREFER_NATIVE= getopt skey tcp_wrappers
1372:
1373: A package must have a builtin.mk file to be listed in PREFER_NATIVE, otherwise
1374: it is simply ignored in that list.
1375:
1376: PREFER_PKGSRC and PREFER_NATIVE should be set during bootstrap to ensure that
1377: the bootstrap process does not use inapropriate native tools as dependencies
1378: for core packages.
1379:
1380: # ./bootstrap --prefer-pkgsrc yes --prefer-native openssl
1381:
1382: Switching between settings globally at a later date can introduce complications
1383: with dependency resolution. This is caused by packages built with the opposite
1384: preference being installed alongside each other. Hence, when changing any of
1385: these variables after bootstrap, you need to rebuild all packages depending on
1386: those whose preference has been changed. This is not trivial and should be
1387: avoided.
1388:
1389: When using pkgsrc on Linux systems, there is high risk of "leakage", where
1390: programs installed by pkgsrc may inadvertently use a command or library not
1391: installed by pkgsrc, e.g. those installed by yum or apt. Such foreign
1392: dependencies may be installed, removed, or upgraded to a version incompatible
1393: with the pkgsrc package at any time, causing pkgsrc packages to subsequently
1394: malfunction. Pkgsrc cannot prevent this, as it has no control over other
1395: package managers. Another potential problem is that under Redhat Enterprise and
1396: related Linux systems, yum packages are only patched and never upgraded, so
1397: eventually they may become too outdated for use by pkgsrc. Even intentionally
1398: using foreign dependencies, not considered leakage, can lead to these problems,
1399: so it is generally discouraged. In order to minimize such problems,
1400: PREFER_PKGSRC defaults to "yes" on Linux systems. This ensures that pkgsrc is
1401: aware of any changes to dependency packages and can rebuild or upgrade the
1402: entire dependency tree as needed. This default can be overridden by setting
1403: --prefer-pkgsrc to a list of packages and --prefer-native to "yes".
1404:
1405: 6.4. Variables affecting the installation process
1.1 dsieger 1406:
1.198 leot 1407: * PKGSRC_KEEP_BIN_PKGS: By default, binary packages of built packages are
1.150 leot 1408: preserved in ${PACKAGES}/All. Setting this variable to "no" prevents this.
1.1 dsieger 1409:
1.107 jnemeth 1410: Packages have to support installation into a subdirectory of WRKDIR. This
1411: allows a package to be built, before the actual filesystem is touched. DESTDIR
1412: support exists in two variations:
1.4 rillig 1413:
1414: * Basic DESTDIR support means that the package installation and packaging is
1415: still run as root.
1416:
1417: * Full DESTDIR support can run the complete build, installation and packaging
1418: as normal user. Root privileges are only needed to add packages.
1419:
1420: With basic DESTDIR support, make clean needs to be run as root.
1421:
1.17 imil 1422: Considering the foo/bar package, DESTDIR full support can be tested using the
1423: following commands
1424:
1425: $ id
1426: uid=1000(myusername) gid=100(users) groups=100(users),0(wheel)
1427: $ mkdir $HOME/packages
1428: $ cd $PKGSRCDIR/foo/bar
1429:
1430: Verify DESTDIR full support, no root privileges should be needed
1431:
1.66 asau 1432: $ make stage-install
1.17 imil 1433:
1434: Create a package without root privileges
1435:
1.66 asau 1436: $ make PACKAGES=$HOME/packages package
1.17 imil 1437:
1438: For the following command, you must be able to gain root privileges using su(1)
1439:
1.66 asau 1440: $ make PACKAGES=$HOME/packages install
1.17 imil 1441:
1442: Then, as a simple user
1443:
1444: $ make clean
1445:
1.241 rillig 1446: 6.5. Selecting and configuring the compiler
1.4 rillig 1447:
1.241 rillig 1448: 6.5.1. Selecting the compiler
1.1 dsieger 1449:
1450: By default, pkgsrc will use GCC to build packages. This may be overridden by
1451: setting the following variables in /etc/mk.conf:
1452:
1453: PKGSRC_COMPILER:
1454:
1455: This is a list of values specifying the chain of compilers to invoke when
1456: building packages. Valid values are:
1457:
1.259 leot 1458: + ccc: Compaq C Compilers (Tru64)
1.66 asau 1459:
1.259 leot 1460: + ccache: compiler cache (chainable)
1.66 asau 1461:
1.259 leot 1462: + clang: Clang C and Objective-C compiler
1.66 asau 1463:
1.259 leot 1464: + distcc: distributed C/C++ (chainable)
1.1 dsieger 1465:
1.259 leot 1466: + f2c: Fortran 77 to C compiler (chainable)
1.66 asau 1467:
1.259 leot 1468: + icc: Intel C++ Compiler (Linux)
1.66 asau 1469:
1.259 leot 1470: + ido: SGI IRIS Development Option cc (IRIX 5)
1.1 dsieger 1471:
1.259 leot 1472: + gcc: GNU C/C++ Compiler
1.1 dsieger 1473:
1.259 leot 1474: + hp: HP-UX C/aC++ compilers
1.66 asau 1475:
1.259 leot 1476: + mipspro: Silicon Graphics, Inc. MIPSpro (n32/n64)
1.1 dsieger 1477:
1.259 leot 1478: + mipspro-ucode: Silicon Graphics, Inc. MIPSpro (o32)
1.1 dsieger 1479:
1.259 leot 1480: + sunpro: Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio
1.1 dsieger 1481:
1.259 leot 1482: + xlc: IBM's XL C/C++ compiler suite
1.66 asau 1483:
1.1 dsieger 1484: The default is "gcc". You can use ccache and/or distcc with an appropriate
1485: PKGSRC_COMPILER setting, e.g. "ccache gcc". This variable should always be
1486: terminated with a value for a real compiler. Note that only one real
1487: compiler should be listed (e.g. "sunpro gcc" is not allowed).
1488:
1489: GCC_REQD:
1490:
1491: This specifies the minimum version of GCC to use when building packages. If
1492: the system GCC doesn't satisfy this requirement, then pkgsrc will build and
1493: install one of the GCC packages to use instead.
1494:
1.153 leot 1495: PYTHON_VERSION_DEFAULT:
1.114 maya 1496:
1497: Specifies which version of python to use when several options are
1498: available.
1499:
1500: PKGSRC_FORTRAN:
1501:
1.176 gutterid 1502: Specifies the Fortran compiler to use. The default is gfortran.
1.114 maya 1503:
1504: GFORTRAN_VERSION:
1505:
1506: If PKGSRC_FORTRAN= gfortran is used, this option specifies which version to
1507: use.
1508:
1.241 rillig 1509: 6.5.2. Additional flags to the compiler (CFLAGS)
1.1 dsieger 1510:
1511: If you wish to set the CFLAGS variable, please make sure to use the += operator
1512: instead of the = operator:
1513:
1514: CFLAGS+= -your -flags
1515:
1516: Using CFLAGS= (i.e. without the "+") may lead to problems with packages that
1.16 jnemeth 1517: need to add their own flags. You may want to take a look at the devel/cpuflags
1.24 wiz 1518: package if you're interested in optimization specifically for the current CPU.
1.1 dsieger 1519:
1.241 rillig 1520: 6.5.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 1521:
1522: If you want to pass flags to the linker, both in the configure step and the
1523: build step, you can do this in two ways. Either set LDFLAGS or LIBS. The
1524: difference between the two is that LIBS will be appended to the command line,
1525: while LDFLAGS come earlier. LDFLAGS is pre-loaded with rpath settings for ELF
1526: machines depending on the setting of USE_IMAKE or the inclusion of mk/
1527: x11.buildlink3.mk. As with CFLAGS, if you do not wish to override these
1528: settings, use the += operator:
1529:
1530: LDFLAGS+= -your -linkerflags
1531:
1.241 rillig 1532: 6.6. Developer/advanced settings
1.1 dsieger 1533:
1534: * PKG_DEVELOPER: Run some sanity checks that package developers want:
1535:
1.42 asau 1536: + make sure patches apply with zero fuzz
1.1 dsieger 1537:
1.42 asau 1538: + run check-shlibs to see that all binaries will find their shared libs.
1.1 dsieger 1539:
1.232 gutterid 1540: * CHECK_FILES_STRICT: Also check VARBASE and PKG_SYSCONFDIR values in PLIST
1541: entries.
1542:
1.1 dsieger 1543: * PKG_DEBUG_LEVEL: The level of debugging output which is displayed whilst
1544: making and installing the package. The default value for this is 0, which
1545: will not display the commands as they are executed (normal, default, quiet
1546: operation); the value 1 will display all shell commands before their
1547: invocation, and the value 2 will display both the shell commands before
1.112 rillig 1548: their invocation, as well as their actual execution progress with set -x.
1.1 dsieger 1549:
1.241 rillig 1550: 6.7. Selecting Build Options
1.1 dsieger 1551:
1552: Some packages have build time options, usually to select between different
1553: dependencies, enable optional support for big dependencies or enable
1554: experimental features.
1555:
1556: To see which options, if any, a package supports, and which options are
1557: mutually exclusive, run make show-options, for example:
1558:
1559: The following options are supported by this package:
1560: ssl Enable SSL support.
1561: Exactly one of the following gecko options is required:
1562: firefox Use firefox as gecko rendering engine.
1563: mozilla Use mozilla as gecko rendering engine.
1564: At most one of the following database options may be selected:
1565: mysql Enable support for MySQL database.
1566: pgsql Enable support for PostgreSQL database.
1567:
1568: These options are enabled by default: firefox
1569: These options are currently enabled: mozilla ssl
1570:
1.4 rillig 1571: The following variables can be defined in mk.conf to select which options to
1572: enable for a package: PKG_DEFAULT_OPTIONS, which can be used to select or
1.1 dsieger 1573: disable options for all packages that support them, and PKG_OPTIONS.pkgbase,
1574: which can be used to select or disable options specifically for package pkgbase
1575: . Options listed in these variables are selected, options preceded by "-" are
1576: disabled. A few examples:
1577:
1.4 rillig 1578: $ grep "PKG.*OPTION" mk.conf
1.1 dsieger 1579: PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
1580: PKG_OPTIONS.kdebase= debug -sasl
1581: PKG_OPTIONS.apache= suexec
1582:
1.11 rillig 1583: It is important to note that options that were specifically suggested by the
1.19 snj 1584: package maintainer must be explicitly removed if you do not wish to include the
1585: option. If you are unsure you can view the current state with make show-options
1586: .
1.11 rillig 1587:
1.1 dsieger 1588: The following settings are consulted in the order given, and the last setting
1589: that selects or disables an option is used:
1590:
1591: 1. the default options as suggested by the package maintainer
1592:
1593: 2. the options implied by the settings of legacy variables (see below)
1594:
1595: 3. PKG_DEFAULT_OPTIONS
1596:
1597: 4. PKG_OPTIONS.pkgbase
1598:
1599: For groups of mutually exclusive options, the last option selected is used, all
1600: others are automatically disabled. If an option of the group is explicitly
1601: disabled, the previously selected option, if any, is used. It is an error if no
1602: option from a required group of options is selected, and building the package
1603: will fail.
1604:
1605: Before the options framework was introduced, build options were selected by
1.4 rillig 1606: setting a variable (often named USE_FOO) in mk.conf for each option. To ease
1607: transition to the options framework for the user, these legacy variables are
1608: converted to the appropriate options setting (PKG_OPTIONS.pkgbase)
1609: automatically. A warning is issued to prompt the user to update mk.conf to use
1610: the options framework directly. Support for the legacy variables will be
1.1 dsieger 1611: removed eventually.
1612:
1.154 rillig 1613: Chapter 7. Creating binary packages
1.1 dsieger 1614:
1615: Table of Contents
1616:
1.154 rillig 1617: 7.1. Building a single binary package
1618: 7.2. Settings for creation of binary packages
1.1 dsieger 1619:
1.154 rillig 1620: 7.1. Building a single binary package
1.1 dsieger 1621:
1622: Once you have built and installed a package, you can create a binary package
1623: which can be installed on another system with pkg_add(1). This saves having to
1624: build the same package on a group of hosts and wasting CPU time. It also
1625: provides a simple means for others to install your package, should you
1626: distribute it.
1627:
1628: To create a binary package, change into the appropriate directory in pkgsrc,
1629: and run make package:
1630:
1.112 rillig 1631: $ cd misc/figlet
1632: $ make package
1.1 dsieger 1633:
1.242 gutterid 1634: This will build your package (if not already done) and package it into a binary
1635: package. You can then use the pkg_* tools to manipulate it. Binary packages are
1636: created in PACKAGES, which defaults to /usr/pkgsrc/packages, in the form of a
1637: compressed tar file. See Section C.2, "Packaging figlet" for a continuation of
1638: the above misc/figlet example.
1.1 dsieger 1639:
1.154 rillig 1640: See Chapter 23, Submitting and Committing for information on how to submit such
1.1 dsieger 1641: a binary package.
1642:
1.154 rillig 1643: 7.2. Settings for creation of binary packages
1.1 dsieger 1644:
1.184 rillig 1645: See Section 13.17, "Other helpful targets".
1.6 rillig 1646:
1.154 rillig 1647: Chapter 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 1648:
1649: Table of Contents
1650:
1.154 rillig 1651: 8.1. Preparations
1.180 rillig 1652: 8.2. Running a bulk build
1.154 rillig 1653: 8.2.1. Configuration
1654: 8.3. Requirements of a full bulk build
1.178 rillig 1655: 8.4. Bulk build variants
1.179 rillig 1656: 8.4.1. Detect unknown configure options
1657: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 1658: 8.4.3. Force compiler options only in the build phase
1659: 8.4.4. Use custom directories
1660: 8.4.5. Turn warnings into errors
1661: 8.4.6. Reject packages for which pkglint reports errors
1662: 8.4.7. Reject packages that contain forbidden strings
1663: 8.4.8. Reject packages whose self-test fails
1664: 8.4.9. Reject packages that use undefined shell variables
1665: 8.4.10. Turn off verbose logging
1.178 rillig 1666: 8.5. Creating a multiple CD-ROM packages collection
1667: 8.5.1. Example of cdpack
1.6 rillig 1668:
1.175 gutterid 1669: For a number of reasons, you may want to build binary packages for a large
1670: selected set of packages in pkgsrc, or even for all pkgsrc packages. For
1.71 wiz 1671: instance, when you have multiple machines that should run the same software, it
1672: is wasted time if they all build their packages themselves from source. Or you
1673: may want to build a list of packages you want and check them before deploying
1.175 gutterid 1674: onto production systems. There is a way of getting a set of binary packages:
1675: the bulk build system, or pbulk ("p" stands for "parallel"). This chapter
1676: describes how to set it up.
1.71 wiz 1677:
1.154 rillig 1678: 8.1. Preparations
1.71 wiz 1679:
1680: First of all, you have to decide whether you build all packages or a limited
1681: set of them. Full bulk builds usually consume a lot more resources, both space
1.175 gutterid 1682: and time, than builds for some practical sets of packages. A number of
1683: particularly heavy packages exist that are not actually interesting to a wide
1684: audience. (The approximate resource consumption for a full bulk build is given
1685: in section Section 8.3, "Requirements of a full bulk build".) For limited bulk
1686: builds you need to make a list of packages you want to build. Note that all
1687: their dependencies will be built, so you don't need to track them manually.
1.71 wiz 1688:
1689: During bulk builds various packages are installed and deinstalled in /usr/pkg
1690: (or whatever LOCALBASE is), so make sure that you don't need any package during
1.112 rillig 1691: the builds. Essentially, you should provide a fresh system, either a chroot
1.71 wiz 1692: environment or something even more restrictive, depending on what the operating
1693: system provides, or dedicate the whole physical machine. As a useful side
1694: effect this makes sure that bulk builds cannot break anything in your system.
1695: There have been numerous cases where certain packages tried to install files
1696: outside the LOCALBASE or wanted to edit some files in /etc.
1.6 rillig 1697:
1.180 rillig 1698: 8.2. Running a bulk build
1.6 rillig 1699:
1.180 rillig 1700: Running a bulk build works roughly as follows:
1.15 rillig 1701:
1702: * First, build the pbulk infrastructure in a fresh pkgsrc location.
1703:
1704: * Then, build each of the packages from a clean installation directory using
1705: the infrastructure.
1706:
1.154 rillig 1707: 8.2.1. Configuration
1.6 rillig 1708:
1.112 rillig 1709: To simplify configuration, we provide the helper script mk/pbulk/pbulk.sh.
1.6 rillig 1710:
1.68 asau 1711: In order to use it, prepare a clear system (real one, chroot environment, jail,
1712: zone, virtual machine). Configure network access to fetch distribution files.
1.112 rillig 1713: Create a user with name "pbulk".
1.68 asau 1714:
1715: Fetch and extract pkgsrc. Use a command like one of these:
1716:
1.151 sevan 1717: # (cd /usr && ftp -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1718: # (cd /usr && fetch -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1.72 wiz 1719: # (cd /usr && cvs -Q -z3 -d anoncvs@anoncvs.NetBSD.org:/cvsroot get -P pkgsrc)
1.68 asau 1720:
1721: Or any other way that fits (e.g., curl, wget).
1722:
1723: Deploy and configure pbulk tools, e.g.:
1724:
1.118 sevan 1725: # sh pbulk.sh -n # use native make, no bootstrap kit needed (for use on NetBSD)
1.68 asau 1726: # sh pbulk.sh -n -c mk.conf.frag # native, apply settings from given mk.conf fragment
1727: # sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build
1728:
1729: Note
1730:
1731: mk.conf.frag is a fragment of mk.conf that contains settings you want to apply
1732: to packages you build. For instance,
1733:
1.112 rillig 1734: PKG_DEVELOPER= yes # perform more checks
1735: X11_TYPE= modular # use pkgsrc X11
1736: SKIP_LICENSE_CHECK= yes # accept all licences (useful
1737: # when building all packages)
1.68 asau 1738:
1739: If configured for limited list, replace the list in /usr/pbulk/etc/pbulk.list
1.112 rillig 1740: with your list of packages, one per line without empty lines or comments. E.g.:
1.68 asau 1741:
1742: www/firefox
1743: mail/thunderbird
1744: misc/libreoffice4
1745:
1.69 asau 1746: At this point you can also review configuration in /usr/pbulk/etc and make
1747: final amendments, if wanted.
1748:
1.68 asau 1749: Start it:
1750:
1751: # /usr/pbulk/bin/bulkbuild
1752:
1753: After it finishes, you'll have /mnt filled with distribution files, binary
1754: packages, and reports, plain text summary in /mnt/bulklog/meta/report.txt
1755:
1756: Note
1757:
1758: The pbulk.sh script does not cover all possible use cases. While being ready to
1759: run, it serves as a good starting point to understand and build more complex
1760: setups. The script is kept small enough for better understanding.
1761:
1762: Note
1763:
1764: The pbulk.sh script supports running unprivileged bulk build and helps
1.205 wiz 1765: configuring distributed bulk builds. Distributed bulk builds support either
1766: building in worker chroots (each node is a path to a different chroot) that
1767: replicate the target system, including the pbulk prefix, or remote machines
1768: (each node is an IP address that must be accessible over SSH without a
1769: password).
1.15 rillig 1770:
1.154 rillig 1771: 8.3. Requirements of a full bulk build
1.71 wiz 1772:
1773: A complete bulk build requires lots of disk space. Some of the disk space can
1774: be read-only, some other must be writable. Some can be on remote filesystems
1775: (such as NFS) and some should be local. Some can be temporary filesystems,
1776: others must survive a sudden reboot.
1777:
1.205 wiz 1778: * 70 GB for the distfiles (read-write, remote, temporary)
1.71 wiz 1779:
1.205 wiz 1780: * 60 GB for the binary packages (read-write, remote, permanent)
1.71 wiz 1781:
1782: * 1 GB for the pkgsrc tree (read-only, remote, permanent)
1783:
1784: * 5 GB for LOCALBASE (read-write, local, temporary)
1785:
1786: * 10 GB for the log files (read-write, remote, permanent)
1787:
1788: * 5 GB for temporary files (read-write, local, temporary)
1789:
1.178 rillig 1790: 8.4. Bulk build variants
1791:
1792: To ensure that pkgsrc packages work in different configurations, it makes sense
1793: to run non-default bulk builds from time to time. This section lists some ideas
1794: for bulk builds that intentionally let packages fail if they don't follow the
1795: pkgsrc style.
1796:
1.179 rillig 1797: 8.4.1. Detect unknown configure options
1.178 rillig 1798:
1799: Add the following line to mk.conf.
1800:
1801: GNU_CONFIGURE_STRICT= yes
1802:
1803: When a package fails this additional check, the most common cause is that the
1804: configure option was valid for an older version of the package but does not
1805: apply anymore. In that case, just remove it.
1806:
1.179 rillig 1807: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.178 rillig 1808:
1809: The job of a compiler is not restricted to producing executable code, most
1.179 rillig 1810: compilers also detect typical programming mistakes. The pkgsrc compiler
1811: wrappers make it easy to force compiler options when the package is built. This
1812: can be used to find typical bugs across all packages that are in pkgsrc. By
1813: reporting these bugs upstream, the packages will be more reliable with the next
1814: updates.
1.178 rillig 1815:
1.179 rillig 1816: Add some of the following lines to mk.conf:
1.178 rillig 1817:
1818: CFLAGS+= -Werror=char-subscripts
1.179 rillig 1819: CFLAGS+= -Werror=implicit-function-declaration
1.178 rillig 1820:
1.179 rillig 1821: When a package fails to build using these stricter compiler options, document
1822: the circumstances in which the compiler produced the error message. This
1823: includes:
1.178 rillig 1824:
1825: * The platform (MACHINE_PLATFORM)
1826:
1827: * The source file
1828:
1829: * An excerpt of the code. GCC and Clang already do this as part of the
1830: diagnostic.
1831:
1.179 rillig 1832: * The exact error message from the compiler.
1.178 rillig 1833:
1.179 rillig 1834: If a package produces these error messages, but the package is fine, record
1835: this in your local mk.conf, like this, to skip this check in the next builds:
1.178 rillig 1836:
1.179 rillig 1837: .if ${PKGPATH} == category/package
1.178 rillig 1838: # Version ${VERSION} failed on ${MACHINE_PLATFORM}:
1839: # error message
1840: # code
1.179 rillig 1841: # Reason why the code does not need to be fixed.
1.178 rillig 1842: BUILDLINK_TRANSFORM+= rm:-Werror=char-subscripts
1.179 rillig 1843: .endif
1.178 rillig 1844:
1845: If the error messages from the compiler are valid and the code needs to be
1.179 rillig 1846: fixed, prepare a local patch (see LOCALPATCHES) and report the bug to the
1847: upstream authors of the package, providing them with the information you
1848: collected above.
1.178 rillig 1849:
1.179 rillig 1850: Patches that are not essential for the package to work should only be reported
1851: upstream but not committed to pkgsrc, to make future updates easier.
1852:
1.181 rillig 1853: 8.4.3. Force compiler options only in the build phase
1854:
1855: When adding custom compiler flags via CFLAGS, these apply to all phases of the
1856: package build process. Especially in the configure phase, adding -Werror leads
1857: to wrong decisions. The GNU configure scripts feed many small test programs to
1858: the C compiler to see whether certain headers are available, functions are
1859: defined in a library and programs can be run. In many cases these programs
1860: would not survive a strict compiler run with -Wall -Wextra -Werror.
1861:
1862: The pkgsrc infrastructure is flexible enough to support compiler options being
1863: added between the configure and build phases. It's a little more complicated
1864: than the other examples in this section but still easy enough.
1865:
1866: The basic idea is to use the pkgsrc compiler wrapper to inject the desired
1867: compiler options. The compiler wrapper's original task is to hide unwanted
1868: directories of include files and to normalize compiler options. It does this by
1869: wrapping the compiler command and rewriting the command line. To see this in
1870: action, run bmake patch in a package directory and examine the work/.cwrappers/
1871: config directory. It contains individual configurations for the C compiler and
1872: the related tools. The plan is to find a hook between the configure and build
1873: phases, and to modify these configuration files at that point.
1874:
1875: To find this hook, have a look at mk/build/build.mk, which contains among
1876: others the pre-build-checks-hook. The word checks doesn't quite fit, but the
1877: pre-build-hook sounds good enough.
1878:
1879: The code to be included in mk.conf is:
1880:
1881: # Just a few example options.
1882: BUILD_ONLY_CFLAGS= -Wall -Werror -O2 -DTEMPDIR='"/tmp"'
1883:
1884: .if ${BUILD_ONLY_CFLAGS:U:M*}
1885: pre-build-checks-hook: add-build-only-cflags
1886:
1887: add-build-only-cflags: .PHONY
1888: ${RUN} cd ${CWRAPPERS_CONFIG_DIR}; \
1889: ${TEST} ! -f ${.TARGET} || exit 0; \
1890: for flag in ${BUILD_ONLY_CFLAGS}; do \
1891: ${ECHO} "append=$$flag" >> cc; \
1892: done; \
1893: > ${.TARGET}
1894: .endif
1895:
1896: (When editing the mk.conf, make sure that the commands of the
1897: add-build-only-cflags target are indented with a tab, not with spaces.)
1898:
1899: The condition in the .if statement contains the :U modifier to prevent parse
1900: errors if the variable should be undefined, possibly because it is only defined
1901: for a subset of the packages. The :M* modifier ensures that there is at least
1902: one compiler option, to prevent a syntax error in the shell parser.
1903:
1904: The code around the ${.TARGET} variable ensures that the additional compiler
1905: options are only appended once, even if bmake build is run multiple times. To
1906: do this, it creates a marker file.
1907:
1908: To verify that this setup works, run bmake configure in a package directory. Up
1909: to now, everything works as usual. Examine the directory work/.cwrappers/config
1910: to see that the compiler options from BUILD_ONLY_CFLAGS are not yet added to
1911: the file cc. Examine the tail of the work/.work.log file to see that the normal
1912: compiler options are used.
1913:
1914: Now run bmake build. This will append the options to the file cc and will
1915: create the marker file in the same directory. After that, the build starts as
1916: usual, but with the added compiler options. Examine the tail of the file work
1917: /.work.log to see that the lines starting with [*] don't contain the compiler
1918: options, but the corresponding lines starting with <.> do end with these
1919: options.
1920:
1921: Building packages using this setup variant and fixing the resulting bugs is the
1922: same as in Section 8.4.2, "Detect classes of bugs by forcing compiler warnings"
1923: .
1924:
1925: 8.4.4. Use custom directories
1.178 rillig 1926:
1927: Some directories like PREFIX, VARBASE, PKG_SYSCONFDIR, PKGMANDIR, PKG_INFODIR
1928: can be configured in pkgsrc. Set these to arbitrary paths during bootstrap or
1929: afterwards in mk.conf.
1930:
1931: PREFIX= /a-random-uuid
1932: PKG_SYSCONFDIR= /a-random-uuid
1933: VARBASE= /a-random-uuid
1934: PKGMANDIR= a-random-uuid
1935: PKG_INFODIR= a-random-uuid
1936:
1.181 rillig 1937: 8.4.5. Turn warnings into errors
1.178 rillig 1938:
1939: When building a package, warnings are typically ignored since they just flow by
1940: and do not cause the build to fail immediately. To find these warnings,
1941: redefine them to errors in mk.conf.
1942:
1943: DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)"
1944: WARNING_MSG= ${FAIL_MSG} "(was warning)"
1945:
1946: (There are many more classes of warnings in pkgsrc, and most of them can be
1947: redefined with a simple definition like above.
1948:
1.179 rillig 1949: If a package suggests to add USE_TOOLS+=perl to the package Makefile, research
1.178 rillig 1950: whether the package actually needs Perl. If it does, add USE_TOOLS+=perl to the
1951: package Makefile, and if it doesn't, add TOOLS_BROKEN+=perl.
1952:
1.181 rillig 1953: 8.4.6. Reject packages for which pkglint reports errors
1.178 rillig 1954:
1955: Using pkglint as part of the regular build process is mostly a waste of time.
1956: If you want to fix some of the warnings, just run pkglint recursively on the
1957: whole pkgsrc tree. This will take a few minutes (up to 10), which is much
1958: faster than a complete bulk build.
1959:
1.181 rillig 1960: 8.4.7. Reject packages that contain forbidden strings
1.178 rillig 1961:
1962: To ensure that the binary packages don't contain references to the build
1963: directory, there is already CHECK_WRKREF. If that variable includes the item
1964: extra, it is possible to define additional patterns that must not appear in any
1965: installed file. This is specified in mk.conf.
1966:
1967: CHECK_WRKREF= extra
1968: CHECK_WRKREF_EXTRA_DIRS+= /usr/local
1969: CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg
1970: CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@
1971:
1972: The above patterns will probably generate many false positives, therefore the
1973: results need to be taken with a grain of salt.
1974:
1.181 rillig 1975: 8.4.8. Reject packages whose self-test fails
1.178 rillig 1976:
1977: To run the test suites that come with each package, add this line to mk.conf.
1978:
1979: PKGSRC_RUN_TEST= yes
1980:
1981: Be prepared that even the most basic packages fail this test. When doing a bulk
1982: build with this, it will often abort in the early phase where the packages are
1983: scanned for their dependencies since there are cyclic dependencies. There is
1984: still a lot to do in this area.
1985:
1.181 rillig 1986: 8.4.9. Reject packages that use undefined shell variables
1.178 rillig 1987:
1988: To catch typos in the shell snippets from the Makefile fragments, add the -u
1989: flag to most of the commands by adding this line to mk.conf.
1990:
1991: RUN= @set -eu;
1992:
1.181 rillig 1993: After that, ensure that none of the bulk build log files (even those for
1994: successfully built packages) contains the string parameter not set or whatever
1995: error message the command sh -ceu '$undefined' outputs.
1996:
1.178 rillig 1997: See mk/misc/common.mk for the existing definition.
1998:
1.181 rillig 1999: 8.4.10. Turn off verbose logging
1.178 rillig 2000:
2001: The build logs of a package are often quite long. This allows error messages or
2002: other interesting details to hide between the noise. To make the actual error
2003: message stand out more, add these lines to mk.conf.
2004:
2005: GNU_CONFIGURE_QUIET= yes
2006: MAKE_FLAGS+= -s
2007:
2008: The -s option works for both GNU Make and BSD Make. On exotic platforms with
2009: their own make, it may be a little different.
2010:
2011: 8.5. Creating a multiple CD-ROM packages collection
1.1 dsieger 2012:
2013: After your pkgsrc bulk-build has completed, you may wish to create a CD-ROM set
2014: of the resulting binary packages to assist in installing packages on other
2015: machines. The pkgtools/cdpack package provides a simple tool for creating the
2016: ISO 9660 images. cdpack arranges the packages on the CD-ROMs in a way that
2017: keeps all the dependencies for a given package on the same CD as that package.
2018:
1.178 rillig 2019: 8.5.1. Example of cdpack
1.1 dsieger 2020:
2021: Complete documentation for cdpack is found in the cdpack(1) man page. The
2022: following short example assumes that the binary packages are left in /usr/
2023: pkgsrc/packages/All and that sufficient disk space exists in /u2 to hold the
2024: ISO 9660 images.
2025:
2026: # mkdir /u2/images
2027: # pkg_add /usr/pkgsrc/packages/All/cdpack
2028: # cdpack /usr/pkgsrc/packages/All /u2/images
2029:
2030:
2031: If you wish to include a common set of files (COPYRIGHT, README, etc.) on each
2032: CD in the collection, then you need to create a directory which contains these
1.175 gutterid 2033: files, e.g.:
1.1 dsieger 2034:
2035: # mkdir /tmp/common
2036: # echo "This is a README" > /tmp/common/README
2037: # echo "Another file" > /tmp/common/COPYING
2038: # mkdir /tmp/common/bin
2039: # echo "#!/bin/sh" > /tmp/common/bin/myscript
2040: # echo "echo Hello world" >> /tmp/common/bin/myscript
2041: # chmod 755 /tmp/common/bin/myscript
2042:
2043:
2044: Now create the images:
2045:
2046: # cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images
2047:
2048: Each image will contain README, COPYING, and bin/myscript in their root
2049: directories.
2050:
1.154 rillig 2051: Chapter 9. Directory layout of the installed files
1.1 dsieger 2052:
2053: Table of Contents
2054:
1.154 rillig 2055: 9.1. File system layout in ${LOCALBASE}
2056: 9.2. File system layout in ${VARBASE}
1.1 dsieger 2057:
2058: The files that are installed by pkgsrc are organized in a way that is similar
2059: to what you find in the /usr directory of the base system. But some details are
2060: different. This is because pkgsrc initially came from FreeBSD and had adopted
2061: its file system hierarchy. Later it was largely influenced by NetBSD. But no
2062: matter which operating system you are using pkgsrc with, you can expect the
2063: same layout for pkgsrc.
2064:
2065: There are mainly four root directories for pkgsrc, which are all configurable
2066: in the bootstrap/bootstrap script. When pkgsrc has been installed as root, the
2067: default locations are:
2068:
2069: LOCALBASE= /usr/pkg
2070: PKG_SYSCONFBASE= /usr/pkg/etc
2071: VARBASE= /var
1.119 sevan 2072: PKG_DBDIR= /usr/pkg/pkgdb
1.1 dsieger 2073:
2074: In unprivileged mode (when pkgsrc has been installed as any other user), the
2075: default locations are:
2076:
2077: LOCALBASE= ${HOME}/pkg
2078: PKG_SYSCONFBASE= ${HOME}/pkg/etc
2079: VARBASE= ${HOME}/pkg/var
1.119 sevan 2080: PKG_DBDIR= ${HOME}/pkg/pkgdb
1.1 dsieger 2081:
2082: What these four directories are for, and what they look like is explained
2083: below.
2084:
1.25 wiz 2085: * LOCALBASE corresponds to the /usr directory in the base system. It is the "
2086: main" directory where the files are installed and contains the well-known
1.1 dsieger 2087: subdirectories like bin, include, lib, share and sbin.
2088:
2089: * VARBASE corresponds to /var in the base system. Some programs (especially
2090: games, network daemons) need write access to it during normal operation.
2091:
2092: * PKG_SYSCONFDIR corresponds to /etc in the base system. It contains
2093: configuration files of the packages, as well as pkgsrc's mk.conf itself.
2094:
1.154 rillig 2095: 9.1. File system layout in ${LOCALBASE}
1.1 dsieger 2096:
2097: The following directories exist in a typical pkgsrc installation in $
2098: {LOCALBASE}.
2099:
2100: bin
2101:
2102: Contains executable programs that are intended to be directly used by the
2103: end user.
2104:
2105: emul
2106:
2107: Contains files for the emulation layers of various other operating systems,
2108: especially for NetBSD.
2109:
2110: etc (the usual location of ${PKG_SYSCONFDIR})
2111:
2112: Contains the configuration files.
2113:
2114: include
2115:
2116: Contains headers for the C and C++ programming languages.
2117:
2118: info
2119:
2120: Contains GNU info files of various packages.
2121:
2122: lib
2123:
2124: Contains shared and static libraries.
2125:
2126: libdata
2127:
2128: Contains data files that don't change after installation. Other data files
2129: belong into ${VARBASE}.
2130:
2131: libexec
2132:
2133: Contains programs that are not intended to be used by end users, such as
2134: helper programs or network daemons.
2135:
2136: libexec/cgi-bin
2137:
2138: Contains programs that are intended to be executed as CGI scripts by a web
2139: server.
2140:
2141: man (the usual value of ${PKGMANDIR})
2142:
2143: Contains brief documentation in form of manual pages.
2144:
2145: sbin
2146:
2147: Contains programs that are intended to be used only by the super-user.
2148:
2149: share
2150:
2151: Contains platform-independent data files that don't change after
2152: installation.
2153:
2154: share/doc
2155:
2156: Contains documentation files provided by the packages.
2157:
2158: share/examples
2159:
2160: Contains example files provided by the packages. Among others, the original
2161: configuration files are saved here and copied to ${PKG_SYSCONFDIR} during
2162: installation.
2163:
2164: share/examples/rc.d
2165:
2166: Contains the original files for rc.d scripts.
2167:
2168: var (the usual location of ${VARBASE})
2169:
2170: Contains files that may be modified after installation.
2171:
1.154 rillig 2172: 9.2. File system layout in ${VARBASE}
1.1 dsieger 2173:
2174: db/pkg (the usual location of ${PKG_DBDIR})
2175:
2176: Contains information about the currently installed packages.
2177:
2178: games
2179:
2180: Contains highscore files.
2181:
2182: log
2183:
2184: Contains log files.
2185:
2186: run
2187:
2188: Contains informational files about daemons that are currently running.
2189:
1.154 rillig 2190: Chapter 10. Frequently Asked Questions
1.1 dsieger 2191:
2192: Table of Contents
2193:
1.154 rillig 2194: 10.1. Are there any mailing lists for pkg-related discussion?
2195: 10.2. Utilities for package management (pkgtools)
2196: 10.3. How to use pkgsrc as non-root
2197: 10.4. How to resume transfers when fetching distfiles?
2198: 10.5. How can I install/use modular X.org from pkgsrc?
2199: 10.6. How to fetch files from behind a firewall
2200: 10.7. How to fetch files from HTTPS sites
2201: 10.8. How do I tell make fetch to do passive FTP?
2202: 10.9. How to fetch all distfiles at once
2203: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
2204: 10.11. What does "Could not find bsd.own.mk" mean?
1.221 nia 2205: 10.12. Using 'sudo' or `priv` with pkgsrc
1.154 rillig 2206: 10.13. How do I change the location of configuration files?
2207: 10.14. Automated security checks
2208: 10.15. Why do some packages ignore my CFLAGS?
2209: 10.16. A package does not build. What shall I do?
2210: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.259 leot 2211: conflicts" mean?
1.1 dsieger 2212:
2213: This section contains hints, tips & tricks on special things in pkgsrc that we
2214: didn't find a better place for in the previous chapters, and it contains items
2215: for both pkgsrc users and developers.
2216:
1.154 rillig 2217: 10.1. Are there any mailing lists for pkg-related discussion?
1.1 dsieger 2218:
2219: The following mailing lists may be of interest to pkgsrc users:
2220:
2221: * pkgsrc-users: This is a general purpose list for most issues regarding
2222: pkgsrc, regardless of platform, e.g. soliciting user help for pkgsrc
2223: configuration, unexpected build failures, using particular packages,
2224: upgrading pkgsrc installations, questions regarding the pkgsrc release
2225: branches, etc. General announcements or proposals for changes that impact
2226: the pkgsrc user community, e.g. major infrastructure changes, new features,
2227: package removals, etc., may also be posted.
2228:
2229: * pkgsrc-bulk: A list where the results of pkgsrc bulk builds are sent and
2230: discussed.
2231:
2232: * pkgsrc-changes: This list is for those who are interested in getting a
2233: commit message for every change committed to pkgsrc. It is also available
2234: in digest form, meaning one daily message containing all commit messages
2235: for changes to the package source tree in that 24 hour period.
2236:
2237: To subscribe, do:
2238:
2239: % echo subscribe listname | mail majordomo@NetBSD.org
2240:
1.174 leot 2241: Archives for all these mailing lists are available from https://
1.1 dsieger 2242: mail-index.NetBSD.org/.
2243:
1.154 rillig 2244: 10.2. Utilities for package management (pkgtools)
1.1 dsieger 2245:
2246: The directory pkgsrc/pkgtools contains a number of useful utilities for both
2247: users and developers of pkgsrc. This section attempts only to make the reader
1.121 sevan 2248: aware of some of the utilities and when they might be useful, and not to
2249: duplicate the documentation that comes with each package.
1.1 dsieger 2250:
2251: Utilities used by pkgsrc (automatically installed when needed):
2252:
2253: * pkgtools/x11-links: Symlinks for use by buildlink.
2254:
2255: OS tool augmentation (automatically installed when needed):
2256:
1.121 sevan 2257: * pkgtools/digest: Calculates various kinds of checksums (including SHA3).
1.1 dsieger 2258:
2259: * pkgtools/libnbcompat: Compatibility library for pkgsrc tools.
2260:
2261: * pkgtools/mtree: Installed on non-BSD systems due to lack of native mtree.
2262:
2263: * pkgtools/pkg_install: Up-to-date replacement for /usr/sbin/pkg_install, or
2264: for use on operating systems where pkg_install is not present.
2265:
2266: Utilities used by pkgsrc (not automatically installed):
2267:
2268: * pkgtools/pkg_tarup: Create a binary package from an already-installed
2269: package. Used by make replace to save the old package.
2270:
2271: * pkgtools/dfdisk: Adds extra functionality to pkgsrc, allowing it to fetch
2272: distfiles from multiple locations. It currently supports the following
2273: methods: multiple CD-ROMs and network FTP/HTTP connections.
2274:
2275: * devel/cpuflags: Determine the best compiler flags to optimise code for your
1.24 wiz 2276: current CPU and compiler.
1.1 dsieger 2277:
2278: Utilities for keeping track of installed packages, being up to date, etc:
2279:
1.65 wiz 2280: * pkgtools/pkgin: A package update tool similar to apt(1). Download, install,
2281: and upgrade binary packages easily.
2282:
1.1 dsieger 2283: * pkgtools/pkg_chk: Reports on packages whose installed versions do not match
2284: the latest pkgsrc entries.
2285:
2286: * pkgtools/pkgdep: Makes dependency graphs of packages, to aid in choosing a
2287: strategy for updating.
2288:
2289: * pkgtools/pkgdepgraph: Makes graphs from the output of pkgtools/pkgdep (uses
2290: graphviz).
2291:
1.12 weinem 2292: * pkgtools/pkglint: The pkglint(1) program checks a pkgsrc entry for errors.
2293:
2294: * pkgtools/lintpkgsrc: The lintpkgsrc(1) program does various checks on the
2295: complete pkgsrc system.
1.1 dsieger 2296:
2297: * pkgtools/pkgsurvey: Report what packages you have installed.
2298:
2299: Utilities for people maintaining or creating individual packages:
2300:
2301: * pkgtools/pkgdiff: Automate making and maintaining patches for a package
2302: (includes pkgdiff, pkgvi, mkpatches, etc.).
2303:
1.65 wiz 2304: * pkgtools/url2pkg: Aids in converting to pkgsrc.
1.1 dsieger 2305:
2306: Utilities for people maintaining pkgsrc (or: more obscure pkg utilities)
2307:
2308: * pkgtools/pkg_comp: Build packages in a chrooted area.
2309:
2310: * pkgtools/libkver: Spoof kernel version for chrooted cross builds.
2311:
1.154 rillig 2312: 10.3. How to use pkgsrc as non-root
1.1 dsieger 2313:
1.108 rillig 2314: To install packages from source as a non-root user, download pkgsrc as
1.154 rillig 2315: described in Chapter 3, Where to get pkgsrc and how to keep it up-to-date, cd
1.108 rillig 2316: into that directory and run the command ./bootstrap/bootstrap --unprivileged.
2317:
2318: This will install the binary part of pkgsrc to ~/pkg and put the pkgsrc
2319: configuration mk.conf into ~/pkg/etc.
2320:
2321: For more details, see mk/unprivileged.mk.
1.1 dsieger 2322:
1.154 rillig 2323: 10.4. How to resume transfers when fetching distfiles?
1.1 dsieger 2324:
2325: By default, resuming transfers in pkgsrc is disabled, but you can enable this
1.4 rillig 2326: feature by adding the option PKG_RESUME_TRANSFERS=YES into mk.conf. If, during
2327: a fetch step, an incomplete distfile is found, pkgsrc will try to resume it.
1.1 dsieger 2328:
1.61 wiz 2329: You can also use a different program than the platform default program by
2330: changing the FETCH_USING variable. You can specify the program by using of ftp,
2331: fetch, wget or curl. Alternatively, fetching can be disabled by using the value
2332: manual. A value of custom disables the system defaults and dependency tracking
2333: for the fetch program. In that case you have to provide FETCH_CMD,
2334: FETCH_BEFORE_ARGS, FETCH_RESUME_ARGS, FETCH_OUTPUT_ARGS, FETCH_AFTER_ARGS.
1.1 dsieger 2335:
1.16 jnemeth 2336: For example, if you want to use wget to download, you'll have to use something
2337: like:
1.1 dsieger 2338:
1.16 jnemeth 2339: FETCH_USING= wget
1.1 dsieger 2340:
1.154 rillig 2341: 10.5. How can I install/use modular X.org from pkgsrc?
1.1 dsieger 2342:
1.4 rillig 2343: If you want to use modular X.org from pkgsrc instead of your system's own X11
2344: (/usr/X11R6, /usr/openwin, ...) you will have to add the following line into
1.1 dsieger 2345: mk.conf:
2346:
1.4 rillig 2347: X11_TYPE=modular
1.1 dsieger 2348:
1.154 rillig 2349: 10.6. How to fetch files from behind a firewall
1.1 dsieger 2350:
2351: If you are sitting behind a firewall which does not allow direct connections to
2352: Internet hosts (i.e. non-NAT), you may specify the relevant proxy hosts. This
2353: is done using an environment variable in the form of a URL, e.g. in Amdahl, the
2354: machine "orpheus.amdahl.com" is one of the firewalls, and it uses port 80 as
2355: the proxy port number. So the proxy environment variables are:
2356:
2357: ftp_proxy=ftp://orpheus.amdahl.com:80/
2358: http_proxy=http://orpheus.amdahl.com:80/
2359:
1.154 rillig 2360: 10.7. How to fetch files from HTTPS sites
1.65 wiz 2361:
2362: Some fetch tools are not prepared to support HTTPS by default (for example, the
2363: one in NetBSD 6.0), or the one installed by the pkgsrc bootstrap (to avoid an
2364: openssl dependency that low in the dependency graph).
2365:
2366: Usually you won't notice, because distribution files are mirrored weekly to "
2367: ftp.NetBSD.org", but that might not be often enough if you are following
2368: pkgsrc-current. In that case, set FETCH_USING in your mk.conf file to "curl" or
2369: "wget", which are both compiled with HTTPS support by default. Of course, these
2370: tools need to be installed before you can use them this way.
2371:
1.154 rillig 2372: 10.8. How do I tell make fetch to do passive FTP?
1.1 dsieger 2373:
2374: This depends on which utility is used to retrieve distfiles. From bsd.pkg.mk,
2375: FETCH_CMD is assigned the first available command from the following list:
2376:
2377: * ${LOCALBASE}/bin/ftp
2378:
2379: * /usr/bin/ftp
2380:
2381: On a default NetBSD installation, this will be /usr/bin/ftp, which
2382: automatically tries passive connections first, and falls back to active
2383: connections if the server refuses to do passive. For the other tools, add the
1.4 rillig 2384: following to your mk.conf file: PASSIVE_FETCH=1.
1.1 dsieger 2385:
2386: Having that option present will prevent /usr/bin/ftp from falling back to
2387: active transfers.
2388:
1.154 rillig 2389: 10.9. How to fetch all distfiles at once
1.1 dsieger 2390:
2391: You would like to download all the distfiles in a single batch from work or
2392: university, where you can't run a make fetch. There is an archive of distfiles
2393: on ftp.NetBSD.org, but downloading the entire directory may not be appropriate.
2394:
2395: The answer here is to do a make fetch-list in /usr/pkgsrc or one of its
2396: subdirectories, carry the resulting list to your machine at work/school and use
2397: it there. If you don't have a NetBSD-compatible ftp(1) (like tnftp) at work,
2398: don't forget to set FETCH_CMD to something that fetches a URL:
2399:
2400: At home:
2401:
2402: % cd /usr/pkgsrc
2403: % make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh
2404: % scp /tmp/fetch.sh work:/tmp
2405:
2406: At work:
2407:
2408: % sh /tmp/fetch.sh
2409:
2410: then tar up /tmp/distfiles and take it home.
2411:
2412: If you have a machine running NetBSD, and you want to get all distfiles (even
2413: ones that aren't for your machine architecture), you can do so by using the
2414: above-mentioned make fetch-list approach, or fetch the distfiles directly by
2415: running:
2416:
2417: % make mirror-distfiles
2418:
2419: If you even decide to ignore NO_{SRC,BIN}_ON_{FTP,CDROM}, then you can get
2420: everything by running:
2421:
2422: % make fetch NO_SKIP=yes
2423:
1.154 rillig 2424: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
1.1 dsieger 2425:
2426: When compiling the pkgtools/pkg_install package, you get the error from make
2427: that it doesn't know how to make /usr/share/tmac/tmac.andoc? This indicates
2428: that you don't have installed the "text" set (nroff, ...) from the NetBSD base
2429: distribution on your machine. It is recommended to do that to format man pages.
2430:
2431: In the case of the pkgtools/pkg_install package, you can get away with setting
1.4 rillig 2432: NOMAN=YES either in the environment or in mk.conf.
1.1 dsieger 2433:
1.154 rillig 2434: 10.11. What does "Could not find bsd.own.mk" mean?
1.1 dsieger 2435:
2436: You didn't install the compiler set, comp.tgz, when you installed your NetBSD
2437: machine. Please get and install it, by extracting it in /:
2438:
2439: # cd /
2440: # tar --unlink -zxvpf .../comp.tgz
2441:
2442: comp.tgz is part of every NetBSD release. Get the one that corresponds to your
2443: release (determine via uname -r).
2444:
1.221 nia 2445: 10.12. Using 'sudo' or `priv` with pkgsrc
1.1 dsieger 2446:
2447: When installing packages as non-root user and using the just-in-time su(1)
2448: feature of pkgsrc, it can become annoying to type in the root password for each
2449: required package installed. To avoid this, the sudo package can be used, which
1.221 nia 2450: does password caching over a limited time. To use it, install sudo or priv
2451: (either as binary package, from security/priv, or security/sudo) and then put
2452: the following into your mk.conf, somewhere after the definition of the
2453: LOCALBASE variable:
1.1 dsieger 2454:
2455: .if exists(${LOCALBASE}/bin/sudo)
1.260 ! wiz 2456: SU_CMD= ${LOCALBASE}/bin/sudo -E /bin/sh -c
1.1 dsieger 2457: .endif
2458:
1.260 ! wiz 2459: Note the -E flag; that tells sudo to preserve the environment. Without this,
! 2460: the bin-install target will fail when building a package with a non-default
! 2461: python version.
! 2462:
1.154 rillig 2463: 10.13. How do I change the location of configuration files?
1.1 dsieger 2464:
2465: As the system administrator, you can choose where configuration files are
2466: installed. The default settings make all these files go into ${PREFIX}/etc or
2467: some of its subdirectories; this may be suboptimal depending on your
2468: expectations (e.g., a read-only, NFS-exported PREFIX with a need of per-machine
2469: configuration of the provided packages).
2470:
2471: In order to change the defaults, you can modify the PKG_SYSCONFBASE variable
1.4 rillig 2472: (in mk.conf) to point to your preferred configuration directory; some common
2473: examples include /etc or /etc/pkg.
1.1 dsieger 2474:
2475: Furthermore, you can change this value on a per-package basis by setting the
2476: PKG_SYSCONFDIR.${PKG_SYSCONFVAR} variable. PKG_SYSCONFVAR's value usually
2477: matches the name of the package you would like to modify, that is, the contents
2478: of PKGBASE.
2479:
2480: Note that after changing these settings, you must rebuild and reinstall any
2481: affected packages.
2482:
1.154 rillig 2483: 10.14. Automated security checks
1.1 dsieger 2484:
2485: Please be aware that there can often be bugs in third-party software, and some
2486: of these bugs can leave a machine vulnerable to exploitation by attackers. In
2487: an effort to lessen the exposure, the NetBSD packages team maintains a database
2488: of known-exploits to packages which have at one time been included in pkgsrc.
2489: The database can be downloaded automatically, and a security audit of all
1.14 jmcneill 2490: packages installed on a system can take place. To do this, refer to the
2491: following two tools (installed as part of the pkgtools/pkg_install package):
1.1 dsieger 2492:
1.21 snj 2493: 1. pkg_admin fetch-pkg-vulnerabilities, an easy way to download a list of the
2494: security vulnerabilities information. This list is kept up to date by the
1.26 spz 2495: pkgsrc security team, and is distributed from the NetBSD ftp server:
1.1 dsieger 2496:
1.177 leot 2497: https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities
1.1 dsieger 2498:
1.21 snj 2499: 2. pkg_admin audit, an easy way to audit the current machine, checking each
1.24 wiz 2500: known vulnerability. If a vulnerable package is installed, it will be shown
2501: by output to stdout, including a description of the type of vulnerability,
2502: and a URL containing more information.
1.1 dsieger 2503:
1.202 nia 2504: Use of these tools is strongly recommended! See Section 5.1.6, "Checking for
1.121 sevan 2505: security vulnerabilities in installed packages" for instructions on how to
2506: automate checking and reporting.
2507:
2508: If this database is installed, pkgsrc builds will use it to perform a security
2509: check before building any package.
1.1 dsieger 2510:
1.154 rillig 2511: 10.15. Why do some packages ignore my CFLAGS?
1.1 dsieger 2512:
2513: When you add your own preferences to the CFLAGS variable in your mk.conf, these
2514: flags are passed in environment variables to the ./configure scripts and to
2515: make(1). Some package authors ignore the CFLAGS from the environment variable
2516: by overriding them in the Makefiles of their package.
2517:
2518: Currently there is no solution to this problem. If you really need the package
2519: to use your CFLAGS you should run make patch in the package directory and then
2520: inspect any Makefile and Makefile.in for whether they define CFLAGS explicitly.
2521: Usually you can remove these lines. But be aware that some "smart" programmers
2522: write so bad code that it only works for the specific combination of CFLAGS
2523: they have chosen.
2524:
1.172 rillig 2525: To find out where the CFLAGS are ignored, add the following lines to mk.conf:
2526:
2527: CPPFLAGS+= -Dpkgsrc___CPPFLAGS
2528: CFLAGS+= -Dpkgsrc___CFLAGS
2529: CXXFLAGS+= -Dpkgsrc___CXXFLAGS
2530:
2531: Then run bmake show-all-configure show-all-build to see whether the above flags
2532: are passed to the actual build commands in general.
2533:
2534: To find out whether the flags are passed to individual compiler commands, have
2535: a look at the file work/.work.log. In most cases, the flags from the original
2536: command lines (the lines starting with [*]) are passed unmodified to the actual
2537: compiler (the lines starting with <.>). If the flag is missing from the actual
2538: compiler command, it must have been removed by the pkgsrc compiler wrappers.
2539:
1.154 rillig 2540: 10.16. A package does not build. What shall I do?
1.1 dsieger 2541:
2542: 1. Make sure that your copy of pkgsrc is consistent. A case that occurs often
2543: is that people only update pkgsrc in parts, because of performance reasons.
2544: Since pkgsrc is one large system, not a collection of many small systems,
2545: there are sometimes changes that only work when the whole pkgsrc tree is
2546: updated.
2547:
1.25 wiz 2548: 2. Make sure that you don't have any CVS conflicts. Search for "<<<<<<" or "
2549: >>>>>>" in all your pkgsrc files.
1.1 dsieger 2550:
1.25 wiz 2551: 3. Make sure that you don't have old copies of the packages extracted. Run
1.1 dsieger 2552: make clean clean-depends to verify this.
2553:
1.108 rillig 2554: 4. If you are a package developer who wants to invest some work, have a look
1.154 rillig 2555: at Chapter 21, Making your package work.
1.108 rillig 2556:
2557: 5. If the problem still exists, write a mail to the pkgsrc-users mailing list.
1.1 dsieger 2558:
1.154 rillig 2559: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.1 dsieger 2560: conflicts" mean?
2561:
2562: You have modified a file from pkgsrc, and someone else has modified that same
2563: file afterwards in the CVS repository. Both changes are in the same region of
2564: the file, so when you updated pkgsrc, the cvs command marked the conflicting
2565: changes in the file. Because of these markers, the file is no longer a valid
2566: Makefile.
2567:
2568: Have a look at that file, and if you don't need your local changes anymore, you
2569: can remove that file and run cvs -q update -dP in that directory to download
2570: the current version.
2571:
2572: Part II. The pkgsrc developer's guide
2573:
2574: This part of the book deals with creating and modifying packages. It starts
2575: with a "HOWTO"-like guide on creating a new package. The remaining chapters are
2576: more like a reference manual for pkgsrc.
2577:
2578: Table of Contents
2579:
1.154 rillig 2580: 11. Getting help
1.184 rillig 2581: 12. Package components - files, directories and contents
2582: 12.1. Makefile
2583: 12.2. distinfo
2584: 12.3. patches/*
2585: 12.3.1. Structure of a single patch file
2586: 12.3.2. Creating patch files
2587: 12.3.3. Sources where the patch files come from
2588: 12.3.4. Patching guidelines
2589: 12.3.5. Feedback to the author
2590: 12.4. Other mandatory files
2591: 12.5. Optional files
2592: 12.5.1. Files affecting the binary package
2593: 12.5.2. Files affecting the build process
2594: 12.5.3. Files affecting nothing at all
2595: 12.6. work*
2596: 12.7. files/*
2597: 13. The build process
2598: 13.1. Introduction
2599: 13.2. Program location
2600: 13.3. Directories used during the build process
2601: 13.4. Running a phase
2602: 13.5. The fetch phase
2603: 13.5.1. What to fetch and where to get it from
2604: 13.5.2. How are the files fetched?
2605: 13.6. The checksum phase
2606: 13.7. The extract phase
2607: 13.8. The patch phase
2608: 13.9. The tools phase
2609: 13.10. The wrapper phase
2610: 13.11. The configure phase
2611: 13.12. The build phase
2612: 13.13. The test phase
2613: 13.14. The install phase
2614: 13.15. The package phase
2615: 13.16. Cleaning up
2616: 13.17. Other helpful targets
2617: 14. Creating a new pkgsrc package from scratch
2618: 14.1. Common types of packages
1.219 nia 2619: 14.1.1. Python modules and programs
2620: 14.1.2. R packages
2621: 14.1.3. TeXlive packages
1.184 rillig 2622: 14.2. Examples
2623: 14.2.1. How the www/nvu package came into pkgsrc
2624: 15. Programming in Makefiles
2625: 15.1. Caveats
2626: 15.2. Makefile variables
2627: 15.2.1. Naming conventions
2628: 15.3. Code snippets
2629: 15.3.1. Adding things to a list
2630: 15.3.2. Echoing a string exactly as-is
2631: 15.3.3. Passing CFLAGS to GNU configure scripts
2632: 15.3.4. Handling possibly empty variables
1.229 gutterid 2633: 15.3.5. Testing yes/no variables in conditions
1.184 rillig 2634: 16. Options handling
2635: 16.1. Global default options
2636: 16.2. Converting packages to use bsd.options.mk
2637: 16.3. Option Names
2638: 16.4. Determining the options of dependencies
2639: 17. Tools needed for building or running
2640: 17.1. Tools for pkgsrc builds
2641: 17.2. Tools needed by packages
2642: 17.3. Tools provided by platforms
2643: 18. Buildlink methodology
2644: 18.1. Converting packages to use buildlink3
2645: 18.2. Writing buildlink3.mk files
2646: 18.2.1. Anatomy of a buildlink3.mk file
2647: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.
1.259 leot 2648: pkg in buildlink3.mk files
1.184 rillig 2649: 18.3. Writing builtin.mk files
2650: 18.3.1. Anatomy of a builtin.mk file
2651: 19. PLIST issues
2652: 19.1. RCS ID
2653: 19.2. Semi-automatic PLIST generation
2654: 19.3. Tweaking output of make print-PLIST
2655: 19.4. Variable substitution in PLIST
2656: 19.5. Man page compression
2657: 19.6. Changing PLIST source with PLIST_SRC
2658: 19.7. Platform-specific and differing PLISTs
2659: 19.8. Build-specific PLISTs
2660: 19.9. Sharing directories between packages
2661: 20. The pkginstall framework
2662: 20.1. Files and directories outside the installation prefix
2663: 20.1.1. Directory manipulation
2664: 20.1.2. File manipulation
2665: 20.2. Configuration files
2666: 20.2.1. How PKG_SYSCONFDIR is set
2667: 20.2.2. Telling the software where configuration files are
1.239 dholland 2668: 20.2.3. Patching installation
2669: 20.2.4. Declaring configuration files
2670: 20.2.5. Disabling handling of configuration files
1.184 rillig 2671: 20.3. System startup scripts
2672: 20.3.1. Disabling handling of system startup scripts
2673: 20.4. System users and groups
2674: 20.5. System shells
2675: 20.5.1. Disabling shell registration
2676: 20.6. Fonts
2677: 20.6.1. Disabling automatic update of the fonts databases
1.154 rillig 2678: 21. Making your package work
2679: 21.1. General operation
2680: 21.1.1. How to pull in user-settable variables from mk.conf
2681: 21.1.2. User interaction
2682: 21.1.3. Handling licenses
2683: 21.1.4. Restricted packages
2684: 21.1.5. Handling dependencies
2685: 21.1.6. Handling conflicts with other packages
2686: 21.1.7. Packages that cannot or should not be built
2687: 21.1.8. Packages which should not be deleted, once installed
2688: 21.1.9. Handling packages with security problems
2689: 21.1.10. How to handle incrementing versions when fixing an existing
1.259 leot 2690: package
1.154 rillig 2691: 21.1.11. Substituting variable text in the package files (the SUBST
1.259 leot 2692: framework)
1.154 rillig 2693: 21.2. The fetch phase
2694: 21.2.1. Packages whose distfiles aren't available for plain downloading
2695: 21.2.2. How to handle modified distfiles with the 'old' name
2696: 21.2.3. Packages hosted on github.com
2697: 21.3. The configure phase
2698: 21.3.1. Shared libraries - libtool
2699: 21.3.2. Using libtool on GNU packages that already support libtool
2700: 21.3.3. GNU Autoconf/Automake
1.223 nia 2701: 21.3.4. Meson / ninja
1.260 ! wiz 2702: 21.3.5. Determining the endianness
1.154 rillig 2703: 21.4. Programming languages
2704: 21.4.1. C, C++, and Fortran
2705: 21.4.2. Java
1.205 wiz 2706: 21.4.3. Go
1.223 nia 2707: 21.4.4. Rust
2708: 21.4.5. Packages containing Perl scripts
2709: 21.4.6. Packages containing shell scripts
2710: 21.4.7. Other programming languages
1.154 rillig 2711: 21.5. The build phase
2712: 21.5.1. Compiling C and C++ code conditionally
2713: 21.5.2. How to handle compiler bugs
1.172 rillig 2714: 21.5.3. No such file or directory
2715: 21.5.4. Undefined reference to "..."
2716: 21.5.5. Running out of memory
1.154 rillig 2717: 21.6. The install phase
2718: 21.6.1. Creating needed directories
2719: 21.6.2. Where to install documentation
2720: 21.6.3. Installing highscore files
2721: 21.6.4. Adding DESTDIR support to packages
2722: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 2723: 21.6.6. Packages installing Perl modules
1.254 wiz 2724: 21.6.7. Packages installing pkg-config files
2725: 21.6.8. Packages installing info files
2726: 21.6.9. Packages installing man pages
2727: 21.6.10. Packages installing X11 fonts
2728: 21.6.11. Packages installing SGML or XML data
2729: 21.6.12. Packages installing extensions to the MIME database
2730: 21.6.13. Packages using intltool
2731: 21.6.14. Packages installing startup scripts
2732: 21.6.15. Packages installing TeX modules
2733: 21.6.16. Packages supporting running binaries in emulation
2734: 21.6.17. Packages installing hicolor icons
2735: 21.6.18. Packages installing desktop files
1.154 rillig 2736: 21.7. Marking packages as having problems
1.184 rillig 2737: 22. GNOME packaging and porting
2738: 22.1. Meta packages
2739: 22.2. Packaging a GNOME application
2740: 22.3. Updating GNOME to a newer version
2741: 22.4. Patching guidelines
1.154 rillig 2742: 23. Submitting and Committing
2743: 23.1. Submitting binary packages
2744: 23.2. Submitting source packages (for non-NetBSD-developers)
2745: 23.3. General notes when adding, updating, or removing packages
2746: 23.4. Commit Messages
2747: 23.5. Committing: Adding a package to CVS
2748: 23.6. Updating a package to a newer version
2749: 23.7. Renaming a package in pkgsrc
2750: 23.8. Moving a package in pkgsrc
2751: 24. Frequently Asked Questions
2752:
2753: Chapter 11. Getting help
2754:
2755: To get help when developing pkgsrc, the definitive source is this document, the
2756: pkgsrc guide. If you don't find anything here, there are alternatives:
2757:
2758: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
2759: Run bmake help topic=? to get help for any topic, such as a variable name
2760: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
2761: like strcasecmp or any other topic.
2762:
1.207 leot 2763: The available help topics are listed in Appendix E, Help topics.
1.154 rillig 2764:
1.163 rillig 2765: * To see the value of a single variable, run bmake show-var VARNAME=X.
2766:
2767: * To see the values of the most common variables, run bmake show-all. These
2768: variables are grouped by topic. To see the variables for a single topic,
2769: run bmake show-all-topic, for example bmake show-all-fetch.
2770:
1.154 rillig 2771: * The tech-pkg mailing list, to which you can subscribe and then ask your
2772: questions.
2773:
2774: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
2775: a specialized chat program such as XChat. Pick any user name and join the
2776: channel #pkgsrc.
1.1 dsieger 2777:
1.184 rillig 2778: Chapter 12. Package components - files, directories and contents
1.1 dsieger 2779:
2780: Table of Contents
2781:
1.184 rillig 2782: 12.1. Makefile
2783: 12.2. distinfo
2784: 12.3. patches/*
2785: 12.3.1. Structure of a single patch file
2786: 12.3.2. Creating patch files
2787: 12.3.3. Sources where the patch files come from
2788: 12.3.4. Patching guidelines
2789: 12.3.5. Feedback to the author
2790: 12.4. Other mandatory files
2791: 12.5. Optional files
2792: 12.5.1. Files affecting the binary package
2793: 12.5.2. Files affecting the build process
2794: 12.5.3. Files affecting nothing at all
2795: 12.6. work*
2796: 12.7. files/*
1.1 dsieger 2797:
1.184 rillig 2798: Whenever you're preparing a package, there are a number of files involved which
2799: are described in the following sections.
1.1 dsieger 2800:
1.184 rillig 2801: 12.1. Makefile
1.1 dsieger 2802:
1.184 rillig 2803: Building, installation and creation of a binary package are all controlled by
2804: the package's Makefile. The Makefile describes various things about a package,
2805: for example from where to get it, how to configure, build, and install it.
1.1 dsieger 2806:
1.184 rillig 2807: A package Makefile contains several sections that describe the package.
1.1 dsieger 2808:
1.184 rillig 2809: In the first section there are the following variables, which should appear
2810: exactly in the order given here. The order and grouping of the variables is
2811: mostly historical and has no further meaning.
1.1 dsieger 2812:
1.184 rillig 2813: * DISTNAME is the basename of the distribution file to be downloaded from the
2814: package's website.
1.1 dsieger 2815:
1.184 rillig 2816: * PKGNAME is the name of the package, as used by pkgsrc. You need to provide
2817: it if DISTNAME (which is the default) is not a good name for the package in
2818: pkgsrc or DISTNAME is not provided (no distribution file is required).
2819: Usually it is the pkgsrc directory name together with the version number.
2820: It must match the regular expression ^[A-Za-z0-9][A-Za-z0-9-_.+]*$, that
2821: is, it starts with a letter or digit, and contains only letters, digits,
1.204 nia 2822: dashes, underscores, dots and plus signs. New packages should have entirely
2823: lower-case names, with the exception of some that must follow pre-existing
2824: conventions (e.g. R packages begin with R-). You can use the :tl variable
2825: modifier to lower-case the package name.
1.26 spz 2826:
1.184 rillig 2827: * CATEGORIES is a list of categories which the package fits in. You can
2828: choose any of the top-level directories of pkgsrc for it.
1.1 dsieger 2829:
1.184 rillig 2830: Currently the following values are available for CATEGORIES. If more than
2831: one is used, they need to be separated by spaces:
1.1 dsieger 2832:
1.184 rillig 2833: archivers cross geography meta-pkgs security
2834: audio databases graphics misc shells
2835: benchmarks devel ham multimedia sysutils
2836: biology editors inputmethod net textproc
2837: cad emulators lang news time
2838: chat finance mail parallel wm
2839: comms fonts math pkgtools www
2840: converters games mbone print x11
1.1 dsieger 2841:
1.184 rillig 2842: * MASTER_SITES, DYNAMIC_MASTER_SITES, DIST_SUBDIR, EXTRACT_SUFX and DISTFILES
2843: are discussed in detail in Section 13.5, "The fetch phase".
1.1 dsieger 2844:
1.184 rillig 2845: The second section contains information about separately downloaded patches, if
2846: any.
1.1 dsieger 2847:
1.184 rillig 2848: * PATCHFILES: Name(s) of additional files that contain distribution patches.
2849: There is no default. pkgsrc will look for them at PATCH_SITES. They will
2850: automatically be uncompressed before patching if the names end with .gz or
2851: .Z.
1.1 dsieger 2852:
1.184 rillig 2853: * PATCH_SITES: Primary location(s) for distribution patch files (see
2854: PATCHFILES above) if not found locally.
1.1 dsieger 2855:
1.184 rillig 2856: * PATCH_DIST_STRIP: an argument to patch(1) that sets the pathname strip
2857: count to help find the correct files to patch. It defaults to -p0.
1.1 dsieger 2858:
1.184 rillig 2859: The third section contains the following variables.
1.1 dsieger 2860:
1.253 gutterid 2861: * MAINTAINER is the email address of the person who is currently responsible
2862: for this package. In theory, the maintainer will be aware of upstream
2863: release, keep it updated, and generally resolve problems. Others
2864: contemplating significant changes should ask the maintainer for advice or
2865: review of a proposed change. This is not necessary for micro updates, bug
2866: fixes, pkgsrc-wide changes affecting many packages, and other things
2867: expected to be uncontroversial. It goes with this "should ask" that the
2868: maintainer should respond to inquiries reasonably promptly (most of the
2869: time), and either approve changes or provide reasons why not. Typically,
2870: when packaging a new program, set MAINTAINER to yourself. If you don't
2871: intend to maintain the package (especially if you feel you have no special
2872: insight), set it to <pkgsrc-users@NetBSD.org>. This special value is a code
2873: point indicating that there is no maintainer, but the variable is
2874: mandatory, absent OWNER.
2875:
2876: * OWNER can be used instead of MAINTAINER in relatively rare circumstances
2877: when the package is such that modifying it is riskier than normal. This is
2878: a stronger form of being the maintainer, with an expectation that others
2879: will ask for almost all changes, except revbumps and accommodating
2880: structural changes. Someone who becomes OWNER has a strong obligation to
2881: keep the package very well maintained, to answer queries promptly and to be
2882: a steward of the package on behalf of users. In this case, MAINTAINER
2883: should be omitted.
2884:
2885: Because of the friction that OWNER adds, PMC may downgrade it to MAINTAINER
2886: at any time.
1.1 dsieger 2887:
1.184 rillig 2888: * HOMEPAGE is a URL where users can find more information about the package.
1.1 dsieger 2889:
1.184 rillig 2890: * COMMENT is a one-line description of the package (should not include the
2891: package name).
1.1 dsieger 2892:
1.184 rillig 2893: * LICENSE indicates the license(s) applicable for the package. See
2894: Section 21.1.3, "Handling licenses" for further details.
1.1 dsieger 2895:
1.184 rillig 2896: Other variables that affect the build:
1.1 dsieger 2897:
1.184 rillig 2898: * WRKSRC: The directory where the interesting distribution files of the
2899: package are found. The default is ${WRKDIR}/${DISTNAME}, which works for
2900: most packages.
1.1 dsieger 2901:
1.184 rillig 2902: If a package doesn't create a subdirectory for itself (most GNU software
2903: does, for instance), but extracts itself in the current directory, you
2904: should set WRKSRC=${WRKDIR}.
1.1 dsieger 2905:
1.184 rillig 2906: If a package doesn't create a subdirectory with the name of DISTNAME but
2907: some different name, set WRKSRC to point to the proper name in ${WRKDIR},
2908: for example WRKSRC=${WRKDIR}/${DISTNAME}/unix. See lang/tcl and x11/tk for
2909: other examples.
1.17 imil 2910:
1.184 rillig 2911: The name of the working directory created by pkgsrc is taken from the
2912: WRKDIR_BASENAME variable. By default, its value is work. If you want to use
2913: the same pkgsrc tree for building different kinds of binary packages, you
2914: can change the variable according to your needs. Two other variables handle
2915: common cases of setting WRKDIR_BASENAME individually. If OBJHOSTNAME is
2916: defined in mk.conf, the first component of the host's name is attached to
2917: the directory name. If OBJMACHINE is defined, the platform name is
2918: attached, which might look like work.i386 or work.sparc.
1.17 imil 2919:
1.184 rillig 2920: Please pay attention to the following gotchas:
1.17 imil 2921:
1.184 rillig 2922: * Add MANCOMPRESSED if man pages are installed in compressed form by the
2923: package. For packages using BSD-style makefiles which honor MANZ, there is
2924: MANCOMPRESSED_IF_MANZ.
1.17 imil 2925:
1.184 rillig 2926: * Replace /usr/local with "${PREFIX}" in all files (see patches, below).
1.103 wiz 2927:
1.254 wiz 2928: * If the package installs any info files, see Section 21.6.8, "Packages
1.184 rillig 2929: installing info files".
1.103 wiz 2930:
1.184 rillig 2931: 12.2. distinfo
1.17 imil 2932:
1.184 rillig 2933: The distinfo file contains the message digest, or checksum, of each distfile
2934: needed for the package. This ensures that the distfiles retrieved from the
2935: Internet have not been corrupted during transfer or altered by a malign force
2936: to introduce a security hole. To provide maximum security, all distfiles are
1.243 gutterid 2937: protected using two different message digest algorithms (BLAKE2s and SHA512),
2938: as well as the file size.
1.17 imil 2939:
1.184 rillig 2940: The distinfo file also contains the checksums for all the patches found in the
2941: patches directory (see Section 12.3, "patches/*"). These checksums ensure that
2942: patches are only applied intentionally and that they don't accidentally change,
2943: e.g. when merging different changes together. They also make sure that new
2944: patches are actually added to CVS and old ones are removed. Too see whether the
2945: patches and the distinfo file match, run pkglint after changing the patches.
1.17 imil 2946:
1.184 rillig 2947: To regenerate the distinfo file, use the make distinfo command.
1.17 imil 2948:
1.184 rillig 2949: Some packages have different sets of distfiles depending on the platform, for
2950: example lang/openjdk8. These are kept in the same distinfo file and care should
2951: be taken when upgrading such a package to ensure distfile information is not
2952: lost.
1.17 imil 2953:
1.184 rillig 2954: 12.3. patches/*
1.63 wiz 2955:
1.184 rillig 2956: Some packages don't work out-of-the box on the various platforms that are
2957: supported by pkgsrc. These packages need to be patched to make them work. The
2958: patch files can be found in the patches/ directory.
1.17 imil 2959:
1.184 rillig 2960: In the patch phase, these patches are applied to the files in WRKSRC directory
2961: after extracting them, in alphabetic order.
1.160 brook 2962:
1.184 rillig 2963: 12.3.1. Structure of a single patch file
1.160 brook 2964:
1.184 rillig 2965: The patch-* files should be in diff -bu format, and apply without a fuzz to
2966: avoid problems. (To force patches to apply with fuzz you can set
2967: PATCH_FUZZ_FACTOR=-F2). Furthermore, each patch should contain only changes for
2968: a single file, and no file should be patched by more than one patch file. This
2969: helps to keep future modifications simple.
1.160 brook 2970:
1.184 rillig 2971: Each patch file is structured as follows: In the first line, there is the RCS
2972: Id of the patch itself. The second line should be empty for aesthetic reasons.
2973: After that, there should be a comment for each change that the patch does.
2974: There are a number of standard cases:
1.160 brook 2975:
1.184 rillig 2976: * Patches for commonly known vulnerabilities should mention the vulnerability
2977: ID (CAN, CVE).
1.160 brook 2978:
1.184 rillig 2979: * Patches that change source code should mention the platform and other
2980: environment (for example, the compiler) that the patch is needed for.
1.160 brook 2981:
1.184 rillig 2982: The patch should be commented so that any developer who knows the code of the
2983: application can make some use of the patch. Special care should be taken for
2984: the upstream developers, since we generally want that they accept our patches,
2985: so we have less work in the future.
1.160 brook 2986:
1.184 rillig 2987: 12.3.2. Creating patch files
1.160 brook 2988:
1.184 rillig 2989: One important thing to mention is to pay attention that no RCS IDs get stored
2990: in the patch files, as these will cause problems when later checked into the
2991: NetBSD CVS tree. Use the pkgdiff command from the pkgtools/pkgdiff package to
2992: avoid these problems.
1.160 brook 2993:
1.184 rillig 2994: For even more automation, we recommend using mkpatches from the same package to
1.222 gutterid 2995: make a whole set of patches. You just have to back up files before you edit
2996: them to filename.orig, e.g., with cp -p filename filename.orig or, easier, by
2997: using pkgvi again from the same package. If you upgrade a package this way, you
2998: can easily compare the new set of patches with the previously existing one with
1.184 rillig 2999: patchdiff. The files in patches are replaced by new files, so carefully check
3000: if you want to take all the changes.
1.160 brook 3001:
1.184 rillig 3002: When you have finished a package, remember to generate the checksums for the
3003: patch files by using the make makepatchsum command, see Section 12.2,
3004: "distinfo".
1.1 dsieger 3005:
1.184 rillig 3006: When adding a patch that corrects a problem in the distfile (rather than e.g.
3007: enforcing pkgsrc's view of where man pages should go), send the patch as a bug
3008: report to the maintainer. This benefits non-pkgsrc users of the package, and
3009: usually makes it possible to remove the patch in future version.
1.1 dsieger 3010:
1.184 rillig 3011: The file names of the patch files are usually of the form patch-
3012: path_to_file__with__underscores.c. Many packages still use the previous
3013: convention patch-[a-z][a-z], but new patches should be of the form containing
3014: the filename. mkpatches included in pkgtools/pkgdiff takes care of the name
3015: automatically.
1.1 dsieger 3016:
1.222 gutterid 3017: When updating pre-existing patch files, if a file uses the old patch-[a-z][a-z]
3018: convention, it's best not to change it to the new form, as that will just cause
3019: churn that makes it harder to track changes to patching over time. Similarly,
3020: if a patch now applies at different line offsets, but still applies cleanly
3021: as-is, there's no need to update it, as that also unnecessarily complicates the
3022: patch history.
3023:
1.184 rillig 3024: 12.3.3. Sources where the patch files come from
1.1 dsieger 3025:
1.184 rillig 3026: If you want to share patches between multiple packages in pkgsrc, e.g. because
3027: they use the same distfiles, set PATCHDIR to the path where the patch files can
3028: be found, e.g.:
1.1 dsieger 3029:
1.184 rillig 3030: PATCHDIR= ../../editors/xemacs/patches
1.1 dsieger 3031:
1.184 rillig 3032: Patch files that are distributed by the author or other maintainers can be
3033: listed in PATCHFILES.
1.1 dsieger 3034:
1.184 rillig 3035: If it is desired to store any patches that should not be committed into pkgsrc,
3036: they can be kept outside the pkgsrc tree in the $LOCALPATCHES directory. The
3037: directory tree there is expected to have the same "category/package" structure
3038: as pkgsrc, and patches are expected to be stored inside these dirs (also known
3039: as $LOCALPATCHES/$PKGPATH). For example, if you want to keep a private patch
3040: for pkgsrc/graphics/png, keep it in $LOCALPATCHES/graphics/png/mypatch. All
3041: files in the named directory are expected to be patch files, and they are
3042: applied after pkgsrc patches are applied.
1.1 dsieger 3043:
1.184 rillig 3044: 12.3.4. Patching guidelines
1.1 dsieger 3045:
1.184 rillig 3046: When fixing a portability issue in the code do not use preprocessor magic to
3047: check for the current operating system nor platform. Doing so hurts portability
3048: to other platforms because the OS-specific details are not abstracted
3049: appropriately.
1.1 dsieger 3050:
1.184 rillig 3051: The general rule to follow is: instead of checking for the operating system the
3052: application is being built on, check for the specific features you need. For
3053: example, instead of assuming that kqueue is available under NetBSD and using
3054: the __NetBSD__ macro to conditionalize kqueue support, add a check that detects
1.198 leot 3055: kqueue itself -- yes, this generally involves patching the configure script.
1.184 rillig 3056: There is absolutely nothing that prevents some OSes from adopting interfaces
3057: from other OSes (e.g. Linux implementing kqueue), something that the above
3058: checks cannot take into account.
1.1 dsieger 3059:
1.184 rillig 3060: Of course, checking for features generally involves more work on the
3061: developer's side, but the resulting changes are cleaner and there are chances
3062: they will work on many other platforms. Not to mention that there are higher
3063: chances of being later integrated into the mainstream sources. Remember: It
3064: doesn't work unless it is right!
1.1 dsieger 3065:
1.184 rillig 3066: Some typical examples:
1.121 sevan 3067:
1.184 rillig 3068: Table 12.1. Patching examples
1.1 dsieger 3069:
1.184 rillig 3070: +-------------------------------------------------------------------------------------------+
3071: | Where | Incorrect | Correct |
3072: |---------+--------------------------+------------------------------------------------------|
3073: | |case ${target_os} in | |
3074: |configure|netbsd*) have_kvm=yes ;; |AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)|
3075: |script |*) have_kvm=no ;; | |
3076: | |esac | |
3077: |---------+--------------------------+------------------------------------------------------|
3078: |C source |#if defined(__NetBSD__) |#if defined(HAVE_SYS_EVENT_H) |
3079: |file |# include <sys/event.h> |# include <sys/event.h> |
3080: | |#endif |#endif |
3081: |---------+--------------------------+------------------------------------------------------|
3082: | |int |int |
3083: | |monitor_file(...) |monitor_file(...) |
3084: | |{ |{ |
3085: | |#if defined(__NetBSD__) |#if defined(HAVE_KQUEUE) |
3086: |C source | int fd = kqueue();| int fd = kqueue(); |
3087: |file | ... | ... |
3088: | |#else |#else |
3089: | | ... | ... |
3090: | |#endif |#endif |
3091: | |} |} |
3092: +-------------------------------------------------------------------------------------------+
1.1 dsieger 3093:
3094:
1.184 rillig 3095: 12.3.5. Feedback to the author
1.1 dsieger 3096:
1.184 rillig 3097: Always, always, always feed back any portability fixes or improvements you do
3098: to a package to the mainstream developers. This is the only way to get their
3099: attention on portability issues and to ensure that future versions can be built
3100: out-of-the box on NetBSD. Furthermore, any user that gets newer distfiles will
3101: get the fixes straight from the packaged code.
1.1 dsieger 3102:
1.184 rillig 3103: This generally involves cleaning up the patches (because sometimes the patches
3104: that are added to pkgsrc are quick hacks), filing bug reports in the
3105: appropriate trackers for the projects and working with the mainstream authors
3106: to accept your changes. It is extremely important that you do it so that the
3107: packages in pkgsrc are kept simple and thus further changes can be done without
3108: much hassle.
1.1 dsieger 3109:
1.184 rillig 3110: When you have done this, please add a URL to the upstream bug report to the
3111: patch comment.
1.1 dsieger 3112:
1.184 rillig 3113: Support the idea of free software!
1.1 dsieger 3114:
1.184 rillig 3115: 12.4. Other mandatory files
1.1 dsieger 3116:
1.184 rillig 3117: DESCR
1.1 dsieger 3118:
1.184 rillig 3119: A multi-line description of the piece of software. This should include any
3120: credits where they are due. Please bear in mind that others do not share
3121: your sense of humour (or spelling idiosyncrasies), and that others will
3122: read everything that you write here.
1.1 dsieger 3123:
1.184 rillig 3124: PLIST
1.1 dsieger 3125:
1.184 rillig 3126: This file governs the files that are installed on your system: all the
3127: binaries, manual pages, etc. There are other directives which may be
3128: entered in this file, to control the creation and deletion of directories,
3129: and the location of inserted files. See Chapter 19, PLIST issues for more
3130: information.
1.1 dsieger 3131:
1.184 rillig 3132: 12.5. Optional files
1.1 dsieger 3133:
1.184 rillig 3134: 12.5.1. Files affecting the binary package
1.1 dsieger 3135:
1.184 rillig 3136: INSTALL
1.1 dsieger 3137:
1.184 rillig 3138: This shell script is invoked twice by pkg_add(1). First time after package
3139: extraction and before files are moved in place, the second time after the
3140: files to install are moved in place. This can be used to do any custom
3141: procedures not possible with @exec commands in PLIST. See pkg_add(1) and
3142: pkg_create(1) for more information. See also Section 20.1, "Files and
3143: directories outside the installation prefix". Please note that you can
3144: modify variables in it easily by using FILES_SUBST in the package's
3145: Makefile:
1.1 dsieger 3146:
1.184 rillig 3147: FILES_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 3148:
1.184 rillig 3149: replaces "@SOMEVAR@" with "somevalue" in the INSTALL. By default,
3150: substitution is performed for PREFIX, LOCALBASE, X11BASE, VARBASE, and a
3151: few others, type make help topic=FILES_SUBST for a complete list.
1.1 dsieger 3152:
1.184 rillig 3153: DEINSTALL
1.1 dsieger 3154:
1.184 rillig 3155: This script is executed before and after any files are removed. It is this
3156: script's responsibility to clean up any additional messy details around the
3157: package's installation, since all pkg_delete knows is how to delete the
3158: files created in the original distribution. See pkg_delete(1) and
3159: pkg_create(1) for more information. The same methods to replace variables
3160: can be used as for the INSTALL file.
1.1 dsieger 3161:
1.184 rillig 3162: MESSAGE
1.1 dsieger 3163:
1.198 leot 3164: This file is displayed after installation of the package. While this was
3165: used often in the past, it has two problems: the display will be missed if
1.257 jkoshy 3166: many packages are installed at once, and the person installing the package
1.198 leot 3167: and the one using or configuring it may be different. It should therefore
3168: be used only in exceptional circumstances where lasting negative
3169: consequences would result from someone not reading it.
3170:
3171: MESSAGE should not be used for:
3172:
1.259 leot 3173: + exhortations to read the documentation
1.198 leot 3174:
1.259 leot 3175: + reminders to install rc.d files and set variables
1.198 leot 3176:
1.259 leot 3177: + anything that should be explained in the installation/configuration
1.198 leot 3178: documentation that should come with the package
3179:
3180: If the documentation provided by upstream needs enhancing, create e.g.
3181: files/README.pkgsrc and install it in the package's documentation
3182: directory.
3183:
3184: Note that MESSAGE is shown for all operating systems and all init systems.
3185: If a MESSAGE is necessary, it should be narrowed to only those operating
3186: systems and init systems to which it applies.
3187:
3188: Note that you can modify variables in it easily by using MESSAGE_SUBST in
3189: the package's Makefile:
1.1 dsieger 3190:
1.184 rillig 3191: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 3192:
1.184 rillig 3193: replaces "${SOMEVAR}" with "somevalue" in MESSAGE. By default, substitution
3194: is performed for PKGNAME, PKGBASE, PREFIX, LOCALBASE, X11BASE,
3195: PKG_SYSCONFDIR, ROOT_GROUP, and ROOT_USER.
1.1 dsieger 3196:
1.184 rillig 3197: You can display a different or additional files by setting the MESSAGE_SRC
3198: variable. Its default is MESSAGE, if the file exists.
1.1 dsieger 3199:
1.184 rillig 3200: ALTERNATIVES
1.1 dsieger 3201:
1.184 rillig 3202: This file is used by the alternatives framework. It creates, configures,
3203: and destroys generic wrappers used to run programs with similar interfaces.
3204: See pkg_alternatives(8) from pkgtools/pkg_alternatives for more
3205: information.
1.1 dsieger 3206:
1.184 rillig 3207: Each line of the file contains two filenames, first the wrapper and then
3208: the alternative provided by the package. Both paths are relative to PREFIX.
1.1 dsieger 3209:
1.184 rillig 3210: 12.5.2. Files affecting the build process
1.1 dsieger 3211:
1.184 rillig 3212: Makefile.common
1.1 dsieger 3213:
1.184 rillig 3214: This file contains arbitrary things that could also go into a Makefile, but
3215: its purpose is to be used by more than one package. This file should only
3216: be used when the packages that will use the file are known in advance. For
3217: other purposes it is often better to write a *.mk file and give it a good
3218: name that describes what it does.
1.1 dsieger 3219:
1.184 rillig 3220: buildlink3.mk
1.1 dsieger 3221:
1.184 rillig 3222: This file contains the dependency information for the buildlink3 framework
3223: (see Chapter 18, Buildlink methodology).
1.1 dsieger 3224:
1.184 rillig 3225: hacks.mk
1.1 dsieger 3226:
1.184 rillig 3227: This file contains workarounds for compiler bugs and similar things. It is
3228: included automatically by the pkgsrc infrastructure, so you don't need an
3229: extra .include line for it.
1.1 dsieger 3230:
1.184 rillig 3231: options.mk
1.1 dsieger 3232:
1.184 rillig 3233: This file contains the code for the package-specific options (see
3234: Chapter 16, Options handling) that can be selected by the user. If a
3235: package has only one or two options, it is equally acceptable to put the
3236: code directly into the Makefile.
1.1 dsieger 3237:
1.184 rillig 3238: 12.5.3. Files affecting nothing at all
1.1 dsieger 3239:
1.184 rillig 3240: README*
1.1 dsieger 3241:
1.184 rillig 3242: These files do not take place in the creation of a package and thus are
3243: purely informative to the package developer.
1.1 dsieger 3244:
1.184 rillig 3245: TODO
1.1 dsieger 3246:
1.184 rillig 3247: This file contains things that need to be done to make the package even
3248: better.
1.1 dsieger 3249:
1.184 rillig 3250: 12.6. work*
1.1 dsieger 3251:
1.184 rillig 3252: When you type make, the distribution files are unpacked into the directory
3253: denoted by WRKDIR. It can be removed by running make clean. Besides the
3254: sources, this directory is also used to keep various timestamp files. The
3255: directory gets removed completely on clean. The default is ${.CURDIR}/work or $
3256: {.CURDIR}/work.${MACHINE_ARCH} if OBJMACHINE is set.
1.1 dsieger 3257:
1.184 rillig 3258: 12.7. files/*
1.80 wiz 3259:
1.184 rillig 3260: If you have any files that you wish to be placed in the package prior to
3261: configuration or building, you can place these files here and use a ${CP}
3262: command in the "post-extract" target to achieve this.
1.1 dsieger 3263:
1.184 rillig 3264: If you want to share files in this way with other packages, set the FILESDIR
3265: variable to point to the other package's files directory, e.g.:
1.1 dsieger 3266:
1.184 rillig 3267: FILESDIR= ../../editors/xemacs/files
1.14 jmcneill 3268:
1.184 rillig 3269: Chapter 13. The build process
1.1 dsieger 3270:
1.184 rillig 3271: Table of Contents
1.1 dsieger 3272:
1.184 rillig 3273: 13.1. Introduction
3274: 13.2. Program location
3275: 13.3. Directories used during the build process
3276: 13.4. Running a phase
3277: 13.5. The fetch phase
3278: 13.5.1. What to fetch and where to get it from
3279: 13.5.2. How are the files fetched?
3280: 13.6. The checksum phase
3281: 13.7. The extract phase
3282: 13.8. The patch phase
3283: 13.9. The tools phase
3284: 13.10. The wrapper phase
3285: 13.11. The configure phase
3286: 13.12. The build phase
3287: 13.13. The test phase
3288: 13.14. The install phase
3289: 13.15. The package phase
3290: 13.16. Cleaning up
3291: 13.17. Other helpful targets
1.1 dsieger 3292:
1.184 rillig 3293: 13.1. Introduction
1.122 leot 3294:
1.184 rillig 3295: This chapter gives a detailed description on how a package is built. Building a
3296: package is separated into different phases (for example fetch, build, install),
3297: all of which are described in the following sections. Each phase is split into
3298: so-called stages, which take the name of the containing phase, prefixed by one
3299: of pre-, do- or post-. (Examples are pre-configure, post-build.) Most of the
3300: actual work is done in the do-* stages.
1.1 dsieger 3301:
1.184 rillig 3302: Never override the regular targets (like fetch), if you have to, override the
3303: do-* ones instead.
1.1 dsieger 3304:
1.184 rillig 3305: The basic steps for building a program are always the same. First the program's
3306: source (distfile) must be brought to the local system and then extracted. After
3307: any pkgsrc-specific patches to compile properly are applied, the software can
3308: be configured, then built (usually by compiling), and finally the generated
3309: binaries, etc. can be put into place on the system.
1.1 dsieger 3310:
1.184 rillig 3311: To get more details about what is happening at each step, you can set the
3312: PKG_VERBOSE variable, or the PATCH_DEBUG variable if you are just interested in
3313: more details about the patch step.
1.1 dsieger 3314:
1.184 rillig 3315: 13.2. Program location
1.1 dsieger 3316:
1.184 rillig 3317: Before outlining the process performed by the NetBSD package system in the next
3318: section, here's a brief discussion on where programs are installed, and which
3319: variables influence this.
1.1 dsieger 3320:
1.184 rillig 3321: The automatic variable PREFIX indicates where all files of the final program
3322: shall be installed. It is usually set to LOCALBASE (/usr/pkg), or CROSSBASE for
3323: pkgs in the cross category. The value of PREFIX needs to be put into the
3324: various places in the program's source where paths to these files are encoded.
3325: See Section 12.3, "patches/*" and Section 21.3.1, "Shared libraries - libtool"
3326: for more details.
1.1 dsieger 3327:
1.184 rillig 3328: When choosing which of these variables to use, follow the following rules:
1.1 dsieger 3329:
1.184 rillig 3330: * PREFIX always points to the location where the current pkg will be
3331: installed. When referring to a pkg's own installation path, use "${PREFIX}"
3332: .
1.1 dsieger 3333:
1.223 nia 3334: * LOCALBASE is where all pkgs are installed. If you need to construct a -I or
3335: -L argument to the compiler to find includes and libraries installed by
3336: another pkg, use "${LOCALBASE}". The name LOCALBASE stems from FreeBSD,
3337: which installed all packages in /usr/local. As pkgsrc leaves /usr/local for
3338: the system administrator, this variable is a misnomer.
1.1 dsieger 3339:
1.184 rillig 3340: * X11BASE is where the actual X11 distribution (from xsrc, etc.) is
3341: installed. When looking for standard X11 includes (not those installed by a
3342: package), use "${X11BASE}".
1.1 dsieger 3343:
1.184 rillig 3344: * X11-based packages using imake must set USE_IMAKE to be installed correctly
3345: under LOCALBASE.
1.1 dsieger 3346:
1.184 rillig 3347: * Within ${PREFIX}, packages should install files according to hier(7), with
3348: the exception that manual pages go into ${PREFIX}/man, not ${PREFIX}/share/
3349: man.
1.1 dsieger 3350:
1.184 rillig 3351: 13.3. Directories used during the build process
1.2 rillig 3352:
1.184 rillig 3353: When building a package, various directories are used to store source files,
3354: temporary files, pkgsrc-internal files, and so on. These directories are
3355: explained here.
1.1 dsieger 3356:
1.184 rillig 3357: Some of the directory variables contain relative pathnames. There are two
3358: common base directories for these relative directories: PKGSRCDIR/PKGPATH is
3359: used for directories that are pkgsrc-specific. WRKSRC is used for directories
3360: inside the package itself.
1.1 dsieger 3361:
1.184 rillig 3362: PKGSRCDIR
1.1 dsieger 3363:
1.184 rillig 3364: This is an absolute pathname that points to the pkgsrc root directory.
3365: Generally, you don't need it.
1.1 dsieger 3366:
1.184 rillig 3367: PKGDIR
1.1 dsieger 3368:
1.184 rillig 3369: This is an absolute pathname that points to the current package.
1.1 dsieger 3370:
1.184 rillig 3371: PKGPATH
1.1 dsieger 3372:
1.184 rillig 3373: This is a pathname relative to PKGSRCDIR that points to the current
1.228 gutterid 3374: package. It is defined after including bsd.prefs.mk and can be used in
3375: makefile fragments that are used by several packages to distinguish between
3376: these packages. Other variables that would serve the same purpose are
3377: PKGBASE and PKGNAME, but these are only defined after including bsd.pkg.mk,
3378: which is too late.
3379:
3380: In mk.conf, the pkgsrc user can use PKGPATH to tweak variables like
3381: MAKE_JOBS and CFLAGS.
1.1 dsieger 3382:
1.184 rillig 3383: WRKDIR
1.1 dsieger 3384:
1.184 rillig 3385: This is an absolute pathname pointing to the directory where all work takes
3386: place. The distfiles are extracted to this directory. It also contains
3387: temporary directories and log files used by the various pkgsrc frameworks,
3388: like buildlink or the wrappers.
1.1 dsieger 3389:
1.184 rillig 3390: WRKSRC
1.1 dsieger 3391:
1.184 rillig 3392: This is an absolute pathname pointing to the directory where the distfiles
3393: are extracted. It is usually a direct subdirectory of WRKDIR, and often
3394: it's the only directory entry that isn't hidden. This variable may be
3395: changed by a package Makefile.
1.1 dsieger 3396:
1.184 rillig 3397: The CREATE_WRKDIR_SYMLINK definition takes either the value yes or no and
3398: defaults to no. It indicates whether a symbolic link to the WRKDIR is to be
3399: created in the pkgsrc entry's directory. If users would like to have their
3400: pkgsrc trees behave in a read-only manner, then the value of
3401: CREATE_WRKDIR_SYMLINK should be set to no.
1.1 dsieger 3402:
1.184 rillig 3403: 13.4. Running a phase
1.1 dsieger 3404:
1.184 rillig 3405: You can run a particular phase by typing make phase, where phase is the name of
3406: the phase. This will automatically run all phases that are required for this
3407: phase. The default phase is build, that is, when you run make without
3408: parameters in a package directory, the package will be built, but not
3409: installed.
1.1 dsieger 3410:
1.184 rillig 3411: 13.5. The fetch phase
1.1 dsieger 3412:
1.184 rillig 3413: The first step in building a package is to fetch the distribution files
3414: (distfiles) from the sites that are providing them. This is the task of the
3415: fetch phase.
1.25 wiz 3416:
1.184 rillig 3417: 13.5.1. What to fetch and where to get it from
1.1 dsieger 3418:
1.184 rillig 3419: In simple cases, MASTER_SITES defines all URLs from where the distfile, whose
3420: name is derived from the DISTNAME variable, is fetched. The more complicated
3421: cases are described below.
1.1 dsieger 3422:
1.184 rillig 3423: The variable DISTFILES specifies the list of distfiles that have to be fetched.
3424: Its value defaults to ${DEFAULT_DISTFILES} and its value is ${DISTNAME}$
3425: {EXTRACT_SUFX}, so that most packages don't need to define it at all.
3426: EXTRACT_SUFX is .tar.gz by default, but can be changed freely. Note that if
3427: your package requires additional distfiles to the default one, you cannot just
3428: append the additional filenames using the += operator, but you have write for
3429: example:
1.1 dsieger 3430:
1.184 rillig 3431: DISTFILES= ${DEFAULT_DISTFILES} additional-files.tar.gz
1.1 dsieger 3432:
1.184 rillig 3433: Each distfile is fetched from a list of sites, usually MASTER_SITES. If the
3434: package has multiple DISTFILES or multiple PATCHFILES from different sites, you
3435: can set SITES.distfile to the list of URLs where the file distfile (including
3436: the suffix) can be found.
1.1 dsieger 3437:
1.184 rillig 3438: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
3439: DISTFILES+= foo-file.tar.gz
3440: SITES.foo-file.tar.gz= \
3441: https://www.somewhere.com/somehow/ \
3442: https://www.somewhereelse.com/mirror/somehow/
1.1 dsieger 3443:
1.184 rillig 3444: When actually fetching the distfiles, each item from MASTER_SITES or SITES.*
3445: gets the name of each distfile appended to it, without an intermediate slash.
3446: Therefore, all site values have to end with a slash or other separator
3447: character. This allows for example to set MASTER_SITES to a URL of a CGI script
3448: that gets the name of the distfile as a parameter. In this case, the definition
3449: would look like:
1.1 dsieger 3450:
1.184 rillig 3451: MASTER_SITES= https://www.example.com/download.cgi?file=
1.1 dsieger 3452:
1.184 rillig 3453: The exception to this rule are URLs starting with a dash. In that case the URL
3454: is taken as is, fetched and the result stored under the name of the distfile.
3455: You can use this style for the case when the download URL style does not match
3456: the above common case. For example, if permanent download URL is a redirector
3457: to the real download URL, or the download file name is offered by an HTTP
3458: Content-Disposition header. In the following example, foo-1.0.0.tar.gz will be
3459: created instead of the default v1.0.0.tar.gz.
1.1 dsieger 3460:
1.184 rillig 3461: DISTNAME= foo-1.0.0
3462: MASTER_SITES= -https://www.example.com/archive/v1.0.0.tar.gz
1.29 wiz 3463:
1.184 rillig 3464: There are some predefined values for MASTER_SITES, which can be used in
3465: packages. The names of the variables should speak for themselves.
1.29 wiz 3466:
1.260 ! wiz 3467: MASTER_SITE_APACHE MASTER_SITE_BACKUP
! 3468: MASTER_SITE_CRATESIO MASTER_SITE_CYGWIN
! 3469: MASTER_SITE_DEBIAN MASTER_SITE_FREEBSD
! 3470: MASTER_SITE_FREEBSD_LOCAL MASTER_SITE_GENTOO
! 3471: MASTER_SITE_GITHUB MASTER_SITE_GITLAB
! 3472: MASTER_SITE_GNOME MASTER_SITE_GNU
! 3473: MASTER_SITE_GNUPG MASTER_SITE_GNUSTEP
! 3474: MASTER_SITE_HASKELL_HACKAGE MASTER_SITE_IFARCHIVE
! 3475: MASTER_SITE_KDE MASTER_SITE_MOZILLA
! 3476: MASTER_SITE_MOZILLA_ALL MASTER_SITE_MYSQL
! 3477: MASTER_SITE_NETLIB MASTER_SITE_OPENBSD
! 3478: MASTER_SITE_OPENOFFICE MASTER_SITE_OSDN
! 3479: MASTER_SITE_PERL_CPAN MASTER_SITE_PGSQL
! 3480: MASTER_SITE_PYPI MASTER_SITE_RUBYGEMS
! 3481: MASTER_SITE_R_CRAN MASTER_SITE_SOURCEFORGE
! 3482: MASTER_SITE_SUNSITE MASTER_SITE_SUSE
! 3483: MASTER_SITE_TEX_CTAN MASTER_SITE_XCONTRIB
! 3484: MASTER_SITE_XEMACS MASTER_SITE_XORG
1.1 dsieger 3485:
1.184 rillig 3486: Some explanations for the less self-explaining ones: MASTER_SITE_BACKUP
3487: contains backup sites for packages that are maintained in ftp://ftp.NetBSD.org/
3488: pub/pkgsrc/distfiles/${DIST_SUBDIR}. MASTER_SITE_LOCAL contains local package
3489: source distributions that are maintained in ftp://ftp.NetBSD.org/pub/pkgsrc/
3490: distfiles/LOCAL_PORTS/.
1.1 dsieger 3491:
1.184 rillig 3492: If you choose one of these predefined sites, you may want to specify a
3493: subdirectory of that site. Since these macros may expand to more than one
3494: actual site, you must use the following construct to specify a subdirectory:
1.1 dsieger 3495:
1.184 rillig 3496: MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/}
3497: MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.1 dsieger 3498:
1.184 rillig 3499: Note the trailing slash after the subdirectory name.
1.1 dsieger 3500:
1.184 rillig 3501: 13.5.2. How are the files fetched?
1.1 dsieger 3502:
1.184 rillig 3503: The fetch phase makes sure that all the distfiles exist in a local directory
3504: (DISTDIR, which can be set by the pkgsrc user). If the files do not exist, they
3505: are fetched using commands of the form
1.1 dsieger 3506:
1.184 rillig 3507: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 dsieger 3508:
1.184 rillig 3509: where ${site} varies through several possibilities in turn: first,
3510: MASTER_SITE_OVERRIDE is tried, then the sites specified in either SITES.file if
3511: defined, else MASTER_SITES or PATCH_SITES, as applies, then finally the value
3512: of MASTER_SITE_BACKUP. The order of all except the first and the last can be
3513: optionally sorted by the user, via setting either MASTER_SORT_RANDOM, and
3514: MASTER_SORT_AWK or MASTER_SORT_REGEX.
1.1 dsieger 3515:
1.184 rillig 3516: The specific command and arguments used depend on the FETCH_USING parameter.
3517: The example above is for FETCH_USING=custom.
1.66 asau 3518:
1.184 rillig 3519: The distfiles mirror run by the NetBSD Foundation uses the mirror-distfiles
3520: target to mirror the distfiles, if they are freely distributable. Packages
3521: setting NO_SRC_ON_FTP (usually to "${RESTRICTED}") will not have their
3522: distfiles mirrored.
1.1 dsieger 3523:
1.184 rillig 3524: 13.6. The checksum phase
1.1 dsieger 3525:
1.184 rillig 3526: After the distfile(s) are fetched, their checksum is generated and compared
3527: with the checksums stored in the distinfo file. If the checksums don't match,
3528: the build is aborted. This is to ensure the same distfile is used for building,
3529: and that the distfile wasn't changed, e.g. by some malign force, deliberately
3530: changed distfiles on the master distribution site or network lossage.
1.1 dsieger 3531:
1.184 rillig 3532: 13.7. The extract phase
1.1 dsieger 3533:
1.184 rillig 3534: When the distfiles are present on the local system, they need to be extracted,
3535: as they usually come in the form of some compressed archive format.
1.1 dsieger 3536:
1.184 rillig 3537: By default, all DISTFILES are extracted. If you only need some of them, you can
3538: set the EXTRACT_ONLY variable to the list of those files.
1.1 dsieger 3539:
1.184 rillig 3540: Extracting the files is usually done by a little program, mk/extract/extract,
3541: which already knows how to extract various archive formats, so most likely you
3542: will not need to change anything here. But if you need, the following variables
3543: may help you:
1.1 dsieger 3544:
1.184 rillig 3545: EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}
1.1 dsieger 3546:
1.184 rillig 3547: Use these variables to override the default options for an extract command,
3548: which are defined in mk/extract/extract.
1.1 dsieger 3549:
1.184 rillig 3550: EXTRACT_USING
1.1 dsieger 3551:
1.184 rillig 3552: This variable can be set to bsdtar, gtar, nbtar (which is the default
3553: value), pax, or an absolute pathname pointing to the command with which tar
3554: archives should be extracted. It is preferred to choose bsdtar over gtar if
3555: NetBSD's pax-as-tar is not good enough.
1.1 dsieger 3556:
1.184 rillig 3557: If the extract program doesn't serve your needs, you can also override the
3558: EXTRACT_CMD variable, which holds the command used for extracting the files.
3559: This command is executed in the ${WRKSRC} directory. During execution of this
3560: command, the shell variable extract_file holds the absolute pathname of the
3561: file that is going to be extracted.
1.1 dsieger 3562:
1.184 rillig 3563: And if that still does not suffice, you can override the do-extract target in
3564: the package Makefile.
1.1 dsieger 3565:
1.184 rillig 3566: 13.8. The patch phase
1.1 dsieger 3567:
1.184 rillig 3568: After extraction, all the patches named by the PATCHFILES, those present in the
3569: patches subdirectory of the package as well as in $LOCALPATCHES/$PKGPATH (e.g.
3570: /usr/local/patches/graphics/png) are applied. Patchfiles ending in .Z or .gz
3571: are uncompressed before they are applied, files ending in .orig or .rej are
3572: ignored. Any special options to patch(1) can be handed in PATCH_DIST_ARGS. See
3573: Section 12.3, "patches/*" for more details.
1.1 dsieger 3574:
1.184 rillig 3575: By default patch(1) is given special arguments to make it fail if the expected
3576: text from the patch context is not found in the patched file. If that happens,
3577: fix the patch file by comparing it with the actual text in the file to be
3578: patched.
1.1 dsieger 3579:
1.184 rillig 3580: 13.9. The tools phase
1.1 dsieger 3581:
1.184 rillig 3582: This is covered in Chapter 17, Tools needed for building or running.
1.1 dsieger 3583:
1.184 rillig 3584: 13.10. The wrapper phase
1.1 dsieger 3585:
1.184 rillig 3586: This phase creates wrapper programs for the compilers and linkers. The
3587: following variables can be used to tweak the wrappers.
1.1 dsieger 3588:
1.184 rillig 3589: ECHO_WRAPPER_MSG
1.1 dsieger 3590:
1.184 rillig 3591: The command used to print progress messages. Does nothing by default. Set
3592: to ${ECHO} to see the progress messages.
1.1 dsieger 3593:
1.184 rillig 3594: WRAPPER_DEBUG
1.1 dsieger 3595:
1.184 rillig 3596: This variable can be set to yes (default) or no, depending on whether you
3597: want additional information in the wrapper log file.
1.1 dsieger 3598:
1.184 rillig 3599: WRAPPER_UPDATE_CACHE
1.1 dsieger 3600:
1.184 rillig 3601: This variable can be set to yes or no, depending on whether the wrapper
3602: should use its cache, which will improve the speed. The default value is
3603: yes, but is forced to no if the platform does not support it.
1.1 dsieger 3604:
1.184 rillig 3605: WRAPPER_REORDER_CMDS
1.1 dsieger 3606:
1.184 rillig 3607: A list of reordering commands. A reordering command has the form reorder:l:
3608: lib1:lib2. It ensures that that -llib1 occurs before -llib2.
1.1 dsieger 3609:
1.184 rillig 3610: 13.11. The configure phase
1.1 dsieger 3611:
1.184 rillig 3612: Most pieces of software need information on the header files, system calls, and
3613: library routines which are available on the platform they run on. The process
3614: of determining this information is known as configuration, and is usually
3615: automated. In most cases, a script is supplied with the distfiles, and its
3616: invocation results in generation of header files, Makefiles, etc.
1.1 dsieger 3617:
1.184 rillig 3618: If the package contains a configure script, this can be invoked by setting
3619: HAS_CONFIGURE to "yes". If the configure script is a GNU autoconf script, you
1.187 rillig 3620: should set GNU_CONFIGURE to "yes" instead.
1.1 dsieger 3621:
1.187 rillig 3622: In the do-configure stage, a rough equivalent of the following command is run.
3623: See mk/configure/configure.mk, target do-configure-script for the exact
3624: definition.
3625:
3626: .for dir in ${CONFIGURE_DIRS}
3627: cd ${WRKSRC} && cd ${dir} \
3628: && env ${CONFIGURE_ENV} \
3629: ${CONFIG_SHELL} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
1.184 rillig 3630: .endfor
1.1 dsieger 3631:
1.184 rillig 3632: CONFIGURE_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In
3633: each of these directories, the configure script is run with the environment
3634: CONFIGURE_ENV and arguments CONFIGURE_ARGS. The variables CONFIGURE_ENV,
3635: CONFIGURE_SCRIPT (default: "./configure") and CONFIGURE_ARGS may all be changed
3636: by the package.
1.1 dsieger 3637:
1.184 rillig 3638: If the program uses the Perl way of configuration (mainly Perl modules, but not
3639: only), i.e. a file called Makefile.PL, it should include ../../lang/perl5/
3640: module.mk. To set any parameter for Makefile.PL use the MAKE_PARAMS variable
3641: (e.g., MAKE_PARAMS+=foo=bar
1.1 dsieger 3642:
1.184 rillig 3643: If the program uses an Imakefile for configuration, the appropriate steps can
3644: be invoked by setting USE_IMAKE to "yes". If you only need xmkmf, add it to
3645: USE_TOOLS. You can add variables to xmkmf's environment by adding them to the
3646: SCRIPTS_ENV variable.
1.1 dsieger 3647:
1.184 rillig 3648: If the program uses cmake for configuration, the appropriate steps can be
1.233 wiz 3649: invoked by including ../../devel/cmake/build.mk. You can add variables to
3650: cmake's environment by adding them to the CONFIGURE_ENV variable and arguments
1.256 wiz 3651: to cmake by adding them to the CMAKE_CONFIGURE_ARGS variable. If you want to
3652: add arguments only for particular stages, you can use the CMAKE_CONFIGURE_ARGS,
1.233 wiz 3653: CMAKE_BUILD_ARGS, and CMAKE_INSTALL_ARGS variables. You can set the
3654: CONFIGURE_DIRS variable to the directories in which CMake should be run,
3655: relative to WRKSRC. This defaults to to ".".
1.1 dsieger 3656:
1.256 wiz 3657: Any package using the now-deprecated USE_CMAKE=yes should be converted.
3658: Essentially, replace with an include of ../../devel/cmake/build.mk, prune
3659: creation of a build directory and settings to use it, and check/fix settings
3660: that intend to perform the build in a subdirectory.
3661:
1.184 rillig 3662: If there is no configure step at all, set NO_CONFIGURE to "yes".
1.1 dsieger 3663:
1.184 rillig 3664: 13.12. The build phase
1.1 dsieger 3665:
1.187 rillig 3666: For building a package, a rough equivalent of the following code is executed;
3667: see mk/build/build.mk, target do-build for the exact definition.
1.154 rillig 3668:
1.187 rillig 3669: .for dir in ${BUILD_DIRS}
3670: cd ${WRKSRC} && cd ${dir} \
1.184 rillig 3671: && env ${MAKE_ENV} \
1.187 rillig 3672: ${MAKE_PROGRAM} ${MAKE_FLAGS} ${BUILD_MAKE_FLAGS} \
1.184 rillig 3673: -f ${MAKE_FILE} \
3674: ${BUILD_TARGET}
3675: .endfor
1.1 dsieger 3676:
1.184 rillig 3677: BUILD_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In each of
3678: these directories, MAKE_PROGRAM is run with the environment MAKE_ENV and
3679: arguments BUILD_MAKE_FLAGS. The variables MAKE_ENV, BUILD_MAKE_FLAGS, MAKE_FILE
3680: and BUILD_TARGET may all be changed by the package.
1.1 dsieger 3681:
1.184 rillig 3682: The default value of MAKE_PROGRAM is "gmake" if USE_TOOLS contains "gmake", "
3683: make" otherwise. The default value of MAKE_FILE is "Makefile", and BUILD_TARGET
3684: defaults to "all".
1.1 dsieger 3685:
1.184 rillig 3686: If there is no build step at all, set NO_BUILD to "yes".
1.1 dsieger 3687:
1.184 rillig 3688: 13.13. The test phase
1.1 dsieger 3689:
1.184 rillig 3690: [TODO]
1.1 dsieger 3691:
1.184 rillig 3692: 13.14. The install phase
1.1 dsieger 3693:
1.184 rillig 3694: Once the build stage has completed, the final step is to install the software
3695: in public directories, so users can access the programs and files.
1.1 dsieger 3696:
1.187 rillig 3697: In the install phase, a rough equivalent of the following code is executed; see
3698: mk/install/install.mk, target do-install for the exact definition.
3699: Additionally, before and after this code, several consistency checks are run
3700: against the files-to-be-installed, see mk/check/*.mk for details.
3701:
3702: .for dir in ${INSTALL_DIRS}
3703: cd ${WRKSRC} && cd ${dir} \
3704: && env ${INSTALL_ENV} ${MAKE_ENV} \
3705: ${MAKE_PROGRAM} ${MAKE_FLAGS} ${INSTALL_MAKE_FLAGS} \
3706: -f ${MAKE_FILE} ${INSTALL_TARGET}
1.184 rillig 3707: .endfor
1.1 dsieger 3708:
1.184 rillig 3709: The variable's meanings are analogous to the ones in the build phase.
3710: INSTALL_DIRS defaults to BUILD_DIRS. INSTALL_TARGET is "install" by default,
3711: plus "install.man" if USE_IMAKE is defined and NO_INSTALL_MANPAGES is not
3712: defined.
1.1 dsieger 3713:
1.184 rillig 3714: In the install phase, the following variables are useful. They are all
3715: variations of the install(1) command that have the owner, group and permissions
3716: preset. INSTALL is the plain install command. The specialized variants,
3717: together with their intended use, are:
1.1 dsieger 3718:
1.184 rillig 3719: INSTALL_PROGRAM_DIR
1.1 dsieger 3720:
1.184 rillig 3721: directories that contain binaries
1.1 dsieger 3722:
1.184 rillig 3723: INSTALL_SCRIPT_DIR
1.1 dsieger 3724:
1.184 rillig 3725: directories that contain scripts
1.1 dsieger 3726:
1.184 rillig 3727: INSTALL_LIB_DIR
1.1 dsieger 3728:
1.184 rillig 3729: directories that contain shared and static libraries
1.1 dsieger 3730:
1.184 rillig 3731: INSTALL_DATA_DIR
1.108 rillig 3732:
1.184 rillig 3733: directories that contain data files
1.108 rillig 3734:
1.184 rillig 3735: INSTALL_MAN_DIR
1.108 rillig 3736:
1.184 rillig 3737: directories that contain man pages
1.108 rillig 3738:
1.184 rillig 3739: INSTALL_GAME_DIR
1.108 rillig 3740:
1.184 rillig 3741: directories that contain data files for games
1.108 rillig 3742:
1.184 rillig 3743: INSTALL_PROGRAM
1.108 rillig 3744:
1.184 rillig 3745: binaries that can be stripped from debugging symbols
1.108 rillig 3746:
1.184 rillig 3747: INSTALL_SCRIPT
1.108 rillig 3748:
1.184 rillig 3749: binaries that cannot be stripped
1.108 rillig 3750:
1.184 rillig 3751: INSTALL_GAME
1.108 rillig 3752:
1.184 rillig 3753: game binaries
1.108 rillig 3754:
1.184 rillig 3755: INSTALL_LIB
1.108 rillig 3756:
1.184 rillig 3757: shared and static libraries
1.108 rillig 3758:
1.184 rillig 3759: INSTALL_DATA
1.108 rillig 3760:
1.184 rillig 3761: data files
1.1 dsieger 3762:
1.184 rillig 3763: INSTALL_GAME_DATA
1.1 dsieger 3764:
1.184 rillig 3765: data files for games
1.108 rillig 3766:
1.184 rillig 3767: INSTALL_MAN
1.108 rillig 3768:
1.184 rillig 3769: man pages
1.1 dsieger 3770:
1.184 rillig 3771: Some other variables are:
1.1 dsieger 3772:
1.184 rillig 3773: INSTALL_UNSTRIPPED
1.1 dsieger 3774:
1.184 rillig 3775: If set to yes, do not run strip(1) when installing binaries. Any debugging
3776: sections and symbols present in binaries will be preserved.
1.1 dsieger 3777:
1.184 rillig 3778: INSTALLATION_DIRS
1.1 dsieger 3779:
1.184 rillig 3780: A list of directories relative to PREFIX that are created by pkgsrc at the
3781: beginning of the install phase. The package is supposed to create all
3782: needed directories itself before installing files to it and list all other
3783: directories here.
1.1 dsieger 3784:
1.184 rillig 3785: In the rare cases that a package shouldn't install anything, set NO_INSTALL to
3786: "yes". This is mostly relevant for packages in the regress category.
1.1 dsieger 3787:
1.184 rillig 3788: 13.15. The package phase
1.121 sevan 3789:
1.184 rillig 3790: Once the install stage has completed, a binary package of the installed files
3791: can be built. These binary packages can be used for quick installation without
3792: previous compilation, e.g. by the make bin-install or by using pkg_add.
1.1 dsieger 3793:
1.184 rillig 3794: By default, the binary packages are created in ${PACKAGES}/All and symlinks are
3795: created in ${PACKAGES}/category, one for each category in the CATEGORIES
3796: variable. PACKAGES defaults to pkgsrc/packages.
1.1 dsieger 3797:
1.184 rillig 3798: 13.16. Cleaning up
1.1 dsieger 3799:
1.184 rillig 3800: Once you're finished with a package, you can clean the work directory by
3801: running make clean. If you want to clean the work directories of all
3802: dependencies too, use make clean-depends.
1.1 dsieger 3803:
1.184 rillig 3804: 13.17. Other helpful targets
1.1 dsieger 3805:
1.184 rillig 3806: pre/post-*
1.1 dsieger 3807:
1.184 rillig 3808: For any of the main targets described in the previous section (configure,
3809: build, install, etc.), two auxiliary targets exist with "pre-" and "post-"
3810: used as a prefix for the main target's name. These targets are invoked
3811: before and after the main target is called, allowing extra configuration or
3812: installation steps be performed from a package's Makefile, for example,
3813: which a program's configure script or install target omitted.
3814:
3815: About 5% of the pkgsrc packages define their custom post-extract target,
3816: another 5% define pre-configure, and 10% define post-install. The other pre
3817: /post-* targets are defined even less often.
1.1 dsieger 3818:
1.184 rillig 3819: do-*
1.182 leot 3820:
1.184 rillig 3821: Should one of the main targets do the wrong thing, and should there be no
3822: variable to fix this, you can redefine it with the do-* target. (Note that
3823: redefining the target itself instead of the do-* target is a bad idea, as
3824: the pre-* and post-* targets won't be called anymore, etc.)
1.1 dsieger 3825:
1.184 rillig 3826: About 15% of the pkgsrc packages override the default do-install, the other
3827: do-* targets are overridden even less often.
1.1 dsieger 3828:
1.184 rillig 3829: reinstall
1.1 dsieger 3830:
1.184 rillig 3831: If you did a make install and you noticed some file was not installed
3832: properly, you can repeat the installation with this target, which will
3833: ignore the "already installed" flag.
1.1 dsieger 3834:
1.184 rillig 3835: This is the default value of DEPENDS_TARGET except in the case of make
3836: update and make package, where the defaults are "package" and "update",
3837: respectively.
1.1 dsieger 3838:
1.184 rillig 3839: deinstall
1.1 dsieger 3840:
1.184 rillig 3841: This target does a pkg_delete(1) in the current directory, effectively
3842: de-installing the package. The following variables can be used to tune the
3843: behaviour:
1.1 dsieger 3844:
1.184 rillig 3845: PKG_VERBOSE
1.1 dsieger 3846:
1.184 rillig 3847: Add a "-v" to the pkg_delete(1) command.
1.1 dsieger 3848:
1.184 rillig 3849: DEINSTALLDEPENDS
1.1 dsieger 3850:
1.184 rillig 3851: Remove all packages that require (depend on) the given package. This
3852: can be used to remove any packages that may have been pulled in by a
3853: given package, e.g. if make deinstall DEINSTALLDEPENDS=1 is done in
3854: pkgsrc/x11/kde, this is likely to remove whole KDE. Works by adding "-R
3855: " to the pkg_delete(1) command line.
1.1 dsieger 3856:
1.184 rillig 3857: bin-install
1.1 dsieger 3858:
1.184 rillig 3859: Install a binary package from local disk and via FTP from a list of sites
3860: (see the BINPKG_SITES variable), and do a make package if no binary package
3861: is available anywhere. The arguments given to pkg_add can be set via
3862: BIN_INSTALL_FLAGS e.g., to do verbose operation, etc.
1.1 dsieger 3863:
1.184 rillig 3864: install-clean
1.1 dsieger 3865:
1.184 rillig 3866: This target removes the state files for the "install" and later phases so
3867: that the "install" target may be re-invoked. This can be used after editing
3868: the PLIST to install the package without rebuilding it.
1.1 dsieger 3869:
1.184 rillig 3870: build-clean
1.18 mishka 3871:
1.184 rillig 3872: This target removes the state files for the "build" and later phases so
3873: that the "build" target may be re-invoked.
1.18 mishka 3874:
1.184 rillig 3875: update
1.18 mishka 3876:
1.184 rillig 3877: This target causes the current package to be updated to the latest version.
3878: The package and all depending packages first get de-installed, then current
3879: versions of the corresponding packages get compiled and installed. This is
3880: similar to manually noting which packages are currently installed, then
3881: performing a series of make deinstall and make install (or whatever
3882: UPDATE_TARGET is set to) for these packages.
1.18 mishka 3883:
1.184 rillig 3884: You can use the "update" target to resume package updating in case a
3885: previous make update was interrupted for some reason. However, in this
3886: case, make sure you don't call make clean or otherwise remove the list of
3887: dependent packages in WRKDIR. Otherwise, you lose the ability to
3888: automatically update the current package along with the dependent packages
3889: you have installed.
1.121 sevan 3890:
1.184 rillig 3891: Resuming an interrupted make update will only work as long as the package
3892: tree remains unchanged. If the source code for one of the packages to be
3893: updated has been changed, resuming make update will most certainly fail!
1.1 dsieger 3894:
1.184 rillig 3895: The following variables can be used either on the command line or in
3896: mk.conf to alter the behaviour of make update:
1.1 dsieger 3897:
1.184 rillig 3898: UPDATE_TARGET
1.1 dsieger 3899:
1.184 rillig 3900: Install target to recursively use for the updated package and the
3901: dependent packages. Defaults to DEPENDS_TARGET if set, "install"
3902: otherwise for make update. Other good targets are "package" or "
3903: bin-install". Do not set this to "update" or you will get stuck in an
3904: endless loop!
1.1 dsieger 3905:
1.184 rillig 3906: NOCLEAN
1.1 dsieger 3907:
1.184 rillig 3908: Don't clean up after updating. Useful if you want to leave the work
3909: sources of the updated packages around for inspection or other
3910: purposes. Be sure you eventually clean up the source tree (see the "
3911: clean-update" target below) or you may run into troubles with old
3912: source code still lying around on your next make or make update.
1.1 dsieger 3913:
1.184 rillig 3914: REINSTALL
1.1 dsieger 3915:
1.184 rillig 3916: Deinstall each package before installing (making DEPENDS_TARGET). This
3917: may be necessary if the "clean-update" target (see below) was called
3918: after interrupting a running make update.
1.1 dsieger 3919:
1.184 rillig 3920: DEPENDS_TARGET
1.1 dsieger 3921:
1.184 rillig 3922: Allows you to disable recursion and hardcode the target for packages.
3923: The default is "update" for the update target, facilitating a recursive
3924: update of prerequisite packages. Only set DEPENDS_TARGET if you want to
3925: disable recursive updates. Use UPDATE_TARGET instead to just set a
3926: specific target for each package to be installed during make update
3927: (see above).
1.1 dsieger 3928:
1.184 rillig 3929: clean-update
1.1 dsieger 3930:
1.184 rillig 3931: Clean the source tree for all packages that would get updated if make
3932: update was called from the current directory. This target should not be
3933: used if the current package (or any of its depending packages) have already
3934: been de-installed (e.g., after calling make update) or you may lose some
3935: packages you intended to update. As a rule of thumb: only use this target
3936: before the first time you run make update and only if you have a dirty
3937: package tree (e.g., if you used NOCLEAN).
1.86 wiz 3938:
1.184 rillig 3939: If you are unsure about whether your tree is clean, you can either perform
3940: a make clean at the top of the tree, or use the following sequence of
3941: commands from the directory of the package you want to update (before
3942: running make update for the first time, otherwise you lose all the packages
3943: you wanted to update!):
1.86 wiz 3944:
1.184 rillig 3945: # make clean-update
3946: # make clean CLEANDEPENDS=YES
3947: # make update
1.86 wiz 3948:
3949:
1.184 rillig 3950: The following variables can be used either on the command line or in
3951: mk.conf to alter the behaviour of make clean-update:
1.86 wiz 3952:
1.184 rillig 3953: CLEAR_DIRLIST
1.86 wiz 3954:
1.184 rillig 3955: After make clean, do not reconstruct the list of directories to update
3956: for this package. Only use this if make update successfully installed
3957: all packages you wanted to update. Normally, this is done automatically
3958: on make update, but may have been suppressed by the NOCLEAN variable
3959: (see above).
1.1 dsieger 3960:
1.184 rillig 3961: replace
1.1 dsieger 3962:
1.184 rillig 3963: Update the installation of the current package. This differs from update in
3964: that it does not replace dependent packages. You will need to install
3965: pkgtools/pkg_tarup for this target to work.
1.1 dsieger 3966:
1.184 rillig 3967: Be careful when using this target! There are no guarantees that dependent
3968: packages will still work, in particular they will most certainly break if
3969: you make replace a library package whose shared library major version
3970: changed between your installed version and the new one. For this reason,
3971: this target is not officially supported and only recommended for advanced
3972: users.
1.1 dsieger 3973:
1.184 rillig 3974: info
1.1 dsieger 3975:
1.184 rillig 3976: This target invokes pkg_info(1) for the current package. You can use this
3977: to check which version of a package is installed.
1.86 wiz 3978:
1.184 rillig 3979: index
1.1 dsieger 3980:
1.184 rillig 3981: This is a top-level command, i.e. it should be used in the pkgsrc
3982: directory. It creates a database of all packages in the local pkgsrc tree,
3983: including dependencies, comment, maintainer, and some other useful
3984: information. Individual entries are created by running make describe in the
3985: packages' directories. This index file is saved as pkgsrc/INDEX. It can be
3986: displayed in verbose format by running make print-index. You can search in
3987: it with make search key=something. You can extract a list of all packages
3988: that depend on a particular one by running make show-deps PKG=somepackage.
1.1 dsieger 3989:
1.184 rillig 3990: Running this command takes a very long time, some hours even on fast
3991: machines!
1.1 dsieger 3992:
1.184 rillig 3993: readme
1.1 dsieger 3994:
1.199 nia 3995: This target generates a index.html file, which can be viewed using a
1.184 rillig 3996: browser such as www/firefox or www/links. The generated files contain
3997: references to any packages which are in the PACKAGES directory on the local
3998: host. The generated files can be made to refer to URLs based on
3999: FTP_PKG_URL_HOST and FTP_PKG_URL_DIR. For example, if I wanted to generate
1.199 nia 4000: index.html files which pointed to binary packages on the local machine, in
1.184 rillig 4001: the directory /usr/packages, set FTP_PKG_URL_HOST=file://localhost and
4002: FTP_PKG_URL_DIR=/usr/packages. The ${PACKAGES} directory and its
4003: subdirectories will be searched for all the binary packages.
1.1 dsieger 4004:
1.184 rillig 4005: The target can be run at the toplevel or in category directories, in which
4006: case it descends recursively.
1.1 dsieger 4007:
1.184 rillig 4008: readme-all
1.1 dsieger 4009:
1.184 rillig 4010: This is a top-level command, run it in pkgsrc. Use this target to create a
4011: file README-all.html which contains a list of all packages currently
4012: available in the NetBSD Packages Collection, together with the category
4013: they belong to and a short description. This file is compiled from the
1.199 nia 4014: pkgsrc/*/index.html files, so be sure to run this after a make readme.
1.1 dsieger 4015:
1.184 rillig 4016: cdrom-readme
1.1 dsieger 4017:
1.184 rillig 4018: This is very much the same as the "readme" target (see above), but is to be
4019: used when generating a pkgsrc tree to be written to a CD-ROM. This target
1.199 nia 4020: also produces index.html files, and can be made to refer to URLs based on
1.184 rillig 4021: CDROM_PKG_URL_HOST and CDROM_PKG_URL_DIR.
1.1 dsieger 4022:
1.184 rillig 4023: show-distfiles
1.1 dsieger 4024:
1.184 rillig 4025: This target shows which distfiles and patchfiles are needed to build the
4026: package (ALLFILES, which contains all DISTFILES and PATCHFILES, but not
4027: patches/*).
1.1 dsieger 4028:
1.184 rillig 4029: show-downlevel
1.1 dsieger 4030:
1.184 rillig 4031: This target shows nothing if the package is not installed. If a version of
4032: this package is installed, but is not the version provided in this version
4033: of pkgsrc, then a warning message is displayed. This target can be used to
4034: show which of your installed packages are downlevel, and so the old
4035: versions can be deleted, and the current ones added.
1.1 dsieger 4036:
1.184 rillig 4037: show-pkgsrc-dir
1.1 dsieger 4038:
1.184 rillig 4039: This target shows the directory in the pkgsrc hierarchy from which the
4040: package can be built and installed. This may not be the same directory as
4041: the one from which the package was installed. This target is intended to be
4042: used by people who may wish to upgrade many packages on a single host, and
4043: can be invoked from the top-level pkgsrc Makefile by using the "
4044: show-host-specific-pkgs" target.
1.1 dsieger 4045:
1.184 rillig 4046: show-installed-depends
1.1 dsieger 4047:
1.184 rillig 4048: This target shows which installed packages match the current package's
4049: DEPENDS. Useful if out of date dependencies are causing build problems.
1.1 dsieger 4050:
1.184 rillig 4051: print-build-depends-list
1.1 dsieger 4052:
1.184 rillig 4053: This target shows the list of packages that the current package depends on
4054: for building.
1.1 dsieger 4055:
1.184 rillig 4056: print-run-depends-list
1.1 dsieger 4057:
1.184 rillig 4058: This target shows the list of packages that the current package depends on
4059: for running.
1.1 dsieger 4060:
1.184 rillig 4061: check-shlibs
1.1 dsieger 4062:
1.184 rillig 4063: After a package is installed, check all its binaries and (on ELF platforms)
4064: shared libraries to see if they find the shared libs they need. Run by
4065: default if PKG_DEVELOPER is set in mk.conf.
1.1 dsieger 4066:
1.184 rillig 4067: print-PLIST
1.1 dsieger 4068:
1.184 rillig 4069: After a "make install" from a new or upgraded pkg, this prints out an
4070: attempt to generate a new PLIST from a find -newer work/.extract_done. An
4071: attempt is made to care for shared libs etc., but it is strongly
4072: recommended to review the result before putting it into PLIST. On upgrades,
4073: it's useful to diff the output of this command against an already existing
4074: PLIST file.
1.1 dsieger 4075:
1.184 rillig 4076: If the package installs files via tar(1) or other methods that don't update
4077: file access times, be sure to add these files manually to your PLIST, as
4078: the "find -newer" command used by this target won't catch them!
1.56 ryoon 4079:
1.184 rillig 4080: See Section 19.3, "Tweaking output of make print-PLIST" for more
4081: information on this target.
1.1 dsieger 4082:
1.255 wiz 4083: rebuild
4084:
4085: If you did a make build and you noticed some further modifications of
4086: sources are needed, you can repeat the build with this target, which will
4087: ignore the "already built" flag. This target is helpful while working with
4088: patches.
4089:
4090: repackage
4091:
4092: If you did a make package and you noticed some further modifications of
4093: sources are needed, you can repeat the package with this target, which will
4094: ignore the "already packaged" flag. This target is helpful while working
4095: with patches, PLIST* files etc.
4096:
4097: retest
4098:
4099: If you did a make test and you noticed some further modifications of
4100: sources are needed, you can repeat the test with this target, which will
4101: ignore the "already tested" flag. This target is helpful while working with
4102: patches.
4103:
1.184 rillig 4104: Chapter 14. Creating a new pkgsrc package from scratch
1.1 dsieger 4105:
1.184 rillig 4106: Table of Contents
1.1 dsieger 4107:
1.184 rillig 4108: 14.1. Common types of packages
1.219 nia 4109: 14.1.1. Python modules and programs
4110: 14.1.2. R packages
4111: 14.1.3. TeXlive packages
1.184 rillig 4112: 14.2. Examples
4113: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 4114:
1.184 rillig 4115: When you find a package that is not yet in pkgsrc, you most likely have a URL
4116: from where you can download the source code. Starting with this URL, creating a
4117: package involves only a few steps.
1.1 dsieger 4118:
1.184 rillig 4119: 1. In your mk.conf, set PKG_DEVELOPER=yes to enable the basic quality checks.
1.1 dsieger 4120:
1.184 rillig 4121: 2. Install the package meta-pkgs/pkg_developer, which among others will
4122: install the utilities url2pkg, pkglint, pkgvi and mkpatches:
1.1 dsieger 4123:
1.184 rillig 4124: $ cd /usr/pkgsrc
4125: $ (cd meta-pkgs/pkg_developer && bmake update)
1.1 dsieger 4126:
1.184 rillig 4127: 3. Choose one of the top-level directories as the category in which you want
4128: to place your package. You can also create a directory of your own (maybe
1.219 nia 4129: called local). Change into that category directory:
1.1 dsieger 4130:
1.219 nia 4131: $ cd category
1.1 dsieger 4132:
1.219 nia 4133: 4. Run the program url2pkg, passing as argument the URL of the distribution
4134: file (in most cases a .tar.gz file). This will download the distribution
4135: file and create the necessary files of the package, based on what's in the
4136: distribution file:
1.1 dsieger 4137:
1.184 rillig 4138: $ url2pkg https://www.example.org/packages/package-1.0.tar.gz
1.1 dsieger 4139:
1.184 rillig 4140: 5. Examine the extracted files to determine the dependencies of your package.
4141: Ideally, this is mentioned in some README file, but things may differ. For
4142: each of these dependencies, look where it exists in pkgsrc, and if there is
4143: a file called buildlink3.mk in that directory, add a line to your package
4144: Makefile which includes that file just before the last line. If the
4145: buildlink3.mk file does not exist, it must be created first. The
4146: buildlink3.mk file makes sure that the package's include files and
4147: libraries are provided.
1.1 dsieger 4148:
1.219 nia 4149: If you just need binaries from a dependent package, add a DEPENDS line to
4150: the Makefile, which specifies the version of the dependency and where it
4151: can be found in pkgsrc. This line should be placed in the third paragraph.
4152: If the dependency is only needed for building the package, but not when
4153: using it, use TOOL_DEPENDS or BUILD_DEPENDS instead of DEPENDS. The
4154: difference between TOOL_DEPENDS and BUILD_DEPENDS occurs when
4155: cross-compiling: TOOL_DEPENDS are native packages, i.e. packages for the
4156: platform where the package is built; BUILD_DEPENDS are target packages,
4157: i.e. packages for the platform for which the package is built. There is
4158: also TEST_DEPENDS, which specifies a dependency used only for testing the
4159: resulting package built, using the upstream project's included test suite,
4160: on the native platform. Your package may then look like this:
1.1 dsieger 4161:
1.184 rillig 4162: [...]
1.1 dsieger 4163:
1.184 rillig 4164: TOOL_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt
4165: DEPENDS+= screen-[0-9]*:../../misc/screen
4166: DEPENDS+= screen>=4.0:../../misc/screen
1.1 dsieger 4167:
1.184 rillig 4168: [...]
1.1 dsieger 4169:
1.184 rillig 4170: .include "../../category/package/buildlink3.mk"
4171: .include "../../devel/glib2/buildlink3.mk"
4172: .include "../../mk/bsd.pkg.mk"
1.1 dsieger 4173:
1.184 rillig 4174: 6. Run pkglint to see what things still need to be done to make your package a
4175: "good" one. If you don't know what pkglint's warnings want to tell you, try
4176: pkglint --explain or pkglint -e, which outputs additional explanations.
1.1 dsieger 4177:
1.184 rillig 4178: 7. In many cases the package is not yet ready to build. You can find
4179: instructions for the most common cases in the next section, Section 14.1,
4180: "Common types of packages". After you have followed the instructions over
4181: there, you can hopefully continue here.
1.1 dsieger 4182:
1.184 rillig 4183: 8. Run bmake clean to clean the working directory from the extracted files.
1.219 nia 4184: Besides these files, a lot of cache files and other system information have
4185: been saved in the working directory, which may have become outdated after
4186: you edited the Makefile.
1.1 dsieger 4187:
1.184 rillig 4188: 9. Now, run bmake to build the package. For the various things that can go
4189: wrong in this phase, consult Chapter 21, Making your package work.
1.1 dsieger 4190:
1.184 rillig 4191: If the extracted files from the package need to be fixed, run multiple
4192: rounds of these commands:
1.1 dsieger 4193:
1.219 nia 4194: $ bmake
1.184 rillig 4195: $ pkgvi ${WRKSRC}/some/file/that/does/not/compile
4196: $ mkpatches
1.219 nia 4197: $ bmake mps
4198: $ bmake clean
1.1 dsieger 4199:
1.184 rillig 4200: 10. When the package builds fine, the next step is to install the package. Run
4201: bmake install and hope that everything works.
1.1 dsieger 4202:
1.184 rillig 4203: 11. Up to now, the file PLIST, which contains a list of the files that are
4204: installed by the package, is nearly empty. Run bmake print-PLIST >PLIST to
4205: generate a probably correct list. Check the file using your preferred text
4206: editor to see if the list of files looks plausible.
1.1 dsieger 4207:
1.184 rillig 4208: 12. Run pkglint again to see if the generated PLIST contains garbage or not.
1.1 dsieger 4209:
1.184 rillig 4210: 13. When you ran bmake install, the package had been registered in the database
4211: of installed files, but with an empty list of files. To fix this, run bmake
4212: deinstall and bmake install again. Now the package is registered with the
4213: list of files from PLIST.
1.48 wiz 4214:
1.219 nia 4215: 14. Run bmake clean update to run everything from above again in a single step,
1.184 rillig 4216: making sure that the PLIST is correct and the whole package is created as
4217: intended.
1.48 wiz 4218:
1.219 nia 4219: 15. Run pkglint to see if there's anything left to do.
1.48 wiz 4220:
1.219 nia 4221: 16. Commit the package to pkgsrc-wip or main pkgsrc; see Chapter 23, Submitting
1.184 rillig 4222: and Committing.
1.50 wiz 4223:
1.184 rillig 4224: 14.1. Common types of packages
1.1 dsieger 4225:
1.219 nia 4226: 14.1.1. Python modules and programs
1.1 dsieger 4227:
1.184 rillig 4228: Python modules and programs packages are easily created using a set of
4229: predefined variables.
1.1 dsieger 4230:
1.184 rillig 4231: If some Python versions are not supported by the software, set the
4232: PYTHON_VERSIONS_INCOMPATIBLE variable to the Python versions that are not
4233: supported, e.g.
1.1 dsieger 4234:
1.184 rillig 4235: PYTHON_VERSIONS_INCOMPATIBLE= 27
1.1 dsieger 4236:
1.249 gutterid 4237: If the packaged software is a Python module, include ../../lang/python/
1.258 wiz 4238: wheel.mk. Note per PEP-518, the minimum and default requirement to create .whl
4239: files is devel/py-setuptools; however, there are various other possible tools
4240: that projects can use. Thus inclusion of wheel.mk does not imply these defaults
4241: are defined as TOOL_DEPENDS. Whatever the project specifically requires as
4242: packaging tools must be defined in the package Makefile.
1.1 dsieger 4243:
1.248 wiz 4244: The package directory should be called "py-software" and PKGNAME should be set
4245: to "${PYPKGPREFIX}-${DISTNAME}", e.g.
1.1 dsieger 4246:
1.184 rillig 4247: DISTNAME= foopymodule-1.2.10
4248: PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
1.1 dsieger 4249:
1.226 gutterid 4250: For software in PyPi, the name should match what PyPi specifies for "pip
4251: install software".
4252:
1.184 rillig 4253: If it is an application, include "../../lang/python/application.mk". In order
4254: to correctly set the path to the Python interpreter, use the REPLACE_PYTHON
4255: variable and set it to the list of files (paths relative to WRKSRC) that must
4256: be corrected. For example:
1.1 dsieger 4257:
1.184 rillig 4258: REPLACE_PYTHON= *.py
1.1 dsieger 4259:
1.219 nia 4260: 14.1.2. R packages
1.1 dsieger 4261:
1.184 rillig 4262: Simple R packages from CRAN are handled automatically by R2pkg, which is
4263: available in pkgtools/R2pkg. Individual packages (and optionally their
4264: dependencies) may be created and updated. R packages generally follow the same
4265: form, and most of the relevant information needed is contained in a DESCRIPTION
4266: file as part of each R package on CRAN. Consequently, R2pkg downloads that
4267: information and creates or updates a package in the canonical form. The
4268: resulting package should be reviewed for correctness.
1.1 dsieger 4269:
1.219 nia 4270: 14.1.3. TeXlive packages
1.1 dsieger 4271:
1.184 rillig 4272: TeXlive packages from CTAN are handled automatically by texlive2pkg, which is
4273: available in pkgtools/texlive2pkg.
1.1 dsieger 4274:
1.184 rillig 4275: If the TeXlive package name is not known, it may be useful to search CTAN. A "
4276: Contained in" field on the package page typically identifies the basename of
4277: the package file in the TeXlive archive.
1.1 dsieger 4278:
1.184 rillig 4279: If the TeXlive package name is known, download the files from the TeXlive
4280: archive. For package foo, you will need to download foo.tar.xz. Most TeXlive
4281: packages also have associated documentation packages, so download
4282: foo.doc.tar.xz at the same time. These files should be placed in the
4283: appropriate category directory, which is often but not always print. Then run
4284: the following command in the category directory.
1.1 dsieger 4285:
1.184 rillig 4286: texlive2pkg foo.tar.xz foo.doc.tar.xz
1.1 dsieger 4287:
1.184 rillig 4288: This will create two packages, tex-foo and tex-foo-doc. Be sure to check that
4289: both packages are correct.
1.1 dsieger 4290:
1.184 rillig 4291: Finally, CTAN currently does not include version information in package
4292: filenames and changes their contents periodically when updates occur.
4293: Consequently, pkgsrc avoids downloading distfiles directly from CTAN and
4294: instead relies on the pkgsrc archives. For each new or updated TeXlive package,
4295: e.g., the main one and the corresponding documentation, upload the distfiles
4296: with the following command in each package directory.
1.1 dsieger 4297:
1.184 rillig 4298: make upload-distfiles
1.117 sevan 4299:
1.184 rillig 4300: 14.2. Examples
1.117 sevan 4301:
1.184 rillig 4302: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 4303:
1.184 rillig 4304: 14.2.1.1. The initial package
1.1 dsieger 4305:
1.184 rillig 4306: Looking at the file pkgsrc/doc/TODO, I saw that the "nvu" package has not yet
4307: been imported into pkgsrc. As the description says it has to do with the web,
4308: the obvious choice for the category is "www".
1.1 dsieger 4309:
1.184 rillig 4310: $ mkdir www/nvu
4311: $ cd www/nvu
1.1 dsieger 4312:
1.184 rillig 4313: The web site says that the sources are available as a tar file, so I fed that
4314: URL to the url2pkg program:
1.1 dsieger 4315:
1.184 rillig 4316: $ url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
1.1 dsieger 4317:
1.184 rillig 4318: My editor popped up, and I added a PKGNAME line below the DISTNAME line, as the
4319: package name should not have the word "sources" in it. I also filled in the
4320: MAINTAINER, HOMEPAGE and COMMENT fields. Then the package Makefile looked like
4321: that:
1.1 dsieger 4322:
1.184 rillig 4323: # $NetBSD $
4324: #
1.1 dsieger 4325:
1.184 rillig 4326: DISTNAME= nvu-1.0-sources
4327: PKGNAME= nvu-1.0
4328: CATEGORIES= www
4329: MASTER_SITES= http://cvs.nvu.com/download/
4330: EXTRACT_SUFX= .tar.bz2
1.1 dsieger 4331:
1.184 rillig 4332: MAINTAINER= rillig@NetBSD.org
4333: HOMEPAGE= http://cvs.nvu.com/
4334: COMMENT= Web Authoring System
1.1 dsieger 4335:
1.184 rillig 4336: # url2pkg-marker (please do not remove this line.)
4337: .include "../../mk/bsd.pkg.mk"
1.1 dsieger 4338:
1.184 rillig 4339: On the first line of output above, an artificial space has been added between
4340: NetBSD and $, this is a workaround to prevent CVS expanding to the filename of
4341: the guide.
1.1 dsieger 4342:
1.184 rillig 4343: Then, I quit the editor and watched pkgsrc downloading a large source archive:
1.1 dsieger 4344:
1.184 rillig 4345: url2pkg> Running "make makesum" ...
4346: => Required installed package digest>=20010302: digest-20060826 found
4347: => Fetching nvu-1.0-sources.tar.bz2
4348: Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
4349: 100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA
4350: 29687976 bytes retrieved in 03:12 (150.77 KB/s)
4351: url2pkg> Running "make extract" ...
4352: => Required installed package digest>=20010302: digest-20060826 found
4353: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
4354: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
4355: work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc
4356: ===> Installing dependencies for nvu-1.0
4357: ===> Overriding tools for nvu-1.0
4358: ===> Extracting for nvu-1.0
4359: url2pkg> Adjusting the Makefile.
1.1 dsieger 4360:
1.184 rillig 4361: Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
1.1 dsieger 4362:
1.184 rillig 4363: Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
1.1 dsieger 4364:
1.184 rillig 4365: 14.2.1.2. Fixing all kinds of problems to make the package work
1.1 dsieger 4366:
1.184 rillig 4367: Now that the package has been extracted, let's see what's inside it. The
4368: package has a README.txt, but that only says something about mozilla, so it's
4369: probably useless for seeing what dependencies this package has. But since there
4370: is a GNU configure script in the package, let's hope that it will complain
4371: about everything it needs.
1.1 dsieger 4372:
1.184 rillig 4373: $ bmake
4374: => Required installed package digest>=20010302: digest-20060826 found
4375: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
4376: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
4377: ===> Patching for nvu-1.0
4378: ===> Creating toolchain wrappers for nvu-1.0
4379: ===> Configuring for nvu-1.0
4380: [...]
4381: configure: error: Perl 5.004 or higher is required.
4382: [...]
4383: WARNING: Please add USE_TOOLS+=perl to the package Makefile.
4384: [...]
1.1 dsieger 4385:
1.184 rillig 4386: That worked quite well. So I opened the package Makefile in my editor, and
4387: since it already has a USE_TOOLS line, I just appended "perl" to it. Since the
4388: dependencies of the package have changed now, and since a perl wrapper is
4389: automatically installed in the "tools" phase, I need to build the package from
4390: scratch.
1.1 dsieger 4391:
1.184 rillig 4392: $ bmake clean
4393: ===> Cleaning for nvu-1.0
4394: $ bmake
4395: [...]
4396: *** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
4397: GNU Make. You will not be able to build Mozilla without GNU Make.
4398: [...]
1.1 dsieger 4399:
1.184 rillig 4400: So I added "gmake" to the USE_TOOLS line and tried again (from scratch).
1.1 dsieger 4401:
1.184 rillig 4402: [...]
4403: checking for GTK - version >= 1.2.0... no
4404: *** Could not run GTK test program, checking why...
4405: [...]
1.1 dsieger 4406:
1.184 rillig 4407: Now to the other dependencies. The first question is: Where is the GTK package
4408: hidden in pkgsrc?
1.1 dsieger 4409:
1.184 rillig 4410: $ echo ../../*/gtk*
4411: [many packages ...]
4412: $ echo ../../*/gtk
4413: ../../x11/gtk
4414: $ echo ../../*/gtk2
4415: ../../x11/gtk2
4416: $ echo ../../*/gtk2/bui*
4417: ../../x11/gtk2/buildlink3.mk
1.1 dsieger 4418:
1.184 rillig 4419: The first try was definitely too broad. The second one had exactly one result,
4420: which is very good. But there is one pitfall with GNOME packages. Before GNOME
4421: 2 had been released, there were already many GNOME 1 packages in pkgsrc. To be
4422: able to continue to use these packages, the GNOME 2 packages were imported as
4423: separate packages, and their names usually have a "2" appended. So I checked
4424: whether this was the case here, and indeed it was.
1.1 dsieger 4425:
1.184 rillig 4426: Since the GTK2 package has a buildlink3.mk file, adding the dependency is very
4427: easy. I just inserted an .include line before the last line of the package
4428: Makefile, so that it now looks like this:
1.1 dsieger 4429:
1.184 rillig 4430: [...]
4431: .include "../../x11/gtk2/buildlink3.mk"
4432: .include "../../mk/bsd.pkg.mk
1.1 dsieger 4433:
1.184 rillig 4434: After another bmake clean && bmake, the answer was:
1.108 rillig 4435:
1.184 rillig 4436: [...]
4437: checking for gtk-config... /home/roland/pkg/bin/gtk-config
4438: checking for GTK - version >= 1.2.0... no
4439: *** Could not run GTK test program, checking why...
4440: *** The test program failed to compile or link. See the file config.log for the
4441: *** exact error that occured. This usually means GTK was incorrectly installed
4442: *** or that you have moved GTK since it was installed. In the latter case, you
4443: *** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
4444: configure: error: Test for GTK failed.
4445: [...]
1.1 dsieger 4446:
1.184 rillig 4447: In this particular case, the assumption that "every package prefers GNOME 2"
4448: had been wrong. The first of the lines above told me that this package really
4449: wanted to have the GNOME 1 version of GTK. If the package had looked for GTK2,
4450: it would have looked for pkg-config instead of gtk-config. So I changed the x11
4451: /gtk2 to x11/gtk in the package Makefile, and tried again.
1.1 dsieger 4452:
1.184 rillig 4453: [...]
4454: cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...]
4455: In file included from xpidl.c:42:
4456: xpidl.h:53:24: libIDL/IDL.h: No such file or directory
4457: In file included from xpidl.c:42:
4458: xpidl.h:132: error: parse error before "IDL_ns"
4459: [...]
1.1 dsieger 4460:
1.184 rillig 4461: The package still does not find all of its dependencies. Now the question is:
4462: Which package provides the libIDL/IDL.h header file?
1.1 dsieger 4463:
1.184 rillig 4464: $ echo ../../*/*idl*
4465: ../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
4466: $ echo ../../*/*IDL*
4467: ../../net/libIDL
1.1 dsieger 4468:
1.184 rillig 4469: Let's take the one from the second try. So I included the ../../net/libIDL/
4470: buildlink3.mk file and tried again. But the error didn't change. After digging
4471: through some of the code, I concluded that the build process of the package was
4472: broken and couldn't have ever worked, but since the Mozilla source tree is
4473: quite large, I didn't want to fix it. So I added the following to the package
4474: Makefile and tried again:
1.1 dsieger 4475:
1.184 rillig 4476: CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
4477: BUILDLINK_TRANSFORM+= l:IDL:IDL-2
1.1 dsieger 4478:
1.184 rillig 4479: The latter line is needed because the package expects the library libIDL.so,
4480: but only libIDL-2.so is available. So I told the compiler wrapper to rewrite
4481: that on the fly.
1.1 dsieger 4482:
1.184 rillig 4483: The next problem was related to a recent change of the FreeType interface. I
4484: looked up in www/seamonkey which patch files were relevant for this issue and
4485: copied them to the patches directory. Then I retried, fixed the patches so that
4486: they applied cleanly and retried again. This time, everything worked.
1.1 dsieger 4487:
1.184 rillig 4488: 14.2.1.3. Installing the package
1.1 dsieger 4489:
1.184 rillig 4490: $ bmake CHECK_FILES=no install
4491: [...]
4492: $ bmake print-PLIST >PLIST
4493: $ bmake deinstall
4494: $ bmake install
1.1 dsieger 4495:
1.184 rillig 4496: Chapter 15. Programming in Makefiles
1.1 dsieger 4497:
1.184 rillig 4498: Table of Contents
1.1 dsieger 4499:
1.184 rillig 4500: 15.1. Caveats
4501: 15.2. Makefile variables
4502: 15.2.1. Naming conventions
4503: 15.3. Code snippets
4504: 15.3.1. Adding things to a list
4505: 15.3.2. Echoing a string exactly as-is
4506: 15.3.3. Passing CFLAGS to GNU configure scripts
4507: 15.3.4. Handling possibly empty variables
1.229 gutterid 4508: 15.3.5. Testing yes/no variables in conditions
1.1 dsieger 4509:
1.184 rillig 4510: Pkgsrc consists of many Makefile fragments, each of which forms a well-defined
4511: part of the pkgsrc system. Using the make(1) system as a programming language
4512: for a big system like pkgsrc requires some discipline to keep the code correct
4513: and understandable.
1.1 dsieger 4514:
1.184 rillig 4515: The basic ingredients for Makefile programming are variables and shell
4516: commands. Among these shell commands may even be more complex ones like awk(1)
4517: programs. To make sure that every shell command runs as intended it is
4518: necessary to quote all variables correctly when they are used.
1.1 dsieger 4519:
1.184 rillig 4520: This chapter describes some patterns that appear quite often in Makefiles,
4521: including the pitfalls that come along with them.
1.1 dsieger 4522:
1.184 rillig 4523: 15.1. Caveats
1.1 dsieger 4524:
1.184 rillig 4525: * When you are creating a file as a target of a rule, always write the data
4526: to a temporary file first and finally rename that file. Otherwise there
4527: might occur an error in the middle of generating the file, and when the
4528: user runs make(1) for the second time, the file exists and will not be
4529: regenerated properly. Example:
1.1 dsieger 4530:
1.184 rillig 4531: wrong:
4532: @echo "line 1" > ${.TARGET}
4533: @echo "line 2" >> ${.TARGET}
4534: @false
1.1 dsieger 4535:
1.184 rillig 4536: correct:
4537: @echo "line 1" > ${.TARGET}.tmp
4538: @echo "line 2" >> ${.TARGET}.tmp
4539: @false
4540: @mv ${.TARGET}.tmp ${.TARGET}
1.1 dsieger 4541:
1.184 rillig 4542: When you run make wrong twice, the file wrong will exist, although there
4543: was an error message in the first run. On the other hand, running make
4544: correct gives an error message twice, as expected.
1.1 dsieger 4545:
1.184 rillig 4546: You might remember that make(1) sometimes removes ${.TARGET} in case of
4547: error, but this only happens when it is interrupted, for example by
4548: pressing Ctrl+C. This does not happen when one of the commands fails (like
4549: false(1) above).
1.1 dsieger 4550:
1.184 rillig 4551: 15.2. Makefile variables
1.1 dsieger 4552:
1.184 rillig 4553: Makefile variables contain strings that can be processed using the five
4554: operators =, +=, ?=, := and !=, which are described in the make(1) man page.
1.1 dsieger 4555:
1.184 rillig 4556: When a variable's value is parsed from a Makefile, the hash character # and the
4557: backslash character \ are handled specially. If a backslash is the last
4558: character in a line, that backslash is removed from the line and the line
4559: continues with the next line of the file.
1.1 dsieger 4560:
1.184 rillig 4561: The # character starts a comment that reaches until the end of the line. To get
4562: an actual # character, such as in a URL, write \# instead.
1.1 dsieger 4563:
1.184 rillig 4564: The evaluation of variables either happens immediately or lazy. It happens
4565: immediately when the variable occurs on the right-hand side of the := or the !=
4566: operator, in a .if condition or a .for loop. In the other cases, it is
4567: evaluated lazily.
1.1 dsieger 4568:
1.184 rillig 4569: Some of the modifiers split the string into words and then operate on the
4570: words, others operate on the string as a whole. When a string is split into
4571: words, double quotes and single quotes are interpreted as delimiters, just like
4572: in sh(1).
1.1 dsieger 4573:
1.184 rillig 4574: 15.2.1. Naming conventions
1.1 dsieger 4575:
1.184 rillig 4576: * All variable names starting with an underscore are reserved for use by the
4577: pkgsrc infrastructure. They shall not be used by packages.
1.1 dsieger 4578:
1.184 rillig 4579: * In .for loops you should use lowercase variable names for the iteration
4580: variables.
1.1 dsieger 4581:
1.184 rillig 4582: * All list variables should have a plural name, such as PKG_OPTIONS or
4583: DISTFILES.
1.1 dsieger 4584:
1.184 rillig 4585: 15.3. Code snippets
1.1 dsieger 4586:
1.184 rillig 4587: 15.3.1. Adding things to a list
1.1 dsieger 4588:
1.184 rillig 4589: When adding a string that possibly contains whitespace or quotes to a list
4590: (example 1), it must be quoted using the :Q modifier.
1.1 dsieger 4591:
1.184 rillig 4592: When adding another list to a list (example 2), it must not be quoted, since
4593: its elements are already quoted.
1.1 dsieger 4594:
1.184 rillig 4595: STRING= foo * bar `date`
4596: LIST= # empty
4597: ANOTHER_LIST= a=b c=d
1.1 dsieger 4598:
1.184 rillig 4599: LIST+= ${STRING:Q} # 1
4600: LIST+= ${ANOTHER_LIST} # 2
1.1 dsieger 4601:
1.184 rillig 4602: 15.3.2. Echoing a string exactly as-is
1.1 dsieger 4603:
1.184 rillig 4604: Echoing a string containing special characters needs special work.
1.1 dsieger 4605:
1.184 rillig 4606: STRING= foo bar < > * `date` $$HOME ' "
4607: EXAMPLE_ENV= string=${STRING:Q} x=multiple\ quoted\ words
1.1 dsieger 4608:
1.184 rillig 4609: all:
4610: echo ${STRING} # 1
4611: echo ${STRING:Q} # 2
4612: printf '%s\n' ${STRING:Q}'' # 3
4613: env ${EXAMPLE_ENV} sh -c 'echo "$$string"; echo "$$x"' # 4
1.1 dsieger 4614:
1.184 rillig 4615: Example 1 leads to a syntax error in the shell, as the characters are just
4616: copied.
1.1 dsieger 4617:
1.184 rillig 4618: Example 2 quotes the string so that the shell interprets it correctly. But the
4619: echo command may additionally interpret strings with a leading dash or those
4620: containing backslashes.
1.1 dsieger 4621:
1.184 rillig 4622: Example 3 can handle arbitrary strings, since printf(1) only interprets the
4623: format string, but not the next argument. The trailing single quotes handle the
4624: case when the string is empty. In that case, the :Q modifier would result in an
4625: empty string too, which would then be skipped by the shell. For printf(1) this
4626: doesn't make a difference, but other programs may care.
1.1 dsieger 4627:
1.184 rillig 4628: In example 4, the EXAMPLE_ENV does not need to be quoted because the quoting
4629: has already been done when adding elements to the list.
1.1 dsieger 4630:
1.184 rillig 4631: 15.3.3. Passing CFLAGS to GNU configure scripts
1.1 dsieger 4632:
1.184 rillig 4633: When passing CFLAGS or similar variables to a GNU-style configure script
4634: (especially those that call other configure scripts), it must not have leading
4635: or trailing whitespace, since otherwise the configure script gets confused. To
4636: trim leading and trailing whitespace, use the :M modifier, as in the following
4637: example:
1.1 dsieger 4638:
1.184 rillig 4639: CPPFLAGS= # empty
4640: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX}\"
4641: CPPFLAGS+= ${MY_CPPFLAGS}
1.1 dsieger 4642:
1.184 rillig 4643: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
1.1 dsieger 4644:
1.184 rillig 4645: all:
4646: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
4647: echo x${CONFIGURE_ARGS:Q}x # properly trimmed
1.1 dsieger 4648:
1.184 rillig 4649: In this example, CPPFLAGS has both leading and trailing whitespace because the
4650: += operator always adds a space.
1.1 dsieger 4651:
1.184 rillig 4652: 15.3.4. Handling possibly empty variables
1.1 dsieger 4653:
1.184 rillig 4654: When a possibly empty variable is used in a shell program, it may lead to a
4655: syntax error.
1.1 dsieger 4656:
1.184 rillig 4657: EGFILES= # empty
1.1 dsieger 4658:
1.184 rillig 4659: install-examples: # produces a syntax error in the shell
4660: for egfile in ${EGFILES}; do \
4661: echo "Installing $$egfile"; \
4662: done
1.1 dsieger 4663:
1.184 rillig 4664: The shell only sees the text for egfile in ; do, since ${EGFILES} is replaced
4665: with an empty string by make(1). To fix this syntax error, use one of the
4666: snippets below.
1.1 dsieger 4667:
1.229 gutterid 4668: EGFILES= # empty
1.1 dsieger 4669:
1.184 rillig 4670: install-examples:
4671: for egfile in ${EGFILES} ""; do \
4672: [ -n "$$egfile" ] || continue; \
4673: echo "Installing $$egfile"; \
4674: done
1.1 dsieger 4675:
1.184 rillig 4676: In this case, an empty string is appended to the iteration list (to prevent the
4677: syntax error) and filtered out later.
1.1 dsieger 4678:
1.184 rillig 4679: EGFILES= # empty
1.1 dsieger 4680:
1.184 rillig 4681: install-examples:
4682: .for egfile in ${EGFILES}
4683: echo "Installing ${egfile}"
4684: .endfor
1.1 dsieger 4685:
1.184 rillig 4686: If one of the filenames contains special characters, it should be enclosed in
4687: single or double quotes.
1.1 dsieger 4688:
1.184 rillig 4689: To have a shell command test whether a make variable is empty, use the
4690: following code: ${TEST} -z ${POSSIBLY_EMPTY:Q}"".
1.1 dsieger 4691:
1.229 gutterid 4692: 15.3.5. Testing yes/no variables in conditions
4693:
4694: When a variable can have the values yes or no, use the following pattern to
4695: test the variable:
4696:
4697: .if ${VAR:U:tl} == "yes"
4698: # do something
4699: .endif
4700:
4701: The :U modifier is only necessary if the variable can be undefined. If the
4702: variable is guaranteed to be defined, the :U can be omitted.
4703:
4704: The :tl modifier converts the variable value to lowercase, allowing for the
4705: values yes, Yes, YES.
4706:
1.184 rillig 4707: Chapter 16. Options handling
1.1 dsieger 4708:
4709: Table of Contents
4710:
1.184 rillig 4711: 16.1. Global default options
4712: 16.2. Converting packages to use bsd.options.mk
4713: 16.3. Option Names
4714: 16.4. Determining the options of dependencies
1.1 dsieger 4715:
4716: Many packages have the ability to be built to support different sets of
4717: features. bsd.options.mk is a framework in pkgsrc that provides generic
4718: handling of those options that determine different ways in which the packages
4719: can be built. It's possible for the user to specify exactly which sets of
4720: options will be built into a package or to allow a set of global default
4721: options apply.
4722:
1.7 rillig 4723: There are two broad classes of behaviors that one might want to control via
4724: options. One is whether some particular feature is enabled in a program that
4725: will be built anyway, often by including or not including a dependency on some
4726: other package. The other is whether or not an additional program will be built
4727: as part of the package. Generally, it is better to make a split package for
4728: such additional programs instead of using options, because it enables binary
4729: packages to be built which can then be added separately. For example, the foo
4730: package might have minimal dependencies (those packages without which foo
4731: doesn't make sense), and then the foo-gfoo package might include the GTK
4732: frontend program gfoo. This is better than including a gtk option to foo that
4733: adds gfoo, because either that option is default, in which case binary users
4734: can't get foo without gfoo, or not default, in which case they can't get gfoo.
4735: With split packages, they can install foo without having GTK, and later decide
4736: to install gfoo (pulling in GTK at that time). This is an advantage to source
4737: users too, avoiding the need for rebuilds.
4738:
4739: Plugins with widely varying dependencies should usually be split instead of
4740: options.
4741:
4742: It is often more work to maintain split packages, especially if the upstream
4743: package does not support this. The decision of split vs. option should be made
4744: based on the likelihood that users will want or object to the various pieces,
4745: the size of the dependencies that are included, and the amount of work.
4746:
4747: A further consideration is licensing. Non-free parts, or parts that depend on
4748: non-free dependencies (especially plugins) should almost always be split if
4749: feasible.
4750:
1.184 rillig 4751: 16.1. Global default options
1.1 dsieger 4752:
4753: Global default options are listed in PKG_DEFAULT_OPTIONS, which is a list of
4754: the options that should be built into every package if that option is
1.4 rillig 4755: supported. This variable should be set in mk.conf.
1.1 dsieger 4756:
1.184 rillig 4757: 16.2. Converting packages to use bsd.options.mk
1.1 dsieger 4758:
4759: The following example shows how bsd.options.mk should be used by the
4760: hypothetical ``wibble'' package, either in the package Makefile, or in a file,
4761: e.g. options.mk, that is included by the main package Makefile.
4762:
4763: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
4764: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
4765: PKG_OPTIONS_OPTIONAL_GROUPS= database
4766: PKG_OPTIONS_GROUP.database= mysql pgsql
4767: PKG_SUGGESTED_OPTIONS= wibble-foo
4768: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
4769: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
4770:
4771: .include "../../mk/bsd.prefs.mk"
4772:
4773: # this package was previously named wibble2
4774: .if defined(PKG_OPTIONS.wibble2)
4775: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
4776: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
4777: "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead."
4778: .endif
4779:
4780: .include "../../mk/bsd.options.mk"
4781:
4782: # Package-specific option-handling
4783:
4784: ###
4785: ### FOO support
4786: ###
4787: .if !empty(PKG_OPTIONS:Mwibble-foo)
4788: CONFIGURE_ARGS+= --enable-foo
4789: .endif
4790:
4791: ###
4792: ### LDAP support
4793: ###
4794: .if !empty(PKG_OPTIONS:Mldap)
4795: . include "../../databases/openldap-client/buildlink3.mk"
4796: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client}
4797: .endif
4798:
4799: ###
4800: ### database support
4801: ###
4802: .if !empty(PKG_OPTIONS:Mmysql)
4803: . include "../../mk/mysql.buildlink3.mk"
4804: .endif
4805: .if !empty(PKG_OPTIONS:Mpgsql)
4806: . include "../../mk/pgsql.buildlink3.mk"
4807: .endif
4808:
4809: The first section contains the information about which build options are
4810: supported by the package, and any default options settings if needed.
4811:
4812: 1. PKG_OPTIONS_VAR is the name of the make(1) variable that the user can set
4813: to override the default options. It should be set to PKG_OPTIONS.pkgbase.
4814: Do not set it to PKG_OPTIONS.${PKGBASE}, since PKGBASE is not defined at
4815: the point where the options are processed.
4816:
4817: 2. PKG_SUPPORTED_OPTIONS is a list of build options supported by the package.
4818:
4819: 3. PKG_OPTIONS_OPTIONAL_GROUPS is a list of names of groups of mutually
4820: exclusive options. The options in each group are listed in
4821: PKG_OPTIONS_GROUP.groupname. The most specific setting of any option from
4822: the group takes precedence over all other options in the group. Options
4823: from the groups will be automatically added to PKG_SUPPORTED_OPTIONS.
4824:
4825: 4. PKG_OPTIONS_REQUIRED_GROUPS is like PKG_OPTIONS_OPTIONAL_GROUPS, but
4826: building the packages will fail if no option from the group is selected.
4827:
4828: 5. PKG_OPTIONS_NONEMPTY_SETS is a list of names of sets of options. At least
4829: one option from each set must be selected. The options in each set are
4830: listed in PKG_OPTIONS_SET.setname. Options from the sets will be
4831: automatically added to PKG_SUPPORTED_OPTIONS. Building the package will
4832: fail if no option from the set is selected.
4833:
4834: 6. PKG_SUGGESTED_OPTIONS is a list of build options which are enabled by
4835: default.
4836:
4837: 7. PKG_OPTIONS_LEGACY_VARS is a list of "USE_VARIABLE:option" pairs that map
1.4 rillig 4838: legacy mk.conf variables to their option counterparts. Pairs should be
1.1 dsieger 4839: added with "+=" to keep the listing of global legacy variables. A warning
4840: will be issued if the user uses a legacy variable.
4841:
4842: 8. PKG_OPTIONS_LEGACY_OPTS is a list of "old-option:new-option" pairs that map
4843: options that have been renamed to their new counterparts. Pairs should be
4844: added with "+=" to keep the listing of global legacy options. A warning
4845: will be issued if the user uses a legacy option.
4846:
4847: 9. PKG_LEGACY_OPTIONS is a list of options implied by deprecated variables
4848: used. This can be used for cases that neither PKG_OPTIONS_LEGACY_VARS nor
4849: PKG_OPTIONS_LEGACY_OPTS can handle, e. g. when PKG_OPTIONS_VAR is renamed.
4850:
4851: 10. PKG_OPTIONS_DEPRECATED_WARNINGS is a list of warnings about deprecated
4852: variables or options used, and what to use instead.
4853:
4854: A package should never modify PKG_DEFAULT_OPTIONS or the variable named in
4855: PKG_OPTIONS_VAR. These are strictly user-settable. To suggest a default set of
4856: options, use PKG_SUGGESTED_OPTIONS.
4857:
4858: PKG_OPTIONS_VAR must be defined before including bsd.options.mk. If none of
4859: PKG_SUPPORTED_OPTIONS, PKG_OPTIONS_OPTIONAL_GROUPS, and
4860: PKG_OPTIONS_REQUIRED_GROUPS are defined (as can happen with platform-specific
4861: options if none of them is supported on the current platform), PKG_OPTIONS is
4862: set to the empty list and the package is otherwise treated as not using the
4863: options framework.
4864:
4865: After the inclusion of bsd.options.mk, the variable PKG_OPTIONS contains the
4866: list of selected build options, properly filtered to remove unsupported and
4867: duplicate options.
4868:
4869: The remaining sections contain the logic that is specific to each option. The
4870: correct way to check for an option is to check whether it is listed in
4871: PKG_OPTIONS:
4872:
4873: .if !empty(PKG_OPTIONS:Moption)
4874:
1.184 rillig 4875: 16.3. Option Names
1.1 dsieger 4876:
4877: Options that enable similar features in different packages (like optional
4878: support for a library) should use a common name in all packages that support it
4879: (like the name of the library). If another package already has an option with
4880: the same meaning, use the same name.
4881:
4882: Options that enable features specific to one package, where it's unlikely that
4883: another (unrelated) package has the same (or a similar) optional feature,
4884: should use a name prefixed with pkgname-.
4885:
4886: If a group of related packages share an optional feature specific to that
4887: group, prefix it with the name of the "main" package (e. g.
4888: djbware-errno-hack).
4889:
4890: For new options, add a line to mk/defaults/options.description. Lines have two
4891: fields, separated by tab. The first field is the option name, the second its
4892: description. The description should be a whole sentence (starting with an
4893: uppercase letter and ending with a period) that describes what enabling the
4894: option does. E. g. "Enable ispell support." The file is sorted by option names.
4895:
1.184 rillig 4896: 16.4. Determining the options of dependencies
1.7 rillig 4897:
4898: When writing buildlink3.mk files, it is often necessary to list different
4899: dependencies based on the options with which the package was built. For
4900: querying these options, the file pkgsrc/mk/pkg-build-options.mk should be used.
4901: A typical example looks like this:
4902:
4903: pkgbase := libpurple
4904: .include "../../mk/pkg-build-options.mk"
4905:
4906: .if !empty(PKG_BUILD_OPTIONS.libpurple:Mdbus)
4907: ...
4908: .endif
4909:
4910: Including pkg-build-options.mk here will set the variable
4911: PKG_BUILD_OPTIONS.libpurple to the build options of the libpurple package,
4912: which can then be queried like PKG_OPTIONS in the options.mk file. See the file
4913: pkg-build-options.mk for more details.
4914:
1.184 rillig 4915: Chapter 17. Tools needed for building or running
4916:
4917: Table of Contents
4918:
4919: 17.1. Tools for pkgsrc builds
4920: 17.2. Tools needed by packages
4921: 17.3. Tools provided by platforms
4922:
4923: The USE_TOOLS definition is used both internally by pkgsrc and also for
4924: individual packages to define what commands are needed for building a package
4925: (like TOOL_DEPENDS) or for later run-time of an installed packaged (such as
4926: DEPENDS). If the native system provides an adequate tool, then in many cases, a
4927: pkgsrc package will not be used.
4928:
4929: When building a package, the replacement tools are made available in a
4930: directory (as symlinks or wrapper scripts) that is early in the executable
4931: search path. Just like the buildlink system, this helps with consistent builds.
4932:
4933: A tool may be needed to help build a specific package. For example, perl, GNU
4934: make (gmake) or yacc may be needed.
4935:
4936: Also a tool may be needed, for example, because the native system's supplied
4937: tool may be inefficient for building a package with pkgsrc. For example, a
4938: package may need GNU awk, bison (instead of yacc) or a better sed.
4939:
4940: The tools used by a package can be listed by running make show-tools.
4941:
4942: 17.1. Tools for pkgsrc builds
4943:
4944: The default set of tools used by pkgsrc is defined in bsd.pkg.mk. This includes
4945: standard Unix tools, such as: cat, awk, chmod, test, and so on. These can be
4946: seen by running: make show-var VARNAME=USE_TOOLS.
4947:
4948: If a package needs a specific program to build then the USE_TOOLS variable can
4949: be used to define the tools needed.
4950:
4951: 17.2. Tools needed by packages
4952:
4953: In the following examples, the :run means that it is needed at run-time (and
4954: becomes a DEPENDS). The default is a build dependency which can be set with
4955: :build. (So in this example, it is the same as gmake:build and
4956: pkg-config:build.)
4957:
4958: USE_TOOLS+= gmake perl:run pkg-config
4959:
4960: When using the tools framework, a TOOLS_PATH.foo variable is defined which
4961: contains the full path to the appropriate tool. For example, TOOLS_PATH.bash
4962: could be "/bin/bash" on Linux systems.
4963:
4964: If you always need a pkgsrc version of the tool at run-time, then just use
4965: DEPENDS instead.
4966:
4967: 17.3. Tools provided by platforms
4968:
4969: When improving or porting pkgsrc to a new platform, have a look at (or create)
4970: the corresponding platform specific make file fragment under pkgsrc/mk/tools/
4971: tools.${OPSYS}.mk which defines the name of the common tools. For example:
4972:
4973: .if exists(/usr/bin/bzcat)
4974: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
4975: .elif exists(/usr/bin/bzip2)
4976: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
4977: .endif
4978:
4979: TOOLS_PLATFORM.true?= true # shell builtin
4980:
4981: Chapter 18. Buildlink methodology
1.1 dsieger 4982:
4983: Table of Contents
4984:
1.184 rillig 4985: 18.1. Converting packages to use buildlink3
4986: 18.2. Writing buildlink3.mk files
4987: 18.2.1. Anatomy of a buildlink3.mk file
4988: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
1.259 leot 4989: buildlink3.mk files
1.184 rillig 4990: 18.3. Writing builtin.mk files
4991: 18.3.1. Anatomy of a builtin.mk file
4992:
4993: Buildlink is a framework in pkgsrc that controls what headers and libraries are
4994: seen by a package's configure and build processes. This is implemented in a two
4995: step process:
4996:
4997: 1. Symlink headers and libraries for dependencies into BUILDLINK_DIR, which by
4998: default is a subdirectory of WRKDIR.
4999:
5000: 2. Create wrapper scripts that are used in place of the normal compiler tools
5001: that translate -I${LOCALBASE}/include and -L${LOCALBASE}/lib into
5002: references to BUILDLINK_DIR. The wrapper scripts also make native compiler
5003: on some operating systems look like GCC, so that packages that expect GCC
5004: won't require modifications to build with those native compilers.
5005:
5006: This normalizes the environment in which a package is built so that the package
5007: may be built consistently despite what other software may be installed. Please
5008: note that the normal system header and library paths, e.g. /usr/include, /usr/
5009: lib, etc., are always searched -- buildlink3 is designed to insulate the
5010: package build from non-system-supplied software.
5011:
5012: 18.1. Converting packages to use buildlink3
1.1 dsieger 5013:
1.184 rillig 5014: The process of converting packages to use the buildlink3 framework ("bl3ifying"
5015: ) is fairly straightforward. The things to keep in mind are:
1.1 dsieger 5016:
1.184 rillig 5017: 1. Ensure that the build always calls the wrapper scripts instead of the
5018: actual toolchain. Some packages are tricky, and the only way to know for
5019: sure is the check ${WRKDIR}/.work.log to see if the wrappers are being
5020: invoked.
1.1 dsieger 5021:
1.184 rillig 5022: 2. Don't override PREFIX from within the package Makefile, e.g. Java VMs,
5023: standalone shells, etc., because the code to symlink files into $
5024: {BUILDLINK_DIR} looks for files relative to "pkg_info -qp pkgname".
1.1 dsieger 5025:
1.184 rillig 5026: 3. Remember that only the buildlink3.mk files that you list in a package's
5027: Makefile are added as dependencies for that package.
1.1 dsieger 5028:
1.184 rillig 5029: If a dependency on a particular package is required for its libraries and
5030: headers, then we replace:
1.1 dsieger 5031:
1.184 rillig 5032: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 dsieger 5033:
1.184 rillig 5034: with
1.1 dsieger 5035:
1.184 rillig 5036: .include "../../category/foo/buildlink3.mk"
1.1 dsieger 5037:
1.184 rillig 5038: The buildlink3.mk files usually define the required dependencies. If you need a
5039: newer version of the dependency when using buildlink3.mk files, then you can
5040: define it in your Makefile; for example:
1.1 dsieger 5041:
1.184 rillig 5042: BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0
5043: .include "../../category/foo/buildlink3.mk"
1.1 dsieger 5044:
1.184 rillig 5045: There are several buildlink3.mk files in pkgsrc/mk that handle special package
5046: issues:
1.1 dsieger 5047:
1.184 rillig 5048: * bdb.buildlink3.mk chooses either the native or a pkgsrc Berkeley DB
5049: implementation based on the values of BDB_ACCEPTED and BDB_DEFAULT.
1.1 dsieger 5050:
1.184 rillig 5051: * curses.buildlink3.mk: If the system comes with neither Curses nor NCurses,
5052: this will take care to install the devel/ncurses package.
1.1 dsieger 5053:
1.184 rillig 5054: * krb5.buildlink3.mk uses the value of KRB5_ACCEPTED to choose between adding
5055: a dependency on Heimdal or MIT-krb5 for packages that require a Kerberos 5
5056: implementation.
1.1 dsieger 5057:
1.184 rillig 5058: * motif.buildlink3.mk checks for a system-provided Motif installation or adds
5059: a dependency on x11/lesstif or x11/motif. The user can set MOTIF_TYPE to "
5060: dt", "lesstif" or "motif" to choose which Motif version will be used.
1.1 dsieger 5061:
1.184 rillig 5062: * readline.buildlink3.mk checks for a system-provided GNU readline or
5063: editline (libedit) installation, or adds a dependency on devel/readline,
5064: devel/editline. The user can set READLINE_DEFAULT to choose readline
5065: implementation. If your package really needs GNU readline library, its
5066: Makefile should include devel/readline/buildlink3.mk instead of
5067: readline.buildlink3.mk.
1.1 dsieger 5068:
1.184 rillig 5069: * oss.buildlink3.mk defines several variables that may be used by packages
5070: that use the Open Sound System (OSS) API.
1.1 dsieger 5071:
1.184 rillig 5072: * pgsql.buildlink3.mk will accept any of the Postgres versions in the
5073: variable PGSQL_VERSIONS_ACCEPTED and default to the version
5074: PGSQL_VERSION_DEFAULT. See the file for more information.
1.1 dsieger 5075:
1.184 rillig 5076: * pthread.buildlink3.mk uses the value of PTHREAD_OPTS and checks for native
5077: pthreads or adds a dependency on devel/pth as needed.
1.1 dsieger 5078:
1.184 rillig 5079: * xaw.buildlink3.mk uses the value of XAW_TYPE to choose a particular Athena
5080: widgets library.
1.1 dsieger 5081:
1.184 rillig 5082: The comments in those buildlink3.mk files provide a more complete description
5083: of how to use them properly.
1.1 dsieger 5084:
1.184 rillig 5085: 18.2. Writing buildlink3.mk files
1.1 dsieger 5086:
1.184 rillig 5087: A package's buildlink3.mk file is included by Makefiles to indicate the need to
5088: compile and link against header files and libraries provided by the package. A
5089: buildlink3.mk file should always provide enough information to add the correct
5090: type of dependency relationship and include any other buildlink3.mk files that
5091: it needs to find headers and libraries that it needs in turn.
1.1 dsieger 5092:
1.184 rillig 5093: To generate an initial buildlink3.mk file for further editing, Rene Hexel's
5094: pkgtools/createbuildlink package is highly recommended. For most packages, the
5095: following command will generate a good starting point for buildlink3.mk files:
1.1 dsieger 5096:
1.184 rillig 5097: % cd pkgsrc/category/pkgdir
5098: % createbuildlink >buildlink3.mk
1.1 dsieger 5099:
5100:
1.184 rillig 5101: 18.2.1. Anatomy of a buildlink3.mk file
1.1 dsieger 5102:
1.184 rillig 5103: The following real-life example buildlink3.mk is taken from pkgsrc/graphics/
5104: tiff:
1.14 jmcneill 5105:
1.184 rillig 5106: BUILDLINK_TREE+= tiff
1.1 dsieger 5107:
1.184 rillig 5108: .if !defined(TIFF_BUILDLINK3_MK)
5109: TIFF_BUILDLINK3_MK:=
1.1 dsieger 5110:
1.184 rillig 5111: BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1
5112: BUILDLINK_ABI_DEPENDS.tiff+= tiff>=3.7.2nb1
5113: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
1.1 dsieger 5114:
1.184 rillig 5115: .include "../../devel/zlib/buildlink3.mk"
5116: .include "../../graphics/jpeg/buildlink3.mk"
5117: .endif # TIFF_BUILDLINK3_MK
1.1 dsieger 5118:
1.184 rillig 5119: BUILDLINK_TREE+= -tiff
1.1 dsieger 5120:
1.184 rillig 5121: The header and footer manipulate BUILDLINK_TREE, which is common across all
5122: buildlink3.mk files and is used to track the dependency tree.
1.1 dsieger 5123:
1.184 rillig 5124: The main section is protected from multiple inclusion and controls how the
5125: dependency on pkg is added. Several important variables are set in the section:
1.1 dsieger 5126:
1.185 wiz 5127: * BUILDLINK_API_DEPENDS.pkg is the dependency version recorded in the
1.184 rillig 5128: installed package; this should always be set using += to ensure that we're
5129: appending to any pre-existing list of values. This variable should be set
1.185 wiz 5130: to the last version of the package that had an backwards-incompatible API
1.184 rillig 5131: change.
1.1 dsieger 5132:
1.184 rillig 5133: * BUILDLINK_PKGSRCDIR.pkg is the location of the pkg pkgsrc directory.
1.1 dsieger 5134:
1.184 rillig 5135: * BUILDLINK_DEPMETHOD.pkg (not shown above) controls whether we use
1.236 gutterid 5136: BUILD_DEPENDS or DEPENDS to add the dependency on pkg. The build dependency
5137: is selected by setting BUILDLINK_DEPMETHOD.pkg to "build". By default, the
5138: full dependency is used.
1.1 dsieger 5139:
1.184 rillig 5140: * BUILDLINK_INCDIRS.pkg and BUILDLINK_LIBDIRS.pkg (not shown above) are lists
5141: of subdirectories of ${BUILDLINK_PREFIX.pkg} to add to the header and
5142: library search paths. These default to "include" and "lib" respectively.
1.1 dsieger 5143:
1.184 rillig 5144: * BUILDLINK_CPPFLAGS.pkg (not shown above) is the list of preprocessor flags
5145: to add to CPPFLAGS, which are passed on to the configure and build phases.
5146: The "-I" option should be avoided and instead be handled using
5147: BUILDLINK_INCDIRS.pkg as above.
1.66 asau 5148:
1.184 rillig 5149: The following variables are all optionally defined within this second section
5150: (protected against multiple inclusion) and control which package files are
5151: symlinked into ${BUILDLINK_DIR} and how their names are transformed during the
5152: symlinking:
1.23 jakllsch 5153:
1.184 rillig 5154: * BUILDLINK_FILES.pkg (not shown above) is a shell glob pattern relative to $
5155: {BUILDLINK_PREFIX.pkg} to be symlinked into ${BUILDLINK_DIR}, e.g. include/
5156: *.h.
1.1 dsieger 5157:
1.184 rillig 5158: * BUILDLINK_FILES_CMD.pkg (not shown above) is a shell pipeline that outputs
5159: to stdout a list of files relative to ${BUILDLINK_PREFIX.pkg}. The
5160: resulting files are to be symlinked into ${BUILDLINK_DIR}. By default, this
5161: takes the +CONTENTS of a pkg and filters it through $
5162: {BUILDLINK_CONTENTS_FILTER.pkg}.
1.1 dsieger 5163:
1.184 rillig 5164: * BUILDLINK_CONTENTS_FILTER.pkg (not shown above) is a filter command that
5165: filters +CONTENTS input into a list of files relative to $
5166: {BUILDLINK_PREFIX.pkg} on stdout. By default, BUILDLINK_CONTENTS_FILTER.pkg
5167: outputs the contents of the include and lib directories in the package
5168: +CONTENTS.
1.1 dsieger 5169:
1.184 rillig 5170: * BUILDLINK_FNAME_TRANSFORM.pkg (not shown above) is a list of sed arguments
5171: used to transform the name of the source filename into a destination
5172: filename, e.g. -e "s|/curses.h|/ncurses.h|g".
1.1 dsieger 5173:
1.184 rillig 5174: This section can additionally include any buildlink3.mk needed for pkg's
5175: library dependencies. Including these buildlink3.mk files means that the
5176: headers and libraries for these dependencies are also symlinked into $
5177: {BUILDLINK_DIR} whenever the pkg buildlink3.mk file is included. Dependencies
5178: are only added for directly include buildlink3.mk files.
1.1 dsieger 5179:
1.184 rillig 5180: When providing a buildlink3.mk and including other buildlink3.mk files in it,
5181: please only add necessary ones, i.e., those whose libraries or header files are
5182: automatically exposed when the package is use.
1.1 dsieger 5183:
1.184 rillig 5184: In particular, if only an executable (bin/foo) is linked against a library,
5185: that library does not need to be propagated in the buildlink3.mk file.
1.1 dsieger 5186:
1.184 rillig 5187: The following steps should help you decide if a buildlink3.mk file needs to be
5188: included:
1.1 dsieger 5189:
1.184 rillig 5190: * Look at the installed header files: What headers do they include? The
5191: packages providing these files must be buildlinked.
1.1 dsieger 5192:
1.184 rillig 5193: * Run ldd on all installed libraries and look against what other libraries
5194: they link. Some of the packages providing these probably need to be
5195: buildlinked; however, it's not automatic, since e.g. GTK on some systems
5196: pulls in the X libraries, so they will show up in the ldd output, while on
5197: others (like OS X) it won't. ldd output can thus only be used as a hint.
1.1 dsieger 5198:
1.184 rillig 5199: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
5200: buildlink3.mk files
1.16 jnemeth 5201:
1.185 wiz 5202: Both variables set lower bounds for a version of this package. The two
5203: variables differ in that one describes source compatibility (API) and the other
5204: binary compatibility (ABI). The difference is that a change in the API breaks
5205: compilation of programs while changes in the ABI stop compiled programs from
5206: running.
5207:
5208: The BUILDLINK_API_DEPENDS.pkg variable in a buildlink3.mk should be changed
5209: very rarely. (One possible scenario: If all packages using this package need a
5210: higher version than defined in the buildlink3.mk, BUILDLINK_API_DEPENDS.pkg
5211: could be updated to that higher version.)
5212:
5213: On the other hand, changes to BUILDLINK_ABI_DEPENDS.pkg are more common. The
5214: variable will need to be updated every time the major version of one of its
5215: shared libraries is changed, or any other change where a binary built against
5216: the previous version of the package will not run against the new version any
5217: longer.
5218:
5219: In such a case, the package's BUILDLINK_ABI_DEPENDS.pkg must be increased to
5220: require the new package version. Then the PKGREVISION of all packages foo that
5221: depend on this package need to be increased, and if they have buildlink3.mk
5222: files, BUILDLINK_ABI_DEPENDS.foo in their buildlink3.mk files must be increased
5223: to the new version as well. This is required so that a package will pull in the
5224: versions of the packages that use the new ABI and that the packages'
5225: PKGREVISIONs uniquely identify the packages built against the new ABI. The
5226: pkgtools/revbump package can help with these updates.
1.1 dsieger 5227:
1.184 rillig 5228: See Section 21.1.5, "Handling dependencies" for more information about
1.185 wiz 5229: dependencies on other packages, including the BUILDLINK_API_DEPENDS
5230: definitions.
1.1 dsieger 5231:
1.184 rillig 5232: Please take careful consideration before adjusting BUILDLINK_API_DEPENDS.pkg or
1.185 wiz 5233: BUILDLINK_ABI_DEPENDS.pkg in a buildlink3.mk file as we don't want to cause
5234: unneeded package deletions and rebuilds. In many cases, new versions of
5235: packages work just fine with older dependencies.
1.1 dsieger 5236:
1.211 gutterid 5237: Also, it is not needed to set BUILDLINK_ABI_DEPENDS.pkg when it is identical to
1.184 rillig 5238: BUILDLINK_API_DEPENDS.pkg.
1.1 dsieger 5239:
1.211 gutterid 5240: Note there is also the distinction that users are able to disable enforcement
5241: of ABI dependencies using the USE_ABI_DEPENDS variable, but there is no
5242: equivalent option for API dependencies.
5243:
1.184 rillig 5244: 18.3. Writing builtin.mk files
1.1 dsieger 5245:
1.184 rillig 5246: Some packages in pkgsrc install headers and libraries that coincide with
5247: headers and libraries present in the base system. Aside from a buildlink3.mk
5248: file, these packages should also include a builtin.mk file that includes the
5249: necessary checks to decide whether using the built-in software or the pkgsrc
5250: software is appropriate.
1.1 dsieger 5251:
1.184 rillig 5252: The only requirements of a builtin.mk file for pkg are:
1.1 dsieger 5253:
1.184 rillig 5254: 1. It should set USE_BUILTIN.pkg to either "yes" or "no" after it is included.
1.1 dsieger 5255:
1.184 rillig 5256: 2. It should not override any USE_BUILTIN.pkg which is already set before the
5257: builtin.mk file is included.
1.1 dsieger 5258:
1.184 rillig 5259: 3. It should be written to allow multiple inclusion. This is very important
5260: and takes careful attention to Makefile coding.
1.1 dsieger 5261:
1.184 rillig 5262: 18.3.1. Anatomy of a builtin.mk file
1.1 dsieger 5263:
1.184 rillig 5264: The following is the recommended template for builtin.mk files:
1.1 dsieger 5265:
1.184 rillig 5266: .if !defined(IS_BUILTIN.foo)
5267: #
5268: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
5269: # genuinely exists in the system or not.
5270: #
5271: IS_BUILTIN.foo?= no
1.1 dsieger 5272:
1.184 rillig 5273: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
5274: # version can be determined.
5275: #
5276: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
5277: BUILTIN_PKG.foo?= foo-1.0
5278: . endif
5279: .endif # IS_BUILTIN.foo
1.1 dsieger 5280:
1.184 rillig 5281: .if !defined(USE_BUILTIN.foo)
5282: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
5283: . if defined(BUILTIN_PKG.foo)
5284: . for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
5285: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
5286: USE_BUILTIN.foo!= \
5287: ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \
5288: && ${ECHO} "yes" || ${ECHO} "no"
5289: . endif
5290: . endfor
5291: . endif
5292: .endif # USE_BUILTIN.foo
1.1 dsieger 5293:
1.184 rillig 5294: CHECK_BUILTIN.foo?= no
5295: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
5296: #
5297: # Here we place code that depends on whether USE_BUILTIN.foo is set to
5298: # "yes" or "no".
5299: #
5300: .endif # CHECK_BUILTIN.foo
1.1 dsieger 5301:
1.184 rillig 5302: The first section sets IS_BUILTIN.pkg depending on if pkg really exists in the
5303: base system. This should not be a base system software with similar
5304: functionality to pkg; it should only be "yes" if the actual package is included
5305: as part of the base system. This variable is only used internally within the
5306: builtin.mk file.
1.1 dsieger 5307:
1.184 rillig 5308: The second section sets BUILTIN_PKG.pkg to the version of pkg in the base
5309: system if it exists (if IS_BUILTIN.pkg is "yes"). This variable is only used
5310: internally within the builtin.mk file.
1.1 dsieger 5311:
1.184 rillig 5312: The third section sets USE_BUILTIN.pkg and is required in all builtin.mk files.
5313: The code in this section must make the determination whether the built-in
5314: software is adequate to satisfy the dependencies listed in
5315: BUILDLINK_API_DEPENDS.pkg. This is typically done by comparing BUILTIN_PKG.pkg
5316: against each of the dependencies in BUILDLINK_API_DEPENDS.pkg. USE_BUILTIN.pkg
5317: must be set to the correct value by the end of the builtin.mk file. Note that
5318: USE_BUILTIN.pkg may be "yes" even if IS_BUILTIN.pkg is "no" because we may make
5319: the determination that the built-in version of the software is similar enough
5320: to be used as a replacement.
1.1 dsieger 5321:
1.184 rillig 5322: The last section is guarded by CHECK_BUILTIN.pkg, and includes code that uses
5323: the value of USE_BUILTIN.pkg set in the previous section. This typically
5324: includes, e.g., adding additional dependency restrictions and listing
5325: additional files to symlink into ${BUILDLINK_DIR} (via BUILDLINK_FILES.pkg).
1.1 dsieger 5326:
1.184 rillig 5327: Chapter 19. PLIST issues
1.1 dsieger 5328:
1.184 rillig 5329: Table of Contents
1.1 dsieger 5330:
1.184 rillig 5331: 19.1. RCS ID
5332: 19.2. Semi-automatic PLIST generation
5333: 19.3. Tweaking output of make print-PLIST
5334: 19.4. Variable substitution in PLIST
5335: 19.5. Man page compression
5336: 19.6. Changing PLIST source with PLIST_SRC
5337: 19.7. Platform-specific and differing PLISTs
5338: 19.8. Build-specific PLISTs
5339: 19.9. Sharing directories between packages
1.1 dsieger 5340:
1.184 rillig 5341: The PLIST file contains a package's "packing list", i.e. a list of files that
5342: belong to the package (relative to the ${PREFIX} directory it's been installed
5343: in) plus some additional statements - see the pkg_create(1) man page for a full
5344: list. This chapter addresses some issues that need attention when dealing with
5345: the PLIST file (or files, see below!).
1.1 dsieger 5346:
1.184 rillig 5347: 19.1. RCS ID
1.1 dsieger 5348:
1.184 rillig 5349: Be sure to add a RCS ID line as the first thing in any PLIST file you write:
1.1 dsieger 5350:
1.184 rillig 5351: @comment $NetBSD $
1.1 dsieger 5352:
1.184 rillig 5353: An artificial space has been added between NetBSD and $, this is a workaround
5354: here to prevent CVS expanding to the filename of the guide. When adding the RCS
5355: ID the space should be omitted.
1.38 wiz 5356:
1.184 rillig 5357: 19.2. Semi-automatic PLIST generation
1.1 dsieger 5358:
1.184 rillig 5359: You can use the make print-PLIST command to output a PLIST that matches any new
5360: files since the package was extracted. See Section 13.17, "Other helpful
5361: targets" for more information on this target.
1.11 rillig 5362:
1.184 rillig 5363: 19.3. Tweaking output of make print-PLIST
1.1 dsieger 5364:
1.184 rillig 5365: The PRINT_PLIST_AWK variable takes a set of AWK patterns and actions that are
5366: used to filter the output of print-PLIST. You can append any chunk of AWK
5367: scripting you like to it, but be careful with quoting.
1.1 dsieger 5368:
1.184 rillig 5369: For example, to get all files inside the libdata/foo directory removed from the
5370: resulting PLIST:
1.1 dsieger 5371:
1.184 rillig 5372: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 dsieger 5373:
1.185 wiz 5374: The PRINT_PLIST_AWK transformations are evaluated after the file list and
5375: directory list are sorted. EARLY_PRINT_PLIST_AWK is like PRINT_PLIST_AWK except
5376: it operates before the file list and directory list are sorted.
5377:
1.184 rillig 5378: 19.4. Variable substitution in PLIST
1.1 dsieger 5379:
1.184 rillig 5380: A number of variables are substituted automatically in PLISTs when a package is
5381: installed on a system. This includes the following variables:
1.1 dsieger 5382:
1.184 rillig 5383: ${MACHINE_ARCH}, ${MACHINE_GNU_ARCH}
1.1 dsieger 5384:
1.184 rillig 5385: Some packages like emacs and perl embed information about which
5386: architecture they were built on into the pathnames where they install their
5387: files. To handle this case, PLIST will be preprocessed before actually
5388: used, and the symbol "${MACHINE_ARCH}" will be replaced by what uname -p
5389: gives. The same is done if the string ${MACHINE_GNU_ARCH} is embedded in
5390: PLIST somewhere - use this on packages that have GNU autoconf-created
5391: configure scripts.
1.1 dsieger 5392:
1.184 rillig 5393: Legacy note
1.1 dsieger 5394:
1.184 rillig 5395: There used to be a symbol "$ARCH" that was replaced by the output of uname
5396: -m, but that's no longer supported and has been removed.
1.1 dsieger 5397:
1.184 rillig 5398: ${OPSYS}, ${LOWER_OPSYS}, ${OS_VERSION}
1.1 dsieger 5399:
1.184 rillig 5400: Some packages want to embed the OS name and version into some paths. To do
5401: this, use these variables in the PLIST:
1.1 dsieger 5402:
1.259 leot 5403: + ${OPSYS} - output of "uname -s"
1.1 dsieger 5404:
1.259 leot 5405: + ${LOWER_OPSYS} - lowercase common name (eg. "solaris")
1.1 dsieger 5406:
1.259 leot 5407: + ${OS_VERSION} - "uname -r"
1.1 dsieger 5408:
1.184 rillig 5409: For a list of values which are replaced by default, the output of make help
5410: topic=PLIST_SUBST as well as searching the pkgsrc/mk directory with grep for
5411: PLIST_SUBST should help.
1.1 dsieger 5412:
1.184 rillig 5413: If you want to change other variables not listed above, you can add variables
5414: and their expansions to this variable in the following way, similar to
5415: MESSAGE_SUBST (see Section 12.5, "Optional files"):
1.1 dsieger 5416:
1.184 rillig 5417: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 5418:
1.184 rillig 5419: This replaces all occurrences of "${SOMEVAR}" in the PLIST with "somevalue".
1.1 dsieger 5420:
1.184 rillig 5421: The PLIST_VARS variable can be used to simplify the common case of
5422: conditionally including some PLIST entries. It can be done by adding
5423: PLIST_VARS+=foo and setting the corresponding PLIST.foo variable to yes if the
5424: entry should be included. This will substitute "${PLIST.foo}" in the PLIST with
5425: either """" or ""@comment "". For example, in Makefile:
1.1 dsieger 5426:
1.184 rillig 5427: PLIST_VARS+= foo
5428: .if condition
5429: PLIST.foo= yes
5430: .else
1.1 dsieger 5431:
1.184 rillig 5432: And then in PLIST:
1.1 dsieger 5433:
1.184 rillig 5434: @comment $NetBSD $
5435: bin/bar
5436: man/man1/bar.1
5437: ${PLIST.foo}bin/foo
5438: ${PLIST.foo}man/man1/foo.1
5439: ${PLIST.foo}share/bar/foo.data
1.1 dsieger 5440:
1.184 rillig 5441: An artificial space has been added between NetBSD and $, this is a workaround
5442: here to prevent CVS expanding to the filename of the guide. When adding the RCS
1.195 gutterid 5443: ID the space should be omitted.
1.1 dsieger 5444:
1.184 rillig 5445: 19.5. Man page compression
1.1 dsieger 5446:
1.184 rillig 5447: Man pages should be installed in compressed form if MANZ is set (in
5448: bsd.own.mk), and uncompressed otherwise. To handle this in the PLIST file, the
5449: suffix ".gz" is appended/removed automatically for man pages according to MANZ
5450: and MANCOMPRESSED being set or not, see above for details. This modification of
5451: the PLIST file is done on a copy of it, not PLIST itself.
1.100 leot 5452:
1.184 rillig 5453: 19.6. Changing PLIST source with PLIST_SRC
1.100 leot 5454:
1.184 rillig 5455: To use one or more files as source for the PLIST used in generating the binary
5456: package, set the variable PLIST_SRC to the names of that file(s). The files are
5457: later concatenated using cat(1), and the order of things is important. The
5458: default for PLIST_SRC is ${PKGDIR}/PLIST.
1.1 dsieger 5459:
1.184 rillig 5460: 19.7. Platform-specific and differing PLISTs
1.1 dsieger 5461:
1.184 rillig 5462: Some packages decide to install a different set of files based on the operating
5463: system being used. These differences can be automatically handled by using the
5464: following files:
1.1 dsieger 5465:
1.184 rillig 5466: * PLIST.common
1.1 dsieger 5467:
1.184 rillig 5468: * PLIST.${OPSYS}
1.1 dsieger 5469:
1.184 rillig 5470: * PLIST.${MACHINE_ARCH}
1.1 dsieger 5471:
1.184 rillig 5472: * PLIST.${OPSYS}-${MACHINE_ARCH}
1.1 dsieger 5473:
1.184 rillig 5474: * PLIST.common_end
1.1 dsieger 5475:
1.184 rillig 5476: 19.8. Build-specific PLISTs
1.1 dsieger 5477:
1.184 rillig 5478: Some packages decide to generate hard-to-guess file names during installation
5479: that are hard to wire down.
1.1 dsieger 5480:
1.184 rillig 5481: In such cases, you can set the GENERATE_PLIST variable to shell code terminated
5482: (with a semicolon) that will output PLIST entries which will be appended to the
5483: PLIST
1.1 dsieger 5484:
1.184 rillig 5485: You can find one example in editors/xemacs:
1.1 dsieger 5486:
1.184 rillig 5487: GENERATE_PLIST+= ${ECHO} bin/${DISTNAME}-`${WRKSRC}/src/xemacs -sd`.dmp ;
1.1 dsieger 5488:
1.184 rillig 5489: which will append something like bin/xemacs-21.4.23-54e8ea71.dmp to the PLIST.
1.1 dsieger 5490:
1.184 rillig 5491: 19.9. Sharing directories between packages
1.1 dsieger 5492:
1.184 rillig 5493: A "shared directory" is a directory where multiple (and unrelated) packages
5494: install files. These directories were problematic because you had to add
5495: special tricks in the PLIST to conditionally remove them, or have some
5496: centralized package handle them.
1.106 tnn 5497:
1.184 rillig 5498: In pkgsrc, it is now easy: Each package should create directories and install
5499: files as needed; pkg_delete will remove any directories left empty after
5500: uninstalling a package.
1.106 tnn 5501:
1.184 rillig 5502: If a package needs an empty directory to work, create the directory during
5503: installation as usual, and also add an entry to the PLIST:
1.1 dsieger 5504:
1.184 rillig 5505: @pkgdir path/to/empty/directory
1.1 dsieger 5506:
1.184 rillig 5507: or take a look at MAKE_DIRS and OWN_DIRS.
1.1 dsieger 5508:
1.184 rillig 5509: Chapter 20. The pkginstall framework
1.1 dsieger 5510:
1.184 rillig 5511: Table of Contents
1.1 dsieger 5512:
1.184 rillig 5513: 20.1. Files and directories outside the installation prefix
5514: 20.1.1. Directory manipulation
5515: 20.1.2. File manipulation
5516: 20.2. Configuration files
5517: 20.2.1. How PKG_SYSCONFDIR is set
5518: 20.2.2. Telling the software where configuration files are
1.239 dholland 5519: 20.2.3. Patching installation
5520: 20.2.4. Declaring configuration files
5521: 20.2.5. Disabling handling of configuration files
1.184 rillig 5522: 20.3. System startup scripts
5523: 20.3.1. Disabling handling of system startup scripts
5524: 20.4. System users and groups
5525: 20.5. System shells
5526: 20.5.1. Disabling shell registration
5527: 20.6. Fonts
5528: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 5529:
1.184 rillig 5530: This chapter describes the framework known as pkginstall, whose key features
5531: are:
1.1 dsieger 5532:
1.184 rillig 5533: * Generic installation and manipulation of directories and files outside the
5534: pkgsrc-handled tree, LOCALBASE.
1.1 dsieger 5535:
1.184 rillig 5536: * Automatic handling of configuration files during installation, provided
5537: that packages are correctly designed.
1.1 dsieger 5538:
1.184 rillig 5539: * Generation and installation of system startup scripts.
1.1 dsieger 5540:
1.184 rillig 5541: * Registration of system users and groups.
1.1 dsieger 5542:
1.184 rillig 5543: * Registration of system shells.
1.1 dsieger 5544:
1.184 rillig 5545: * Automatic updating of fonts databases.
1.1 dsieger 5546:
1.184 rillig 5547: The following sections inspect each of the above points in detail.
1.1 dsieger 5548:
1.184 rillig 5549: You may be thinking that many of the things described here could be easily done
5550: with simple code in the package's post-installation target (post-install). This
5551: is incorrect, as the code in them is only executed when building from source.
5552: Machines using binary packages could not benefit from it at all (as the code
5553: itself could be unavailable). Therefore, the only way to achieve any of the
5554: items described above is by means of the installation scripts, which are
5555: automatically generated by pkginstall.
1.1 dsieger 5556:
1.184 rillig 5557: 20.1. Files and directories outside the installation prefix
1.95 wiz 5558:
1.184 rillig 5559: As you already know, the PLIST file holds a list of files and directories that
5560: belong to a package. The names used in it are relative to the installation
5561: prefix (${PREFIX}), which means that it cannot register files outside this
5562: directory (absolute path names are not allowed). Despite this restriction, some
5563: packages need to install files outside this location; e.g., under ${VARBASE} or
5564: ${PKG_SYSCONFDIR}. The only way to achieve this is to create such files during
5565: installation time by using installation scripts.
1.95 wiz 5566:
1.184 rillig 5567: The generic installation scripts are shell scripts that can contain arbitrary
5568: code. The list of scripts to execute is taken from the INSTALL_FILE variable,
5569: which defaults to INSTALL. A similar variable exists for package removal
5570: (DEINSTALL_FILE, whose default is DEINSTALL). These scripts can run arbitrary
5571: commands, so they have the potential to create and manage files anywhere in the
5572: file system.
1.95 wiz 5573:
1.184 rillig 5574: Using these general installation files is not recommended, but may be needed in
5575: some special cases. One reason for avoiding them is that the user has to trust
5576: the packager that there is no unwanted or simply erroneous code included in the
5577: installation script. Also, previously there were many similar scripts for the
5578: same functionality, and fixing a common error involved finding and changing all
5579: of them.
1.95 wiz 5580:
1.184 rillig 5581: The pkginstall framework offers another, standardized way. It provides generic
5582: scripts to abstract the manipulation of such files and directories based on
5583: variables set in the package's Makefile. The rest of this section describes
5584: these variables.
1.1 dsieger 5585:
1.184 rillig 5586: 20.1.1. Directory manipulation
1.1 dsieger 5587:
1.184 rillig 5588: The following variables can be set to request the creation of directories
5589: anywhere in the file system:
1.1 dsieger 5590:
1.184 rillig 5591: * MAKE_DIRS and OWN_DIRS contain a list of directories that should be created
5592: and should attempt to be destroyed by the installation scripts. The
5593: difference between the two is that the latter prompts the administrator to
5594: remove any directories that may be left after deinstallation (because they
5595: were not empty), while the former does not. Example:
1.1 dsieger 5596:
1.184 rillig 5597: MAKE_DIRS+= ${VARBASE}/foo/private
1.1 dsieger 5598:
1.184 rillig 5599: * MAKE_DIRS_PERMS and OWN_DIRS_PERMS contain a list of tuples describing
5600: which directories should be created and should attempt to be destroyed by
5601: the installation scripts. Each tuple holds the following values, separated
5602: by spaces: the directory name, its owner, its group and its numerical mode.
5603: For example:
1.1 dsieger 5604:
1.184 rillig 5605: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private \
5606: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 5607:
1.184 rillig 5608: The difference between the two is exactly the same as their non-PERMS
5609: counterparts.
1.1 dsieger 5610:
1.184 rillig 5611: 20.1.2. File manipulation
1.1 dsieger 5612:
1.184 rillig 5613: Creating non-empty files outside the installation prefix is tricky because the
5614: PLIST forces all files to be inside it. To overcome this problem, the only
1.239 dholland 5615: solution is to extract the file in a known place (i.e., inside the installation
5616: prefix) and copy it to the appropriate location during installation (done by
5617: the installation scripts generated by pkginstall). We will call the former the
5618: reference file in the following paragraphs, which describe the variables that
5619: can be used to automatically and consistently handle files outside the
5620: installation prefix:
5621:
5622: * REQD_FILES is a list of pairs of reference and target files. At
5623: installation time, the reference file is copied to the target if and only
5624: if the latter does not exist. Upon deinstallation, the reference file is
1.184 rillig 5625: removed provided that it was not modified by the installation.
1.1 dsieger 5626:
1.239 dholland 5627: * REQD_FILES_PERMS contains tuples describing reference files and targets,
5628: including owner, group, and numeric permissions that should be set. For
5629: example:
1.1 dsieger 5630:
1.184 rillig 5631: REQD_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile \
5632: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 5633:
1.239 dholland 5634: * CONF_FILES and CONF_FILES_PERMS have the same syntax as REQD_FILES and
5635: REQD_FILES_PERMS respectively. The difference is that these variables are
5636: specifically intended for handling configuration files, for which
5637: additional conventions and constraints apply. See Section 20.2,
5638: "Configuration files" for further discussion. Note in particular that while
5639: handling of configuration files can be disabled by the user (see
5640: Section 20.2.5, "Disabling handling of configuration files"), this setting
5641: does not affect REQD_FILES and REQD_FILES_PERMS.
5642:
5643: To install an empty file, one can use these macros and /dev/null as the
5644: reference file.
1.1 dsieger 5645:
1.184 rillig 5646: 20.2. Configuration files
1.1 dsieger 5647:
1.239 dholland 5648: There are two principles that govern the handling of configuration files in
5649: pkgsrc: first, the user's configuration must not be lost or overwritten by
5650: upgrades or reinstallations; and second, the default configuration should
5651: always be available for reference. To that end, pkgsrc has a framework
5652: specifically for handling configuration files. In general, configuration files
5653: are installed into ${PREFIX}/share/examples, and copied from there to the
5654: pertinent etc directory as a separate step and only as needed.
5655:
5656: To make this work, there are three things that need to happen, any of which may
5657: require patching. First, the package must be told to read its configuration
5658: from the correct place at runtime; this place is ${PKG_SYSCONFDIR} (or possibly
5659: a subdirectory of it) which is often but not always ${PREFIX}/etc. Second, the
5660: package must be taught to install its default configuration files in ${PREFIX}/
5661: share/examples/${PKGBASE}; this is the point at which patching often becomes
5662: required because it is not the same place as the runtime location. Third, the
5663: configuration files need to be declared in the package makefile; this is the
5664: easy part.
5665:
5666: With those elements in place, the right things will happen: the package install
5667: phase and resulting binary package will not touch ${PKG_SYSCONFDIR}, and the
5668: default configuration will be copied into place by the pkgsrc framework only if
5669: not already present. Similarly, upon deinstall the configuration will not be
5670: removed if it has been modified. (This means that in the case of reinstallation
5671: and upgrades, unmodified configuration files are updated but modifications are
5672: never discarded.)
5673:
5674: The following sections describe how to make these things happen and document
5675: other relevant knobs available in the pkgsrc infrastructure.
1.1 dsieger 5676:
1.184 rillig 5677: 20.2.1. How PKG_SYSCONFDIR is set
1.1 dsieger 5678:
1.184 rillig 5679: As said before, the PKG_SYSCONFDIR variable specifies where configuration files
5680: shall be installed. Its contents are set based upon the following variables:
1.1 dsieger 5681:
1.184 rillig 5682: * PKG_SYSCONFBASE: The configuration's root directory. Defaults to ${PREFIX}/
1.239 dholland 5683: etc although it may be overridden by the user to point to their preferred
1.184 rillig 5684: location (e.g., /etc, /etc/pkg, etc.). Packages must not use it directly.
1.1 dsieger 5685:
1.184 rillig 5686: * PKG_SYSCONFSUBDIR: A subdirectory of PKG_SYSCONFBASE under which the
5687: configuration files for the package being built shall be installed. The
5688: definition of this variable only makes sense in the package's Makefile
5689: (i.e., it is not user-customizable).
1.1 dsieger 5690:
1.184 rillig 5691: As an example, consider the Apache package, www/apache24, which places its
5692: configuration files under the httpd/ subdirectory of PKG_SYSCONFBASE. This
5693: should be set in the package Makefile.
1.1 dsieger 5694:
1.184 rillig 5695: * PKG_SYSCONFVAR: Specifies the name of the variable that holds this
5696: package's configuration directory (if different from PKG_SYSCONFBASE). It
5697: defaults to PKGBASE's value, and is always prefixed with PKG_SYSCONFDIR.
1.1 dsieger 5698:
1.184 rillig 5699: * PKG_SYSCONFDIR.${PKG_SYSCONFVAR}: Holds the directory where the
5700: configuration files for the package identified by PKG_SYSCONFVAR's shall be
5701: placed.
1.1 dsieger 5702:
1.184 rillig 5703: Based on the above variables, pkginstall determines the value of
1.239 dholland 5704: PKG_SYSCONFDIR, which is the only variable that may be used within a package to
1.184 rillig 5705: refer to its configuration directory. The algorithm used to set its value is
5706: basically the following:
1.1 dsieger 5707:
1.184 rillig 5708: 1. If PKG_SYSCONFDIR.${PKG_SYSCONFVAR} is set, its value is used.
1.1 dsieger 5709:
1.184 rillig 5710: 2. If the previous variable is not defined but PKG_SYSCONFSUBDIR is set in the
5711: package's Makefile, the resulting value is ${PKG_SYSCONFBASE}/$
5712: {PKG_SYSCONFSUBDIR}.
1.1 dsieger 5713:
1.184 rillig 5714: 3. Otherwise, it is set to ${PKG_SYSCONFBASE}.
1.1 dsieger 5715:
1.184 rillig 5716: It is worth mentioning that ${PKG_SYSCONFDIR} is automatically added to
1.239 dholland 5717: OWN_DIRS. This causes it to be automatically created if needed. See
5718: Section 20.1.1, "Directory manipulation" for further details. This does not
5719: apply to subdirectories of ${PKG_SYSCONFDIR}; they must be manually created
5720: with OWN_DIRS or MAKE_DIRS.
1.1 dsieger 5721:
1.184 rillig 5722: 20.2.2. Telling the software where configuration files are
1.1 dsieger 5723:
1.184 rillig 5724: Given that pkgsrc (and users!) expect configuration files to be in a known
1.239 dholland 5725: place, you need to teach each package where to install its files. In some cases
5726: you will have to patch the package Makefiles to achieve it. If you are lucky,
5727: though, it may be as easy as passing an extra flag to the configuration script.
5728: This is the case for packages using GNU autoconf:
1.1 dsieger 5729:
1.184 rillig 5730: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.1 dsieger 5731:
1.184 rillig 5732: Note that this specifies where the package has to look for its configuration
1.239 dholland 5733: files, not where they will be installed. Fortunately, there is a different way
1.240 gutterid 5734: to specify the latter, as seen in the next section, although the combination is
5735: rather confusing at first glance.
1.1 dsieger 5736:
1.239 dholland 5737: 20.2.3. Patching installation
1.1 dsieger 5738:
1.239 dholland 5739: As discussed above, packages themselves must not touch the contents of $
1.184 rillig 5740: {PKG_SYSCONFDIR} directly. Bad news is that many software installation scripts
5741: will, out of the box, mess with the contents of that directory. So what is the
5742: correct procedure to fix this issue?
1.1 dsieger 5743:
1.184 rillig 5744: You must teach the package (usually by manually patching it) to install any
5745: configuration files under the examples hierarchy, share/examples/${PKGBASE}/.
5746: This way, the PLIST registers them and the administrator always has the
5747: original copies available.
1.1 dsieger 5748:
1.239 dholland 5749: It turns out that for packages using GNU autoconf it is possible to create the
5750: desired effect by setting sysconfdir on the make command line at install time.
5751: Consider this example taken from mail/mutt:
5752:
5753: EGDIR= ${PREFIX}/share/examples/mutt
5754: INSTALL_MAKE_FLAGS= ${MAKE_FLAGS} sysconfdir=${EGDIR}
5755:
5756: Note that the EGDIR variable, though commonly used for this purpose, is local
5757: to that package and has no meaning outside it.
1.1 dsieger 5758:
1.239 dholland 5759: 20.2.4. Declaring configuration files
1.1 dsieger 5760:
1.239 dholland 5761: Once the required configuration files are in place (i.e., under the examples
5762: hierarchy), the pkginstall framework can use them as reference copies during
5763: the package installation to update what is in ${PKG_SYSCONFDIR}. To achieve
5764: this, the variables CONF_FILES and CONF_FILES_PERMS are used. Check out
5765: Section 20.1.2, "File manipulation" for further information about their syntax
5766: and their purpose. Here is an example, taken from the mail/mutt package:
5767:
5768: EGDIR= ${PREFIX}/share/examples/mutt
5769: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
5770:
5771: Note that (as in the previous section's example) the EGDIR variable is specific
5772: to the package and has no meaning outside it.
5773:
5774: For reference, the complete example from Mutt is as follows:
5775:
5776: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
5777: EGDIR= ${PREFIX}/share/examples/mutt
5778: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
5779: INSTALLATION_DIRS+= ${EGDIR}
5780: INSTALL_MAKE_FLAGS= ${MAKE_FLAGS} sysconfdir=${EGDIR}
1.1 dsieger 5781:
1.239 dholland 5782: 20.2.5. Disabling handling of configuration files
1.1 dsieger 5783:
1.184 rillig 5784: The automatic copying of config files can be toggled by setting the environment
5785: variable PKG_CONFIG prior to package installation.
1.1 dsieger 5786:
1.184 rillig 5787: 20.3. System startup scripts
1.1 dsieger 5788:
1.184 rillig 5789: System startup scripts are special files because they must be installed in a
5790: place known by the underlying OS, usually outside the installation prefix.
5791: Therefore, the same rules described in Section 20.1, "Files and directories
5792: outside the installation prefix" apply, and the same solutions can be used.
5793: However, pkginstall provides a special mechanism to handle these files.
1.1 dsieger 5794:
1.184 rillig 5795: In order to provide system startup scripts, the package has to:
1.1 dsieger 5796:
1.184 rillig 5797: 1. Store the script inside ${FILESDIR}, with the .sh suffix appended.
1.223 nia 5798: Considering the print/cups-base package as an example, it has a cupsd.sh in
5799: its files directory.
1.95 wiz 5800:
1.184 rillig 5801: 2. Tell pkginstall to handle it, appending the name of the script, without its
5802: extension, to the RCD_SCRIPTS variable. Continuing the previous example:
1.95 wiz 5803:
1.184 rillig 5804: RCD_SCRIPTS+= cupsd
1.95 wiz 5805:
1.184 rillig 5806: Once this is done, pkginstall will do the following steps for each script in an
5807: automated fashion:
1.95 wiz 5808:
1.184 rillig 5809: 1. Process the file found in the files directory applying all the
5810: substitutions described in the FILES_SUBST variable.
1.1 dsieger 5811:
1.184 rillig 5812: 2. Copy the script from the files directory to the examples hierarchy, $
1.239 dholland 5813: {PREFIX}/share/examples/rc.d/. Note that this reference file must be
1.184 rillig 5814: explicitly registered in the PLIST.
1.1 dsieger 5815:
1.184 rillig 5816: 3. Add code to the installation scripts to copy the startup script from the
5817: examples hierarchy into the system-wide startup scripts directory.
1.1 dsieger 5818:
1.184 rillig 5819: 20.3.1. Disabling handling of system startup scripts
1.1 dsieger 5820:
1.184 rillig 5821: The automatic copying of config files can be toggled by setting the environment
5822: variable PKG_RCD_SCRIPTS prior to package installation. Note that the scripts
5823: will be always copied inside the examples hierarchy, ${PREFIX}/share/examples/
5824: rc.d/, no matter what the value of this variable is.
1.1 dsieger 5825:
1.184 rillig 5826: 20.4. System users and groups
1.1 dsieger 5827:
1.184 rillig 5828: If a package needs to create special users and/or groups during installation,
5829: it can do so by using the pkginstall framework.
1.1 dsieger 5830:
1.184 rillig 5831: Users can be created by adding entries to the PKG_USERS variable. Each entry
5832: has the following syntax:
1.1 dsieger 5833:
1.184 rillig 5834: user:group
1.1 dsieger 5835:
1.184 rillig 5836: Further specification of user details may be done by setting per-user
5837: variables. PKG_UID.user is the numeric UID for the user. PKG_GECOS.user is the
5838: user's description or comment. PKG_HOME.user is the user's home directory, and
5839: defaults to /nonexistent if not specified. PKG_SHELL.user is the user's shell,
5840: and defaults to /sbin/nologin if not specified.
1.1 dsieger 5841:
1.184 rillig 5842: Similarly, groups can be created by adding entries to the PKG_GROUPS variable,
5843: whose syntax is:
1.1 dsieger 5844:
1.184 rillig 5845: group
1.1 dsieger 5846:
1.184 rillig 5847: The numeric GID of the group may be set by defining PKG_GID.group.
1.1 dsieger 5848:
1.184 rillig 5849: If a package needs to create the users and groups at an earlier stage, then it
5850: can set USERGROUP_PHASE to either configure,build, or pre-install to indicate
5851: the phase before which the users and groups are created. In this case, the
5852: numeric UIDs and GIDs of the created users and groups are automatically
5853: hardcoded into the final installation scripts.
1.1 dsieger 5854:
1.184 rillig 5855: 20.5. System shells
1.1 dsieger 5856:
1.184 rillig 5857: Packages that install system shells should register them in the shell database,
5858: /etc/shells, to make things easier to the administrator. This must be done from
5859: the installation scripts to keep binary packages working on any system.
5860: pkginstall provides an easy way to accomplish this task.
1.1 dsieger 5861:
1.184 rillig 5862: When a package provides a shell interpreter, it has to set the PKG_SHELL
5863: variable to its absolute file name. This will add some hooks to the
5864: installation scripts to handle it. Consider the following example, taken from
5865: shells/zsh:
1.1 dsieger 5866:
1.184 rillig 5867: PKG_SHELL= ${PREFIX}/bin/zsh
1.1 dsieger 5868:
1.184 rillig 5869: 20.5.1. Disabling shell registration
1.1 dsieger 5870:
1.184 rillig 5871: The automatic registration of shell interpreters can be disabled by the
5872: administrator by setting the PKG_REGISTER_SHELLS environment variable to NO.
1.1 dsieger 5873:
1.184 rillig 5874: 20.6. Fonts
1.1 dsieger 5875:
1.184 rillig 5876: Packages that install X11 fonts should update the database files that index the
5877: fonts within each fonts directory. This can easily be accomplished within the
5878: pkginstall framework.
1.1 dsieger 5879:
1.184 rillig 5880: When a package installs X11 fonts, it must list the directories in which fonts
5881: are installed in the FONTS_DIRS.type variables, where type can be one of "ttf",
5882: "type1" or "x11". This will add hooks to the installation scripts to run the
5883: appropriate commands to update the fonts database files within each of those
5884: directories. For convenience, if the directory path is relative, it is taken to
5885: be relative to the package's installation prefix. Consider the following
5886: example, taken from fonts/dbz-ttf:
1.1 dsieger 5887:
1.184 rillig 5888: FONTS_DIRS.ttf= ${PREFIX}/share/fonts/X11/TTF
1.1 dsieger 5889:
1.184 rillig 5890: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 5891:
1.184 rillig 5892: The automatic update of fonts databases can be disabled by the administrator by
5893: setting the PKG_UPDATE_FONTS_DB environment variable to NO.
1.1 dsieger 5894:
1.154 rillig 5895: Chapter 21. Making your package work
1.1 dsieger 5896:
5897: Table of Contents
5898:
1.154 rillig 5899: 21.1. General operation
5900: 21.1.1. How to pull in user-settable variables from mk.conf
5901: 21.1.2. User interaction
5902: 21.1.3. Handling licenses
5903: 21.1.4. Restricted packages
5904: 21.1.5. Handling dependencies
5905: 21.1.6. Handling conflicts with other packages
5906: 21.1.7. Packages that cannot or should not be built
5907: 21.1.8. Packages which should not be deleted, once installed
5908: 21.1.9. Handling packages with security problems
5909: 21.1.10. How to handle incrementing versions when fixing an existing
1.259 leot 5910: package
1.154 rillig 5911: 21.1.11. Substituting variable text in the package files (the SUBST
1.259 leot 5912: framework)
1.154 rillig 5913: 21.2. The fetch phase
5914: 21.2.1. Packages whose distfiles aren't available for plain downloading
5915: 21.2.2. How to handle modified distfiles with the 'old' name
5916: 21.2.3. Packages hosted on github.com
5917: 21.3. The configure phase
5918: 21.3.1. Shared libraries - libtool
5919: 21.3.2. Using libtool on GNU packages that already support libtool
5920: 21.3.3. GNU Autoconf/Automake
1.223 nia 5921: 21.3.4. Meson / ninja
1.260 ! wiz 5922: 21.3.5. Determining the endianness
1.154 rillig 5923: 21.4. Programming languages
5924: 21.4.1. C, C++, and Fortran
5925: 21.4.2. Java
1.205 wiz 5926: 21.4.3. Go
1.223 nia 5927: 21.4.4. Rust
5928: 21.4.5. Packages containing Perl scripts
5929: 21.4.6. Packages containing shell scripts
5930: 21.4.7. Other programming languages
1.154 rillig 5931: 21.5. The build phase
5932: 21.5.1. Compiling C and C++ code conditionally
5933: 21.5.2. How to handle compiler bugs
1.172 rillig 5934: 21.5.3. No such file or directory
5935: 21.5.4. Undefined reference to "..."
5936: 21.5.5. Running out of memory
1.154 rillig 5937: 21.6. The install phase
5938: 21.6.1. Creating needed directories
5939: 21.6.2. Where to install documentation
5940: 21.6.3. Installing highscore files
5941: 21.6.4. Adding DESTDIR support to packages
5942: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 5943: 21.6.6. Packages installing Perl modules
1.254 wiz 5944: 21.6.7. Packages installing pkg-config files
5945: 21.6.8. Packages installing info files
5946: 21.6.9. Packages installing man pages
5947: 21.6.10. Packages installing X11 fonts
5948: 21.6.11. Packages installing SGML or XML data
5949: 21.6.12. Packages installing extensions to the MIME database
5950: 21.6.13. Packages using intltool
5951: 21.6.14. Packages installing startup scripts
5952: 21.6.15. Packages installing TeX modules
5953: 21.6.16. Packages supporting running binaries in emulation
5954: 21.6.17. Packages installing hicolor icons
5955: 21.6.18. Packages installing desktop files
1.154 rillig 5956: 21.7. Marking packages as having problems
1.1 dsieger 5957:
1.154 rillig 5958: 21.1. General operation
1.1 dsieger 5959:
5960: One appealing feature of pkgsrc is that it runs on many different platforms. As
5961: a result, it is important to ensure, where possible, that packages in pkgsrc
5962: are portable. This chapter mentions some particular details you should pay
5963: attention to while working on pkgsrc.
5964:
1.154 rillig 5965: 21.1.1. How to pull in user-settable variables from mk.conf
1.1 dsieger 5966:
5967: The pkgsrc user can configure pkgsrc by overriding several variables in the
1.4 rillig 5968: file pointed to by MAKECONF, which is mk.conf by default. When you want to use
5969: those variables in the preprocessor directives of make(1) (for example .if or
5970: .for), you need to include the file ../../mk/bsd.prefs.mk before, which in turn
5971: loads the user preferences.
1.1 dsieger 5972:
5973: But note that some variables may not be completely defined after ../../mk/
5974: bsd.prefs.mk has been included, as they may contain references to variables
1.108 rillig 5975: that are not yet defined. In shell commands (the lines in Makefile that are
5976: indented with a tab) this is no problem, since variables are only expanded when
5977: they are used. But in the preprocessor directives mentioned above and in
5978: dependency lines (of the form target: dependencies) the variables are expanded
5979: at load time.
1.1 dsieger 5980:
5981: Note
5982:
1.108 rillig 5983: To check whether a variable can be used at load time, run pkglint -Wall on your
5984: package.
1.1 dsieger 5985:
1.154 rillig 5986: 21.1.2. User interaction
1.1 dsieger 5987:
5988: Occasionally, packages require interaction from the user, and this can be in a
5989: number of ways:
5990:
5991: * When fetching the distfiles, some packages require user interaction such as
5992: entering username/password or accepting a license on a web page.
5993:
5994: * When extracting the distfiles, some packages may ask for passwords.
5995:
5996: * help to configure the package before it is built
5997:
5998: * help during the build process
5999:
6000: * help during the installation of a package
6001:
1.108 rillig 6002: A package can set the INTERACTIVE_STAGE variable to define which stages need
6003: interaction. This should be done in the package's Makefile, e.g.:
1.1 dsieger 6004:
6005: INTERACTIVE_STAGE= configure install
6006:
6007: The user can then decide to skip this package by setting the BATCH variable.
1.108 rillig 6008: Packages that require interaction are also excluded from bulk builds.
1.1 dsieger 6009:
1.154 rillig 6010: 21.1.3. Handling licenses
1.1 dsieger 6011:
6012: Authors of software can choose the licence under which software can be copied.
1.111 sevan 6013: The Free Software Foundation has declared some licenses "Free", and the Open
6014: Source Initiative has a definition of "Open Source".
6015:
6016: By default, pkgsrc allows packages with Free or Open Source licenses to be
6017: built. To allow packages with other licenses to be built as well, the pkgsrc
6018: user needs to add these licenses to the ACCEPTABLE_LICENSES variable in mk.conf
6019: . Note that this variable only affects which packages may be built, while the
6020: license terms often also restrict the actual use of the package and its
6021: redistribution.
1.1 dsieger 6022:
6023: One might want to only install packages with a BSD license, or the GPL, and not
1.20 jnemeth 6024: the other. The free licenses are added to the default ACCEPTABLE_LICENSES
1.111 sevan 6025: variable. The pkgsrc user can override the default by setting the
6026: ACCEPTABLE_LICENSES variable with "=" instead of "+=". The licenses accepted by
6027: default are defined in the DEFAULT_ACCEPTABLE_LICENSES variable in the file
6028: pkgsrc/mk/license.mk.
1.1 dsieger 6029:
6030: The license tag mechanism is intended to address copyright-related issues
6031: surrounding building, installing and using a package, and not to address
1.20 jnemeth 6032: redistribution issues (see RESTRICTED and NO_SRC_ON_FTP, etc.). Packages with
6033: redistribution restrictions should set these tags.
1.1 dsieger 6034:
6035: Denoting that a package may be copied according to a particular license is done
6036: by placing the license in pkgsrc/licenses and setting the LICENSE variable to a
6037: string identifying the license, e.g. in graphics/xv:
6038:
6039: LICENSE= xv-license
6040:
6041: When trying to build, the user will get a notice that the package is covered by
6042: a license which has not been placed in the ACCEPTABLE_LICENSES variable:
6043:
6044: % make
6045: ===> xv-3.10anb9 has an unacceptable license: xv-license.
6046: ===> To view the license, enter "/usr/bin/make show-license".
6047: ===> To indicate acceptance, add this line to your /etc/mk.conf:
6048: ===> ACCEPTABLE_LICENSES+=xv-license
6049: *** Error code 1
6050:
1.260 ! wiz 6051: In case a package requires multiple licenses, you can add all of them to the
! 6052: LICENSE variable, connected with the upper-case keyword AND. If the user has a
! 6053: choice between multiple licenses, you can add them connected with the
! 6054: upper-case keyword OR, for example:
! 6055:
! 6056: LICENSE= isc AND apache-2.0
! 6057: LICENSE= 2-clause-bsd OR ruby-license
! 6058:
1.1 dsieger 6059: The license can be viewed with make show-license, and if the user so chooses,
1.4 rillig 6060: the line printed above can be added to mk.conf to convey to pkgsrc that it
1.1 dsieger 6061: should not in the future fail because of that license:
6062:
6063: ACCEPTABLE_LICENSES+=xv-license
6064:
1.111 sevan 6065: The use of LICENSE=shareware, LICENSE=no-commercial-use, and similar language
6066: is deprecated because it does not crisply refer to a particular license text.
6067: Another problem with such usage is that it does not enable a user to tell
6068: pkgsrc to proceed for a single package without also telling pkgsrc to proceed
6069: for all packages with that tag.
6070:
1.154 rillig 6071: 21.1.3.1. Adding a package with a new license
1.1 dsieger 6072:
1.49 rodent 6073: When adding a package with a new license, the following steps are required:
6074:
1.111 sevan 6075: 1. Check whether the license qualifies as Free or Open Source by referencing
6076: Various Licenses and Comments about Them and Licenses by Name | Open Source
6077: Initiative. If this is the case, the filename in pkgsrc/licenses/ does not
6078: need the -license suffix, and the license name should be added to:
1.49 rodent 6079:
6080: + DEFAULT_ACCEPTABLE_LICENSES in pkgsrc/mk/license.mk
6081:
6082: + default_acceptable_licenses in pkgsrc/pkgtools/pkg_install/files/lib/
6083: license.c
6084:
6085: 2. The license text should be added to pkgsrc/licenses for displaying. A list
6086: of known licenses can be seen in this directory.
1.1 dsieger 6087:
1.154 rillig 6088: 21.1.3.2. Change to the license
1.1 dsieger 6089:
1.111 sevan 6090: When the license changes (in a way other than formatting), make sure that the
6091: new license has a different name (e.g., append the version number if it exists,
6092: or the date). Just because a user told pkgsrc to build programs under a
6093: previous version of a license does not mean that pkgsrc should build programs
6094: under the new licenses. The higher-level point is that pkgsrc does not evaluate
6095: licenses for reasonableness; the only test is a mechanistic test of whether a
6096: particular text has been approved by either of two bodies (FSF or OSI).
1.1 dsieger 6097:
1.154 rillig 6098: 21.1.4. Restricted packages
1.1 dsieger 6099:
1.111 sevan 6100: Some licenses restrict how software may be re-distributed. By declaring the
6101: restrictions, package tools can automatically refrain from e.g. placing binary
6102: packages on FTP sites.
6103:
6104: There are four possible restrictions, which are the cross product of sources
6105: (distfiles) and binaries not being placed on FTP sites and CD-ROMs. Because
6106: this is rarely the exact language in any license, and because non-Free licenses
6107: tend to be different from each other, pkgsrc adopts a definition of FTP and
6108: CD-ROM. "FTP" means making the source or binary file available over the
6109: Internet at no charge. "CD-ROM" means making the source or binary available on
6110: some kind of media, together with other source and binary packages, which is
6111: sold for a distribution charge.
1.1 dsieger 6112:
6113: In order to encode these restrictions, the package system defines five make
6114: variables that can be set to note these restrictions:
6115:
6116: * RESTRICTED
6117:
6118: This variable should be set whenever a restriction exists (regardless of
6119: its kind). Set this variable to a string containing the reason for the
6120: restriction. It should be understood that those wanting to understand the
6121: restriction will have to read the license, and perhaps seek advice of
6122: counsel.
6123:
6124: * NO_BIN_ON_CDROM
6125:
6126: Binaries may not be placed on CD-ROM containing other binary packages, for
6127: which a distribution charge may be made. In this case, set this variable to
6128: ${RESTRICTED}.
6129:
6130: * NO_BIN_ON_FTP
6131:
6132: Binaries may not made available on the Internet without charge. In this
6133: case, set this variable to ${RESTRICTED}. If this variable is set, binary
6134: packages will not be included on ftp.NetBSD.org.
6135:
6136: * NO_SRC_ON_CDROM
6137:
6138: Distfiles may not be placed on CD-ROM, together with other distfiles, for
6139: which a fee may be charged. In this case, set this variable to $
6140: {RESTRICTED}.
6141:
6142: * NO_SRC_ON_FTP
6143:
6144: Distfiles may not made available via FTP at no charge. In this case, set
6145: this variable to ${RESTRICTED}. If this variable is set, the distfile(s)
6146: will not be mirrored on ftp.NetBSD.org.
6147:
1.111 sevan 6148: Please note that packages will be removed from pkgsrc when the distfiles are
1.33 wiz 6149: not distributable and cannot be obtained for a period of one full quarter
1.111 sevan 6150: branch. Packages with manual/interactive fetch must have a maintainer and it is
6151: his/her responsibility to ensure this.
1.33 wiz 6152:
1.154 rillig 6153: 21.1.5. Handling dependencies
1.1 dsieger 6154:
1.175 gutterid 6155: Your package may depend on some other package being present, and there are
6156: various ways of expressing this dependency. pkgsrc supports the DEPENDS,
6157: BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS definitions, the USE_TOOLS
6158: definition, as well as dependencies via buildlink3.mk, which is the preferred
6159: way to handle dependencies, and which uses the variables named above. See
1.184 rillig 6160: Chapter 18, Buildlink methodology for more information.
1.175 gutterid 6161:
6162: The basic difference is that the DEPENDS definition registers that
6163: pre-requisite in the binary package so it will be pulled in when the binary
6164: package is later installed, whilst the BUILD_DEPENDS, TOOL_DEPENDS, and
6165: TEST_DEPENDS definitions do not, marking a dependency that is only needed for
1.184 rillig 6166: building or testing the resulting package. See also Chapter 14, Creating a new
1.175 gutterid 6167: pkgsrc package from scratch for more information.
6168:
6169: This means that if you only need a package present whilst you are building or
6170: testing, it should be noted as a TOOL_DEPENDS, BUILD_DEPENDS, or TEST_DEPENDS.
6171: When cross-compiling, TOOL_DEPENDS are native packages, i.e. packages for the
6172: architecture where the package is built; BUILD_DEPENDS are target packages,
6173: i.e., packages for the architecture for which the package is built.
1.1 dsieger 6174:
1.175 gutterid 6175: The format for a DEPENDS, BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS
6176: definition is:
1.1 dsieger 6177:
6178: <pre-req-package-name>:../../<category>/<pre-req-package>
6179:
6180: Please note that the "pre-req-package-name" may include any of the wildcard
6181: version numbers recognized by pkg_info(1).
6182:
1.55 wiz 6183: 1. If your package needs another package's binaries or libraries to build and
1.1 dsieger 6184: run, and if that package has a buildlink3.mk file available, use it:
6185:
6186: .include "../../graphics/jpeg/buildlink3.mk"
6187:
1.55 wiz 6188: 2. If your package needs another package's binaries or libraries only for
6189: building, and if that package has a buildlink3.mk file available, use it:
6190:
6191: .include "../../graphics/jpeg/buildlink3.mk"
6192:
6193: but set BUILDLINK_DEPMETHOD.jpeg?=build to make it a build dependency only.
6194: This case is rather rare.
6195:
6196: 3. If your package needs binaries from another package to build, use the
1.156 leot 6197: TOOL_DEPENDS definition:
6198:
6199: TOOL_DEPENDS+= itstool-[0-9]*:../../textproc/itstool
1.1 dsieger 6200:
1.156 leot 6201: 4. If your package needs static libraries to link against, header files to
6202: include, etc. from another package to build, use the BUILD_DEPENDS
6203: definition.
1.1 dsieger 6204:
1.156 leot 6205: 5. If your package needs a library with which to link and there is no
1.26 spz 6206: buildlink3.mk file available, create one. Using DEPENDS won't be sufficient
6207: because the include files and libraries will be hidden from the compiler.
1.1 dsieger 6208:
1.156 leot 6209: 6. If your package needs some executable to be able to run correctly and if
1.26 spz 6210: there's no buildlink3.mk file, this is specified using the DEPENDS
6211: variable. The print/lyx package needs to be able to execute the latex
1.129 wiz 6212: binary from the tex-latex-bin package when it runs, and that is specified:
1.1 dsieger 6213:
1.129 wiz 6214: DEPENDS+= tex-latex-bin-[0-9]*:../../print/tex-latex-bin
1.1 dsieger 6215:
1.175 gutterid 6216: 7. If your package includes a test suite that has extra dependencies only
6217: required for this purpose (frequently this can be run as a "make test"
6218: target), use the TEST_DEPENDS variable.
6219:
6220: 8. You can use wildcards in package dependencies. Note that such wildcard
1.26 spz 6221: dependencies are retained when creating binary packages. The dependency is
6222: checked when installing the binary package and any package which matches
6223: the pattern will be used. Wildcard dependencies should be used with care.
1.1 dsieger 6224:
6225: The "-[0-9]*" should be used instead of "-*" to avoid potentially ambiguous
6226: matches such as "tk-postgresql" matching a "tk-*" DEPENDS.
6227:
6228: Wildcards can also be used to specify that a package will only build
6229: against a certain minimum version of a pre-requisite:
6230:
1.26 spz 6231: DEPENDS+= ImageMagick>=6.0:../../graphics/ImageMagick
1.1 dsieger 6232:
1.26 spz 6233: This means that the package will build using version 6.0 of ImageMagick or
6234: newer. Such a dependency may be warranted if, for example, the command line
6235: options of an executable have changed.
6236:
1.183 wiz 6237: If you need to depend on minimum versions of libraries, set
6238: BUILDLINK_API_DEPENDS.pkg to the appropriate pattern before including its
6239: buildlink3.mk file, e.g.
6240:
6241: BUILDLINK_API_DEPENDS.jpeg+= jpeg>=9.0
6242: .include "../../graphics/jpeg/buildlink3.mk"
1.1 dsieger 6243:
6244: For security fixes, please update the package vulnerabilities file. See
1.154 rillig 6245: Section 21.1.9, "Handling packages with security problems" for more
1.1 dsieger 6246: information.
6247:
6248: If your package needs files from another package to build, add the relevant
6249: distribution files to DISTFILES, so they will be extracted automatically. See
6250: the print/ghostscript package for an example. (It relies on the jpeg sources
6251: being present in source form during the build.)
6252:
1.154 rillig 6253: 21.1.6. Handling conflicts with other packages
1.1 dsieger 6254:
1.226 gutterid 6255: Your package may conflict with other packages users might already have
6256: installed on their system, e.g., if your package installs the same set of files
1.227 wiz 6257: as another package in the pkgsrc tree.
1.1 dsieger 6258:
1.142 leot 6259: For example, x11/libXaw3d and x11/Xaw-Xpm install the same shared library, thus
6260: you set in pkgsrc/x11/libXaw3d/Makefile:
1.1 dsieger 6261:
1.142 leot 6262: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 dsieger 6263:
1.142 leot 6264: and in pkgsrc/x11/Xaw-Xpm/Makefile:
1.1 dsieger 6265:
1.142 leot 6266: CONFLICTS= libXaw3d-[0-9]*
1.1 dsieger 6267:
1.142 leot 6268: pkg_add(1) is able to detect attempts to install packages that conflict with
6269: existing packages and abort. However, in many situations this is too late in
6270: the process. Binary package managers will not know about the conflict until
6271: they attempt to install the package after already downloading it and all its
6272: dependencies. Users may also waste time building a package and its dependencies
6273: only to find out at the end that it conflicts with another package they have
6274: installed.
6275:
6276: To avoid these issues CONFLICTS entries should be added in all cases where it
6277: is known that packages conflict with each other. These CONFLICTS entries are
6278: exported in pkg_summary(5) files and consumed by binary package managers to
6279: inform users that packages cannot be installed onto the target system.
1.1 dsieger 6280:
1.154 rillig 6281: 21.1.7. Packages that cannot or should not be built
1.1 dsieger 6282:
6283: There are several reasons why a package might be instructed to not build under
6284: certain circumstances. If the package builds and runs on most platforms, the
1.83 dholland 6285: exceptions should be noted with BROKEN_ON_PLATFORM. If the package builds and
6286: runs on a small handful of platforms, set BROKEN_EXCEPT_ON_PLATFORM instead.
6287: Both BROKEN_ON_PLATFORM and BROKEN_EXCEPT_ON_PLATFORM are OS triples
6288: (OS-version-platform) that can use glob-style wildcards.
6289:
1.114 maya 6290: If a package is not appropriate for some platforms (as opposed to merely
1.83 dholland 6291: broken), a different set of variables should be used as this affects failure
6292: reporting and statistics. If the package is appropriate for most platforms, the
6293: exceptions should be noted with NOT_FOR_PLATFORM. If the package is appropriate
6294: for only a small handful of platforms (often exactly one), set
6295: ONLY_FOR_PLATFORM instead. Both ONLY_FOR_PLATFORM and NOT_FOR_PLATFORM are OS
6296: triples (OS-version-platform) that can use glob-style wildcards.
1.1 dsieger 6297:
6298: Some packages are tightly bound to a specific version of an operating system,
6299: e.g. LKMs or sysutils/lsof. Such binary packages are not backwards compatible
6300: with other versions of the OS, and should be uploaded to a version specific
6301: directory on the FTP server. Mark these packages by setting OSVERSION_SPECIFIC
6302: to "yes". This variable is not currently used by any of the package system
6303: internals, but may be used in the future.
6304:
6305: If the package should be skipped (for example, because it provides
6306: functionality already provided by the system), set PKG_SKIP_REASON to a
6307: descriptive message. If the package should fail because some preconditions are
6308: not met, set PKG_FAIL_REASON to a descriptive message.
6309:
1.154 rillig 6310: 21.1.8. Packages which should not be deleted, once installed
1.1 dsieger 6311:
6312: To ensure that a package may not be deleted, once it has been installed, the
6313: PKG_PRESERVE definition should be set in the package Makefile. This will be
1.25 wiz 6314: carried into any binary package that is made from this pkgsrc entry. A "
6315: preserved" package will not be deleted using pkg_delete(1) unless the "-f"
1.1 dsieger 6316: option is used.
6317:
1.154 rillig 6318: 21.1.9. Handling packages with security problems
1.1 dsieger 6319:
1.247 wiz 6320: When a vulnerability is found, this should be noted in pkgsrc/doc/
6321: pkg-vulnerabilities. Entries in that file consist of three parts:
1.205 wiz 6322:
6323: * package version pattern
6324:
6325: * type of vulnerability (please cut'n'paste an existing one where possible)
6326:
6327: * URL providing additional information about the issue
6328:
6329: For the package version pattern please always use `<' to mark an upper bound
6330: (not `<='!). This will avoid possible problems due unrelated PKGREVISION bumps
6331: not related to security fixes. Lower bounds can be added too, using '>' or '>=
1.206 wiz 6332: '. For example, "foo>=1<1.2" would mark versions 1.0 (included) to 1.2
1.205 wiz 6333: (excluded) of "foo" as affected by the security issue.
6334:
6335: Entries should always be added at the bottom of the file.
6336:
6337: When fixing packages, please modify the upper bound of the corresponding entry.
6338: To continue the previous example, if a fix was backported to version 1.1nb2,
1.206 wiz 6339: change the previous pattern to "foo>=1<1.1nb2".
1.205 wiz 6340:
6341: To locally test a package version pattern against a PKGNAME you can use the
6342: pkg_admin pmatch command.
6343:
6344: The URL should be as permanent as possible and provide as much information
6345: about the issue as possible. CVE entries are preferred.
6346:
6347: After committing that file, ask pkgsrc-security@NetBSD.org to update the file
6348: on ftp.NetBSD.org.
1.1 dsieger 6349:
6350: After fixing the vulnerability by a patch, its PKGREVISION should be increased
6351: (this is of course not necessary if the problem is fixed by using a newer
1.32 wiz 6352: release of the software), and the pattern in the pkg-vulnerabilities file must
6353: be updated.
1.1 dsieger 6354:
6355: Also, if the fix should be applied to the stable pkgsrc branch, be sure to
6356: submit a pullup request!
6357:
6358: Binary packages already on ftp.NetBSD.org will be handled semi-automatically by
6359: a weekly cron job.
6360:
1.205 wiz 6361: In case a security issue is disputed, please contact
6362: pkgsrc-security@NetBSD.org.
6363:
1.154 rillig 6364: 21.1.10. How to handle incrementing versions when fixing an existing package
1.1 dsieger 6365:
6366: When making fixes to an existing package it can be useful to change the version
6367: number in PKGNAME. To avoid conflicting with future versions by the original
6368: author, a "nb1", "nb2", ... suffix can be used on package versions by setting
6369: PKGREVISION=1 (2, ...). The "nb" is treated like a "." by the package tools.
6370: e.g.
6371:
6372: DISTNAME= foo-17.42
6373: PKGREVISION= 9
6374:
6375: will result in a PKGNAME of "foo-17.42nb9". If you want to use the original
6376: value of PKGNAME without the "nbX" suffix, e.g. for setting DIST_SUBDIR, use
6377: PKGNAME_NOREV.
6378:
6379: When a new release of the package is released, the PKGREVISION should be
6380: removed, e.g. on a new minor release of the above package, things should be
6381: like:
6382:
6383: DISTNAME= foo-17.43
6384:
6385: PKGREVISION should be incremented for any non-trivial change in the resulting
6386: binary package. Without a PKGREVISION bump, someone with the previous version
6387: installed has no way of knowing that their package is out of date. Thus,
6388: changes without increasing PKGREVISION are essentially labeled "this is so
6389: trivial that no reasonable person would want to upgrade", and this is the rough
6390: test for when increasing PKGREVISION is appropriate. Examples of changes that
6391: do not merit increasing PKGREVISION are:
6392:
1.14 jmcneill 6393: * Changing HOMEPAGE, MAINTAINER, OWNER, or comments in Makefile.
1.1 dsieger 6394:
6395: * Changing build variables if the resulting binary package is the same.
6396:
6397: * Changing DESCR.
6398:
6399: * Adding PKG_OPTIONS if the default options don't change.
6400:
6401: Examples of changes that do merit an increase to PKGREVISION include:
6402:
6403: * Security fixes
6404:
6405: * Changes or additions to a patch file
6406:
6407: * Changes to the PLIST
6408:
1.12 weinem 6409: * A dependency is changed or renamed.
6410:
1.1 dsieger 6411: PKGREVISION must also be incremented when dependencies have ABI changes.
6412:
1.154 rillig 6413: 21.1.11. Substituting variable text in the package files (the SUBST framework)
1.1 dsieger 6414:
1.180 rillig 6415: When you want to replace the same text in multiple files, or multiple times in
6416: the same file, it is cumbersome to maintain a patch file for this. This is
6417: where the SUBST framework steps in. It provides an easy-to-use interface for
6418: replacing text in files. It just needs the following information:
1.172 rillig 6419:
1.180 rillig 6420: * In which phase of the package build cycle should the replacement happen?
1.172 rillig 6421:
1.180 rillig 6422: * In which files should the replacement happen?
1.172 rillig 6423:
6424: * Which text should be replaced with what?
6425:
1.180 rillig 6426: This information is encoded in a block of SUBST variables. A minimal example
6427: is:
6428:
6429: SUBST_CLASSES+= paths
6430: SUBST_STAGE.paths= pre-configure
6431: SUBST_FILES.paths= src/*.c
6432: SUBST_SED.paths= -e 's,/usr/local,${PREFIX},g'
6433:
6434: Translated into English, it means: In the pre-configure stage (that is, after
6435: applying the patches from the patches/ directory and before running the
6436: configure script and the portability check), replace the text /usr/local with
6437: the content of the variable PREFIX.
6438:
6439: Each SUBST block starts by appending an identifier to SUBST_CLASSES (note the +
6440: =). This identifier can be chosen freely by the package. If there should ever
6441: be duplicate identifiers, the pkgsrc infrastructure will catch this and fail
6442: early, so don't worry about name collisions.
6443:
6444: Except for SUBST_CLASSES, all variables in a SUBST block are parameterized
6445: using this identifier. In the remainder of this section, these parameterized
6446: variables are written as SUBST_STAGE.*.
6447:
6448: SUBST_CLASSES+= paths
6449: SUBST_STAGE.paths= pre-configure
6450: SUBST_MESSAGE.paths= Fixing absolute paths.
6451: SUBST_FILES.paths= src/*.c
6452: SUBST_FILES.paths+= scripts/*.sh
6453: SUBST_SED.paths= -e 's,"/usr/local,"${PREFIX},g'
6454: SUBST_SED.paths+= -e 's,"/var/log,"${VARBASE}/log,g'
6455: SUBST_VARS.paths= LOCALBASE PREFIX PKGVERSION
6456:
6457: To get a complete picture about the SUBST substitutions, run bmake
6458: show-all-subst. If something doesn't work as expected, run pkglint on the
6459: package, which detects several typical mistakes surrounding the SUBST blocks.
6460: For any questions that might remain after this, have a look at mk/subst.mk.
6461:
6462: 21.1.11.1. Choosing the time where the substitutions happen
6463:
6464: The SUBST_STAGE.* is one of {pre,do,post}-
6465: {extract,patch,configure,build,test,install}. Of these, pre-configure is used
6466: most often, by far. The most popular stages are, in chronological order:
6467:
6468: post-extract
6469:
6470: The substitutions are applied immediately after the distfiles are
6471: extracted. Running bmake extract on the package will leave no traces of the
6472: original files.
6473:
6474: When the substitution applies to files for which there is also a patch in
6475: the patches/ directory, this means that the patches will be computed based
6476: on the result of the substitution. When these patches are sent to the
6477: upstream maintainer later, to be fixed in the upstream package, these
6478: patches may no longer match what the upstream author is used to. Because of
6479: this, pre-configure is often a better choice.
6480:
6481: pre-configure
6482:
6483: The substitutions are applied after the patches from the patches/
6484: directory. This makes it possible to run bmake patch on the package, after
6485: which the patches can be edited using the tools pkgvi and mkpatches from
6486: the pkgtools/pkgdiff package.
6487:
6488: When updating the patches, it is helpful to explicitly separate the bmake
6489: patch from the bmake configure, and to only edit the patches between these
6490: commands. Otherwise the substitutions from the SUBST block will end up in
6491: the patch file. When this happens in really obvious ways, pkglint will
6492: complain about patches that contain a hard-coded /usr/pkg instead of the
6493: correct and intended @PREFIX@, but it can only detect these really obvious
6494: cases.
6495:
6496: do-configure
6497:
6498: This stage should only be used if the package defines a pre-configure
6499: action itself, and the substitution must happen after that. Typical
6500: examples are packages that use the pre-configure stage to regenerate the
6501: GNU configure script from configure.ac.
6502:
6503: post-configure
6504:
6505: This stage is used to fix up any mistakes by the configure stage.
6506:
6507: pre-build
6508:
6509: This stage should only be used for substitutions that are clearly related
6510: to building the package, not for fixing the configuration. Substitutions
6511: for pathnames (such as replacing /usr/local with ${PREFIX}) or user names
6512: (such as replacing @MY_USER@ with the actual username) belong in
6513: pre-configure or post-configure instead.
6514:
6515: post-build
6516:
6517: Just as with pre-build, this stage should only be used for substitutions
6518: that are clearly related to building the package, not for fixing the
6519: configuration. Substitutions for pathnames (such as replacing /usr/local
6520: with ${PREFIX}) or user names (such as replacing @MY_USER@ with the actual
6521: username) belong in pre-configure or post-configure instead.
6522:
6523: A typical use is to update pkg-config files to include the rpath compiler
6524: options.
6525:
6526: pre-install
6527:
6528: In general, the install phase should be as simple as possible. As with the
6529: pre-build and post-build stages, it should not be used to fix pathnames or
6530: user names, these belong in pre-configure instead. There are only few
6531: legitimate use cases for applying substitutions in this stage.
6532:
1.181 rillig 6533: 21.1.11.2. Choosing the files where the substitutions happen
1.180 rillig 6534:
6535: The SUBST_FILES.* variable contains a list of filename patterns. These patterns
6536: are relative to WRKSRC since that is where most substitutions happen. A typical
6537: example is:
6538:
6539: SUBST_FILES.path= Makefile */Makefile */*/Makefile *.[ch]
6540:
6541: The above patterns, especially the last, are quite broad. The SUBST
6542: implementation checks that each filename pattern that is mentioned here has an
6543: effect. For example, if none of the */*/Makefile files contains the patterns to
6544: be found and substituted, that filename pattern is redundant and should be left
1.181 rillig 6545: out. By default, the SUBST framework will complain with an error message. If
6546: the text to be substituted occurs in some of the files from a single pattern,
6547: but not in all of them, that is totally ok, and the SUBST framework will only
6548: print an INFO message for those files.
1.180 rillig 6549:
6550: If there is a good reason for having redundant filename patterns, set
1.181 rillig 6551: SUBST_NOOP_OK.* to yes.
1.180 rillig 6552:
6553: Another popular way of choosing the files for the substitutions is via a shell
6554: command, like this:
6555:
1.181 rillig 6556: C_FILES_CMD= cd ${WRKSRC} && ${FIND} . -name '*.c'
1.180 rillig 6557: SUBST_FILES.path= ${C_FILES_CMD:sh}
6558:
6559: The variable name C_FILES_CMD in this example is freely chosen and independent
6560: of the SUBST framework.
6561:
6562: In this variant, the SUBST_FILES.* variable lists each file individually.
6563: Thereby chances are higher that there are filename patterns in which no
6564: substitution happens. Since the SUBST framework cannot know whether the
6565: filename patterns in SUBST_FILES.* have been explicitly listed in the Makefile
6566: (where any redundant filename pattern would be suspicious) or been generated by
6567: a shell command (in which redundant filename patterns are more likely and to be
6568: expected), it will complain about these redundant filename patterns. Therefore,
6569: SUBST blocks that use a shell command to generate the list of filename patterns
6570: often need to set SUBST_NOOP_OK.* to yes.
6571:
6572: 21.1.11.3. Choosing what to substitute
6573:
6574: In most cases, the substitutions are given using one or more sed(1) commands,
6575: like this:
6576:
6577: SUBST_SED.path= -e 's|/usr/local|${PREFIX}|g'
6578:
6579: Each of the sed commands needs to be preceded by the -e option and should be
6580: specified on a line of its own, to avoid hiding short sed commands at the end
6581: of a line.
6582:
6583: Since the sed commands often contain shell metacharacters as the separator (the
6584: | in the above example), it is common to enclose them in single quotes.
6585:
6586: A common substitution is to replace placeholders of the form @VARNAME@ with
6587: their pkgsrc counterpart variable ${VARNAME}. A typical example is:
6588:
6589: SUBST_VARS.path= PREFIX
6590:
1.181 rillig 6591: This type of substitutions is typically done by the GNU configure scripts
6592: during the do-configure stage, but in some cases these need to be overridden.
6593: The same pattern is also used when a package defines patches that replace
6594: previously hard-coded paths like /usr/local with a @PREFIX@ placeholder first,
6595: which then gets substituted by the actual ${PREFIX} in the pre-configure stage.
6596: In many of these cases, it works equally well to just use the SUBST framework
6597: to directly replace /usr/local with ${PREFIX}, thereby omitting the
6598: intermediate patch file.
1.180 rillig 6599:
6600: If the above is not flexible enough, it is possible to not use sed at all for
6601: the substitution but to specify an entirely different command, like this:
6602:
6603: SUBST_FILTER_CMD.path= LC_ALL=C ${TR} -d '\r'
1.1 dsieger 6604:
1.180 rillig 6605: This is used for the few remaining packages in which the distributed files use
6606: Windows-style line endings that need to be converted to UNIX-style line
6607: endings.
1.1 dsieger 6608:
1.180 rillig 6609: 21.1.11.4. Other SUBST variables
1.172 rillig 6610:
1.180 rillig 6611: When a SUBST block is applied during a package build, a message is logged. The
6612: default message is fine for most purposes but can be overridden by setting
6613: SUBST_MESSAGE.* to an individual message.
1.1 dsieger 6614:
1.154 rillig 6615: 21.2. The fetch phase
1.1 dsieger 6616:
1.154 rillig 6617: 21.2.1. Packages whose distfiles aren't available for plain downloading
1.1 dsieger 6618:
6619: If you need to download from a dynamic URL you can set DYNAMIC_MASTER_SITES and
6620: a make fetch will call files/getsite.sh with the name of each file to download
6621: as an argument, expecting it to output the URL of the directory from which to
6622: download it. graphics/ns-cult3d is an example of this usage.
6623:
6624: If the download can't be automated, because the user must submit personal
6625: information to apply for a password, or must pay for the source, or whatever,
6626: you can set FETCH_MESSAGE to a list of lines that are displayed to the user
6627: before aborting the build. Example:
6628:
6629: FETCH_MESSAGE= "Please download the files"
6630: FETCH_MESSAGE+= " "${DISTFILES:Q}
6631: FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"."
6632:
1.154 rillig 6633: 21.2.2. How to handle modified distfiles with the 'old' name
1.1 dsieger 6634:
6635: Sometimes authors of a software package make some modifications after the
6636: software was released, and they put up a new distfile without changing the
6637: package's version number. If a package is already in pkgsrc at that time, the
6638: checksum will no longer match. The contents of the new distfile should be
6639: compared against the old one before changing anything, to make sure the
6640: distfile was really updated on purpose, and that no trojan horse or so crept
6641: in. Please mention that the distfiles were compared and what was found in your
1.54 rodent 6642: commit message.
6643:
6644: Then, the correct way to work around this is to set DIST_SUBDIR to a unique
1.109 wiz 6645: directory name, usually based on PKGNAME_NOREV (but take care with python or
6646: ruby packages, where PKGNAME includes a variable prefix). All DISTFILES and
6647: PATCHFILES for this package will be put in that subdirectory of the local
1.154 rillig 6648: distfiles directory. (See Section 21.1.10, "How to handle incrementing versions
1.109 wiz 6649: when fixing an existing package" for more details.) In case this happens more
6650: often, PKGNAME can be used (thus including the nbX suffix) or a date stamp can
6651: be appended, like ${PKGNAME_NOREV}-YYYYMMDD.
1.54 rodent 6652:
6653: DIST_SUBDIR is also used when a distfile's name does not contain a version and
6654: the distfile is apt to change. In cases where the likelihood of this is very
6655: small, DIST_SUBDIR might not be required. Additionally, DIST_SUBDIR must not be
6656: removed unless the distfile name changes, even if a package is being moved or
6657: renamed.
6658:
6659: Do not forget regenerating the distinfo file after that, since it contains the
6660: DIST_SUBDIR path in the filenames. Also, increase the PKGREVISION if the
6661: installed package is different. Furthermore, a mail to the package's authors
6662: seems appropriate telling them that changing distfiles after releases without
6663: changing the file names is not good practice.
1.1 dsieger 6664:
1.154 rillig 6665: 21.2.3. Packages hosted on github.com
1.88 tnn 6666:
1.90 tnn 6667: Helper methods exist for packages hosted on github.com which will often have
6668: distfile names that clash with other packages, for example 1.0.tar.gz. Use one
6669: of the three recipes from below:
1.88 tnn 6670:
1.154 rillig 6671: 21.2.3.1. Fetch based on a tagged release
1.88 tnn 6672:
1.189 bacon 6673: If your distfile URL looks similar to https://github.com/username/example/
6674: archive/v1.0.zip, then you are packaging a tagged release.
1.88 tnn 6675:
1.189 bacon 6676: DISTNAME= example-1.0
1.90 tnn 6677: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
1.189 bacon 6678: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
1.90 tnn 6679: GITHUB_TAG= v${PKGVERSION_NOREV}
1.88 tnn 6680: EXTRACT_SUFX= .zip
6681:
1.230 gutterid 6682: Here, DISTNAME combined with use of GITHUB_TAG leads the file fetching
6683: infrastructure to save the resulting file locally as example-1.0.zip.
6684:
1.189 bacon 6685: 21.2.3.2. Fetch based on a specific commit before the first release
6686:
6687: If your distfile looks similar to https://github.com/username/example/archive/
6688: 988881adc9fc3655077dc2d4d757d480b5ea0e11 and is from a commit before the first
6689: release, then set the package version to 0.0.0.N, where N is the number of
6690: commits to the repository, and set GITHUB_TAG to the commit hash. This will
6691: (almost) ensure that the first tagged release will have a version greater than
6692: this one so that package upgrades will function properly.
6693:
6694: DISTNAME= example-0.0.0.347
6695: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6696: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
6697: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
6698:
6699: 21.2.3.3. Fetch based on a specific commit after a release
1.88 tnn 6700:
1.189 bacon 6701: If your distfile looks similar to https://github.com/username/example/archive/
6702: 988881adc9fc3655077dc2d4d757d480b5ea0e11 and is from a commit after a release,
6703: then include the last release version and the commit count since that release
6704: in the package version and set GITHUB_TAG to the commit hash. The latest
6705: release and commit count are shown in the output of "git describe --tags":
6706:
6707: # git clone https://github.com/username/example
6708: # cd example
6709: # git describe --tags
6710: 1.2.3-5-g988881a
1.88 tnn 6711:
1.189 bacon 6712: DISTNAME= example-1.2.3.5
6713: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6714: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
1.90 tnn 6715: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
1.88 tnn 6716:
1.189 bacon 6717: 21.2.3.4. Fetch based on release
1.88 tnn 6718:
1.189 bacon 6719: If your distfile URL looks similar to https://github.com/username/example/
6720: releases/download/rel-1.6/offensive-1.6.zip, then you are packaging a release.
1.88 tnn 6721:
1.90 tnn 6722: DISTNAME= offensive-1.6
1.88 tnn 6723: PKGNAME= ${DISTNAME:S/offensive/proper/}
1.90 tnn 6724: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
1.189 bacon 6725: GITHUB_PROJECT= example
1.90 tnn 6726: GITHUB_RELEASE= rel-${PKGVERSION_NOREV} # usually just set this to ${DISTNAME}
6727: EXTRACT_SUFX= .zip
1.88 tnn 6728:
1.154 rillig 6729: 21.3. The configure phase
1.1 dsieger 6730:
1.154 rillig 6731: 21.3.1. Shared libraries - libtool
1.1 dsieger 6732:
6733: pkgsrc supports many different machines, with different object formats like
6734: a.out and ELF, and varying abilities to do shared library and dynamic loading
6735: at all. To accompany this, varying commands and options have to be passed to
6736: the compiler, linker, etc. to get the Right Thing, which can be pretty annoying
6737: especially if you don't have all the machines at your hand to test things. The
6738: devel/libtool pkg can help here, as it just "knows" how to build both static
6739: and dynamic libraries from a set of source files, thus being
6740: platform-independent.
6741:
6742: Here's how to use libtool in a package in seven simple steps:
6743:
6744: 1. Add USE_LIBTOOL=yes to the package Makefile.
6745:
6746: 2. For library objects, use "${LIBTOOL} --mode=compile ${CC}" in place of "$
6747: {CC}". You could even add it to the definition of CC, if only libraries are
6748: being built in a given Makefile. This one command will build both PIC and
6749: non-PIC library objects, so you need not have separate shared and
6750: non-shared library rules.
6751:
6752: 3. For the linking of the library, remove any "ar", "ranlib", and "ld
6753: -Bshareable" commands, and instead use:
6754:
6755: ${LIBTOOL} --mode=link \
6756: ${CC} -o ${.TARGET:.a=.la} \
6757: ${OBJS:.o=.lo} \
6758: -rpath ${PREFIX}/lib \
6759: -version-info major:minor
6760:
6761: Note that the library is changed to have a .la extension, and the objects
6762: are changed to have a .lo extension. Change OBJS as necessary. This
6763: automatically creates all of the .a, .so.major.minor, and ELF symlinks (if
6764: necessary) in the build directory. Be sure to include "-version-info",
6765: especially when major and minor are zero, as libtool will otherwise strip
6766: off the shared library version.
6767:
6768: From the libtool manual:
6769:
6770: So, libtool library versions are described by three integers:
6771:
6772: CURRENT
6773: The most recent interface number that this library implements.
6774:
6775: REVISION
6776: The implementation number of the CURRENT interface.
6777:
6778: AGE
6779: The difference between the newest and oldest interfaces that
6780: this library implements. In other words, the library implements
6781: all the interface numbers in the range from number `CURRENT -
6782: AGE' to `CURRENT'.
6783:
6784: If two libraries have identical CURRENT and AGE numbers, then the
6785: dynamic linker chooses the library with the greater REVISION number.
6786:
6787: The "-release" option will produce different results for a.out and ELF
1.25 wiz 6788: (excluding symlinks) in only one case. An ELF library of the form "
6789: libfoo-release.so.x.y" will have a symlink of "libfoo.so.x.y" on an a.out
1.1 dsieger 6790: platform. This is handled automatically.
6791:
6792: The "-rpath argument" is the install directory of the library being built.
6793:
6794: In the PLIST, include only the .la file, the other files will be added
6795: automatically.
6796:
6797: 4. When linking shared object (.so) files, i.e. files that are loaded via
6798: dlopen(3), NOT shared libraries, use "-module -avoid-version" to prevent
6799: them getting version tacked on.
6800:
6801: The PLIST file gets the foo.so entry.
6802:
6803: 5. When linking programs that depend on these libraries before they are
6804: installed, preface the cc(1) or ld(1) line with "${LIBTOOL} --mode=link",
6805: and it will find the correct libraries (static or shared), but please be
6806: aware that libtool will not allow you to specify a relative path in -L
6807: (such as "-L../somelib"), because it expects you to change that argument to
6808: be the .la file. e.g.
6809:
6810: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
6811:
6812: should be changed to:
6813:
6814: ${LIBTOOL} --mode=link ${CC} -o someprog ../somelib/somelib.la
6815:
6816: and it will do the right thing with the libraries.
6817:
6818: 6. When installing libraries, preface the install(1) or cp(1) command with "$
6819: {LIBTOOL} --mode=install", and change the library name to .la. e.g.
6820:
1.23 jakllsch 6821: ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 dsieger 6822:
6823: This will install the static .a, shared library, any needed symlinks, and
6824: run ldconfig(8).
6825:
6826: 7. In your PLIST, include only the .la file (this is a change from previous
6827: behaviour).
6828:
1.154 rillig 6829: 21.3.2. Using libtool on GNU packages that already support libtool
1.1 dsieger 6830:
6831: Add USE_LIBTOOL=yes to the package Makefile. This will override the package's
6832: own libtool in most cases. For older libtool using packages, libtool is made by
6833: ltconfig script during the do-configure step; you can check the libtool script
6834: location by doing make configure; find work*/ -name libtool.
6835:
6836: LIBTOOL_OVERRIDE specifies which libtool scripts, relative to WRKSRC, to
6837: override. By default, it is set to "libtool */libtool */*/libtool". If this
6838: does not match the location of the package's libtool script(s), set it as
6839: appropriate.
6840:
6841: If you do not need *.a static libraries built and installed, then use
6842: SHLIBTOOL_OVERRIDE instead.
6843:
6844: If your package makes use of the platform-independent library for loading
6845: dynamic shared objects, that comes with libtool (libltdl), you should include
6846: devel/libltdl/buildlink3.mk.
6847:
6848: Some packages use libtool incorrectly so that the package may not work or build
6849: in some circumstances. Some of the more common errors are:
6850:
6851: * The inclusion of a shared object (-module) as a dependent library in an
6852: executable or library. This in itself isn't a problem if one of two things
6853: has been done:
6854:
6855: 1. The shared object is named correctly, i.e. libfoo.la, not foo.la
6856:
6857: 2. The -dlopen option is used when linking an executable.
6858:
6859: * The use of libltdl without the correct calls to initialisation routines.
6860: The function lt_dlinit() should be called and the macro
6861: LTDL_SET_PRELOADED_SYMBOLS included in executables.
6862:
1.154 rillig 6863: 21.3.3. GNU Autoconf/Automake
1.1 dsieger 6864:
6865: If a package needs GNU autoconf or automake to be executed to regenerate the
1.223 nia 6866: configure script and Makefile.in makefile templates from configure.ac and
6867: Makefile.am, then they should be executed in a pre-configure target:
1.1 dsieger 6868:
1.223 nia 6869: USE_TOOLS+= autoconf automake autoreconf
6870: GNU_CONFIGURE= yes
1.1 dsieger 6871: ...
6872:
6873: pre-configure:
1.223 nia 6874: set -e; cd ${WRKSRC} && autoreconf -fi
1.1 dsieger 6875: ...
6876:
1.223 nia 6877: Packages which use GNU Automake will sometimes require GNU Make (gmake in
6878: USE_TOOLS), but not always. Note that autoreconf only needs to be executed if
6879: configure.ac or Makefiles are modified, or configure is not present.
1.1 dsieger 6880:
6881: There are times when the configure process makes additional changes to the
6882: generated files, which then causes the build process to try to re-execute the
6883: automake sequence. This is prevented by touching various files in the configure
6884: stage. If this causes problems with your package you can set AUTOMAKE_OVERRIDE=
6885: NO in the package Makefile.
6886:
1.223 nia 6887: 21.3.4. Meson / ninja
6888:
6889: Packages using Meson to configure need to include:
6890:
6891: .include "../../devel/meson/build.mk"
6892:
6893: In nearly all cases (any program with dependencies), pkg-config needs to be
6894: added to USE_TOOLS. If the package installs translation files for non-English
6895: languages, also add msgfmt and xgettext:
6896:
6897: USE_TOOLS+= pkg-config msgfmt xgettext
6898:
6899: If any options need to be passed to Meson, use MESON_ARGS instead of
6900: CONFIGURE_ARGS:
6901:
6902: MESON_ARGS+= -Dx11=false
6903:
1.260 ! wiz 6904: 21.3.5. Determining the endianness
! 6905:
! 6906: To determine the endianness of the target platform, have a look at mk/
! 6907: endian.mk.
! 6908:
1.154 rillig 6909: 21.4. Programming languages
1.1 dsieger 6910:
1.154 rillig 6911: 21.4.1. C, C++, and Fortran
1.1 dsieger 6912:
1.244 gutterid 6913: Compilers for the C and C++ languages come with the NetBSD base system. By
1.223 nia 6914: default, pkgsrc assumes that a package is written in C and will hide all other
6915: compilers (via the wrapper framework, see Chapter 18, Buildlink methodology).
1.1 dsieger 6916:
1.243 gutterid 6917: To declare which languages should be made available through pkgsrc's compiler
6918: wrappers, use the USE_LANGUAGES variable. Allowed values currently are:
1.212 wiz 6919:
1.244 gutterid 6920: c, c++, fortran, fortran77, java, objc, obj-c++, and ada.
1.212 wiz 6921:
6922: (and any combination). The default is "c". Packages using GNU configure
6923: scripts, even if written in C++, usually need a C compiler for the configure
1.244 gutterid 6924: phase.
1.243 gutterid 6925:
1.250 jnemeth 6926: To declare which features a package requires from the compiler, set either
1.243 gutterid 6927: USE_CC_FEATURES or USE_CXX_FEATURES. Allowed values for USE_CC_FEATURES are
6928: currently:
6929:
6930: c11, c99, has_include
6931:
6932: Allowed values for USE_CXX_FEATURES are currently:
6933:
6934: c++11, c++14, c++17, c++20, has_include, regex, filesystem,
6935: charconv, parallelism_ts, unique_ptr, put_time,
6936: is_trivially_copy_constructible
1.1 dsieger 6937:
1.251 gutterid 6938: Note at present these variables only affect use of GCC, not other compilers.
6939:
1.244 gutterid 6940: Language variants like gnu99 and c++11 can be specified in FORCE_C_STD and
6941: FORCE_CXX_STD if the package does not explicitly set -std=... when compiling
6942: (i.e. the package assumes the compiler defaults to C++11 or some other
6943: standard). This is a common bug in upstream build systems.
6944:
6945: Allowed values for FORCE_C_STD are currently:
6946:
6947: c90, c99, c11, gnu90, gnu99, gnu11
6948:
6949: Allowed values for FORCE_CXX_STD are currently:
6950:
6951: c++03, c++11, c++14, c++17, c++20,
6952: gnu++03, gnu++11, gnu++14, gnu++17, gnu++20
6953:
1.251 gutterid 6954: Note at present these variables only affect use of GCC and Clang.
6955:
1.154 rillig 6956: 21.4.2. Java
1.1 dsieger 6957:
6958: If a program is written in Java, use the Java framework in pkgsrc. The package
6959: must include ../../mk/java-vm.mk. This Makefile fragment provides the following
6960: variables:
6961:
6962: * USE_JAVA defines if a build dependency on the JDK is added. If USE_JAVA is
6963: set to "run", then there is only a runtime dependency on the JDK. The
6964: default is "yes", which also adds a build dependency on the JDK.
6965:
6966: * Set USE_JAVA2 to declare that a package needs a Java2 implementation. The
6967: supported values are "yes", "1.4", and "1.5". "yes" accepts any Java2
6968: implementation, "1.4" insists on versions 1.4 or above, and "1.5" only
6969: accepts versions 1.5 or above. This variable is not set by default.
6970:
1.25 wiz 6971: * PKG_JAVA_HOME is automatically set to the runtime location of the used Java
6972: implementation dependency. It may be used to set JAVA_HOME to a good value
6973: if the program needs this variable to be defined.
6974:
1.205 wiz 6975: 21.4.3. Go
6976:
6977: If a program is written in Go and has any dependencies on other Go modules,
6978: have the package include ../../lang/go/go-module.mk.
6979:
6980: 1. Generate a list of those dependencies with make clean && make patch && make
6981: show-go-modules > go-modules.mk.
6982:
1.223 nia 6983: 2. Prepend .include "go-modules.mk" to any other .includes.
6984:
6985: 3. Incorporate these modules in distinfo with make makesum.
1.205 wiz 6986:
1.223 nia 6987: 21.4.4. Rust
1.205 wiz 6988:
1.223 nia 6989: If a program is written in Rust and uses Cargo to build, have the package
6990: include ../../lang/rust/cargo.mk.
1.205 wiz 6991:
1.223 nia 6992: 1. Generate a list of those dependencies with make CARGO_ARGS="build
6993: --release" build && make print-cargo-depends > cargo-depends.mk.
1.205 wiz 6994:
1.223 nia 6995: 2. Prepend .include "cargo-depends.mk" to any other .includes.
1.205 wiz 6996:
6997: 3. Incorporate these modules in distinfo with make makesum.
6998:
1.223 nia 6999: 21.4.5. Packages containing Perl scripts
1.1 dsieger 7000:
1.203 nia 7001: If your package contains interpreted Perl scripts, add "perl" to the USE_TOOLS
1.1 dsieger 7002: variable and set REPLACE_PERL to ensure that the proper interpreter path is
7003: set. REPLACE_PERL should contain a list of scripts, relative to WRKSRC, that
1.74 wiz 7004: you want adjusted. Every occurrence of */bin/perl in a she-bang line will be
1.210 gutterid 7005: replaced with the full path to the Perl executable.
1.1 dsieger 7006:
1.210 gutterid 7007: If a particular version of Perl is needed, set the PERL5_REQD variable to the
1.1 dsieger 7008: version number. The default is "5.0".
7009:
1.203 nia 7010: See Section 21.6.6, "Packages installing Perl modules" for information about
1.210 gutterid 7011: handling Perl modules.
7012:
7013: There is also the REPLACE_PERL6 variable for the language now known as Raku.
1.1 dsieger 7014:
1.223 nia 7015: 21.4.6. Packages containing shell scripts
1.41 wiz 7016:
7017: REPLACE_SH, REPLACE_BASH, REPLACE_CSH, and REPLACE_KSH can be used to replace
1.225 gutterid 7018: shell she-bangs in files. Please use the appropriate one, preferring REPLACE_SH
7019: when this shell is sufficient. Each should contain a list of scripts, relative
7020: to WRKSRC, that you want adjusted. Every occurrence of the matching shell in a
7021: she-bang line will be replaced with the full path to the shell executable. When
7022: using REPLACE_BASH, don't forget to add bash to USE_TOOLS.
1.41 wiz 7023:
1.223 nia 7024: 21.4.7. Other programming languages
1.1 dsieger 7025:
1.210 gutterid 7026: There are further similar REPLACE variables available, e.g., REPLACE_AWK for
7027: packages containing awk scripts, and REPLACE_R for R. These two, like the
1.211 gutterid 7028: others noted above, have their actions defined centrally in mk/configure/
7029: replace-interpreter.mk. Other languages define the actions of these variables
7030: within their own dedicated part of the tree, e.g., REPLACE_PHP is actioned in
1.245 gutterid 7031: lang/php/replace.mk, and REPLACE_PYTHON is actioned in lang/python/
1.211 gutterid 7032: application.mk. For other languages, consult the mk files found within their
1.216 gutterid 7033: specific directories (the naming convention varies), or check the list found in
7034: Appendix E, Help topics.
1.210 gutterid 7035:
7036: Currently, special handling for other languages varies in pkgsrc. If a compiler
7037: package provides a buildlink3.mk file, include that, otherwise just add a
7038: (build) dependency on the appropriate compiler package.
1.1 dsieger 7039:
1.154 rillig 7040: 21.5. The build phase
1.1 dsieger 7041:
7042: The most common failures when building a package are that some platforms do not
7043: provide certain header files, functions or libraries, or they provide the
7044: functions in a library that the original package author didn't know. To work
7045: around this, you can rewrite the source code in most cases so that it does not
7046: use the missing functions or provides a replacement function.
7047:
1.154 rillig 7048: 21.5.1. Compiling C and C++ code conditionally
1.1 dsieger 7049:
7050: If a package already comes with a GNU configure script, the preferred way to
7051: fix the build failure is to change the configure script, not the code. In the
7052: other cases, you can utilize the C preprocessor, which defines certain macros
7053: depending on the operating system and hardware architecture it compiles for.
7054: These macros can be queried using for example #if defined(__i386). Almost every
7055: operating system, hardware architecture and compiler has its own macro. For
7056: example, if the macros __GNUC__, __i386__ and __NetBSD__ are all defined, you
7057: know that you are using NetBSD on an i386 compatible CPU, and your compiler is
7058: GCC.
7059:
7060: The list of the following macros for hardware and operating system depends on
7061: the compiler that is used. For example, if you want to conditionally compile
7062: code on Solaris, don't use __sun__, as the SunPro compiler does not define it.
7063: Use __sun instead.
7064:
1.154 rillig 7065: 21.5.1.1. C preprocessor macros to identify the operating system
1.1 dsieger 7066:
1.223 nia 7067: To distinguish between specific NetBSD versions, you should use the following
7068: code.
7069:
7070: #ifdef __NetBSD__
7071: #include <sys/param.h>
7072: #if __NetBSD_Prereq__(9,99,17)
7073: /* use a newer feature */
7074: #else
7075: /* older code */
7076: #endif
7077: #endif
7078:
7079: #ifndef _WIN32
7080: /* Unix-like specific code */
7081: #endif
7082:
1.1 dsieger 7083: To distinguish between 4.4 BSD-derived systems and the rest of the world, you
7084: should use the following code.
7085:
7086: #include <sys/param.h>
7087: #if (defined(BSD) && BSD >= 199306)
7088: /* BSD-specific code goes here */
7089: #else
7090: /* non-BSD-specific code goes here */
7091: #endif
7092:
1.223 nia 7093: You can also test for the following macros:
1.1 dsieger 7094:
1.46 obache 7095: Cygwin __CYGWIN__
7096: DragonFly __DragonFly__
1.1 dsieger 7097: FreeBSD __FreeBSD__
1.46 obache 7098: Haiku __HAIKU__
1.1 dsieger 7099: Interix __INTERIX
7100: IRIX __sgi (TODO: get a definite source for this)
1.223 nia 7101: Linux __linux
1.83 dholland 7102: Mac OS X __APPLE__
1.46 obache 7103: MirBSD __MirBSD__ (__OpenBSD__ is also defined)
7104: Minix3 __minix
1.1 dsieger 7105: NetBSD __NetBSD__
7106: OpenBSD __OpenBSD__
7107: Solaris sun, __sun
7108:
1.154 rillig 7109: 21.5.1.2. C preprocessor macros to identify the hardware architecture
1.1 dsieger 7110:
7111: i386 i386, __i386, __i386__
1.223 nia 7112: x86-64 __amd64__, __x86_64__
7113: ARM __arm__
1.1 dsieger 7114: MIPS __mips
7115: SPARC sparc, __sparc
1.223 nia 7116: PowerPC __powerpc
1.1 dsieger 7117:
1.154 rillig 7118: 21.5.1.3. C preprocessor macros to identify the compiler
1.1 dsieger 7119:
7120: GCC __GNUC__ (major version), __GNUC_MINOR__
7121: MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41)
7122: SunPro __SUNPRO_C (0x570 for Sun C 5.7)
7123: SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8)
7124:
1.154 rillig 7125: 21.5.2. How to handle compiler bugs
1.1 dsieger 7126:
7127: Some source files trigger bugs in the compiler, based on combinations of
7128: compiler version and architecture and almost always relation to optimisation
7129: being enabled. Common symptoms are gcc internal errors or never finishing
7130: compiling a file.
7131:
7132: Typically, a workaround involves testing the MACHINE_ARCH and compiler version,
1.87 tnn 7133: disabling optimisation for that combination of file, MACHINE_ARCH and compiler.
7134:
7135: This used to be a big problem in the past, but is rarely needed now as compiler
7136: technology has matured. If you still need to add a compiler specific
7137: workaround, please do so in the file hacks.mk and describe the symptom and
7138: compiler version as detailed as possible.
1.1 dsieger 7139:
1.172 rillig 7140: 21.5.3. No such file or directory
7141:
7142: Compilation sometimes fails with an error message like this:
7143:
7144: .../x11/gtk3/work/gtk+-3.24.12/gdk/gdktypes.h:35:10:
7145: fatal error: pango/pango.h: No such file or directory
7146:
7147: The proper way to fix this problem depends on the type of the header, which is
7148: described in the following sections.
7149:
7150: 21.5.3.1. Headers from other packages
7151:
7152: If the header name looks like it comes from a different package, that other
7153: package should be included via the buildlink3 framework.
7154:
7155: First, look whether the header is somewhere in the buildlink3 directory below
7156: WRKDIR. In the above case of the missing Pango header:
7157:
7158: $ find work/.buildlink/ -print | grep -F pango/pango.h
7159:
7160: In the case of Pango, the output is:
7161:
7162: work/.buildlink/include/pango-1.0/pango/pango.h
7163:
7164: If the pango/pango.h file were placed directly in the .buildlink directory, it
7165: would have been found automatically. There is an extra pango-1.0 path component
7166: though, which means that the compiler command line must contain an option of
7167: the form -I${BUILDLINK3_PREFIX.pango}/include/pango-1.0. In most cases this
7168: option is generated by the configure script, which can be examined using:
7169:
7170: $ $ grep -o '[-]I[^[:space:]]*/pango[^[:space:]]*' work/*/Makefile
7171: -I/usr/pkg/include/pango-1.0
7172: -I/usr/pkg/include/pango-1.0
7173: -I/usr/pkg/include/pango-1.0
7174: -I/usr/pkg/include/pango-1.0
7175: -I/usr/pkg/include/pango-1.0
7176:
7177: This looks good. These options are transformed by the buildlink wrapper to
7178: refer to the correct path inside work/.buildlink.
7179:
7180: Since the compilation fails though, examine the compiler command lines in work
7181: /.work.log to see whether the -I option is included in the particular command
7182: line.
7183:
7184: To further analyze the situation, run bmake build-env, which sets up an
7185: interactive, realistic environment including all the pkgsrc wrapper commands
7186: and environment variables. From there, try to compile some simple example
7187: programs that use the header.
7188:
7189: 21.5.3.2. Headers generated during the build
7190:
7191: If the name of the header seems to come from the package itself, and if the
7192: build is run with parallel jobs, the package may have some undeclared
7193: dependencies between the .c and the .h files, and a C file is compiled before
7194: its required header is generated.
7195:
7196: To see whether the build runs with parallel jobs, run bmake show-all-build |
7197: grep JOBS. Its output looks like this:
7198:
7199: usr MAKE_JOBS= 7
7200: pkg MAKE_JOBS_SAFE # undefined
7201: def _MAKE_JOBS_N= 7
7202:
7203: In this case the pkgsrc user has asked pkgsrc to build packages with 7 jobs in
7204: parallel (MAKE_JOBS). The package could have disabled parallel builds by
7205: setting MAKE_JOBS_SAFE to no, but in this case it hasn't.
7206:
7207: To see whether the build failure is caused by parallel builds, first save the
7208: exact error message and a bit of context, maybe you need it later for reporting
7209: a bug. Next, run:
7210:
7211: MAKE_JOBS_SAFE=no bmake clean build
7212:
7213: If that succeeds, file a bug report against the pkgsrc package, including the
7214: exact error message and the contents of your mk.conf file.
7215:
1.173 rillig 7216: 21.5.3.3. Symlinks
7217:
7218: Pkgsrc does not work reliably if any of LOCALBASE, VARBASE or WRKDIR contains a
7219: symlink. Since 2019Q2, the pkgsrc bootstrap program prevents installing pkgsrc
7220: in symlink-based directories. Existing pkgsrc installations are not checked for
7221: symlinks though.
7222:
7223: The "No such file or directory" error messages are a typical symptom of
7224: symlinks, and it's quite difficult to find out that this is the actual cause.
7225:
7226: 21.5.3.4. Stale working directories
7227:
7228: When building a hierarchy of packages, it may happen that one package is built
7229: and then pkgsrc is updated. This situation can provoke various hard to diagnose
7230: build errors. To clean up the situation:
7231:
1.223 nia 7232: $ (cd ../../ && cat mk/bsd.pkg.mk >/dev/null && rm -rf */*/work)
1.173 rillig 7233:
1.223 nia 7234: (The only purpose of the bsd.pkg.mk is to prevent running this command in the
7235: wrong directory.)
1.173 rillig 7236:
7237: If you have set WRKOBJDIR in mk.conf, remove that directory as well.
7238:
7239: 21.5.3.5. Other possible reasons
7240:
7241: On platforms other than BSD, third-party packages are installed in /usr/
7242: include, together with the base system. This means that pkgsrc cannot
7243: distinguish between headers provided by the base system (which it needs) and
7244: headers from third-party packages (which are often included in pkgsrc as well).
7245: This can lead to subtle version mismatches.
7246:
7247: In pkgsrc installations that have been active for several years, it may happen
7248: that some files are manually deleted. To exclude this unlikely reason, run
7249: pkg_admin check.
7250:
7251: It may help to run pkg_admin rebuild-tree to check/fix dependencies.
7252:
7253: If all of the above doesn't help, see Chapter 2, Getting help for contact
7254: information. Be prepared to describe what you have tried so far and what any
7255: error messages were.
7256:
1.172 rillig 7257: 21.5.4. Undefined reference to "..."
1.1 dsieger 7258:
7259: This error message often means that a package did not link to a shared library
7260: it needs. The following functions are known to cause this error message over
7261: and over.
7262:
7263: +-----------------------------------------------------+
7264: | Function |Library |Affected platforms|
7265: |-------------------------+--------+------------------|
7266: |accept, bind, connect |-lsocket|Solaris |
7267: |-------------------------+--------+------------------|
7268: |crypt |-lcrypt |DragonFly, NetBSD |
7269: |-------------------------+--------+------------------|
7270: |dlopen, dlsym |-ldl |Linux |
7271: |-------------------------+--------+------------------|
7272: |gethost* |-lnsl |Solaris |
7273: |-------------------------+--------+------------------|
7274: |inet_aton |-lresolv|Solaris |
7275: |-------------------------+--------+------------------|
7276: |nanosleep, sem_*, timer_*|-lrt |Solaris |
7277: |-------------------------+--------+------------------|
7278: |openpty |-lutil |Linux |
7279: +-----------------------------------------------------+
7280:
1.223 nia 7281: To fix these linker errors, it is often sufficient to add LIBS.OperatingSystem+
7282: = -lfoo to the package Makefile and then run bmake clean; bmake.
1.1 dsieger 7283:
1.223 nia 7284: 21.5.4.1. The SunPro compiler and inline functions
1.1 dsieger 7285:
7286: When you are using the SunPro compiler, there is another possibility. That
7287: compiler cannot handle the following code:
7288:
7289: extern int extern_func(int);
7290:
7291: static inline int
7292: inline_func(int x)
7293: {
7294: return extern_func(x);
7295: }
7296:
7297: int main(void)
7298: {
7299: return 0;
7300: }
7301:
7302: It generates the code for inline_func even if that function is never used. This
7303: code then refers to extern_func, which can usually not be resolved. To solve
7304: this problem you can try to tell the package to disable inlining of functions.
7305:
1.228 gutterid 7306: 21.5.4.2. Missing atomic functions
7307:
7308: When building for older machine architectures (e.g., i386, PowerPC), builds may
7309: fail because the package expects modern 64-bit atomic functions which the
7310: underlying hardware either doesn't support, or will only support with specific
7311: compiler flags. This is generally handled via inclusion of mk/atomic64.mk.
7312:
1.172 rillig 7313: 21.5.5. Running out of memory
1.1 dsieger 7314:
7315: Sometimes packages fail to build because the compiler runs into an operating
7316: system specific soft limit. With the UNLIMIT_RESOURCES variable pkgsrc can be
1.223 nia 7317: told to unlimit the resources. The allowed values are any combination of "
7318: cputime", "datasize", "memorysize", "stacksize" and "virtualsize". Setting this
7319: variable is similar to running the shell builtin ulimit command to raise the
7320: maximum data segment size or maximum stack size of a process, respectively, to
7321: their hard limits.
1.1 dsieger 7322:
1.154 rillig 7323: 21.6. The install phase
1.1 dsieger 7324:
1.154 rillig 7325: 21.6.1. Creating needed directories
1.1 dsieger 7326:
7327: The BSD-compatible install supplied with some operating systems cannot create
7328: more than one directory at a time. As such, you should call ${INSTALL_*_DIR}
7329: like this:
7330:
7331: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
7332: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
7333:
1.223 nia 7334: Instead of running the install commands directly, you can also append "dir1
7335: dir2" to the INSTALLATION_DIRS variable, which will automatically do the right
7336: thing.
1.1 dsieger 7337:
1.154 rillig 7338: 21.6.2. Where to install documentation
1.1 dsieger 7339:
7340: In general, documentation should be installed into ${PREFIX}/share/doc/$
1.223 nia 7341: {PKGBASE} or ${PREFIX}/share/doc/${PKGNAME_NOREV} (the latter includes the
7342: version number of the package).
1.1 dsieger 7343:
7344: Many modern packages using GNU autoconf allow to set the directory where HTML
7345: documentation is installed with the "--with-html-dir" option. Sometimes using
7346: this flag is needed because otherwise the documentation ends up in ${PREFIX}/
1.223 nia 7347: share/doc/html or other places. In pkgsrc, the HTML documentation should go
7348: into the package-specific directory, just like any other documentation.
1.1 dsieger 7349:
7350: An exception to the above is that library API documentation generated with the
7351: textproc/gtk-doc tools, for use by special browsers (devhelp) should be left at
7352: their default location, which is ${PREFIX}/share/gtk-doc. Such documentation
7353: can be recognized from files ending in .devhelp or .devhelp2. (It is also
7354: acceptable to install such files in ${PREFIX}/share/doc/${PKGBASE} or ${PREFIX}
7355: /share/doc/${PKGNAME}; the .devhelp* file must be directly in that directory
7356: then, no additional subdirectory level is allowed in this case. This is usually
7357: achieved by using "--with-html-dir=${PREFIX}/share/doc". ${PREFIX}/share/
7358: gtk-doc is preferred though.)
7359:
1.154 rillig 7360: 21.6.3. Installing highscore files
1.1 dsieger 7361:
7362: Certain packages, most of them in the games category, install a score file that
7363: allows all users on the system to record their highscores. In order for this to
7364: work, the binaries need to be installed setgid and the score files owned by the
1.36 wiz 7365: appropriate group and/or owner (traditionally the "games" user/group). Set
7366: USE_GAMESGROUP to yes to support this. The following variables, documented in
7367: more detail in mk/defaults/mk.conf, control this behaviour: GAMEDATAMODE,
1.100 leot 7368: GAMEDIRMODE, GAMES_GROUP, GAMEMODE, GAME_USER. Other useful variables are:
7369: GAMEDIR_PERMS, GAMEDATA_PERMS and SETGID_GAMES_PERMS.
7370:
7371: An example that illustrates some of the variables described above is games/
7372: moon-buggy. OWN_DIRS_PERMS is used to properly set directory permissions of the
7373: directory where the scorefile is saved, REQD_FILES_PERMS is used to create a
7374: dummy scorefile (mbscore) with the proper permissions and SPECIAL_PERMS is used
7375: to install setgid the game binary:
7376:
7377: USE_GAMESGROUP= yes
7378:
7379: BUILD_DEFS+= VARBASE
7380:
7381: OWN_DIRS_PERMS+= ${VARBASE}/games/moon-buggy ${GAMEDIR_PERMS}
7382: REQD_FILES_PERMS+= /dev/null ${VARBASE}/games/moon-buggy/mbscore ${GAMEDATA_PERMS}
7383: SPECIAL_PERMS+= ${PREFIX}/bin/moon-buggy ${SETGID_GAMES_PERMS}
7384:
7385: Various INSTALL_* variables are also available: INSTALL_GAME to install setgid
7386: game binaries, INSTALL_GAME_DIR to install game directories that are needed to
7387: be accessed by setgid games and INSTALL_GAME_DATA to install scorefiles.
1.1 dsieger 7388:
1.14 jmcneill 7389: A package should therefore never hard code file ownership or access permissions
1.100 leot 7390: but rely on *_PERMS as described above or alternatively on INSTALL_GAME,
7391: INSTALL_GAME_DATA and INSTALL_GAME_DIR to set these correctly.
1.1 dsieger 7392:
1.154 rillig 7393: 21.6.4. Adding DESTDIR support to packages
1.4 rillig 7394:
1.14 jmcneill 7395: DESTDIR support means that a package installs into a staging directory, not the
7396: final location of the files. Then a binary package is created which can be used
7397: for installation as usual. There are two ways: Either the package must install
1.25 wiz 7398: as root ("destdir") or the package can install as non-root user ("user-destdir"
7399: ).
1.14 jmcneill 7400:
1.113 leot 7401: * PKG_DESTDIR_SUPPORT has to be set to "destdir" or "user-destdir". By
7402: default PKG_DESTDIR_SUPPORT is set to "user-destdir" to help catching more
7403: potential packaging problems. If bsd.prefs.mk is included in the Makefile,
7404: PKG_DESTDIR_SUPPORT needs to be set before the inclusion.
1.14 jmcneill 7405:
1.4 rillig 7406: * All installation operations have to be prefixed with ${DESTDIR}.
7407:
7408: * automake gets this DESTDIR mostly right automatically. Many manual rules
7409: and pre/post-install often are incorrect; fix them.
7410:
1.17 imil 7411: * If files are installed with special owner/group use SPECIAL_PERMS.
1.4 rillig 7412:
7413: * In general, packages should support UNPRIVILEGED to be able to use DESTDIR.
7414:
1.154 rillig 7415: 21.6.5. Packages with hardcoded paths to other interpreters
1.1 dsieger 7416:
7417: Your package may also contain scripts with hardcoded paths to other
1.203 nia 7418: interpreters besides (or as well as) Perl. To correct the full pathname to the
1.1 dsieger 7419: script interpreter, you need to set the following definitions in your Makefile
7420: (we shall use tclsh in this example):
7421:
7422: REPLACE_INTERPRETER+= tcl
7423: REPLACE.tcl.old= .*/bin/tclsh
7424: REPLACE.tcl.new= ${PREFIX}/bin/tclsh
7425: REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
7426: # relative to ${WRKSRC}, just as in REPLACE_PERL
7427:
1.203 nia 7428: 21.6.6. Packages installing Perl modules
1.1 dsieger 7429:
7430: Makefiles of packages providing perl5 modules should include the Makefile
7431: fragment ../../lang/perl5/module.mk. It provides a do-configure target for the
7432: standard perl configuration for such modules as well as various hooks to tune
7433: this configuration. See comments in this file for details.
7434:
7435: Perl5 modules will install into different places depending on the version of
7436: perl used during the build process. To address this, pkgsrc will append lines
7437: to the PLIST corresponding to the files listed in the installed .packlist file
7438: generated by most perl5 modules. This is invoked by defining PERL5_PACKLIST to
1.48 wiz 7439: a space-separated list of packlist files relative to PERL5_PACKLIST_DIR
7440: (PERL5_INSTALLVENDORARCH by default), e.g.:
1.1 dsieger 7441:
1.48 wiz 7442: PERL5_PACKLIST= auto/Pg/.packlist
1.1 dsieger 7443:
1.48 wiz 7444: The perl5 config variables installarchlib, installscript, installvendorbin,
7445: installvendorscript, installvendorarch, installvendorlib, installvendorman1dir,
7446: and installvendorman3dir represent those locations in which components of perl5
7447: modules may be installed, provided as variable with uppercase and prefixed with
7448: PERL5_, e.g. PERL5_INSTALLARCHLIB and may be used by perl5 packages that don't
7449: have a packlist. These variables are also substituted for in the PLIST as
7450: uppercase prefixed with PERL5_SUB_.
1.1 dsieger 7451:
1.254 wiz 7452: 21.6.7. Packages installing pkg-config files
7453:
7454: Some packages, usually those providing libraries, install pkg-config files so
7455: that their headers and libraries can easily be found. The file names end with
7456: .pc.
7457:
7458: Most of the time, these files only provide the linker flags for the library,
7459: but do not include the flags for setting the rpath so the libraries can also be
7460: found at runtime. Since this is so common, pkgsrc provides PKGCONFIG_OVERRIDE
7461: for this. Many packages generate the .pc from .pc.in, in that case add those
7462: files to the PKGCONFIG_OVERRIDE variable:
7463:
7464: PKGCONFIG_OVERRIDE+= foo.pc.in
7465:
7466:
7467: For packages using meson, the files are generated during build and you also
7468: need to change the phase in which the replacement is done. For example:
7469:
7470: PKGCONFIG_OVERRIDE+= output/meson-private/foo.pc
7471: PKGCONFIG_OVERRIDE_STAGE= post-build
7472:
7473:
7474: 21.6.8. Packages installing info files
1.1 dsieger 7475:
7476: Some packages install info files or use the "makeinfo" or "install-info"
7477: commands. INFO_FILES should be defined in the package Makefile so that INSTALL
7478: and DEINSTALL scripts will be generated to handle registration of the info
7479: files in the Info directory file. The "install-info" command used for the info
7480: files registration is either provided by the system, or by a special purpose
7481: package automatically added as dependency if needed.
7482:
7483: PKGINFODIR is the directory under ${PREFIX} where info files are primarily
7484: located. PKGINFODIR defaults to "info" and can be overridden by the user.
7485:
7486: The info files for the package should be listed in the package PLIST; however
7487: any split info files need not be listed.
7488:
7489: A package which needs the "makeinfo" command at build time must add "makeinfo"
7490: to USE_TOOLS in its Makefile. If a minimum version of the "makeinfo" command is
7491: needed it should be noted with the TEXINFO_REQD variable in the package
7492: Makefile. By default, a minimum version of 3.12 is required. If the system does
7493: not provide a makeinfo command or if it does not match the required minimum, a
7494: build dependency on the devel/gtexinfo package will be added automatically.
7495:
7496: The build and installation process of the software provided by the package
7497: should not use the install-info command as the registration of info files is
1.25 wiz 7498: the task of the package INSTALL script, and it must use the appropriate
1.1 dsieger 7499: makeinfo command.
7500:
7501: To achieve this goal, the pkgsrc infrastructure creates overriding scripts for
7502: the install-info and makeinfo commands in a directory listed early in PATH.
7503:
7504: The script overriding install-info has no effect except the logging of a
7505: message. The script overriding makeinfo logs a message and according to the
7506: value of TEXINFO_REQD either runs the appropriate makeinfo command or exit on
7507: error.
7508:
1.254 wiz 7509: 21.6.9. Packages installing man pages
1.1 dsieger 7510:
7511: All packages that install manual pages should install them into the same
7512: directory, so that there is one common place to look for them. In pkgsrc, this
7513: place is ${PREFIX}/${PKGMANDIR}, and this expression should be used in
1.25 wiz 7514: packages. The default for PKGMANDIR is "man". Another often-used value is "
7515: share/man".
1.1 dsieger 7516:
7517: Note
7518:
7519: The support for a custom PKGMANDIR is far from complete.
7520:
7521: The PLIST files can just use man/ as the top level directory for the man page
7522: file entries, and the pkgsrc framework will convert as needed. In all other
7523: places, the correct PKGMANDIR must be used.
7524:
7525: Packages that are configured with GNU_CONFIGURE set as "yes", by default will
7526: use the ./configure --mandir switch to set where the man pages should be
7527: installed. The path is GNU_CONFIGURE_MANDIR which defaults to ${PREFIX}/$
7528: {PKGMANDIR}.
7529:
7530: Packages that use GNU_CONFIGURE but do not use --mandir, can set
7531: CONFIGURE_HAS_MANDIR to "no". Or if the ./configure script uses a non-standard
7532: use of --mandir, you can set GNU_CONFIGURE_MANDIR as needed.
7533:
1.184 rillig 7534: See Section 19.5, "Man page compression" for information on installation of
1.1 dsieger 7535: compressed manual pages.
7536:
1.254 wiz 7537: 21.6.10. Packages installing X11 fonts
1.1 dsieger 7538:
7539: If a package installs font files, you will need to rebuild the fonts database
7540: in the directory where they get installed at installation and deinstallation
7541: time. This can be automatically done by using the pkginstall framework.
7542:
7543: You can list the directories where fonts are installed in the FONTS_DIRS.type
7544: variables, where type can be one of "ttf", "type1" or "x11". Also make sure
7545: that the database file fonts.dir is not listed in the PLIST.
7546:
7547: Note that you should not create new directories for fonts; instead use the
7548: standard ones to avoid that the user needs to manually configure his X server
7549: to find them.
7550:
1.254 wiz 7551: 21.6.11. Packages installing SGML or XML data
1.1 dsieger 7552:
7553: If a package installs SGML or XML data files that need to be registered in
7554: system-wide catalogs (like DTDs, sub-catalogs, etc.), you need to take some
7555: extra steps:
7556:
7557: 1. Include ../../textproc/xmlcatmgr/catalogs.mk in your Makefile, which takes
7558: care of registering those files in system-wide catalogs at installation and
7559: deinstallation time.
7560:
7561: 2. Set SGML_CATALOGS to the full path of any SGML catalogs installed by the
7562: package.
7563:
7564: 3. Set XML_CATALOGS to the full path of any XML catalogs installed by the
7565: package.
7566:
7567: 4. Set SGML_ENTRIES to individual entries to be added to the SGML catalog.
7568: These come in groups of three strings; see xmlcatmgr(1) for more
7569: information (specifically, arguments recognized by the 'add' action). Note
7570: that you will normally not use this variable.
7571:
7572: 5. Set XML_ENTRIES to individual entries to be added to the XML catalog. These
7573: come in groups of three strings; see xmlcatmgr(1) for more information
7574: (specifically, arguments recognized by the 'add' action). Note that you
7575: will normally not use this variable.
7576:
1.254 wiz 7577: 21.6.12. Packages installing extensions to the MIME database
1.1 dsieger 7578:
7579: If a package provides extensions to the MIME database by installing .xml files
7580: inside ${PREFIX}/share/mime/packages, you need to take some extra steps to
7581: ensure that the database is kept consistent with respect to these new files:
7582:
7583: 1. Include ../../databases/shared-mime-info/mimedb.mk (avoid using the
7584: buildlink3.mk file from this same directory, which is reserved for
7585: inclusion from other buildlink3.mk files). It takes care of rebuilding the
7586: MIME database at installation and deinstallation time, and disallows any
7587: access to it directly from the package.
7588:
1.25 wiz 7589: 2. Check the PLIST and remove any entries under the share/mime directory,
1.1 dsieger 7590: except for files saved under share/mime/packages. The former are handled
7591: automatically by the update-mime-database program, but the latter are
7592: package-dependent and must be removed by the package that installed them in
7593: the first place.
7594:
7595: 3. Remove any share/mime/* directories from the PLIST. They will be handled by
7596: the shared-mime-info package.
7597:
1.254 wiz 7598: 21.6.13. Packages using intltool
1.1 dsieger 7599:
7600: If a package uses intltool during its build, add intltool to the USE_TOOLS,
7601: which forces it to use the intltool package provided by pkgsrc, instead of the
7602: one bundled with the distribution file.
7603:
7604: This tracks intltool's build-time dependencies and uses the latest available
7605: version; this way, the package benefits of any bug fixes that may have appeared
7606: since it was released.
7607:
1.254 wiz 7608: 21.6.14. Packages installing startup scripts
1.1 dsieger 7609:
1.256 wiz 7610: If a package contains an rc.d script, it won't be copied into the startup
7611: directory (/etc/rc.d) by default, but you can enable copying by setting the
7612: option PKG_RCD_SCRIPTS=YES in mk.conf. With PKG_RCD_SCRIPTS=YES, rc.d scripts
7613: will be copied into /etc/rc.d when a package is installed, but only if the
7614: target does not already exist. Copies in /etc/rc.d will be automatically
7615: removed only if they have not been modified.
7616:
7617: Note that this alone does not enable the service: It must still be added to /
7618: etc/rc.conf.
1.1 dsieger 7619:
1.254 wiz 7620: 21.6.15. Packages installing TeX modules
1.1 dsieger 7621:
7622: If a package installs TeX packages into the texmf tree, the ls-R database of
7623: the tree needs to be updated.
7624:
7625: Note
7626:
1.23 jakllsch 7627: Except the main TeX packages such as kpathsea, packages should install files
7628: into ${PREFIX}/share/texmf-dist, not ${PREFIX}/share/texmf.
1.1 dsieger 7629:
1.23 jakllsch 7630: 1. Include ../../print/kpathsea/texmf.mk. This takes care of rebuilding the
7631: ls-R database at installation and deinstallation time.
1.1 dsieger 7632:
1.23 jakllsch 7633: 2. If your package installs files into a texmf tree other than the one at $
7634: {PREFIX}/share/texmf-dist, set TEX_TEXMF_DIRS to the list of all texmf
7635: trees that need database update.
1.1 dsieger 7636:
7637: If your package also installs font map files that need to be registered
1.30 dholland 7638: using updmap, include ../../print/tex-tetex/map.mk and set TEX_MAP_FILES
7639: and/or TEX_MIXEDMAP_FILES to the list of all such font map files. Then
7640: updmap will be run automatically at installation/deinstallation to enable/
7641: disable font map files for TeX output drivers.
1.1 dsieger 7642:
7643: 3. Make sure that none of ls-R databases are included in PLIST, as they will
1.30 dholland 7644: be removed only by the kpathsea package.
1.1 dsieger 7645:
1.254 wiz 7646: 21.6.16. Packages supporting running binaries in emulation
1.1 dsieger 7647:
7648: There are some packages that provide libraries and executables for running
7649: binaries from a one operating system on a different one (if the latter supports
7650: it). One example is running Linux binaries on NetBSD.
7651:
7652: The pkgtools/rpm2pkg helps in extracting and packaging Linux rpm packages.
7653:
7654: The CHECK_SHLIBS can be set to no to avoid the check-shlibs target, which tests
7655: if all libraries for each installed executable can be found by the dynamic
7656: linker. Since the standard dynamic linker is run, this fails for emulation
7657: packages, because the libraries used by the emulation are not in the standard
7658: directories.
7659:
1.254 wiz 7660: 21.6.17. Packages installing hicolor icons
1.1 dsieger 7661:
7662: If a package installs images under the share/icons/hicolor and/or updates the
7663: share/icons/hicolor/icon-theme.cache database, you need to take some extra
7664: steps to make sure that the shared theme directory is handled appropriately and
7665: that the cache database is rebuilt:
7666:
7667: 1. Include ../../graphics/hicolor-icon-theme/buildlink3.mk.
7668:
7669: 2. Check the PLIST and remove the entry that refers to the theme cache.
7670:
7671: 3. Ensure that the PLIST does not remove the shared icon directories from the
7672: share/icons/hicolor hierarchy because they will be handled automatically.
7673:
7674: The best way to verify that the PLIST is correct with respect to the last two
7675: points is to regenerate it using make print-PLIST.
7676:
1.254 wiz 7677: 21.6.18. Packages installing desktop files
1.1 dsieger 7678:
7679: If a package installs .desktop files under share/applications and these include
1.54 rodent 7680: MIME information (MimeType key), you need to take extra steps to ensure that
7681: they are registered into the MIME database:
1.1 dsieger 7682:
7683: 1. Include ../../sysutils/desktop-file-utils/desktopdb.mk.
7684:
7685: 2. Check the PLIST and remove the entry that refers to the share/applications/
7686: mimeinfo.cache file. It will be handled automatically.
7687:
7688: The best way to verify that the PLIST is correct with respect to the last point
7689: is to regenerate it using make print-PLIST.
7690:
1.154 rillig 7691: 21.7. Marking packages as having problems
1.1 dsieger 7692:
1.23 jakllsch 7693: In some cases one does not have the time to solve a problem immediately. In
7694: this case, one can plainly mark a package as broken. For this, one just sets
7695: the variable BROKEN to the reason why the package is broken (similar to the
1.162 rillig 7696: PKG_FAIL_REASON variable). A user trying to build the package will immediately
7697: be shown this message, and the build will not be even tried.
1.1 dsieger 7698:
1.23 jakllsch 7699: BROKEN packages are removed from pkgsrc in irregular intervals.
1.1 dsieger 7700:
1.184 rillig 7701: Chapter 22. GNOME packaging and porting
7702:
7703: Table of Contents
7704:
7705: 22.1. Meta packages
7706: 22.2. Packaging a GNOME application
7707: 22.3. Updating GNOME to a newer version
7708: 22.4. Patching guidelines
7709:
7710: Quoting GNOME's web site:
7711:
7712: The GNOME project provides two things: The GNOME desktop environment, an
7713: intuitive and attractive desktop for users, and the GNOME development
7714: platform, an extensive framework for building applications that integrate
7715: into the rest of the desktop.
7716:
7717: pkgsrc provides a seamless way to automatically build and install a complete
7718: GNOME environment under many different platforms. We can say with confidence
7719: that pkgsrc is one of the most advanced build and packaging systems for GNOME
7720: due to its included technologies buildlink3, the wrappers and tools framework
7721: and automatic configuration file management. Lots of efforts are put into
7722: achieving a completely clean deinstallation of installed software components.
7723:
7724: Given that pkgsrc is NetBSD's official packaging system, the above also means
7725: that great efforts are put into making GNOME work under this operating system.
7726:
7727: This chapter is aimed at pkgsrc developers and other people interested in
7728: helping our GNOME porting and packaging efforts. It provides instructions on
7729: how to manage the existing packages and some important information regarding
7730: their internals.
7731:
7732: 22.1. Meta packages
7733:
7734: pkgsrc includes three GNOME-related meta packages:
7735:
7736: * meta-pkgs/gnome-base: Provides the core GNOME desktop environment. It only
7737: includes the necessary bits to get it to boot correctly, although it may
7738: lack important functionality for daily operation. The idea behind this
7739: package is to let end users build their own configurations on top of this
7740: one, first installing this meta package to achieve a functional setup and
7741: then adding individual applications.
7742:
7743: * meta-pkgs/gnome: Provides a complete installation of the GNOME platform and
7744: desktop as defined by the GNOME project; this is based on the components
7745: distributed in the platform/x.y/x.y.z/sources and desktop/x.y/x.y.z/sources
7746: directories of the official FTP server. Developer-only tools found in those
7747: directories are not installed unless required by some other component to
7748: work properly. Similarly, packages from the bindings set (bindings/x.y/
7749: x.y.z/sources) are not pulled in unless required as a dependency for an
7750: end-user component. This package "extends" meta-pkgs/gnome-base.
7751:
7752: * meta-pkgs/gnome-devel: Installs all the tools required to build a GNOME
7753: component when fetched from the CVS repository. These are required to let
7754: the autogen.sh scripts work appropriately.
7755:
7756: In all these packages, the DEPENDS lines are sorted in a way that eases
7757: updates: a package may depend on other packages listed before it but not on any
7758: listed after it. It is very important to keep this order to ease updates so...
7759: do not change it to alphabetical sorting!
7760:
7761: 22.2. Packaging a GNOME application
7762:
7763: Almost all GNOME applications are written in C and use a common set of tools as
7764: their build system. Things get different with the new bindings to other
7765: languages (such as Python), but the following will give you a general idea on
7766: the minimum required tools:
7767:
7768: * Almost all GNOME applications use the GNU Autotools as their build system.
7769: As a general rule you will need to tell this to your package:
7770:
1.223 nia 7771: GNU_CONFIGURE= yes
7772: USE_LIBTOOL= yes
7773: USE_TOOLS+= gmake
1.184 rillig 7774:
7775: * If the package uses pkg-config to detect dependencies, add this tool to the
7776: list of required utilities:
7777:
1.223 nia 7778: USE_TOOLS+= pkg-config
1.184 rillig 7779:
7780: Also use pkgtools/verifypc at the end of the build process to ensure that
7781: you did not miss to specify any dependency in your package and that the
7782: version requirements are all correct.
7783:
7784: * If the package uses intltool, be sure to add intltool to the USE_TOOLS to
7785: handle dependencies and to force the package to use the latest available
7786: version.
7787:
7788: * If the package uses gtk-doc (a documentation generation utility), do not
7789: add a dependency on it. The tool is rather big and the distfile should come
7790: with pregenerated documentation anyway; if it does not, it is a bug that
7791: you ought to report. For such packages you should disable gtk-doc (unless
7792: it is the default):
7793:
1.223 nia 7794: CONFIGURE_ARGS+= --disable-gtk-doc
1.184 rillig 7795:
7796: The default location of installed HTML files (share/gtk-doc/<package-name>)
7797: is correct and should not be changed unless the package insists on
7798: installing them somewhere else. Otherwise programs as devhelp will not be
7799: able to open them. You can do that with an entry similar to:
1.1 dsieger 7800:
1.223 nia 7801: CONFIGURE_ARGS+= --with-html-dir=${PREFIX}/share/gtk-doc/...
1.1 dsieger 7802:
1.184 rillig 7803: GNOME uses multiple shared directories and files under the installation prefix
7804: to maintain databases. In this context, shared means that those exact same
7805: directories and files are used among several different packages, leading to
7806: conflicts in the PLIST. pkgsrc currently includes functionality to handle the
7807: most common cases, so you have to forget about using @unexec ${RMDIR} lines in
7808: your file lists and omitting shared files from them. If you find yourself doing
7809: those, your package is most likely incorrect.
1.1 dsieger 7810:
1.184 rillig 7811: The following table lists the common situations that result in using shared
7812: directories or files. For each of them, the appropriate solution is given.
7813: After applying the solution be sure to regenerate the package's file list with
7814: make print-PLIST and ensure it is correct.
1.1 dsieger 7815:
1.184 rillig 7816: Table 22.1. PLIST handling for GNOME packages
1.1 dsieger 7817:
1.184 rillig 7818: +-----------------------------------------------------------------------------+
7819: | If the package... | Then... |
7820: |-------------------------------------------+---------------------------------|
1.254 wiz 7821: |Installs icons under the share/icons/ |See Section 21.6.17, "Packages |
1.203 nia 7822: |hicolor hierarchy or updates share/icons/ |installing hicolor icons". |
1.184 rillig 7823: |hicolor/icon-theme.cache. | |
7824: |-------------------------------------------+---------------------------------|
1.254 wiz 7825: | |See Section 21.6.12, "Packages |
1.184 rillig 7826: |Installs files under share/mime/packages. |installing extensions to the MIME|
7827: | |database". |
7828: |-------------------------------------------+---------------------------------|
1.254 wiz 7829: |Installs .desktop files under share/ |See Section 21.6.18, "Packages |
1.184 rillig 7830: |applications and these include MIME |installing desktop files". |
7831: |information. | |
7832: +-----------------------------------------------------------------------------+
1.1 dsieger 7833:
7834:
1.184 rillig 7835: 22.3. Updating GNOME to a newer version
1.1 dsieger 7836:
1.184 rillig 7837: When seeing GNOME as a whole, there are two kinds of updates:
1.1 dsieger 7838:
1.184 rillig 7839: Major update
1.1 dsieger 7840:
1.184 rillig 7841: Given that there is still a very long way for GNOME 3 (if it ever appears),
7842: we consider a major update one that goes from a 2.X version to a 2.Y one,
7843: where Y is even and greater than X. These are hard to achieve because they
7844: introduce lots of changes in the components' code and almost all GNOME
7845: distfiles are updated to newer versions. Some of them can even break API
7846: and ABI compatibility with the previous major version series. As a result,
7847: the update needs to be done all at once to minimize breakage.
1.1 dsieger 7848:
1.184 rillig 7849: A major update typically consists of around 80 package updates and the
7850: addition of some new ones.
1.1 dsieger 7851:
1.184 rillig 7852: Minor update
1.1 dsieger 7853:
1.184 rillig 7854: We consider a minor update one that goes from a 2.A.X version to a 2.A.Y
7855: one where Y is greater than X. These are easy to achieve because they do
7856: not update all GNOME components, can be done in an incremental way and do
7857: not break API nor ABI compatibility.
1.1 dsieger 7858:
1.184 rillig 7859: A minor update typically consists of around 50 package updates, although
7860: the numbers here may vary a lot.
1.1 dsieger 7861:
1.184 rillig 7862: In order to update the GNOME components in pkgsrc to a new stable release
7863: (either major or minor), the following steps should be followed:
1.1 dsieger 7864:
1.184 rillig 7865: 1. Get a list of all the tarballs that form the new release by using the
7866: following commands. These will leave the full list of the components'
7867: distfiles into the list.txt file:
1.1 dsieger 7868:
1.184 rillig 7869: % echo ls "*.tar.bz2" | \
7870: ftp -V ftp://ftp.gnome.org/pub/gnome/platform/x.y/x.y.z/sources/ | \
7871: awk '{ print $9 }' >list.txt
7872: % echo ls "*.tar.bz2" | \
7873: ftp -V ftp://ftp.gnome.org/pub/gnome/desktop/x.y/x.y.z/sources/ | \
7874: awk '{ print $9 }' >>list.txt
1.1 dsieger 7875:
1.184 rillig 7876: 2. Open each meta package's Makefile and bump their version to the release you
7877: are updating them to. The three meta packages should be always consistent
7878: with versioning. Obviously remove any PKGREVISIONs that might be in them.
1.1 dsieger 7879:
1.184 rillig 7880: 3. For each meta package, update all its DEPENDS lines to match the latest
7881: versions as shown by the above commands. Do not list any newer version
7882: (even if found in the FTP) because the meta packages are supposed to list
7883: the exact versions that form a specific GNOME release. Exceptions are
7884: permitted here if a newer version solves a serious issue in the overall
7885: desktop experience; these typically come in the form of a revision bump in
7886: pkgsrc, not in newer versions from the developers.
1.1 dsieger 7887:
1.184 rillig 7888: Packages not listed in the list.txt file should be updated to the latest
7889: version available (if found in pkgsrc). This is the case, for example, of
7890: the dependencies on the GNU Autotools in the meta-pkgs/gnome-devel meta
7891: package.
1.1 dsieger 7892:
1.184 rillig 7893: 4. Generate a patch from the modified meta packages and extract the list of
7894: "new" lines. This will provide you an outline on what packages need to be
7895: updated in pkgsrc and in what order:
1.1 dsieger 7896:
1.184 rillig 7897: % cvs diff -u gnome-devel gnome-base gnome | grep '^+D' >todo.txt
1.1 dsieger 7898:
1.184 rillig 7899: 5. For major desktop updates it is recommended to zap all your installed
7900: packages and start over from scratch at this point.
1.1 dsieger 7901:
1.184 rillig 7902: 6. Now comes the longest step by far: iterate over the contents of todo.txt
7903: and update the packages listed in it in order. For major desktop updates
7904: none of these should be committed until the entire set is completed because
7905: there are chances of breaking not-yet-updated packages.
1.1 dsieger 7906:
1.184 rillig 7907: 7. Once the packages are up to date and working, commit them to the tree one
7908: by one with appropriate log messages. At the end, commit the three meta
7909: package updates and all the corresponding changes to the doc/CHANGES-<YEAR>
7910: and pkgsrc/doc/TODO files.
1.1 dsieger 7911:
1.184 rillig 7912: 22.4. Patching guidelines
1.1 dsieger 7913:
1.184 rillig 7914: GNOME is a very big component in pkgsrc which approaches 100 packages. Please,
7915: it is very important that you always, always, always feed back any portability
7916: fixes you do to a GNOME package to the mainstream developers (see
7917: Section 12.3.5, "Feedback to the author"). This is the only way to get their
7918: attention on portability issues and to ensure that future versions can be built
7919: out-of-the box on NetBSD. The less custom patches in pkgsrc, the easier further
7920: updates are. Those developers in charge of issuing major GNOME updates will be
7921: grateful if you do that.
1.1 dsieger 7922:
1.200 cirnatda 7923: The most common places to report bugs are the GNOME's GitLab and the
7924: freedesktop.org's GitLab. Not all components use these to track bugs, but most
7925: of them do. Do not be short on your reports: always provide detailed
1.184 rillig 7926: explanations of the current failure, how it can be improved to achieve maximum
1.200 cirnatda 7927: portability and, if at all possible, provide a patch against the main Git
7928: branch. The more verbose you are, the higher chances of your patch being
7929: accepted.
1.1 dsieger 7930:
1.184 rillig 7931: Also, please avoid using preprocessor magic to fix portability issues. While
7932: the FreeBSD GNOME people are doing a great job in porting GNOME to their
7933: operating system, the official GNOME sources are now plagued by conditionals
7934: that check for __FreeBSD__ and similar macros. This hurts portability. Please
7935: see our patching guidelines (Section 12.3.4, "Patching guidelines") for more
7936: details.
1.1 dsieger 7937:
1.154 rillig 7938: Chapter 23. Submitting and Committing
1.1 dsieger 7939:
7940: Table of Contents
7941:
1.154 rillig 7942: 23.1. Submitting binary packages
7943: 23.2. Submitting source packages (for non-NetBSD-developers)
7944: 23.3. General notes when adding, updating, or removing packages
7945: 23.4. Commit Messages
7946: 23.5. Committing: Adding a package to CVS
7947: 23.6. Updating a package to a newer version
7948: 23.7. Renaming a package in pkgsrc
7949: 23.8. Moving a package in pkgsrc
1.1 dsieger 7950:
1.154 rillig 7951: 23.1. Submitting binary packages
1.1 dsieger 7952:
7953: Our policy is that we accept binaries only from pkgsrc developers to guarantee
7954: that the packages don't contain any trojan horses etc. This is not to annoy
7955: anyone but rather to protect our users! You're still free to put up your
7956: home-made binary packages and tell the world where to get them. NetBSD
1.154 rillig 7957: developers doing bulk builds and wanting to upload them please see Chapter 8,
1.66 asau 7958: Creating binary packages for everything in pkgsrc (bulk builds).
1.1 dsieger 7959:
1.154 rillig 7960: 23.2. Submitting source packages (for non-NetBSD-developers)
1.1 dsieger 7961:
1.218 nia 7962: Firstly, you can import new packages into pkgsrc-wip ("pkgsrc work-in-progress"
7963: ); see the homepage at https://pkgsrc.org/wip/ for details.
7964:
7965: Next, check that your package is complete, compiles and runs well; see
1.184 rillig 7966: Chapter 14, Creating a new pkgsrc package from scratch and the rest of this
1.218 nia 7967: document. Run the pkgtools/pkglint tool and fix any errors that appear.
7968:
7969: Finally, send a report to the pkgsrc bug tracking system, either with the
7970: send-pr(1) command, or if you don't have that, go to the web page https://
7971: www.NetBSD.org/support/send-pr.html, which contains some instructions and a
7972: link to a form where you can submit packages. The sysutils/gtk-send-pr package
7973: is also available as a substitute for either of the above two tools.
1.1 dsieger 7974:
7975: In the form of the problem report, the category should be "pkg", the synopsis
7976: should include the package name and version number, and the description field
7977: should contain a short description of your package (contents of the COMMENT
1.218 nia 7978: variable or DESCR file are OK).
1.1 dsieger 7979:
1.154 rillig 7980: 23.3. General notes when adding, updating, or removing packages
1.1 dsieger 7981:
7982: Please note all package additions, updates, moves, and removals in pkgsrc/doc/
7983: CHANGES-YYYY. It's very important to keep this file up to date and conforming
7984: to the existing format, because it will be used by scripts to automatically
7985: update pages on www.NetBSD.org and other sites. Additionally, check the pkgsrc/
7986: doc/TODO file and remove the entry for the package you updated or removed, in
7987: case it was mentioned there.
7988:
7989: When the PKGREVISION of a package is bumped, the change should appear in pkgsrc
7990: /doc/CHANGES-YYYY if it is security related or otherwise relevant. Mass bumps
7991: that result from a dependency being updated should not be mentioned. In all
7992: other cases it's the developer's decision.
7993:
7994: There is a make target that helps in creating proper CHANGES-YYYY entries: make
7995: changes-entry. It uses the optional CTYPE and NETBSD_LOGIN_NAME variables. The
7996: general usage is to first make sure that your CHANGES-YYYY file is up-to-date
7997: (to avoid having to resolve conflicts later-on) and then to cd to the package
7998: directory. For package updates, make changes-entry is enough. For new packages,
7999: or package moves or removals, set the CTYPE variable on the command line to
1.4 rillig 8000: "Added", "Moved", or "Removed". You can set NETBSD_LOGIN_NAME in mk.conf if
1.23 jakllsch 8001: your local login name is not the same as your NetBSD login name. The target
8002: also automatically removes possibly existing entries for the package in the
8003: TODO file. Don't forget to commit the changes, e.g. by using make
1.66 asau 8004: commit-changes-entry! If you are not using a checkout directly from
1.23 jakllsch 8005: cvs.NetBSD.org, but e.g. a local copy of the repository, you can set
8006: USE_NETBSD_REPO=yes. This makes the cvs commands use the main repository.
1.1 dsieger 8007:
1.154 rillig 8008: 23.4. Commit Messages
1.130 wiz 8009:
8010: For several years, there have been mirrors of pkgsrc in fossil, git, and hg.
1.257 jkoshy 8011: Standard practice when using these tools is to make the first line of a commit
1.130 wiz 8012: message function as a summary that can be read without the rest, such as is
8013: commonly done with "git log --oneline". For this reason, we have the following
8014: guidelines for pkgsrc commit messages:
8015:
1.131 wiz 8016: * Start the commit message with a line that explains the big picture in 65
1.130 wiz 8017: characters or less. When a commit is for one package, include the name of
8018: the package. For updates, include the version to which it is updated.
8019:
8020: * Leave the next line empty.
8021:
8022: * Then come the details for the commit (changes in that package, reason for a
8023: change) and any relevant PRs. Wrap this section.
8024:
8025: Here is an example:
8026:
1.238 wiz 8027: libxslt: update to 1.0.30
1.130 wiz 8028:
1.238 wiz 8029: Changes since 1.0.29:
8030: ...
1.130 wiz 8031:
8032: Here is another example:
8033:
1.238 wiz 8034: mk/bsd.pkg.mk: enable SSP by default on NetBSD
1.130 wiz 8035:
1.238 wiz 8036: (rationale)
1.130 wiz 8037:
8038: Commit messages are final: no "cvs admin" is allowed on the pkgsrc repository
8039: to change commit messages.
8040:
1.154 rillig 8041: 23.5. Committing: Adding a package to CVS
1.1 dsieger 8042:
8043: This section is only of interest for pkgsrc developers with write access to the
1.34 wiz 8044: pkgsrc repository.
8045:
8046: When the package is finished, "cvs add" the files. Start by adding the
8047: directory and then files in the directory. Don't forget to add the new package
8048: to the category's Makefile. Make sure you don't forget any files; you can check
8049: by running "cvs status". An example:
8050:
8051: $ cd .../pkgsrc/category
8052: $ cvs add pkgname
8053: $ cd pkgname
8054: $ cvs add DESCR Makefile PLIST distinfo buildlink3.mk patches
8055: $ cvs add patches/p*
8056: $ cvs status | less
1.35 wiz 8057: $ cvs commit
1.34 wiz 8058: $ cd ..
1.236 gutterid 8059: $ vi Makefile # add SUBDIR+=pkgname line
1.35 wiz 8060: $ cvs commit Makefile
1.66 asau 8061: $ cd pkgname
1.73 jnemeth 8062: $ make CTYPE=Added commit-changes-entry
1.1 dsieger 8063:
8064: The commit message of the initial import should include part of the DESCR file,
8065: so people reading the mailing lists know what the package is/does.
8066:
1.34 wiz 8067: Also mention the new package in pkgsrc/doc/CHANGES-20xx.
8068:
8069: Previously, "cvs import" was suggested, but it was much easier to get wrong
8070: than "cvs add".
1.1 dsieger 8071:
1.154 rillig 8072: 23.6. Updating a package to a newer version
1.1 dsieger 8073:
8074: Please always put a concise, appropriate and relevant summary of the changes
8075: between old and new versions into the commit log when updating a package. There
8076: are various reasons for this:
8077:
8078: * A URL is volatile, and can change over time. It may go away completely or
8079: its information may be overwritten by newer information.
8080:
8081: * Having the change information between old and new versions in our CVS
8082: repository is very useful for people who use either cvs or anoncvs.
8083:
8084: * Having the change information between old and new versions in our CVS
8085: repository is very useful for people who read the pkgsrc-changes mailing
8086: list, so that they can make tactical decisions about when to upgrade the
8087: package.
8088:
8089: Please also recognize that, just because a new version of a package has been
8090: released, it should not automatically be upgraded in the CVS repository. We
8091: prefer to be conservative in the packages that are included in pkgsrc -
8092: development or beta packages are not really the best thing for most places in
8093: which pkgsrc is used. Please use your judgement about what should go into
8094: pkgsrc, and bear in mind that stability is to be preferred above new and
8095: possibly untested features.
8096:
1.154 rillig 8097: 23.7. Renaming a package in pkgsrc
1.21 snj 8098:
8099: Renaming packages is not recommended.
8100:
1.175 gutterid 8101: When renaming packages, be sure to fix any references to the old name in other
1.21 snj 8102: Makefiles, options, buildlink files, etc.
8103:
1.175 gutterid 8104: Also, when renaming a package, please add the package name and version pattern
1.167 leot 8105: (s) of the previous package to SUPERSEDES. This may be repeated for multiple
8106: renames. The new package would be an exact replacement. Example:
8107:
8108: SUPERSEDES+= p5-IO-Compress-Zlib<2.017
8109: SUPERSEDES+= optcomp-[0-9]*
1.21 snj 8110:
8111: Note that "successor" in the CHANGES-YYYY file doesn't necessarily mean that it
8112: supersedes, as that successor may not be an exact replacement but is a
8113: suggestion for the replaced functionality.
8114:
1.154 rillig 8115: 23.8. Moving a package in pkgsrc
1.21 snj 8116:
8117: It is preferred that packages are not renamed or moved, but if needed please
8118: follow these steps.
1.1 dsieger 8119:
8120: 1. Make a copy of the directory somewhere else.
8121:
8122: 2. Remove all CVS dirs.
8123:
8124: Alternatively to the first two steps you can also do:
8125:
8126: % cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package
8127:
8128: and use that for further work.
8129:
1.25 wiz 8130: 3. Fix CATEGORIES and any DEPENDS paths that just did "../package" instead of
1.1 dsieger 8131: "../../category/package".
8132:
1.21 snj 8133: 4. In the modified package's Makefile, consider setting PREV_PKGPATH to the
8134: previous category/package pathname. The PREV_PKGPATH can be used by tools
8135: for doing an update using pkgsrc building; for example, it can search the
8136: pkg_summary(5) database for PREV_PKGPATH (if no SUPERSEDES) and then use
8137: the corresponding new PKGPATH for that moved package. Note that it may have
8138: multiple matches, so the tool should also check on the PKGBASE too. The
8139: PREV_PKGPATH probably has no value unless SUPERSEDES is not set, i.e.
8140: PKGBASE stays the same.
8141:
1.237 gutterid 8142: 5. cvs add the modified package in the new place.
1.1 dsieger 8143:
1.21 snj 8144: 6. Check if any package depends on it:
1.1 dsieger 8145:
8146: % cd /usr/pkgsrc
8147: % grep /package */*/Makefile* */*/buildlink*
8148:
1.21 snj 8149: 7. Fix paths in packages from step 5 to point to new location.
1.1 dsieger 8150:
1.21 snj 8151: 8. cvs rm (-f) the package at the old location.
1.1 dsieger 8152:
1.21 snj 8153: 9. Remove from oldcategory/Makefile.
1.1 dsieger 8154:
1.21 snj 8155: 10. Add to newcategory/Makefile.
1.1 dsieger 8156:
1.21 snj 8157: 11. Commit the changed and removed files:
1.1 dsieger 8158:
8159: % cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile
8160:
8161: (and any packages from step 5, of course).
8162:
1.154 rillig 8163: Chapter 24. Frequently Asked Questions
1.1 dsieger 8164:
8165: This section contains the answers to questions that may arise when you are
8166: writing a package. If you don't find your question answered here, first have a
8167: look in the other chapters, and if you still don't have the answer, ask on the
8168: pkgsrc-users mailing list.
8169:
1.154 rillig 8170: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
8171: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
8172: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
1.223 nia 8173: 24.4. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
8174: 24.5. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.259 leot 8175: the := inside it.
1.223 nia 8176: 24.6. Which mailing lists are there for package developers?
8177: 24.7. Where is the pkgsrc documentation?
8178: 24.8. I have a little time to kill. What shall I do?
1.1 dsieger 8179:
1.154 rillig 8180: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
1.1 dsieger 8181:
8182: MAKEFLAGS are the flags passed to the pkgsrc-internal invocations of make
1.223 nia 8183: (1).
8184:
8185: MAKE_FLAGS are the flags that are passed to the MAKE_PROGRAM when
8186: building the package.
8187:
8188: .MAKEFLAGS is an internal variable of bmake and should not be used by
8189: packages.
1.1 dsieger 8190:
1.154 rillig 8191: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
1.1 dsieger 8192:
8193: MAKE is the path to the make(1) program that is used in the pkgsrc
1.223 nia 8194: infrastructure.
8195:
8196: GMAKE is the path to GNU Make, but you need to say USE_TOOLS+=gmake to
8197: use that.
8198:
8199: MAKE_PROGRAM is the path to the Make program that is used for building
8200: the package.
1.1 dsieger 8201:
1.154 rillig 8202: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
1.1 dsieger 8203:
8204: CC is the path to the real C compiler, which can be configured by the
1.223 nia 8205: pkgsrc user.
1.1 dsieger 8206:
1.223 nia 8207: PKG_CC is the path to the compiler wrapper.
1.1 dsieger 8208:
1.223 nia 8209: PKGSRC_COMPILER is not a path to a compiler, but the type of compiler
8210: that should be used. See mk/compiler.mk for more information about the
8211: latter variable.
1.1 dsieger 8212:
1.223 nia 8213: 24.4. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
1.1 dsieger 8214:
1.25 wiz 8215: For optimization reasons, some variables are only available in the "
8216: wrapper" phase and later. To "simulate" the wrapper phase, append
1.1 dsieger 8217: PKG_PHASE=wrapper to the above command.
8218:
1.223 nia 8219: 24.5. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.1 dsieger 8220: the := inside it.
8221:
1.223 nia 8222: The := is not an assignment operator, even though it may look like one.
1.108 rillig 8223: Instead, it is a degenerate form of ${LIST:old_string=new_string}, which
8224: is documented in the make(1) man page and which is commonly used in the
8225: form ${SRCS:.c=.o}. In the case of MASTER_SITE_*, old_string is the empty
8226: string and new_string is package/. That's where the : and the = fall
8227: together.
1.1 dsieger 8228:
1.223 nia 8229: 24.6. Which mailing lists are there for package developers?
1.1 dsieger 8230:
8231: tech-pkg
8232:
8233: This is a list for technical discussions related to pkgsrc
8234: development, e.g. soliciting feedback for changes to pkgsrc
8235: infrastructure, proposed new features, questions related to porting
8236: pkgsrc to a new platform, advice for maintaining a package, patches
8237: that affect many packages, help requests moved from pkgsrc-users when
8238: an infrastructure bug is found, etc.
8239:
8240: pkgsrc-bugs
8241:
8242: All bug reports in category "pkg" sent with send-pr(1) appear here.
8243: Please do not report your bugs here directly; use one of the other
8244: mailing lists.
1.259 leot 8245:
1.223 nia 8246: 24.7. Where is the pkgsrc documentation?
1.1 dsieger 8247:
8248: There are many places where you can find documentation about pkgsrc:
8249:
8250: * The pkgsrc guide (this document) is a collection of chapters that
8251: explain large parts of pkgsrc, but some chapters tend to be outdated.
8252: Which ones they are is hard to say.
8253:
1.174 leot 8254: * On the mailing list archives (see https://mail-index.NetBSD.org/),
8255: you can find discussions about certain features, announcements of new
1.1 dsieger 8256: parts of the pkgsrc infrastructure and sometimes even announcements
8257: that a certain feature has been marked as obsolete. The benefit here
8258: is that each message has a date appended to it.
8259:
8260: * Many of the files in the mk/ directory start with a comment that
8261: describes the purpose of the file and how it can be used by the
8262: pkgsrc user and package authors. An easy way to find this
8263: documentation is to run bmake help.
8264:
8265: * The CVS log messages are a rich source of information, but they tend
8266: to be highly abbreviated, especially for actions that occur often.
8267: Some contain a detailed description of what has changed, but they are
8268: geared towards the other pkgsrc developers, not towards an average
8269: pkgsrc user. They also only document changes, so if you don't know
8270: what has been before, these messages may not be worth too much to
8271: you.
8272:
8273: * Some parts of pkgsrc are only "implicitly documented", that is the
8274: documentation exists only in the mind of the developer who wrote the
8275: code. To get this information, use the cvs annotate command to see
8276: who has written it and ask on the tech-pkg mailing list, so that
8277: others can find your questions later (see above). To be sure that the
8278: developer in charge reads the mail, you may CC him or her.
8279:
1.223 nia 8280: 24.8. I have a little time to kill. What shall I do?
1.1 dsieger 8281:
8282: This is not really an FAQ yet, but here's the answer anyway.
8283:
8284: * Run pkg_chk -N (from the pkgtools/pkg_chk package). It will tell you
8285: about newer versions of installed packages that are available, but
8286: not yet updated in pkgsrc.
8287:
1.198 leot 8288: * Browse pkgsrc/doc/TODO -- it contains a list of suggested new
8289: packages and a list of cleanups and enhancements for pkgsrc that
8290: would be nice to have.
1.1 dsieger 8291:
1.71 wiz 8292: * Review packages for which review was requested on the tech-pkg
8293: mailing list.
1.1 dsieger 8294:
8295: Part III. The pkgsrc infrastructure internals
8296:
8297: This part of the guide deals with everything from the infrastructure that is
8298: behind the interfaces described in the developer's guide. A casual package
8299: maintainer should not need anything from this part.
8300:
8301: Table of Contents
8302:
1.184 rillig 8303: 25. Design of the pkgsrc infrastructure
8304: 25.1. The meaning of variable definitions
8305: 25.2. Avoiding problems before they arise
8306: 25.3. Variable evaluation
8307: 25.3.1. At load time
8308: 25.3.2. At runtime
8309: 25.4. How can variables be specified?
8310: 25.5. Designing interfaces for Makefile fragments
8311: 25.5.1. Procedures with parameters
8312: 25.5.2. Actions taken on behalf of parameters
8313: 25.6. The order in which files are loaded
8314: 25.6.1. The order in bsd.prefs.mk
8315: 25.6.2. The order in bsd.pkg.mk
8316: 26. Regression tests
8317: 26.1. Running the regression tests
8318: 26.2. Adding a new regression test
8319: 26.2.1. Overridable functions
8320: 26.2.2. Helper functions
8321: 27. Porting pkgsrc
8322: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8323:
1.184 rillig 8324: Chapter 25. Design of the pkgsrc infrastructure
1.1 dsieger 8325:
8326: Table of Contents
8327:
1.184 rillig 8328: 25.1. The meaning of variable definitions
8329: 25.2. Avoiding problems before they arise
8330: 25.3. Variable evaluation
8331: 25.3.1. At load time
8332: 25.3.2. At runtime
8333: 25.4. How can variables be specified?
8334: 25.5. Designing interfaces for Makefile fragments
8335: 25.5.1. Procedures with parameters
8336: 25.5.2. Actions taken on behalf of parameters
8337: 25.6. The order in which files are loaded
8338: 25.6.1. The order in bsd.prefs.mk
8339: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8340:
8341: The pkgsrc infrastructure consists of many small Makefile fragments. Each such
8342: fragment needs a properly specified interface. This chapter explains how such
8343: an interface looks like.
8344:
1.184 rillig 8345: 25.1. The meaning of variable definitions
1.1 dsieger 8346:
8347: Whenever a variable is defined in the pkgsrc infrastructure, the location and
8348: the way of definition provide much information about the intended use of that
8349: variable. Additionally, more documentation may be found in a header comment or
8350: in this pkgsrc guide.
8351:
8352: A special file is mk/defaults/mk.conf, which lists all variables that are
8353: intended to be user-defined. They are either defined using the ?= operator or
8354: they are left undefined because defining them to anything would effectively
8355: mean "yes". All these variables may be overridden by the pkgsrc user in the
8356: MAKECONF file.
8357:
8358: Outside this file, the following conventions apply: Variables that are defined
8359: using the ?= operator may be overridden by a package.
8360:
8361: Variables that are defined using the = operator may be used read-only at
8362: run-time.
8363:
8364: Variables whose name starts with an underscore must not be accessed outside the
8365: pkgsrc infrastructure at all. They may change without further notice.
8366:
8367: Note
8368:
8369: These conventions are currently not applied consistently to the complete pkgsrc
8370: infrastructure.
8371:
1.184 rillig 8372: 25.2. Avoiding problems before they arise
1.1 dsieger 8373:
8374: All variables that contain lists of things should default to being empty. Two
8375: examples that do not follow this rule are USE_LANGUAGES and DISTFILES. These
8376: variables cannot simply be modified using the += operator in package Makefiles
8377: (or other files included by them), since there is no guarantee whether the
8378: variable is already set or not, and what its value is. In the case of
8379: DISTFILES, the packages "know" the default value and just define it as in the
8380: following example.
8381:
8382: DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
8383:
8384: Because of the selection of this default value, the same value appears in many
8385: package Makefiles. Similarly for USE_LANGUAGES, but in this case the default
8386: value ("c") is so short that it doesn't stand out. Nevertheless it is mentioned
8387: in many files.
8388:
1.184 rillig 8389: 25.3. Variable evaluation
1.1 dsieger 8390:
1.184 rillig 8391: 25.3.1. At load time
1.1 dsieger 8392:
8393: Variable evaluation takes place either at load time or at runtime, depending on
8394: the context in which they occur. The contexts where variables are evaluated at
8395: load time are:
8396:
8397: * The right hand side of the := and != operators,
8398:
8399: * Make directives like .if or .for,
8400:
8401: * Dependency lines.
8402:
8403: A special exception are references to the iteration variables of .for loops,
8404: which are expanded inline, no matter in which context they appear.
8405:
8406: As the values of variables may change during load time, care must be taken not
8407: to evaluate them by accident. Typical examples for variables that should not be
8408: evaluated at load time are DEPENDS and CONFIGURE_ARGS. To make the effect more
8409: clear, here is an example:
8410:
8411: CONFIGURE_ARGS= # none
8412: CFLAGS= -O
8413: CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
8414:
8415: CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
8416:
8417: CFLAGS+= -Wall
8418:
8419: This code shows how the use of the := operator can quickly lead to unexpected
8420: results. The first paragraph is fairly common code. The second paragraph
8421: evaluates the CONFIGURE_ARGS variable, which results in CFLAGS=-O. In the third
8422: paragraph, the -Wall is appended to the CFLAGS, but this addition will not
8423: appear in CONFIGURE_ARGS. In actual code, the three paragraphs from above
8424: typically occur in completely unrelated files.
8425:
1.184 rillig 8426: 25.3.2. At runtime
1.1 dsieger 8427:
8428: After all the files have been loaded, the values of the variables cannot be
8429: changed anymore. Variables that are used in the shell commands are expanded at
8430: this point.
8431:
1.184 rillig 8432: 25.4. How can variables be specified?
1.1 dsieger 8433:
8434: There are many ways in which the definition and use of a variable can be
8435: restricted in order to detect bugs and violations of the (mostly unwritten)
1.108 rillig 8436: policies. A package can be checked with pkglint -Wall to see whether it meets
8437: these rules.
1.1 dsieger 8438:
1.184 rillig 8439: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8440:
8441: Most of the .mk files fall into one of the following classes. Cases where a
8442: file falls into more than one class should be avoided as it often leads to
8443: subtle bugs.
8444:
1.184 rillig 8445: 25.5.1. Procedures with parameters
1.1 dsieger 8446:
8447: In a traditional imperative programming language some of the .mk files could be
1.198 leot 8448: described as procedures. They take some input parameters and--after
8449: inclusion--provide a result in output parameters. Since all variables in
1.23 jakllsch 8450: Makefiles have global scope care must be taken not to use parameter names that
8451: have already another meaning. For example, PKGNAME is a bad choice for a
8452: parameter name.
1.1 dsieger 8453:
8454: Procedures are completely evaluated at preprocessing time. That is, when
8455: calling a procedure all input parameters must be completely resolvable. For
8456: example, CONFIGURE_ARGS should never be an input parameter since it is very
8457: likely that further text will be added after calling the procedure, which would
8458: effectively apply the procedure to only a part of the variable. Also,
1.108 rillig 8459: references to other variables will be modified after calling the procedure.
1.1 dsieger 8460:
8461: A procedure can declare its output parameters either as suitable for use in
8462: preprocessing directives or as only available at runtime. The latter
8463: alternative is for variables that contain references to other runtime
8464: variables.
8465:
8466: Procedures shall be written such that it is possible to call the procedure more
8467: than once. That is, the file must not contain multiple-inclusion guards.
8468:
8469: Examples for procedures are mk/bsd.options.mk and mk/buildlink3/bsd.builtin.mk.
8470: To express that the parameters are evaluated at load time, they should be
8471: assigned using the := operator, which should be used only for this purpose.
8472:
1.184 rillig 8473: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8474:
8475: Action files take some input parameters and may define runtime variables. They
8476: shall not define loadtime variables. There are action files that are included
8477: implicitly by the pkgsrc infrastructure, while other must be included
8478: explicitly.
8479:
8480: An example for action files is mk/subst.mk.
8481:
1.184 rillig 8482: 25.6. The order in which files are loaded
1.1 dsieger 8483:
8484: Package Makefiles usually consist of a set of variable definitions, and include
8485: the file ../../mk/bsd.pkg.mk in the very last line. Before that, they may also
8486: include various other *.mk files if they need to query the availability of
8487: certain features like the type of compiler or the X11 implementation. Due to
8488: the heavy use of preprocessor directives like .if and .for, the order in which
8489: the files are loaded matters.
8490:
8491: This section describes at which point the various files are loaded and gives
8492: reasons for that order.
8493:
1.184 rillig 8494: 25.6.1. The order in bsd.prefs.mk
1.1 dsieger 8495:
8496: The very first action in bsd.prefs.mk is to define some essential variables
8497: like OPSYS, OS_VERSION and MACHINE_ARCH.
8498:
1.4 rillig 8499: Then, the user settings are loaded from the file specified in MAKECONF, which
8500: is usually mk.conf. After that, those variables that have not been overridden
8501: by the user are loaded from mk/defaults/mk.conf.
1.1 dsieger 8502:
8503: After the user settings, the system settings and platform settings are loaded,
8504: which may override the user settings.
8505:
8506: Then, the tool definitions are loaded. The tool wrappers are not yet in effect.
8507: This only happens when building a package, so the proper variables must be used
8508: instead of the direct tool names.
8509:
8510: As the last steps, some essential variables from the wrapper and the package
8511: system flavor are loaded, as well as the variables that have been cached in
8512: earlier phases of a package build.
8513:
1.184 rillig 8514: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8515:
8516: First, bsd.prefs.mk is loaded.
8517:
8518: Then, the various *-vars.mk files are loaded, which fill default values for
8519: those variables that have not been defined by the package. These variables may
8520: later be used even in unrelated files.
8521:
8522: Then, the file bsd.pkg.error.mk provides the target error-check that is added
8523: as a special dependency to all other targets that use DELAYED_ERROR_MSG or
8524: DELAYED_WARNING_MSG.
8525:
8526: Then, the package-specific hacks from hacks.mk are included.
8527:
8528: Then, various other files follow. Most of them don't have any dependencies on
8529: what they need to have included before or after them, though some do.
8530:
8531: The code to check PKG_FAIL_REASON and PKG_SKIP_REASON is then executed, which
8532: restricts the use of these variables to all the files that have been included
8533: before. Appearances in later files will be silently ignored.
8534:
8535: Then, the files for the main targets are included, in the order of later
8536: execution, though the actual order should not matter.
8537:
8538: At last, some more files are included that don't set any interesting variables
8539: but rather just define make targets to be executed.
8540:
1.184 rillig 8541: Chapter 26. Regression tests
1.1 dsieger 8542:
8543: Table of Contents
8544:
1.184 rillig 8545: 26.1. Running the regression tests
8546: 26.2. Adding a new regression test
8547: 26.2.1. Overridable functions
8548: 26.2.2. Helper functions
1.1 dsieger 8549:
8550: The pkgsrc infrastructure consists of a large codebase, and there are many
8551: corners where every little bit of a file is well thought out, making pkgsrc
8552: likely to fail as soon as anything is changed near those parts. To prevent most
8553: changes from breaking anything, a suite of regression tests should go along
8554: with every important part of the pkgsrc infrastructure. This chapter describes
8555: how regression tests work in pkgsrc and how you can add new tests.
8556:
1.184 rillig 8557: 26.1. Running the regression tests
1.1 dsieger 8558:
1.25 wiz 8559: You first need to install the pkgtools/pkg_regress package, which provides the
1.1 dsieger 8560: pkg_regress command. Then you can simply run that command, which will run all
1.168 rillig 8561: tests in the regress/ directory.
1.1 dsieger 8562:
1.184 rillig 8563: 26.2. Adding a new regression test
1.1 dsieger 8564:
1.168 rillig 8565: Every directory in the regress/ directory that contains a file called spec is
1.1 dsieger 8566: considered a regression test. This file is a shell program that is included by
8567: the pkg_regress command. The following functions can be overridden to suit your
8568: needs.
8569:
1.184 rillig 8570: 26.2.1. Overridable functions
1.1 dsieger 8571:
1.108 rillig 8572: These functions do not take any parameters. Although they are called in "set -e
1.168 rillig 8573: " mode, they don't stop at the first failing command. See this Stack Overflow
1.108 rillig 8574: question for details.
1.1 dsieger 8575:
1.108 rillig 8576: do_setup
1.1 dsieger 8577:
8578: This function prepares the environment for the test. By default it does
8579: nothing.
8580:
1.108 rillig 8581: do_test
1.1 dsieger 8582:
8583: This function runs the actual test. By default, it calls TEST_MAKE with the
8584: arguments MAKEARGS_TEST and writes its output including error messages into
8585: the file TEST_OUTFILE.
8586:
1.108 rillig 8587: When defining this function, make sure that all output that needs to be
8588: checked is written to the correct output file. Example:
8589:
8590: do_test() {
8591: echo "Example output"
8592: } 1>$TEST_OUTFILE 2>&1
8593:
8594: check_result
1.1 dsieger 8595:
8596: This function is run after the test and is typically used to compare the
8597: actual output from the one that is expected. It can make use of the various
1.108 rillig 8598: helper functions from the next section. Example:
8599:
8600: check_result() {
8601: exit_status 0
8602: output_require "Example"
8603: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
8604: output_prohibit "no such file or directory"
1.169 rillig 8605: regress_fail "expected $expected but got $actual for input $input"
1.108 rillig 8606: }
1.1 dsieger 8607:
1.108 rillig 8608: do_cleanup
1.1 dsieger 8609:
8610: This function cleans everything up after the test has been run. By default
8611: it does nothing.
8612:
1.184 rillig 8613: 26.2.2. Helper functions
1.1 dsieger 8614:
1.168 rillig 8615: regress_fail message...
8616:
8617: This function makes the test fail with the given error message.
8618:
1.108 rillig 8619: exit_status expected
1.1 dsieger 8620:
1.108 rillig 8621: This function compares the exitcode of the do_test function with its first
8622: parameter. If they differ, the test will fail.
1.1 dsieger 8623:
1.108 rillig 8624: output_require regex...
1.1 dsieger 8625:
8626: This function checks for each of its parameters if the output from do_test
1.108 rillig 8627: matches the extended regular expression. If it does not, the test will
8628: fail. Example:
8629:
8630: output_require "looks fine"
8631: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
1.1 dsieger 8632:
1.177 leot 8633: output_prohibit regex...
1.1 dsieger 8634:
8635: This function checks for each of its parameters if the output from do_test
8636: () does not match the extended regular expression. If any of the regular
8637: expressions matches, the test will fail.
8638:
1.184 rillig 8639: Chapter 27. Porting pkgsrc
1.1 dsieger 8640:
8641: Table of Contents
8642:
1.184 rillig 8643: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8644:
8645: The pkgsrc system has already been ported to many operating systems, hardware
8646: architectures and compilers. This chapter explains the necessary steps to make
8647: pkgsrc even more portable.
8648:
1.184 rillig 8649: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8650:
8651: To port pkgsrc to a new operating system (called MyOS in this example), you
8652: need to touch the following files:
8653:
8654: pkgtools/bootstrap-mk-files/files/mods/MyOS.sys.mk
8655:
8656: This file contains some basic definitions, for example the name of the C
8657: compiler.
8658:
8659: mk/bsd.prefs.mk
8660:
1.212 wiz 8661: Insert code that defines the variables OPSYS, OS_VERSION, OPSYS_VERSION,
1.1 dsieger 8662: LOWER_VENDOR, MACHINE_ARCH, OBJECT_FMT, APPEND_ELF, and the other variables
8663: that appear in this file.
8664:
8665: mk/platform/MyOS.mk
8666:
8667: This file contains the platform-specific definitions that are used by
8668: pkgsrc. Start by copying one of the other files and edit it to your needs.
8669:
8670: mk/tools/tools.MyOS.mk
8671:
8672: This file defines the paths to all the tools that are needed by one or the
8673: other package in pkgsrc, as well as by pkgsrc itself. Find out where these
8674: tools are on your platform and add them.
8675:
8676: Now, you should be able to build some basic packages, like lang/perl5, shells/
8677: bash.
8678:
8679: Appendix A. A simple example package: bison
8680:
8681: Table of Contents
8682:
8683: A.1. files
8684: A.1.1. Makefile
8685: A.1.2. DESCR
8686: A.1.3. PLIST
8687: A.1.4. Checking a package with pkglint
8688: A.2. Steps for building, installing, packaging
8689:
8690: We checked to find a piece of software that wasn't in the packages collection,
1.25 wiz 8691: and picked GNU bison. Quite why someone would want to have bison when Berkeley
1.1 dsieger 8692: yacc is already present in the tree is beyond us, but it's useful for the
8693: purposes of this exercise.
8694:
8695: A.1. files
8696:
8697: A.1.1. Makefile
8698:
1.2 rillig 8699: # $NetBSD$
1.1 dsieger 8700: #
8701:
8702: DISTNAME= bison-1.25
8703: CATEGORIES= devel
1.171 rillig 8704: MASTER_SITES= ${MASTER_SITE_GNU:=bison/}
1.1 dsieger 8705:
1.30 dholland 8706: MAINTAINER= pkgsrc-users@NetBSD.org
1.174 leot 8707: HOMEPAGE= https://www.gnu.org/software/bison/bison.html
1.1 dsieger 8708: COMMENT= GNU yacc clone
8709:
8710: GNU_CONFIGURE= yes
1.47 wiz 8711: INFO_FILES= yes
1.1 dsieger 8712:
8713: .include "../../mk/bsd.pkg.mk"
8714:
8715: A.1.2. DESCR
8716:
8717: GNU version of yacc. Can make re-entrant parsers, and numerous other
8718: improvements. Why you would want this when Berkeley yacc(1) is part
8719: of the NetBSD source tree is beyond me.
8720:
8721: A.1.3. PLIST
8722:
1.2 rillig 8723: @comment $NetBSD$
1.1 dsieger 8724: bin/bison
8725: man/man1/bison.1.gz
8726: share/bison.simple
8727: share/bison.hairy
8728:
8729: A.1.4. Checking a package with pkglint
8730:
8731: The NetBSD package system comes with pkgtools/pkglint which helps to check the
8732: contents of these files. After installation it is quite easy to use, just
1.171 rillig 8733: change to the directory of the package you wish to examine and run pkglint:
1.1 dsieger 8734:
8735: $ pkglint
1.171 rillig 8736: ERROR: Makefile: Each package must define its LICENSE.
8737: WARN: Makefile:9: HOMEPAGE should migrate from http to https.
8738: NOTE: PLIST:3: The .gz extension is unnecessary for manual pages.
8739: WARN: PLIST:5: "share/bison.hairy" should be sorted before "share/bison.simple".
8740: 1 error, 2 warnings and 1 note found.
8741: (Run "pkglint -e" to show explanations.)
8742: (Run "pkglint -fs" to show what can be fixed automatically.)
1.172 rillig 8743: (Run "pkglint -F" to automatically fix some issues.)
1.1 dsieger 8744:
8745: Depending on the supplied command line arguments (see pkglint(1)), more checks
1.170 rillig 8746: will be performed. Use e.g. pkglint -Wall for a very thorough check.
1.1 dsieger 8747:
8748: A.2. Steps for building, installing, packaging
8749:
8750: Create the directory where the package lives, plus any auxiliary directories:
8751:
8752: # cd /usr/pkgsrc/lang
8753: # mkdir bison
8754: # cd bison
8755: # mkdir patches
8756:
1.184 rillig 8757: Create Makefile, DESCR and PLIST (see Chapter 12, Package components - files,
1.1 dsieger 8758: directories and contents) then continue with fetching the distfile:
8759:
8760: # make fetch
8761: >> bison-1.25.tar.gz doesn't seem to exist on this system.
8762: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
8763: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8764: ftp: Error retrieving file: 500 Internal error
8765:
8766: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
8767: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8768: ftp: Error retrieving file: 500 Internal error
8769:
8770: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
8771: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8772: Successfully retrieved file.
8773:
8774: Generate the checksum of the distfile into distinfo:
8775:
8776: # make makedistinfo
8777:
8778: Now compile:
8779:
8780: # make
8781: >> Checksum OK for bison-1.25.tar.gz.
8782: ===> Extracting for bison-1.25
8783: ===> Patching for bison-1.25
8784: ===> Ignoring empty patch directory
8785: ===> Configuring for bison-1.25
8786: creating cache ./config.cache
8787: checking for gcc... cc
8788: checking whether we are using GNU C... yes
8789: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
8790: checking how to run the C preprocessor... cc -E
8791: checking for minix/config.h... no
8792: checking for POSIXized ISC... no
8793: checking whether cross-compiling... no
8794: checking for ANSI C header files... yes
8795: checking for string.h... yes
8796: checking for stdlib.h... yes
8797: checking for memory.h... yes
8798: checking for working const... yes
8799: checking for working alloca.h... no
8800: checking for alloca... yes
8801: checking for strerror... yes
8802: updating cache ./config.cache
8803: creating ./config.status
8804: creating Makefile
8805: ===> Building for bison-1.25
8806: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g LR0.c
8807: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g allocate.c
8808: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g closure.c
8809: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g conflicts.c
8810: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g derives.c
8811: cc -c -DXPFILE=\"/usr/pkg/share/bison.simple\" -DXPFILE1=\"/usr/pkg/share/bison.hairy\" -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -g ./files.c
8812: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getargs.c
8813: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g gram.c
8814: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lalr.c
8815: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lex.c
8816: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g main.c
8817: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g nullable.c
8818: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g output.c
8819: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g print.c
8820: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g reader.c
8821: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g reduce.c
8822: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g symtab.c
8823: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g warshall.c
8824: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g version.c
8825: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getopt.c
8826: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getopt1.c
8827: cc -g -o bison LR0.o allocate.o closure.o conflicts.o derives.o files.o getargs.o gram.o lalr.o lex.o main.o nullable.o output.o print.o reader.o reduce.o symtab.o warshall.o version.o getopt.o getopt1.o
8828: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
8829: rm -f bison.s1
8830: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
8831:
8832: Everything seems OK, so install the files:
8833:
8834: # make install
8835: >> Checksum OK for bison-1.25.tar.gz.
8836: ===> Installing for bison-1.25
8837: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
8838: rm -f /usr/pkg/bin/bison
8839: cd /usr/pkg/share; rm -f bison.simple bison.hairy
8840: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
8841: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
8842: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
8843: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
8844: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
8845: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
8846: ===> Registering installation for bison-1.25
8847:
8848: You can now use bison, and also - if you decide so - remove it with pkg_delete
8849: bison. Should you decide that you want a binary package, do this now:
8850:
8851: # make package
8852: >> Checksum OK for bison-1.25.tar.gz.
8853: ===> Building package for bison-1.25
8854: Creating package bison-1.25.tgz
8855: Registering depends:.
8856: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
8857:
8858: Now that you don't need the source and object files any more, clean up:
8859:
8860: # make clean
8861: ===> Cleaning for bison-1.25
8862:
1.207 leot 8863: Appendix B. Security hardening
8864:
8865: Table of Contents
8866:
8867: B.1. Mechanisms
8868: B.1.1. Enabled by default
8869: B.1.2. Not enabled by default
8870: B.2. Caveats
8871: B.2.1. Problems with PKGSRC_MKPIE
8872: B.2.2. Problems with PKGSRC_USE_FORTIFY
8873: B.2.3. Problems with PKGSRC_USE_RELRO
8874: B.2.4. Problems with PKGSRC_USE_SSP
8875: B.3. Auditing the system
8876: B.3.1. Checking for PIE
8877: B.3.2. Checking for partial RELRO
8878: B.3.3. Checking for full RELRO
8879: B.3.4. Checking for SSP
8880:
8881: A number of mechanisms are available in pkgsrc to improve the security of the
8882: resulting system. This page describes the mechanisms, and gives hints about
8883: detecting and fixing problems.
8884:
8885: Mechanisms can be enabled individually in mk.conf, and are individually
8886: described below.
8887:
8888: Typically, a feature will cause some programs to fail to build or work when
8889: first enabled. This can be due to latent problems in the program, and can be
8890: due to other reasons. After enough testing to have confidence that user
8891: problems will be quite rare, individual mechanisms will be enabled by default.
8892:
8893: For each mechanism, see the Caveats section below for an explanation of what
8894: might go wrong at compile time and at run time, and how to notice and address
8895: these problems.
8896:
8897: B.1. Mechanisms
8898:
8899: B.1.1. Enabled by default
8900:
8901: B.1.1.1. PKGSRC_USE_FORTIFY
8902:
8903: This allows substitute wrappers to be used for some commonly used library
8904: functions that do not have built-in bounds checking - but could in some cases.
8905:
8906: Two mitigation levels are available:
8907:
8908: * "weak" only enables checks at compile-time.
8909:
8910: * "strong" enables checks at compile-time and runtime.
8911:
8912: "strong" has been enabled by default since pkgsrc-2017Q3.
8913:
8914: B.1.1.2. PKGSRC_USE_SSP
8915:
8916: This enables a stack-smashing protection mitigation. It is done by adding a
8917: guard variable to functions with vulnerable objects. The guards are initialized
8918: when a function is entered and then checked when the function exits. The guard
8919: check will fail and the program forcibly exited if the variable was modified in
8920: the meantime. This can happen in case of buffer overflows or memory corruption,
8921: and therefore exposing these bugs.
8922:
8923: Different mitigation levels are available:
8924:
8925: * "yes", which will only protect functions considered vulnerable by the
8926: compiler;
8927:
8928: * "all", which will protect every function;
8929:
8930: * "strong", the default, which will apply a better balance between the two
8931: settings above.
8932:
8933: This mitigation is supported by both GCC and clang. It may be supported in
8934: additional compilers, possibly under a different name. It is particularly
8935: useful for unsafe programming languages, such as C/C++.
8936:
8937: * "yes" is enabled by default where known supported since pkgsrc-2017Q3.
8938:
8939: * "strong" is enabled by default where known supported since pkgsrc-2021Q4.
8940:
8941: More details can be found here:
8942:
8943: * Buffer overflow protection on Wikipedia
8944:
8945: B.1.1.3. PKGSRC_MKPIE
8946:
8947: This requests the creation of PIE (Position Independent Executables) for all
8948: executables. The PIE mechanism is normally used for shared libraries, so that
8949: they can be loaded at differing addresses at runtime. PIE itself does not have
8950: useful security properties; however, it is necessary to fully leverage some,
8951: such as ASLR. Some operating systems support Address Space Layout Randomization
8952: (ASLR), which causes different addresses to be used each time a program is run.
8953: This makes it more difficult for an attacker to guess addresses and thus makes
8954: exploits harder to construct. With PIE, ASLR can really be applied to the
8955: entire program, instead of the stack and heap only.
8956:
8957: PIE executables will only be built for toolchains that are known to support
8958: PIE. Currently, this means NetBSD on x86, ARM, SPARC64, m68k, and MIPS.
8959:
8960: PKGSRC_MKPIE was enabled by default after the pkgsrc-2021Q3 branch.
8961:
1.219 nia 8962: B.1.1.4. PKGSRC_USE_RELRO
1.207 leot 8963:
8964: This also makes the exploitation of some security vulnerabilities more
8965: difficult in some cases.
8966:
8967: Two different mitigation levels are available:
8968:
1.219 nia 8969: * partial (the default): the ELF sections are reordered so that internal data
8970: sections precede the program's own data sections, and non-PLT GOT is
8971: read-only;
1.207 leot 8972:
8973: * full: in addition to partial RELRO, every relocation is performed
1.218 nia 8974: immediately when starting the program, allowing the entire GOT to be
8975: read-only. This can greatly slow down startup of large programs.
1.207 leot 8976:
8977: This is currently supported by GCC. Many software distributions now enable this
1.220 nia 8978: feature by default, at the "partial" level.
1.207 leot 8979:
8980: More details can be found here:
8981:
8982: * Hardening ELF binaries using Relocation Read-Only (RELRO)
8983:
1.219 nia 8984: B.1.2. Not enabled by default
8985:
8986: B.1.2.1. PKGSRC_MKREPRO
8987:
8988: With this option, pkgsrc will try to build packages reproducibly. This allows
8989: packages built from the same tree and with the same options, to produce
8990: identical results bit by bit. This option should be combined with ASLR and
8991: PKGSRC_MKPIE to avoid predictable address offsets for attackers attempting to
8992: exploit security vulnerabilities.
8993:
8994: More details can be found here:
8995:
8996: * Reproducible Builds - a set of software development practices that create
8997: an independently-verifiable path from source to binary code
8998:
8999: More work likely needs to be done before pkgsrc is fully reproducible.
9000:
9001: B.1.2.2. PKGSRC_USE_STACK_CHECK
1.207 leot 9002:
9003: This uses -fstack-check with GCC for another stack protection mitigation.
9004:
9005: It asks the compiler to generate code verifying that it does not corrupt the
9006: stack. According to GCC's manual page, this is really only useful for
9007: multi-threaded programs.
9008:
9009: B.2. Caveats
9010:
9011: B.2.1. Problems with PKGSRC_MKPIE
9012:
9013: B.2.1.1. Packages failing to build
9014:
9015: A number of packages may fail to build with this option enabled. The failures
9016: are often related to the absence of the -fPIC compilation flag when building
9017: libraries or executables (or ideally -fPIE in the latter case). This flag is
9018: added to the CFLAGS already, but requires the package to actually support it.
9019:
9020: B.2.1.1.1. How to fix
9021:
9022: These instructions are meant as a reference only; they likely need to be
9023: adapted for many packages individually.
9024:
9025: For packages using Makefiles:
9026:
9027: MAKE_FLAGS+= CFLAGS=${CFLAGS:Q}
9028: MAKE_FLAGS+= LDFLAGS=${LDFLAGS:Q}
9029:
9030: For packages using Imakefiles:
9031:
9032: MAKE_FLAGS+= CCOPTIONS=${CFLAGS:Q}
9033: MAKE_FLAGS+= LOCAL_LDFLAGS=${LDFLAGS:Q}
9034:
9035: B.2.1.2. Run-time crashes
9036:
9037: Some programs may fail to run, or crash at random times once built as PIE. Two
9038: scenarios are essentially possible. This is nearly always due to a bug in the
9039: program being exposed due to ASLR.
9040:
9041: B.2.1.3. Disabling PKGSRC_MKPIE on a per-package basis
9042:
9043: Ideally, packages should be fixed for compatibility with MKPIE. However, in
9044: some cases this is very difficult, due to complex build systems, packages using
9045: non-standard toolchains, or programming languages with odd bootstrapping
9046: mechanisms.
9047:
9048: To disable PKGSRC_MKPIE on a per-package basis, set MKPIE_SUPPORTED= no in the
9049: package's Makefile before bsd.prefs.mk is included.
9050:
9051: B.2.2. Problems with PKGSRC_USE_FORTIFY
9052:
9053: B.2.2.1. Packages failing to build
9054:
9055: This feature makes use of pre-processing directives to look for hardened,
9056: alternative implementations of essential library calls. Some programs may fail
9057: to build as a result; this usually happens for those trying too hard to be
9058: portable, or otherwise abusing definitions in the standard library.
9059:
9060: B.2.2.2. Run-time crashes
9061:
9062: This feature may cause some programs to crash, usually indicating an actual bug
9063: in the program. The fix will typically involve patching the original program's
9064: source code.
9065:
9066: B.2.2.3. Optimization is required
9067:
9068: At least in the case of GCC, FORTIFY will only be applied if optimization is
9069: applied while compiling. This means that the CFLAGS should also contain -O, -O2
9070: or another optimization level. This cannot easily be applied globally, as some
9071: packages may require specific optimization levels.
9072:
9073: B.2.2.4. Disabling FORTIFY on a per-package basis
9074:
9075: Note
9076:
9077: FORTIFY should not be disabled to work around runtime crashes in the program!
9078: This is a very bad idea and will expose you to security vulnerabilities.
9079:
9080: To disable FORTIFY on a per-package basis, set the following in the package's
9081: Makefile before bsd.prefs.mk is included:
9082:
9083: FORTIFY_SUPPORTED= no
9084:
9085: B.2.3. Problems with PKGSRC_USE_RELRO
9086:
9087: B.2.3.1. Performance impact
9088:
9089: For better protection, full RELRO requires every symbol to be resolved when the
9090: program starts, rather than simply when required at run-time. This will have
9091: more impact on programs using a lot of symbols, or linked to libraries exposing
9092: a lot of symbols. Therefore, daemons or programs otherwise running in
9093: background are affected only when started. Programs loading plug-ins at
9094: run-time are affected when loading the plug-ins.
9095:
9096: The impact is not expected to be noticeable on modern hardware, except in some
9097: cases for big programs.
9098:
9099: B.2.3.2. Run-time crashes
9100:
9101: Some programs handle plug-ins and dependencies in a way that conflicts with
9102: RELRO: for instance, with an initialization routine listing any other plug-in
9103: required. With full RELRO, the missing symbols are resolved before the
9104: initialization routine can run, and the dynamic loader will not be able to find
9105: them directly and abort as a result. Unfortunately, this is how Xorg loads its
9106: drivers. Partial RELRO can be applied instead in this case.
9107:
9108: B.2.3.3. Disabling RELRO on a per-package basis
9109:
9110: To disable RELRO on a per-package basis, set the following in the package's
9111: Makefile before bsd.prefs.mk is included:
9112:
9113: RELRO_SUPPORTED= no
9114:
1.209 nia 9115: It is also possible to at most enable partial RELRO, by setting RELRO_SUPPORTED
9116: to partial.
9117:
1.207 leot 9118: B.2.4. Problems with PKGSRC_USE_SSP
9119:
9120: B.2.4.1. Packages failing to build
9121:
9122: The stack-smashing protection provided by this option does not work for some
9123: programs. The most common situation in which this happens is when the program
9124: allocates variables on the stack, with the size determined at run-time.
9125:
9126: B.2.4.2. Run-time crashes
9127:
9128: Again, this feature may cause some programs to crash via a SIGABRT, usually
9129: indicating an actual bug in the program.
9130:
9131: On NetBSD LOG_CRIT level syslog messages are sent and - by default - appended
9132: to /var/log/messages, e.g.:
9133:
9134: Jan 6 15:42:51 hostname -: hostname program - - - buffer overflow detected; terminated
9135:
9136: (where hostname is the hostname(1) and program is the basename(1) of the
9137: program crashed).
9138:
9139: Patching the original program is then required.
9140:
9141: Rebuilding the package via:
9142:
9143: % env CFLAGS=-g INSTALL_UNSTRIPPED=yes make replace
9144:
9145: and inspecting the backtrace of the coredump via the debugger should point out
9146: the problematic call by inspecting the frame calling the _chk() (SSP) function.
9147:
9148: B.2.4.3. Performance impact
9149:
9150: The compiler emits extra code when using this feature: a check for buffer
9151: overflows is performed when entering and exiting functions, requiring an extra
9152: variable on the stack. The level of protection can otherwise be adjusted to
9153: affect only those functions considered more sensitive by the compiler (with
9154: -fstack-protector instead of -fstack-protector-all).
9155:
9156: The impact is not expected to be noticeable on modern hardware. However,
9157: programs with a hard requirement to run at the fastest possible speed should
9158: avoid using this feature, or using libraries built with this feature.
9159:
9160: B.2.4.4. Disabling SSP on a per-package basis
9161:
9162: Note
9163:
9164: SSP should not be disabled to work around runtime crashes in the program! This
9165: is a very bad idea and will expose you to security vulnerabilities.
9166:
9167: To disable SSP on a per-package basis, set the following in the package's
9168: Makefile before bsd.prefs.mk is included:
9169:
9170: SSP_SUPPORTED= no
9171:
9172: B.3. Auditing the system
9173:
9174: The illusion of security is worse than having no security at all. This section
9175: lists a number of ways to ensure the security features requested are actually
9176: effective.
9177:
9178: These instructions were obtained and tested on a system derived from NetBSD 7
9179: (amd64). YMMV.
9180:
9181: B.3.1. Checking for PIE
9182:
9183: The ELF executable type in use changes for binaries built as PIE; without:
9184:
9185: $ file /path/to/bin/ary
9186: /path/to/bin/ary: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for NetBSD 7.0, not stripped
9187:
9188: as opposed to the following binary, built as PIE:
9189:
9190: $ file /path/to/pie/bin/ary
9191: /path/to/pie/bin/ary: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for NetBSD 7.0, not stripped
9192:
9193: The latter result is then what is expected.
9194:
9195: B.3.2. Checking for partial RELRO
9196:
9197: The following command should list a section called RELRO:
9198:
9199: $ objdump -p /path/to/bin/ary
9200:
9201: /path/to/bin/ary: file format elf64-x86-64
9202:
9203: Program Header:
9204: [...]
9205: RELRO off 0x0000000000000d78 vaddr 0x0000000000600d78 paddr 0x0000000000600d78 align 2**0
9206:
9207: This check is now performed automatically if PKG_DEVELOPER is set and RELRO is
9208: enabled.
9209:
9210: B.3.3. Checking for full RELRO
9211:
9212: The dynamic loader will apply RELRO immediately when detecting the presence of
9213: the BIND_NOW flag:
9214:
9215: $ objdump -x /path/to/bin/ary
9216:
9217: /path/to/bin/ary: file format elf64-x86-64
9218:
9219: Dynamic Section:
9220: [...]
9221: BIND_NOW 0x0000000000000000
9222:
9223: This has to be combined with partial RELRO (see above) to be fully efficient.
9224:
9225: This check is now performed automatically (where supported) if PKG_DEVELOPER is
9226: set.
9227:
9228: B.3.4. Checking for SSP
9229:
1.208 nia 9230: Note
9231:
9232: Checking for SSP using this method only works where the operating system uses
9233: libssp. libssp is not used on recent NetBSD/FreeBSD/Linux versions.
9234:
1.207 leot 9235: Building objects, binaries and libraries with SSP will affect the presence of
9236: additional symbols in the resulting file:
9237:
9238: $ nm /path/to/bin/ary
9239: [...]
9240: U __stack_chk_fail
9241: 0000000000600ea0 B __stack_chk_guard
9242:
9243: This is an indicator that the program was indeed built with support for SSP.
9244:
9245: This check is now performed automatically (where supported) if PKG_DEVELOPER is
9246: set and SSP is enabled.
9247:
9248: Appendix C. Build logs
1.1 dsieger 9249:
9250: Table of Contents
9251:
1.207 leot 9252: C.1. Building figlet
9253: C.2. Packaging figlet
1.1 dsieger 9254:
1.207 leot 9255: C.1. Building figlet
1.1 dsieger 9256:
9257: # make
9258: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9259: => figlet221.tar.gz doesn't seem to exist on this system.
9260: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
9261: => [172219 bytes]
9262: Connected to ftp.plig.net.
9263: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
9264: 331 Guest login ok, send your complete e-mail address as password.
9265: 230-You are user #5 of 500 simultaneous users allowed.
9266: 230-
9267: 230- ___ _ _ _
9268: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
9269: 230- | _| _| . |_| . | | | . |_| . | _| . |
9270: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
9271: 230- |_| |_| |___| |___|
9272: 230-
9273: 230-** Welcome to ftp.plig.org **
9274: 230-
9275: 230-Please note that all transfers from this FTP site are logged. If you
9276: 230-do not like this, please disconnect now.
9277: 230-
1.19 snj 9278: 230-This archive is available via
1.1 dsieger 9279: 230-
9280: 230-HTTP: http://ftp.plig.org/
9281: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
9282: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
9283: 230-
9284: 230-Please email comments, bug reports and requests for packages to be
9285: 230-mirrored to ftp-admin@plig.org.
9286: 230-
9287: 230-
9288: 230 Logged in anonymously.
9289: Remote system type is UNIX.
9290: Using binary mode to transfer files.
9291: 200 Type okay.
9292: 250 "/pub" is new cwd.
9293: 250-"/pub/figlet" is new cwd.
9294: 250-
9295: 250-Welcome to the figlet archive at ftp.figlet.org
9296: 250-
9297: 250- ftp://ftp.figlet.org/pub/figlet/
9298: 250-
9299: 250-The official FIGlet web page is:
9300: 250- http://www.figlet.org/
9301: 250-
9302: 250-If you have questions, please mailto:info@figlet.org. If you want to
9303: 250-contribute a font or something else, you can email us.
9304: 250
9305: 250 "/pub/figlet/program" is new cwd.
9306: 250 "/pub/figlet/program/unix" is new cwd.
9307: local: figlet221.tar.gz remote: figlet221.tar.gz
9308: 502 Unimplemented command.
9309: 227 Entering Passive Mode (195,40,6,41,246,104)
9310: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
9311: 38% |************** | 65800 64.16 KB/s 00:01 ETA
9312: 226 Transfer completed.
9313: 172219 bytes received in 00:02 (75.99 KB/s)
9314: 221 Goodbye.
9315: => Checksum OK for figlet221.tar.gz.
9316: ===> Extracting for figlet-2.2.1nb2
9317: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
9318: ===> Patching for figlet-2.2.1nb2
9319: ===> Applying pkgsrc patches for figlet-2.2.1nb2
9320: ===> Overriding tools for figlet-2.2.1nb2
9321: ===> Creating toolchain wrappers for figlet-2.2.1nb2
9322: ===> Configuring for figlet-2.2.1nb2
9323: ===> Building for figlet-2.2.1nb2
9324: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
9325: chmod a+x figlet
9326: gcc -O2 -o chkfont chkfont.c
9327: => Unwrapping files-to-be-installed.
9328: #
9329: # make install
9330: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9331: ===> Installing for figlet-2.2.1nb2
9332: install -d -o root -g wheel -m 755 /usr/pkg/bin
9333: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
9334: mkdir -p /usr/pkg/share/figlet
9335: cp figlet /usr/pkg/bin
9336: cp chkfont /usr/pkg/bin
9337: chmod 555 figlist showfigfonts
9338: cp figlist /usr/pkg/bin
9339: cp showfigfonts /usr/pkg/bin
9340: cp fonts/*.flf /usr/pkg/share/figlet
9341: cp fonts/*.flc /usr/pkg/share/figlet
9342: cp figlet.6 /usr/pkg/man/man6
9343: ===> Registering installation for figlet-2.2.1nb2
9344: #
9345:
1.207 leot 9346: C.2. Packaging figlet
1.1 dsieger 9347:
9348: # make package
9349: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9350: ===> Packaging figlet-2.2.1nb2
9351: ===> Building binary package for figlet-2.2.1nb2
9352: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
9353: Using SrcDir value of /usr/pkg
9354: Registering depends:.
9355: #
9356:
1.207 leot 9357: Appendix D. Directory layout of the pkgsrc FTP server
1.1 dsieger 9358:
9359: Table of Contents
9360:
1.207 leot 9361: D.1. distfiles: The distributed source files
9362: D.2. misc: Miscellaneous things
9363: D.3. packages: Binary packages
9364: D.4. reports: Bulk build reports
9365: D.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 9366:
9367: As in other big projects, the directory layout of pkgsrc is quite complex for
9368: newbies. This chapter explains where you find things on the FTP server. The
9369: base directory on ftp.NetBSD.org is /pub/pkgsrc/. On other servers it may be
9370: different, but inside this directory, everything should look the same, no
9371: matter on which server you are. This directory contains some subdirectories,
9372: which are explained below.
9373:
1.207 leot 9374: D.1. distfiles: The distributed source files
1.1 dsieger 9375:
9376: The directory distfiles contains lots of archive files from all pkgsrc
9377: packages, which are mirrored here. The subdirectories are called after their
9378: package names and are used when the distributed files have names that don't
9379: explicitly contain a version number or are otherwise too generic (for example
9380: release.tar.gz).
9381:
1.207 leot 9382: D.2. misc: Miscellaneous things
1.1 dsieger 9383:
9384: This directory contains things that individual pkgsrc developers find worth
9385: publishing.
9386:
1.207 leot 9387: D.3. packages: Binary packages
1.1 dsieger 9388:
1.3 rillig 9389: This directory contains binary packages for the various platforms that are
9390: supported by pkgsrc. Each subdirectory is of the form OPSYS/ARCH/OSVERSION_TAG.
9391: The meaning of these variables is:
9392:
9393: * OPSYS is the name of the operating system for which the packages have been
1.9 rillig 9394: built. The name is taken from the output of the uname command, so it may
9395: differ from the one you are used to hear.
1.3 rillig 9396:
1.8 rillig 9397: * ARCH is the hardware architecture of the platform for which the packages
1.10 hubertf 9398: have been built. It also includes the ABI (Application Binary Interface)
9399: for platforms that have several of them.
1.3 rillig 9400:
1.255 wiz 9401: * OSVERSION is the version of the operating system. Typically it is the
9402: version defining an ABI, e.g. 9.0.
9403:
9404: * TAG is either 20YYQN for a stable branch, or current for packages built
9405: from the HEAD branch. The latter should only be used when the packages are
9406: updated on a regular basis.
9407:
9408: The rationale for this scheme is that users can first search by OPSYS and ARCH,
9409: since these are more or less unchangeable. After that, there is a management
9410: set of directories with OSVERSION and TAG.
9411:
9412: See also README.md in packages for more details, including about symlinks.
1.3 rillig 9413:
9414: In each of these directories, there is a whole binary packages collection for a
9415: specific platform. It has a directory called All which contains all binary
1.255 wiz 9416: packages.
1.1 dsieger 9417:
1.207 leot 9418: D.4. reports: Bulk build reports
1.8 rillig 9419:
9420: Here are the reports from bulk builds, for those who want to fix packages that
9421: didn't build on some of the platforms. The structure of subdirectories should
1.207 leot 9422: look like the one in Section D.3, "packages: Binary packages".
1.8 rillig 9423:
1.207 leot 9424: D.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 9425:
9426: These directories contain the "real" pkgsrc, that is the files that define how
9427: to create binary packages from source archives.
9428:
1.149 leot 9429: Each of the current, stable and pkgsrc-20xxQy directories share the same
9430: structure. They each contain a pkgsrc directory and pkgsrc.tar.{bz,gz,xz} file.
9431:
1.1 dsieger 9432: The directory pkgsrc contains a snapshot of the CVS repository, which is
1.149 leot 9433: updated regularly. The file pkgsrc.tar.{bz,gz,xz} contains the same as the
9434: directory, ready to be downloaded as a whole.
1.1 dsieger 9435:
1.149 leot 9436: The current directory contains files related to the HEAD branch of the CVS
9437: repository. In this directory there is an additional file called
9438: pkgsrc-readmes.tar.{bz,gz,xz} that contains all pkgsrc READMEs with information
9439: about categories and packages.
9440:
9441: The stable directory is a symlink to the latest pkgsrc-20xxQy.
9442:
9443: The pkgsrc-20xxQy. directories contain files related to the -20xxQy stable
9444: branch of the CVS repository. In these directories there is an additional file
9445: called pkgsrc-20xxQy.tar.{bz,gz,xz}, which contains the state of pkgsrc when it
9446: was branched.
1.148 leot 9447:
1.207 leot 9448: Appendix E. Help topics
1.154 rillig 9449:
9450: The following list contains all help topics that are available when running
9451: bmake help topic=:index.
9452:
1.260 ! wiz 9453: #! -lintl
! 9454: 32bit 64bit
! 9455: ABI ACCEPTABLE_LICENSES
! 9456: ACROREAD_FONTPATH ADDITIONAL
! 9457: AFAIK AIX
! 9458: ALLOW_NETWORK_ACCESS ALLOW_NEWER_COMPILER
! 9459: ALLOW_VULNERABLE_PACKAGES ALL_ENV
! 9460: ALSA_PC ALTERNATIVES_SRC
! 9461: AMANDA_TMP AMANDA_USER
! 9462: AMANDA_VAR APACHE_GROUP
! 9463: APACHE_MODULE_NAME APACHE_MODULE_SRC
! 9464: APACHE_MODULE_SRCDIR APACHE_PKG_PREFIX
! 9465: APACHE_SUEXEC_CONFIGURE_ARGS APACHE_SUEXEC_DOCROOT
! 9466: APACHE_USER ARGMAX_REQ
! 9467: ARG_MAX ARLA_CACHE
! 9468: AUDIT_PACKAGES_FLAGS AUTOCONF_REQD
! 9469: AUTOMAKE_OVERRIDE AUTOMAKE_REQD
! 9470: AUTO_MKDIRS AUX
! 9471: BDB185_DEFAULT BDBBASE
! 9472: BDB_ACCEPTED BDB_DEFAULT
! 9473: BDB_LIBS BDB_TYPE
! 9474: BINCIMAP_GROUP BINCIMAP_LOG_USER
! 9475: BINCIMAP_USER BIND_DIR
! 9476: BIND_GROUP BIND_USER
! 9477: BINOWN BINPKG_SITES
! 9478: BIN_INSTALL_FLAGS BISON_PKGDATADIR
! 9479: BLAS BLAS_ACCEPTED
! 9480: BLAS_C_INTERFACE BLAS_INCLUDES
! 9481: BLAS_INDEX64 BLAS_LIBS
! 9482: BLAS_PC BLAS_TYPE
! 9483: BOOTSTRAP_DEPENDS BROKEN
! 9484: BROKEN_EXCEPT_ON_PLATFORM BROKEN_ON_PLATFORM
! 9485: BSDSRCDIR BSDXSRCDIR
! 9486: BSD_MAKE_ENV BUILDLINK_AUTO_DIRS
! 9487: BUILDLINK_AUTO_VARS BUILDLINK_CFLAGS
! 9488: BUILDLINK_CONTENTS_FILTER BUILDLINK_CPPFLAGS
! 9489: BUILDLINK_DEPMETHOD BUILDLINK_FILES
! 9490: BUILDLINK_FILES_CMD BUILDLINK_FNAME_TRANSFORM
! 9491: BUILDLINK_LDFLAGS BUILDLINK_LIBS
! 9492: BUILDLINK_OPSYS_SUPPORT_PTHREAD BUILDLINK_PKGNAME
! 9493: BUILDLINK_PREFIX BUILDLINK_RPATHDIRS
! 9494: BUILDLINK_TREE BUILD_DEFS
! 9495: BUILD_DEFS_EFFECTS BUILD_DEPENDS
! 9496: BUILD_DIRS BUILD_ENV_SHELL
! 9497: BUILD_MAKE_CMD BUILD_MAKE_FLAGS
! 9498: BUILD_TARGET BUILTIN_FIND_FILES
! 9499: BUILTIN_FIND_FILES_VAR BUILTIN_FIND_GREP
! 9500: BUILTIN_FIND_HEADERS BUILTIN_FIND_HEADERS_VAR
! 9501: BUILTIN_FIND_PKGCONFIG BUILTIN_FIND_PKGCONFIG_VAR
! 9502: BUILTIN_PKG BUILTIN_TEST_CURSES_DEFINES
! 9503: BUILTIN_TEST_CURSES_FUNCS BUILTIN_VERSION_SCRIPT
! 9504: BUILTIN_X11_TYPE BUILTIN_X11_VERSION
! 9505: CACTI_GROUP CACTI_USER
! 9506: CANNA_GROUP CANNA_USER
! 9507: CAT CBLAS_LIBS
! 9508: CBLAS_PC CCACHE_BASE
! 9509: CCACHE_DIR CCACHE_LOGFILE
! 9510: CCACHE_RECACHE CC_VERSION
! 9511: CC_VERSION_STRING CDRECORD_CONF
! 9512: CDROM_PKG_URL_DIR CDROM_PKG_URL_HOST
! 9513: CHANGES CHECKOUT_DATE
! 9514: CHECK_COMPILER CHECK_FAKEHOME
! 9515: CHECK_FILES CHECK_FILES_ONLY_PREFIX
! 9516: CHECK_FILES_SKIP CHECK_FILES_STRICT
! 9517: CHECK_HEADERS CHECK_HEADERS_SKIP
! 9518: CHECK_INTERPRETER CHECK_INTERPRETER_SKIP
! 9519: CHECK_PERMS CHECK_PERMS_AUTOFIX
! 9520: CHECK_PERMS_SKIP CHECK_PIE
! 9521: CHECK_PIE_SKIP CHECK_PIE_SUPPORTED
! 9522: CHECK_PORTABILITY CHECK_PORTABILITY_EXPERIMENTAL
! 9523: CHECK_PORTABILITY_SKIP CHECK_RELRO
! 9524: CHECK_RELRO_SKIP CHECK_RELRO_SUPPORTED
! 9525: CHECK_SHLIBS CHECK_SHLIBS_SKIP
! 9526: CHECK_SHLIBS_SUPPORTED CHECK_SHLIBS_TOXIC
! 9527: CHECK_SSP CHECK_SSP_SKIP
! 9528: CHECK_SSP_SUPPORTED CHECK_STRIPPED
! 9529: CHECK_STRIPPED_SKIP CHECK_WRKREF
! 9530: CHECK_WRKREF_EXTRA_DIRS CHECK_WRKREF_SKIP
! 9531: CLAMAV_DBDIR CLAMAV_GROUP
! 9532: CLAMAV_USER CLANGBASE
! 9533: CLEANDEPENDS CLT
! 9534: CMAKE_DEPENDENCIES_REWRITE CMAKE_INSTALL_NAME_DIR
! 9535: CMAKE_INSTALL_PREFIX CMAKE_MODULE_PATH_OVERRIDE
! 9536: CMAKE_PKGSRC_BUILD_FLAGS CMAKE_PREFIX_PATH
! 9537: CMAKE_USE_GNU_INSTALL_DIRS COMMON_LISP_DOCFILES
! 9538: COMMON_LISP_EXAMPLES COMMON_LISP_EXTRAFILES
! 9539: COMMON_LISP_PACKAGES COMMON_LISP_SYSTEM
! 9540: COMPILER_RPATH_FLAG COMPILER_USE_SYMLINKS
! 9541: CONFIGURE_ARGS CONFIGURE_DIRS
! 9542: CONFIGURE_ENV CONFIGURE_ENV_SHELL
! 9543: CONFIGURE_HAS_INFODIR CONFIGURE_HAS_MANDIR
! 9544: CONFIGURE_SCRIPT CONFIG_SHELL
! 9545: CONFIG_SHELL_FLAGS CONF_FILES
! 9546: CONF_FILES_MODE CONF_FILES_PERMS
! 9547: CONSERVER_DEFAULTHOST CONSERVER_DEFAULTPORT
! 9548: CP CPE
! 9549: CPE_EDITION CPE_LANG
! 9550: CPE_OTHER CPE_PART
! 9551: CPE_PRODUCT CPE_SW_EDITION
! 9552: CPE_TARGET_HW CPE_TARGET_SW
! 9553: CPE_UPDATE CPE_URI
! 9554: CPE_VENDOR CPE_VERSION
! 9555: CPP CPP_PRECOMP_FLAGS
! 9556: CREATE_WRKDIR_SYMLINK CROSSBASE
! 9557: CTFCONVERT CTF_FILES_SKIP
! 9558: CTF_SUPPORTED CTYPE
! 9559: CUPS_GROUP CUPS_SYSTEM_GROUPS
! 9560: CUPS_USER CURSES_DEFAULT
! 9561: CURSES_TYPE CVS_EXTRACTDIR
! 9562: CVS_MODULE CVS_PROJECT
! 9563: CVS_REPOSITORIES CVS_ROOT
! 9564: CVS_ROOT_GNU CVS_ROOT_NONGNU
! 9565: CVS_ROOT_SOURCEFORGE CVS_TAG
! 9566: CXX CYRUS_GROUP
! 9567: CYRUS_IDLE CYRUS_USER
! 9568: DAEMONTOOLS_GROUP DAEMONTOOLS_LOG_USER
! 9569: DARWIN_NO_SYSTEM_LIBS DARWIN_REQUIRES_FILTER
! 9570: DBUS_GROUP DBUS_USER
! 9571: DEFANG_GROUP DEFANG_USER
! 9572: DEFAULT_ACCEPTABLE_LICENSES DEFAULT_DISTFILES
! 9573: DEFAULT_IRC_SERVER DEFAULT_SERIAL_DEVICE
! 9574: DEF_UMASK DEINSTALLDEPENDS
! 9575: DEINSTALL_SRC DEINSTALL_TEMPLATES
! 9576: DELAYED_ERROR_MSG DELAYED_WARNING_MSG
! 9577: DEPENDS DEPENDS_TARGET
! 9578: DEPENDS_TYPE DESTDIR
! 9579: DESTDIR_VARNAME DIALER_GROUP
! 9580: DIGEST_REQD DISTDIR
! 9581: DISTFILES DISTINFO_FILE
! 9582: DISTNAME DIST_PATH
! 9583: DIST_SUBDIR DJBDNS_AXFR_USER
! 9584: DJBDNS_CACHE_USER DJBDNS_DJBDNS_GROUP
! 9585: DJBDNS_LOG_USER DJBDNS_RBL_USER
! 9586: DJBDNS_TINY_USER DLOPEN_REQUIRE_PTHREADS
! 9587: DL_AUTO_VARS DL_CFLAGS
! 9588: DL_LDFLAGS DL_LIBS
! 9589: DNS DOCOWN
! 9590: DOWNLOADED_DISTFILE DQCACHE_GROUP
! 9591: DQCACHE_USER DT_LAYOUT
! 9592: DYNAMIC_SITES_CMD DYNAMIC_SITES_SCRIPT
! 9593: ECHO ECHO_N
! 9594: ELK_GUI EMACS_TYPE
! 9595: EMULDIR EMULSUBDIR
! 9596: EMULSUBDIRSLASH EMUL_ARCH
! 9597: EMUL_DISTRO EMUL_EXEC_FMT
! 9598: EMUL_IS_NATIVE EMUL_MODULES
! 9599: EMUL_OPSYS EMUL_PKG_FMT
! 9600: EMUL_PLATFORM EMUL_PLATFORMS
! 9601: EMUL_PREFER EMUL_REQD
! 9602: EMUL_TYPE ERROR_MSG
! 9603: EXIM_GROUP EXIM_USER
! 9604: EXPORT_SYMBOLS_LDFLAGS EXTRACTOR
! 9605: EXTRACT_CMD EXTRACT_CMD_DEFAULT
! 9606: EXTRACT_DIR EXTRACT_ELEMENTS
! 9607: EXTRACT_ENV EXTRACT_ONLY
! 9608: EXTRACT_OPTS EXTRACT_SUFX
! 9609: EXTRACT_USING FAIL
! 9610: FAILOVER_FETCH FAIL_MSG
! 9611: FAKE_NCURSES FAM
! 9612: FAM_ACCEPTED FAM_DEFAULT
! 9613: FAM_SERVER FCPATH
! 9614: FETCH_AFTER_ARGS FETCH_BEFORE_ARGS
! 9615: FETCH_CMD FETCH_INSECURE
! 9616: FETCH_OUTPUT_ARGS FETCH_PROXY
! 9617: FETCH_RESUME_ARGS FETCH_TIMEOUT
! 9618: FETCH_USE_IPV4_ONLY FETCH_USING
! 9619: FILES_SUBST FILES_SUBST_SED
! 9620: FIX_SYSTEM_HEADERS FONTDIR
! 9621: FONTS_DIRS FONTS_VERBOSE
! 9622: FOO_HACKS_MK FORCE_CXX_STD
! 9623: FORCE_C_STD FOSSIL_EXTRACTDIR
! 9624: FOSSIL_REPO FOSSIL_REPOSITORIES
! 9625: FOSSIL_VERSION FOX_USE_XUNICODE
! 9626: FREEWNN_GROUP FREEWNN_USER
! 9627: FTP_PKG_URL_DIR FTP_PKG_URL_HOST
! 9628: GAMEDATAMODE GAMEDATA_PERMS
! 9629: GAMEDIRMODE GAMEDIR_PERMS
! 9630: GAMEGRP GAMEMODE
! 9631: GAMEOWN GAMES_GROUP
! 9632: GAMES_USER GCC
! 9633: GCCBASE GCC_REQD
! 9634: GCC_VERSION_SUFFIX GEM_BUILD
! 9635: GEM_CLEANBUILD GEM_CLEANBUILD_EXTENSIONS
! 9636: GEM_DOCDIR GEM_EXTSDIR
! 9637: GEM_HOME GEM_KEEPBUILD
! 9638: GEM_LIBDIR GEM_NAME
! 9639: GEM_PATH GEM_PLUGINSDIR
! 9640: GEM_SPECFILE GENERATE_PLIST
! 9641: GHC GHOSTSCRIPT_REQD
! 9642: GITHUB_PROJECT GITHUB_RELEASE
! 9643: GITHUB_SUBMODULES GITHUB_TAG
! 9644: GITHUB_TYPE GITLAB_PROJECT
! 9645: GITLAB_RELEASE GITLAB_SUBMODULES
! 9646: GITLAB_TAG GITLAB_TYPE
! 9647: GIT_BRANCH GIT_ENV
! 9648: GIT_EXTRACTDIR GIT_REPO
! 9649: GIT_REPOSITORIES GIT_REVISION
! 9650: GIT_TAG GNU
! 9651: GNU_CONFIGURE GNU_CONFIGURE_ICONV
! 9652: GNU_CONFIGURE_INFODIR GNU_CONFIGURE_MANDIR
! 9653: GNU_CONFIGURE_QUIET GNU_CONFIGURE_STRICT
! 9654: GODEP_REDIRECTS GO_BUILD_PATTERN
! 9655: GO_DEPS GO_DIST_BASE
! 9656: GO_EXTRA_MOD_DIRS GO_MODULE_EXTRACT
! 9657: GO_MODULE_FILES GO_SRCPATH
! 9658: GROUP_SPECIFIC_PKGS GRUB_NETWORK_CARDS
! 9659: GRUB_PRESET_COMMAND GRUB_SCAN_ARGS
! 9660: GZIP HASKELL_COMPILER
! 9661: HASKELL_DISABLE_EXECUTABLES HASKELL_DISABLE_LIBRARIES
! 9662: HASKELL_ENABLE_DYNAMIC_EXECUTABLE HASKELL_ENABLE_HADDOCK_DOCUMENTATION
! 9663: HASKELL_ENABLE_LIBRARY_PROFILING HASKELL_ENABLE_SHARED_LIBRARY
! 9664: HASKELL_ENABLE_TESTS HASKELL_OPTIMIZATION_LEVEL
! 9665: HASKELL_PKG_NAME HASKELL_UNRESTRICT_DEPENDENCIES
! 9666: HEADER_TEMPLATES HG_REPO
! 9667: HG_REPOSITORIES HG_TAG
! 9668: HOMEPAGE HOST_PKGTOOLS_ARGS
! 9669: HOST_SPECIFIC_PKGS HOWL_GROUP
! 9670: HOWL_USER ICCBASE
! 9671: ICECAST_CHROOTDIR ICON_THEMES
! 9672: IDOBASE IGNORE_CCACHE
! 9673: IGNORE_INFO_DIRS IGNORE_INTERACTIVE_FETCH
! 9674: IMAKE IMAKEOPTS
! 9675: IMAKE_MAKE IMAKE_MANINSTALL
! 9676: IMAP_UW_CCLIENT_MBOX_FMT IMDICTDIR
! 9677: INCOMPAT_CURSES INFO_DIR
! 9678: INFO_FILES INFO_MSG
! 9679: INIT_SYSTEM INN_DATA_DIR
! 9680: INN_GROUP INN_USER
! 9681: INSTALLATION_DIRS INSTALLATION_DIRS_FROM_PLIST
! 9682: INSTALL_ENV INSTALL_ENV_SHELL
! 9683: INSTALL_SH_OVERRIDE INSTALL_SRC
! 9684: INSTALL_TEMPLATES INSTALL_UNSTRIPPED
! 9685: IRCD_HYBRID_IRC_GROUP IRCD_HYBRID_IRC_USER
! 9686: IRCD_HYBRID_MAXCONN IRCD_HYBRID_NICLEN
! 9687: IRCD_HYBRID_SYSLOG_EVENTS IRCD_HYBRID_SYSLOG_FACILITY
! 9688: IRCD_HYBRID_TOPICLEN IRIX
! 9689: IRRD_USE_PGP JABBERD_GROUP
! 9690: JABBERD_LOGDIR JABBERD_PIDDIR
! 9691: JABBERD_SPOOLDIR JABBERD_USER
! 9692: JAVA_APP_PATH JAVA_APP_TARGETS
! 9693: JAVA_BINPREFIX JAVA_CLASSPATH
! 9694: JAVA_HOME JAVA_LD_LIBRARY_PATH
! 9695: JAVA_NAME JAVA_UNLIMIT
! 9696: JAVA_WRAPPERS JPEG_ACCEPTED
! 9697: JPEG_DEFAULT KERBEROS
! 9698: KERMIT_SUID_UUCP KJS_USE_PCRE
! 9699: KNEWS_DOMAIN_FILE KNEWS_DOMAIN_NAME
! 9700: KRB5_ACCEPTED KRB5_DEFAULT
! 9701: LANGUAGES LAPACKE_LIBS
! 9702: LAPACKE_PC LAPACK_LIBS
! 9703: LAPACK_PC LATEX2HTML_ICONPATH
! 9704: LDCONFIG_ADD_CMD LDCONFIG_REMOVE_CMD
! 9705: LDD LEAFNODE_DATA_DIR
! 9706: LEAFNODE_GROUP LEAFNODE_USER
! 9707: LIBDVDCSS_HOMEPAGE LIBDVDCSS_MASTER_SITES
! 9708: LIBIMAGEQUANT_TYPE LIBRSVG_TYPE
! 9709: LIBTOOL LIBTOOLIZE_PLIST
! 9710: LIBTOOL_M4_OVERRIDE LIBUSB_TYPE
! 9711: LICENSE LINKER_RPATH_FLAG
! 9712: LINK_RPATH_FLAG LINUX_BASE_NODEPS
! 9713: LINUX_BASE_PREFERRED LINUX_BASE_REQUIRED
! 9714: LINUX_LOCALES LOCALBASE
! 9715: LOCALBASE_LOCKTYPE LOCALPATCHES
! 9716: LOVE_DATA LOVE_GAME
! 9717: LOVE_VERSION LOWER_OPSYS
! 9718: LOWER_OPSYS_VERSUFFIX LOWER_VARIANT_VERSION
! 9719: LOWER_VENDOR LP32PLATFORMS
! 9720: LP64PLATFORMS LUA_BUSTED_ARGS
! 9721: LUA_CDIR LUA_COMPILER
! 9722: LUA_DOCDIR LUA_EXAMPLESDIR
! 9723: LUA_INCDIR LUA_INTERPRETER
! 9724: LUA_LDIR LUA_LINKER_MAGIC
! 9725: LUA_PKGPREFIX LUA_SELF_CONFLICT
! 9726: LUA_USE_BUSTED LUA_VERSIONS_ACCEPTED
! 9727: LUA_VERSIONS_INCOMPATIBLE LUA_VERSION_DEFAULT
! 9728: LUA_VERSION_REQD Lua
! 9729: MACHINE_PLATFORM MAILAGENT_DOMAIN
! 9730: MAILAGENT_EMAIL MAILAGENT_FQDN
! 9731: MAILAGENT_ORGANIZATION MAJORDOMO_HOMEDIR
! 9732: MAJOR_OS_VERSION MAKEINFO_ARGS
! 9733: MAKE_DIRS MAKE_DIRS_PERMS
! 9734: MAKE_ENV MAKE_FILE
! 9735: MAKE_FLAGS MAKE_JOBS
! 9736: MAKE_JOBS_SAFE MAKE_PROGRAM
! 9737: MANCOMPRESSED_IF_MANZ MANINSTALL
! 9738: MANZ MARIADB_VERSIONS_ALL
! 9739: MASTER_SITES MASTER_SITE_BACKUP
! 9740: MASTER_SITE_LOCAL MASTER_SITE_MOZILLA
! 9741: MASTER_SITE_OVERRIDE MASTER_SITE_PERL_CPAN
! 9742: MASTER_SORT MASTER_SORT_RANDOM
! 9743: MASTER_SORT_REGEX MECAB_CHARSET
! 9744: MEDIATOMB_GROUP MEDIATOMB_USER
! 9745: MIPSPROBASE MIREDO_GROUP
! 9746: MIREDO_USER MISSING_FEATURES
! 9747: MKDIR MKPIE_SUPPORTED
! 9748: MLDONKEY_GROUP MLDONKEY_HOME
! 9749: MLDONKEY_USER MONOTONE_GROUP
! 9750: MONOTONE_USER MOTIFBASE
! 9751: MOTIF_TYPE MOTIF_TYPE_DEFAULT
! 9752: MPI_TYPE MSGFMT_STRIP_MSGCTXT
! 9753: MSGFMT_STRIP_MSGID_PLURAL MTOOLS_ENABLE_FLOPPYD
! 9754: MUST MV
! 9755: MYSQL_CHARSET MYSQL_DATADIR
! 9756: MYSQL_EXTRA_CHARSET MYSQL_GROUP
! 9757: MYSQL_USER MYSQL_VERSION
! 9758: MYSQL_VERSIONS_ACCEPTED MYSQL_VERSION_DEFAULT
! 9759: NAGIOSCMD_GROUP NAGIOSDIR
! 9760: NAGIOS_GROUP NAGIOS_USER
! 9761: NATIVE_EXEC_FMT NATIVE_LOWER_OPSYS
! 9762: NATIVE_LOWER_VENDOR NATIVE_MACHINE_PLATFORM
! 9763: NATIVE_OBJECT_FMT NATIVE_OPSYS_VERSION
! 9764: NATIVE_OS_VARIANT NATIVE_OS_VERSION
! 9765: NBPAX_PROGRAM_PREFIX NETBSD_LOGIN_NAME
! 9766: NMH_EDITOR NMH_MTA
! 9767: NMH_PAGER NODE_VERSIONS_ACCEPTED
! 9768: NODE_VERSIONS_INCOMPATIBLE NODE_VERSION_DEFAULT
! 9769: NODE_VERSION_REQD NOLOGIN
! 9770: NOTE NOT_FOR_PLATFORM
! 9771: NOT_PAX_ASLR_SAFE NOT_PAX_MPROTECT_SAFE
! 9772: NO_BUILD NO_CHECKSUM
! 9773: NO_CONFIGURE NO_SKIP
! 9774: NSD_GROUP NSD_LOG_FACILITY
! 9775: NSD_USER NS_PREFERRED
! 9776: NULLMAILER_GROUP NULLMAILER_USER
! 9777: OBJECT_FMT OBJHOSTNAME
! 9778: OBJMACHINE OCAML_FINDLIB_DIRS
! 9779: OCAML_FINDLIB_REGISTER OCAML_FINDLIB_REGISTER_VERBOSE
! 9780: OCAML_SITELIBDIR OMF
! 9781: ONLY_FOR_COMPILER ONLY_FOR_PLATFORM
! 9782: OPENSSH_CHROOT OPENSSH_GROUP
! 9783: OPENSSH_USER OPSYS
! 9784: OPSYS_EMULDIR OPSYS_VERSION
! 9785: OS OSS_TYPE
! 9786: OSX OSX_PATH_TO_M4
! 9787: OSX_PATH_TO_YACC OS_HAVE_ALSA
! 9788: OS_HAVE_RCD OS_VARIANT
! 9789: OS_VERSION OTF_FONTS_DIR
! 9790: OVERRIDE_DIRDEPTH OVERRIDE_GEMSPEC
! 9791: OVERRIDE_GNU_CONFIG_SCRIPTS OVERRIDE_ROCKSPEC
! 9792: OWN_DIRS OWN_DIRS_PERMS
! 9793: P4GROUP P4PORT
! 9794: P4ROOT P4USER
! 9795: PACKAGES PALMOS_DEFAULT_SDK
! 9796: PAMBASE PAM_DEFAULT
! 9797: PAPERSIZE PASSIVE_FETCH
! 9798: PATCHDIR PATCHFILES
! 9799: PATCH_ARGS PATCH_DEBUG
! 9800: PATCH_DIST_ARGS PATCH_DIST_CAT
! 9801: PATCH_DIST_STRIP PATCH_FUZZ_FACTOR
! 9802: PATCH_STRIP PATH
! 9803: PCCBASE PEAR
! 9804: PEAR_CHANNEL PEAR_CHANNEL_ALIAS
! 9805: PEAR_CHANNEL_VERSION PEAR_CMD
! 9806: PEAR_LIB PEAR_PACKAGE_XML
! 9807: PEP-518 PERL5
! 9808: PERL5_CONFIGURE PERL5_CONFIGURE_DIRS
! 9809: PERL5_LDFLAGS PERL5_LICENSE
! 9810: PERL5_MODULE_TYPE PERL5_PACKLIST
! 9811: PERL5_PACKLIST_DIR PERL5_PERLBASE
! 9812: PERL5_SITEBASE PERL5_USE_PACKLIST
! 9813: PERL5_VENDORBASE PFCTL
! 9814: PFVAR_H PF_VERSION
! 9815: PGGROUP PGHOME
! 9816: PGPKGSRCDIR PGSQL_TYPE
! 9817: PGSQL_VERSION PGSQL_VERSIONS_ACCEPTED
! 9818: PGSQL_VERSION_DEFAULT PGUSER
! 9819: PG_LIB_EXT PHP
! 9820: PHPCOMMON_MK PHPPKGSRCDIR
! 9821: PHP_BASE_VERS PHP_EGDIR
! 9822: PHP_EXTENSION_DIR PHP_INCDIR
! 9823: PHP_LIBDIR PHP_MAJOR_VERS
! 9824: PHP_MINIMUM_TEENY PHP_MINOR_VERS
! 9825: PHP_PKG_PREFIX PHP_SHAREDIR
! 9826: PHP_VER PHP_VERSION
! 9827: PHP_VERSIONS_ACCEPTED PHP_VERSIONS_INCOMPATIBLE
! 9828: PHP_VERSION_DEFAULT PHP_VERSION_REQD
! 9829: PILRC_USE_GTK PKGCONFIG_BASE
! 9830: PKGCONFIG_FILE PKGCONFIG_OVERRIDE
! 9831: PKGCONFIG_OVERRIDE_STAGE PKGDIR
! 9832: PKGGNUDIR PKGINFODIR
! 9833: PKGLOCALEDIR PKGMANDIR
! 9834: PKGNAME PKGNAME_REQD
! 9835: PKGPATH PKGREVISION
! 9836: PKGSRC_BLAS_TYPES PKGSRC_CHANGES
! 9837: PKGSRC_COMPILER PKGSRC_KEEP_BIN_PKGS
! 9838: PKGSRC_LOCKTYPE PKGSRC_MAKE_ENV
! 9839: PKGSRC_MESSAGE_RECIPIENTS PKGSRC_MKPIE
! 9840: PKGSRC_MKREPRO PKGSRC_OVERRIDE_MKPIE
! 9841: PKGSRC_RUN_TEST PKGSRC_SETENV
! 9842: PKGSRC_SLEEPSECS PKGSRC_TODO
! 9843: PKGSRC_USE_CTF PKGSRC_USE_FORTIFY
! 9844: PKGSRC_USE_MKTOOLS PKGSRC_USE_RELRO
! 9845: PKGSRC_USE_SSP PKGSRC_USE_STACK_CHECK
! 9846: PKGTASKS_DATAFILE PKGTOOLS_ARGS
! 9847: PKGTOOLS_ENV PKG_ALTERNATIVES
! 9848: PKG_APACHE PKG_APACHE_ACCEPTED
! 9849: PKG_APACHE_DEFAULT PKG_BEST_EXISTS
! 9850: PKG_BUILD_OPTIONS PKG_COMPRESSION
! 9851: PKG_CONFIG PKG_CONFIG_PERMS
! 9852: PKG_CREATE_USERGROUP PKG_DBDIR
! 9853: PKG_DB_TMPDIR PKG_DEBUG_LEVEL
! 9854: PKG_DEFAULT_OPTIONS PKG_DESTDIR_SUPPORT
! 9855: PKG_DEVELOPER PKG_DISABLED_OPTIONS
! 9856: PKG_FATAL_ERRORS PKG_FC
! 9857: PKG_FILELIST_CMD PKG_GECOS
! 9858: PKG_GID PKG_GROUPS
! 9859: PKG_GROUPS_VARS PKG_HOME
! 9860: PKG_INIT_SCRIPTS PKG_JAVA_HOME
! 9861: PKG_JVM PKG_JVMS_ACCEPTED
! 9862: PKG_JVM_DEFAULT PKG_LEGACY_OPTIONS
! 9863: PKG_LIBTOOL PKG_MKSYMLINKS
! 9864: PKG_OPTIONS PKG_OPTIONS_DEPRECATED_WARNINGS
! 9865: PKG_OPTIONS_LEGACY_OPTS PKG_OPTIONS_LEGACY_VARS
! 9866: PKG_OPTIONS_NONEMPTY_SETS PKG_OPTIONS_OPTIONAL_GROUPS
! 9867: PKG_OPTIONS_REQUIRED_GROUPS PKG_OPTIONS_VAR
! 9868: PKG_RCD_SCRIPTS PKG_REFCOUNT_DBDIR
! 9869: PKG_REGISTER_SHELLS PKG_RESUME_TRANSFERS
! 9870: PKG_SHELL PKG_SUGGESTED_OPTIONS
! 9871: PKG_SUPPORTED_OPTIONS PKG_SYSCONFBASE
! 9872: PKG_SYSCONFBASEDIR PKG_SYSCONFDIR
! 9873: PKG_SYSCONFDIR_PERMS PKG_SYSCONFSUBDIR
! 9874: PKG_SYSCONFVAR PKG_TOOLS_BIN
! 9875: PKG_UID PKG_UPDATE_FONTS_DB
! 9876: PKG_USERS PKG_USERS_VARS
! 9877: PKG_VERBOSE PLEASE
! 9878: PLIST PLIST_AWK
! 9879: PLIST_AWK_ENV PLIST_SRC
! 9880: PLIST_SUBST PLIST_TYPE
! 9881: PLIST_VARS POPTOP_USE_MPPE
! 9882: POSSIBLE_GFORTRAN_VERSION POST_FETCH_HOOK
! 9883: PREFER PREFER_NATIVE
! 9884: PREFER_NATIVE_PTHREADS PREFER_PKGSRC
! 9885: PREFIX PREPEND_PATH
! 9886: PRE_ROOT_CMD PRIVILEGED_STAGES
! 9887: PS PTHREAD_AUTO_VARS
! 9888: PTHREAD_CFLAGS PTHREAD_LDFLAGS
! 9889: PTHREAD_LIBS PTHREAD_OPTS
! 9890: PTHREAD_TYPE PVM_SSH
! 9891: PYPKGPREFIX PYTHON_FOR_BUILD_ONLY
! 9892: PYTHON_SELF_CONFLICT PYTHON_VERSION
! 9893: PYTHON_VERSIONED_DEPENDENCIES PYTHON_VERSIONS_ACCEPTED
! 9894: PYTHON_VERSIONS_INCOMPATIBLE PYTHON_VERSION_DEFAULT
! 9895: PYTHON_VERSION_REQD PYVERSSUFFIX
! 9896: QMAILDIR QMAIL_ALIAS_USER
! 9897: QMAIL_DAEMON_USER QMAIL_LOG_USER
! 9898: QMAIL_NOFILES_GROUP QMAIL_PASSWD_USER
! 9899: QMAIL_QMAIL_GROUP QMAIL_QUEUE_DIR
! 9900: QMAIL_QUEUE_EXTRA QMAIL_QUEUE_USER
! 9901: QMAIL_REMOTE_USER QMAIL_ROOT_USER
! 9902: QMAIL_SEND_USER QORE_LATEST_MODULE_API
! 9903: QORE_MODULE_API QORE_MODULE_DIR
! 9904: QORE_USER_MODULE_DIR QORE_VERSION
! 9905: QPOPPER_FAC QPOPPER_SPOOL_DIR
! 9906: QPOPPER_USER RAKE_NAME
! 9907: RASMOL_DEPTH RCD_DIR
! 9908: RCD_ORDER RCD_SCRIPTS
! 9909: RCD_SCRIPTS_DIR RCD_SCRIPTS_EXAMPLEDIR
! 9910: RCD_SCRIPTS_MODE RCD_SCRIPTS_SHELL
! 9911: RCD_SCRIPT_SRC RCD_SUBR
! 9912: RDOC READLINE_DEFAULT
! 9913: READLINE_TYPE REAL_ROOT_GROUP
! 9914: REAL_ROOT_USER RECURSIVE_MAKE
! 9915: RELAY_CTRL_DIR RELRO_SUPPORTED
! 9916: REPLACE_AWK REPLACE_BASH
! 9917: REPLACE_CSH REPLACE_KSH
! 9918: REPLACE_LUA REPLACE_NODEJS
! 9919: REPLACE_OCTAVE REPLACE_PERL
! 9920: REPLACE_PERL6 REPLACE_PHP
! 9921: REPLACE_PYTHON REPLACE_QORE
! 9922: REPLACE_R REPLACE_RUBY
! 9923: REPLACE_RUBY_DIRS REPLACE_RUBY_PAT
! 9924: REPLACE_SH REPLACE_TEXLUA
! 9925: REPLACE_TOOL_PYTHON REPLACE_WISH
! 9926: REQD_DIRS REQD_DIRS_PERMS
! 9927: REQD_FILES REQD_FILES_MODE
! 9928: REQD_FILES_PERMS RESOLV_AUTO_VARS
! 9929: RESOLV_LDFLAGS RESOLV_LIBS
! 9930: RM ROCKSPEC_NAME
! 9931: ROCKSPEC_SPECFILE ROOT_CMD
! 9932: ROOT_GROUP ROOT_USER
! 9933: RPCGEN RPM
! 9934: RPM2PKG_PLIST RPM2PKG_PREFIX
! 9935: RPM2PKG_STAGE RPM2PKG_STRIP
! 9936: RPM2PKG_SUBPREFIX RPMFILES
! 9937: RPMIGNOREPATH RPM_DB_PREFIX
! 9938: RSSH_CVS_PATH RSSH_RDIST_PATH
! 9939: RSSH_RSYNC_PATH RSSH_SCP_PATH
! 9940: RSSH_SFTP_SERVER_PATH RUBY
! 9941: RUBYGEM RUBYGEM_MANPAGES
! 9942: RUBYGEM_NAME RUBYGEM_OPTIONS
! 9943: RUBYGEM_USE_MANPAGES RUBYGEM_VERBOSE
! 9944: RUBY_ABI_VERSION RUBY_ARCH
! 9945: RUBY_ARCHINC RUBY_ARCHLIB
! 9946: RUBY_BASE RUBY_BASERIDIR
! 9947: RUBY_BUILD_DOCUMENT RUBY_DLEXT
! 9948: RUBY_DOC RUBY_DYNAMIC_DIRS
! 9949: RUBY_EG RUBY_ENCODING_ARG
! 9950: RUBY_EXTCONF RUBY_EXTCONF_CHECK
! 9951: RUBY_EXTCONF_DEBUG RUBY_EXTCONF_MAKEFILE
! 9952: RUBY_GEM_ARCH RUBY_GEM_BASE
! 9953: RUBY_INC RUBY_LIB
! 9954: RUBY_LIB_BASE RUBY_NAME
! 9955: RUBY_NOVERSION RUBY_PKGPREFIX
! 9956: RUBY_RAILS RUBY_RAILS61_VERSION
! 9957: RUBY_RAILS70_VERSION RUBY_RAILS71_VERSION
! 9958: RUBY_RAILS72_VERSION RUBY_RAILS80_VERSION
! 9959: RUBY_RAILS_ACCEPTED RUBY_RAILS_DEFAULT
! 9960: RUBY_RAILS_REQD RUBY_RAILS_STRICT_DEP
! 9961: RUBY_RIDIR RUBY_SETUP
! 9962: RUBY_SHLIB RUBY_SHLIBALIAS
! 9963: RUBY_SHLIBVER RUBY_SIMPLE_INSTALL
! 9964: RUBY_SITEARCHLIB RUBY_SITELIB
! 9965: RUBY_SITELIB_BASE RUBY_SITERIDIR
! 9966: RUBY_SLEXT RUBY_SRCDIR
! 9967: RUBY_STATICLIB RUBY_SUFFIX
! 9968: RUBY_SYSRIDIR RUBY_USE_PTHREAD
! 9969: RUBY_VENDORARCHLIB RUBY_VENDORLIB
! 9970: RUBY_VENDORLIB_BASE RUBY_VER
! 9971: RUBY_VERSION RUBY_VERSIONS_ACCEPTED
! 9972: RUBY_VERSIONS_INCOMPATIBLE RUBY_VERSION_DEFAULT
! 9973: RUBY_VERSION_REQD RUBY_VER_DIR
! 9974: RUN RUN_LDCONFIG
! 9975: RUST_TYPE SCO
! 9976: SCREWS_GROUP SCREWS_USER
! 9977: SCRIPTS_ENV SCROLLKEEPER_DATADIR
! 9978: SCROLLKEEPER_REBUILDDB SCROLLKEEPER_UPDATEDB
! 9979: SDIST_PAWD SDL12_TYPE
! 9980: SERIAL_DEVICES SETGIDGAME
! 9981: SETGID_GAMES_PERMS SETUID_ROOT_PERMS
! 9982: SH SHLIB
! 9983: SHORTNAME SIGN_PACKAGES
! 9984: SILC_CLIENT_WITH_PERL SITE_SPECIFIC_PKGS
! 9985: SKIP_DEPENDS SMF_INSTANCES
! 9986: SMF_MANIFEST SMF_METHODS
! 9987: SMF_METHOD_SHELL SMF_METHOD_SRC
! 9988: SMF_NAME SMF_PREFIX
! 9989: SMF_SRCDIR SNIPROXY_GROUP
! 9990: SNIPROXY_USER SOURCE_BUFFSIZE
! 9991: SPECIAL_PERMS SPECIFIC_PKGS
! 9992: SSH_SUID SSLCERTBUNDLE
! 9993: SSLCERTS SSLDIR
! 9994: SSLKEYS SSP_SUPPORTED
! 9995: SSYNC_PAWD STEP_MSG
! 9996: STRIP STRIP_DBG
! 9997: STRIP_DEBUG STRIP_DEBUG_SUPPORTED
! 9998: STRIP_FILES_SKIP SU
! 9999: SUBDIR SUBST
! 10000: SUBST_CLASSES SUBST_FILES
! 10001: SUBST_FILTER_CMD SUBST_MESSAGE
! 10002: SUBST_NOOP_OK SUBST_SED
! 10003: SUBST_SHOW_DIFF SUBST_SKIP_TEXT_CHECK
! 10004: SUBST_STAGE SUBST_VARS
! 10005: SUNWSPROBASE SUSE_PREFER
! 10006: SU_CMD SVN_EXTRACTDIR
! 10007: SVN_REPO SVN_REPOSITORIES
! 10008: SVN_REVISION SYSCONFBASE
! 10009: TARGET_MACHINE_ARCH TBL
! 10010: TERMCAP_TYPE TERMINFO_DEFAULT
! 10011: TERMINFO_TYPE TEST
! 10012: TEST_DEPENDS TEST_DIRS
! 10013: TEST_ENV TEST_ENV_SHELL
! 10014: TEST_MAKE_CMD TEST_MAKE_FLAGS
! 10015: TEST_TARGET TEXLIVE_IGNORE_PATTERNS
! 10016: TEXLIVE_REV TEXLIVE_UNVERSIONED
! 10017: TEXMFSITE TEX_FORMATS
! 10018: TEX_HYPHEN_DAT TEX_HYPHEN_DEF
! 10019: TEX_TEXMF_DIRS THTTPD_LOG_FACILITY
! 10020: TINYDYN_USER TLS
! 10021: TLSWRAPPER_CHROOT TO
! 10022: TOOLDIR TOOLS_ALIASES
! 10023: TOOLS_ALWAYS_WRAP TOOLS_ARGS
! 10024: TOOLS_BROKEN TOOLS_CMD
! 10025: TOOLS_CMDLINE_SED TOOLS_CREATE
! 10026: TOOLS_CROSS_DESTDIR TOOLS_DIR
! 10027: TOOLS_FAIL TOOLS_GNU_MISSING
! 10028: TOOLS_LDCONFIG TOOLS_NOOP
! 10029: TOOLS_PATH TOOLS_SCRIPT
! 10030: TOOLS_USE_CROSS_COMPILE TOOL_DEPENDS
! 10031: TTF_FONTDIR TTF_FONTS_DIR
! 10032: TYPE UAC_REQD_EXECS
! 10033: UCSPI_SSL_GROUP UCSPI_SSL_USER
! 10034: UNBOUND_GROUP UNBOUND_LOG_FACILITY
! 10035: UNBOUND_USER UNLIMIT_RESOURCES
! 10036: UNPRIVILEGED UNPRIVILEGED_GROUP
! 10037: UNPRIVILEGED_GROUPS UNPRIVILEGED_USER
! 10038: UNWRAP_FILES UNWRAP_PATTERNS
! 10039: UPDATE_GEMSPEC UPDATE_TARGET
! 10040: URI USERGROUP_PHASE
! 10041: USERPPP_GROUP USER_SPECIFIC_PKGS
! 10042: USE_ABI_DEPENDS USE_APR
! 10043: USE_BSD_MAKEFILE USE_BUILTIN
! 10044: USE_CC_FEATURES USE_CROSS_COMPILE
! 10045: USE_CURSES USE_CWRAPPERS
! 10046: USE_CXX_FEATURES USE_DB185
! 10047: USE_FEATURES USE_GAMESGROUP
! 10048: USE_GCC_RUNTIME USE_IMAKE
! 10049: USE_INDIRECT_DEPENDS USE_JAVA
! 10050: USE_JAVA2 USE_LANGUAGES
! 10051: USE_LIBTOOL USE_NATIVE_GCC
! 10052: USE_NETBSD_REPO USE_PKGSRC_GCC
! 10053: USE_PKGSRC_GCC_RUNTIME USE_PKGTASKS
! 10054: USE_PKG_ADMIN_DIGEST USE_RUBY_EXTCONF
! 10055: USE_RUBY_INSTALL USE_RUBY_SETUP
! 10056: USE_RUBY_SETUP_PKG USE_TMPFILES
! 10057: USE_TOOLS UUCP_GROUP
! 10058: UUCP_USER VARBASE
! 10059: VARNAME VIM_EXTRA_OPTS
! 10060: WARNING_MSG WCALC_CGIDIR
! 10061: WCALC_CGIPATH WCALC_HTMLDIR
! 10062: WCALC_HTMLPATH WDM_MANAGERS
! 10063: WRAPPER_CC WRAPPER_REORDER_CMDS
! 10064: WRKDIR WRKDIR_BASENAME
! 10065: WRKDIR_LOCKTYPE WRKLOG
! 10066: WRKOBJDIR WRKSRC
! 10067: X10_PORT X11
! 10068: X11BASE X11_PKGSRCDIR
! 10069: X11_TYPE X509_CERTIFICATE
! 10070: X509_KEY XAW_TYPE
! 10071: XLOCK_DEFAULT_MODE XMKMF
! 10072: XMKMF_FLAGS XXX
! 10073: XXXX YES
! 10074: ZSH_STATIC __stdc__
! 10075: _vargroups accept
! 10076: acquire-localbase-lock acquire-lock
! 10077: add added
! 10078: administrator alloca
! 10079: alternatives aslr
! 10080: asprintf atlas
! 10081: autoconf automake
! 10082: autoreconf awk
! 10083: bash big-endian
! 10084: bin-install bind
! 10085: binpkg-list blas
! 10086: bootstrap-depends broken
! 10087: broken_on_platform bsd
! 10088: bsd.prog.mk build
! 10089: build-env buildlink-directories
! 10090: buildlink-oss-soundcard-h built-in
! 10091: builtin c
! 10092: c++ ccache
! 10093: cce cdefs
! 10094: ceil changes
! 10095: changes-entry changes-entry-noupdate
! 10096: check check-clean
! 10097: check-files check-files-clean
! 10098: check-hackage check-vulnerable
! 10099: checksum checksum-phase
! 10100: clean clean-depends
! 10101: cleandir commit
! 10102: commit-changes-entry compact
! 10103: compiler conf
! 10104: config.guess config.sub
! 10105: configuration configure
! 10106: configure-env configure-help
! 10107: configure_args connect
! 10108: cos cpe
! 10109: cputime create-usergroup
! 10110: csh ctf
! 10111: cvs debug
! 10112: declaration declare
! 10113: defined depend
! 10114: dependencies depends
! 10115: depends-checksum depends-fetch
! 10116: deps describe
! 10117: destdir disable
! 10118: distclean distfiles
! 10119: distinfo dl
! 10120: dlopen do-buildlink
! 10121: do-clean do-configure
! 10122: do-configure-post-hook do-extract
! 10123: do-fetch do-install
! 10124: download emul
! 10125: emul-distinfo emul-fetch
! 10126: emulation emulator
! 10127: enable endian
! 10128: endif enomem
! 10129: ensurepip err
! 10130: errx etc
! 10131: exp extract-rpm
! 10132: fabs feature
! 10133: features fetch
! 10134: fetch-list follows
! 10135: forbids form
! 10136: format fortify
! 10137: fortify_source fossil
! 10138: friend fts
! 10139: fts_close fts_open
! 10140: fts_read fts_set
! 10141: gcc gethostbyaddr
! 10142: gethostbyname gethostbyname2
! 10143: getopt_long getprogname
! 10144: getservbyname getservbyport
! 10145: getservent gettext
! 10146: git github
! 10147: gitlab glob
! 10148: gnu gnu_configure_strict
! 10149: go go-deps
! 10150: golang guess-license
! 10151: hashbang heimdal
! 10152: help hg
! 10153: imake in-tree
! 10154: increment indirect
! 10155: inet_aton install
! 10156: install-env interp
! 10157: interpreter intl
! 10158: ip4 ip6
! 10159: ipv4 ipv6
! 10160: iso kerberos
! 10161: krb krb5
! 10162: ksh lapack
! 10163: latex libiconv
! 10164: libintl_bindtextdomain libintl_gettext
! 10165: libintl_textdomain libnbcompat
! 10166: libs libtool
! 10167: licence license
! 10168: lintl little-endian
! 10169: lock locking
! 10170: lua lvalue
! 10171: machine_endian make
! 10172: makedistinfo makepatchsum
! 10173: makesum mdi
! 10174: memory mercurial
! 10175: meta meta-package
! 10176: meta_package mit-krb5
! 10177: mk.conf mkl
! 10178: mount move
! 10179: moved mprotect
! 10180: mps mremap
! 10181: native nb
! 10182: nbcompat netlib
! 10183: network node
! 10184: node.js nodejs
! 10185: obstack obstack_ptr_grow
! 10186: occurs only
! 10187: openblas options
! 10188: options.mk order
! 10189: override override-intltool
! 10190: override-message-intltool package
! 10191: parallel path
! 10192: pax paxctl
! 10193: pbulk-index pc
! 10194: perl perl5
! 10195: perms php
! 10196: pkg-build-options pkg-config
! 10197: pkg_build_options pkgsrc
! 10198: platform plist
! 10199: post-extract post-fetch
! 10200: post-wrapper pre-build-checks-hook
! 10201: pre-configure-checks-hook pre-extract
! 10202: pre-fetch print-go-deps
! 10203: print-plist print-summary-data
! 10204: privileged-install-hook pypi
! 10205: python r
! 10206: readme-all recursive
! 10207: recv recvfrom
! 10208: regcomp release-localbase-lock
! 10209: release-lock relro
! 10210: remove removed
! 10211: rename renamed
! 10212: reorder replace
! 10213: replace_interpreter reproducible
! 10214: resolv root
! 10215: ruby send
! 10216: sendfile sendto
! 10217: setenv setgid
! 10218: setprogname setuid
! 10219: sh shebang
! 10220: show show-all
! 10221: show-build-defs show-depends
! 10222: show-depends-dirs show-depends-pkgpaths
! 10223: show-depends-recursive show-deps
! 10224: show-distfiles show-downlevel
! 10225: show-subdir-var show-tools
! 10226: show-var show-vars
! 10227: snprintf socket
! 10228: ssp st_mode
! 10229: stage-install strcasestr
! 10230: strict strip
! 10231: strndup strnlen
! 10232: strsep subst
! 10233: substitutions subversion
! 10234: sun sunpro
! 10235: sunwspro svn
! 10236: symlink test
! 10237: test-env tex
! 10238: texlive tmp
! 10239: todo tool
! 10240: tools tools-libtool-m4-override
! 10241: transitive type
! 10242: ulimit undefined
! 10243: undo-replace unlimit
! 10244: unprivileged unprivileged-install-hook
! 10245: unstripped update
! 10246: updated upload
! 10247: upload-distfiles use_tools
! 10248: user utimes
! 10249: vasprintf verbose
! 10250: vsnprintf warn
! 10251: warning warnings
! 10252: warnx wattr_off
! 10253: wattr_on work
! 10254: wrapper wrkdir
1.154 rillig 10255:
1.207 leot 10256: Appendix F. Editing guidelines for the pkgsrc guide
1.1 dsieger 10257:
10258: Table of Contents
10259:
1.207 leot 10260: F.1. Make targets
10261: F.2. Procedure
1.1 dsieger 10262:
10263: This section contains information on editing the pkgsrc guide itself.
10264:
1.207 leot 10265: F.1. Make targets
1.1 dsieger 10266:
10267: The pkgsrc guide's source code is stored in pkgsrc/doc/guide/files, and several
10268: files are created from it:
10269:
10270: * pkgsrc/doc/pkgsrc.txt
10271:
10272: * pkgsrc/doc/pkgsrc.html
10273:
1.174 leot 10274: * https://www.NetBSD.org/docs/pkgsrc/
1.1 dsieger 10275:
1.174 leot 10276: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.pdf: The PDF version of the
10277: pkgsrc guide.
1.1 dsieger 10278:
1.174 leot 10279: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.ps: PostScript version of the
1.2 rillig 10280: pkgsrc guide.
1.1 dsieger 10281:
1.207 leot 10282: F.2. Procedure
1.1 dsieger 10283:
10284: The procedure to edit the pkgsrc guide is:
10285:
1.190 bacon 10286: 1. Make sure you have checked out the htdocs repository into a sibling
10287: directory of your pkgsrc directory. You will need the ability to commit
10288: from both pkgsrc and htdocs.
10289:
10290: 2. Make sure you have the packages needed to regenerate the pkgsrc guide (and
1.46 obache 10291: other XML-based NetBSD documentation) installed. These are automatically
10292: installed when you install the meta-pkgs/pkgsrc-guide-tools package.
1.1 dsieger 10293:
1.190 bacon 10294: 3. Run cd doc/guide to get to the right directory. All further steps will take
1.1 dsieger 10295: place here.
10296:
1.190 bacon 10297: 4. Edit the XML file(s) in files/.
1.1 dsieger 10298:
1.190 bacon 10299: 5. Run bmake to check the pkgsrc guide for valid XML and to build the final
1.1 dsieger 10300: output files. If you get any errors at this stage, you can just edit the
10301: files, as there are only symbolic links in the working directory, pointing
10302: to the files in files/.
10303:
1.190 bacon 10304: 6. (cd files && cvs commit)
1.1 dsieger 10305:
1.190 bacon 10306: 7. Run bmake clean && bmake to regenerate the output files with the proper RCS
1.1 dsieger 10307: Ids.
10308:
1.190 bacon 10309: 8. Run bmake regen to install and commit the files in both pkgsrc/doc and
1.1 dsieger 10310: htdocs.
10311:
10312: Note
10313:
10314: If you have added, removed or renamed some chapters, you need to
10315: synchronize them using cvs add or cvs delete in the htdocs directory.
10316:
CVSweb <webmaster@jp.NetBSD.org>