Annotation of htdocs/docs/pkgsrc/pkgsrc.txt, revision 1.239
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.231 jnemeth 15: Copyright 1994-2023 The NetBSD Foundation, Inc
1.1 dsieger 16:
1.231 jnemeth 17: $NetBSD: pkgsrc.xml,v 1.42 2023/01/02 05:45:23 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.232 gutterid 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
68: 6.3. Variables affecting the installation process
69: 6.4. Selecting and configuring the compiler
70: 6.4.1. Selecting the compiler
71: 6.4.2. Additional flags to the compiler (CFLAGS)
72: 6.4.3. Additional flags to the linker (LDFLAGS)
73: 6.5. Developer/advanced settings
74: 6.6. Selecting Build Options
75: 7. Creating binary packages
76: 7.1. Building a single binary package
77: 7.2. Settings for creation of binary packages
78: 8. Creating binary packages for everything in pkgsrc (bulk builds)
79: 8.1. Preparations
1.180 rillig 80: 8.2. Running a bulk build
1.154 rillig 81: 8.2.1. Configuration
82: 8.3. Requirements of a full bulk build
1.178 rillig 83: 8.4. Bulk build variants
1.179 rillig 84: 8.4.1. Detect unknown configure options
85: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 86: 8.4.3. Force compiler options only in the build phase
87: 8.4.4. Use custom directories
88: 8.4.5. Turn warnings into errors
89: 8.4.6. Reject packages for which pkglint reports errors
90: 8.4.7. Reject packages that contain forbidden strings
91: 8.4.8. Reject packages whose self-test fails
92: 8.4.9. Reject packages that use undefined shell variables
93: 8.4.10. Turn off verbose logging
1.178 rillig 94: 8.5. Creating a multiple CD-ROM packages collection
95: 8.5.1. Example of cdpack
1.154 rillig 96: 9. Directory layout of the installed files
97: 9.1. File system layout in ${LOCALBASE}
98: 9.2. File system layout in ${VARBASE}
99: 10. Frequently Asked Questions
100: 10.1. Are there any mailing lists for pkg-related discussion?
101: 10.2. Utilities for package management (pkgtools)
102: 10.3. How to use pkgsrc as non-root
103: 10.4. How to resume transfers when fetching distfiles?
104: 10.5. How can I install/use modular X.org from pkgsrc?
105: 10.6. How to fetch files from behind a firewall
106: 10.7. How to fetch files from HTTPS sites
107: 10.8. How do I tell make fetch to do passive FTP?
108: 10.9. How to fetch all distfiles at once
109: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc"
1.232 gutterid 110: mean?
1.154 rillig 111: 10.11. What does "Could not find bsd.own.mk" mean?
1.221 nia 112: 10.12. Using 'sudo' or `priv` with pkgsrc
1.154 rillig 113: 10.13. How do I change the location of configuration files?
114: 10.14. Automated security checks
115: 10.15. Why do some packages ignore my CFLAGS?
116: 10.16. A package does not build. What shall I do?
117: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/???
1.232 gutterid 118: merge conflicts" mean?
1.1 dsieger 119: II. The pkgsrc developer's guide
1.154 rillig 120: 11. Getting help
1.184 rillig 121: 12. Package components - files, directories and contents
122: 12.1. Makefile
123: 12.2. distinfo
124: 12.3. patches/*
125: 12.3.1. Structure of a single patch file
126: 12.3.2. Creating patch files
127: 12.3.3. Sources where the patch files come from
128: 12.3.4. Patching guidelines
129: 12.3.5. Feedback to the author
130: 12.4. Other mandatory files
131: 12.5. Optional files
132: 12.5.1. Files affecting the binary package
133: 12.5.2. Files affecting the build process
134: 12.5.3. Files affecting nothing at all
135: 12.6. work*
136: 12.7. files/*
137: 13. The build process
138: 13.1. Introduction
139: 13.2. Program location
140: 13.3. Directories used during the build process
141: 13.4. Running a phase
142: 13.5. The fetch phase
143: 13.5.1. What to fetch and where to get it from
144: 13.5.2. How are the files fetched?
145: 13.6. The checksum phase
146: 13.7. The extract phase
147: 13.8. The patch phase
148: 13.9. The tools phase
149: 13.10. The wrapper phase
150: 13.11. The configure phase
151: 13.12. The build phase
152: 13.13. The test phase
153: 13.14. The install phase
154: 13.15. The package phase
155: 13.16. Cleaning up
156: 13.17. Other helpful targets
157: 14. Creating a new pkgsrc package from scratch
158: 14.1. Common types of packages
1.219 nia 159: 14.1.1. Python modules and programs
160: 14.1.2. R packages
161: 14.1.3. TeXlive packages
1.184 rillig 162: 14.2. Examples
163: 14.2.1. How the www/nvu package came into pkgsrc
164: 15. Programming in Makefiles
165: 15.1. Caveats
166: 15.2. Makefile variables
167: 15.2.1. Naming conventions
168: 15.3. Code snippets
169: 15.3.1. Adding things to a list
170: 15.3.2. Echoing a string exactly as-is
171: 15.3.3. Passing CFLAGS to GNU configure scripts
172: 15.3.4. Handling possibly empty variables
1.229 gutterid 173: 15.3.5. Testing yes/no variables in conditions
1.184 rillig 174: 16. Options handling
175: 16.1. Global default options
176: 16.2. Converting packages to use bsd.options.mk
177: 16.3. Option Names
178: 16.4. Determining the options of dependencies
179: 17. Tools needed for building or running
180: 17.1. Tools for pkgsrc builds
181: 17.2. Tools needed by packages
182: 17.3. Tools provided by platforms
183: 18. Buildlink methodology
184: 18.1. Converting packages to use buildlink3
185: 18.2. Writing buildlink3.mk files
186: 18.2.1. Anatomy of a buildlink3.mk file
187: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and
1.232 gutterid 188: BUILDLINK_ABI_DEPENDS.pkg in buildlink3.mk files
1.184 rillig 189: 18.3. Writing builtin.mk files
190: 18.3.1. Anatomy of a builtin.mk file
191: 18.3.2. Global preferences for native or pkgsrc software
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.232 gutterid 231: existing package
1.154 rillig 232: 21.1.11. Substituting variable text in the package files (the SUBST
1.232 gutterid 233: framework)
1.154 rillig 234: 21.2. The fetch phase
235: 21.2.1. Packages whose distfiles aren't available for plain
1.232 gutterid 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.154 rillig 244: 21.4. Programming languages
245: 21.4.1. C, C++, and Fortran
246: 21.4.2. Java
1.205 wiz 247: 21.4.3. Go
1.223 nia 248: 21.4.4. Rust
249: 21.4.5. Packages containing Perl scripts
250: 21.4.6. Packages containing shell scripts
251: 21.4.7. Other programming languages
1.154 rillig 252: 21.5. The build phase
253: 21.5.1. Compiling C and C++ code conditionally
254: 21.5.2. How to handle compiler bugs
1.172 rillig 255: 21.5.3. No such file or directory
256: 21.5.4. Undefined reference to "..."
257: 21.5.5. Running out of memory
1.154 rillig 258: 21.6. The install phase
259: 21.6.1. Creating needed directories
260: 21.6.2. Where to install documentation
261: 21.6.3. Installing highscore files
262: 21.6.4. Adding DESTDIR support to packages
263: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 264: 21.6.6. Packages installing Perl modules
1.154 rillig 265: 21.6.7. Packages installing info files
266: 21.6.8. Packages installing man pages
1.203 nia 267: 21.6.9. Packages installing X11 fonts
268: 21.6.10. Packages installing SGML or XML data
269: 21.6.11. Packages installing extensions to the MIME database
270: 21.6.12. Packages using intltool
271: 21.6.13. Packages installing startup scripts
272: 21.6.14. Packages installing TeX modules
273: 21.6.15. Packages supporting running binaries in emulation
274: 21.6.16. Packages installing hicolor icons
275: 21.6.17. Packages installing desktop files
1.154 rillig 276: 21.7. Marking packages as having problems
1.184 rillig 277: 22. GNOME packaging and porting
278: 22.1. Meta packages
279: 22.2. Packaging a GNOME application
280: 22.3. Updating GNOME to a newer version
281: 22.4. Patching guidelines
1.154 rillig 282: 23. Submitting and Committing
283: 23.1. Submitting binary packages
284: 23.2. Submitting source packages (for non-NetBSD-developers)
285: 23.3. General notes when adding, updating, or removing packages
286: 23.4. Commit Messages
287: 23.5. Committing: Adding a package to CVS
288: 23.6. Updating a package to a newer version
289: 23.7. Renaming a package in pkgsrc
290: 23.8. Moving a package in pkgsrc
291: 24. Frequently Asked Questions
1.1 dsieger 292: III. The pkgsrc infrastructure internals
1.184 rillig 293: 25. Design of the pkgsrc infrastructure
294: 25.1. The meaning of variable definitions
295: 25.2. Avoiding problems before they arise
296: 25.3. Variable evaluation
297: 25.3.1. At load time
298: 25.3.2. At runtime
299: 25.4. How can variables be specified?
300: 25.5. Designing interfaces for Makefile fragments
301: 25.5.1. Procedures with parameters
302: 25.5.2. Actions taken on behalf of parameters
303: 25.6. The order in which files are loaded
304: 25.6.1. The order in bsd.prefs.mk
305: 25.6.2. The order in bsd.pkg.mk
306: 26. Regression tests
307: 26.1. Running the regression tests
308: 26.2. Adding a new regression test
309: 26.2.1. Overridable functions
310: 26.2.2. Helper functions
311: 27. Porting pkgsrc
312: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 313: A. A simple example package: bison
314: A.1. files
315: A.1.1. Makefile
316: A.1.2. DESCR
317: A.1.3. PLIST
318: A.1.4. Checking a package with pkglint
319: A.2. Steps for building, installing, packaging
1.207 leot 320: B. Security hardening
321: B.1. Mechanisms
322: B.1.1. Enabled by default
323: B.1.2. Not enabled by default
324: B.2. Caveats
325: B.2.1. Problems with PKGSRC_MKPIE
326: B.2.2. Problems with PKGSRC_USE_FORTIFY
327: B.2.3. Problems with PKGSRC_USE_RELRO
328: B.2.4. Problems with PKGSRC_USE_SSP
329: B.3. Auditing the system
330: B.3.1. Checking for PIE
331: B.3.2. Checking for partial RELRO
332: B.3.3. Checking for full RELRO
333: B.3.4. Checking for SSP
334: C. Build logs
335: C.1. Building figlet
336: C.2. Packaging figlet
337: D. Directory layout of the pkgsrc FTP server
338: D.1. distfiles: The distributed source files
339: D.2. misc: Miscellaneous things
340: D.3. packages: Binary packages
341: D.4. reports: Bulk build reports
342: D.5. current, stable, pkgsrc-20xxQy: source packages
343: E. Help topics
344: F. Editing guidelines for the pkgsrc guide
345: F.1. Make targets
346: F.2. Procedure
1.1 dsieger 347:
348: List of Tables
349:
350: 1.1. Platforms supported by pkgsrc
1.184 rillig 351: 12.1. Patching examples
352: 22.1. PLIST handling for GNOME packages
1.1 dsieger 353:
354: Chapter 1. What is pkgsrc?
355:
356: Table of Contents
357:
358: 1.1. Introduction
359: 1.1.1. Why pkgsrc?
360: 1.1.2. Supported platforms
361: 1.2. Overview
362: 1.3. Terminology
363: 1.3.1. Roles involved in pkgsrc
364: 1.4. Typography
365:
366: 1.1. Introduction
367:
368: There is a lot of software freely available for Unix-based systems, which is
369: usually available in form of the source code. Before such software can be used,
370: it needs to be configured to the local system, compiled and installed, and this
371: is exactly what The NetBSD Packages Collection (pkgsrc) does. pkgsrc also has
372: some basic commands to handle binary packages, so that not every user has to
373: build the packages for himself, which is a time-costly task.
374:
375: pkgsrc currently contains several thousand packages, including:
376:
1.104 sevan 377: * www/apache24 - The Apache web server
1.1 dsieger 378:
379: * www/firefox - The Firefox web browser
380:
381: * meta-pkgs/gnome - The GNOME Desktop Environment
382:
1.102 ryoon 383: * meta-pkgs/kde4 - The K Desktop Environment
1.1 dsieger 384:
1.108 rillig 385: ? just to name a few.
1.1 dsieger 386:
387: pkgsrc has built-in support for handling varying dependencies, such as pthreads
388: and X11, and extended features such as IPv6 support on a range of platforms.
389:
390: 1.1.1. Why pkgsrc?
391:
392: pkgsrc provides the following key features:
393:
394: * Easy building of software from source as well as the creation and
395: installation of binary packages. The source and latest patches are
396: retrieved from a master or mirror download site, checksum verified, then
397: built on your system. Support for binary-only distributions is available
398: for both native platforms and NetBSD emulated platforms.
399:
400: * All packages are installed in a consistent directory tree, including
401: binaries, libraries, man pages and other documentation.
402:
1.104 sevan 403: * Tracking of package dependencies automatically, including when performing
404: updates, to ensure required packages are installed. The configuration files
405: of various packages are handled automatically during updates, so local
406: changes are preserved.
1.1 dsieger 407:
408: * Like NetBSD, pkgsrc is designed with portability in mind and consists of
409: highly portable code. This allows the greatest speed of development when
1.26 spz 410: porting to a new platform. This portability also ensures that pkgsrc is
1.1 dsieger 411: consistent across all platforms.
412:
413: * The installation prefix, acceptable software licenses, international
414: encryption requirements and build-time options for a large number of
415: packages are all set in a simple, central configuration file.
416:
417: * The entire source (not including the distribution files) is freely
418: available under a BSD license, so you may extend and adapt pkgsrc to your
419: needs. Support for local packages and patches is available right out of the
420: box, so you can configure it specifically for your environment.
421:
422: The following principles are basic to pkgsrc:
423:
1.198 leot 424: * "It should only work if it's right." -- That means, if a package contains
1.1 dsieger 425: bugs, it's better to find them and to complain about them rather than to
426: just install the package and hope that it works. There are numerous checks
1.175 gutterid 427: in pkgsrc that try to find such bugs: static analysis tools (pkgtools/
1.1 dsieger 428: pkglint), build-time checks (portability of shell scripts), and
429: post-installation checks (installed files, references to shared libraries,
430: script interpreters).
431:
1.198 leot 432: * "If it works, it should work everywhere" -- Like NetBSD has been ported to
1.1 dsieger 433: many hardware architectures, pkgsrc has been ported to many operating
434: systems. Care is taken that packages behave the same on all platforms.
435:
436: 1.1.2. Supported platforms
437:
438: pkgsrc consists of both a source distribution and a binary distribution for
439: these operating systems. After retrieving the required source or binaries, you
440: can be up and running with pkgsrc in just minutes!
441:
442: pkgsrc was derived from FreeBSD's ports system, and initially developed for
443: NetBSD only. Since then, pkgsrc has grown a lot, and now supports the following
444: platforms:
445:
446: Table 1.1. Platforms supported by pkgsrc
447:
1.92 sevan 448: +-----------------------------------------------------------------------------+
1.229 gutterid 449: | Platform | Date Support | Notes |
450: | | Added | |
451: |-------------------------------------+---------------+-----------------------|
452: |NetBSD | Aug 1997 | |
453: |-------------------------------------+---------------+-----------------------|
454: |Solaris | Mar 1999 |README.Solaris |
455: |-------------------------------------+---------------+-----------------------|
456: |Linux | Jun 1999 |README.Linux |
457: |-------------------------------------+---------------+-----------------------|
458: |Darwin / Mac OS X / OS X / macOS | Oct 2001 |README.macOS |
459: |-------------------------------------+---------------+-----------------------|
460: |FreeBSD | Nov 2002 |README.FreeBSD |
461: |-------------------------------------+---------------+-----------------------|
462: |OpenBSD | Nov 2002 |README.OpenBSD |
463: |-------------------------------------+---------------+-----------------------|
464: |IRIX | Dec 2002 |README.IRIX |
465: |-------------------------------------+---------------+-----------------------|
466: |BSD/OS | Dec 2003 | |
467: |-------------------------------------+---------------+-----------------------|
468: |AIX | Dec 2003 |README.AIX |
469: |-------------------------------------+---------------+-----------------------|
470: |Interix (Microsoft Windows Services | Mar 2004 |README.Interix |
471: |for Unix) | | |
472: |-------------------------------------+---------------+-----------------------|
473: |DragonFlyBSD | Oct 2004 | |
474: |-------------------------------------+---------------+-----------------------|
475: |OSF/1 | Nov 2004 |README.OSF1 |
476: |-------------------------------------+---------------+-----------------------|
477: |HP-UX | Apr 2007 |README.HPUX |
478: |-------------------------------------+---------------+-----------------------|
479: |Haiku | Sep 2010 |README.Haiku |
480: |-------------------------------------+---------------+-----------------------|
481: |MirBSD | Jan 2011 | |
482: |-------------------------------------+---------------+-----------------------|
483: |Minix3 | Nov 2011 |README.Minix3 |
484: |-------------------------------------+---------------+-----------------------|
485: |Cygwin | Mar 2013 |README.Cygwin |
486: |-------------------------------------+---------------+-----------------------|
487: |GNU/kFreeBSD | Jul 2013 |README.GNUkFreeBSD |
488: |-------------------------------------+---------------+-----------------------|
489: |Bitrig | Jun 2014 |Removed from pkgsrc Sep|
490: | | |2022 |
1.92 sevan 491: +-----------------------------------------------------------------------------+
1.1 dsieger 492:
493:
494: 1.2. Overview
495:
496: This document is divided into three parts. The first, The pkgsrc user's guide,
497: describes how one can use one of the packages in the Package Collection, either
498: by installing a precompiled binary package, or by building one's own copy using
499: the NetBSD package system. The second part, The pkgsrc developer's guide,
500: explains how to prepare a package so it can be easily built by other NetBSD
501: users without knowing about the package's building details. The third part, The
502: pkgsrc infrastructure internals is intended for those who want to understand
503: how pkgsrc is implemented.
504:
505: This document is available in various formats: HTML, PDF, PS, TXT.
506:
507: 1.3. Terminology
508:
509: There has been a lot of talk about "ports", "packages", etc. so far. Here is a
510: description of all the terminology used within this document.
511:
512: Package
513:
514: A set of files and building instructions that describe what's necessary to
515: build a certain piece of software using pkgsrc. Packages are traditionally
1.123 wiz 516: stored under /usr/pkgsrc, but may be stored in any location, referred to as
517: PKGSRCDIR.
1.1 dsieger 518:
519: The NetBSD package system
520:
521: This is the former name of "pkgsrc". It is part of the NetBSD operating
522: system and can be bootstrapped to run on non-NetBSD operating systems as
523: well. It handles building (compiling), installing, and removing of
524: packages.
525:
526: Distfile
527:
528: This term describes the file or files that are provided by the author of
529: the piece of software to distribute his work. All the changes necessary to
530: build on NetBSD are reflected in the corresponding package. Usually the
531: distfile is in the form of a compressed tar-archive, but other types are
532: possible, too. Distfiles are usually stored below /usr/pkgsrc/distfiles.
533:
534: Port
535:
536: This is the term used by FreeBSD and OpenBSD people for what we call a
537: package. In NetBSD terminology, "port" refers to a different architecture.
538:
539: Precompiled/binary package
540:
541: A set of binaries built with pkgsrc from a distfile and stuffed together in
542: a single .tgz file so it can be installed on machines of the same machine
543: architecture without the need to recompile. Packages are usually generated
544: in /usr/pkgsrc/packages; there is also an archive on ftp.NetBSD.org.
545:
546: Sometimes, this is referred to by the term "package" too, especially in the
547: context of precompiled packages.
548:
549: Program
550:
551: The piece of software to be installed which will be constructed from all
552: the files in the distfile by the actions defined in the corresponding
553: package.
554:
555: 1.3.1. Roles involved in pkgsrc
556:
557: pkgsrc users
558:
559: The pkgsrc users are people who use the packages provided by pkgsrc.
560: Typically they are system administrators. The people using the software
561: that is inside the packages (maybe called "end users") are not covered by
562: the pkgsrc guide.
563:
564: There are two kinds of pkgsrc users: Some only want to install pre-built
565: binary packages. Others build the pkgsrc packages from source, either for
566: installing them directly or for building binary packages themselves. For
567: pkgsrc users Part I, "The pkgsrc user's guide" should provide all necessary
568: documentation.
569:
570: package maintainers
571:
572: A package maintainer creates packages as described in Part II, "The pkgsrc
573: developer's guide".
574:
575: infrastructure developers
576:
577: These people are involved in all those files that live in the mk/ directory
578: and below. Only these people should need to read through Part III, "The
579: pkgsrc infrastructure internals", though others might be curious, too.
580:
581: 1.4. Typography
582:
583: When giving examples for commands, shell prompts are used to show if the
584: command should/can be issued as root, or if "normal" user privileges are
1.115 sevan 585: sufficient. We use a # for root's shell prompt, a % for users' shell prompt,
1.229 gutterid 586: assuming they use the C-shell or tcsh and a $ for Bourne shell and derivatives.
1.1 dsieger 587:
588: Part I. The pkgsrc user's guide
589:
590: Table of Contents
591:
1.154 rillig 592: 2. Getting help
593: 3. Where to get pkgsrc and how to keep it up-to-date
594: 3.1. Getting pkgsrc for the first time
595: 3.1.1. As tar archive
596: 3.1.2. Via anonymous CVS
597: 3.2. Keeping pkgsrc up-to-date
598: 3.2.1. Via tar files
599: 3.2.2. Via CVS
600: 4. Using pkgsrc on systems other than NetBSD
601: 4.1. Binary distribution
602: 4.2. Bootstrapping pkgsrc
603: 5. Using pkgsrc
604: 5.1. Using binary packages
605: 5.1.1. Finding binary packages
606: 5.1.2. Installing binary packages
1.202 nia 607: 5.1.3. Updating packages
608: 5.1.4. Deinstalling packages
609: 5.1.5. Getting information about installed packages
610: 5.1.6. Checking for security vulnerabilities in installed packages
611: 5.1.7. Finding if newer versions of your installed packages are in
1.232 gutterid 612: pkgsrc
1.202 nia 613: 5.1.8. Other administrative functions
1.154 rillig 614: 5.2. Building packages from source
615: 5.2.1. Requirements
616: 5.2.2. Fetching distfiles
617: 5.2.3. How to build and install
618: 6. Configuring pkgsrc
619: 6.1. General configuration
620: 6.2. Variables affecting the build process
621: 6.3. Variables affecting the installation process
622: 6.4. Selecting and configuring the compiler
623: 6.4.1. Selecting the compiler
624: 6.4.2. Additional flags to the compiler (CFLAGS)
625: 6.4.3. Additional flags to the linker (LDFLAGS)
626: 6.5. Developer/advanced settings
627: 6.6. Selecting Build Options
628: 7. Creating binary packages
629: 7.1. Building a single binary package
630: 7.2. Settings for creation of binary packages
631: 8. Creating binary packages for everything in pkgsrc (bulk builds)
632: 8.1. Preparations
1.180 rillig 633: 8.2. Running a bulk build
1.154 rillig 634: 8.2.1. Configuration
635: 8.3. Requirements of a full bulk build
1.178 rillig 636: 8.4. Bulk build variants
1.179 rillig 637: 8.4.1. Detect unknown configure options
638: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 639: 8.4.3. Force compiler options only in the build phase
640: 8.4.4. Use custom directories
641: 8.4.5. Turn warnings into errors
642: 8.4.6. Reject packages for which pkglint reports errors
643: 8.4.7. Reject packages that contain forbidden strings
644: 8.4.8. Reject packages whose self-test fails
645: 8.4.9. Reject packages that use undefined shell variables
646: 8.4.10. Turn off verbose logging
1.178 rillig 647: 8.5. Creating a multiple CD-ROM packages collection
648: 8.5.1. Example of cdpack
1.154 rillig 649: 9. Directory layout of the installed files
650: 9.1. File system layout in ${LOCALBASE}
651: 9.2. File system layout in ${VARBASE}
652: 10. Frequently Asked Questions
653: 10.1. Are there any mailing lists for pkg-related discussion?
654: 10.2. Utilities for package management (pkgtools)
655: 10.3. How to use pkgsrc as non-root
656: 10.4. How to resume transfers when fetching distfiles?
657: 10.5. How can I install/use modular X.org from pkgsrc?
658: 10.6. How to fetch files from behind a firewall
659: 10.7. How to fetch files from HTTPS sites
660: 10.8. How do I tell make fetch to do passive FTP?
661: 10.9. How to fetch all distfiles at once
662: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
663: 10.11. What does "Could not find bsd.own.mk" mean?
1.221 nia 664: 10.12. Using 'sudo' or `priv` with pkgsrc
1.154 rillig 665: 10.13. How do I change the location of configuration files?
666: 10.14. Automated security checks
667: 10.15. Why do some packages ignore my CFLAGS?
668: 10.16. A package does not build. What shall I do?
669: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.232 gutterid 670: conflicts" mean?
1.1 dsieger 671:
1.154 rillig 672: Chapter 2. Getting help
673:
674: To get help when using pkgsrc, the definitive source is this document, the
675: pkgsrc guide. If you don't find anything here, there are alternatives:
676:
677: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
678: Run bmake help topic=? to get help for any topic, such as a variable name
679: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
680: like strcasecmp or any other topic.
681:
1.207 leot 682: The available help topics are listed in Appendix E, Help topics.
1.154 rillig 683:
1.163 rillig 684: * To see the value of a single variable, run bmake show-var VARNAME=X.
685:
686: * To see the values of the most common variables, run bmake show-all. These
687: variables are grouped by topic. To see the variables for a single topic,
688: run bmake show-all-topic, for example bmake show-all-fetch.
689:
1.154 rillig 690: * The pkgsrc-users mailing list, to which you can subscribe and then ask your
691: questions.
692:
693: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
694: a specialized chat program such as XChat. Pick any user name and join the
695: channel #pkgsrc.
696:
697: Chapter 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 698:
699: Table of Contents
700:
1.154 rillig 701: 3.1. Getting pkgsrc for the first time
702: 3.1.1. As tar archive
703: 3.1.2. Via anonymous CVS
704: 3.2. Keeping pkgsrc up-to-date
705: 3.2.1. Via tar files
706: 3.2.2. Via CVS
1.1 dsieger 707:
708: Before you download and extract the files, you need to decide where you want to
709: extract them. When using pkgsrc as root user, pkgsrc is usually installed in /
710: usr/pkgsrc. You are though free to install the sources and binary packages
711: wherever you want in your filesystem, provided that the pathname does not
712: contain white-space or other characters that are interpreted specially by the
713: shell and some other programs. A safe bet is to use only letters, digits,
714: underscores and dashes.
715:
1.154 rillig 716: 3.1. Getting pkgsrc for the first time
1.1 dsieger 717:
1.25 wiz 718: Before you download any pkgsrc files, you should decide whether you want the
1.1 dsieger 719: current branch or the stable branch. The latter is forked on a quarterly basis
720: from the current branch and only gets modified for security updates. The names
721: of the stable branches are built from the year and the quarter, for example
1.214 leot 722: 2021Q4.
1.1 dsieger 723:
724: The second step is to decide how you want to download pkgsrc. You can get it as
1.24 wiz 725: a tar file or via CVS. Both ways are described here.
1.1 dsieger 726:
1.52 asau 727: Note that tar archive contains CVS working copy. Thus you can switch to using
728: CVS at any later time.
1.1 dsieger 729:
1.154 rillig 730: 3.1.1. As tar archive
1.52 asau 731:
1.151 sevan 732: The primary download location for all pkgsrc files is https://cdn.NetBSD.org/
733: pub/pkgsrc/ or ftp://ftp.NetBSD.org/pub/pkgsrc/ (it points to the same
734: location). There are a number of subdirectories for different purposes, which
1.207 leot 735: are described in detail in Appendix D, Directory layout of the pkgsrc FTP
1.151 sevan 736: server.
1.1 dsieger 737:
1.52 asau 738: The tar archive for the current branch is in the directory current and is
1.118 sevan 739: called pkgsrc.tar.gz. It is autogenerated weekly.
1.52 asau 740:
741: To save download time we provide bzip2- and xz-compressed archives which are
742: published at pkgsrc.tar.bz2 and pkgsrc.tar.xz respectively.
743:
744: You can fetch the same files using FTP.
1.1 dsieger 745:
1.214 leot 746: The tar file for the stable branch 2021Q4 is in the directory pkgsrc-2021Q4 and
1.59 jnemeth 747: is also called pkgsrc.tar.gz.
1.1 dsieger 748:
1.136 leot 749: To download the latest pkgsrc stable tarball, run:
1.12 weinem 750:
1.214 leot 751: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2021Q4/pkgsrc.tar.gz
1.12 weinem 752:
1.78 snj 753: If you prefer, you can also fetch it using "wget", "curl", or your web browser.
1.52 asau 754:
1.12 weinem 755: Then, extract it with:
756:
1.78 snj 757: $ tar -xzf pkgsrc.tar.gz -C /usr
1.12 weinem 758:
759: This will create the directory pkgsrc/ in /usr/ and all the package source will
760: be stored under /usr/pkgsrc/.
761:
762: To download pkgsrc-current, run:
763:
764: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz
1.1 dsieger 765:
1.154 rillig 766: 3.1.2. Via anonymous CVS
1.1 dsieger 767:
1.24 wiz 768: To fetch a specific pkgsrc stable branch, run:
1.1 dsieger 769:
1.214 leot 770: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2021Q4 -P pkgsrc
1.13 weinem 771:
1.24 wiz 772: This will create the directory pkgsrc/ in your /usr/ directory and all the
773: package source will be stored under /usr/pkgsrc/.
774:
775: To fetch the pkgsrc current branch, run:
1.1 dsieger 776:
1.40 wiz 777: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 778:
1.30 dholland 779: Refer to the list of available mirrors to choose a faster CVS mirror, if
780: needed.
1.1 dsieger 781:
1.24 wiz 782: If you get error messages from rsh, you need to set CVS_RSH variable. E.g.:
1.1 dsieger 783:
1.40 wiz 784: $ cd /usr && env CVS_RSH=ssh cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 785:
1.24 wiz 786: Refer to documentation on your command shell how to set CVS_RSH=ssh
787: permanently. For Bourne shells, you can set it in your .profile or better
788: globally in /etc/profile:
789:
790: # set CVS remote shell command
791: CVS_RSH=ssh
792: export CVS_RSH
1.12 weinem 793:
1.13 weinem 794: By default, CVS doesn't do things like most people would expect it to do. But
795: there is a way to convince CVS, by creating a file called .cvsrc in your home
1.12 weinem 796: directory and saving the following lines to it. This file will save you lots of
797: headache and some bug reports, so we strongly recommend it. You can find an
798: explanation of this file in the CVS documentation.
1.2 rillig 799:
800: # recommended CVS configuration file from the pkgsrc guide
1.155 sevan 801: cvs -q
1.2 rillig 802: checkout -P
1.4 rillig 803: update -dP
804: diff -upN
1.2 rillig 805: rdiff -u
1.24 wiz 806: release -d
1.1 dsieger 807:
1.154 rillig 808: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 809:
810: The preferred way to keep pkgsrc up-to-date is via CVS (which also works if you
811: have first installed it via a tar file). It saves bandwidth and hard disk
812: activity, compared to downloading the tar file again.
813:
1.154 rillig 814: 3.2.1. Via tar files
1.1 dsieger 815:
816: Warning
817:
818: When updating from a tar file, you first need to completely remove the old
819: pkgsrc directory. Otherwise those files that have been removed from pkgsrc in
820: the mean time will not be removed on your local disk, resulting in
821: inconsistencies. When removing the old files, any changes that you have done to
822: the pkgsrc files will be lost after updating. Therefore updating via CVS is
823: strongly recommended.
824:
825: Note that by default the distfiles and the binary packages are saved in the
826: pkgsrc tree, so don't forget to rescue them before updating. You can also
1.78 snj 827: configure pkgsrc to store distfiles and packages in directories outside the
1.154 rillig 828: pkgsrc tree by setting the DISTDIR and PACKAGES variables. See Chapter 6,
1.78 snj 829: Configuring pkgsrc for the details.
1.1 dsieger 830:
831: To update pkgsrc from a tar file, download the tar file as explained above.
832: Then, make sure that you have not made any changes to the files in the pkgsrc
833: directory. Remove the pkgsrc directory and extract the new tar file. Done.
834:
1.154 rillig 835: 3.2.2. Via CVS
1.1 dsieger 836:
1.26 spz 837: To update pkgsrc via CVS, change to the pkgsrc directory and run cvs:
1.12 weinem 838:
1.26 spz 839: $ cd /usr/pkgsrc && cvs update -dP
840:
841: If you get error messages from rsh, you need to set CVS_RSH variable as
842: described above. E.g.:
843:
844: $ cd /usr/pkgsrc && env CVS_RSH=ssh cvs up -dP
1.1 dsieger 845:
1.154 rillig 846: 3.2.2.1. Switching between different pkgsrc branches
1.1 dsieger 847:
848: When updating pkgsrc, the CVS program keeps track of the branch you selected.
849: But if you, for whatever reason, want to switch from the stable branch to the
850: current one, you can do it by adding the option "-A" after the "update"
1.25 wiz 851: keyword. To switch from the current branch back to the stable branch, add the "
1.214 leot 852: -rpkgsrc-2021Q4" option.
1.1 dsieger 853:
1.154 rillig 854: 3.2.2.2. What happens to my changes when updating?
1.1 dsieger 855:
856: When you update pkgsrc, the CVS program will only touch those files that are
857: registered in the CVS repository. That means that any packages that you created
858: on your own will stay unmodified. If you change files that are managed by CVS,
859: later updates will try to merge your changes with those that have been done by
860: others. See the CVS manual, chapter "update" for details.
861:
1.154 rillig 862: Chapter 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 863:
864: Table of Contents
865:
1.154 rillig 866: 4.1. Binary distribution
867: 4.2. Bootstrapping pkgsrc
1.1 dsieger 868:
1.154 rillig 869: 4.1. Binary distribution
1.1 dsieger 870:
1.154 rillig 871: See Section 5.1, "Using binary packages".
1.1 dsieger 872:
1.154 rillig 873: 4.2. Bootstrapping pkgsrc
1.1 dsieger 874:
1.44 asau 875: pkgsrc can be bootstrapped for use in two different modes: privileged and
876: unprivileged one. In unprivileged mode in contrast to privileged one all
1.45 asau 877: programs are installed under one particular user and cannot utilise privileged
1.44 asau 878: operations (packages don't create special users and all special file
879: permissions like setuid are ignored).
880:
1.1 dsieger 881: Installing the bootstrap kit from source should be as simple as:
882:
1.60 asau 883: # env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 884: # cd pkgsrc/bootstrap
885: # ./bootstrap
886:
887:
1.44 asau 888: To bootstrap in unprivileged mode pass "--unprivileged" flag to bootstrap
889:
890: By default, in privileged mode pkgsrc uses /usr/pkg for prefix where programs
1.118 sevan 891: will be installed in, and /usr/pkg/pkgdb for the package database directory
892: where pkgsrc will do its internal bookkeeping, /var is used as varbase, where
1.44 asau 893: packages install their persistent data. In unprivileged mode pkgsrc uses ~/pkg
1.118 sevan 894: for prefix, ~/pkg/pkgdb for the package database, and ~/pkg/var for varbase.
1.44 asau 895:
896: You can change default layout using command-line arguments. Run "./bootstrap
897: --help" to get details.
1.1 dsieger 898:
899: Note
900:
901: The bootstrap installs a bmake tool. Use this bmake when building via pkgsrc.
902: For examples in this guide, use bmake instead of "make".
903:
1.44 asau 904: Note
905:
906: It is possible to bootstrap multiple instances of pkgsrc using non-intersecting
907: directories. Use bmake corresponding to the installation you're working with to
908: build and install packages.
909:
1.154 rillig 910: Chapter 5. Using pkgsrc
1.1 dsieger 911:
912: Table of Contents
913:
1.154 rillig 914: 5.1. Using binary packages
915: 5.1.1. Finding binary packages
916: 5.1.2. Installing binary packages
1.202 nia 917: 5.1.3. Updating packages
918: 5.1.4. Deinstalling packages
919: 5.1.5. Getting information about installed packages
920: 5.1.6. Checking for security vulnerabilities in installed packages
921: 5.1.7. Finding if newer versions of your installed packages are in pkgsrc
922: 5.1.8. Other administrative functions
1.154 rillig 923: 5.2. Building packages from source
924: 5.2.1. Requirements
925: 5.2.2. Fetching distfiles
926: 5.2.3. How to build and install
1.1 dsieger 927:
928: Basically, there are two ways of using pkgsrc. The first is to only install the
929: package tools and to use binary packages that someone else has prepared. This
930: is the "pkg" in pkgsrc. The second way is to install the "src" of pkgsrc, too.
931: Then you are able to build your own packages, and you can still use binary
932: packages from someone else.
933:
1.154 rillig 934: 5.1. Using binary packages
1.1 dsieger 935:
1.151 sevan 936: On the cdn.NetBSD.org site and mirrors, there are collections of binary
1.9 rillig 937: packages, ready to be installed. These binary packages have been built using
938: the default settings for the directories, that is:
939:
940: * /usr/pkg for LOCALBASE, where most of the files are installed,
941:
942: * /usr/pkg/etc for configuration files,
943:
944: * /var for VARBASE, where those files are installed that may change after
945: installation.
946:
947: If you cannot use these directories for whatever reasons (maybe because you're
948: not root), you cannot use these binary packages, but have to build the packages
1.154 rillig 949: yourself, which is explained in Section 4.2, "Bootstrapping pkgsrc".
1.1 dsieger 950:
1.154 rillig 951: 5.1.1. Finding binary packages
1.1 dsieger 952:
1.5 weinem 953: To install binary packages, you first need to know from where to get them. The
1.202 nia 954: first place where you should look is on the main pkgsrc CDN in the directory /
955: pub/pkgsrc/packages.
1.5 weinem 956:
957: This directory contains binary packages for multiple platforms. First, select
1.226 gutterid 958: your operating system. Then, select your hardware architecture, and in the
959: third step, the OS version and the "version" of pkgsrc.
1.9 rillig 960:
1.226 gutterid 961: In this directory, you may find a file called bootstrap.tar.gz which contains
1.9 rillig 962: the package management tools. If the file is missing, it is likely that your
963: operating system already provides those tools. Download the file and extract it
964: in the / directory. It will create the directories /usr/pkg (containing the
1.118 sevan 965: tools for managing binary packages and the database of installed packages).
1.1 dsieger 966:
1.154 rillig 967: 5.1.2. Installing binary packages
1.1 dsieger 968:
1.85 wiz 969: In the directory from the last section, there is a subdirectory called All/,
1.9 rillig 970: which contains all the binary packages that are available for the platform,
1.202 nia 971: excluding those that may not be distributed via HTTP or FTP.
1.9 rillig 972:
973: To install packages directly from an FTP or HTTP server, run the following
974: commands in a Bourne-compatible shell (be sure to su to root first):
975:
1.202 nia 976: # PATH="/usr/pkg/sbin:/usr/pkg/bin:$PATH"
977: # PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages"
1.169 rillig 978: # PKG_PATH="$PKG_PATH/OPSYS/ARCH/VERSIONS/All/"
1.9 rillig 979: # export PATH PKG_PATH
1.202 nia 980: # pkg_add pkgin
1.9 rillig 981:
982: Instead of URLs, you can also use local paths, for example if you are
983: installing from a set of CDROMs, DVDs or an NFS-mounted repository. If you want
984: to install packages from multiple sources, you can separate them by a semicolon
985: in PKG_PATH.
986:
987: After these preparations, installing a package is very easy:
988:
1.202 nia 989: # pkgin search nginx
990: nginx-1.19.6 Lightweight HTTP server and mail proxy server
991: nginx-1.18.0nb8 Lightweight HTTP server and mail proxy server
992: # pkgin install zsh nginx-1.19.6 vim
1.1 dsieger 993:
1.202 nia 994: Note that pkgin is a user-friendly frontend to the pkg_* tools.
1.1 dsieger 995:
1.202 nia 996: Any prerequisite packages needed to run the package in question will be
997: installed, too, assuming they are present in the repository.
1.1 dsieger 998:
999: After you've installed packages, be sure to have /usr/pkg/bin and /usr/pkg/sbin
1000: in your PATH so you can actually start the just installed program.
1001:
1.202 nia 1002: 5.1.3. Updating packages
1.1 dsieger 1003:
1.202 nia 1004: To update binary packages, it is recommended that you use pkgin upgrade. This
1005: will compare the remote package repository to your locally installed packages
1006: and safely replace any older packages.
1.1 dsieger 1007:
1.202 nia 1008: Note that pkgsrc is released as quarterly branches. If you are updating to a
1009: newer quarterly branch of pkgsrc, you may need to adjust the repository in /usr
1010: /pkg/etc/pkgin/repositories.conf.
1.1 dsieger 1011:
1.202 nia 1012: 5.1.4. Deinstalling packages
1.1 dsieger 1013:
1.202 nia 1014: To deinstall a package, it does not matter whether it was installed from source
1015: code or from a binary package. Neither the pkgin or the pkg_delete command need
1016: to know.
1.1 dsieger 1017:
1.202 nia 1018: To delete a package, you can just run pkgin remove package-name. The package
1019: name can be given with or without version number.
1.1 dsieger 1020:
1.202 nia 1021: 5.1.5. Getting information about installed packages
1.1 dsieger 1022:
1023: The pkg_info shows information about installed packages or binary package
1.202 nia 1024: files. As with other management tools, it works with packages installed from
1025: source or binaries.
1.1 dsieger 1026:
1.202 nia 1027: 5.1.6. Checking for security vulnerabilities in installed packages
1.1 dsieger 1028:
1.202 nia 1029: The pkgsrc Security Team and Packages Groups maintain a list of known
1.164 leot 1030: vulnerabilities to packages which are (or have been) included in pkgsrc. The
1.202 nia 1031: list is available from the NetBSD CDN at https://cdn.NetBSD.org/pub/NetBSD/
1.179 rillig 1032: packages/vulns/pkg-vulnerabilities.
1.1 dsieger 1033:
1.202 nia 1034: Please note that not every "vulnerability" with a CVE assignment is exploitable
1035: in every configuration. Some bugs are marked as active simply because an fix
1036: was not marked as such. Operating system specific hardening and mitigation
1037: features may also reduce the impact of bugs.
1038:
1.23 jakllsch 1039: Through pkg_admin fetch-pkg-vulnerabilities, this list can be downloaded
1040: automatically, and a security audit of all packages installed on a system can
1041: take place.
1042:
1043: There are two components to auditing. The first step, pkg_admin
1044: fetch-pkg-vulnerabilities, is for downloading the list of vulnerabilities from
1045: the NetBSD FTP site. The second step, pkg_admin audit, checks to see if any of
1046: your installed packages are vulnerable. If a package is vulnerable, you will
1047: see output similar to the following:
1.1 dsieger 1048:
1049: Package samba-2.0.9 has a local-root-shell vulnerability, see
1.174 leot 1050: https://www.samba.org/samba/whatsnew/macroexploit.html
1.1 dsieger 1051:
1.23 jakllsch 1052: You may wish to have the vulnerabilities file downloaded daily so that it
1053: remains current. This may be done by adding an appropriate entry to the root
1054: users crontab(5) entry. For example the entry
1055:
1.121 sevan 1056: # Download vulnerabilities file
1.118 sevan 1057: 0 3 * * * /usr/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities >/dev/null 2>&1
1.121 sevan 1058: # Audit the installed packages and email results to root
1059: 9 3 * * * /usr/pkg/sbin/pkg_admin audit |mail -s "Installed package audit result" \
1060: root >/dev/null 2>&1
1.118 sevan 1061:
1062:
1063: will update the vulnerability list every day at 3AM, followed by an audit at
1064: 3:09AM. The result of the audit are then emailed to root. On NetBSD this may be
1065: accomplished instead by adding the following line to /etc/daily.conf:
1066:
1067: fetch_pkg_vulnerabilities=YES
1068:
1.23 jakllsch 1069:
1.118 sevan 1070: to fetch the vulnerability list from the daily security script. The system is
1071: set to audit the packages by default but can be set explicitly, if desired (not
1.123 wiz 1072: required), by adding the following line to /etc/security.conf:
1.23 jakllsch 1073:
1.118 sevan 1074: check_pkg_vulnerabilities=YES
1.23 jakllsch 1075:
1076:
1.118 sevan 1077: see daily.conf(5) and security.conf(5) for more details.
1.1 dsieger 1078:
1.202 nia 1079: 5.1.7. Finding if newer versions of your installed packages are in pkgsrc
1.1 dsieger 1080:
1.12 weinem 1081: Install pkgtools/lintpkgsrc and run lintpkgsrc with the "-i" argument to check
1.202 nia 1082: if any packages are stale, e.g.
1.1 dsieger 1083:
1084: % lintpkgsrc -i
1085: ...
1086: Version mismatch: 'tcsh' 6.09.00 vs 6.10.00
1087:
1088:
1.202 nia 1089: 5.1.8. Other administrative functions
1.1 dsieger 1090:
1091: The pkg_admin executes various administrative functions on the package system.
1092:
1.154 rillig 1093: 5.2. Building packages from source
1.1 dsieger 1094:
1095: After obtaining pkgsrc, the pkgsrc directory now contains a set of packages,
1.25 wiz 1096: organized into categories. You can browse the online index of packages, or run
1.1 dsieger 1097: make readme from the pkgsrc directory to build local README.html files for all
1098: packages, viewable with any web browser such as www/lynx or www/firefox.
1099:
1100: The default prefix for installed packages is /usr/pkg. If you wish to change
1101: this, you should do so by setting LOCALBASE in mk.conf. You should not try to
1102: use multiple different LOCALBASE definitions on the same system (inside a
1103: chroot is an exception).
1104:
1105: The rest of this chapter assumes that the package is already in pkgsrc. If it
1106: is not, see Part II, "The pkgsrc developer's guide" for instructions how to
1107: create your own packages.
1108:
1.154 rillig 1109: 5.2.1. Requirements
1.1 dsieger 1110:
1111: To build packages from source, you need a working C compiler. On NetBSD, you
1112: need to install the "comp" and the "text" distribution sets. If you want to
1113: build X11-related packages, the "xbase" and "xcomp" distribution sets are
1114: required, too.
1115:
1.154 rillig 1116: 5.2.2. Fetching distfiles
1.1 dsieger 1117:
1118: The first step for building a package is downloading the distfiles (i.e. the
1119: unmodified source). If they have not yet been downloaded, pkgsrc will fetch
1120: them automatically.
1121:
1122: If you have all files that you need in the distfiles directory, you don't need
1123: to connect. If the distfiles are on CD-ROM, you can mount the CD-ROM on /cdrom
1124: and add:
1125:
1126: DISTDIR=/cdrom/pkgsrc/distfiles
1127:
1128: to your mk.conf.
1129:
1130: By default a list of distribution sites will be randomly intermixed to prevent
1131: huge load on servers which holding popular packages (for example,
1132: SourceForge.net mirrors). Thus, every time when you need to fetch yet another
1133: distfile all the mirrors will be tried in new (random) order. You can turn this
1134: feature off by setting MASTER_SORT_RANDOM=NO (for PKG_DEVELOPERs it's already
1135: disabled).
1136:
1137: You can overwrite some of the major distribution sites to fit to sites that are
1138: close to your own. By setting one or two variables you can modify the order in
1139: which the master sites are accessed. MASTER_SORT contains a whitespace
1140: delimited list of domain suffixes. MASTER_SORT_REGEX is even more flexible, it
1141: contains a whitespace delimited list of regular expressions. It has higher
1142: priority than MASTER_SORT. Have a look at pkgsrc/mk/defaults/mk.conf to find
1143: some examples. This may save some of your bandwidth and time.
1144:
1145: You can change these settings either in your shell's environment, or, if you
1.4 rillig 1146: want to keep the settings, by editing the mk.conf file, and adding the
1.1 dsieger 1147: definitions there.
1148:
1.132 wiz 1149: If a package depends on many other packages (such as meta-pkgs/kde4), the build
1.1 dsieger 1150: process may alternate between periods of downloading source, and compiling. To
1151: ensure you have all the source downloaded initially you can run the command:
1152:
1153: % make fetch-list | sh
1154:
1155: which will output and run a set of shell commands to fetch the necessary files
1156: into the distfiles directory. You can also choose to download the files
1157: manually.
1158:
1.154 rillig 1159: 5.2.3. How to build and install
1.1 dsieger 1160:
1161: Once the software has downloaded, any patches will be applied, then it will be
1162: compiled for you. This may take some time depending on your computer, and how
1163: many other packages the software depends on and their compile time.
1164:
1165: Note
1166:
1167: If using bootstrap or pkgsrc on a non-NetBSD system, use the pkgsrc bmake
1168: command instead of "make" in the examples in this guide.
1169:
1170: For example, type
1171:
1172: % cd misc/figlet
1173: % make
1174:
1175:
1176: at the shell prompt to build the various components of the package.
1177:
1178: The next stage is to actually install the newly compiled program onto your
1179: system. Do this by entering:
1180:
1181: % make install
1182:
1183:
1184: while you are still in the directory for whatever package you are installing.
1185:
1186: Installing the package on your system may require you to be root. However,
1187: pkgsrc has a just-in-time-su feature, which allows you to only become root for
1188: the actual installation step.
1189:
1190: That's it, the software should now be installed and setup for use. You can now
1191: enter:
1192:
1193: % make clean
1194:
1195:
1196: to remove the compiled files in the work directory, as you shouldn't need them
1197: any more. If other packages were also added to your system (dependencies) to
1198: allow your program to compile, you can tidy these up also with the command:
1199:
1200: % make clean-depends
1201:
1202:
1203: Taking the figlet utility as an example, we can install it on our system by
1.207 leot 1204: building as shown in Appendix C, Build logs.
1.1 dsieger 1205:
1206: The program is installed under the default root of the packages tree - /usr/
1207: pkg. Should this not conform to your tastes, set the LOCALBASE variable in your
1208: environment, and it will use that value as the root of your packages tree. So,
1209: to use /usr/local, set LOCALBASE=/usr/local in your environment. Please note
1210: that you should use a directory which is dedicated to packages and not shared
1211: with other programs (i.e., do not try and use LOCALBASE=/usr). Also, you should
1212: not try to add any of your own files or directories (such as src/, obj/, or
1213: pkgsrc/) below the LOCALBASE tree. This is to prevent possible conflicts
1214: between programs and other files installed by the package system and whatever
1215: else may have been installed there.
1216:
1.4 rillig 1217: Some packages look in mk.conf to alter some configuration options at build
1.1 dsieger 1218: time. Have a look at pkgsrc/mk/defaults/mk.conf to get an overview of what will
1219: be set there by default. Environment variables such as LOCALBASE can be set in
1.4 rillig 1220: mk.conf to save having to remember to set them each time you want to use
1.1 dsieger 1221: pkgsrc.
1222:
1223: Occasionally, people want to "look under the covers" to see what is going on
1224: when a package is building or being installed. This may be for debugging
1225: purposes, or out of simple curiosity. A number of utility values have been
1226: added to help with this.
1227:
1228: 1. If you invoke the make(1) command with PKG_DEBUG_LEVEL=2, then a huge
1229: amount of information will be displayed. For example,
1230:
1231: make patch PKG_DEBUG_LEVEL=2
1232:
1.25 wiz 1233: will show all the commands that are invoked, up to and including the "patch
1234: " stage.
1.1 dsieger 1235:
1236: 2. If you want to know the value of a certain make(1) definition, then the
1237: VARNAME definition should be used, in conjunction with the show-var target.
1238: e.g. to show the expansion of the make(1) variable LOCALBASE:
1239:
1240: % make show-var VARNAME=LOCALBASE
1241: /usr/pkg
1242: %
1243:
1244:
1245: If you want to install a binary package that you've either created yourself
1246: (see next section), that you put into pkgsrc/packages manually or that is
1247: located on a remote FTP server, you can use the "bin-install" target. This
1248: target will install a binary package - if available - via pkg_add(1), else do a
1249: make package. The list of remote FTP sites searched is kept in the variable
1250: BINPKG_SITES, which defaults to ftp.NetBSD.org. Any flags that should be added
1251: to pkg_add(1) can be put into BIN_INSTALL_FLAGS. See pkgsrc/mk/defaults/mk.conf
1252: for more details.
1253:
1254: A final word of warning: If you set up a system that has a non-standard setting
1255: for LOCALBASE, be sure to set that before any packages are installed, as you
1256: cannot use several directories for the same purpose. Doing so will result in
1257: pkgsrc not being able to properly detect your installed packages, and fail
1258: miserably. Note also that precompiled binary packages are usually built with
1259: the default LOCALBASE of /usr/pkg, and that you should not install any if you
1260: use a non-standard LOCALBASE.
1261:
1.154 rillig 1262: Chapter 6. Configuring pkgsrc
1.1 dsieger 1263:
1264: Table of Contents
1265:
1.154 rillig 1266: 6.1. General configuration
1267: 6.2. Variables affecting the build process
1268: 6.3. Variables affecting the installation process
1269: 6.4. Selecting and configuring the compiler
1270: 6.4.1. Selecting the compiler
1271: 6.4.2. Additional flags to the compiler (CFLAGS)
1272: 6.4.3. Additional flags to the linker (LDFLAGS)
1273: 6.5. Developer/advanced settings
1274: 6.6. Selecting Build Options
1.1 dsieger 1275:
1276: The whole pkgsrc system is configured in a single file, usually called mk.conf.
1277: In which directory pkgsrc looks for that file depends on the installation. On
1278: NetBSD, when you use make(1) from the base system, it is in the directory /etc
1279: /. In all other cases the default location is ${PREFIX}/etc/, depending on
1280: where you told the bootstrap program to install the binary packages.
1281:
1282: The format of the configuration file is that of the usual BSD-style Makefiles.
1283: The whole pkgsrc configuration is done by setting variables in this file. Note
1284: that you can define all kinds of variables, and no special error checking (for
1.112 rillig 1285: example for spelling mistakes) takes place.
1.1 dsieger 1286:
1.154 rillig 1287: 6.1. General configuration
1.1 dsieger 1288:
1.112 rillig 1289: The following variables apply to all pkgsrc packages. A complete list of the
1290: variables that can be configured by the user is available in mk/defaults/
1291: mk.conf, together with some comments that describe each variable's intent.
1.1 dsieger 1292:
1293: * LOCALBASE: Where packages will be installed. The default is /usr/pkg. Do
1294: not mix binary packages with different LOCALBASEs!
1295:
1296: * CROSSBASE: Where "cross" category packages will be installed. The default
1297: is ${LOCALBASE}/cross.
1298:
1.84 wiz 1299: * X11BASE: Where X11 is installed on the system. The default is /usr/X11R7.
1.1 dsieger 1300:
1301: * DISTDIR: Where to store the downloaded copies of the original source
1302: distributions used for building pkgsrc packages. The default is $
1303: {PKGSRCDIR}/distfiles.
1304:
1305: * PKG_DBDIR: Where the database about installed packages is stored. The
1.118 sevan 1306: default is /usr/pkg/pkgdb.
1.1 dsieger 1307:
1308: * MASTER_SITE_OVERRIDE: If set, override the packages' MASTER_SITES with this
1309: value.
1310:
1311: * MASTER_SITE_BACKUP: Backup location(s) for distribution files and patch
1312: files if not found locally or in ${MASTER_SITES} or ${PATCH_SITES}
1.118 sevan 1313: respectively. The defaults is ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/$
1.1 dsieger 1314: {DIST_SUBDIR}/.
1315:
1316: * BINPKG_SITES: List of sites carrying binary pkgs. rel and arch are replaced
1317: with OS release ("2.0", etc.) and architecture ("mipsel", etc.).
1318:
1.23 jakllsch 1319: * ACCEPTABLE_LICENSES: List of acceptable licenses. License names are
1320: case-sensitive. Whenever you try to build a package whose license is not in
1321: this list, you will get an error message. If the license condition is
1322: simple enough, the error message will include specific instructions on how
1323: to change this variable.
1.1 dsieger 1324:
1.154 rillig 1325: 6.2. Variables affecting the build process
1.1 dsieger 1326:
1327: * PACKAGES: The top level directory for the binary packages. The default is $
1328: {PKGSRCDIR}/packages.
1329:
1330: * WRKOBJDIR: The top level directory where, if defined, the separate working
1331: directories will get created, and symbolically linked to from ${WRKDIR}
1332: (see below). This is useful for building packages on several architectures,
1333: then ${PKGSRCDIR} can be NFS-mounted while ${WRKOBJDIR} is local to every
1334: architecture. (It should be noted that PKGSRCDIR should not be set by the
1.198 leot 1335: user -- it is an internal definition which refers to the root of the pkgsrc
1.1 dsieger 1336: tree. It is possible to have many pkgsrc tree instances.)
1337:
1338: * LOCALPATCHES: Directory for local patches that aren't part of pkgsrc. See
1.184 rillig 1339: Section 12.3, "patches/*" for more information.
1.1 dsieger 1340:
1341: * PKGMAKECONF: Location of the mk.conf file used by a package's BSD-style
1342: Makefile. If this is not set, MAKECONF is set to /dev/null to avoid picking
1343: up settings used by builds in /usr/src.
1344:
1.154 rillig 1345: 6.3. Variables affecting the installation process
1.1 dsieger 1346:
1.198 leot 1347: * PKGSRC_KEEP_BIN_PKGS: By default, binary packages of built packages are
1.150 leot 1348: preserved in ${PACKAGES}/All. Setting this variable to "no" prevents this.
1.1 dsieger 1349:
1.107 jnemeth 1350: Packages have to support installation into a subdirectory of WRKDIR. This
1351: allows a package to be built, before the actual filesystem is touched. DESTDIR
1352: support exists in two variations:
1.4 rillig 1353:
1354: * Basic DESTDIR support means that the package installation and packaging is
1355: still run as root.
1356:
1357: * Full DESTDIR support can run the complete build, installation and packaging
1358: as normal user. Root privileges are only needed to add packages.
1359:
1360: With basic DESTDIR support, make clean needs to be run as root.
1361:
1.17 imil 1362: Considering the foo/bar package, DESTDIR full support can be tested using the
1363: following commands
1364:
1365: $ id
1366: uid=1000(myusername) gid=100(users) groups=100(users),0(wheel)
1367: $ mkdir $HOME/packages
1368: $ cd $PKGSRCDIR/foo/bar
1369:
1370: Verify DESTDIR full support, no root privileges should be needed
1371:
1.66 asau 1372: $ make stage-install
1.17 imil 1373:
1374: Create a package without root privileges
1375:
1.66 asau 1376: $ make PACKAGES=$HOME/packages package
1.17 imil 1377:
1378: For the following command, you must be able to gain root privileges using su(1)
1379:
1.66 asau 1380: $ make PACKAGES=$HOME/packages install
1.17 imil 1381:
1382: Then, as a simple user
1383:
1384: $ make clean
1385:
1.154 rillig 1386: 6.4. Selecting and configuring the compiler
1.4 rillig 1387:
1.154 rillig 1388: 6.4.1. Selecting the compiler
1.1 dsieger 1389:
1390: By default, pkgsrc will use GCC to build packages. This may be overridden by
1391: setting the following variables in /etc/mk.conf:
1392:
1393: PKGSRC_COMPILER:
1394:
1395: This is a list of values specifying the chain of compilers to invoke when
1396: building packages. Valid values are:
1397:
1.232 gutterid 1398: o ccc: Compaq C Compilers (Tru64)
1.66 asau 1399:
1.232 gutterid 1400: o ccache: compiler cache (chainable)
1.66 asau 1401:
1.232 gutterid 1402: o clang: Clang C and Objective-C compiler
1.66 asau 1403:
1.232 gutterid 1404: o distcc: distributed C/C++ (chainable)
1.1 dsieger 1405:
1.232 gutterid 1406: o f2c: Fortran 77 to C compiler (chainable)
1.66 asau 1407:
1.232 gutterid 1408: o icc: Intel C++ Compiler (Linux)
1.66 asau 1409:
1.232 gutterid 1410: o ido: SGI IRIS Development Option cc (IRIX 5)
1.1 dsieger 1411:
1.232 gutterid 1412: o gcc: GNU C/C++ Compiler
1.1 dsieger 1413:
1.232 gutterid 1414: o hp: HP-UX C/aC++ compilers
1.66 asau 1415:
1.232 gutterid 1416: o mipspro: Silicon Graphics, Inc. MIPSpro (n32/n64)
1.1 dsieger 1417:
1.232 gutterid 1418: o mipspro-ucode: Silicon Graphics, Inc. MIPSpro (o32)
1.1 dsieger 1419:
1.232 gutterid 1420: o sunpro: Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio
1.1 dsieger 1421:
1.232 gutterid 1422: o xlc: IBM's XL C/C++ compiler suite
1.66 asau 1423:
1.1 dsieger 1424: The default is "gcc". You can use ccache and/or distcc with an appropriate
1425: PKGSRC_COMPILER setting, e.g. "ccache gcc". This variable should always be
1426: terminated with a value for a real compiler. Note that only one real
1427: compiler should be listed (e.g. "sunpro gcc" is not allowed).
1428:
1429: GCC_REQD:
1430:
1431: This specifies the minimum version of GCC to use when building packages. If
1432: the system GCC doesn't satisfy this requirement, then pkgsrc will build and
1433: install one of the GCC packages to use instead.
1434:
1.153 leot 1435: PYTHON_VERSION_DEFAULT:
1.114 maya 1436:
1437: Specifies which version of python to use when several options are
1438: available.
1439:
1440: PKGSRC_FORTRAN:
1441:
1.176 gutterid 1442: Specifies the Fortran compiler to use. The default is gfortran.
1.114 maya 1443:
1444: GFORTRAN_VERSION:
1445:
1446: If PKGSRC_FORTRAN= gfortran is used, this option specifies which version to
1447: use.
1448:
1.154 rillig 1449: 6.4.2. Additional flags to the compiler (CFLAGS)
1.1 dsieger 1450:
1451: If you wish to set the CFLAGS variable, please make sure to use the += operator
1452: instead of the = operator:
1453:
1454: CFLAGS+= -your -flags
1455:
1456: Using CFLAGS= (i.e. without the "+") may lead to problems with packages that
1.16 jnemeth 1457: need to add their own flags. You may want to take a look at the devel/cpuflags
1.24 wiz 1458: package if you're interested in optimization specifically for the current CPU.
1.1 dsieger 1459:
1.154 rillig 1460: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 1461:
1462: If you want to pass flags to the linker, both in the configure step and the
1463: build step, you can do this in two ways. Either set LDFLAGS or LIBS. The
1464: difference between the two is that LIBS will be appended to the command line,
1465: while LDFLAGS come earlier. LDFLAGS is pre-loaded with rpath settings for ELF
1466: machines depending on the setting of USE_IMAKE or the inclusion of mk/
1467: x11.buildlink3.mk. As with CFLAGS, if you do not wish to override these
1468: settings, use the += operator:
1469:
1470: LDFLAGS+= -your -linkerflags
1471:
1.154 rillig 1472: 6.5. Developer/advanced settings
1.1 dsieger 1473:
1474: * PKG_DEVELOPER: Run some sanity checks that package developers want:
1475:
1.42 asau 1476: + make sure patches apply with zero fuzz
1.1 dsieger 1477:
1.42 asau 1478: + run check-shlibs to see that all binaries will find their shared libs.
1.1 dsieger 1479:
1.232 gutterid 1480: * CHECK_FILES_STRICT: Also check VARBASE and PKG_SYSCONFDIR values in PLIST
1481: entries.
1482:
1.1 dsieger 1483: * PKG_DEBUG_LEVEL: The level of debugging output which is displayed whilst
1484: making and installing the package. The default value for this is 0, which
1485: will not display the commands as they are executed (normal, default, quiet
1486: operation); the value 1 will display all shell commands before their
1487: invocation, and the value 2 will display both the shell commands before
1.112 rillig 1488: their invocation, as well as their actual execution progress with set -x.
1.1 dsieger 1489:
1.154 rillig 1490: 6.6. Selecting Build Options
1.1 dsieger 1491:
1492: Some packages have build time options, usually to select between different
1493: dependencies, enable optional support for big dependencies or enable
1494: experimental features.
1495:
1496: To see which options, if any, a package supports, and which options are
1497: mutually exclusive, run make show-options, for example:
1498:
1499: The following options are supported by this package:
1500: ssl Enable SSL support.
1501: Exactly one of the following gecko options is required:
1502: firefox Use firefox as gecko rendering engine.
1503: mozilla Use mozilla as gecko rendering engine.
1504: At most one of the following database options may be selected:
1505: mysql Enable support for MySQL database.
1506: pgsql Enable support for PostgreSQL database.
1507:
1508: These options are enabled by default: firefox
1509: These options are currently enabled: mozilla ssl
1510:
1.4 rillig 1511: The following variables can be defined in mk.conf to select which options to
1512: enable for a package: PKG_DEFAULT_OPTIONS, which can be used to select or
1.1 dsieger 1513: disable options for all packages that support them, and PKG_OPTIONS.pkgbase,
1514: which can be used to select or disable options specifically for package pkgbase
1515: . Options listed in these variables are selected, options preceded by "-" are
1516: disabled. A few examples:
1517:
1.4 rillig 1518: $ grep "PKG.*OPTION" mk.conf
1.1 dsieger 1519: PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
1520: PKG_OPTIONS.kdebase= debug -sasl
1521: PKG_OPTIONS.apache= suexec
1522:
1.11 rillig 1523: It is important to note that options that were specifically suggested by the
1.19 snj 1524: package maintainer must be explicitly removed if you do not wish to include the
1525: option. If you are unsure you can view the current state with make show-options
1526: .
1.11 rillig 1527:
1.1 dsieger 1528: The following settings are consulted in the order given, and the last setting
1529: that selects or disables an option is used:
1530:
1531: 1. the default options as suggested by the package maintainer
1532:
1533: 2. the options implied by the settings of legacy variables (see below)
1534:
1535: 3. PKG_DEFAULT_OPTIONS
1536:
1537: 4. PKG_OPTIONS.pkgbase
1538:
1539: For groups of mutually exclusive options, the last option selected is used, all
1540: others are automatically disabled. If an option of the group is explicitly
1541: disabled, the previously selected option, if any, is used. It is an error if no
1542: option from a required group of options is selected, and building the package
1543: will fail.
1544:
1545: Before the options framework was introduced, build options were selected by
1.4 rillig 1546: setting a variable (often named USE_FOO) in mk.conf for each option. To ease
1547: transition to the options framework for the user, these legacy variables are
1548: converted to the appropriate options setting (PKG_OPTIONS.pkgbase)
1549: automatically. A warning is issued to prompt the user to update mk.conf to use
1550: the options framework directly. Support for the legacy variables will be
1.1 dsieger 1551: removed eventually.
1552:
1.154 rillig 1553: Chapter 7. Creating binary packages
1.1 dsieger 1554:
1555: Table of Contents
1556:
1.154 rillig 1557: 7.1. Building a single binary package
1558: 7.2. Settings for creation of binary packages
1.1 dsieger 1559:
1.154 rillig 1560: 7.1. Building a single binary package
1.1 dsieger 1561:
1562: Once you have built and installed a package, you can create a binary package
1563: which can be installed on another system with pkg_add(1). This saves having to
1564: build the same package on a group of hosts and wasting CPU time. It also
1565: provides a simple means for others to install your package, should you
1566: distribute it.
1567:
1568: To create a binary package, change into the appropriate directory in pkgsrc,
1569: and run make package:
1570:
1.112 rillig 1571: $ cd misc/figlet
1572: $ make package
1.1 dsieger 1573:
1574: This will build and install your package (if not already done), and then build
1575: a binary package from what was installed. You can then use the pkg_* tools to
1576: manipulate it. Binary packages are created by default in /usr/pkgsrc/packages,
1.207 leot 1577: in the form of a gzipped tar file. See Section C.2, "Packaging figlet" for a
1.1 dsieger 1578: continuation of the above misc/figlet example.
1579:
1.154 rillig 1580: See Chapter 23, Submitting and Committing for information on how to submit such
1.1 dsieger 1581: a binary package.
1582:
1.154 rillig 1583: 7.2. Settings for creation of binary packages
1.1 dsieger 1584:
1.184 rillig 1585: See Section 13.17, "Other helpful targets".
1.6 rillig 1586:
1.154 rillig 1587: Chapter 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 1588:
1589: Table of Contents
1590:
1.154 rillig 1591: 8.1. Preparations
1.180 rillig 1592: 8.2. Running a bulk build
1.154 rillig 1593: 8.2.1. Configuration
1594: 8.3. Requirements of a full bulk build
1.178 rillig 1595: 8.4. Bulk build variants
1.179 rillig 1596: 8.4.1. Detect unknown configure options
1597: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 1598: 8.4.3. Force compiler options only in the build phase
1599: 8.4.4. Use custom directories
1600: 8.4.5. Turn warnings into errors
1601: 8.4.6. Reject packages for which pkglint reports errors
1602: 8.4.7. Reject packages that contain forbidden strings
1603: 8.4.8. Reject packages whose self-test fails
1604: 8.4.9. Reject packages that use undefined shell variables
1605: 8.4.10. Turn off verbose logging
1.178 rillig 1606: 8.5. Creating a multiple CD-ROM packages collection
1607: 8.5.1. Example of cdpack
1.6 rillig 1608:
1.175 gutterid 1609: For a number of reasons, you may want to build binary packages for a large
1610: selected set of packages in pkgsrc, or even for all pkgsrc packages. For
1.71 wiz 1611: instance, when you have multiple machines that should run the same software, it
1612: is wasted time if they all build their packages themselves from source. Or you
1613: may want to build a list of packages you want and check them before deploying
1.175 gutterid 1614: onto production systems. There is a way of getting a set of binary packages:
1615: the bulk build system, or pbulk ("p" stands for "parallel"). This chapter
1616: describes how to set it up.
1.71 wiz 1617:
1.154 rillig 1618: 8.1. Preparations
1.71 wiz 1619:
1620: First of all, you have to decide whether you build all packages or a limited
1621: set of them. Full bulk builds usually consume a lot more resources, both space
1.175 gutterid 1622: and time, than builds for some practical sets of packages. A number of
1623: particularly heavy packages exist that are not actually interesting to a wide
1624: audience. (The approximate resource consumption for a full bulk build is given
1625: in section Section 8.3, "Requirements of a full bulk build".) For limited bulk
1626: builds you need to make a list of packages you want to build. Note that all
1627: their dependencies will be built, so you don't need to track them manually.
1.71 wiz 1628:
1629: During bulk builds various packages are installed and deinstalled in /usr/pkg
1630: (or whatever LOCALBASE is), so make sure that you don't need any package during
1.112 rillig 1631: the builds. Essentially, you should provide a fresh system, either a chroot
1.71 wiz 1632: environment or something even more restrictive, depending on what the operating
1633: system provides, or dedicate the whole physical machine. As a useful side
1634: effect this makes sure that bulk builds cannot break anything in your system.
1635: There have been numerous cases where certain packages tried to install files
1636: outside the LOCALBASE or wanted to edit some files in /etc.
1.6 rillig 1637:
1.180 rillig 1638: 8.2. Running a bulk build
1.6 rillig 1639:
1.180 rillig 1640: Running a bulk build works roughly as follows:
1.15 rillig 1641:
1642: * First, build the pbulk infrastructure in a fresh pkgsrc location.
1643:
1644: * Then, build each of the packages from a clean installation directory using
1645: the infrastructure.
1646:
1.154 rillig 1647: 8.2.1. Configuration
1.6 rillig 1648:
1.112 rillig 1649: To simplify configuration, we provide the helper script mk/pbulk/pbulk.sh.
1.6 rillig 1650:
1.68 asau 1651: In order to use it, prepare a clear system (real one, chroot environment, jail,
1652: zone, virtual machine). Configure network access to fetch distribution files.
1.112 rillig 1653: Create a user with name "pbulk".
1.68 asau 1654:
1655: Fetch and extract pkgsrc. Use a command like one of these:
1656:
1.151 sevan 1657: # (cd /usr && ftp -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1658: # (cd /usr && fetch -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1.72 wiz 1659: # (cd /usr && cvs -Q -z3 -d anoncvs@anoncvs.NetBSD.org:/cvsroot get -P pkgsrc)
1.68 asau 1660:
1661: Or any other way that fits (e.g., curl, wget).
1662:
1663: Deploy and configure pbulk tools, e.g.:
1664:
1.118 sevan 1665: # sh pbulk.sh -n # use native make, no bootstrap kit needed (for use on NetBSD)
1.68 asau 1666: # sh pbulk.sh -n -c mk.conf.frag # native, apply settings from given mk.conf fragment
1667: # sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build
1668:
1669: Note
1670:
1671: mk.conf.frag is a fragment of mk.conf that contains settings you want to apply
1672: to packages you build. For instance,
1673:
1.112 rillig 1674: PKG_DEVELOPER= yes # perform more checks
1675: X11_TYPE= modular # use pkgsrc X11
1676: SKIP_LICENSE_CHECK= yes # accept all licences (useful
1677: # when building all packages)
1.68 asau 1678:
1679: If configured for limited list, replace the list in /usr/pbulk/etc/pbulk.list
1.112 rillig 1680: with your list of packages, one per line without empty lines or comments. E.g.:
1.68 asau 1681:
1682: www/firefox
1683: mail/thunderbird
1684: misc/libreoffice4
1685:
1.69 asau 1686: At this point you can also review configuration in /usr/pbulk/etc and make
1687: final amendments, if wanted.
1688:
1.68 asau 1689: Start it:
1690:
1691: # /usr/pbulk/bin/bulkbuild
1692:
1693: After it finishes, you'll have /mnt filled with distribution files, binary
1694: packages, and reports, plain text summary in /mnt/bulklog/meta/report.txt
1695:
1696: Note
1697:
1698: The pbulk.sh script does not cover all possible use cases. While being ready to
1699: run, it serves as a good starting point to understand and build more complex
1700: setups. The script is kept small enough for better understanding.
1701:
1702: Note
1703:
1704: The pbulk.sh script supports running unprivileged bulk build and helps
1.205 wiz 1705: configuring distributed bulk builds. Distributed bulk builds support either
1706: building in worker chroots (each node is a path to a different chroot) that
1707: replicate the target system, including the pbulk prefix, or remote machines
1708: (each node is an IP address that must be accessible over SSH without a
1709: password).
1.15 rillig 1710:
1.154 rillig 1711: 8.3. Requirements of a full bulk build
1.71 wiz 1712:
1713: A complete bulk build requires lots of disk space. Some of the disk space can
1714: be read-only, some other must be writable. Some can be on remote filesystems
1715: (such as NFS) and some should be local. Some can be temporary filesystems,
1716: others must survive a sudden reboot.
1717:
1.205 wiz 1718: * 70 GB for the distfiles (read-write, remote, temporary)
1.71 wiz 1719:
1.205 wiz 1720: * 60 GB for the binary packages (read-write, remote, permanent)
1.71 wiz 1721:
1722: * 1 GB for the pkgsrc tree (read-only, remote, permanent)
1723:
1724: * 5 GB for LOCALBASE (read-write, local, temporary)
1725:
1726: * 10 GB for the log files (read-write, remote, permanent)
1727:
1728: * 5 GB for temporary files (read-write, local, temporary)
1729:
1.178 rillig 1730: 8.4. Bulk build variants
1731:
1732: To ensure that pkgsrc packages work in different configurations, it makes sense
1733: to run non-default bulk builds from time to time. This section lists some ideas
1734: for bulk builds that intentionally let packages fail if they don't follow the
1735: pkgsrc style.
1736:
1.179 rillig 1737: 8.4.1. Detect unknown configure options
1.178 rillig 1738:
1739: Add the following line to mk.conf.
1740:
1741: GNU_CONFIGURE_STRICT= yes
1742:
1743: When a package fails this additional check, the most common cause is that the
1744: configure option was valid for an older version of the package but does not
1745: apply anymore. In that case, just remove it.
1746:
1.179 rillig 1747: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.178 rillig 1748:
1749: The job of a compiler is not restricted to producing executable code, most
1.179 rillig 1750: compilers also detect typical programming mistakes. The pkgsrc compiler
1751: wrappers make it easy to force compiler options when the package is built. This
1752: can be used to find typical bugs across all packages that are in pkgsrc. By
1753: reporting these bugs upstream, the packages will be more reliable with the next
1754: updates.
1.178 rillig 1755:
1.179 rillig 1756: Add some of the following lines to mk.conf:
1.178 rillig 1757:
1758: CFLAGS+= -Werror=char-subscripts
1.179 rillig 1759: CFLAGS+= -Werror=implicit-function-declaration
1.178 rillig 1760:
1.179 rillig 1761: When a package fails to build using these stricter compiler options, document
1762: the circumstances in which the compiler produced the error message. This
1763: includes:
1.178 rillig 1764:
1765: * The platform (MACHINE_PLATFORM)
1766:
1767: * The source file
1768:
1769: * An excerpt of the code. GCC and Clang already do this as part of the
1770: diagnostic.
1771:
1.179 rillig 1772: * The exact error message from the compiler.
1.178 rillig 1773:
1.179 rillig 1774: If a package produces these error messages, but the package is fine, record
1775: this in your local mk.conf, like this, to skip this check in the next builds:
1.178 rillig 1776:
1.179 rillig 1777: .if ${PKGPATH} == category/package
1.178 rillig 1778: # Version ${VERSION} failed on ${MACHINE_PLATFORM}:
1779: # error message
1780: # code
1.179 rillig 1781: # Reason why the code does not need to be fixed.
1.178 rillig 1782: BUILDLINK_TRANSFORM+= rm:-Werror=char-subscripts
1.179 rillig 1783: .endif
1.178 rillig 1784:
1785: If the error messages from the compiler are valid and the code needs to be
1.179 rillig 1786: fixed, prepare a local patch (see LOCALPATCHES) and report the bug to the
1787: upstream authors of the package, providing them with the information you
1788: collected above.
1.178 rillig 1789:
1.179 rillig 1790: Patches that are not essential for the package to work should only be reported
1791: upstream but not committed to pkgsrc, to make future updates easier.
1792:
1.181 rillig 1793: 8.4.3. Force compiler options only in the build phase
1794:
1795: When adding custom compiler flags via CFLAGS, these apply to all phases of the
1796: package build process. Especially in the configure phase, adding -Werror leads
1797: to wrong decisions. The GNU configure scripts feed many small test programs to
1798: the C compiler to see whether certain headers are available, functions are
1799: defined in a library and programs can be run. In many cases these programs
1800: would not survive a strict compiler run with -Wall -Wextra -Werror.
1801:
1802: The pkgsrc infrastructure is flexible enough to support compiler options being
1803: added between the configure and build phases. It's a little more complicated
1804: than the other examples in this section but still easy enough.
1805:
1806: The basic idea is to use the pkgsrc compiler wrapper to inject the desired
1807: compiler options. The compiler wrapper's original task is to hide unwanted
1808: directories of include files and to normalize compiler options. It does this by
1809: wrapping the compiler command and rewriting the command line. To see this in
1810: action, run bmake patch in a package directory and examine the work/.cwrappers/
1811: config directory. It contains individual configurations for the C compiler and
1812: the related tools. The plan is to find a hook between the configure and build
1813: phases, and to modify these configuration files at that point.
1814:
1815: To find this hook, have a look at mk/build/build.mk, which contains among
1816: others the pre-build-checks-hook. The word checks doesn't quite fit, but the
1817: pre-build-hook sounds good enough.
1818:
1819: The code to be included in mk.conf is:
1820:
1821: # Just a few example options.
1822: BUILD_ONLY_CFLAGS= -Wall -Werror -O2 -DTEMPDIR='"/tmp"'
1823:
1824: .if ${BUILD_ONLY_CFLAGS:U:M*}
1825: pre-build-checks-hook: add-build-only-cflags
1826:
1827: add-build-only-cflags: .PHONY
1828: ${RUN} cd ${CWRAPPERS_CONFIG_DIR}; \
1829: ${TEST} ! -f ${.TARGET} || exit 0; \
1830: for flag in ${BUILD_ONLY_CFLAGS}; do \
1831: ${ECHO} "append=$$flag" >> cc; \
1832: done; \
1833: > ${.TARGET}
1834: .endif
1835:
1836: (When editing the mk.conf, make sure that the commands of the
1837: add-build-only-cflags target are indented with a tab, not with spaces.)
1838:
1839: The condition in the .if statement contains the :U modifier to prevent parse
1840: errors if the variable should be undefined, possibly because it is only defined
1841: for a subset of the packages. The :M* modifier ensures that there is at least
1842: one compiler option, to prevent a syntax error in the shell parser.
1843:
1844: The code around the ${.TARGET} variable ensures that the additional compiler
1845: options are only appended once, even if bmake build is run multiple times. To
1846: do this, it creates a marker file.
1847:
1848: To verify that this setup works, run bmake configure in a package directory. Up
1849: to now, everything works as usual. Examine the directory work/.cwrappers/config
1850: to see that the compiler options from BUILD_ONLY_CFLAGS are not yet added to
1851: the file cc. Examine the tail of the work/.work.log file to see that the normal
1852: compiler options are used.
1853:
1854: Now run bmake build. This will append the options to the file cc and will
1855: create the marker file in the same directory. After that, the build starts as
1856: usual, but with the added compiler options. Examine the tail of the file work
1857: /.work.log to see that the lines starting with [*] don't contain the compiler
1858: options, but the corresponding lines starting with <.> do end with these
1859: options.
1860:
1861: Building packages using this setup variant and fixing the resulting bugs is the
1862: same as in Section 8.4.2, "Detect classes of bugs by forcing compiler warnings"
1863: .
1864:
1865: 8.4.4. Use custom directories
1.178 rillig 1866:
1867: Some directories like PREFIX, VARBASE, PKG_SYSCONFDIR, PKGMANDIR, PKG_INFODIR
1868: can be configured in pkgsrc. Set these to arbitrary paths during bootstrap or
1869: afterwards in mk.conf.
1870:
1871: PREFIX= /a-random-uuid
1872: PKG_SYSCONFDIR= /a-random-uuid
1873: VARBASE= /a-random-uuid
1874: PKGMANDIR= a-random-uuid
1875: PKG_INFODIR= a-random-uuid
1876:
1.181 rillig 1877: 8.4.5. Turn warnings into errors
1.178 rillig 1878:
1879: When building a package, warnings are typically ignored since they just flow by
1880: and do not cause the build to fail immediately. To find these warnings,
1881: redefine them to errors in mk.conf.
1882:
1883: DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)"
1884: WARNING_MSG= ${FAIL_MSG} "(was warning)"
1885:
1886: (There are many more classes of warnings in pkgsrc, and most of them can be
1887: redefined with a simple definition like above.
1888:
1.179 rillig 1889: If a package suggests to add USE_TOOLS+=perl to the package Makefile, research
1.178 rillig 1890: whether the package actually needs Perl. If it does, add USE_TOOLS+=perl to the
1891: package Makefile, and if it doesn't, add TOOLS_BROKEN+=perl.
1892:
1.181 rillig 1893: 8.4.6. Reject packages for which pkglint reports errors
1.178 rillig 1894:
1895: Using pkglint as part of the regular build process is mostly a waste of time.
1896: If you want to fix some of the warnings, just run pkglint recursively on the
1897: whole pkgsrc tree. This will take a few minutes (up to 10), which is much
1898: faster than a complete bulk build.
1899:
1.181 rillig 1900: 8.4.7. Reject packages that contain forbidden strings
1.178 rillig 1901:
1902: To ensure that the binary packages don't contain references to the build
1903: directory, there is already CHECK_WRKREF. If that variable includes the item
1904: extra, it is possible to define additional patterns that must not appear in any
1905: installed file. This is specified in mk.conf.
1906:
1907: CHECK_WRKREF= extra
1908: CHECK_WRKREF_EXTRA_DIRS+= /usr/local
1909: CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg
1910: CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@
1911:
1912: The above patterns will probably generate many false positives, therefore the
1913: results need to be taken with a grain of salt.
1914:
1.181 rillig 1915: 8.4.8. Reject packages whose self-test fails
1.178 rillig 1916:
1917: To run the test suites that come with each package, add this line to mk.conf.
1918:
1919: PKGSRC_RUN_TEST= yes
1920:
1921: Be prepared that even the most basic packages fail this test. When doing a bulk
1922: build with this, it will often abort in the early phase where the packages are
1923: scanned for their dependencies since there are cyclic dependencies. There is
1924: still a lot to do in this area.
1925:
1.181 rillig 1926: 8.4.9. Reject packages that use undefined shell variables
1.178 rillig 1927:
1928: To catch typos in the shell snippets from the Makefile fragments, add the -u
1929: flag to most of the commands by adding this line to mk.conf.
1930:
1931: RUN= @set -eu;
1932:
1.181 rillig 1933: After that, ensure that none of the bulk build log files (even those for
1934: successfully built packages) contains the string parameter not set or whatever
1935: error message the command sh -ceu '$undefined' outputs.
1936:
1.178 rillig 1937: See mk/misc/common.mk for the existing definition.
1938:
1.181 rillig 1939: 8.4.10. Turn off verbose logging
1.178 rillig 1940:
1941: The build logs of a package are often quite long. This allows error messages or
1942: other interesting details to hide between the noise. To make the actual error
1943: message stand out more, add these lines to mk.conf.
1944:
1945: GNU_CONFIGURE_QUIET= yes
1946: MAKE_FLAGS+= -s
1947:
1948: The -s option works for both GNU Make and BSD Make. On exotic platforms with
1949: their own make, it may be a little different.
1950:
1951: 8.5. Creating a multiple CD-ROM packages collection
1.1 dsieger 1952:
1953: After your pkgsrc bulk-build has completed, you may wish to create a CD-ROM set
1954: of the resulting binary packages to assist in installing packages on other
1955: machines. The pkgtools/cdpack package provides a simple tool for creating the
1956: ISO 9660 images. cdpack arranges the packages on the CD-ROMs in a way that
1957: keeps all the dependencies for a given package on the same CD as that package.
1958:
1.178 rillig 1959: 8.5.1. Example of cdpack
1.1 dsieger 1960:
1961: Complete documentation for cdpack is found in the cdpack(1) man page. The
1962: following short example assumes that the binary packages are left in /usr/
1963: pkgsrc/packages/All and that sufficient disk space exists in /u2 to hold the
1964: ISO 9660 images.
1965:
1966: # mkdir /u2/images
1967: # pkg_add /usr/pkgsrc/packages/All/cdpack
1968: # cdpack /usr/pkgsrc/packages/All /u2/images
1969:
1970:
1971: If you wish to include a common set of files (COPYRIGHT, README, etc.) on each
1972: CD in the collection, then you need to create a directory which contains these
1.175 gutterid 1973: files, e.g.:
1.1 dsieger 1974:
1975: # mkdir /tmp/common
1976: # echo "This is a README" > /tmp/common/README
1977: # echo "Another file" > /tmp/common/COPYING
1978: # mkdir /tmp/common/bin
1979: # echo "#!/bin/sh" > /tmp/common/bin/myscript
1980: # echo "echo Hello world" >> /tmp/common/bin/myscript
1981: # chmod 755 /tmp/common/bin/myscript
1982:
1983:
1984: Now create the images:
1985:
1986: # cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images
1987:
1988: Each image will contain README, COPYING, and bin/myscript in their root
1989: directories.
1990:
1.154 rillig 1991: Chapter 9. Directory layout of the installed files
1.1 dsieger 1992:
1993: Table of Contents
1994:
1.154 rillig 1995: 9.1. File system layout in ${LOCALBASE}
1996: 9.2. File system layout in ${VARBASE}
1.1 dsieger 1997:
1998: The files that are installed by pkgsrc are organized in a way that is similar
1999: to what you find in the /usr directory of the base system. But some details are
2000: different. This is because pkgsrc initially came from FreeBSD and had adopted
2001: its file system hierarchy. Later it was largely influenced by NetBSD. But no
2002: matter which operating system you are using pkgsrc with, you can expect the
2003: same layout for pkgsrc.
2004:
2005: There are mainly four root directories for pkgsrc, which are all configurable
2006: in the bootstrap/bootstrap script. When pkgsrc has been installed as root, the
2007: default locations are:
2008:
2009: LOCALBASE= /usr/pkg
2010: PKG_SYSCONFBASE= /usr/pkg/etc
2011: VARBASE= /var
1.119 sevan 2012: PKG_DBDIR= /usr/pkg/pkgdb
1.1 dsieger 2013:
2014: In unprivileged mode (when pkgsrc has been installed as any other user), the
2015: default locations are:
2016:
2017: LOCALBASE= ${HOME}/pkg
2018: PKG_SYSCONFBASE= ${HOME}/pkg/etc
2019: VARBASE= ${HOME}/pkg/var
1.119 sevan 2020: PKG_DBDIR= ${HOME}/pkg/pkgdb
1.1 dsieger 2021:
2022: What these four directories are for, and what they look like is explained
2023: below.
2024:
1.25 wiz 2025: * LOCALBASE corresponds to the /usr directory in the base system. It is the "
2026: main" directory where the files are installed and contains the well-known
1.1 dsieger 2027: subdirectories like bin, include, lib, share and sbin.
2028:
2029: * VARBASE corresponds to /var in the base system. Some programs (especially
2030: games, network daemons) need write access to it during normal operation.
2031:
2032: * PKG_SYSCONFDIR corresponds to /etc in the base system. It contains
2033: configuration files of the packages, as well as pkgsrc's mk.conf itself.
2034:
1.154 rillig 2035: 9.1. File system layout in ${LOCALBASE}
1.1 dsieger 2036:
2037: The following directories exist in a typical pkgsrc installation in $
2038: {LOCALBASE}.
2039:
2040: bin
2041:
2042: Contains executable programs that are intended to be directly used by the
2043: end user.
2044:
2045: emul
2046:
2047: Contains files for the emulation layers of various other operating systems,
2048: especially for NetBSD.
2049:
2050: etc (the usual location of ${PKG_SYSCONFDIR})
2051:
2052: Contains the configuration files.
2053:
2054: include
2055:
2056: Contains headers for the C and C++ programming languages.
2057:
2058: info
2059:
2060: Contains GNU info files of various packages.
2061:
2062: lib
2063:
2064: Contains shared and static libraries.
2065:
2066: libdata
2067:
2068: Contains data files that don't change after installation. Other data files
2069: belong into ${VARBASE}.
2070:
2071: libexec
2072:
2073: Contains programs that are not intended to be used by end users, such as
2074: helper programs or network daemons.
2075:
2076: libexec/cgi-bin
2077:
2078: Contains programs that are intended to be executed as CGI scripts by a web
2079: server.
2080:
2081: man (the usual value of ${PKGMANDIR})
2082:
2083: Contains brief documentation in form of manual pages.
2084:
2085: sbin
2086:
2087: Contains programs that are intended to be used only by the super-user.
2088:
2089: share
2090:
2091: Contains platform-independent data files that don't change after
2092: installation.
2093:
2094: share/doc
2095:
2096: Contains documentation files provided by the packages.
2097:
2098: share/examples
2099:
2100: Contains example files provided by the packages. Among others, the original
2101: configuration files are saved here and copied to ${PKG_SYSCONFDIR} during
2102: installation.
2103:
2104: share/examples/rc.d
2105:
2106: Contains the original files for rc.d scripts.
2107:
2108: var (the usual location of ${VARBASE})
2109:
2110: Contains files that may be modified after installation.
2111:
1.154 rillig 2112: 9.2. File system layout in ${VARBASE}
1.1 dsieger 2113:
2114: db/pkg (the usual location of ${PKG_DBDIR})
2115:
2116: Contains information about the currently installed packages.
2117:
2118: games
2119:
2120: Contains highscore files.
2121:
2122: log
2123:
2124: Contains log files.
2125:
2126: run
2127:
2128: Contains informational files about daemons that are currently running.
2129:
1.154 rillig 2130: Chapter 10. Frequently Asked Questions
1.1 dsieger 2131:
2132: Table of Contents
2133:
1.154 rillig 2134: 10.1. Are there any mailing lists for pkg-related discussion?
2135: 10.2. Utilities for package management (pkgtools)
2136: 10.3. How to use pkgsrc as non-root
2137: 10.4. How to resume transfers when fetching distfiles?
2138: 10.5. How can I install/use modular X.org from pkgsrc?
2139: 10.6. How to fetch files from behind a firewall
2140: 10.7. How to fetch files from HTTPS sites
2141: 10.8. How do I tell make fetch to do passive FTP?
2142: 10.9. How to fetch all distfiles at once
2143: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
2144: 10.11. What does "Could not find bsd.own.mk" mean?
1.221 nia 2145: 10.12. Using 'sudo' or `priv` with pkgsrc
1.154 rillig 2146: 10.13. How do I change the location of configuration files?
2147: 10.14. Automated security checks
2148: 10.15. Why do some packages ignore my CFLAGS?
2149: 10.16. A package does not build. What shall I do?
2150: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.232 gutterid 2151: conflicts" mean?
1.1 dsieger 2152:
2153: This section contains hints, tips & tricks on special things in pkgsrc that we
2154: didn't find a better place for in the previous chapters, and it contains items
2155: for both pkgsrc users and developers.
2156:
1.154 rillig 2157: 10.1. Are there any mailing lists for pkg-related discussion?
1.1 dsieger 2158:
2159: The following mailing lists may be of interest to pkgsrc users:
2160:
2161: * pkgsrc-users: This is a general purpose list for most issues regarding
2162: pkgsrc, regardless of platform, e.g. soliciting user help for pkgsrc
2163: configuration, unexpected build failures, using particular packages,
2164: upgrading pkgsrc installations, questions regarding the pkgsrc release
2165: branches, etc. General announcements or proposals for changes that impact
2166: the pkgsrc user community, e.g. major infrastructure changes, new features,
2167: package removals, etc., may also be posted.
2168:
2169: * pkgsrc-bulk: A list where the results of pkgsrc bulk builds are sent and
2170: discussed.
2171:
2172: * pkgsrc-changes: This list is for those who are interested in getting a
2173: commit message for every change committed to pkgsrc. It is also available
2174: in digest form, meaning one daily message containing all commit messages
2175: for changes to the package source tree in that 24 hour period.
2176:
2177: To subscribe, do:
2178:
2179: % echo subscribe listname | mail majordomo@NetBSD.org
2180:
1.174 leot 2181: Archives for all these mailing lists are available from https://
1.1 dsieger 2182: mail-index.NetBSD.org/.
2183:
1.154 rillig 2184: 10.2. Utilities for package management (pkgtools)
1.1 dsieger 2185:
2186: The directory pkgsrc/pkgtools contains a number of useful utilities for both
2187: users and developers of pkgsrc. This section attempts only to make the reader
1.121 sevan 2188: aware of some of the utilities and when they might be useful, and not to
2189: duplicate the documentation that comes with each package.
1.1 dsieger 2190:
2191: Utilities used by pkgsrc (automatically installed when needed):
2192:
2193: * pkgtools/x11-links: Symlinks for use by buildlink.
2194:
2195: OS tool augmentation (automatically installed when needed):
2196:
1.121 sevan 2197: * pkgtools/digest: Calculates various kinds of checksums (including SHA3).
1.1 dsieger 2198:
2199: * pkgtools/libnbcompat: Compatibility library for pkgsrc tools.
2200:
2201: * pkgtools/mtree: Installed on non-BSD systems due to lack of native mtree.
2202:
2203: * pkgtools/pkg_install: Up-to-date replacement for /usr/sbin/pkg_install, or
2204: for use on operating systems where pkg_install is not present.
2205:
2206: Utilities used by pkgsrc (not automatically installed):
2207:
2208: * pkgtools/pkg_tarup: Create a binary package from an already-installed
2209: package. Used by make replace to save the old package.
2210:
2211: * pkgtools/dfdisk: Adds extra functionality to pkgsrc, allowing it to fetch
2212: distfiles from multiple locations. It currently supports the following
2213: methods: multiple CD-ROMs and network FTP/HTTP connections.
2214:
2215: * devel/cpuflags: Determine the best compiler flags to optimise code for your
1.24 wiz 2216: current CPU and compiler.
1.1 dsieger 2217:
2218: Utilities for keeping track of installed packages, being up to date, etc:
2219:
1.65 wiz 2220: * pkgtools/pkgin: A package update tool similar to apt(1). Download, install,
2221: and upgrade binary packages easily.
2222:
1.1 dsieger 2223: * pkgtools/pkg_chk: Reports on packages whose installed versions do not match
2224: the latest pkgsrc entries.
2225:
2226: * pkgtools/pkgdep: Makes dependency graphs of packages, to aid in choosing a
2227: strategy for updating.
2228:
2229: * pkgtools/pkgdepgraph: Makes graphs from the output of pkgtools/pkgdep (uses
2230: graphviz).
2231:
1.12 weinem 2232: * pkgtools/pkglint: The pkglint(1) program checks a pkgsrc entry for errors.
2233:
2234: * pkgtools/lintpkgsrc: The lintpkgsrc(1) program does various checks on the
2235: complete pkgsrc system.
1.1 dsieger 2236:
2237: * pkgtools/pkgsurvey: Report what packages you have installed.
2238:
2239: Utilities for people maintaining or creating individual packages:
2240:
2241: * pkgtools/pkgdiff: Automate making and maintaining patches for a package
2242: (includes pkgdiff, pkgvi, mkpatches, etc.).
2243:
1.65 wiz 2244: * pkgtools/url2pkg: Aids in converting to pkgsrc.
1.1 dsieger 2245:
2246: Utilities for people maintaining pkgsrc (or: more obscure pkg utilities)
2247:
2248: * pkgtools/pkg_comp: Build packages in a chrooted area.
2249:
2250: * pkgtools/libkver: Spoof kernel version for chrooted cross builds.
2251:
1.154 rillig 2252: 10.3. How to use pkgsrc as non-root
1.1 dsieger 2253:
1.108 rillig 2254: To install packages from source as a non-root user, download pkgsrc as
1.154 rillig 2255: described in Chapter 3, Where to get pkgsrc and how to keep it up-to-date, cd
1.108 rillig 2256: into that directory and run the command ./bootstrap/bootstrap --unprivileged.
2257:
2258: This will install the binary part of pkgsrc to ~/pkg and put the pkgsrc
2259: configuration mk.conf into ~/pkg/etc.
2260:
2261: For more details, see mk/unprivileged.mk.
1.1 dsieger 2262:
1.154 rillig 2263: 10.4. How to resume transfers when fetching distfiles?
1.1 dsieger 2264:
2265: By default, resuming transfers in pkgsrc is disabled, but you can enable this
1.4 rillig 2266: feature by adding the option PKG_RESUME_TRANSFERS=YES into mk.conf. If, during
2267: a fetch step, an incomplete distfile is found, pkgsrc will try to resume it.
1.1 dsieger 2268:
1.61 wiz 2269: You can also use a different program than the platform default program by
2270: changing the FETCH_USING variable. You can specify the program by using of ftp,
2271: fetch, wget or curl. Alternatively, fetching can be disabled by using the value
2272: manual. A value of custom disables the system defaults and dependency tracking
2273: for the fetch program. In that case you have to provide FETCH_CMD,
2274: FETCH_BEFORE_ARGS, FETCH_RESUME_ARGS, FETCH_OUTPUT_ARGS, FETCH_AFTER_ARGS.
1.1 dsieger 2275:
1.16 jnemeth 2276: For example, if you want to use wget to download, you'll have to use something
2277: like:
1.1 dsieger 2278:
1.16 jnemeth 2279: FETCH_USING= wget
1.1 dsieger 2280:
1.154 rillig 2281: 10.5. How can I install/use modular X.org from pkgsrc?
1.1 dsieger 2282:
1.4 rillig 2283: If you want to use modular X.org from pkgsrc instead of your system's own X11
2284: (/usr/X11R6, /usr/openwin, ...) you will have to add the following line into
1.1 dsieger 2285: mk.conf:
2286:
1.4 rillig 2287: X11_TYPE=modular
1.1 dsieger 2288:
1.154 rillig 2289: 10.6. How to fetch files from behind a firewall
1.1 dsieger 2290:
2291: If you are sitting behind a firewall which does not allow direct connections to
2292: Internet hosts (i.e. non-NAT), you may specify the relevant proxy hosts. This
2293: is done using an environment variable in the form of a URL, e.g. in Amdahl, the
2294: machine "orpheus.amdahl.com" is one of the firewalls, and it uses port 80 as
2295: the proxy port number. So the proxy environment variables are:
2296:
2297: ftp_proxy=ftp://orpheus.amdahl.com:80/
2298: http_proxy=http://orpheus.amdahl.com:80/
2299:
1.154 rillig 2300: 10.7. How to fetch files from HTTPS sites
1.65 wiz 2301:
2302: Some fetch tools are not prepared to support HTTPS by default (for example, the
2303: one in NetBSD 6.0), or the one installed by the pkgsrc bootstrap (to avoid an
2304: openssl dependency that low in the dependency graph).
2305:
2306: Usually you won't notice, because distribution files are mirrored weekly to "
2307: ftp.NetBSD.org", but that might not be often enough if you are following
2308: pkgsrc-current. In that case, set FETCH_USING in your mk.conf file to "curl" or
2309: "wget", which are both compiled with HTTPS support by default. Of course, these
2310: tools need to be installed before you can use them this way.
2311:
1.154 rillig 2312: 10.8. How do I tell make fetch to do passive FTP?
1.1 dsieger 2313:
2314: This depends on which utility is used to retrieve distfiles. From bsd.pkg.mk,
2315: FETCH_CMD is assigned the first available command from the following list:
2316:
2317: * ${LOCALBASE}/bin/ftp
2318:
2319: * /usr/bin/ftp
2320:
2321: On a default NetBSD installation, this will be /usr/bin/ftp, which
2322: automatically tries passive connections first, and falls back to active
2323: connections if the server refuses to do passive. For the other tools, add the
1.4 rillig 2324: following to your mk.conf file: PASSIVE_FETCH=1.
1.1 dsieger 2325:
2326: Having that option present will prevent /usr/bin/ftp from falling back to
2327: active transfers.
2328:
1.154 rillig 2329: 10.9. How to fetch all distfiles at once
1.1 dsieger 2330:
2331: You would like to download all the distfiles in a single batch from work or
2332: university, where you can't run a make fetch. There is an archive of distfiles
2333: on ftp.NetBSD.org, but downloading the entire directory may not be appropriate.
2334:
2335: The answer here is to do a make fetch-list in /usr/pkgsrc or one of its
2336: subdirectories, carry the resulting list to your machine at work/school and use
2337: it there. If you don't have a NetBSD-compatible ftp(1) (like tnftp) at work,
2338: don't forget to set FETCH_CMD to something that fetches a URL:
2339:
2340: At home:
2341:
2342: % cd /usr/pkgsrc
2343: % make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh
2344: % scp /tmp/fetch.sh work:/tmp
2345:
2346: At work:
2347:
2348: % sh /tmp/fetch.sh
2349:
2350: then tar up /tmp/distfiles and take it home.
2351:
2352: If you have a machine running NetBSD, and you want to get all distfiles (even
2353: ones that aren't for your machine architecture), you can do so by using the
2354: above-mentioned make fetch-list approach, or fetch the distfiles directly by
2355: running:
2356:
2357: % make mirror-distfiles
2358:
2359: If you even decide to ignore NO_{SRC,BIN}_ON_{FTP,CDROM}, then you can get
2360: everything by running:
2361:
2362: % make fetch NO_SKIP=yes
2363:
1.154 rillig 2364: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
1.1 dsieger 2365:
2366: When compiling the pkgtools/pkg_install package, you get the error from make
2367: that it doesn't know how to make /usr/share/tmac/tmac.andoc? This indicates
2368: that you don't have installed the "text" set (nroff, ...) from the NetBSD base
2369: distribution on your machine. It is recommended to do that to format man pages.
2370:
2371: In the case of the pkgtools/pkg_install package, you can get away with setting
1.4 rillig 2372: NOMAN=YES either in the environment or in mk.conf.
1.1 dsieger 2373:
1.154 rillig 2374: 10.11. What does "Could not find bsd.own.mk" mean?
1.1 dsieger 2375:
2376: You didn't install the compiler set, comp.tgz, when you installed your NetBSD
2377: machine. Please get and install it, by extracting it in /:
2378:
2379: # cd /
2380: # tar --unlink -zxvpf .../comp.tgz
2381:
2382: comp.tgz is part of every NetBSD release. Get the one that corresponds to your
2383: release (determine via uname -r).
2384:
1.221 nia 2385: 10.12. Using 'sudo' or `priv` with pkgsrc
1.1 dsieger 2386:
2387: When installing packages as non-root user and using the just-in-time su(1)
2388: feature of pkgsrc, it can become annoying to type in the root password for each
2389: required package installed. To avoid this, the sudo package can be used, which
1.221 nia 2390: does password caching over a limited time. To use it, install sudo or priv
2391: (either as binary package, from security/priv, or security/sudo) and then put
2392: the following into your mk.conf, somewhere after the definition of the
2393: LOCALBASE variable:
1.1 dsieger 2394:
2395: .if exists(${LOCALBASE}/bin/sudo)
2396: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
2397: .endif
2398:
1.154 rillig 2399: 10.13. How do I change the location of configuration files?
1.1 dsieger 2400:
2401: As the system administrator, you can choose where configuration files are
2402: installed. The default settings make all these files go into ${PREFIX}/etc or
2403: some of its subdirectories; this may be suboptimal depending on your
2404: expectations (e.g., a read-only, NFS-exported PREFIX with a need of per-machine
2405: configuration of the provided packages).
2406:
2407: In order to change the defaults, you can modify the PKG_SYSCONFBASE variable
1.4 rillig 2408: (in mk.conf) to point to your preferred configuration directory; some common
2409: examples include /etc or /etc/pkg.
1.1 dsieger 2410:
2411: Furthermore, you can change this value on a per-package basis by setting the
2412: PKG_SYSCONFDIR.${PKG_SYSCONFVAR} variable. PKG_SYSCONFVAR's value usually
2413: matches the name of the package you would like to modify, that is, the contents
2414: of PKGBASE.
2415:
2416: Note that after changing these settings, you must rebuild and reinstall any
2417: affected packages.
2418:
1.154 rillig 2419: 10.14. Automated security checks
1.1 dsieger 2420:
2421: Please be aware that there can often be bugs in third-party software, and some
2422: of these bugs can leave a machine vulnerable to exploitation by attackers. In
2423: an effort to lessen the exposure, the NetBSD packages team maintains a database
2424: of known-exploits to packages which have at one time been included in pkgsrc.
2425: The database can be downloaded automatically, and a security audit of all
1.14 jmcneill 2426: packages installed on a system can take place. To do this, refer to the
2427: following two tools (installed as part of the pkgtools/pkg_install package):
1.1 dsieger 2428:
1.21 snj 2429: 1. pkg_admin fetch-pkg-vulnerabilities, an easy way to download a list of the
2430: security vulnerabilities information. This list is kept up to date by the
1.26 spz 2431: pkgsrc security team, and is distributed from the NetBSD ftp server:
1.1 dsieger 2432:
1.177 leot 2433: https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities
1.1 dsieger 2434:
1.21 snj 2435: 2. pkg_admin audit, an easy way to audit the current machine, checking each
1.24 wiz 2436: known vulnerability. If a vulnerable package is installed, it will be shown
2437: by output to stdout, including a description of the type of vulnerability,
2438: and a URL containing more information.
1.1 dsieger 2439:
1.202 nia 2440: Use of these tools is strongly recommended! See Section 5.1.6, "Checking for
1.121 sevan 2441: security vulnerabilities in installed packages" for instructions on how to
2442: automate checking and reporting.
2443:
2444: If this database is installed, pkgsrc builds will use it to perform a security
2445: check before building any package.
1.1 dsieger 2446:
1.154 rillig 2447: 10.15. Why do some packages ignore my CFLAGS?
1.1 dsieger 2448:
2449: When you add your own preferences to the CFLAGS variable in your mk.conf, these
2450: flags are passed in environment variables to the ./configure scripts and to
2451: make(1). Some package authors ignore the CFLAGS from the environment variable
2452: by overriding them in the Makefiles of their package.
2453:
2454: Currently there is no solution to this problem. If you really need the package
2455: to use your CFLAGS you should run make patch in the package directory and then
2456: inspect any Makefile and Makefile.in for whether they define CFLAGS explicitly.
2457: Usually you can remove these lines. But be aware that some "smart" programmers
2458: write so bad code that it only works for the specific combination of CFLAGS
2459: they have chosen.
2460:
1.172 rillig 2461: To find out where the CFLAGS are ignored, add the following lines to mk.conf:
2462:
2463: CPPFLAGS+= -Dpkgsrc___CPPFLAGS
2464: CFLAGS+= -Dpkgsrc___CFLAGS
2465: CXXFLAGS+= -Dpkgsrc___CXXFLAGS
2466:
2467: Then run bmake show-all-configure show-all-build to see whether the above flags
2468: are passed to the actual build commands in general.
2469:
2470: To find out whether the flags are passed to individual compiler commands, have
2471: a look at the file work/.work.log. In most cases, the flags from the original
2472: command lines (the lines starting with [*]) are passed unmodified to the actual
2473: compiler (the lines starting with <.>). If the flag is missing from the actual
2474: compiler command, it must have been removed by the pkgsrc compiler wrappers.
2475:
1.154 rillig 2476: 10.16. A package does not build. What shall I do?
1.1 dsieger 2477:
2478: 1. Make sure that your copy of pkgsrc is consistent. A case that occurs often
2479: is that people only update pkgsrc in parts, because of performance reasons.
2480: Since pkgsrc is one large system, not a collection of many small systems,
2481: there are sometimes changes that only work when the whole pkgsrc tree is
2482: updated.
2483:
1.25 wiz 2484: 2. Make sure that you don't have any CVS conflicts. Search for "<<<<<<" or "
2485: >>>>>>" in all your pkgsrc files.
1.1 dsieger 2486:
1.25 wiz 2487: 3. Make sure that you don't have old copies of the packages extracted. Run
1.1 dsieger 2488: make clean clean-depends to verify this.
2489:
1.108 rillig 2490: 4. If you are a package developer who wants to invest some work, have a look
1.154 rillig 2491: at Chapter 21, Making your package work.
1.108 rillig 2492:
2493: 5. If the problem still exists, write a mail to the pkgsrc-users mailing list.
1.1 dsieger 2494:
1.154 rillig 2495: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.1 dsieger 2496: conflicts" mean?
2497:
2498: You have modified a file from pkgsrc, and someone else has modified that same
2499: file afterwards in the CVS repository. Both changes are in the same region of
2500: the file, so when you updated pkgsrc, the cvs command marked the conflicting
2501: changes in the file. Because of these markers, the file is no longer a valid
2502: Makefile.
2503:
2504: Have a look at that file, and if you don't need your local changes anymore, you
2505: can remove that file and run cvs -q update -dP in that directory to download
2506: the current version.
2507:
2508: Part II. The pkgsrc developer's guide
2509:
2510: This part of the book deals with creating and modifying packages. It starts
2511: with a "HOWTO"-like guide on creating a new package. The remaining chapters are
2512: more like a reference manual for pkgsrc.
2513:
2514: Table of Contents
2515:
1.154 rillig 2516: 11. Getting help
1.184 rillig 2517: 12. Package components - files, directories and contents
2518: 12.1. Makefile
2519: 12.2. distinfo
2520: 12.3. patches/*
2521: 12.3.1. Structure of a single patch file
2522: 12.3.2. Creating patch files
2523: 12.3.3. Sources where the patch files come from
2524: 12.3.4. Patching guidelines
2525: 12.3.5. Feedback to the author
2526: 12.4. Other mandatory files
2527: 12.5. Optional files
2528: 12.5.1. Files affecting the binary package
2529: 12.5.2. Files affecting the build process
2530: 12.5.3. Files affecting nothing at all
2531: 12.6. work*
2532: 12.7. files/*
2533: 13. The build process
2534: 13.1. Introduction
2535: 13.2. Program location
2536: 13.3. Directories used during the build process
2537: 13.4. Running a phase
2538: 13.5. The fetch phase
2539: 13.5.1. What to fetch and where to get it from
2540: 13.5.2. How are the files fetched?
2541: 13.6. The checksum phase
2542: 13.7. The extract phase
2543: 13.8. The patch phase
2544: 13.9. The tools phase
2545: 13.10. The wrapper phase
2546: 13.11. The configure phase
2547: 13.12. The build phase
2548: 13.13. The test phase
2549: 13.14. The install phase
2550: 13.15. The package phase
2551: 13.16. Cleaning up
2552: 13.17. Other helpful targets
2553: 14. Creating a new pkgsrc package from scratch
2554: 14.1. Common types of packages
1.219 nia 2555: 14.1.1. Python modules and programs
2556: 14.1.2. R packages
2557: 14.1.3. TeXlive packages
1.184 rillig 2558: 14.2. Examples
2559: 14.2.1. How the www/nvu package came into pkgsrc
2560: 15. Programming in Makefiles
2561: 15.1. Caveats
2562: 15.2. Makefile variables
2563: 15.2.1. Naming conventions
2564: 15.3. Code snippets
2565: 15.3.1. Adding things to a list
2566: 15.3.2. Echoing a string exactly as-is
2567: 15.3.3. Passing CFLAGS to GNU configure scripts
2568: 15.3.4. Handling possibly empty variables
1.229 gutterid 2569: 15.3.5. Testing yes/no variables in conditions
1.184 rillig 2570: 16. Options handling
2571: 16.1. Global default options
2572: 16.2. Converting packages to use bsd.options.mk
2573: 16.3. Option Names
2574: 16.4. Determining the options of dependencies
2575: 17. Tools needed for building or running
2576: 17.1. Tools for pkgsrc builds
2577: 17.2. Tools needed by packages
2578: 17.3. Tools provided by platforms
2579: 18. Buildlink methodology
2580: 18.1. Converting packages to use buildlink3
2581: 18.2. Writing buildlink3.mk files
2582: 18.2.1. Anatomy of a buildlink3.mk file
2583: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.
1.232 gutterid 2584: pkg in buildlink3.mk files
1.184 rillig 2585: 18.3. Writing builtin.mk files
2586: 18.3.1. Anatomy of a builtin.mk file
2587: 18.3.2. Global preferences for native or pkgsrc software
2588: 19. PLIST issues
2589: 19.1. RCS ID
2590: 19.2. Semi-automatic PLIST generation
2591: 19.3. Tweaking output of make print-PLIST
2592: 19.4. Variable substitution in PLIST
2593: 19.5. Man page compression
2594: 19.6. Changing PLIST source with PLIST_SRC
2595: 19.7. Platform-specific and differing PLISTs
2596: 19.8. Build-specific PLISTs
2597: 19.9. Sharing directories between packages
2598: 20. The pkginstall framework
2599: 20.1. Files and directories outside the installation prefix
2600: 20.1.1. Directory manipulation
2601: 20.1.2. File manipulation
2602: 20.2. Configuration files
2603: 20.2.1. How PKG_SYSCONFDIR is set
2604: 20.2.2. Telling the software where configuration files are
1.239 ! dholland 2605: 20.2.3. Patching installation
! 2606: 20.2.4. Declaring configuration files
! 2607: 20.2.5. Disabling handling of configuration files
1.184 rillig 2608: 20.3. System startup scripts
2609: 20.3.1. Disabling handling of system startup scripts
2610: 20.4. System users and groups
2611: 20.5. System shells
2612: 20.5.1. Disabling shell registration
2613: 20.6. Fonts
2614: 20.6.1. Disabling automatic update of the fonts databases
1.154 rillig 2615: 21. Making your package work
2616: 21.1. General operation
2617: 21.1.1. How to pull in user-settable variables from mk.conf
2618: 21.1.2. User interaction
2619: 21.1.3. Handling licenses
2620: 21.1.4. Restricted packages
2621: 21.1.5. Handling dependencies
2622: 21.1.6. Handling conflicts with other packages
2623: 21.1.7. Packages that cannot or should not be built
2624: 21.1.8. Packages which should not be deleted, once installed
2625: 21.1.9. Handling packages with security problems
2626: 21.1.10. How to handle incrementing versions when fixing an existing
1.232 gutterid 2627: package
1.154 rillig 2628: 21.1.11. Substituting variable text in the package files (the SUBST
1.232 gutterid 2629: framework)
1.154 rillig 2630: 21.2. The fetch phase
2631: 21.2.1. Packages whose distfiles aren't available for plain downloading
2632: 21.2.2. How to handle modified distfiles with the 'old' name
2633: 21.2.3. Packages hosted on github.com
2634: 21.3. The configure phase
2635: 21.3.1. Shared libraries - libtool
2636: 21.3.2. Using libtool on GNU packages that already support libtool
2637: 21.3.3. GNU Autoconf/Automake
1.223 nia 2638: 21.3.4. Meson / ninja
1.154 rillig 2639: 21.4. Programming languages
2640: 21.4.1. C, C++, and Fortran
2641: 21.4.2. Java
1.205 wiz 2642: 21.4.3. Go
1.223 nia 2643: 21.4.4. Rust
2644: 21.4.5. Packages containing Perl scripts
2645: 21.4.6. Packages containing shell scripts
2646: 21.4.7. Other programming languages
1.154 rillig 2647: 21.5. The build phase
2648: 21.5.1. Compiling C and C++ code conditionally
2649: 21.5.2. How to handle compiler bugs
1.172 rillig 2650: 21.5.3. No such file or directory
2651: 21.5.4. Undefined reference to "..."
2652: 21.5.5. Running out of memory
1.154 rillig 2653: 21.6. The install phase
2654: 21.6.1. Creating needed directories
2655: 21.6.2. Where to install documentation
2656: 21.6.3. Installing highscore files
2657: 21.6.4. Adding DESTDIR support to packages
2658: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 2659: 21.6.6. Packages installing Perl modules
1.154 rillig 2660: 21.6.7. Packages installing info files
2661: 21.6.8. Packages installing man pages
1.203 nia 2662: 21.6.9. Packages installing X11 fonts
2663: 21.6.10. Packages installing SGML or XML data
2664: 21.6.11. Packages installing extensions to the MIME database
2665: 21.6.12. Packages using intltool
2666: 21.6.13. Packages installing startup scripts
2667: 21.6.14. Packages installing TeX modules
2668: 21.6.15. Packages supporting running binaries in emulation
2669: 21.6.16. Packages installing hicolor icons
2670: 21.6.17. Packages installing desktop files
1.154 rillig 2671: 21.7. Marking packages as having problems
1.184 rillig 2672: 22. GNOME packaging and porting
2673: 22.1. Meta packages
2674: 22.2. Packaging a GNOME application
2675: 22.3. Updating GNOME to a newer version
2676: 22.4. Patching guidelines
1.154 rillig 2677: 23. Submitting and Committing
2678: 23.1. Submitting binary packages
2679: 23.2. Submitting source packages (for non-NetBSD-developers)
2680: 23.3. General notes when adding, updating, or removing packages
2681: 23.4. Commit Messages
2682: 23.5. Committing: Adding a package to CVS
2683: 23.6. Updating a package to a newer version
2684: 23.7. Renaming a package in pkgsrc
2685: 23.8. Moving a package in pkgsrc
2686: 24. Frequently Asked Questions
2687:
2688: Chapter 11. Getting help
2689:
2690: To get help when developing pkgsrc, the definitive source is this document, the
2691: pkgsrc guide. If you don't find anything here, there are alternatives:
2692:
2693: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
2694: Run bmake help topic=? to get help for any topic, such as a variable name
2695: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
2696: like strcasecmp or any other topic.
2697:
1.207 leot 2698: The available help topics are listed in Appendix E, Help topics.
1.154 rillig 2699:
1.163 rillig 2700: * To see the value of a single variable, run bmake show-var VARNAME=X.
2701:
2702: * To see the values of the most common variables, run bmake show-all. These
2703: variables are grouped by topic. To see the variables for a single topic,
2704: run bmake show-all-topic, for example bmake show-all-fetch.
2705:
1.154 rillig 2706: * The tech-pkg mailing list, to which you can subscribe and then ask your
2707: questions.
2708:
2709: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
2710: a specialized chat program such as XChat. Pick any user name and join the
2711: channel #pkgsrc.
1.1 dsieger 2712:
1.184 rillig 2713: Chapter 12. Package components - files, directories and contents
1.1 dsieger 2714:
2715: Table of Contents
2716:
1.184 rillig 2717: 12.1. Makefile
2718: 12.2. distinfo
2719: 12.3. patches/*
2720: 12.3.1. Structure of a single patch file
2721: 12.3.2. Creating patch files
2722: 12.3.3. Sources where the patch files come from
2723: 12.3.4. Patching guidelines
2724: 12.3.5. Feedback to the author
2725: 12.4. Other mandatory files
2726: 12.5. Optional files
2727: 12.5.1. Files affecting the binary package
2728: 12.5.2. Files affecting the build process
2729: 12.5.3. Files affecting nothing at all
2730: 12.6. work*
2731: 12.7. files/*
1.1 dsieger 2732:
1.184 rillig 2733: Whenever you're preparing a package, there are a number of files involved which
2734: are described in the following sections.
1.1 dsieger 2735:
1.184 rillig 2736: 12.1. Makefile
1.1 dsieger 2737:
1.184 rillig 2738: Building, installation and creation of a binary package are all controlled by
2739: the package's Makefile. The Makefile describes various things about a package,
2740: for example from where to get it, how to configure, build, and install it.
1.1 dsieger 2741:
1.184 rillig 2742: A package Makefile contains several sections that describe the package.
1.1 dsieger 2743:
1.184 rillig 2744: In the first section there are the following variables, which should appear
2745: exactly in the order given here. The order and grouping of the variables is
2746: mostly historical and has no further meaning.
1.1 dsieger 2747:
1.184 rillig 2748: * DISTNAME is the basename of the distribution file to be downloaded from the
2749: package's website.
1.1 dsieger 2750:
1.184 rillig 2751: * PKGNAME is the name of the package, as used by pkgsrc. You need to provide
2752: it if DISTNAME (which is the default) is not a good name for the package in
2753: pkgsrc or DISTNAME is not provided (no distribution file is required).
2754: Usually it is the pkgsrc directory name together with the version number.
2755: It must match the regular expression ^[A-Za-z0-9][A-Za-z0-9-_.+]*$, that
2756: is, it starts with a letter or digit, and contains only letters, digits,
1.204 nia 2757: dashes, underscores, dots and plus signs. New packages should have entirely
2758: lower-case names, with the exception of some that must follow pre-existing
2759: conventions (e.g. R packages begin with R-). You can use the :tl variable
2760: modifier to lower-case the package name.
1.26 spz 2761:
1.184 rillig 2762: * CATEGORIES is a list of categories which the package fits in. You can
2763: choose any of the top-level directories of pkgsrc for it.
1.1 dsieger 2764:
1.184 rillig 2765: Currently the following values are available for CATEGORIES. If more than
2766: one is used, they need to be separated by spaces:
1.1 dsieger 2767:
1.184 rillig 2768: archivers cross geography meta-pkgs security
2769: audio databases graphics misc shells
2770: benchmarks devel ham multimedia sysutils
2771: biology editors inputmethod net textproc
2772: cad emulators lang news time
2773: chat finance mail parallel wm
2774: comms fonts math pkgtools www
2775: converters games mbone print x11
1.1 dsieger 2776:
1.184 rillig 2777: * MASTER_SITES, DYNAMIC_MASTER_SITES, DIST_SUBDIR, EXTRACT_SUFX and DISTFILES
2778: are discussed in detail in Section 13.5, "The fetch phase".
1.1 dsieger 2779:
1.184 rillig 2780: The second section contains information about separately downloaded patches, if
2781: any.
1.1 dsieger 2782:
1.184 rillig 2783: * PATCHFILES: Name(s) of additional files that contain distribution patches.
2784: There is no default. pkgsrc will look for them at PATCH_SITES. They will
2785: automatically be uncompressed before patching if the names end with .gz or
2786: .Z.
1.1 dsieger 2787:
1.184 rillig 2788: * PATCH_SITES: Primary location(s) for distribution patch files (see
2789: PATCHFILES above) if not found locally.
1.1 dsieger 2790:
1.184 rillig 2791: * PATCH_DIST_STRIP: an argument to patch(1) that sets the pathname strip
2792: count to help find the correct files to patch. It defaults to -p0.
1.1 dsieger 2793:
1.184 rillig 2794: The third section contains the following variables.
1.1 dsieger 2795:
1.184 rillig 2796: * MAINTAINER is the email address of the person who feels responsible for
2797: this package, and who is most likely to look at problems or questions
2798: regarding this package which have been reported with send-pr(1). Other
2799: developers may contact the MAINTAINER before making changes to the package,
2800: but are not required to do so. When packaging a new program, set MAINTAINER
2801: to yourself. If you really can't maintain the package for future updates,
2802: set it to <pkgsrc-users@NetBSD.org>.
1.1 dsieger 2803:
1.184 rillig 2804: * OWNER should be used instead of MAINTAINER when you do not want other
2805: developers to update or change the package without contacting you first. A
2806: package Makefile should contain one of MAINTAINER or OWNER, but not both.
1.1 dsieger 2807:
1.184 rillig 2808: * HOMEPAGE is a URL where users can find more information about the package.
1.1 dsieger 2809:
1.184 rillig 2810: * COMMENT is a one-line description of the package (should not include the
2811: package name).
1.1 dsieger 2812:
1.184 rillig 2813: * LICENSE indicates the license(s) applicable for the package. See
2814: Section 21.1.3, "Handling licenses" for further details.
1.1 dsieger 2815:
1.184 rillig 2816: Other variables that affect the build:
1.1 dsieger 2817:
1.184 rillig 2818: * WRKSRC: The directory where the interesting distribution files of the
2819: package are found. The default is ${WRKDIR}/${DISTNAME}, which works for
2820: most packages.
1.1 dsieger 2821:
1.184 rillig 2822: If a package doesn't create a subdirectory for itself (most GNU software
2823: does, for instance), but extracts itself in the current directory, you
2824: should set WRKSRC=${WRKDIR}.
1.1 dsieger 2825:
1.184 rillig 2826: If a package doesn't create a subdirectory with the name of DISTNAME but
2827: some different name, set WRKSRC to point to the proper name in ${WRKDIR},
2828: for example WRKSRC=${WRKDIR}/${DISTNAME}/unix. See lang/tcl and x11/tk for
2829: other examples.
1.17 imil 2830:
1.184 rillig 2831: The name of the working directory created by pkgsrc is taken from the
2832: WRKDIR_BASENAME variable. By default, its value is work. If you want to use
2833: the same pkgsrc tree for building different kinds of binary packages, you
2834: can change the variable according to your needs. Two other variables handle
2835: common cases of setting WRKDIR_BASENAME individually. If OBJHOSTNAME is
2836: defined in mk.conf, the first component of the host's name is attached to
2837: the directory name. If OBJMACHINE is defined, the platform name is
2838: attached, which might look like work.i386 or work.sparc.
1.17 imil 2839:
1.184 rillig 2840: Please pay attention to the following gotchas:
1.17 imil 2841:
1.184 rillig 2842: * Add MANCOMPRESSED if man pages are installed in compressed form by the
2843: package. For packages using BSD-style makefiles which honor MANZ, there is
2844: MANCOMPRESSED_IF_MANZ.
1.17 imil 2845:
1.184 rillig 2846: * Replace /usr/local with "${PREFIX}" in all files (see patches, below).
1.103 wiz 2847:
1.184 rillig 2848: * If the package installs any info files, see Section 21.6.7, "Packages
2849: installing info files".
1.103 wiz 2850:
1.184 rillig 2851: 12.2. distinfo
1.17 imil 2852:
1.184 rillig 2853: The distinfo file contains the message digest, or checksum, of each distfile
2854: needed for the package. This ensures that the distfiles retrieved from the
2855: Internet have not been corrupted during transfer or altered by a malign force
2856: to introduce a security hole. To provide maximum security, all distfiles are
2857: protected using three different message digest algorithms (SHA1, RMD160,
2858: SHA512), as well as the file size.
1.17 imil 2859:
1.184 rillig 2860: The distinfo file also contains the checksums for all the patches found in the
2861: patches directory (see Section 12.3, "patches/*"). These checksums ensure that
2862: patches are only applied intentionally and that they don't accidentally change,
2863: e.g. when merging different changes together. They also make sure that new
2864: patches are actually added to CVS and old ones are removed. Too see whether the
2865: patches and the distinfo file match, run pkglint after changing the patches.
1.17 imil 2866:
1.184 rillig 2867: To regenerate the distinfo file, use the make distinfo command.
1.17 imil 2868:
1.184 rillig 2869: Some packages have different sets of distfiles depending on the platform, for
2870: example lang/openjdk8. These are kept in the same distinfo file and care should
2871: be taken when upgrading such a package to ensure distfile information is not
2872: lost.
1.17 imil 2873:
1.184 rillig 2874: 12.3. patches/*
1.63 wiz 2875:
1.184 rillig 2876: Some packages don't work out-of-the box on the various platforms that are
2877: supported by pkgsrc. These packages need to be patched to make them work. The
2878: patch files can be found in the patches/ directory.
1.17 imil 2879:
1.184 rillig 2880: In the patch phase, these patches are applied to the files in WRKSRC directory
2881: after extracting them, in alphabetic order.
1.160 brook 2882:
1.184 rillig 2883: 12.3.1. Structure of a single patch file
1.160 brook 2884:
1.184 rillig 2885: The patch-* files should be in diff -bu format, and apply without a fuzz to
2886: avoid problems. (To force patches to apply with fuzz you can set
2887: PATCH_FUZZ_FACTOR=-F2). Furthermore, each patch should contain only changes for
2888: a single file, and no file should be patched by more than one patch file. This
2889: helps to keep future modifications simple.
1.160 brook 2890:
1.184 rillig 2891: Each patch file is structured as follows: In the first line, there is the RCS
2892: Id of the patch itself. The second line should be empty for aesthetic reasons.
2893: After that, there should be a comment for each change that the patch does.
2894: There are a number of standard cases:
1.160 brook 2895:
1.184 rillig 2896: * Patches for commonly known vulnerabilities should mention the vulnerability
2897: ID (CAN, CVE).
1.160 brook 2898:
1.184 rillig 2899: * Patches that change source code should mention the platform and other
2900: environment (for example, the compiler) that the patch is needed for.
1.160 brook 2901:
1.184 rillig 2902: The patch should be commented so that any developer who knows the code of the
2903: application can make some use of the patch. Special care should be taken for
2904: the upstream developers, since we generally want that they accept our patches,
2905: so we have less work in the future.
1.160 brook 2906:
1.184 rillig 2907: 12.3.2. Creating patch files
1.160 brook 2908:
1.184 rillig 2909: One important thing to mention is to pay attention that no RCS IDs get stored
2910: in the patch files, as these will cause problems when later checked into the
2911: NetBSD CVS tree. Use the pkgdiff command from the pkgtools/pkgdiff package to
2912: avoid these problems.
1.160 brook 2913:
1.184 rillig 2914: For even more automation, we recommend using mkpatches from the same package to
1.222 gutterid 2915: make a whole set of patches. You just have to back up files before you edit
2916: them to filename.orig, e.g., with cp -p filename filename.orig or, easier, by
2917: using pkgvi again from the same package. If you upgrade a package this way, you
2918: can easily compare the new set of patches with the previously existing one with
1.184 rillig 2919: patchdiff. The files in patches are replaced by new files, so carefully check
2920: if you want to take all the changes.
1.160 brook 2921:
1.184 rillig 2922: When you have finished a package, remember to generate the checksums for the
2923: patch files by using the make makepatchsum command, see Section 12.2,
2924: "distinfo".
1.1 dsieger 2925:
1.184 rillig 2926: When adding a patch that corrects a problem in the distfile (rather than e.g.
2927: enforcing pkgsrc's view of where man pages should go), send the patch as a bug
2928: report to the maintainer. This benefits non-pkgsrc users of the package, and
2929: usually makes it possible to remove the patch in future version.
1.1 dsieger 2930:
1.184 rillig 2931: The file names of the patch files are usually of the form patch-
2932: path_to_file__with__underscores.c. Many packages still use the previous
2933: convention patch-[a-z][a-z], but new patches should be of the form containing
2934: the filename. mkpatches included in pkgtools/pkgdiff takes care of the name
2935: automatically.
1.1 dsieger 2936:
1.222 gutterid 2937: When updating pre-existing patch files, if a file uses the old patch-[a-z][a-z]
2938: convention, it's best not to change it to the new form, as that will just cause
2939: churn that makes it harder to track changes to patching over time. Similarly,
2940: if a patch now applies at different line offsets, but still applies cleanly
2941: as-is, there's no need to update it, as that also unnecessarily complicates the
2942: patch history.
2943:
1.184 rillig 2944: 12.3.3. Sources where the patch files come from
1.1 dsieger 2945:
1.184 rillig 2946: If you want to share patches between multiple packages in pkgsrc, e.g. because
2947: they use the same distfiles, set PATCHDIR to the path where the patch files can
2948: be found, e.g.:
1.1 dsieger 2949:
1.184 rillig 2950: PATCHDIR= ../../editors/xemacs/patches
1.1 dsieger 2951:
1.184 rillig 2952: Patch files that are distributed by the author or other maintainers can be
2953: listed in PATCHFILES.
1.1 dsieger 2954:
1.184 rillig 2955: If it is desired to store any patches that should not be committed into pkgsrc,
2956: they can be kept outside the pkgsrc tree in the $LOCALPATCHES directory. The
2957: directory tree there is expected to have the same "category/package" structure
2958: as pkgsrc, and patches are expected to be stored inside these dirs (also known
2959: as $LOCALPATCHES/$PKGPATH). For example, if you want to keep a private patch
2960: for pkgsrc/graphics/png, keep it in $LOCALPATCHES/graphics/png/mypatch. All
2961: files in the named directory are expected to be patch files, and they are
2962: applied after pkgsrc patches are applied.
1.1 dsieger 2963:
1.184 rillig 2964: 12.3.4. Patching guidelines
1.1 dsieger 2965:
1.184 rillig 2966: When fixing a portability issue in the code do not use preprocessor magic to
2967: check for the current operating system nor platform. Doing so hurts portability
2968: to other platforms because the OS-specific details are not abstracted
2969: appropriately.
1.1 dsieger 2970:
1.184 rillig 2971: The general rule to follow is: instead of checking for the operating system the
2972: application is being built on, check for the specific features you need. For
2973: example, instead of assuming that kqueue is available under NetBSD and using
2974: the __NetBSD__ macro to conditionalize kqueue support, add a check that detects
1.198 leot 2975: kqueue itself -- yes, this generally involves patching the configure script.
1.184 rillig 2976: There is absolutely nothing that prevents some OSes from adopting interfaces
2977: from other OSes (e.g. Linux implementing kqueue), something that the above
2978: checks cannot take into account.
1.1 dsieger 2979:
1.184 rillig 2980: Of course, checking for features generally involves more work on the
2981: developer's side, but the resulting changes are cleaner and there are chances
2982: they will work on many other platforms. Not to mention that there are higher
2983: chances of being later integrated into the mainstream sources. Remember: It
2984: doesn't work unless it is right!
1.1 dsieger 2985:
1.184 rillig 2986: Some typical examples:
1.121 sevan 2987:
1.184 rillig 2988: Table 12.1. Patching examples
1.1 dsieger 2989:
1.184 rillig 2990: +-------------------------------------------------------------------------------------------+
2991: | Where | Incorrect | Correct |
2992: |---------+--------------------------+------------------------------------------------------|
2993: | |case ${target_os} in | |
2994: |configure|netbsd*) have_kvm=yes ;; |AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)|
2995: |script |*) have_kvm=no ;; | |
2996: | |esac | |
2997: |---------+--------------------------+------------------------------------------------------|
2998: |C source |#if defined(__NetBSD__) |#if defined(HAVE_SYS_EVENT_H) |
2999: |file |# include <sys/event.h> |# include <sys/event.h> |
3000: | |#endif |#endif |
3001: |---------+--------------------------+------------------------------------------------------|
3002: | |int |int |
3003: | |monitor_file(...) |monitor_file(...) |
3004: | |{ |{ |
3005: | |#if defined(__NetBSD__) |#if defined(HAVE_KQUEUE) |
3006: |C source | int fd = kqueue();| int fd = kqueue(); |
3007: |file | ... | ... |
3008: | |#else |#else |
3009: | | ... | ... |
3010: | |#endif |#endif |
3011: | |} |} |
3012: +-------------------------------------------------------------------------------------------+
1.1 dsieger 3013:
3014:
1.184 rillig 3015: 12.3.5. Feedback to the author
1.1 dsieger 3016:
1.184 rillig 3017: Always, always, always feed back any portability fixes or improvements you do
3018: to a package to the mainstream developers. This is the only way to get their
3019: attention on portability issues and to ensure that future versions can be built
3020: out-of-the box on NetBSD. Furthermore, any user that gets newer distfiles will
3021: get the fixes straight from the packaged code.
1.1 dsieger 3022:
1.184 rillig 3023: This generally involves cleaning up the patches (because sometimes the patches
3024: that are added to pkgsrc are quick hacks), filing bug reports in the
3025: appropriate trackers for the projects and working with the mainstream authors
3026: to accept your changes. It is extremely important that you do it so that the
3027: packages in pkgsrc are kept simple and thus further changes can be done without
3028: much hassle.
1.1 dsieger 3029:
1.184 rillig 3030: When you have done this, please add a URL to the upstream bug report to the
3031: patch comment.
1.1 dsieger 3032:
1.184 rillig 3033: Support the idea of free software!
1.1 dsieger 3034:
1.184 rillig 3035: 12.4. Other mandatory files
1.1 dsieger 3036:
1.184 rillig 3037: DESCR
1.1 dsieger 3038:
1.184 rillig 3039: A multi-line description of the piece of software. This should include any
3040: credits where they are due. Please bear in mind that others do not share
3041: your sense of humour (or spelling idiosyncrasies), and that others will
3042: read everything that you write here.
1.1 dsieger 3043:
1.184 rillig 3044: PLIST
1.1 dsieger 3045:
1.184 rillig 3046: This file governs the files that are installed on your system: all the
3047: binaries, manual pages, etc. There are other directives which may be
3048: entered in this file, to control the creation and deletion of directories,
3049: and the location of inserted files. See Chapter 19, PLIST issues for more
3050: information.
1.1 dsieger 3051:
1.184 rillig 3052: 12.5. Optional files
1.1 dsieger 3053:
1.184 rillig 3054: 12.5.1. Files affecting the binary package
1.1 dsieger 3055:
1.184 rillig 3056: INSTALL
1.1 dsieger 3057:
1.184 rillig 3058: This shell script is invoked twice by pkg_add(1). First time after package
3059: extraction and before files are moved in place, the second time after the
3060: files to install are moved in place. This can be used to do any custom
3061: procedures not possible with @exec commands in PLIST. See pkg_add(1) and
3062: pkg_create(1) for more information. See also Section 20.1, "Files and
3063: directories outside the installation prefix". Please note that you can
3064: modify variables in it easily by using FILES_SUBST in the package's
3065: Makefile:
1.1 dsieger 3066:
1.184 rillig 3067: FILES_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 3068:
1.184 rillig 3069: replaces "@SOMEVAR@" with "somevalue" in the INSTALL. By default,
3070: substitution is performed for PREFIX, LOCALBASE, X11BASE, VARBASE, and a
3071: few others, type make help topic=FILES_SUBST for a complete list.
1.1 dsieger 3072:
1.184 rillig 3073: DEINSTALL
1.1 dsieger 3074:
1.184 rillig 3075: This script is executed before and after any files are removed. It is this
3076: script's responsibility to clean up any additional messy details around the
3077: package's installation, since all pkg_delete knows is how to delete the
3078: files created in the original distribution. See pkg_delete(1) and
3079: pkg_create(1) for more information. The same methods to replace variables
3080: can be used as for the INSTALL file.
1.1 dsieger 3081:
1.184 rillig 3082: MESSAGE
1.1 dsieger 3083:
1.198 leot 3084: This file is displayed after installation of the package. While this was
3085: used often in the past, it has two problems: the display will be missed if
3086: many packages are intalled at once, and the person installing the package
3087: and the one using or configuring it may be different. It should therefore
3088: be used only in exceptional circumstances where lasting negative
3089: consequences would result from someone not reading it.
3090:
3091: MESSAGE should not be used for:
3092:
1.232 gutterid 3093: o exhortations to read the documentation
1.198 leot 3094:
1.232 gutterid 3095: o reminders to install rc.d files and set variables
1.198 leot 3096:
1.232 gutterid 3097: o anything that should be explained in the installation/configuration
1.198 leot 3098: documentation that should come with the package
3099:
3100: If the documentation provided by upstream needs enhancing, create e.g.
3101: files/README.pkgsrc and install it in the package's documentation
3102: directory.
3103:
3104: Note that MESSAGE is shown for all operating systems and all init systems.
3105: If a MESSAGE is necessary, it should be narrowed to only those operating
3106: systems and init systems to which it applies.
3107:
3108: Note that you can modify variables in it easily by using MESSAGE_SUBST in
3109: the package's Makefile:
1.1 dsieger 3110:
1.184 rillig 3111: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 3112:
1.184 rillig 3113: replaces "${SOMEVAR}" with "somevalue" in MESSAGE. By default, substitution
3114: is performed for PKGNAME, PKGBASE, PREFIX, LOCALBASE, X11BASE,
3115: PKG_SYSCONFDIR, ROOT_GROUP, and ROOT_USER.
1.1 dsieger 3116:
1.184 rillig 3117: You can display a different or additional files by setting the MESSAGE_SRC
3118: variable. Its default is MESSAGE, if the file exists.
1.1 dsieger 3119:
1.184 rillig 3120: ALTERNATIVES
1.1 dsieger 3121:
1.184 rillig 3122: This file is used by the alternatives framework. It creates, configures,
3123: and destroys generic wrappers used to run programs with similar interfaces.
3124: See pkg_alternatives(8) from pkgtools/pkg_alternatives for more
3125: information.
1.1 dsieger 3126:
1.184 rillig 3127: Each line of the file contains two filenames, first the wrapper and then
3128: the alternative provided by the package. Both paths are relative to PREFIX.
1.1 dsieger 3129:
1.184 rillig 3130: 12.5.2. Files affecting the build process
1.1 dsieger 3131:
1.184 rillig 3132: Makefile.common
1.1 dsieger 3133:
1.184 rillig 3134: This file contains arbitrary things that could also go into a Makefile, but
3135: its purpose is to be used by more than one package. This file should only
3136: be used when the packages that will use the file are known in advance. For
3137: other purposes it is often better to write a *.mk file and give it a good
3138: name that describes what it does.
1.1 dsieger 3139:
1.184 rillig 3140: buildlink3.mk
1.1 dsieger 3141:
1.184 rillig 3142: This file contains the dependency information for the buildlink3 framework
3143: (see Chapter 18, Buildlink methodology).
1.1 dsieger 3144:
1.184 rillig 3145: hacks.mk
1.1 dsieger 3146:
1.184 rillig 3147: This file contains workarounds for compiler bugs and similar things. It is
3148: included automatically by the pkgsrc infrastructure, so you don't need an
3149: extra .include line for it.
1.1 dsieger 3150:
1.184 rillig 3151: options.mk
1.1 dsieger 3152:
1.184 rillig 3153: This file contains the code for the package-specific options (see
3154: Chapter 16, Options handling) that can be selected by the user. If a
3155: package has only one or two options, it is equally acceptable to put the
3156: code directly into the Makefile.
1.1 dsieger 3157:
1.184 rillig 3158: 12.5.3. Files affecting nothing at all
1.1 dsieger 3159:
1.184 rillig 3160: README*
1.1 dsieger 3161:
1.184 rillig 3162: These files do not take place in the creation of a package and thus are
3163: purely informative to the package developer.
1.1 dsieger 3164:
1.184 rillig 3165: TODO
1.1 dsieger 3166:
1.184 rillig 3167: This file contains things that need to be done to make the package even
3168: better.
1.1 dsieger 3169:
1.184 rillig 3170: 12.6. work*
1.1 dsieger 3171:
1.184 rillig 3172: When you type make, the distribution files are unpacked into the directory
3173: denoted by WRKDIR. It can be removed by running make clean. Besides the
3174: sources, this directory is also used to keep various timestamp files. The
3175: directory gets removed completely on clean. The default is ${.CURDIR}/work or $
3176: {.CURDIR}/work.${MACHINE_ARCH} if OBJMACHINE is set.
1.1 dsieger 3177:
1.184 rillig 3178: 12.7. files/*
1.80 wiz 3179:
1.184 rillig 3180: If you have any files that you wish to be placed in the package prior to
3181: configuration or building, you can place these files here and use a ${CP}
3182: command in the "post-extract" target to achieve this.
1.1 dsieger 3183:
1.184 rillig 3184: If you want to share files in this way with other packages, set the FILESDIR
3185: variable to point to the other package's files directory, e.g.:
1.1 dsieger 3186:
1.184 rillig 3187: FILESDIR= ../../editors/xemacs/files
1.14 jmcneill 3188:
1.184 rillig 3189: Chapter 13. The build process
1.1 dsieger 3190:
1.184 rillig 3191: Table of Contents
1.1 dsieger 3192:
1.184 rillig 3193: 13.1. Introduction
3194: 13.2. Program location
3195: 13.3. Directories used during the build process
3196: 13.4. Running a phase
3197: 13.5. The fetch phase
3198: 13.5.1. What to fetch and where to get it from
3199: 13.5.2. How are the files fetched?
3200: 13.6. The checksum phase
3201: 13.7. The extract phase
3202: 13.8. The patch phase
3203: 13.9. The tools phase
3204: 13.10. The wrapper phase
3205: 13.11. The configure phase
3206: 13.12. The build phase
3207: 13.13. The test phase
3208: 13.14. The install phase
3209: 13.15. The package phase
3210: 13.16. Cleaning up
3211: 13.17. Other helpful targets
1.1 dsieger 3212:
1.184 rillig 3213: 13.1. Introduction
1.122 leot 3214:
1.184 rillig 3215: This chapter gives a detailed description on how a package is built. Building a
3216: package is separated into different phases (for example fetch, build, install),
3217: all of which are described in the following sections. Each phase is split into
3218: so-called stages, which take the name of the containing phase, prefixed by one
3219: of pre-, do- or post-. (Examples are pre-configure, post-build.) Most of the
3220: actual work is done in the do-* stages.
1.1 dsieger 3221:
1.184 rillig 3222: Never override the regular targets (like fetch), if you have to, override the
3223: do-* ones instead.
1.1 dsieger 3224:
1.184 rillig 3225: The basic steps for building a program are always the same. First the program's
3226: source (distfile) must be brought to the local system and then extracted. After
3227: any pkgsrc-specific patches to compile properly are applied, the software can
3228: be configured, then built (usually by compiling), and finally the generated
3229: binaries, etc. can be put into place on the system.
1.1 dsieger 3230:
1.184 rillig 3231: To get more details about what is happening at each step, you can set the
3232: PKG_VERBOSE variable, or the PATCH_DEBUG variable if you are just interested in
3233: more details about the patch step.
1.1 dsieger 3234:
1.184 rillig 3235: 13.2. Program location
1.1 dsieger 3236:
1.184 rillig 3237: Before outlining the process performed by the NetBSD package system in the next
3238: section, here's a brief discussion on where programs are installed, and which
3239: variables influence this.
1.1 dsieger 3240:
1.184 rillig 3241: The automatic variable PREFIX indicates where all files of the final program
3242: shall be installed. It is usually set to LOCALBASE (/usr/pkg), or CROSSBASE for
3243: pkgs in the cross category. The value of PREFIX needs to be put into the
3244: various places in the program's source where paths to these files are encoded.
3245: See Section 12.3, "patches/*" and Section 21.3.1, "Shared libraries - libtool"
3246: for more details.
1.1 dsieger 3247:
1.184 rillig 3248: When choosing which of these variables to use, follow the following rules:
1.1 dsieger 3249:
1.184 rillig 3250: * PREFIX always points to the location where the current pkg will be
3251: installed. When referring to a pkg's own installation path, use "${PREFIX}"
3252: .
1.1 dsieger 3253:
1.223 nia 3254: * LOCALBASE is where all pkgs are installed. If you need to construct a -I or
3255: -L argument to the compiler to find includes and libraries installed by
3256: another pkg, use "${LOCALBASE}". The name LOCALBASE stems from FreeBSD,
3257: which installed all packages in /usr/local. As pkgsrc leaves /usr/local for
3258: the system administrator, this variable is a misnomer.
1.1 dsieger 3259:
1.184 rillig 3260: * X11BASE is where the actual X11 distribution (from xsrc, etc.) is
3261: installed. When looking for standard X11 includes (not those installed by a
3262: package), use "${X11BASE}".
1.1 dsieger 3263:
1.184 rillig 3264: * X11-based packages using imake must set USE_IMAKE to be installed correctly
3265: under LOCALBASE.
1.1 dsieger 3266:
1.184 rillig 3267: * Within ${PREFIX}, packages should install files according to hier(7), with
3268: the exception that manual pages go into ${PREFIX}/man, not ${PREFIX}/share/
3269: man.
1.1 dsieger 3270:
1.184 rillig 3271: 13.3. Directories used during the build process
1.2 rillig 3272:
1.184 rillig 3273: When building a package, various directories are used to store source files,
3274: temporary files, pkgsrc-internal files, and so on. These directories are
3275: explained here.
1.1 dsieger 3276:
1.184 rillig 3277: Some of the directory variables contain relative pathnames. There are two
3278: common base directories for these relative directories: PKGSRCDIR/PKGPATH is
3279: used for directories that are pkgsrc-specific. WRKSRC is used for directories
3280: inside the package itself.
1.1 dsieger 3281:
1.184 rillig 3282: PKGSRCDIR
1.1 dsieger 3283:
1.184 rillig 3284: This is an absolute pathname that points to the pkgsrc root directory.
3285: Generally, you don't need it.
1.1 dsieger 3286:
1.184 rillig 3287: PKGDIR
1.1 dsieger 3288:
1.184 rillig 3289: This is an absolute pathname that points to the current package.
1.1 dsieger 3290:
1.184 rillig 3291: PKGPATH
1.1 dsieger 3292:
1.184 rillig 3293: This is a pathname relative to PKGSRCDIR that points to the current
1.228 gutterid 3294: package. It is defined after including bsd.prefs.mk and can be used in
3295: makefile fragments that are used by several packages to distinguish between
3296: these packages. Other variables that would serve the same purpose are
3297: PKGBASE and PKGNAME, but these are only defined after including bsd.pkg.mk,
3298: which is too late.
3299:
3300: In mk.conf, the pkgsrc user can use PKGPATH to tweak variables like
3301: MAKE_JOBS and CFLAGS.
1.1 dsieger 3302:
1.184 rillig 3303: WRKDIR
1.1 dsieger 3304:
1.184 rillig 3305: This is an absolute pathname pointing to the directory where all work takes
3306: place. The distfiles are extracted to this directory. It also contains
3307: temporary directories and log files used by the various pkgsrc frameworks,
3308: like buildlink or the wrappers.
1.1 dsieger 3309:
1.184 rillig 3310: WRKSRC
1.1 dsieger 3311:
1.184 rillig 3312: This is an absolute pathname pointing to the directory where the distfiles
3313: are extracted. It is usually a direct subdirectory of WRKDIR, and often
3314: it's the only directory entry that isn't hidden. This variable may be
3315: changed by a package Makefile.
1.1 dsieger 3316:
1.184 rillig 3317: The CREATE_WRKDIR_SYMLINK definition takes either the value yes or no and
3318: defaults to no. It indicates whether a symbolic link to the WRKDIR is to be
3319: created in the pkgsrc entry's directory. If users would like to have their
3320: pkgsrc trees behave in a read-only manner, then the value of
3321: CREATE_WRKDIR_SYMLINK should be set to no.
1.1 dsieger 3322:
1.184 rillig 3323: 13.4. Running a phase
1.1 dsieger 3324:
1.184 rillig 3325: You can run a particular phase by typing make phase, where phase is the name of
3326: the phase. This will automatically run all phases that are required for this
3327: phase. The default phase is build, that is, when you run make without
3328: parameters in a package directory, the package will be built, but not
3329: installed.
1.1 dsieger 3330:
1.184 rillig 3331: 13.5. The fetch phase
1.1 dsieger 3332:
1.184 rillig 3333: The first step in building a package is to fetch the distribution files
3334: (distfiles) from the sites that are providing them. This is the task of the
3335: fetch phase.
1.25 wiz 3336:
1.184 rillig 3337: 13.5.1. What to fetch and where to get it from
1.1 dsieger 3338:
1.184 rillig 3339: In simple cases, MASTER_SITES defines all URLs from where the distfile, whose
3340: name is derived from the DISTNAME variable, is fetched. The more complicated
3341: cases are described below.
1.1 dsieger 3342:
1.184 rillig 3343: The variable DISTFILES specifies the list of distfiles that have to be fetched.
3344: Its value defaults to ${DEFAULT_DISTFILES} and its value is ${DISTNAME}$
3345: {EXTRACT_SUFX}, so that most packages don't need to define it at all.
3346: EXTRACT_SUFX is .tar.gz by default, but can be changed freely. Note that if
3347: your package requires additional distfiles to the default one, you cannot just
3348: append the additional filenames using the += operator, but you have write for
3349: example:
1.1 dsieger 3350:
1.184 rillig 3351: DISTFILES= ${DEFAULT_DISTFILES} additional-files.tar.gz
1.1 dsieger 3352:
1.184 rillig 3353: Each distfile is fetched from a list of sites, usually MASTER_SITES. If the
3354: package has multiple DISTFILES or multiple PATCHFILES from different sites, you
3355: can set SITES.distfile to the list of URLs where the file distfile (including
3356: the suffix) can be found.
1.1 dsieger 3357:
1.184 rillig 3358: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
3359: DISTFILES+= foo-file.tar.gz
3360: SITES.foo-file.tar.gz= \
3361: https://www.somewhere.com/somehow/ \
3362: https://www.somewhereelse.com/mirror/somehow/
1.1 dsieger 3363:
1.184 rillig 3364: When actually fetching the distfiles, each item from MASTER_SITES or SITES.*
3365: gets the name of each distfile appended to it, without an intermediate slash.
3366: Therefore, all site values have to end with a slash or other separator
3367: character. This allows for example to set MASTER_SITES to a URL of a CGI script
3368: that gets the name of the distfile as a parameter. In this case, the definition
3369: would look like:
1.1 dsieger 3370:
1.184 rillig 3371: MASTER_SITES= https://www.example.com/download.cgi?file=
1.1 dsieger 3372:
1.184 rillig 3373: The exception to this rule are URLs starting with a dash. In that case the URL
3374: is taken as is, fetched and the result stored under the name of the distfile.
3375: You can use this style for the case when the download URL style does not match
3376: the above common case. For example, if permanent download URL is a redirector
3377: to the real download URL, or the download file name is offered by an HTTP
3378: Content-Disposition header. In the following example, foo-1.0.0.tar.gz will be
3379: created instead of the default v1.0.0.tar.gz.
1.1 dsieger 3380:
1.184 rillig 3381: DISTNAME= foo-1.0.0
3382: MASTER_SITES= -https://www.example.com/archive/v1.0.0.tar.gz
1.29 wiz 3383:
1.184 rillig 3384: There are some predefined values for MASTER_SITES, which can be used in
3385: packages. The names of the variables should speak for themselves.
1.29 wiz 3386:
1.225 gutterid 3387: MASTER_SITE_APACHE MASTER_SITE_BACKUP
3388: MASTER_SITE_CRATESIO MASTER_SITE_CYGWIN
3389: MASTER_SITE_DEBIAN MASTER_SITE_FREEBSD
3390: MASTER_SITE_FREEBSD_LOCAL MASTER_SITE_GENTOO
3391: MASTER_SITE_GITHUB MASTER_SITE_GITLAB
3392: MASTER_SITE_GNOME MASTER_SITE_GNU
3393: MASTER_SITE_GNUSTEP MASTER_SITE_HASKELL_HACKAGE
3394: MASTER_SITE_IFARCHIVE MASTER_SITE_KDE
3395: MASTER_SITE_MOZILLA MASTER_SITE_MOZILLA_ALL
3396: MASTER_SITE_MYSQL MASTER_SITE_NETLIB
3397: MASTER_SITE_OPENBSD MASTER_SITE_OPENOFFICE
3398: MASTER_SITE_OSDN MASTER_SITE_PERL_CPAN
3399: MASTER_SITE_PGSQL MASTER_SITE_PYPI
3400: MASTER_SITE_RUBYGEMS MASTER_SITE_R_CRAN
3401: MASTER_SITE_SOURCEFORGE MASTER_SITE_SUNSITE
3402: MASTER_SITE_SUSE MASTER_SITE_TEX_CTAN
3403: MASTER_SITE_XCONTRIB MASTER_SITE_XEMACS
3404: MASTER_SITE_XORG
1.1 dsieger 3405:
1.184 rillig 3406: Some explanations for the less self-explaining ones: MASTER_SITE_BACKUP
3407: contains backup sites for packages that are maintained in ftp://ftp.NetBSD.org/
3408: pub/pkgsrc/distfiles/${DIST_SUBDIR}. MASTER_SITE_LOCAL contains local package
3409: source distributions that are maintained in ftp://ftp.NetBSD.org/pub/pkgsrc/
3410: distfiles/LOCAL_PORTS/.
1.1 dsieger 3411:
1.184 rillig 3412: If you choose one of these predefined sites, you may want to specify a
3413: subdirectory of that site. Since these macros may expand to more than one
3414: actual site, you must use the following construct to specify a subdirectory:
1.1 dsieger 3415:
1.184 rillig 3416: MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/}
3417: MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.1 dsieger 3418:
1.184 rillig 3419: Note the trailing slash after the subdirectory name.
1.1 dsieger 3420:
1.184 rillig 3421: 13.5.2. How are the files fetched?
1.1 dsieger 3422:
1.184 rillig 3423: The fetch phase makes sure that all the distfiles exist in a local directory
3424: (DISTDIR, which can be set by the pkgsrc user). If the files do not exist, they
3425: are fetched using commands of the form
1.1 dsieger 3426:
1.184 rillig 3427: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 dsieger 3428:
1.184 rillig 3429: where ${site} varies through several possibilities in turn: first,
3430: MASTER_SITE_OVERRIDE is tried, then the sites specified in either SITES.file if
3431: defined, else MASTER_SITES or PATCH_SITES, as applies, then finally the value
3432: of MASTER_SITE_BACKUP. The order of all except the first and the last can be
3433: optionally sorted by the user, via setting either MASTER_SORT_RANDOM, and
3434: MASTER_SORT_AWK or MASTER_SORT_REGEX.
1.1 dsieger 3435:
1.184 rillig 3436: The specific command and arguments used depend on the FETCH_USING parameter.
3437: The example above is for FETCH_USING=custom.
1.66 asau 3438:
1.184 rillig 3439: The distfiles mirror run by the NetBSD Foundation uses the mirror-distfiles
3440: target to mirror the distfiles, if they are freely distributable. Packages
3441: setting NO_SRC_ON_FTP (usually to "${RESTRICTED}") will not have their
3442: distfiles mirrored.
1.1 dsieger 3443:
1.184 rillig 3444: 13.6. The checksum phase
1.1 dsieger 3445:
1.184 rillig 3446: After the distfile(s) are fetched, their checksum is generated and compared
3447: with the checksums stored in the distinfo file. If the checksums don't match,
3448: the build is aborted. This is to ensure the same distfile is used for building,
3449: and that the distfile wasn't changed, e.g. by some malign force, deliberately
3450: changed distfiles on the master distribution site or network lossage.
1.1 dsieger 3451:
1.184 rillig 3452: 13.7. The extract phase
1.1 dsieger 3453:
1.184 rillig 3454: When the distfiles are present on the local system, they need to be extracted,
3455: as they usually come in the form of some compressed archive format.
1.1 dsieger 3456:
1.184 rillig 3457: By default, all DISTFILES are extracted. If you only need some of them, you can
3458: set the EXTRACT_ONLY variable to the list of those files.
1.1 dsieger 3459:
1.184 rillig 3460: Extracting the files is usually done by a little program, mk/extract/extract,
3461: which already knows how to extract various archive formats, so most likely you
3462: will not need to change anything here. But if you need, the following variables
3463: may help you:
1.1 dsieger 3464:
1.184 rillig 3465: EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}
1.1 dsieger 3466:
1.184 rillig 3467: Use these variables to override the default options for an extract command,
3468: which are defined in mk/extract/extract.
1.1 dsieger 3469:
1.184 rillig 3470: EXTRACT_USING
1.1 dsieger 3471:
1.184 rillig 3472: This variable can be set to bsdtar, gtar, nbtar (which is the default
3473: value), pax, or an absolute pathname pointing to the command with which tar
3474: archives should be extracted. It is preferred to choose bsdtar over gtar if
3475: NetBSD's pax-as-tar is not good enough.
1.1 dsieger 3476:
1.184 rillig 3477: If the extract program doesn't serve your needs, you can also override the
3478: EXTRACT_CMD variable, which holds the command used for extracting the files.
3479: This command is executed in the ${WRKSRC} directory. During execution of this
3480: command, the shell variable extract_file holds the absolute pathname of the
3481: file that is going to be extracted.
1.1 dsieger 3482:
1.184 rillig 3483: And if that still does not suffice, you can override the do-extract target in
3484: the package Makefile.
1.1 dsieger 3485:
1.184 rillig 3486: 13.8. The patch phase
1.1 dsieger 3487:
1.184 rillig 3488: After extraction, all the patches named by the PATCHFILES, those present in the
3489: patches subdirectory of the package as well as in $LOCALPATCHES/$PKGPATH (e.g.
3490: /usr/local/patches/graphics/png) are applied. Patchfiles ending in .Z or .gz
3491: are uncompressed before they are applied, files ending in .orig or .rej are
3492: ignored. Any special options to patch(1) can be handed in PATCH_DIST_ARGS. See
3493: Section 12.3, "patches/*" for more details.
1.1 dsieger 3494:
1.184 rillig 3495: By default patch(1) is given special arguments to make it fail if the expected
3496: text from the patch context is not found in the patched file. If that happens,
3497: fix the patch file by comparing it with the actual text in the file to be
3498: patched.
1.1 dsieger 3499:
1.184 rillig 3500: 13.9. The tools phase
1.1 dsieger 3501:
1.184 rillig 3502: This is covered in Chapter 17, Tools needed for building or running.
1.1 dsieger 3503:
1.184 rillig 3504: 13.10. The wrapper phase
1.1 dsieger 3505:
1.184 rillig 3506: This phase creates wrapper programs for the compilers and linkers. The
3507: following variables can be used to tweak the wrappers.
1.1 dsieger 3508:
1.184 rillig 3509: ECHO_WRAPPER_MSG
1.1 dsieger 3510:
1.184 rillig 3511: The command used to print progress messages. Does nothing by default. Set
3512: to ${ECHO} to see the progress messages.
1.1 dsieger 3513:
1.184 rillig 3514: WRAPPER_DEBUG
1.1 dsieger 3515:
1.184 rillig 3516: This variable can be set to yes (default) or no, depending on whether you
3517: want additional information in the wrapper log file.
1.1 dsieger 3518:
1.184 rillig 3519: WRAPPER_UPDATE_CACHE
1.1 dsieger 3520:
1.184 rillig 3521: This variable can be set to yes or no, depending on whether the wrapper
3522: should use its cache, which will improve the speed. The default value is
3523: yes, but is forced to no if the platform does not support it.
1.1 dsieger 3524:
1.184 rillig 3525: WRAPPER_REORDER_CMDS
1.1 dsieger 3526:
1.184 rillig 3527: A list of reordering commands. A reordering command has the form reorder:l:
3528: lib1:lib2. It ensures that that -llib1 occurs before -llib2.
1.1 dsieger 3529:
1.184 rillig 3530: 13.11. The configure phase
1.1 dsieger 3531:
1.184 rillig 3532: Most pieces of software need information on the header files, system calls, and
3533: library routines which are available on the platform they run on. The process
3534: of determining this information is known as configuration, and is usually
3535: automated. In most cases, a script is supplied with the distfiles, and its
3536: invocation results in generation of header files, Makefiles, etc.
1.1 dsieger 3537:
1.184 rillig 3538: If the package contains a configure script, this can be invoked by setting
3539: HAS_CONFIGURE to "yes". If the configure script is a GNU autoconf script, you
1.187 rillig 3540: should set GNU_CONFIGURE to "yes" instead.
1.1 dsieger 3541:
1.187 rillig 3542: In the do-configure stage, a rough equivalent of the following command is run.
3543: See mk/configure/configure.mk, target do-configure-script for the exact
3544: definition.
3545:
3546: .for dir in ${CONFIGURE_DIRS}
3547: cd ${WRKSRC} && cd ${dir} \
3548: && env ${CONFIGURE_ENV} \
3549: ${CONFIG_SHELL} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
1.184 rillig 3550: .endfor
1.1 dsieger 3551:
1.184 rillig 3552: CONFIGURE_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In
3553: each of these directories, the configure script is run with the environment
3554: CONFIGURE_ENV and arguments CONFIGURE_ARGS. The variables CONFIGURE_ENV,
3555: CONFIGURE_SCRIPT (default: "./configure") and CONFIGURE_ARGS may all be changed
3556: by the package.
1.1 dsieger 3557:
1.184 rillig 3558: If the program uses the Perl way of configuration (mainly Perl modules, but not
3559: only), i.e. a file called Makefile.PL, it should include ../../lang/perl5/
3560: module.mk. To set any parameter for Makefile.PL use the MAKE_PARAMS variable
3561: (e.g., MAKE_PARAMS+=foo=bar
1.1 dsieger 3562:
1.184 rillig 3563: If the program uses an Imakefile for configuration, the appropriate steps can
3564: be invoked by setting USE_IMAKE to "yes". If you only need xmkmf, add it to
3565: USE_TOOLS. You can add variables to xmkmf's environment by adding them to the
3566: SCRIPTS_ENV variable.
1.1 dsieger 3567:
1.184 rillig 3568: If the program uses cmake for configuration, the appropriate steps can be
1.233 wiz 3569: invoked by including ../../devel/cmake/build.mk. You can add variables to
3570: cmake's environment by adding them to the CONFIGURE_ENV variable and arguments
3571: to cmake by adding them to the CMAKE_ARGS variable. If you want to add
3572: arguments only for particular stages, you can use the CMAKE_CONFIGURE_ARGS,
3573: CMAKE_BUILD_ARGS, and CMAKE_INSTALL_ARGS variables. You can set the
3574: CONFIGURE_DIRS variable to the directories in which CMake should be run,
3575: relative to WRKSRC. This defaults to to ".".
1.1 dsieger 3576:
1.184 rillig 3577: If there is no configure step at all, set NO_CONFIGURE to "yes".
1.1 dsieger 3578:
1.184 rillig 3579: 13.12. The build phase
1.1 dsieger 3580:
1.187 rillig 3581: For building a package, a rough equivalent of the following code is executed;
3582: see mk/build/build.mk, target do-build for the exact definition.
1.154 rillig 3583:
1.187 rillig 3584: .for dir in ${BUILD_DIRS}
3585: cd ${WRKSRC} && cd ${dir} \
1.184 rillig 3586: && env ${MAKE_ENV} \
1.187 rillig 3587: ${MAKE_PROGRAM} ${MAKE_FLAGS} ${BUILD_MAKE_FLAGS} \
1.184 rillig 3588: -f ${MAKE_FILE} \
3589: ${BUILD_TARGET}
3590: .endfor
1.1 dsieger 3591:
1.184 rillig 3592: BUILD_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In each of
3593: these directories, MAKE_PROGRAM is run with the environment MAKE_ENV and
3594: arguments BUILD_MAKE_FLAGS. The variables MAKE_ENV, BUILD_MAKE_FLAGS, MAKE_FILE
3595: and BUILD_TARGET may all be changed by the package.
1.1 dsieger 3596:
1.184 rillig 3597: The default value of MAKE_PROGRAM is "gmake" if USE_TOOLS contains "gmake", "
3598: make" otherwise. The default value of MAKE_FILE is "Makefile", and BUILD_TARGET
3599: defaults to "all".
1.1 dsieger 3600:
1.184 rillig 3601: If there is no build step at all, set NO_BUILD to "yes".
1.1 dsieger 3602:
1.184 rillig 3603: 13.13. The test phase
1.1 dsieger 3604:
1.184 rillig 3605: [TODO]
1.1 dsieger 3606:
1.184 rillig 3607: 13.14. The install phase
1.1 dsieger 3608:
1.184 rillig 3609: Once the build stage has completed, the final step is to install the software
3610: in public directories, so users can access the programs and files.
1.1 dsieger 3611:
1.187 rillig 3612: In the install phase, a rough equivalent of the following code is executed; see
3613: mk/install/install.mk, target do-install for the exact definition.
3614: Additionally, before and after this code, several consistency checks are run
3615: against the files-to-be-installed, see mk/check/*.mk for details.
3616:
3617: .for dir in ${INSTALL_DIRS}
3618: cd ${WRKSRC} && cd ${dir} \
3619: && env ${INSTALL_ENV} ${MAKE_ENV} \
3620: ${MAKE_PROGRAM} ${MAKE_FLAGS} ${INSTALL_MAKE_FLAGS} \
3621: -f ${MAKE_FILE} ${INSTALL_TARGET}
1.184 rillig 3622: .endfor
1.1 dsieger 3623:
1.184 rillig 3624: The variable's meanings are analogous to the ones in the build phase.
3625: INSTALL_DIRS defaults to BUILD_DIRS. INSTALL_TARGET is "install" by default,
3626: plus "install.man" if USE_IMAKE is defined and NO_INSTALL_MANPAGES is not
3627: defined.
1.1 dsieger 3628:
1.184 rillig 3629: In the install phase, the following variables are useful. They are all
3630: variations of the install(1) command that have the owner, group and permissions
3631: preset. INSTALL is the plain install command. The specialized variants,
3632: together with their intended use, are:
1.1 dsieger 3633:
1.184 rillig 3634: INSTALL_PROGRAM_DIR
1.1 dsieger 3635:
1.184 rillig 3636: directories that contain binaries
1.1 dsieger 3637:
1.184 rillig 3638: INSTALL_SCRIPT_DIR
1.1 dsieger 3639:
1.184 rillig 3640: directories that contain scripts
1.1 dsieger 3641:
1.184 rillig 3642: INSTALL_LIB_DIR
1.1 dsieger 3643:
1.184 rillig 3644: directories that contain shared and static libraries
1.1 dsieger 3645:
1.184 rillig 3646: INSTALL_DATA_DIR
1.108 rillig 3647:
1.184 rillig 3648: directories that contain data files
1.108 rillig 3649:
1.184 rillig 3650: INSTALL_MAN_DIR
1.108 rillig 3651:
1.184 rillig 3652: directories that contain man pages
1.108 rillig 3653:
1.184 rillig 3654: INSTALL_GAME_DIR
1.108 rillig 3655:
1.184 rillig 3656: directories that contain data files for games
1.108 rillig 3657:
1.184 rillig 3658: INSTALL_PROGRAM
1.108 rillig 3659:
1.184 rillig 3660: binaries that can be stripped from debugging symbols
1.108 rillig 3661:
1.184 rillig 3662: INSTALL_SCRIPT
1.108 rillig 3663:
1.184 rillig 3664: binaries that cannot be stripped
1.108 rillig 3665:
1.184 rillig 3666: INSTALL_GAME
1.108 rillig 3667:
1.184 rillig 3668: game binaries
1.108 rillig 3669:
1.184 rillig 3670: INSTALL_LIB
1.108 rillig 3671:
1.184 rillig 3672: shared and static libraries
1.108 rillig 3673:
1.184 rillig 3674: INSTALL_DATA
1.108 rillig 3675:
1.184 rillig 3676: data files
1.1 dsieger 3677:
1.184 rillig 3678: INSTALL_GAME_DATA
1.1 dsieger 3679:
1.184 rillig 3680: data files for games
1.108 rillig 3681:
1.184 rillig 3682: INSTALL_MAN
1.108 rillig 3683:
1.184 rillig 3684: man pages
1.1 dsieger 3685:
1.184 rillig 3686: Some other variables are:
1.1 dsieger 3687:
1.184 rillig 3688: INSTALL_UNSTRIPPED
1.1 dsieger 3689:
1.184 rillig 3690: If set to yes, do not run strip(1) when installing binaries. Any debugging
3691: sections and symbols present in binaries will be preserved.
1.1 dsieger 3692:
1.184 rillig 3693: INSTALLATION_DIRS
1.1 dsieger 3694:
1.184 rillig 3695: A list of directories relative to PREFIX that are created by pkgsrc at the
3696: beginning of the install phase. The package is supposed to create all
3697: needed directories itself before installing files to it and list all other
3698: directories here.
1.1 dsieger 3699:
1.184 rillig 3700: In the rare cases that a package shouldn't install anything, set NO_INSTALL to
3701: "yes". This is mostly relevant for packages in the regress category.
1.1 dsieger 3702:
1.184 rillig 3703: 13.15. The package phase
1.121 sevan 3704:
1.184 rillig 3705: Once the install stage has completed, a binary package of the installed files
3706: can be built. These binary packages can be used for quick installation without
3707: previous compilation, e.g. by the make bin-install or by using pkg_add.
1.1 dsieger 3708:
1.184 rillig 3709: By default, the binary packages are created in ${PACKAGES}/All and symlinks are
3710: created in ${PACKAGES}/category, one for each category in the CATEGORIES
3711: variable. PACKAGES defaults to pkgsrc/packages.
1.1 dsieger 3712:
1.184 rillig 3713: 13.16. Cleaning up
1.1 dsieger 3714:
1.184 rillig 3715: Once you're finished with a package, you can clean the work directory by
3716: running make clean. If you want to clean the work directories of all
3717: dependencies too, use make clean-depends.
1.1 dsieger 3718:
1.184 rillig 3719: 13.17. Other helpful targets
1.1 dsieger 3720:
1.184 rillig 3721: pre/post-*
1.1 dsieger 3722:
1.184 rillig 3723: For any of the main targets described in the previous section (configure,
3724: build, install, etc.), two auxiliary targets exist with "pre-" and "post-"
3725: used as a prefix for the main target's name. These targets are invoked
3726: before and after the main target is called, allowing extra configuration or
3727: installation steps be performed from a package's Makefile, for example,
3728: which a program's configure script or install target omitted.
3729:
3730: About 5% of the pkgsrc packages define their custom post-extract target,
3731: another 5% define pre-configure, and 10% define post-install. The other pre
3732: /post-* targets are defined even less often.
1.1 dsieger 3733:
1.184 rillig 3734: do-*
1.182 leot 3735:
1.184 rillig 3736: Should one of the main targets do the wrong thing, and should there be no
3737: variable to fix this, you can redefine it with the do-* target. (Note that
3738: redefining the target itself instead of the do-* target is a bad idea, as
3739: the pre-* and post-* targets won't be called anymore, etc.)
1.1 dsieger 3740:
1.184 rillig 3741: About 15% of the pkgsrc packages override the default do-install, the other
3742: do-* targets are overridden even less often.
1.1 dsieger 3743:
1.184 rillig 3744: reinstall
1.1 dsieger 3745:
1.184 rillig 3746: If you did a make install and you noticed some file was not installed
3747: properly, you can repeat the installation with this target, which will
3748: ignore the "already installed" flag.
1.1 dsieger 3749:
1.184 rillig 3750: This is the default value of DEPENDS_TARGET except in the case of make
3751: update and make package, where the defaults are "package" and "update",
3752: respectively.
1.1 dsieger 3753:
1.184 rillig 3754: deinstall
1.1 dsieger 3755:
1.184 rillig 3756: This target does a pkg_delete(1) in the current directory, effectively
3757: de-installing the package. The following variables can be used to tune the
3758: behaviour:
1.1 dsieger 3759:
1.184 rillig 3760: PKG_VERBOSE
1.1 dsieger 3761:
1.184 rillig 3762: Add a "-v" to the pkg_delete(1) command.
1.1 dsieger 3763:
1.184 rillig 3764: DEINSTALLDEPENDS
1.1 dsieger 3765:
1.184 rillig 3766: Remove all packages that require (depend on) the given package. This
3767: can be used to remove any packages that may have been pulled in by a
3768: given package, e.g. if make deinstall DEINSTALLDEPENDS=1 is done in
3769: pkgsrc/x11/kde, this is likely to remove whole KDE. Works by adding "-R
3770: " to the pkg_delete(1) command line.
1.1 dsieger 3771:
1.184 rillig 3772: bin-install
1.1 dsieger 3773:
1.184 rillig 3774: Install a binary package from local disk and via FTP from a list of sites
3775: (see the BINPKG_SITES variable), and do a make package if no binary package
3776: is available anywhere. The arguments given to pkg_add can be set via
3777: BIN_INSTALL_FLAGS e.g., to do verbose operation, etc.
1.1 dsieger 3778:
1.184 rillig 3779: install-clean
1.1 dsieger 3780:
1.184 rillig 3781: This target removes the state files for the "install" and later phases so
3782: that the "install" target may be re-invoked. This can be used after editing
3783: the PLIST to install the package without rebuilding it.
1.1 dsieger 3784:
1.184 rillig 3785: build-clean
1.18 mishka 3786:
1.184 rillig 3787: This target removes the state files for the "build" and later phases so
3788: that the "build" target may be re-invoked.
1.18 mishka 3789:
1.184 rillig 3790: update
1.18 mishka 3791:
1.184 rillig 3792: This target causes the current package to be updated to the latest version.
3793: The package and all depending packages first get de-installed, then current
3794: versions of the corresponding packages get compiled and installed. This is
3795: similar to manually noting which packages are currently installed, then
3796: performing a series of make deinstall and make install (or whatever
3797: UPDATE_TARGET is set to) for these packages.
1.18 mishka 3798:
1.184 rillig 3799: You can use the "update" target to resume package updating in case a
3800: previous make update was interrupted for some reason. However, in this
3801: case, make sure you don't call make clean or otherwise remove the list of
3802: dependent packages in WRKDIR. Otherwise, you lose the ability to
3803: automatically update the current package along with the dependent packages
3804: you have installed.
1.121 sevan 3805:
1.184 rillig 3806: Resuming an interrupted make update will only work as long as the package
3807: tree remains unchanged. If the source code for one of the packages to be
3808: updated has been changed, resuming make update will most certainly fail!
1.1 dsieger 3809:
1.184 rillig 3810: The following variables can be used either on the command line or in
3811: mk.conf to alter the behaviour of make update:
1.1 dsieger 3812:
1.184 rillig 3813: UPDATE_TARGET
1.1 dsieger 3814:
1.184 rillig 3815: Install target to recursively use for the updated package and the
3816: dependent packages. Defaults to DEPENDS_TARGET if set, "install"
3817: otherwise for make update. Other good targets are "package" or "
3818: bin-install". Do not set this to "update" or you will get stuck in an
3819: endless loop!
1.1 dsieger 3820:
1.184 rillig 3821: NOCLEAN
1.1 dsieger 3822:
1.184 rillig 3823: Don't clean up after updating. Useful if you want to leave the work
3824: sources of the updated packages around for inspection or other
3825: purposes. Be sure you eventually clean up the source tree (see the "
3826: clean-update" target below) or you may run into troubles with old
3827: source code still lying around on your next make or make update.
1.1 dsieger 3828:
1.184 rillig 3829: REINSTALL
1.1 dsieger 3830:
1.184 rillig 3831: Deinstall each package before installing (making DEPENDS_TARGET). This
3832: may be necessary if the "clean-update" target (see below) was called
3833: after interrupting a running make update.
1.1 dsieger 3834:
1.184 rillig 3835: DEPENDS_TARGET
1.1 dsieger 3836:
1.184 rillig 3837: Allows you to disable recursion and hardcode the target for packages.
3838: The default is "update" for the update target, facilitating a recursive
3839: update of prerequisite packages. Only set DEPENDS_TARGET if you want to
3840: disable recursive updates. Use UPDATE_TARGET instead to just set a
3841: specific target for each package to be installed during make update
3842: (see above).
1.1 dsieger 3843:
1.184 rillig 3844: clean-update
1.1 dsieger 3845:
1.184 rillig 3846: Clean the source tree for all packages that would get updated if make
3847: update was called from the current directory. This target should not be
3848: used if the current package (or any of its depending packages) have already
3849: been de-installed (e.g., after calling make update) or you may lose some
3850: packages you intended to update. As a rule of thumb: only use this target
3851: before the first time you run make update and only if you have a dirty
3852: package tree (e.g., if you used NOCLEAN).
1.86 wiz 3853:
1.184 rillig 3854: If you are unsure about whether your tree is clean, you can either perform
3855: a make clean at the top of the tree, or use the following sequence of
3856: commands from the directory of the package you want to update (before
3857: running make update for the first time, otherwise you lose all the packages
3858: you wanted to update!):
1.86 wiz 3859:
1.184 rillig 3860: # make clean-update
3861: # make clean CLEANDEPENDS=YES
3862: # make update
1.86 wiz 3863:
3864:
1.184 rillig 3865: The following variables can be used either on the command line or in
3866: mk.conf to alter the behaviour of make clean-update:
1.86 wiz 3867:
1.184 rillig 3868: CLEAR_DIRLIST
1.86 wiz 3869:
1.184 rillig 3870: After make clean, do not reconstruct the list of directories to update
3871: for this package. Only use this if make update successfully installed
3872: all packages you wanted to update. Normally, this is done automatically
3873: on make update, but may have been suppressed by the NOCLEAN variable
3874: (see above).
1.1 dsieger 3875:
1.184 rillig 3876: replace
1.1 dsieger 3877:
1.184 rillig 3878: Update the installation of the current package. This differs from update in
3879: that it does not replace dependent packages. You will need to install
3880: pkgtools/pkg_tarup for this target to work.
1.1 dsieger 3881:
1.184 rillig 3882: Be careful when using this target! There are no guarantees that dependent
3883: packages will still work, in particular they will most certainly break if
3884: you make replace a library package whose shared library major version
3885: changed between your installed version and the new one. For this reason,
3886: this target is not officially supported and only recommended for advanced
3887: users.
1.1 dsieger 3888:
1.184 rillig 3889: info
1.1 dsieger 3890:
1.184 rillig 3891: This target invokes pkg_info(1) for the current package. You can use this
3892: to check which version of a package is installed.
1.86 wiz 3893:
1.184 rillig 3894: index
1.1 dsieger 3895:
1.184 rillig 3896: This is a top-level command, i.e. it should be used in the pkgsrc
3897: directory. It creates a database of all packages in the local pkgsrc tree,
3898: including dependencies, comment, maintainer, and some other useful
3899: information. Individual entries are created by running make describe in the
3900: packages' directories. This index file is saved as pkgsrc/INDEX. It can be
3901: displayed in verbose format by running make print-index. You can search in
3902: it with make search key=something. You can extract a list of all packages
3903: that depend on a particular one by running make show-deps PKG=somepackage.
1.1 dsieger 3904:
1.184 rillig 3905: Running this command takes a very long time, some hours even on fast
3906: machines!
1.1 dsieger 3907:
1.184 rillig 3908: readme
1.1 dsieger 3909:
1.199 nia 3910: This target generates a index.html file, which can be viewed using a
1.184 rillig 3911: browser such as www/firefox or www/links. The generated files contain
3912: references to any packages which are in the PACKAGES directory on the local
3913: host. The generated files can be made to refer to URLs based on
3914: FTP_PKG_URL_HOST and FTP_PKG_URL_DIR. For example, if I wanted to generate
1.199 nia 3915: index.html files which pointed to binary packages on the local machine, in
1.184 rillig 3916: the directory /usr/packages, set FTP_PKG_URL_HOST=file://localhost and
3917: FTP_PKG_URL_DIR=/usr/packages. The ${PACKAGES} directory and its
3918: subdirectories will be searched for all the binary packages.
1.1 dsieger 3919:
1.184 rillig 3920: The target can be run at the toplevel or in category directories, in which
3921: case it descends recursively.
1.1 dsieger 3922:
1.184 rillig 3923: readme-all
1.1 dsieger 3924:
1.184 rillig 3925: This is a top-level command, run it in pkgsrc. Use this target to create a
3926: file README-all.html which contains a list of all packages currently
3927: available in the NetBSD Packages Collection, together with the category
3928: they belong to and a short description. This file is compiled from the
1.199 nia 3929: pkgsrc/*/index.html files, so be sure to run this after a make readme.
1.1 dsieger 3930:
1.184 rillig 3931: cdrom-readme
1.1 dsieger 3932:
1.184 rillig 3933: This is very much the same as the "readme" target (see above), but is to be
3934: used when generating a pkgsrc tree to be written to a CD-ROM. This target
1.199 nia 3935: also produces index.html files, and can be made to refer to URLs based on
1.184 rillig 3936: CDROM_PKG_URL_HOST and CDROM_PKG_URL_DIR.
1.1 dsieger 3937:
1.184 rillig 3938: show-distfiles
1.1 dsieger 3939:
1.184 rillig 3940: This target shows which distfiles and patchfiles are needed to build the
3941: package (ALLFILES, which contains all DISTFILES and PATCHFILES, but not
3942: patches/*).
1.1 dsieger 3943:
1.184 rillig 3944: show-downlevel
1.1 dsieger 3945:
1.184 rillig 3946: This target shows nothing if the package is not installed. If a version of
3947: this package is installed, but is not the version provided in this version
3948: of pkgsrc, then a warning message is displayed. This target can be used to
3949: show which of your installed packages are downlevel, and so the old
3950: versions can be deleted, and the current ones added.
1.1 dsieger 3951:
1.184 rillig 3952: show-pkgsrc-dir
1.1 dsieger 3953:
1.184 rillig 3954: This target shows the directory in the pkgsrc hierarchy from which the
3955: package can be built and installed. This may not be the same directory as
3956: the one from which the package was installed. This target is intended to be
3957: used by people who may wish to upgrade many packages on a single host, and
3958: can be invoked from the top-level pkgsrc Makefile by using the "
3959: show-host-specific-pkgs" target.
1.1 dsieger 3960:
1.184 rillig 3961: show-installed-depends
1.1 dsieger 3962:
1.184 rillig 3963: This target shows which installed packages match the current package's
3964: DEPENDS. Useful if out of date dependencies are causing build problems.
1.1 dsieger 3965:
1.184 rillig 3966: print-build-depends-list
1.1 dsieger 3967:
1.184 rillig 3968: This target shows the list of packages that the current package depends on
3969: for building.
1.1 dsieger 3970:
1.184 rillig 3971: print-run-depends-list
1.1 dsieger 3972:
1.184 rillig 3973: This target shows the list of packages that the current package depends on
3974: for running.
1.1 dsieger 3975:
1.184 rillig 3976: check-shlibs
1.1 dsieger 3977:
1.184 rillig 3978: After a package is installed, check all its binaries and (on ELF platforms)
3979: shared libraries to see if they find the shared libs they need. Run by
3980: default if PKG_DEVELOPER is set in mk.conf.
1.1 dsieger 3981:
1.184 rillig 3982: print-PLIST
1.1 dsieger 3983:
1.184 rillig 3984: After a "make install" from a new or upgraded pkg, this prints out an
3985: attempt to generate a new PLIST from a find -newer work/.extract_done. An
3986: attempt is made to care for shared libs etc., but it is strongly
3987: recommended to review the result before putting it into PLIST. On upgrades,
3988: it's useful to diff the output of this command against an already existing
3989: PLIST file.
1.1 dsieger 3990:
1.184 rillig 3991: If the package installs files via tar(1) or other methods that don't update
3992: file access times, be sure to add these files manually to your PLIST, as
3993: the "find -newer" command used by this target won't catch them!
1.56 ryoon 3994:
1.184 rillig 3995: See Section 19.3, "Tweaking output of make print-PLIST" for more
3996: information on this target.
1.1 dsieger 3997:
1.184 rillig 3998: Chapter 14. Creating a new pkgsrc package from scratch
1.1 dsieger 3999:
1.184 rillig 4000: Table of Contents
1.1 dsieger 4001:
1.184 rillig 4002: 14.1. Common types of packages
1.219 nia 4003: 14.1.1. Python modules and programs
4004: 14.1.2. R packages
4005: 14.1.3. TeXlive packages
1.184 rillig 4006: 14.2. Examples
4007: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 4008:
1.184 rillig 4009: When you find a package that is not yet in pkgsrc, you most likely have a URL
4010: from where you can download the source code. Starting with this URL, creating a
4011: package involves only a few steps.
1.1 dsieger 4012:
1.184 rillig 4013: 1. In your mk.conf, set PKG_DEVELOPER=yes to enable the basic quality checks.
1.1 dsieger 4014:
1.184 rillig 4015: 2. Install the package meta-pkgs/pkg_developer, which among others will
4016: install the utilities url2pkg, pkglint, pkgvi and mkpatches:
1.1 dsieger 4017:
1.184 rillig 4018: $ cd /usr/pkgsrc
4019: $ (cd meta-pkgs/pkg_developer && bmake update)
1.1 dsieger 4020:
1.184 rillig 4021: 3. Choose one of the top-level directories as the category in which you want
4022: to place your package. You can also create a directory of your own (maybe
1.219 nia 4023: called local). Change into that category directory:
1.1 dsieger 4024:
1.219 nia 4025: $ cd category
1.1 dsieger 4026:
1.219 nia 4027: 4. Run the program url2pkg, passing as argument the URL of the distribution
4028: file (in most cases a .tar.gz file). This will download the distribution
4029: file and create the necessary files of the package, based on what's in the
4030: distribution file:
1.1 dsieger 4031:
1.184 rillig 4032: $ url2pkg https://www.example.org/packages/package-1.0.tar.gz
1.1 dsieger 4033:
1.184 rillig 4034: 5. Examine the extracted files to determine the dependencies of your package.
4035: Ideally, this is mentioned in some README file, but things may differ. For
4036: each of these dependencies, look where it exists in pkgsrc, and if there is
4037: a file called buildlink3.mk in that directory, add a line to your package
4038: Makefile which includes that file just before the last line. If the
4039: buildlink3.mk file does not exist, it must be created first. The
4040: buildlink3.mk file makes sure that the package's include files and
4041: libraries are provided.
1.1 dsieger 4042:
1.219 nia 4043: If you just need binaries from a dependent package, add a DEPENDS line to
4044: the Makefile, which specifies the version of the dependency and where it
4045: can be found in pkgsrc. This line should be placed in the third paragraph.
4046: If the dependency is only needed for building the package, but not when
4047: using it, use TOOL_DEPENDS or BUILD_DEPENDS instead of DEPENDS. The
4048: difference between TOOL_DEPENDS and BUILD_DEPENDS occurs when
4049: cross-compiling: TOOL_DEPENDS are native packages, i.e. packages for the
4050: platform where the package is built; BUILD_DEPENDS are target packages,
4051: i.e. packages for the platform for which the package is built. There is
4052: also TEST_DEPENDS, which specifies a dependency used only for testing the
4053: resulting package built, using the upstream project's included test suite,
4054: on the native platform. Your package may then look like this:
1.1 dsieger 4055:
1.184 rillig 4056: [...]
1.1 dsieger 4057:
1.184 rillig 4058: TOOL_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt
4059: DEPENDS+= screen-[0-9]*:../../misc/screen
4060: DEPENDS+= screen>=4.0:../../misc/screen
1.1 dsieger 4061:
1.184 rillig 4062: [...]
1.1 dsieger 4063:
1.184 rillig 4064: .include "../../category/package/buildlink3.mk"
4065: .include "../../devel/glib2/buildlink3.mk"
4066: .include "../../mk/bsd.pkg.mk"
1.1 dsieger 4067:
1.184 rillig 4068: 6. Run pkglint to see what things still need to be done to make your package a
4069: "good" one. If you don't know what pkglint's warnings want to tell you, try
4070: pkglint --explain or pkglint -e, which outputs additional explanations.
1.1 dsieger 4071:
1.184 rillig 4072: 7. In many cases the package is not yet ready to build. You can find
4073: instructions for the most common cases in the next section, Section 14.1,
4074: "Common types of packages". After you have followed the instructions over
4075: there, you can hopefully continue here.
1.1 dsieger 4076:
1.184 rillig 4077: 8. Run bmake clean to clean the working directory from the extracted files.
1.219 nia 4078: Besides these files, a lot of cache files and other system information have
4079: been saved in the working directory, which may have become outdated after
4080: you edited the Makefile.
1.1 dsieger 4081:
1.184 rillig 4082: 9. Now, run bmake to build the package. For the various things that can go
4083: wrong in this phase, consult Chapter 21, Making your package work.
1.1 dsieger 4084:
1.184 rillig 4085: If the extracted files from the package need to be fixed, run multiple
4086: rounds of these commands:
1.1 dsieger 4087:
1.219 nia 4088: $ bmake
1.184 rillig 4089: $ pkgvi ${WRKSRC}/some/file/that/does/not/compile
4090: $ mkpatches
1.219 nia 4091: $ bmake mps
4092: $ bmake clean
1.1 dsieger 4093:
1.184 rillig 4094: 10. When the package builds fine, the next step is to install the package. Run
4095: bmake install and hope that everything works.
1.1 dsieger 4096:
1.184 rillig 4097: 11. Up to now, the file PLIST, which contains a list of the files that are
4098: installed by the package, is nearly empty. Run bmake print-PLIST >PLIST to
4099: generate a probably correct list. Check the file using your preferred text
4100: editor to see if the list of files looks plausible.
1.1 dsieger 4101:
1.184 rillig 4102: 12. Run pkglint again to see if the generated PLIST contains garbage or not.
1.1 dsieger 4103:
1.184 rillig 4104: 13. When you ran bmake install, the package had been registered in the database
4105: of installed files, but with an empty list of files. To fix this, run bmake
4106: deinstall and bmake install again. Now the package is registered with the
4107: list of files from PLIST.
1.48 wiz 4108:
1.219 nia 4109: 14. Run bmake clean update to run everything from above again in a single step,
1.184 rillig 4110: making sure that the PLIST is correct and the whole package is created as
4111: intended.
1.48 wiz 4112:
1.219 nia 4113: 15. Run pkglint to see if there's anything left to do.
1.48 wiz 4114:
1.219 nia 4115: 16. Commit the package to pkgsrc-wip or main pkgsrc; see Chapter 23, Submitting
1.184 rillig 4116: and Committing.
1.50 wiz 4117:
1.184 rillig 4118: 14.1. Common types of packages
1.1 dsieger 4119:
1.219 nia 4120: 14.1.1. Python modules and programs
1.1 dsieger 4121:
1.184 rillig 4122: Python modules and programs packages are easily created using a set of
4123: predefined variables.
1.1 dsieger 4124:
1.184 rillig 4125: If some Python versions are not supported by the software, set the
4126: PYTHON_VERSIONS_INCOMPATIBLE variable to the Python versions that are not
4127: supported, e.g.
1.1 dsieger 4128:
1.184 rillig 4129: PYTHON_VERSIONS_INCOMPATIBLE= 27
1.1 dsieger 4130:
1.184 rillig 4131: If the packaged software is a Python module, include one of ../../lang/python/
1.215 wiz 4132: egg.mk or ../../lang/python/extension.mk.
1.1 dsieger 4133:
1.215 wiz 4134: Most Python packages use setuptools ("eggs"). If the packaged software is using
4135: setuptools, you only need to include "../../lang/python/egg.mk".
1.1 dsieger 4136:
1.184 rillig 4137: Either way, the package directory should be called "py-software" and PKGNAME
4138: should be set to "${PYPKGPREFIX}-${DISTNAME}", e.g.
1.1 dsieger 4139:
1.184 rillig 4140: DISTNAME= foopymodule-1.2.10
4141: PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
1.1 dsieger 4142:
1.226 gutterid 4143: For software in PyPi, the name should match what PyPi specifies for "pip
4144: install software".
4145:
1.184 rillig 4146: If it is an application, include "../../lang/python/application.mk". In order
4147: to correctly set the path to the Python interpreter, use the REPLACE_PYTHON
4148: variable and set it to the list of files (paths relative to WRKSRC) that must
4149: be corrected. For example:
1.1 dsieger 4150:
1.184 rillig 4151: REPLACE_PYTHON= *.py
1.1 dsieger 4152:
1.184 rillig 4153: Some Python modules have separate distributions for Python-2.x and Python-3.x
4154: support. In pkgsrc this is handled by the versioned_dependencies.mk file. Set
4155: PYTHON_VERSIONED_DEPENDENCIES to the list of packages that should be depended
4156: upon and include "../../lang/python/versioned_dependencies.mk", then the pkgsrc
4157: infrastructure will depend on the appropriate package version. For example:
1.1 dsieger 4158:
1.184 rillig 4159: PYTHON_VERSIONED_DEPENDENCIES=dialog
1.1 dsieger 4160:
1.184 rillig 4161: Look inside versioned_dependencies.mk for a list of supported packages.
1.1 dsieger 4162:
1.219 nia 4163: 14.1.2. R packages
1.1 dsieger 4164:
1.184 rillig 4165: Simple R packages from CRAN are handled automatically by R2pkg, which is
4166: available in pkgtools/R2pkg. Individual packages (and optionally their
4167: dependencies) may be created and updated. R packages generally follow the same
4168: form, and most of the relevant information needed is contained in a DESCRIPTION
4169: file as part of each R package on CRAN. Consequently, R2pkg downloads that
4170: information and creates or updates a package in the canonical form. The
4171: resulting package should be reviewed for correctness.
1.1 dsieger 4172:
1.219 nia 4173: 14.1.3. TeXlive packages
1.1 dsieger 4174:
1.184 rillig 4175: TeXlive packages from CTAN are handled automatically by texlive2pkg, which is
4176: available in pkgtools/texlive2pkg.
1.1 dsieger 4177:
1.184 rillig 4178: If the TeXlive package name is not known, it may be useful to search CTAN. A "
4179: Contained in" field on the package page typically identifies the basename of
4180: the package file in the TeXlive archive.
1.1 dsieger 4181:
1.184 rillig 4182: If the TeXlive package name is known, download the files from the TeXlive
4183: archive. For package foo, you will need to download foo.tar.xz. Most TeXlive
4184: packages also have associated documentation packages, so download
4185: foo.doc.tar.xz at the same time. These files should be placed in the
4186: appropriate category directory, which is often but not always print. Then run
4187: the following command in the category directory.
1.1 dsieger 4188:
1.184 rillig 4189: texlive2pkg foo.tar.xz foo.doc.tar.xz
1.1 dsieger 4190:
1.184 rillig 4191: This will create two packages, tex-foo and tex-foo-doc. Be sure to check that
4192: both packages are correct.
1.1 dsieger 4193:
1.184 rillig 4194: Finally, CTAN currently does not include version information in package
4195: filenames and changes their contents periodically when updates occur.
4196: Consequently, pkgsrc avoids downloading distfiles directly from CTAN and
4197: instead relies on the pkgsrc archives. For each new or updated TeXlive package,
4198: e.g., the main one and the corresponding documentation, upload the distfiles
4199: with the following command in each package directory.
1.1 dsieger 4200:
1.184 rillig 4201: make upload-distfiles
1.117 sevan 4202:
1.184 rillig 4203: 14.2. Examples
1.117 sevan 4204:
1.184 rillig 4205: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 4206:
1.184 rillig 4207: 14.2.1.1. The initial package
1.1 dsieger 4208:
1.184 rillig 4209: Looking at the file pkgsrc/doc/TODO, I saw that the "nvu" package has not yet
4210: been imported into pkgsrc. As the description says it has to do with the web,
4211: the obvious choice for the category is "www".
1.1 dsieger 4212:
1.184 rillig 4213: $ mkdir www/nvu
4214: $ cd www/nvu
1.1 dsieger 4215:
1.184 rillig 4216: The web site says that the sources are available as a tar file, so I fed that
4217: URL to the url2pkg program:
1.1 dsieger 4218:
1.184 rillig 4219: $ url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
1.1 dsieger 4220:
1.184 rillig 4221: My editor popped up, and I added a PKGNAME line below the DISTNAME line, as the
4222: package name should not have the word "sources" in it. I also filled in the
4223: MAINTAINER, HOMEPAGE and COMMENT fields. Then the package Makefile looked like
4224: that:
1.1 dsieger 4225:
1.184 rillig 4226: # $NetBSD $
4227: #
1.1 dsieger 4228:
1.184 rillig 4229: DISTNAME= nvu-1.0-sources
4230: PKGNAME= nvu-1.0
4231: CATEGORIES= www
4232: MASTER_SITES= http://cvs.nvu.com/download/
4233: EXTRACT_SUFX= .tar.bz2
1.1 dsieger 4234:
1.184 rillig 4235: MAINTAINER= rillig@NetBSD.org
4236: HOMEPAGE= http://cvs.nvu.com/
4237: COMMENT= Web Authoring System
1.1 dsieger 4238:
1.184 rillig 4239: # url2pkg-marker (please do not remove this line.)
4240: .include "../../mk/bsd.pkg.mk"
1.1 dsieger 4241:
1.184 rillig 4242: On the first line of output above, an artificial space has been added between
4243: NetBSD and $, this is a workaround to prevent CVS expanding to the filename of
4244: the guide.
1.1 dsieger 4245:
1.184 rillig 4246: Then, I quit the editor and watched pkgsrc downloading a large source archive:
1.1 dsieger 4247:
1.184 rillig 4248: url2pkg> Running "make makesum" ...
4249: => Required installed package digest>=20010302: digest-20060826 found
4250: => Fetching nvu-1.0-sources.tar.bz2
4251: Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
4252: 100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA
4253: 29687976 bytes retrieved in 03:12 (150.77 KB/s)
4254: url2pkg> Running "make extract" ...
4255: => Required installed package digest>=20010302: digest-20060826 found
4256: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
4257: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
4258: work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc
4259: ===> Installing dependencies for nvu-1.0
4260: ===> Overriding tools for nvu-1.0
4261: ===> Extracting for nvu-1.0
4262: url2pkg> Adjusting the Makefile.
1.1 dsieger 4263:
1.184 rillig 4264: Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
1.1 dsieger 4265:
1.184 rillig 4266: Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
1.1 dsieger 4267:
1.184 rillig 4268: 14.2.1.2. Fixing all kinds of problems to make the package work
1.1 dsieger 4269:
1.184 rillig 4270: Now that the package has been extracted, let's see what's inside it. The
4271: package has a README.txt, but that only says something about mozilla, so it's
4272: probably useless for seeing what dependencies this package has. But since there
4273: is a GNU configure script in the package, let's hope that it will complain
4274: about everything it needs.
1.1 dsieger 4275:
1.184 rillig 4276: $ bmake
4277: => Required installed package digest>=20010302: digest-20060826 found
4278: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
4279: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
4280: ===> Patching for nvu-1.0
4281: ===> Creating toolchain wrappers for nvu-1.0
4282: ===> Configuring for nvu-1.0
4283: [...]
4284: configure: error: Perl 5.004 or higher is required.
4285: [...]
4286: WARNING: Please add USE_TOOLS+=perl to the package Makefile.
4287: [...]
1.1 dsieger 4288:
1.184 rillig 4289: That worked quite well. So I opened the package Makefile in my editor, and
4290: since it already has a USE_TOOLS line, I just appended "perl" to it. Since the
4291: dependencies of the package have changed now, and since a perl wrapper is
4292: automatically installed in the "tools" phase, I need to build the package from
4293: scratch.
1.1 dsieger 4294:
1.184 rillig 4295: $ bmake clean
4296: ===> Cleaning for nvu-1.0
4297: $ bmake
4298: [...]
4299: *** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
4300: GNU Make. You will not be able to build Mozilla without GNU Make.
4301: [...]
1.1 dsieger 4302:
1.184 rillig 4303: So I added "gmake" to the USE_TOOLS line and tried again (from scratch).
1.1 dsieger 4304:
1.184 rillig 4305: [...]
4306: checking for GTK - version >= 1.2.0... no
4307: *** Could not run GTK test program, checking why...
4308: [...]
1.1 dsieger 4309:
1.184 rillig 4310: Now to the other dependencies. The first question is: Where is the GTK package
4311: hidden in pkgsrc?
1.1 dsieger 4312:
1.184 rillig 4313: $ echo ../../*/gtk*
4314: [many packages ...]
4315: $ echo ../../*/gtk
4316: ../../x11/gtk
4317: $ echo ../../*/gtk2
4318: ../../x11/gtk2
4319: $ echo ../../*/gtk2/bui*
4320: ../../x11/gtk2/buildlink3.mk
1.1 dsieger 4321:
1.184 rillig 4322: The first try was definitely too broad. The second one had exactly one result,
4323: which is very good. But there is one pitfall with GNOME packages. Before GNOME
4324: 2 had been released, there were already many GNOME 1 packages in pkgsrc. To be
4325: able to continue to use these packages, the GNOME 2 packages were imported as
4326: separate packages, and their names usually have a "2" appended. So I checked
4327: whether this was the case here, and indeed it was.
1.1 dsieger 4328:
1.184 rillig 4329: Since the GTK2 package has a buildlink3.mk file, adding the dependency is very
4330: easy. I just inserted an .include line before the last line of the package
4331: Makefile, so that it now looks like this:
1.1 dsieger 4332:
1.184 rillig 4333: [...]
4334: .include "../../x11/gtk2/buildlink3.mk"
4335: .include "../../mk/bsd.pkg.mk
1.1 dsieger 4336:
1.184 rillig 4337: After another bmake clean && bmake, the answer was:
1.108 rillig 4338:
1.184 rillig 4339: [...]
4340: checking for gtk-config... /home/roland/pkg/bin/gtk-config
4341: checking for GTK - version >= 1.2.0... no
4342: *** Could not run GTK test program, checking why...
4343: *** The test program failed to compile or link. See the file config.log for the
4344: *** exact error that occured. This usually means GTK was incorrectly installed
4345: *** or that you have moved GTK since it was installed. In the latter case, you
4346: *** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
4347: configure: error: Test for GTK failed.
4348: [...]
1.1 dsieger 4349:
1.184 rillig 4350: In this particular case, the assumption that "every package prefers GNOME 2"
4351: had been wrong. The first of the lines above told me that this package really
4352: wanted to have the GNOME 1 version of GTK. If the package had looked for GTK2,
4353: it would have looked for pkg-config instead of gtk-config. So I changed the x11
4354: /gtk2 to x11/gtk in the package Makefile, and tried again.
1.1 dsieger 4355:
1.184 rillig 4356: [...]
4357: cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...]
4358: In file included from xpidl.c:42:
4359: xpidl.h:53:24: libIDL/IDL.h: No such file or directory
4360: In file included from xpidl.c:42:
4361: xpidl.h:132: error: parse error before "IDL_ns"
4362: [...]
1.1 dsieger 4363:
1.184 rillig 4364: The package still does not find all of its dependencies. Now the question is:
4365: Which package provides the libIDL/IDL.h header file?
1.1 dsieger 4366:
1.184 rillig 4367: $ echo ../../*/*idl*
4368: ../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
4369: $ echo ../../*/*IDL*
4370: ../../net/libIDL
1.1 dsieger 4371:
1.184 rillig 4372: Let's take the one from the second try. So I included the ../../net/libIDL/
4373: buildlink3.mk file and tried again. But the error didn't change. After digging
4374: through some of the code, I concluded that the build process of the package was
4375: broken and couldn't have ever worked, but since the Mozilla source tree is
4376: quite large, I didn't want to fix it. So I added the following to the package
4377: Makefile and tried again:
1.1 dsieger 4378:
1.184 rillig 4379: CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
4380: BUILDLINK_TRANSFORM+= l:IDL:IDL-2
1.1 dsieger 4381:
1.184 rillig 4382: The latter line is needed because the package expects the library libIDL.so,
4383: but only libIDL-2.so is available. So I told the compiler wrapper to rewrite
4384: that on the fly.
1.1 dsieger 4385:
1.184 rillig 4386: The next problem was related to a recent change of the FreeType interface. I
4387: looked up in www/seamonkey which patch files were relevant for this issue and
4388: copied them to the patches directory. Then I retried, fixed the patches so that
4389: they applied cleanly and retried again. This time, everything worked.
1.1 dsieger 4390:
1.184 rillig 4391: 14.2.1.3. Installing the package
1.1 dsieger 4392:
1.184 rillig 4393: $ bmake CHECK_FILES=no install
4394: [...]
4395: $ bmake print-PLIST >PLIST
4396: $ bmake deinstall
4397: $ bmake install
1.1 dsieger 4398:
1.184 rillig 4399: Chapter 15. Programming in Makefiles
1.1 dsieger 4400:
1.184 rillig 4401: Table of Contents
1.1 dsieger 4402:
1.184 rillig 4403: 15.1. Caveats
4404: 15.2. Makefile variables
4405: 15.2.1. Naming conventions
4406: 15.3. Code snippets
4407: 15.3.1. Adding things to a list
4408: 15.3.2. Echoing a string exactly as-is
4409: 15.3.3. Passing CFLAGS to GNU configure scripts
4410: 15.3.4. Handling possibly empty variables
1.229 gutterid 4411: 15.3.5. Testing yes/no variables in conditions
1.1 dsieger 4412:
1.184 rillig 4413: Pkgsrc consists of many Makefile fragments, each of which forms a well-defined
4414: part of the pkgsrc system. Using the make(1) system as a programming language
4415: for a big system like pkgsrc requires some discipline to keep the code correct
4416: and understandable.
1.1 dsieger 4417:
1.184 rillig 4418: The basic ingredients for Makefile programming are variables and shell
4419: commands. Among these shell commands may even be more complex ones like awk(1)
4420: programs. To make sure that every shell command runs as intended it is
4421: necessary to quote all variables correctly when they are used.
1.1 dsieger 4422:
1.184 rillig 4423: This chapter describes some patterns that appear quite often in Makefiles,
4424: including the pitfalls that come along with them.
1.1 dsieger 4425:
1.184 rillig 4426: 15.1. Caveats
1.1 dsieger 4427:
1.184 rillig 4428: * When you are creating a file as a target of a rule, always write the data
4429: to a temporary file first and finally rename that file. Otherwise there
4430: might occur an error in the middle of generating the file, and when the
4431: user runs make(1) for the second time, the file exists and will not be
4432: regenerated properly. Example:
1.1 dsieger 4433:
1.184 rillig 4434: wrong:
4435: @echo "line 1" > ${.TARGET}
4436: @echo "line 2" >> ${.TARGET}
4437: @false
1.1 dsieger 4438:
1.184 rillig 4439: correct:
4440: @echo "line 1" > ${.TARGET}.tmp
4441: @echo "line 2" >> ${.TARGET}.tmp
4442: @false
4443: @mv ${.TARGET}.tmp ${.TARGET}
1.1 dsieger 4444:
1.184 rillig 4445: When you run make wrong twice, the file wrong will exist, although there
4446: was an error message in the first run. On the other hand, running make
4447: correct gives an error message twice, as expected.
1.1 dsieger 4448:
1.184 rillig 4449: You might remember that make(1) sometimes removes ${.TARGET} in case of
4450: error, but this only happens when it is interrupted, for example by
4451: pressing Ctrl+C. This does not happen when one of the commands fails (like
4452: false(1) above).
1.1 dsieger 4453:
1.184 rillig 4454: 15.2. Makefile variables
1.1 dsieger 4455:
1.184 rillig 4456: Makefile variables contain strings that can be processed using the five
4457: operators =, +=, ?=, := and !=, which are described in the make(1) man page.
1.1 dsieger 4458:
1.184 rillig 4459: When a variable's value is parsed from a Makefile, the hash character # and the
4460: backslash character \ are handled specially. If a backslash is the last
4461: character in a line, that backslash is removed from the line and the line
4462: continues with the next line of the file.
1.1 dsieger 4463:
1.184 rillig 4464: The # character starts a comment that reaches until the end of the line. To get
4465: an actual # character, such as in a URL, write \# instead.
1.1 dsieger 4466:
1.184 rillig 4467: The evaluation of variables either happens immediately or lazy. It happens
4468: immediately when the variable occurs on the right-hand side of the := or the !=
4469: operator, in a .if condition or a .for loop. In the other cases, it is
4470: evaluated lazily.
1.1 dsieger 4471:
1.184 rillig 4472: Some of the modifiers split the string into words and then operate on the
4473: words, others operate on the string as a whole. When a string is split into
4474: words, double quotes and single quotes are interpreted as delimiters, just like
4475: in sh(1).
1.1 dsieger 4476:
1.184 rillig 4477: 15.2.1. Naming conventions
1.1 dsieger 4478:
1.184 rillig 4479: * All variable names starting with an underscore are reserved for use by the
4480: pkgsrc infrastructure. They shall not be used by packages.
1.1 dsieger 4481:
1.184 rillig 4482: * In .for loops you should use lowercase variable names for the iteration
4483: variables.
1.1 dsieger 4484:
1.184 rillig 4485: * All list variables should have a plural name, such as PKG_OPTIONS or
4486: DISTFILES.
1.1 dsieger 4487:
1.184 rillig 4488: 15.3. Code snippets
1.1 dsieger 4489:
1.184 rillig 4490: 15.3.1. Adding things to a list
1.1 dsieger 4491:
1.184 rillig 4492: When adding a string that possibly contains whitespace or quotes to a list
4493: (example 1), it must be quoted using the :Q modifier.
1.1 dsieger 4494:
1.184 rillig 4495: When adding another list to a list (example 2), it must not be quoted, since
4496: its elements are already quoted.
1.1 dsieger 4497:
1.184 rillig 4498: STRING= foo * bar `date`
4499: LIST= # empty
4500: ANOTHER_LIST= a=b c=d
1.1 dsieger 4501:
1.184 rillig 4502: LIST+= ${STRING:Q} # 1
4503: LIST+= ${ANOTHER_LIST} # 2
1.1 dsieger 4504:
1.184 rillig 4505: 15.3.2. Echoing a string exactly as-is
1.1 dsieger 4506:
1.184 rillig 4507: Echoing a string containing special characters needs special work.
1.1 dsieger 4508:
1.184 rillig 4509: STRING= foo bar < > * `date` $$HOME ' "
4510: EXAMPLE_ENV= string=${STRING:Q} x=multiple\ quoted\ words
1.1 dsieger 4511:
1.184 rillig 4512: all:
4513: echo ${STRING} # 1
4514: echo ${STRING:Q} # 2
4515: printf '%s\n' ${STRING:Q}'' # 3
4516: env ${EXAMPLE_ENV} sh -c 'echo "$$string"; echo "$$x"' # 4
1.1 dsieger 4517:
1.184 rillig 4518: Example 1 leads to a syntax error in the shell, as the characters are just
4519: copied.
1.1 dsieger 4520:
1.184 rillig 4521: Example 2 quotes the string so that the shell interprets it correctly. But the
4522: echo command may additionally interpret strings with a leading dash or those
4523: containing backslashes.
1.1 dsieger 4524:
1.184 rillig 4525: Example 3 can handle arbitrary strings, since printf(1) only interprets the
4526: format string, but not the next argument. The trailing single quotes handle the
4527: case when the string is empty. In that case, the :Q modifier would result in an
4528: empty string too, which would then be skipped by the shell. For printf(1) this
4529: doesn't make a difference, but other programs may care.
1.1 dsieger 4530:
1.184 rillig 4531: In example 4, the EXAMPLE_ENV does not need to be quoted because the quoting
4532: has already been done when adding elements to the list.
1.1 dsieger 4533:
1.184 rillig 4534: 15.3.3. Passing CFLAGS to GNU configure scripts
1.1 dsieger 4535:
1.184 rillig 4536: When passing CFLAGS or similar variables to a GNU-style configure script
4537: (especially those that call other configure scripts), it must not have leading
4538: or trailing whitespace, since otherwise the configure script gets confused. To
4539: trim leading and trailing whitespace, use the :M modifier, as in the following
4540: example:
1.1 dsieger 4541:
1.184 rillig 4542: CPPFLAGS= # empty
4543: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX}\"
4544: CPPFLAGS+= ${MY_CPPFLAGS}
1.1 dsieger 4545:
1.184 rillig 4546: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
1.1 dsieger 4547:
1.184 rillig 4548: all:
4549: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
4550: echo x${CONFIGURE_ARGS:Q}x # properly trimmed
1.1 dsieger 4551:
1.184 rillig 4552: In this example, CPPFLAGS has both leading and trailing whitespace because the
4553: += operator always adds a space.
1.1 dsieger 4554:
1.184 rillig 4555: 15.3.4. Handling possibly empty variables
1.1 dsieger 4556:
1.184 rillig 4557: When a possibly empty variable is used in a shell program, it may lead to a
4558: syntax error.
1.1 dsieger 4559:
1.184 rillig 4560: EGFILES= # empty
1.1 dsieger 4561:
1.184 rillig 4562: install-examples: # produces a syntax error in the shell
4563: for egfile in ${EGFILES}; do \
4564: echo "Installing $$egfile"; \
4565: done
1.1 dsieger 4566:
1.184 rillig 4567: The shell only sees the text for egfile in ; do, since ${EGFILES} is replaced
4568: with an empty string by make(1). To fix this syntax error, use one of the
4569: snippets below.
1.1 dsieger 4570:
1.229 gutterid 4571: EGFILES= # empty
1.1 dsieger 4572:
1.184 rillig 4573: install-examples:
4574: for egfile in ${EGFILES} ""; do \
4575: [ -n "$$egfile" ] || continue; \
4576: echo "Installing $$egfile"; \
4577: done
1.1 dsieger 4578:
1.184 rillig 4579: In this case, an empty string is appended to the iteration list (to prevent the
4580: syntax error) and filtered out later.
1.1 dsieger 4581:
1.184 rillig 4582: EGFILES= # empty
1.1 dsieger 4583:
1.184 rillig 4584: install-examples:
4585: .for egfile in ${EGFILES}
4586: echo "Installing ${egfile}"
4587: .endfor
1.1 dsieger 4588:
1.184 rillig 4589: If one of the filenames contains special characters, it should be enclosed in
4590: single or double quotes.
1.1 dsieger 4591:
1.184 rillig 4592: To have a shell command test whether a make variable is empty, use the
4593: following code: ${TEST} -z ${POSSIBLY_EMPTY:Q}"".
1.1 dsieger 4594:
1.229 gutterid 4595: 15.3.5. Testing yes/no variables in conditions
4596:
4597: When a variable can have the values yes or no, use the following pattern to
4598: test the variable:
4599:
4600: .if ${VAR:U:tl} == "yes"
4601: # do something
4602: .endif
4603:
4604: The :U modifier is only necessary if the variable can be undefined. If the
4605: variable is guaranteed to be defined, the :U can be omitted.
4606:
4607: The :tl modifier converts the variable value to lowercase, allowing for the
4608: values yes, Yes, YES.
4609:
1.184 rillig 4610: Chapter 16. Options handling
1.1 dsieger 4611:
4612: Table of Contents
4613:
1.184 rillig 4614: 16.1. Global default options
4615: 16.2. Converting packages to use bsd.options.mk
4616: 16.3. Option Names
4617: 16.4. Determining the options of dependencies
1.1 dsieger 4618:
4619: Many packages have the ability to be built to support different sets of
4620: features. bsd.options.mk is a framework in pkgsrc that provides generic
4621: handling of those options that determine different ways in which the packages
4622: can be built. It's possible for the user to specify exactly which sets of
4623: options will be built into a package or to allow a set of global default
4624: options apply.
4625:
1.7 rillig 4626: There are two broad classes of behaviors that one might want to control via
4627: options. One is whether some particular feature is enabled in a program that
4628: will be built anyway, often by including or not including a dependency on some
4629: other package. The other is whether or not an additional program will be built
4630: as part of the package. Generally, it is better to make a split package for
4631: such additional programs instead of using options, because it enables binary
4632: packages to be built which can then be added separately. For example, the foo
4633: package might have minimal dependencies (those packages without which foo
4634: doesn't make sense), and then the foo-gfoo package might include the GTK
4635: frontend program gfoo. This is better than including a gtk option to foo that
4636: adds gfoo, because either that option is default, in which case binary users
4637: can't get foo without gfoo, or not default, in which case they can't get gfoo.
4638: With split packages, they can install foo without having GTK, and later decide
4639: to install gfoo (pulling in GTK at that time). This is an advantage to source
4640: users too, avoiding the need for rebuilds.
4641:
4642: Plugins with widely varying dependencies should usually be split instead of
4643: options.
4644:
4645: It is often more work to maintain split packages, especially if the upstream
4646: package does not support this. The decision of split vs. option should be made
4647: based on the likelihood that users will want or object to the various pieces,
4648: the size of the dependencies that are included, and the amount of work.
4649:
4650: A further consideration is licensing. Non-free parts, or parts that depend on
4651: non-free dependencies (especially plugins) should almost always be split if
4652: feasible.
4653:
1.184 rillig 4654: 16.1. Global default options
1.1 dsieger 4655:
4656: Global default options are listed in PKG_DEFAULT_OPTIONS, which is a list of
4657: the options that should be built into every package if that option is
1.4 rillig 4658: supported. This variable should be set in mk.conf.
1.1 dsieger 4659:
1.184 rillig 4660: 16.2. Converting packages to use bsd.options.mk
1.1 dsieger 4661:
4662: The following example shows how bsd.options.mk should be used by the
4663: hypothetical ``wibble'' package, either in the package Makefile, or in a file,
4664: e.g. options.mk, that is included by the main package Makefile.
4665:
4666: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
4667: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
4668: PKG_OPTIONS_OPTIONAL_GROUPS= database
4669: PKG_OPTIONS_GROUP.database= mysql pgsql
4670: PKG_SUGGESTED_OPTIONS= wibble-foo
4671: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
4672: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
4673:
4674: .include "../../mk/bsd.prefs.mk"
4675:
4676: # this package was previously named wibble2
4677: .if defined(PKG_OPTIONS.wibble2)
4678: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
4679: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
4680: "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead."
4681: .endif
4682:
4683: .include "../../mk/bsd.options.mk"
4684:
4685: # Package-specific option-handling
4686:
4687: ###
4688: ### FOO support
4689: ###
4690: .if !empty(PKG_OPTIONS:Mwibble-foo)
4691: CONFIGURE_ARGS+= --enable-foo
4692: .endif
4693:
4694: ###
4695: ### LDAP support
4696: ###
4697: .if !empty(PKG_OPTIONS:Mldap)
4698: . include "../../databases/openldap-client/buildlink3.mk"
4699: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client}
4700: .endif
4701:
4702: ###
4703: ### database support
4704: ###
4705: .if !empty(PKG_OPTIONS:Mmysql)
4706: . include "../../mk/mysql.buildlink3.mk"
4707: .endif
4708: .if !empty(PKG_OPTIONS:Mpgsql)
4709: . include "../../mk/pgsql.buildlink3.mk"
4710: .endif
4711:
4712: The first section contains the information about which build options are
4713: supported by the package, and any default options settings if needed.
4714:
4715: 1. PKG_OPTIONS_VAR is the name of the make(1) variable that the user can set
4716: to override the default options. It should be set to PKG_OPTIONS.pkgbase.
4717: Do not set it to PKG_OPTIONS.${PKGBASE}, since PKGBASE is not defined at
4718: the point where the options are processed.
4719:
4720: 2. PKG_SUPPORTED_OPTIONS is a list of build options supported by the package.
4721:
4722: 3. PKG_OPTIONS_OPTIONAL_GROUPS is a list of names of groups of mutually
4723: exclusive options. The options in each group are listed in
4724: PKG_OPTIONS_GROUP.groupname. The most specific setting of any option from
4725: the group takes precedence over all other options in the group. Options
4726: from the groups will be automatically added to PKG_SUPPORTED_OPTIONS.
4727:
4728: 4. PKG_OPTIONS_REQUIRED_GROUPS is like PKG_OPTIONS_OPTIONAL_GROUPS, but
4729: building the packages will fail if no option from the group is selected.
4730:
4731: 5. PKG_OPTIONS_NONEMPTY_SETS is a list of names of sets of options. At least
4732: one option from each set must be selected. The options in each set are
4733: listed in PKG_OPTIONS_SET.setname. Options from the sets will be
4734: automatically added to PKG_SUPPORTED_OPTIONS. Building the package will
4735: fail if no option from the set is selected.
4736:
4737: 6. PKG_SUGGESTED_OPTIONS is a list of build options which are enabled by
4738: default.
4739:
4740: 7. PKG_OPTIONS_LEGACY_VARS is a list of "USE_VARIABLE:option" pairs that map
1.4 rillig 4741: legacy mk.conf variables to their option counterparts. Pairs should be
1.1 dsieger 4742: added with "+=" to keep the listing of global legacy variables. A warning
4743: will be issued if the user uses a legacy variable.
4744:
4745: 8. PKG_OPTIONS_LEGACY_OPTS is a list of "old-option:new-option" pairs that map
4746: options that have been renamed to their new counterparts. Pairs should be
4747: added with "+=" to keep the listing of global legacy options. A warning
4748: will be issued if the user uses a legacy option.
4749:
4750: 9. PKG_LEGACY_OPTIONS is a list of options implied by deprecated variables
4751: used. This can be used for cases that neither PKG_OPTIONS_LEGACY_VARS nor
4752: PKG_OPTIONS_LEGACY_OPTS can handle, e. g. when PKG_OPTIONS_VAR is renamed.
4753:
4754: 10. PKG_OPTIONS_DEPRECATED_WARNINGS is a list of warnings about deprecated
4755: variables or options used, and what to use instead.
4756:
4757: A package should never modify PKG_DEFAULT_OPTIONS or the variable named in
4758: PKG_OPTIONS_VAR. These are strictly user-settable. To suggest a default set of
4759: options, use PKG_SUGGESTED_OPTIONS.
4760:
4761: PKG_OPTIONS_VAR must be defined before including bsd.options.mk. If none of
4762: PKG_SUPPORTED_OPTIONS, PKG_OPTIONS_OPTIONAL_GROUPS, and
4763: PKG_OPTIONS_REQUIRED_GROUPS are defined (as can happen with platform-specific
4764: options if none of them is supported on the current platform), PKG_OPTIONS is
4765: set to the empty list and the package is otherwise treated as not using the
4766: options framework.
4767:
4768: After the inclusion of bsd.options.mk, the variable PKG_OPTIONS contains the
4769: list of selected build options, properly filtered to remove unsupported and
4770: duplicate options.
4771:
4772: The remaining sections contain the logic that is specific to each option. The
4773: correct way to check for an option is to check whether it is listed in
4774: PKG_OPTIONS:
4775:
4776: .if !empty(PKG_OPTIONS:Moption)
4777:
1.184 rillig 4778: 16.3. Option Names
1.1 dsieger 4779:
4780: Options that enable similar features in different packages (like optional
4781: support for a library) should use a common name in all packages that support it
4782: (like the name of the library). If another package already has an option with
4783: the same meaning, use the same name.
4784:
4785: Options that enable features specific to one package, where it's unlikely that
4786: another (unrelated) package has the same (or a similar) optional feature,
4787: should use a name prefixed with pkgname-.
4788:
4789: If a group of related packages share an optional feature specific to that
4790: group, prefix it with the name of the "main" package (e. g.
4791: djbware-errno-hack).
4792:
4793: For new options, add a line to mk/defaults/options.description. Lines have two
4794: fields, separated by tab. The first field is the option name, the second its
4795: description. The description should be a whole sentence (starting with an
4796: uppercase letter and ending with a period) that describes what enabling the
4797: option does. E. g. "Enable ispell support." The file is sorted by option names.
4798:
1.184 rillig 4799: 16.4. Determining the options of dependencies
1.7 rillig 4800:
4801: When writing buildlink3.mk files, it is often necessary to list different
4802: dependencies based on the options with which the package was built. For
4803: querying these options, the file pkgsrc/mk/pkg-build-options.mk should be used.
4804: A typical example looks like this:
4805:
4806: pkgbase := libpurple
4807: .include "../../mk/pkg-build-options.mk"
4808:
4809: .if !empty(PKG_BUILD_OPTIONS.libpurple:Mdbus)
4810: ...
4811: .endif
4812:
4813: Including pkg-build-options.mk here will set the variable
4814: PKG_BUILD_OPTIONS.libpurple to the build options of the libpurple package,
4815: which can then be queried like PKG_OPTIONS in the options.mk file. See the file
4816: pkg-build-options.mk for more details.
4817:
1.184 rillig 4818: Chapter 17. Tools needed for building or running
4819:
4820: Table of Contents
4821:
4822: 17.1. Tools for pkgsrc builds
4823: 17.2. Tools needed by packages
4824: 17.3. Tools provided by platforms
4825:
4826: The USE_TOOLS definition is used both internally by pkgsrc and also for
4827: individual packages to define what commands are needed for building a package
4828: (like TOOL_DEPENDS) or for later run-time of an installed packaged (such as
4829: DEPENDS). If the native system provides an adequate tool, then in many cases, a
4830: pkgsrc package will not be used.
4831:
4832: When building a package, the replacement tools are made available in a
4833: directory (as symlinks or wrapper scripts) that is early in the executable
4834: search path. Just like the buildlink system, this helps with consistent builds.
4835:
4836: A tool may be needed to help build a specific package. For example, perl, GNU
4837: make (gmake) or yacc may be needed.
4838:
4839: Also a tool may be needed, for example, because the native system's supplied
4840: tool may be inefficient for building a package with pkgsrc. For example, a
4841: package may need GNU awk, bison (instead of yacc) or a better sed.
4842:
4843: The tools used by a package can be listed by running make show-tools.
4844:
4845: 17.1. Tools for pkgsrc builds
4846:
4847: The default set of tools used by pkgsrc is defined in bsd.pkg.mk. This includes
4848: standard Unix tools, such as: cat, awk, chmod, test, and so on. These can be
4849: seen by running: make show-var VARNAME=USE_TOOLS.
4850:
4851: If a package needs a specific program to build then the USE_TOOLS variable can
4852: be used to define the tools needed.
4853:
4854: 17.2. Tools needed by packages
4855:
4856: In the following examples, the :run means that it is needed at run-time (and
4857: becomes a DEPENDS). The default is a build dependency which can be set with
4858: :build. (So in this example, it is the same as gmake:build and
4859: pkg-config:build.)
4860:
4861: USE_TOOLS+= gmake perl:run pkg-config
4862:
4863: When using the tools framework, a TOOLS_PATH.foo variable is defined which
4864: contains the full path to the appropriate tool. For example, TOOLS_PATH.bash
4865: could be "/bin/bash" on Linux systems.
4866:
4867: If you always need a pkgsrc version of the tool at run-time, then just use
4868: DEPENDS instead.
4869:
4870: 17.3. Tools provided by platforms
4871:
4872: When improving or porting pkgsrc to a new platform, have a look at (or create)
4873: the corresponding platform specific make file fragment under pkgsrc/mk/tools/
4874: tools.${OPSYS}.mk which defines the name of the common tools. For example:
4875:
4876: .if exists(/usr/bin/bzcat)
4877: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
4878: .elif exists(/usr/bin/bzip2)
4879: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
4880: .endif
4881:
4882: TOOLS_PLATFORM.true?= true # shell builtin
4883:
4884: Chapter 18. Buildlink methodology
1.1 dsieger 4885:
4886: Table of Contents
4887:
1.184 rillig 4888: 18.1. Converting packages to use buildlink3
4889: 18.2. Writing buildlink3.mk files
4890: 18.2.1. Anatomy of a buildlink3.mk file
4891: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
1.232 gutterid 4892: buildlink3.mk files
1.184 rillig 4893: 18.3. Writing builtin.mk files
4894: 18.3.1. Anatomy of a builtin.mk file
4895: 18.3.2. Global preferences for native or pkgsrc software
4896:
4897: Buildlink is a framework in pkgsrc that controls what headers and libraries are
4898: seen by a package's configure and build processes. This is implemented in a two
4899: step process:
4900:
4901: 1. Symlink headers and libraries for dependencies into BUILDLINK_DIR, which by
4902: default is a subdirectory of WRKDIR.
4903:
4904: 2. Create wrapper scripts that are used in place of the normal compiler tools
4905: that translate -I${LOCALBASE}/include and -L${LOCALBASE}/lib into
4906: references to BUILDLINK_DIR. The wrapper scripts also make native compiler
4907: on some operating systems look like GCC, so that packages that expect GCC
4908: won't require modifications to build with those native compilers.
4909:
4910: This normalizes the environment in which a package is built so that the package
4911: may be built consistently despite what other software may be installed. Please
4912: note that the normal system header and library paths, e.g. /usr/include, /usr/
4913: lib, etc., are always searched -- buildlink3 is designed to insulate the
4914: package build from non-system-supplied software.
4915:
4916: 18.1. Converting packages to use buildlink3
1.1 dsieger 4917:
1.184 rillig 4918: The process of converting packages to use the buildlink3 framework ("bl3ifying"
4919: ) is fairly straightforward. The things to keep in mind are:
1.1 dsieger 4920:
1.184 rillig 4921: 1. Ensure that the build always calls the wrapper scripts instead of the
4922: actual toolchain. Some packages are tricky, and the only way to know for
4923: sure is the check ${WRKDIR}/.work.log to see if the wrappers are being
4924: invoked.
1.1 dsieger 4925:
1.184 rillig 4926: 2. Don't override PREFIX from within the package Makefile, e.g. Java VMs,
4927: standalone shells, etc., because the code to symlink files into $
4928: {BUILDLINK_DIR} looks for files relative to "pkg_info -qp pkgname".
1.1 dsieger 4929:
1.184 rillig 4930: 3. Remember that only the buildlink3.mk files that you list in a package's
4931: Makefile are added as dependencies for that package.
1.1 dsieger 4932:
1.184 rillig 4933: If a dependency on a particular package is required for its libraries and
4934: headers, then we replace:
1.1 dsieger 4935:
1.184 rillig 4936: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 dsieger 4937:
1.184 rillig 4938: with
1.1 dsieger 4939:
1.184 rillig 4940: .include "../../category/foo/buildlink3.mk"
1.1 dsieger 4941:
1.184 rillig 4942: The buildlink3.mk files usually define the required dependencies. If you need a
4943: newer version of the dependency when using buildlink3.mk files, then you can
4944: define it in your Makefile; for example:
1.1 dsieger 4945:
1.184 rillig 4946: BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0
4947: .include "../../category/foo/buildlink3.mk"
1.1 dsieger 4948:
1.184 rillig 4949: There are several buildlink3.mk files in pkgsrc/mk that handle special package
4950: issues:
1.1 dsieger 4951:
1.184 rillig 4952: * bdb.buildlink3.mk chooses either the native or a pkgsrc Berkeley DB
4953: implementation based on the values of BDB_ACCEPTED and BDB_DEFAULT.
1.1 dsieger 4954:
1.184 rillig 4955: * curses.buildlink3.mk: If the system comes with neither Curses nor NCurses,
4956: this will take care to install the devel/ncurses package.
1.1 dsieger 4957:
1.184 rillig 4958: * krb5.buildlink3.mk uses the value of KRB5_ACCEPTED to choose between adding
4959: a dependency on Heimdal or MIT-krb5 for packages that require a Kerberos 5
4960: implementation.
1.1 dsieger 4961:
1.184 rillig 4962: * motif.buildlink3.mk checks for a system-provided Motif installation or adds
4963: a dependency on x11/lesstif or x11/motif. The user can set MOTIF_TYPE to "
4964: dt", "lesstif" or "motif" to choose which Motif version will be used.
1.1 dsieger 4965:
1.184 rillig 4966: * readline.buildlink3.mk checks for a system-provided GNU readline or
4967: editline (libedit) installation, or adds a dependency on devel/readline,
4968: devel/editline. The user can set READLINE_DEFAULT to choose readline
4969: implementation. If your package really needs GNU readline library, its
4970: Makefile should include devel/readline/buildlink3.mk instead of
4971: readline.buildlink3.mk.
1.1 dsieger 4972:
1.184 rillig 4973: * oss.buildlink3.mk defines several variables that may be used by packages
4974: that use the Open Sound System (OSS) API.
1.1 dsieger 4975:
1.184 rillig 4976: * pgsql.buildlink3.mk will accept any of the Postgres versions in the
4977: variable PGSQL_VERSIONS_ACCEPTED and default to the version
4978: PGSQL_VERSION_DEFAULT. See the file for more information.
1.1 dsieger 4979:
1.184 rillig 4980: * pthread.buildlink3.mk uses the value of PTHREAD_OPTS and checks for native
4981: pthreads or adds a dependency on devel/pth as needed.
1.1 dsieger 4982:
1.184 rillig 4983: * xaw.buildlink3.mk uses the value of XAW_TYPE to choose a particular Athena
4984: widgets library.
1.1 dsieger 4985:
1.184 rillig 4986: The comments in those buildlink3.mk files provide a more complete description
4987: of how to use them properly.
1.1 dsieger 4988:
1.184 rillig 4989: 18.2. Writing buildlink3.mk files
1.1 dsieger 4990:
1.184 rillig 4991: A package's buildlink3.mk file is included by Makefiles to indicate the need to
4992: compile and link against header files and libraries provided by the package. A
4993: buildlink3.mk file should always provide enough information to add the correct
4994: type of dependency relationship and include any other buildlink3.mk files that
4995: it needs to find headers and libraries that it needs in turn.
1.1 dsieger 4996:
1.184 rillig 4997: To generate an initial buildlink3.mk file for further editing, Rene Hexel's
4998: pkgtools/createbuildlink package is highly recommended. For most packages, the
4999: following command will generate a good starting point for buildlink3.mk files:
1.1 dsieger 5000:
1.184 rillig 5001: % cd pkgsrc/category/pkgdir
5002: % createbuildlink >buildlink3.mk
1.1 dsieger 5003:
5004:
1.184 rillig 5005: 18.2.1. Anatomy of a buildlink3.mk file
1.1 dsieger 5006:
1.184 rillig 5007: The following real-life example buildlink3.mk is taken from pkgsrc/graphics/
5008: tiff:
1.14 jmcneill 5009:
1.184 rillig 5010: BUILDLINK_TREE+= tiff
1.1 dsieger 5011:
1.184 rillig 5012: .if !defined(TIFF_BUILDLINK3_MK)
5013: TIFF_BUILDLINK3_MK:=
1.1 dsieger 5014:
1.184 rillig 5015: BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1
5016: BUILDLINK_ABI_DEPENDS.tiff+= tiff>=3.7.2nb1
5017: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
1.1 dsieger 5018:
1.184 rillig 5019: .include "../../devel/zlib/buildlink3.mk"
5020: .include "../../graphics/jpeg/buildlink3.mk"
5021: .endif # TIFF_BUILDLINK3_MK
1.1 dsieger 5022:
1.184 rillig 5023: BUILDLINK_TREE+= -tiff
1.1 dsieger 5024:
1.184 rillig 5025: The header and footer manipulate BUILDLINK_TREE, which is common across all
5026: buildlink3.mk files and is used to track the dependency tree.
1.1 dsieger 5027:
1.184 rillig 5028: The main section is protected from multiple inclusion and controls how the
5029: dependency on pkg is added. Several important variables are set in the section:
1.1 dsieger 5030:
1.185 wiz 5031: * BUILDLINK_API_DEPENDS.pkg is the dependency version recorded in the
1.184 rillig 5032: installed package; this should always be set using += to ensure that we're
5033: appending to any pre-existing list of values. This variable should be set
1.185 wiz 5034: to the last version of the package that had an backwards-incompatible API
1.184 rillig 5035: change.
1.1 dsieger 5036:
1.184 rillig 5037: * BUILDLINK_PKGSRCDIR.pkg is the location of the pkg pkgsrc directory.
1.1 dsieger 5038:
1.184 rillig 5039: * BUILDLINK_DEPMETHOD.pkg (not shown above) controls whether we use
1.236 gutterid 5040: BUILD_DEPENDS or DEPENDS to add the dependency on pkg. The build dependency
5041: is selected by setting BUILDLINK_DEPMETHOD.pkg to "build". By default, the
5042: full dependency is used.
1.1 dsieger 5043:
1.184 rillig 5044: * BUILDLINK_INCDIRS.pkg and BUILDLINK_LIBDIRS.pkg (not shown above) are lists
5045: of subdirectories of ${BUILDLINK_PREFIX.pkg} to add to the header and
5046: library search paths. These default to "include" and "lib" respectively.
1.1 dsieger 5047:
1.184 rillig 5048: * BUILDLINK_CPPFLAGS.pkg (not shown above) is the list of preprocessor flags
5049: to add to CPPFLAGS, which are passed on to the configure and build phases.
5050: The "-I" option should be avoided and instead be handled using
5051: BUILDLINK_INCDIRS.pkg as above.
1.66 asau 5052:
1.184 rillig 5053: The following variables are all optionally defined within this second section
5054: (protected against multiple inclusion) and control which package files are
5055: symlinked into ${BUILDLINK_DIR} and how their names are transformed during the
5056: symlinking:
1.23 jakllsch 5057:
1.184 rillig 5058: * BUILDLINK_FILES.pkg (not shown above) is a shell glob pattern relative to $
5059: {BUILDLINK_PREFIX.pkg} to be symlinked into ${BUILDLINK_DIR}, e.g. include/
5060: *.h.
1.1 dsieger 5061:
1.184 rillig 5062: * BUILDLINK_FILES_CMD.pkg (not shown above) is a shell pipeline that outputs
5063: to stdout a list of files relative to ${BUILDLINK_PREFIX.pkg}. The
5064: resulting files are to be symlinked into ${BUILDLINK_DIR}. By default, this
5065: takes the +CONTENTS of a pkg and filters it through $
5066: {BUILDLINK_CONTENTS_FILTER.pkg}.
1.1 dsieger 5067:
1.184 rillig 5068: * BUILDLINK_CONTENTS_FILTER.pkg (not shown above) is a filter command that
5069: filters +CONTENTS input into a list of files relative to $
5070: {BUILDLINK_PREFIX.pkg} on stdout. By default, BUILDLINK_CONTENTS_FILTER.pkg
5071: outputs the contents of the include and lib directories in the package
5072: +CONTENTS.
1.1 dsieger 5073:
1.184 rillig 5074: * BUILDLINK_FNAME_TRANSFORM.pkg (not shown above) is a list of sed arguments
5075: used to transform the name of the source filename into a destination
5076: filename, e.g. -e "s|/curses.h|/ncurses.h|g".
1.1 dsieger 5077:
1.184 rillig 5078: This section can additionally include any buildlink3.mk needed for pkg's
5079: library dependencies. Including these buildlink3.mk files means that the
5080: headers and libraries for these dependencies are also symlinked into $
5081: {BUILDLINK_DIR} whenever the pkg buildlink3.mk file is included. Dependencies
5082: are only added for directly include buildlink3.mk files.
1.1 dsieger 5083:
1.184 rillig 5084: When providing a buildlink3.mk and including other buildlink3.mk files in it,
5085: please only add necessary ones, i.e., those whose libraries or header files are
5086: automatically exposed when the package is use.
1.1 dsieger 5087:
1.184 rillig 5088: In particular, if only an executable (bin/foo) is linked against a library,
5089: that library does not need to be propagated in the buildlink3.mk file.
1.1 dsieger 5090:
1.184 rillig 5091: The following steps should help you decide if a buildlink3.mk file needs to be
5092: included:
1.1 dsieger 5093:
1.184 rillig 5094: * Look at the installed header files: What headers do they include? The
5095: packages providing these files must be buildlinked.
1.1 dsieger 5096:
1.184 rillig 5097: * Run ldd on all installed libraries and look against what other libraries
5098: they link. Some of the packages providing these probably need to be
5099: buildlinked; however, it's not automatic, since e.g. GTK on some systems
5100: pulls in the X libraries, so they will show up in the ldd output, while on
5101: others (like OS X) it won't. ldd output can thus only be used as a hint.
1.1 dsieger 5102:
1.184 rillig 5103: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
5104: buildlink3.mk files
1.16 jnemeth 5105:
1.185 wiz 5106: Both variables set lower bounds for a version of this package. The two
5107: variables differ in that one describes source compatibility (API) and the other
5108: binary compatibility (ABI). The difference is that a change in the API breaks
5109: compilation of programs while changes in the ABI stop compiled programs from
5110: running.
5111:
5112: The BUILDLINK_API_DEPENDS.pkg variable in a buildlink3.mk should be changed
5113: very rarely. (One possible scenario: If all packages using this package need a
5114: higher version than defined in the buildlink3.mk, BUILDLINK_API_DEPENDS.pkg
5115: could be updated to that higher version.)
5116:
5117: On the other hand, changes to BUILDLINK_ABI_DEPENDS.pkg are more common. The
5118: variable will need to be updated every time the major version of one of its
5119: shared libraries is changed, or any other change where a binary built against
5120: the previous version of the package will not run against the new version any
5121: longer.
5122:
5123: In such a case, the package's BUILDLINK_ABI_DEPENDS.pkg must be increased to
5124: require the new package version. Then the PKGREVISION of all packages foo that
5125: depend on this package need to be increased, and if they have buildlink3.mk
5126: files, BUILDLINK_ABI_DEPENDS.foo in their buildlink3.mk files must be increased
5127: to the new version as well. This is required so that a package will pull in the
5128: versions of the packages that use the new ABI and that the packages'
5129: PKGREVISIONs uniquely identify the packages built against the new ABI. The
5130: pkgtools/revbump package can help with these updates.
1.1 dsieger 5131:
1.184 rillig 5132: See Section 21.1.5, "Handling dependencies" for more information about
1.185 wiz 5133: dependencies on other packages, including the BUILDLINK_API_DEPENDS
5134: definitions.
1.1 dsieger 5135:
1.184 rillig 5136: Please take careful consideration before adjusting BUILDLINK_API_DEPENDS.pkg or
1.185 wiz 5137: BUILDLINK_ABI_DEPENDS.pkg in a buildlink3.mk file as we don't want to cause
5138: unneeded package deletions and rebuilds. In many cases, new versions of
5139: packages work just fine with older dependencies.
1.1 dsieger 5140:
1.211 gutterid 5141: Also, it is not needed to set BUILDLINK_ABI_DEPENDS.pkg when it is identical to
1.184 rillig 5142: BUILDLINK_API_DEPENDS.pkg.
1.1 dsieger 5143:
1.211 gutterid 5144: Note there is also the distinction that users are able to disable enforcement
5145: of ABI dependencies using the USE_ABI_DEPENDS variable, but there is no
5146: equivalent option for API dependencies.
5147:
1.184 rillig 5148: 18.3. Writing builtin.mk files
1.1 dsieger 5149:
1.184 rillig 5150: Some packages in pkgsrc install headers and libraries that coincide with
5151: headers and libraries present in the base system. Aside from a buildlink3.mk
5152: file, these packages should also include a builtin.mk file that includes the
5153: necessary checks to decide whether using the built-in software or the pkgsrc
5154: software is appropriate.
1.1 dsieger 5155:
1.184 rillig 5156: The only requirements of a builtin.mk file for pkg are:
1.1 dsieger 5157:
1.184 rillig 5158: 1. It should set USE_BUILTIN.pkg to either "yes" or "no" after it is included.
1.1 dsieger 5159:
1.184 rillig 5160: 2. It should not override any USE_BUILTIN.pkg which is already set before the
5161: builtin.mk file is included.
1.1 dsieger 5162:
1.184 rillig 5163: 3. It should be written to allow multiple inclusion. This is very important
5164: and takes careful attention to Makefile coding.
1.1 dsieger 5165:
1.184 rillig 5166: 18.3.1. Anatomy of a builtin.mk file
1.1 dsieger 5167:
1.184 rillig 5168: The following is the recommended template for builtin.mk files:
1.1 dsieger 5169:
1.184 rillig 5170: .if !defined(IS_BUILTIN.foo)
5171: #
5172: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
5173: # genuinely exists in the system or not.
5174: #
5175: IS_BUILTIN.foo?= no
1.1 dsieger 5176:
1.184 rillig 5177: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
5178: # version can be determined.
5179: #
5180: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
5181: BUILTIN_PKG.foo?= foo-1.0
5182: . endif
5183: .endif # IS_BUILTIN.foo
1.1 dsieger 5184:
1.184 rillig 5185: .if !defined(USE_BUILTIN.foo)
5186: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
5187: . if defined(BUILTIN_PKG.foo)
5188: . for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
5189: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
5190: USE_BUILTIN.foo!= \
5191: ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \
5192: && ${ECHO} "yes" || ${ECHO} "no"
5193: . endif
5194: . endfor
5195: . endif
5196: .endif # USE_BUILTIN.foo
1.1 dsieger 5197:
1.184 rillig 5198: CHECK_BUILTIN.foo?= no
5199: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
5200: #
5201: # Here we place code that depends on whether USE_BUILTIN.foo is set to
5202: # "yes" or "no".
5203: #
5204: .endif # CHECK_BUILTIN.foo
1.1 dsieger 5205:
1.184 rillig 5206: The first section sets IS_BUILTIN.pkg depending on if pkg really exists in the
5207: base system. This should not be a base system software with similar
5208: functionality to pkg; it should only be "yes" if the actual package is included
5209: as part of the base system. This variable is only used internally within the
5210: builtin.mk file.
1.1 dsieger 5211:
1.184 rillig 5212: The second section sets BUILTIN_PKG.pkg to the version of pkg in the base
5213: system if it exists (if IS_BUILTIN.pkg is "yes"). This variable is only used
5214: internally within the builtin.mk file.
1.1 dsieger 5215:
1.184 rillig 5216: The third section sets USE_BUILTIN.pkg and is required in all builtin.mk files.
5217: The code in this section must make the determination whether the built-in
5218: software is adequate to satisfy the dependencies listed in
5219: BUILDLINK_API_DEPENDS.pkg. This is typically done by comparing BUILTIN_PKG.pkg
5220: against each of the dependencies in BUILDLINK_API_DEPENDS.pkg. USE_BUILTIN.pkg
5221: must be set to the correct value by the end of the builtin.mk file. Note that
5222: USE_BUILTIN.pkg may be "yes" even if IS_BUILTIN.pkg is "no" because we may make
5223: the determination that the built-in version of the software is similar enough
5224: to be used as a replacement.
1.1 dsieger 5225:
1.184 rillig 5226: The last section is guarded by CHECK_BUILTIN.pkg, and includes code that uses
5227: the value of USE_BUILTIN.pkg set in the previous section. This typically
5228: includes, e.g., adding additional dependency restrictions and listing
5229: additional files to symlink into ${BUILDLINK_DIR} (via BUILDLINK_FILES.pkg).
1.1 dsieger 5230:
1.184 rillig 5231: 18.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 5232:
1.184 rillig 5233: When building packages, it's possible to choose whether to set a global
5234: preference for using either the built-in (native) version or the pkgsrc version
5235: of software to satisfy a dependency. This is controlled by setting
5236: PREFER_PKGSRC and PREFER_NATIVE. These variables take values of either "yes", "
5237: no", or a list of packages. PREFER_PKGSRC tells pkgsrc to use the pkgsrc
5238: versions of software, while PREFER_NATIVE tells pkgsrc to use the built-in
5239: versions. Preferences are determined by the most specific instance of the
5240: package in either PREFER_PKGSRC or PREFER_NATIVE. If a package is specified in
5241: neither or in both variables, then PREFER_PKGSRC has precedence over
5242: PREFER_NATIVE. For example, to require using pkgsrc versions of software for
5243: all but the most basic bits on a NetBSD system, you can set:
1.1 dsieger 5244:
1.184 rillig 5245: PREFER_PKGSRC= yes
5246: PREFER_NATIVE= getopt skey tcp_wrappers
1.1 dsieger 5247:
1.184 rillig 5248: A package must have a builtin.mk file to be listed in PREFER_NATIVE, otherwise
5249: it is simply ignored in that list.
1.1 dsieger 5250:
1.191 bacon 5251: PREFER_PKGSRC and PREFER_NATIVE should be set during bootstrap to ensure that
5252: the bootstrap process does not use inapropriate native tools as dependencies
5253: for core packages.
5254:
5255: # ./bootstrap --prefer-pkgsrc yes --prefer-native openssl
5256:
5257: Switching between settings globally at a later date can introduce complications
5258: with dependency resolution. This is caused by packages built with the opposite
5259: preference being installed alongside each other. Hence, any changes to these
5260: variables after bootstrap will necessitate rebuilding all packages depending on
5261: one whose preference has been changed. This is not trivial and should be
5262: avoided.
5263:
5264: When using pkgsrc on Linux systems, there is high risk of "leakage", where
5265: programs installed by pkgsrc may inadvertently use a command or library not
5266: installed by pkgsrc, e.g. those installed by yum or apt. Such foreign
5267: dependencies may be installed, removed, or upgraded to a version incompatible
5268: with the pkgsrc package at any time, causing pkgsrc packages to subsequently
5269: malfunction. Pkgsrc cannot prevent this, as it has no control over other
5270: package managers. Another potential problem is that under Redhat Enterprise and
5271: related Linux systems, yum packages are only patched and never upgraded, so
5272: eventually they may become too outdated for use by pkgsrc. Even intentionally
5273: using foreign dependencies, not considered leakage, can lead to these problems,
5274: so it is generally discouraged. In order to minimize such problems,
5275: PREFER_PKGSRC defaults to "yes" on Linux systems. This ensures that pkgsrc is
5276: aware of any changes to dependency packages and can rebuild or upgrade the
5277: entire dependency tree as needed. This default can be overridden by setting
5278: --prefer-pkgsrc to "no" or a list of packages, or by setting --prefer-native to
5279: "yes".
1.1 dsieger 5280:
1.184 rillig 5281: Chapter 19. PLIST issues
1.1 dsieger 5282:
1.184 rillig 5283: Table of Contents
1.1 dsieger 5284:
1.184 rillig 5285: 19.1. RCS ID
5286: 19.2. Semi-automatic PLIST generation
5287: 19.3. Tweaking output of make print-PLIST
5288: 19.4. Variable substitution in PLIST
5289: 19.5. Man page compression
5290: 19.6. Changing PLIST source with PLIST_SRC
5291: 19.7. Platform-specific and differing PLISTs
5292: 19.8. Build-specific PLISTs
5293: 19.9. Sharing directories between packages
1.1 dsieger 5294:
1.184 rillig 5295: The PLIST file contains a package's "packing list", i.e. a list of files that
5296: belong to the package (relative to the ${PREFIX} directory it's been installed
5297: in) plus some additional statements - see the pkg_create(1) man page for a full
5298: list. This chapter addresses some issues that need attention when dealing with
5299: the PLIST file (or files, see below!).
1.1 dsieger 5300:
1.184 rillig 5301: 19.1. RCS ID
1.1 dsieger 5302:
1.184 rillig 5303: Be sure to add a RCS ID line as the first thing in any PLIST file you write:
1.1 dsieger 5304:
1.184 rillig 5305: @comment $NetBSD $
1.1 dsieger 5306:
1.184 rillig 5307: An artificial space has been added between NetBSD and $, this is a workaround
5308: here to prevent CVS expanding to the filename of the guide. When adding the RCS
5309: ID the space should be omitted.
1.38 wiz 5310:
1.184 rillig 5311: 19.2. Semi-automatic PLIST generation
1.1 dsieger 5312:
1.184 rillig 5313: You can use the make print-PLIST command to output a PLIST that matches any new
5314: files since the package was extracted. See Section 13.17, "Other helpful
5315: targets" for more information on this target.
1.11 rillig 5316:
1.184 rillig 5317: 19.3. Tweaking output of make print-PLIST
1.1 dsieger 5318:
1.184 rillig 5319: The PRINT_PLIST_AWK variable takes a set of AWK patterns and actions that are
5320: used to filter the output of print-PLIST. You can append any chunk of AWK
5321: scripting you like to it, but be careful with quoting.
1.1 dsieger 5322:
1.184 rillig 5323: For example, to get all files inside the libdata/foo directory removed from the
5324: resulting PLIST:
1.1 dsieger 5325:
1.184 rillig 5326: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 dsieger 5327:
1.185 wiz 5328: The PRINT_PLIST_AWK transformations are evaluated after the file list and
5329: directory list are sorted. EARLY_PRINT_PLIST_AWK is like PRINT_PLIST_AWK except
5330: it operates before the file list and directory list are sorted.
5331:
1.184 rillig 5332: 19.4. Variable substitution in PLIST
1.1 dsieger 5333:
1.184 rillig 5334: A number of variables are substituted automatically in PLISTs when a package is
5335: installed on a system. This includes the following variables:
1.1 dsieger 5336:
1.184 rillig 5337: ${MACHINE_ARCH}, ${MACHINE_GNU_ARCH}
1.1 dsieger 5338:
1.184 rillig 5339: Some packages like emacs and perl embed information about which
5340: architecture they were built on into the pathnames where they install their
5341: files. To handle this case, PLIST will be preprocessed before actually
5342: used, and the symbol "${MACHINE_ARCH}" will be replaced by what uname -p
5343: gives. The same is done if the string ${MACHINE_GNU_ARCH} is embedded in
5344: PLIST somewhere - use this on packages that have GNU autoconf-created
5345: configure scripts.
1.1 dsieger 5346:
1.184 rillig 5347: Legacy note
1.1 dsieger 5348:
1.184 rillig 5349: There used to be a symbol "$ARCH" that was replaced by the output of uname
5350: -m, but that's no longer supported and has been removed.
1.1 dsieger 5351:
1.184 rillig 5352: ${OPSYS}, ${LOWER_OPSYS}, ${OS_VERSION}
1.1 dsieger 5353:
1.184 rillig 5354: Some packages want to embed the OS name and version into some paths. To do
5355: this, use these variables in the PLIST:
1.1 dsieger 5356:
1.232 gutterid 5357: o ${OPSYS} - output of "uname -s"
1.1 dsieger 5358:
1.232 gutterid 5359: o ${LOWER_OPSYS} - lowercase common name (eg. "solaris")
1.1 dsieger 5360:
1.232 gutterid 5361: o ${OS_VERSION} - "uname -r"
1.1 dsieger 5362:
1.184 rillig 5363: For a list of values which are replaced by default, the output of make help
5364: topic=PLIST_SUBST as well as searching the pkgsrc/mk directory with grep for
5365: PLIST_SUBST should help.
1.1 dsieger 5366:
1.184 rillig 5367: If you want to change other variables not listed above, you can add variables
5368: and their expansions to this variable in the following way, similar to
5369: MESSAGE_SUBST (see Section 12.5, "Optional files"):
1.1 dsieger 5370:
1.184 rillig 5371: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 5372:
1.184 rillig 5373: This replaces all occurrences of "${SOMEVAR}" in the PLIST with "somevalue".
1.1 dsieger 5374:
1.184 rillig 5375: The PLIST_VARS variable can be used to simplify the common case of
5376: conditionally including some PLIST entries. It can be done by adding
5377: PLIST_VARS+=foo and setting the corresponding PLIST.foo variable to yes if the
5378: entry should be included. This will substitute "${PLIST.foo}" in the PLIST with
5379: either """" or ""@comment "". For example, in Makefile:
1.1 dsieger 5380:
1.184 rillig 5381: PLIST_VARS+= foo
5382: .if condition
5383: PLIST.foo= yes
5384: .else
1.1 dsieger 5385:
1.184 rillig 5386: And then in PLIST:
1.1 dsieger 5387:
1.184 rillig 5388: @comment $NetBSD $
5389: bin/bar
5390: man/man1/bar.1
5391: ${PLIST.foo}bin/foo
5392: ${PLIST.foo}man/man1/foo.1
5393: ${PLIST.foo}share/bar/foo.data
1.1 dsieger 5394:
1.184 rillig 5395: An artificial space has been added between NetBSD and $, this is a workaround
5396: here to prevent CVS expanding to the filename of the guide. When adding the RCS
1.195 gutterid 5397: ID the space should be omitted.
1.1 dsieger 5398:
1.184 rillig 5399: 19.5. Man page compression
1.1 dsieger 5400:
1.184 rillig 5401: Man pages should be installed in compressed form if MANZ is set (in
5402: bsd.own.mk), and uncompressed otherwise. To handle this in the PLIST file, the
5403: suffix ".gz" is appended/removed automatically for man pages according to MANZ
5404: and MANCOMPRESSED being set or not, see above for details. This modification of
5405: the PLIST file is done on a copy of it, not PLIST itself.
1.100 leot 5406:
1.184 rillig 5407: 19.6. Changing PLIST source with PLIST_SRC
1.100 leot 5408:
1.184 rillig 5409: To use one or more files as source for the PLIST used in generating the binary
5410: package, set the variable PLIST_SRC to the names of that file(s). The files are
5411: later concatenated using cat(1), and the order of things is important. The
5412: default for PLIST_SRC is ${PKGDIR}/PLIST.
1.1 dsieger 5413:
1.184 rillig 5414: 19.7. Platform-specific and differing PLISTs
1.1 dsieger 5415:
1.184 rillig 5416: Some packages decide to install a different set of files based on the operating
5417: system being used. These differences can be automatically handled by using the
5418: following files:
1.1 dsieger 5419:
1.184 rillig 5420: * PLIST.common
1.1 dsieger 5421:
1.184 rillig 5422: * PLIST.${OPSYS}
1.1 dsieger 5423:
1.184 rillig 5424: * PLIST.${MACHINE_ARCH}
1.1 dsieger 5425:
1.184 rillig 5426: * PLIST.${OPSYS}-${MACHINE_ARCH}
1.1 dsieger 5427:
1.184 rillig 5428: * PLIST.common_end
1.1 dsieger 5429:
1.184 rillig 5430: 19.8. Build-specific PLISTs
1.1 dsieger 5431:
1.184 rillig 5432: Some packages decide to generate hard-to-guess file names during installation
5433: that are hard to wire down.
1.1 dsieger 5434:
1.184 rillig 5435: In such cases, you can set the GENERATE_PLIST variable to shell code terminated
5436: (with a semicolon) that will output PLIST entries which will be appended to the
5437: PLIST
1.1 dsieger 5438:
1.184 rillig 5439: You can find one example in editors/xemacs:
1.1 dsieger 5440:
1.184 rillig 5441: GENERATE_PLIST+= ${ECHO} bin/${DISTNAME}-`${WRKSRC}/src/xemacs -sd`.dmp ;
1.1 dsieger 5442:
1.184 rillig 5443: which will append something like bin/xemacs-21.4.23-54e8ea71.dmp to the PLIST.
1.1 dsieger 5444:
1.184 rillig 5445: 19.9. Sharing directories between packages
1.1 dsieger 5446:
1.184 rillig 5447: A "shared directory" is a directory where multiple (and unrelated) packages
5448: install files. These directories were problematic because you had to add
5449: special tricks in the PLIST to conditionally remove them, or have some
5450: centralized package handle them.
1.106 tnn 5451:
1.184 rillig 5452: In pkgsrc, it is now easy: Each package should create directories and install
5453: files as needed; pkg_delete will remove any directories left empty after
5454: uninstalling a package.
1.106 tnn 5455:
1.184 rillig 5456: If a package needs an empty directory to work, create the directory during
5457: installation as usual, and also add an entry to the PLIST:
1.1 dsieger 5458:
1.184 rillig 5459: @pkgdir path/to/empty/directory
1.1 dsieger 5460:
1.184 rillig 5461: or take a look at MAKE_DIRS and OWN_DIRS.
1.1 dsieger 5462:
1.184 rillig 5463: Chapter 20. The pkginstall framework
1.1 dsieger 5464:
1.184 rillig 5465: Table of Contents
1.1 dsieger 5466:
1.184 rillig 5467: 20.1. Files and directories outside the installation prefix
5468: 20.1.1. Directory manipulation
5469: 20.1.2. File manipulation
5470: 20.2. Configuration files
5471: 20.2.1. How PKG_SYSCONFDIR is set
5472: 20.2.2. Telling the software where configuration files are
1.239 ! dholland 5473: 20.2.3. Patching installation
! 5474: 20.2.4. Declaring configuration files
! 5475: 20.2.5. Disabling handling of configuration files
1.184 rillig 5476: 20.3. System startup scripts
5477: 20.3.1. Disabling handling of system startup scripts
5478: 20.4. System users and groups
5479: 20.5. System shells
5480: 20.5.1. Disabling shell registration
5481: 20.6. Fonts
5482: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 5483:
1.184 rillig 5484: This chapter describes the framework known as pkginstall, whose key features
5485: are:
1.1 dsieger 5486:
1.184 rillig 5487: * Generic installation and manipulation of directories and files outside the
5488: pkgsrc-handled tree, LOCALBASE.
1.1 dsieger 5489:
1.184 rillig 5490: * Automatic handling of configuration files during installation, provided
5491: that packages are correctly designed.
1.1 dsieger 5492:
1.184 rillig 5493: * Generation and installation of system startup scripts.
1.1 dsieger 5494:
1.184 rillig 5495: * Registration of system users and groups.
1.1 dsieger 5496:
1.184 rillig 5497: * Registration of system shells.
1.1 dsieger 5498:
1.184 rillig 5499: * Automatic updating of fonts databases.
1.1 dsieger 5500:
1.184 rillig 5501: The following sections inspect each of the above points in detail.
1.1 dsieger 5502:
1.184 rillig 5503: You may be thinking that many of the things described here could be easily done
5504: with simple code in the package's post-installation target (post-install). This
5505: is incorrect, as the code in them is only executed when building from source.
5506: Machines using binary packages could not benefit from it at all (as the code
5507: itself could be unavailable). Therefore, the only way to achieve any of the
5508: items described above is by means of the installation scripts, which are
5509: automatically generated by pkginstall.
1.1 dsieger 5510:
1.184 rillig 5511: 20.1. Files and directories outside the installation prefix
1.95 wiz 5512:
1.184 rillig 5513: As you already know, the PLIST file holds a list of files and directories that
5514: belong to a package. The names used in it are relative to the installation
5515: prefix (${PREFIX}), which means that it cannot register files outside this
5516: directory (absolute path names are not allowed). Despite this restriction, some
5517: packages need to install files outside this location; e.g., under ${VARBASE} or
5518: ${PKG_SYSCONFDIR}. The only way to achieve this is to create such files during
5519: installation time by using installation scripts.
1.95 wiz 5520:
1.184 rillig 5521: The generic installation scripts are shell scripts that can contain arbitrary
5522: code. The list of scripts to execute is taken from the INSTALL_FILE variable,
5523: which defaults to INSTALL. A similar variable exists for package removal
5524: (DEINSTALL_FILE, whose default is DEINSTALL). These scripts can run arbitrary
5525: commands, so they have the potential to create and manage files anywhere in the
5526: file system.
1.95 wiz 5527:
1.184 rillig 5528: Using these general installation files is not recommended, but may be needed in
5529: some special cases. One reason for avoiding them is that the user has to trust
5530: the packager that there is no unwanted or simply erroneous code included in the
5531: installation script. Also, previously there were many similar scripts for the
5532: same functionality, and fixing a common error involved finding and changing all
5533: of them.
1.95 wiz 5534:
1.184 rillig 5535: The pkginstall framework offers another, standardized way. It provides generic
5536: scripts to abstract the manipulation of such files and directories based on
5537: variables set in the package's Makefile. The rest of this section describes
5538: these variables.
1.1 dsieger 5539:
1.184 rillig 5540: 20.1.1. Directory manipulation
1.1 dsieger 5541:
1.184 rillig 5542: The following variables can be set to request the creation of directories
5543: anywhere in the file system:
1.1 dsieger 5544:
1.184 rillig 5545: * MAKE_DIRS and OWN_DIRS contain a list of directories that should be created
5546: and should attempt to be destroyed by the installation scripts. The
5547: difference between the two is that the latter prompts the administrator to
5548: remove any directories that may be left after deinstallation (because they
5549: were not empty), while the former does not. Example:
1.1 dsieger 5550:
1.184 rillig 5551: MAKE_DIRS+= ${VARBASE}/foo/private
1.1 dsieger 5552:
1.184 rillig 5553: * MAKE_DIRS_PERMS and OWN_DIRS_PERMS contain a list of tuples describing
5554: which directories should be created and should attempt to be destroyed by
5555: the installation scripts. Each tuple holds the following values, separated
5556: by spaces: the directory name, its owner, its group and its numerical mode.
5557: For example:
1.1 dsieger 5558:
1.184 rillig 5559: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private \
5560: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 5561:
1.184 rillig 5562: The difference between the two is exactly the same as their non-PERMS
5563: counterparts.
1.1 dsieger 5564:
1.184 rillig 5565: 20.1.2. File manipulation
1.1 dsieger 5566:
1.184 rillig 5567: Creating non-empty files outside the installation prefix is tricky because the
5568: PLIST forces all files to be inside it. To overcome this problem, the only
1.239 ! dholland 5569: solution is to extract the file in a known place (i.e., inside the installation
! 5570: prefix) and copy it to the appropriate location during installation (done by
! 5571: the installation scripts generated by pkginstall). We will call the former the
! 5572: reference file in the following paragraphs, which describe the variables that
! 5573: can be used to automatically and consistently handle files outside the
! 5574: installation prefix:
! 5575:
! 5576: * REQD_FILES is a list of pairs of reference and target files. At
! 5577: installation time, the reference file is copied to the target if and only
! 5578: if the latter does not exist. Upon deinstallation, the reference file is
1.184 rillig 5579: removed provided that it was not modified by the installation.
1.1 dsieger 5580:
1.239 ! dholland 5581: * REQD_FILES_PERMS contains tuples describing reference files and targets,
! 5582: including owner, group, and numeric permissions that should be set. For
! 5583: example:
1.1 dsieger 5584:
1.184 rillig 5585: REQD_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile \
5586: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 5587:
1.239 ! dholland 5588: * CONF_FILES and CONF_FILES_PERMS have the same syntax as REQD_FILES and
! 5589: REQD_FILES_PERMS respectively. The difference is that these variables are
! 5590: specifically intended for handling configuration files, for which
! 5591: additional conventions and constraints apply. See Section 20.2,
! 5592: "Configuration files" for further discussion. Note in particular that while
! 5593: handling of configuration files can be disabled by the user (see
! 5594: Section 20.2.5, "Disabling handling of configuration files"), this setting
! 5595: does not affect REQD_FILES and REQD_FILES_PERMS.
! 5596:
! 5597: To install an empty file, one can use these macros and /dev/null as the
! 5598: reference file.
1.1 dsieger 5599:
1.184 rillig 5600: 20.2. Configuration files
1.1 dsieger 5601:
1.239 ! dholland 5602: There are two principles that govern the handling of configuration files in
! 5603: pkgsrc: first, the user's configuration must not be lost or overwritten by
! 5604: upgrades or reinstallations; and second, the default configuration should
! 5605: always be available for reference. To that end, pkgsrc has a framework
! 5606: specifically for handling configuration files. In general, configuration files
! 5607: are installed into ${PREFIX}/share/examples, and copied from there to the
! 5608: pertinent etc directory as a separate step and only as needed.
! 5609:
! 5610: To make this work, there are three things that need to happen, any of which may
! 5611: require patching. First, the package must be told to read its configuration
! 5612: from the correct place at runtime; this place is ${PKG_SYSCONFDIR} (or possibly
! 5613: a subdirectory of it) which is often but not always ${PREFIX}/etc. Second, the
! 5614: package must be taught to install its default configuration files in ${PREFIX}/
! 5615: share/examples/${PKGBASE}; this is the point at which patching often becomes
! 5616: required because it is not the same place as the runtime location. Third, the
! 5617: configuration files need to be declared in the package makefile; this is the
! 5618: easy part.
! 5619:
! 5620: With those elements in place, the right things will happen: the package install
! 5621: phase and resulting binary package will not touch ${PKG_SYSCONFDIR}, and the
! 5622: default configuration will be copied into place by the pkgsrc framework only if
! 5623: not already present. Similarly, upon deinstall the configuration will not be
! 5624: removed if it has been modified. (This means that in the case of reinstallation
! 5625: and upgrades, unmodified configuration files are updated but modifications are
! 5626: never discarded.)
! 5627:
! 5628: The following sections describe how to make these things happen and document
! 5629: other relevant knobs available in the pkgsrc infrastructure.
1.1 dsieger 5630:
1.184 rillig 5631: 20.2.1. How PKG_SYSCONFDIR is set
1.1 dsieger 5632:
1.184 rillig 5633: As said before, the PKG_SYSCONFDIR variable specifies where configuration files
5634: shall be installed. Its contents are set based upon the following variables:
1.1 dsieger 5635:
1.184 rillig 5636: * PKG_SYSCONFBASE: The configuration's root directory. Defaults to ${PREFIX}/
1.239 ! dholland 5637: etc although it may be overridden by the user to point to their preferred
1.184 rillig 5638: location (e.g., /etc, /etc/pkg, etc.). Packages must not use it directly.
1.1 dsieger 5639:
1.184 rillig 5640: * PKG_SYSCONFSUBDIR: A subdirectory of PKG_SYSCONFBASE under which the
5641: configuration files for the package being built shall be installed. The
5642: definition of this variable only makes sense in the package's Makefile
5643: (i.e., it is not user-customizable).
1.1 dsieger 5644:
1.184 rillig 5645: As an example, consider the Apache package, www/apache24, which places its
5646: configuration files under the httpd/ subdirectory of PKG_SYSCONFBASE. This
5647: should be set in the package Makefile.
1.1 dsieger 5648:
1.184 rillig 5649: * PKG_SYSCONFVAR: Specifies the name of the variable that holds this
5650: package's configuration directory (if different from PKG_SYSCONFBASE). It
5651: defaults to PKGBASE's value, and is always prefixed with PKG_SYSCONFDIR.
1.1 dsieger 5652:
1.184 rillig 5653: * PKG_SYSCONFDIR.${PKG_SYSCONFVAR}: Holds the directory where the
5654: configuration files for the package identified by PKG_SYSCONFVAR's shall be
5655: placed.
1.1 dsieger 5656:
1.184 rillig 5657: Based on the above variables, pkginstall determines the value of
1.239 ! dholland 5658: PKG_SYSCONFDIR, which is the only variable that may be used within a package to
1.184 rillig 5659: refer to its configuration directory. The algorithm used to set its value is
5660: basically the following:
1.1 dsieger 5661:
1.184 rillig 5662: 1. If PKG_SYSCONFDIR.${PKG_SYSCONFVAR} is set, its value is used.
1.1 dsieger 5663:
1.184 rillig 5664: 2. If the previous variable is not defined but PKG_SYSCONFSUBDIR is set in the
5665: package's Makefile, the resulting value is ${PKG_SYSCONFBASE}/$
5666: {PKG_SYSCONFSUBDIR}.
1.1 dsieger 5667:
1.184 rillig 5668: 3. Otherwise, it is set to ${PKG_SYSCONFBASE}.
1.1 dsieger 5669:
1.184 rillig 5670: It is worth mentioning that ${PKG_SYSCONFDIR} is automatically added to
1.239 ! dholland 5671: OWN_DIRS. This causes it to be automatically created if needed. See
! 5672: Section 20.1.1, "Directory manipulation" for further details. This does not
! 5673: apply to subdirectories of ${PKG_SYSCONFDIR}; they must be manually created
! 5674: with OWN_DIRS or MAKE_DIRS.
1.1 dsieger 5675:
1.184 rillig 5676: 20.2.2. Telling the software where configuration files are
1.1 dsieger 5677:
1.184 rillig 5678: Given that pkgsrc (and users!) expect configuration files to be in a known
1.239 ! dholland 5679: place, you need to teach each package where to install its files. In some cases
! 5680: you will have to patch the package Makefiles to achieve it. If you are lucky,
! 5681: though, it may be as easy as passing an extra flag to the configuration script.
! 5682: This is the case for packages using GNU autoconf:
1.1 dsieger 5683:
1.184 rillig 5684: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.1 dsieger 5685:
1.184 rillig 5686: Note that this specifies where the package has to look for its configuration
1.239 ! dholland 5687: files, not where they will be installed. Fortunately, there is a different way
! 5688: to specify the latter, as seen in the next seection, although the combination
! 5689: is rather confusing at first glance.
1.1 dsieger 5690:
1.239 ! dholland 5691: 20.2.3. Patching installation
1.1 dsieger 5692:
1.239 ! dholland 5693: As discussed above, packages themselves must not touch the contents of $
1.184 rillig 5694: {PKG_SYSCONFDIR} directly. Bad news is that many software installation scripts
5695: will, out of the box, mess with the contents of that directory. So what is the
5696: correct procedure to fix this issue?
1.1 dsieger 5697:
1.184 rillig 5698: You must teach the package (usually by manually patching it) to install any
5699: configuration files under the examples hierarchy, share/examples/${PKGBASE}/.
5700: This way, the PLIST registers them and the administrator always has the
5701: original copies available.
1.1 dsieger 5702:
1.239 ! dholland 5703: It turns out that for packages using GNU autoconf it is possible to create the
! 5704: desired effect by setting sysconfdir on the make command line at install time.
! 5705: Consider this example taken from mail/mutt:
! 5706:
! 5707: EGDIR= ${PREFIX}/share/examples/mutt
! 5708: INSTALL_MAKE_FLAGS= ${MAKE_FLAGS} sysconfdir=${EGDIR}
! 5709:
! 5710: Note that the EGDIR variable, though commonly used for this purpose, is local
! 5711: to that package and has no meaning outside it.
1.1 dsieger 5712:
1.239 ! dholland 5713: 20.2.4. Declaring configuration files
1.1 dsieger 5714:
1.239 ! dholland 5715: Once the required configuration files are in place (i.e., under the examples
! 5716: hierarchy), the pkginstall framework can use them as reference copies during
! 5717: the package installation to update what is in ${PKG_SYSCONFDIR}. To achieve
! 5718: this, the variables CONF_FILES and CONF_FILES_PERMS are used. Check out
! 5719: Section 20.1.2, "File manipulation" for further information about their syntax
! 5720: and their purpose. Here is an example, taken from the mail/mutt package:
! 5721:
! 5722: EGDIR= ${PREFIX}/share/examples/mutt
! 5723: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
! 5724:
! 5725: Note that (as in the previous section's example) the EGDIR variable is specific
! 5726: to the package and has no meaning outside it.
! 5727:
! 5728: For reference, the complete example from Mutt is as follows:
! 5729:
! 5730: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
! 5731: EGDIR= ${PREFIX}/share/examples/mutt
! 5732: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
! 5733: INSTALLATION_DIRS+= ${EGDIR}
! 5734: INSTALL_MAKE_FLAGS= ${MAKE_FLAGS} sysconfdir=${EGDIR}
1.1 dsieger 5735:
1.239 ! dholland 5736: 20.2.5. Disabling handling of configuration files
1.1 dsieger 5737:
1.184 rillig 5738: The automatic copying of config files can be toggled by setting the environment
5739: variable PKG_CONFIG prior to package installation.
1.1 dsieger 5740:
1.184 rillig 5741: 20.3. System startup scripts
1.1 dsieger 5742:
1.184 rillig 5743: System startup scripts are special files because they must be installed in a
5744: place known by the underlying OS, usually outside the installation prefix.
5745: Therefore, the same rules described in Section 20.1, "Files and directories
5746: outside the installation prefix" apply, and the same solutions can be used.
5747: However, pkginstall provides a special mechanism to handle these files.
1.1 dsieger 5748:
1.184 rillig 5749: In order to provide system startup scripts, the package has to:
1.1 dsieger 5750:
1.184 rillig 5751: 1. Store the script inside ${FILESDIR}, with the .sh suffix appended.
1.223 nia 5752: Considering the print/cups-base package as an example, it has a cupsd.sh in
5753: its files directory.
1.95 wiz 5754:
1.184 rillig 5755: 2. Tell pkginstall to handle it, appending the name of the script, without its
5756: extension, to the RCD_SCRIPTS variable. Continuing the previous example:
1.95 wiz 5757:
1.184 rillig 5758: RCD_SCRIPTS+= cupsd
1.95 wiz 5759:
1.184 rillig 5760: Once this is done, pkginstall will do the following steps for each script in an
5761: automated fashion:
1.95 wiz 5762:
1.184 rillig 5763: 1. Process the file found in the files directory applying all the
5764: substitutions described in the FILES_SUBST variable.
1.1 dsieger 5765:
1.184 rillig 5766: 2. Copy the script from the files directory to the examples hierarchy, $
1.239 ! dholland 5767: {PREFIX}/share/examples/rc.d/. Note that this reference file must be
1.184 rillig 5768: explicitly registered in the PLIST.
1.1 dsieger 5769:
1.184 rillig 5770: 3. Add code to the installation scripts to copy the startup script from the
5771: examples hierarchy into the system-wide startup scripts directory.
1.1 dsieger 5772:
1.184 rillig 5773: 20.3.1. Disabling handling of system startup scripts
1.1 dsieger 5774:
1.184 rillig 5775: The automatic copying of config files can be toggled by setting the environment
5776: variable PKG_RCD_SCRIPTS prior to package installation. Note that the scripts
5777: will be always copied inside the examples hierarchy, ${PREFIX}/share/examples/
5778: rc.d/, no matter what the value of this variable is.
1.1 dsieger 5779:
1.184 rillig 5780: 20.4. System users and groups
1.1 dsieger 5781:
1.184 rillig 5782: If a package needs to create special users and/or groups during installation,
5783: it can do so by using the pkginstall framework.
1.1 dsieger 5784:
1.184 rillig 5785: Users can be created by adding entries to the PKG_USERS variable. Each entry
5786: has the following syntax:
1.1 dsieger 5787:
1.184 rillig 5788: user:group
1.1 dsieger 5789:
1.184 rillig 5790: Further specification of user details may be done by setting per-user
5791: variables. PKG_UID.user is the numeric UID for the user. PKG_GECOS.user is the
5792: user's description or comment. PKG_HOME.user is the user's home directory, and
5793: defaults to /nonexistent if not specified. PKG_SHELL.user is the user's shell,
5794: and defaults to /sbin/nologin if not specified.
1.1 dsieger 5795:
1.184 rillig 5796: Similarly, groups can be created by adding entries to the PKG_GROUPS variable,
5797: whose syntax is:
1.1 dsieger 5798:
1.184 rillig 5799: group
1.1 dsieger 5800:
1.184 rillig 5801: The numeric GID of the group may be set by defining PKG_GID.group.
1.1 dsieger 5802:
1.184 rillig 5803: If a package needs to create the users and groups at an earlier stage, then it
5804: can set USERGROUP_PHASE to either configure,build, or pre-install to indicate
5805: the phase before which the users and groups are created. In this case, the
5806: numeric UIDs and GIDs of the created users and groups are automatically
5807: hardcoded into the final installation scripts.
1.1 dsieger 5808:
1.184 rillig 5809: 20.5. System shells
1.1 dsieger 5810:
1.184 rillig 5811: Packages that install system shells should register them in the shell database,
5812: /etc/shells, to make things easier to the administrator. This must be done from
5813: the installation scripts to keep binary packages working on any system.
5814: pkginstall provides an easy way to accomplish this task.
1.1 dsieger 5815:
1.184 rillig 5816: When a package provides a shell interpreter, it has to set the PKG_SHELL
5817: variable to its absolute file name. This will add some hooks to the
5818: installation scripts to handle it. Consider the following example, taken from
5819: shells/zsh:
1.1 dsieger 5820:
1.184 rillig 5821: PKG_SHELL= ${PREFIX}/bin/zsh
1.1 dsieger 5822:
1.184 rillig 5823: 20.5.1. Disabling shell registration
1.1 dsieger 5824:
1.184 rillig 5825: The automatic registration of shell interpreters can be disabled by the
5826: administrator by setting the PKG_REGISTER_SHELLS environment variable to NO.
1.1 dsieger 5827:
1.184 rillig 5828: 20.6. Fonts
1.1 dsieger 5829:
1.184 rillig 5830: Packages that install X11 fonts should update the database files that index the
5831: fonts within each fonts directory. This can easily be accomplished within the
5832: pkginstall framework.
1.1 dsieger 5833:
1.184 rillig 5834: When a package installs X11 fonts, it must list the directories in which fonts
5835: are installed in the FONTS_DIRS.type variables, where type can be one of "ttf",
5836: "type1" or "x11". This will add hooks to the installation scripts to run the
5837: appropriate commands to update the fonts database files within each of those
5838: directories. For convenience, if the directory path is relative, it is taken to
5839: be relative to the package's installation prefix. Consider the following
5840: example, taken from fonts/dbz-ttf:
1.1 dsieger 5841:
1.184 rillig 5842: FONTS_DIRS.ttf= ${PREFIX}/share/fonts/X11/TTF
1.1 dsieger 5843:
1.184 rillig 5844: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 5845:
1.184 rillig 5846: The automatic update of fonts databases can be disabled by the administrator by
5847: setting the PKG_UPDATE_FONTS_DB environment variable to NO.
1.1 dsieger 5848:
1.154 rillig 5849: Chapter 21. Making your package work
1.1 dsieger 5850:
5851: Table of Contents
5852:
1.154 rillig 5853: 21.1. General operation
5854: 21.1.1. How to pull in user-settable variables from mk.conf
5855: 21.1.2. User interaction
5856: 21.1.3. Handling licenses
5857: 21.1.4. Restricted packages
5858: 21.1.5. Handling dependencies
5859: 21.1.6. Handling conflicts with other packages
5860: 21.1.7. Packages that cannot or should not be built
5861: 21.1.8. Packages which should not be deleted, once installed
5862: 21.1.9. Handling packages with security problems
5863: 21.1.10. How to handle incrementing versions when fixing an existing
1.232 gutterid 5864: package
1.154 rillig 5865: 21.1.11. Substituting variable text in the package files (the SUBST
1.232 gutterid 5866: framework)
1.154 rillig 5867: 21.2. The fetch phase
5868: 21.2.1. Packages whose distfiles aren't available for plain downloading
5869: 21.2.2. How to handle modified distfiles with the 'old' name
5870: 21.2.3. Packages hosted on github.com
5871: 21.3. The configure phase
5872: 21.3.1. Shared libraries - libtool
5873: 21.3.2. Using libtool on GNU packages that already support libtool
5874: 21.3.3. GNU Autoconf/Automake
1.223 nia 5875: 21.3.4. Meson / ninja
1.154 rillig 5876: 21.4. Programming languages
5877: 21.4.1. C, C++, and Fortran
5878: 21.4.2. Java
1.205 wiz 5879: 21.4.3. Go
1.223 nia 5880: 21.4.4. Rust
5881: 21.4.5. Packages containing Perl scripts
5882: 21.4.6. Packages containing shell scripts
5883: 21.4.7. Other programming languages
1.154 rillig 5884: 21.5. The build phase
5885: 21.5.1. Compiling C and C++ code conditionally
5886: 21.5.2. How to handle compiler bugs
1.172 rillig 5887: 21.5.3. No such file or directory
5888: 21.5.4. Undefined reference to "..."
5889: 21.5.5. Running out of memory
1.154 rillig 5890: 21.6. The install phase
5891: 21.6.1. Creating needed directories
5892: 21.6.2. Where to install documentation
5893: 21.6.3. Installing highscore files
5894: 21.6.4. Adding DESTDIR support to packages
5895: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 5896: 21.6.6. Packages installing Perl modules
1.154 rillig 5897: 21.6.7. Packages installing info files
5898: 21.6.8. Packages installing man pages
1.203 nia 5899: 21.6.9. Packages installing X11 fonts
5900: 21.6.10. Packages installing SGML or XML data
5901: 21.6.11. Packages installing extensions to the MIME database
5902: 21.6.12. Packages using intltool
5903: 21.6.13. Packages installing startup scripts
5904: 21.6.14. Packages installing TeX modules
5905: 21.6.15. Packages supporting running binaries in emulation
5906: 21.6.16. Packages installing hicolor icons
5907: 21.6.17. Packages installing desktop files
1.154 rillig 5908: 21.7. Marking packages as having problems
1.1 dsieger 5909:
1.154 rillig 5910: 21.1. General operation
1.1 dsieger 5911:
5912: One appealing feature of pkgsrc is that it runs on many different platforms. As
5913: a result, it is important to ensure, where possible, that packages in pkgsrc
5914: are portable. This chapter mentions some particular details you should pay
5915: attention to while working on pkgsrc.
5916:
1.154 rillig 5917: 21.1.1. How to pull in user-settable variables from mk.conf
1.1 dsieger 5918:
5919: The pkgsrc user can configure pkgsrc by overriding several variables in the
1.4 rillig 5920: file pointed to by MAKECONF, which is mk.conf by default. When you want to use
5921: those variables in the preprocessor directives of make(1) (for example .if or
5922: .for), you need to include the file ../../mk/bsd.prefs.mk before, which in turn
5923: loads the user preferences.
1.1 dsieger 5924:
5925: But note that some variables may not be completely defined after ../../mk/
5926: bsd.prefs.mk has been included, as they may contain references to variables
1.108 rillig 5927: that are not yet defined. In shell commands (the lines in Makefile that are
5928: indented with a tab) this is no problem, since variables are only expanded when
5929: they are used. But in the preprocessor directives mentioned above and in
5930: dependency lines (of the form target: dependencies) the variables are expanded
5931: at load time.
1.1 dsieger 5932:
5933: Note
5934:
1.108 rillig 5935: To check whether a variable can be used at load time, run pkglint -Wall on your
5936: package.
1.1 dsieger 5937:
1.154 rillig 5938: 21.1.2. User interaction
1.1 dsieger 5939:
5940: Occasionally, packages require interaction from the user, and this can be in a
5941: number of ways:
5942:
5943: * When fetching the distfiles, some packages require user interaction such as
5944: entering username/password or accepting a license on a web page.
5945:
5946: * When extracting the distfiles, some packages may ask for passwords.
5947:
5948: * help to configure the package before it is built
5949:
5950: * help during the build process
5951:
5952: * help during the installation of a package
5953:
1.108 rillig 5954: A package can set the INTERACTIVE_STAGE variable to define which stages need
5955: interaction. This should be done in the package's Makefile, e.g.:
1.1 dsieger 5956:
5957: INTERACTIVE_STAGE= configure install
5958:
5959: The user can then decide to skip this package by setting the BATCH variable.
1.108 rillig 5960: Packages that require interaction are also excluded from bulk builds.
1.1 dsieger 5961:
1.154 rillig 5962: 21.1.3. Handling licenses
1.1 dsieger 5963:
5964: Authors of software can choose the licence under which software can be copied.
1.111 sevan 5965: The Free Software Foundation has declared some licenses "Free", and the Open
5966: Source Initiative has a definition of "Open Source".
5967:
5968: By default, pkgsrc allows packages with Free or Open Source licenses to be
5969: built. To allow packages with other licenses to be built as well, the pkgsrc
5970: user needs to add these licenses to the ACCEPTABLE_LICENSES variable in mk.conf
5971: . Note that this variable only affects which packages may be built, while the
5972: license terms often also restrict the actual use of the package and its
5973: redistribution.
1.1 dsieger 5974:
5975: One might want to only install packages with a BSD license, or the GPL, and not
1.20 jnemeth 5976: the other. The free licenses are added to the default ACCEPTABLE_LICENSES
1.111 sevan 5977: variable. The pkgsrc user can override the default by setting the
5978: ACCEPTABLE_LICENSES variable with "=" instead of "+=". The licenses accepted by
5979: default are defined in the DEFAULT_ACCEPTABLE_LICENSES variable in the file
5980: pkgsrc/mk/license.mk.
1.1 dsieger 5981:
5982: The license tag mechanism is intended to address copyright-related issues
5983: surrounding building, installing and using a package, and not to address
1.20 jnemeth 5984: redistribution issues (see RESTRICTED and NO_SRC_ON_FTP, etc.). Packages with
5985: redistribution restrictions should set these tags.
1.1 dsieger 5986:
5987: Denoting that a package may be copied according to a particular license is done
5988: by placing the license in pkgsrc/licenses and setting the LICENSE variable to a
5989: string identifying the license, e.g. in graphics/xv:
5990:
5991: LICENSE= xv-license
5992:
5993: When trying to build, the user will get a notice that the package is covered by
5994: a license which has not been placed in the ACCEPTABLE_LICENSES variable:
5995:
5996: % make
5997: ===> xv-3.10anb9 has an unacceptable license: xv-license.
5998: ===> To view the license, enter "/usr/bin/make show-license".
5999: ===> To indicate acceptance, add this line to your /etc/mk.conf:
6000: ===> ACCEPTABLE_LICENSES+=xv-license
6001: *** Error code 1
6002:
6003: The license can be viewed with make show-license, and if the user so chooses,
1.4 rillig 6004: the line printed above can be added to mk.conf to convey to pkgsrc that it
1.1 dsieger 6005: should not in the future fail because of that license:
6006:
6007: ACCEPTABLE_LICENSES+=xv-license
6008:
1.111 sevan 6009: The use of LICENSE=shareware, LICENSE=no-commercial-use, and similar language
6010: is deprecated because it does not crisply refer to a particular license text.
6011: Another problem with such usage is that it does not enable a user to tell
6012: pkgsrc to proceed for a single package without also telling pkgsrc to proceed
6013: for all packages with that tag.
6014:
1.154 rillig 6015: 21.1.3.1. Adding a package with a new license
1.1 dsieger 6016:
1.49 rodent 6017: When adding a package with a new license, the following steps are required:
6018:
1.111 sevan 6019: 1. Check whether the license qualifies as Free or Open Source by referencing
6020: Various Licenses and Comments about Them and Licenses by Name | Open Source
6021: Initiative. If this is the case, the filename in pkgsrc/licenses/ does not
6022: need the -license suffix, and the license name should be added to:
1.49 rodent 6023:
6024: + DEFAULT_ACCEPTABLE_LICENSES in pkgsrc/mk/license.mk
6025:
6026: + default_acceptable_licenses in pkgsrc/pkgtools/pkg_install/files/lib/
6027: license.c
6028:
6029: 2. The license text should be added to pkgsrc/licenses for displaying. A list
6030: of known licenses can be seen in this directory.
1.1 dsieger 6031:
1.154 rillig 6032: 21.1.3.2. Change to the license
1.1 dsieger 6033:
1.111 sevan 6034: When the license changes (in a way other than formatting), make sure that the
6035: new license has a different name (e.g., append the version number if it exists,
6036: or the date). Just because a user told pkgsrc to build programs under a
6037: previous version of a license does not mean that pkgsrc should build programs
6038: under the new licenses. The higher-level point is that pkgsrc does not evaluate
6039: licenses for reasonableness; the only test is a mechanistic test of whether a
6040: particular text has been approved by either of two bodies (FSF or OSI).
1.1 dsieger 6041:
1.154 rillig 6042: 21.1.4. Restricted packages
1.1 dsieger 6043:
1.111 sevan 6044: Some licenses restrict how software may be re-distributed. By declaring the
6045: restrictions, package tools can automatically refrain from e.g. placing binary
6046: packages on FTP sites.
6047:
6048: There are four possible restrictions, which are the cross product of sources
6049: (distfiles) and binaries not being placed on FTP sites and CD-ROMs. Because
6050: this is rarely the exact language in any license, and because non-Free licenses
6051: tend to be different from each other, pkgsrc adopts a definition of FTP and
6052: CD-ROM. "FTP" means making the source or binary file available over the
6053: Internet at no charge. "CD-ROM" means making the source or binary available on
6054: some kind of media, together with other source and binary packages, which is
6055: sold for a distribution charge.
1.1 dsieger 6056:
6057: In order to encode these restrictions, the package system defines five make
6058: variables that can be set to note these restrictions:
6059:
6060: * RESTRICTED
6061:
6062: This variable should be set whenever a restriction exists (regardless of
6063: its kind). Set this variable to a string containing the reason for the
6064: restriction. It should be understood that those wanting to understand the
6065: restriction will have to read the license, and perhaps seek advice of
6066: counsel.
6067:
6068: * NO_BIN_ON_CDROM
6069:
6070: Binaries may not be placed on CD-ROM containing other binary packages, for
6071: which a distribution charge may be made. In this case, set this variable to
6072: ${RESTRICTED}.
6073:
6074: * NO_BIN_ON_FTP
6075:
6076: Binaries may not made available on the Internet without charge. In this
6077: case, set this variable to ${RESTRICTED}. If this variable is set, binary
6078: packages will not be included on ftp.NetBSD.org.
6079:
6080: * NO_SRC_ON_CDROM
6081:
6082: Distfiles may not be placed on CD-ROM, together with other distfiles, for
6083: which a fee may be charged. In this case, set this variable to $
6084: {RESTRICTED}.
6085:
6086: * NO_SRC_ON_FTP
6087:
6088: Distfiles may not made available via FTP at no charge. In this case, set
6089: this variable to ${RESTRICTED}. If this variable is set, the distfile(s)
6090: will not be mirrored on ftp.NetBSD.org.
6091:
1.111 sevan 6092: Please note that packages will be removed from pkgsrc when the distfiles are
1.33 wiz 6093: not distributable and cannot be obtained for a period of one full quarter
1.111 sevan 6094: branch. Packages with manual/interactive fetch must have a maintainer and it is
6095: his/her responsibility to ensure this.
1.33 wiz 6096:
1.154 rillig 6097: 21.1.5. Handling dependencies
1.1 dsieger 6098:
1.175 gutterid 6099: Your package may depend on some other package being present, and there are
6100: various ways of expressing this dependency. pkgsrc supports the DEPENDS,
6101: BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS definitions, the USE_TOOLS
6102: definition, as well as dependencies via buildlink3.mk, which is the preferred
6103: way to handle dependencies, and which uses the variables named above. See
1.184 rillig 6104: Chapter 18, Buildlink methodology for more information.
1.175 gutterid 6105:
6106: The basic difference is that the DEPENDS definition registers that
6107: pre-requisite in the binary package so it will be pulled in when the binary
6108: package is later installed, whilst the BUILD_DEPENDS, TOOL_DEPENDS, and
6109: TEST_DEPENDS definitions do not, marking a dependency that is only needed for
1.184 rillig 6110: building or testing the resulting package. See also Chapter 14, Creating a new
1.175 gutterid 6111: pkgsrc package from scratch for more information.
6112:
6113: This means that if you only need a package present whilst you are building or
6114: testing, it should be noted as a TOOL_DEPENDS, BUILD_DEPENDS, or TEST_DEPENDS.
6115: When cross-compiling, TOOL_DEPENDS are native packages, i.e. packages for the
6116: architecture where the package is built; BUILD_DEPENDS are target packages,
6117: i.e., packages for the architecture for which the package is built.
1.1 dsieger 6118:
1.175 gutterid 6119: The format for a DEPENDS, BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS
6120: definition is:
1.1 dsieger 6121:
6122: <pre-req-package-name>:../../<category>/<pre-req-package>
6123:
6124: Please note that the "pre-req-package-name" may include any of the wildcard
6125: version numbers recognized by pkg_info(1).
6126:
1.55 wiz 6127: 1. If your package needs another package's binaries or libraries to build and
1.1 dsieger 6128: run, and if that package has a buildlink3.mk file available, use it:
6129:
6130: .include "../../graphics/jpeg/buildlink3.mk"
6131:
1.55 wiz 6132: 2. If your package needs another package's binaries or libraries only for
6133: building, and if that package has a buildlink3.mk file available, use it:
6134:
6135: .include "../../graphics/jpeg/buildlink3.mk"
6136:
6137: but set BUILDLINK_DEPMETHOD.jpeg?=build to make it a build dependency only.
6138: This case is rather rare.
6139:
6140: 3. If your package needs binaries from another package to build, use the
1.156 leot 6141: TOOL_DEPENDS definition:
6142:
6143: TOOL_DEPENDS+= itstool-[0-9]*:../../textproc/itstool
1.1 dsieger 6144:
1.156 leot 6145: 4. If your package needs static libraries to link against, header files to
6146: include, etc. from another package to build, use the BUILD_DEPENDS
6147: definition.
1.1 dsieger 6148:
1.156 leot 6149: 5. If your package needs a library with which to link and there is no
1.26 spz 6150: buildlink3.mk file available, create one. Using DEPENDS won't be sufficient
6151: because the include files and libraries will be hidden from the compiler.
1.1 dsieger 6152:
1.156 leot 6153: 6. If your package needs some executable to be able to run correctly and if
1.26 spz 6154: there's no buildlink3.mk file, this is specified using the DEPENDS
6155: variable. The print/lyx package needs to be able to execute the latex
1.129 wiz 6156: binary from the tex-latex-bin package when it runs, and that is specified:
1.1 dsieger 6157:
1.129 wiz 6158: DEPENDS+= tex-latex-bin-[0-9]*:../../print/tex-latex-bin
1.1 dsieger 6159:
1.175 gutterid 6160: 7. If your package includes a test suite that has extra dependencies only
6161: required for this purpose (frequently this can be run as a "make test"
6162: target), use the TEST_DEPENDS variable.
6163:
6164: 8. You can use wildcards in package dependencies. Note that such wildcard
1.26 spz 6165: dependencies are retained when creating binary packages. The dependency is
6166: checked when installing the binary package and any package which matches
6167: the pattern will be used. Wildcard dependencies should be used with care.
1.1 dsieger 6168:
6169: The "-[0-9]*" should be used instead of "-*" to avoid potentially ambiguous
6170: matches such as "tk-postgresql" matching a "tk-*" DEPENDS.
6171:
6172: Wildcards can also be used to specify that a package will only build
6173: against a certain minimum version of a pre-requisite:
6174:
1.26 spz 6175: DEPENDS+= ImageMagick>=6.0:../../graphics/ImageMagick
1.1 dsieger 6176:
1.26 spz 6177: This means that the package will build using version 6.0 of ImageMagick or
6178: newer. Such a dependency may be warranted if, for example, the command line
6179: options of an executable have changed.
6180:
1.183 wiz 6181: If you need to depend on minimum versions of libraries, set
6182: BUILDLINK_API_DEPENDS.pkg to the appropriate pattern before including its
6183: buildlink3.mk file, e.g.
6184:
6185: BUILDLINK_API_DEPENDS.jpeg+= jpeg>=9.0
6186: .include "../../graphics/jpeg/buildlink3.mk"
1.1 dsieger 6187:
6188: For security fixes, please update the package vulnerabilities file. See
1.154 rillig 6189: Section 21.1.9, "Handling packages with security problems" for more
1.1 dsieger 6190: information.
6191:
6192: If your package needs files from another package to build, add the relevant
6193: distribution files to DISTFILES, so they will be extracted automatically. See
6194: the print/ghostscript package for an example. (It relies on the jpeg sources
6195: being present in source form during the build.)
6196:
1.154 rillig 6197: 21.1.6. Handling conflicts with other packages
1.1 dsieger 6198:
1.226 gutterid 6199: Your package may conflict with other packages users might already have
6200: installed on their system, e.g., if your package installs the same set of files
1.227 wiz 6201: as another package in the pkgsrc tree.
1.1 dsieger 6202:
1.142 leot 6203: For example, x11/libXaw3d and x11/Xaw-Xpm install the same shared library, thus
6204: you set in pkgsrc/x11/libXaw3d/Makefile:
1.1 dsieger 6205:
1.142 leot 6206: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 dsieger 6207:
1.142 leot 6208: and in pkgsrc/x11/Xaw-Xpm/Makefile:
1.1 dsieger 6209:
1.142 leot 6210: CONFLICTS= libXaw3d-[0-9]*
1.1 dsieger 6211:
1.142 leot 6212: pkg_add(1) is able to detect attempts to install packages that conflict with
6213: existing packages and abort. However, in many situations this is too late in
6214: the process. Binary package managers will not know about the conflict until
6215: they attempt to install the package after already downloading it and all its
6216: dependencies. Users may also waste time building a package and its dependencies
6217: only to find out at the end that it conflicts with another package they have
6218: installed.
6219:
6220: To avoid these issues CONFLICTS entries should be added in all cases where it
6221: is known that packages conflict with each other. These CONFLICTS entries are
6222: exported in pkg_summary(5) files and consumed by binary package managers to
6223: inform users that packages cannot be installed onto the target system.
1.1 dsieger 6224:
1.154 rillig 6225: 21.1.7. Packages that cannot or should not be built
1.1 dsieger 6226:
6227: There are several reasons why a package might be instructed to not build under
6228: certain circumstances. If the package builds and runs on most platforms, the
1.83 dholland 6229: exceptions should be noted with BROKEN_ON_PLATFORM. If the package builds and
6230: runs on a small handful of platforms, set BROKEN_EXCEPT_ON_PLATFORM instead.
6231: Both BROKEN_ON_PLATFORM and BROKEN_EXCEPT_ON_PLATFORM are OS triples
6232: (OS-version-platform) that can use glob-style wildcards.
6233:
1.114 maya 6234: If a package is not appropriate for some platforms (as opposed to merely
1.83 dholland 6235: broken), a different set of variables should be used as this affects failure
6236: reporting and statistics. If the package is appropriate for most platforms, the
6237: exceptions should be noted with NOT_FOR_PLATFORM. If the package is appropriate
6238: for only a small handful of platforms (often exactly one), set
6239: ONLY_FOR_PLATFORM instead. Both ONLY_FOR_PLATFORM and NOT_FOR_PLATFORM are OS
6240: triples (OS-version-platform) that can use glob-style wildcards.
1.1 dsieger 6241:
6242: Some packages are tightly bound to a specific version of an operating system,
6243: e.g. LKMs or sysutils/lsof. Such binary packages are not backwards compatible
6244: with other versions of the OS, and should be uploaded to a version specific
6245: directory on the FTP server. Mark these packages by setting OSVERSION_SPECIFIC
6246: to "yes". This variable is not currently used by any of the package system
6247: internals, but may be used in the future.
6248:
6249: If the package should be skipped (for example, because it provides
6250: functionality already provided by the system), set PKG_SKIP_REASON to a
6251: descriptive message. If the package should fail because some preconditions are
6252: not met, set PKG_FAIL_REASON to a descriptive message.
6253:
1.154 rillig 6254: 21.1.8. Packages which should not be deleted, once installed
1.1 dsieger 6255:
6256: To ensure that a package may not be deleted, once it has been installed, the
6257: PKG_PRESERVE definition should be set in the package Makefile. This will be
1.25 wiz 6258: carried into any binary package that is made from this pkgsrc entry. A "
6259: preserved" package will not be deleted using pkg_delete(1) unless the "-f"
1.1 dsieger 6260: option is used.
6261:
1.154 rillig 6262: 21.1.9. Handling packages with security problems
1.1 dsieger 6263:
6264: When a vulnerability is found, this should be noted in localsrc/security/
1.205 wiz 6265: advisories/pkg-vulnerabilities. Entries in that file consist of three parts:
6266:
6267: * package version pattern
6268:
6269: * type of vulnerability (please cut'n'paste an existing one where possible)
6270:
6271: * URL providing additional information about the issue
6272:
6273: For the package version pattern please always use `<' to mark an upper bound
6274: (not `<='!). This will avoid possible problems due unrelated PKGREVISION bumps
6275: not related to security fixes. Lower bounds can be added too, using '>' or '>=
1.206 wiz 6276: '. For example, "foo>=1<1.2" would mark versions 1.0 (included) to 1.2
1.205 wiz 6277: (excluded) of "foo" as affected by the security issue.
6278:
6279: Entries should always be added at the bottom of the file.
6280:
6281: When fixing packages, please modify the upper bound of the corresponding entry.
6282: To continue the previous example, if a fix was backported to version 1.1nb2,
1.206 wiz 6283: change the previous pattern to "foo>=1<1.1nb2".
1.205 wiz 6284:
6285: To locally test a package version pattern against a PKGNAME you can use the
6286: pkg_admin pmatch command.
6287:
6288: The URL should be as permanent as possible and provide as much information
6289: about the issue as possible. CVE entries are preferred.
6290:
6291: After committing that file, ask pkgsrc-security@NetBSD.org to update the file
6292: on ftp.NetBSD.org.
1.1 dsieger 6293:
6294: After fixing the vulnerability by a patch, its PKGREVISION should be increased
6295: (this is of course not necessary if the problem is fixed by using a newer
1.32 wiz 6296: release of the software), and the pattern in the pkg-vulnerabilities file must
6297: be updated.
1.1 dsieger 6298:
6299: Also, if the fix should be applied to the stable pkgsrc branch, be sure to
6300: submit a pullup request!
6301:
6302: Binary packages already on ftp.NetBSD.org will be handled semi-automatically by
6303: a weekly cron job.
6304:
1.205 wiz 6305: In case a security issue is disputed, please contact
6306: pkgsrc-security@NetBSD.org.
6307:
1.154 rillig 6308: 21.1.10. How to handle incrementing versions when fixing an existing package
1.1 dsieger 6309:
6310: When making fixes to an existing package it can be useful to change the version
6311: number in PKGNAME. To avoid conflicting with future versions by the original
6312: author, a "nb1", "nb2", ... suffix can be used on package versions by setting
6313: PKGREVISION=1 (2, ...). The "nb" is treated like a "." by the package tools.
6314: e.g.
6315:
6316: DISTNAME= foo-17.42
6317: PKGREVISION= 9
6318:
6319: will result in a PKGNAME of "foo-17.42nb9". If you want to use the original
6320: value of PKGNAME without the "nbX" suffix, e.g. for setting DIST_SUBDIR, use
6321: PKGNAME_NOREV.
6322:
6323: When a new release of the package is released, the PKGREVISION should be
6324: removed, e.g. on a new minor release of the above package, things should be
6325: like:
6326:
6327: DISTNAME= foo-17.43
6328:
6329: PKGREVISION should be incremented for any non-trivial change in the resulting
6330: binary package. Without a PKGREVISION bump, someone with the previous version
6331: installed has no way of knowing that their package is out of date. Thus,
6332: changes without increasing PKGREVISION are essentially labeled "this is so
6333: trivial that no reasonable person would want to upgrade", and this is the rough
6334: test for when increasing PKGREVISION is appropriate. Examples of changes that
6335: do not merit increasing PKGREVISION are:
6336:
1.14 jmcneill 6337: * Changing HOMEPAGE, MAINTAINER, OWNER, or comments in Makefile.
1.1 dsieger 6338:
6339: * Changing build variables if the resulting binary package is the same.
6340:
6341: * Changing DESCR.
6342:
6343: * Adding PKG_OPTIONS if the default options don't change.
6344:
6345: Examples of changes that do merit an increase to PKGREVISION include:
6346:
6347: * Security fixes
6348:
6349: * Changes or additions to a patch file
6350:
6351: * Changes to the PLIST
6352:
1.12 weinem 6353: * A dependency is changed or renamed.
6354:
1.1 dsieger 6355: PKGREVISION must also be incremented when dependencies have ABI changes.
6356:
1.154 rillig 6357: 21.1.11. Substituting variable text in the package files (the SUBST framework)
1.1 dsieger 6358:
1.180 rillig 6359: When you want to replace the same text in multiple files, or multiple times in
6360: the same file, it is cumbersome to maintain a patch file for this. This is
6361: where the SUBST framework steps in. It provides an easy-to-use interface for
6362: replacing text in files. It just needs the following information:
1.172 rillig 6363:
1.180 rillig 6364: * In which phase of the package build cycle should the replacement happen?
1.172 rillig 6365:
1.180 rillig 6366: * In which files should the replacement happen?
1.172 rillig 6367:
6368: * Which text should be replaced with what?
6369:
1.180 rillig 6370: This information is encoded in a block of SUBST variables. A minimal example
6371: is:
6372:
6373: SUBST_CLASSES+= paths
6374: SUBST_STAGE.paths= pre-configure
6375: SUBST_FILES.paths= src/*.c
6376: SUBST_SED.paths= -e 's,/usr/local,${PREFIX},g'
6377:
6378: Translated into English, it means: In the pre-configure stage (that is, after
6379: applying the patches from the patches/ directory and before running the
6380: configure script and the portability check), replace the text /usr/local with
6381: the content of the variable PREFIX.
6382:
6383: Each SUBST block starts by appending an identifier to SUBST_CLASSES (note the +
6384: =). This identifier can be chosen freely by the package. If there should ever
6385: be duplicate identifiers, the pkgsrc infrastructure will catch this and fail
6386: early, so don't worry about name collisions.
6387:
6388: Except for SUBST_CLASSES, all variables in a SUBST block are parameterized
6389: using this identifier. In the remainder of this section, these parameterized
6390: variables are written as SUBST_STAGE.*.
6391:
6392: SUBST_CLASSES+= paths
6393: SUBST_STAGE.paths= pre-configure
6394: SUBST_MESSAGE.paths= Fixing absolute paths.
6395: SUBST_FILES.paths= src/*.c
6396: SUBST_FILES.paths+= scripts/*.sh
6397: SUBST_SED.paths= -e 's,"/usr/local,"${PREFIX},g'
6398: SUBST_SED.paths+= -e 's,"/var/log,"${VARBASE}/log,g'
6399: SUBST_VARS.paths= LOCALBASE PREFIX PKGVERSION
6400:
6401: To get a complete picture about the SUBST substitutions, run bmake
6402: show-all-subst. If something doesn't work as expected, run pkglint on the
6403: package, which detects several typical mistakes surrounding the SUBST blocks.
6404: For any questions that might remain after this, have a look at mk/subst.mk.
6405:
6406: 21.1.11.1. Choosing the time where the substitutions happen
6407:
6408: The SUBST_STAGE.* is one of {pre,do,post}-
6409: {extract,patch,configure,build,test,install}. Of these, pre-configure is used
6410: most often, by far. The most popular stages are, in chronological order:
6411:
6412: post-extract
6413:
6414: The substitutions are applied immediately after the distfiles are
6415: extracted. Running bmake extract on the package will leave no traces of the
6416: original files.
6417:
6418: When the substitution applies to files for which there is also a patch in
6419: the patches/ directory, this means that the patches will be computed based
6420: on the result of the substitution. When these patches are sent to the
6421: upstream maintainer later, to be fixed in the upstream package, these
6422: patches may no longer match what the upstream author is used to. Because of
6423: this, pre-configure is often a better choice.
6424:
6425: pre-configure
6426:
6427: The substitutions are applied after the patches from the patches/
6428: directory. This makes it possible to run bmake patch on the package, after
6429: which the patches can be edited using the tools pkgvi and mkpatches from
6430: the pkgtools/pkgdiff package.
6431:
6432: When updating the patches, it is helpful to explicitly separate the bmake
6433: patch from the bmake configure, and to only edit the patches between these
6434: commands. Otherwise the substitutions from the SUBST block will end up in
6435: the patch file. When this happens in really obvious ways, pkglint will
6436: complain about patches that contain a hard-coded /usr/pkg instead of the
6437: correct and intended @PREFIX@, but it can only detect these really obvious
6438: cases.
6439:
6440: do-configure
6441:
6442: This stage should only be used if the package defines a pre-configure
6443: action itself, and the substitution must happen after that. Typical
6444: examples are packages that use the pre-configure stage to regenerate the
6445: GNU configure script from configure.ac.
6446:
6447: post-configure
6448:
6449: This stage is used to fix up any mistakes by the configure stage.
6450:
6451: pre-build
6452:
6453: This stage should only be used for substitutions that are clearly related
6454: to building the package, not for fixing the configuration. Substitutions
6455: for pathnames (such as replacing /usr/local with ${PREFIX}) or user names
6456: (such as replacing @MY_USER@ with the actual username) belong in
6457: pre-configure or post-configure instead.
6458:
6459: post-build
6460:
6461: Just as with pre-build, this stage should only be used for substitutions
6462: that are clearly related to building the package, not for fixing the
6463: configuration. Substitutions for pathnames (such as replacing /usr/local
6464: with ${PREFIX}) or user names (such as replacing @MY_USER@ with the actual
6465: username) belong in pre-configure or post-configure instead.
6466:
6467: A typical use is to update pkg-config files to include the rpath compiler
6468: options.
6469:
6470: pre-install
6471:
6472: In general, the install phase should be as simple as possible. As with the
6473: pre-build and post-build stages, it should not be used to fix pathnames or
6474: user names, these belong in pre-configure instead. There are only few
6475: legitimate use cases for applying substitutions in this stage.
6476:
1.181 rillig 6477: 21.1.11.2. Choosing the files where the substitutions happen
1.180 rillig 6478:
6479: The SUBST_FILES.* variable contains a list of filename patterns. These patterns
6480: are relative to WRKSRC since that is where most substitutions happen. A typical
6481: example is:
6482:
6483: SUBST_FILES.path= Makefile */Makefile */*/Makefile *.[ch]
6484:
6485: The above patterns, especially the last, are quite broad. The SUBST
6486: implementation checks that each filename pattern that is mentioned here has an
6487: effect. For example, if none of the */*/Makefile files contains the patterns to
6488: be found and substituted, that filename pattern is redundant and should be left
1.181 rillig 6489: out. By default, the SUBST framework will complain with an error message. If
6490: the text to be substituted occurs in some of the files from a single pattern,
6491: but not in all of them, that is totally ok, and the SUBST framework will only
6492: print an INFO message for those files.
1.180 rillig 6493:
6494: If there is a good reason for having redundant filename patterns, set
1.181 rillig 6495: SUBST_NOOP_OK.* to yes.
1.180 rillig 6496:
6497: Another popular way of choosing the files for the substitutions is via a shell
6498: command, like this:
6499:
1.181 rillig 6500: C_FILES_CMD= cd ${WRKSRC} && ${FIND} . -name '*.c'
1.180 rillig 6501: SUBST_FILES.path= ${C_FILES_CMD:sh}
6502:
6503: The variable name C_FILES_CMD in this example is freely chosen and independent
6504: of the SUBST framework.
6505:
6506: In this variant, the SUBST_FILES.* variable lists each file individually.
6507: Thereby chances are higher that there are filename patterns in which no
6508: substitution happens. Since the SUBST framework cannot know whether the
6509: filename patterns in SUBST_FILES.* have been explicitly listed in the Makefile
6510: (where any redundant filename pattern would be suspicious) or been generated by
6511: a shell command (in which redundant filename patterns are more likely and to be
6512: expected), it will complain about these redundant filename patterns. Therefore,
6513: SUBST blocks that use a shell command to generate the list of filename patterns
6514: often need to set SUBST_NOOP_OK.* to yes.
6515:
6516: 21.1.11.3. Choosing what to substitute
6517:
6518: In most cases, the substitutions are given using one or more sed(1) commands,
6519: like this:
6520:
6521: SUBST_SED.path= -e 's|/usr/local|${PREFIX}|g'
6522:
6523: Each of the sed commands needs to be preceded by the -e option and should be
6524: specified on a line of its own, to avoid hiding short sed commands at the end
6525: of a line.
6526:
6527: Since the sed commands often contain shell metacharacters as the separator (the
6528: | in the above example), it is common to enclose them in single quotes.
6529:
6530: A common substitution is to replace placeholders of the form @VARNAME@ with
6531: their pkgsrc counterpart variable ${VARNAME}. A typical example is:
6532:
6533: SUBST_VARS.path= PREFIX
6534:
1.181 rillig 6535: This type of substitutions is typically done by the GNU configure scripts
6536: during the do-configure stage, but in some cases these need to be overridden.
6537: The same pattern is also used when a package defines patches that replace
6538: previously hard-coded paths like /usr/local with a @PREFIX@ placeholder first,
6539: which then gets substituted by the actual ${PREFIX} in the pre-configure stage.
6540: In many of these cases, it works equally well to just use the SUBST framework
6541: to directly replace /usr/local with ${PREFIX}, thereby omitting the
6542: intermediate patch file.
1.180 rillig 6543:
6544: If the above is not flexible enough, it is possible to not use sed at all for
6545: the substitution but to specify an entirely different command, like this:
6546:
6547: SUBST_FILTER_CMD.path= LC_ALL=C ${TR} -d '\r'
1.1 dsieger 6548:
1.180 rillig 6549: This is used for the few remaining packages in which the distributed files use
6550: Windows-style line endings that need to be converted to UNIX-style line
6551: endings.
1.1 dsieger 6552:
1.180 rillig 6553: 21.1.11.4. Other SUBST variables
1.172 rillig 6554:
1.180 rillig 6555: When a SUBST block is applied during a package build, a message is logged. The
6556: default message is fine for most purposes but can be overridden by setting
6557: SUBST_MESSAGE.* to an individual message.
1.1 dsieger 6558:
1.154 rillig 6559: 21.2. The fetch phase
1.1 dsieger 6560:
1.154 rillig 6561: 21.2.1. Packages whose distfiles aren't available for plain downloading
1.1 dsieger 6562:
6563: If you need to download from a dynamic URL you can set DYNAMIC_MASTER_SITES and
6564: a make fetch will call files/getsite.sh with the name of each file to download
6565: as an argument, expecting it to output the URL of the directory from which to
6566: download it. graphics/ns-cult3d is an example of this usage.
6567:
6568: If the download can't be automated, because the user must submit personal
6569: information to apply for a password, or must pay for the source, or whatever,
6570: you can set FETCH_MESSAGE to a list of lines that are displayed to the user
6571: before aborting the build. Example:
6572:
6573: FETCH_MESSAGE= "Please download the files"
6574: FETCH_MESSAGE+= " "${DISTFILES:Q}
6575: FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"."
6576:
1.154 rillig 6577: 21.2.2. How to handle modified distfiles with the 'old' name
1.1 dsieger 6578:
6579: Sometimes authors of a software package make some modifications after the
6580: software was released, and they put up a new distfile without changing the
6581: package's version number. If a package is already in pkgsrc at that time, the
6582: checksum will no longer match. The contents of the new distfile should be
6583: compared against the old one before changing anything, to make sure the
6584: distfile was really updated on purpose, and that no trojan horse or so crept
6585: in. Please mention that the distfiles were compared and what was found in your
1.54 rodent 6586: commit message.
6587:
6588: Then, the correct way to work around this is to set DIST_SUBDIR to a unique
1.109 wiz 6589: directory name, usually based on PKGNAME_NOREV (but take care with python or
6590: ruby packages, where PKGNAME includes a variable prefix). All DISTFILES and
6591: PATCHFILES for this package will be put in that subdirectory of the local
1.154 rillig 6592: distfiles directory. (See Section 21.1.10, "How to handle incrementing versions
1.109 wiz 6593: when fixing an existing package" for more details.) In case this happens more
6594: often, PKGNAME can be used (thus including the nbX suffix) or a date stamp can
6595: be appended, like ${PKGNAME_NOREV}-YYYYMMDD.
1.54 rodent 6596:
6597: DIST_SUBDIR is also used when a distfile's name does not contain a version and
6598: the distfile is apt to change. In cases where the likelihood of this is very
6599: small, DIST_SUBDIR might not be required. Additionally, DIST_SUBDIR must not be
6600: removed unless the distfile name changes, even if a package is being moved or
6601: renamed.
6602:
6603: Do not forget regenerating the distinfo file after that, since it contains the
6604: DIST_SUBDIR path in the filenames. Also, increase the PKGREVISION if the
6605: installed package is different. Furthermore, a mail to the package's authors
6606: seems appropriate telling them that changing distfiles after releases without
6607: changing the file names is not good practice.
1.1 dsieger 6608:
1.154 rillig 6609: 21.2.3. Packages hosted on github.com
1.88 tnn 6610:
1.90 tnn 6611: Helper methods exist for packages hosted on github.com which will often have
6612: distfile names that clash with other packages, for example 1.0.tar.gz. Use one
6613: of the three recipes from below:
1.88 tnn 6614:
1.154 rillig 6615: 21.2.3.1. Fetch based on a tagged release
1.88 tnn 6616:
1.189 bacon 6617: If your distfile URL looks similar to https://github.com/username/example/
6618: archive/v1.0.zip, then you are packaging a tagged release.
1.88 tnn 6619:
1.189 bacon 6620: DISTNAME= example-1.0
1.90 tnn 6621: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
1.189 bacon 6622: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
1.90 tnn 6623: GITHUB_TAG= v${PKGVERSION_NOREV}
1.88 tnn 6624: EXTRACT_SUFX= .zip
6625:
1.230 gutterid 6626: Here, DISTNAME combined with use of GITHUB_TAG leads the file fetching
6627: infrastructure to save the resulting file locally as example-1.0.zip.
6628:
1.189 bacon 6629: 21.2.3.2. Fetch based on a specific commit before the first release
6630:
6631: If your distfile looks similar to https://github.com/username/example/archive/
6632: 988881adc9fc3655077dc2d4d757d480b5ea0e11 and is from a commit before the first
6633: release, then set the package version to 0.0.0.N, where N is the number of
6634: commits to the repository, and set GITHUB_TAG to the commit hash. This will
6635: (almost) ensure that the first tagged release will have a version greater than
6636: this one so that package upgrades will function properly.
6637:
6638: DISTNAME= example-0.0.0.347
6639: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6640: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
6641: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
6642:
6643: 21.2.3.3. Fetch based on a specific commit after a release
1.88 tnn 6644:
1.189 bacon 6645: If your distfile looks similar to https://github.com/username/example/archive/
6646: 988881adc9fc3655077dc2d4d757d480b5ea0e11 and is from a commit after a release,
6647: then include the last release version and the commit count since that release
6648: in the package version and set GITHUB_TAG to the commit hash. The latest
6649: release and commit count are shown in the output of "git describe --tags":
6650:
6651: # git clone https://github.com/username/example
6652: # cd example
6653: # git describe --tags
6654: 1.2.3-5-g988881a
1.88 tnn 6655:
1.189 bacon 6656: DISTNAME= example-1.2.3.5
6657: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6658: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
1.90 tnn 6659: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
1.88 tnn 6660:
1.189 bacon 6661: 21.2.3.4. Fetch based on release
1.88 tnn 6662:
1.189 bacon 6663: If your distfile URL looks similar to https://github.com/username/example/
6664: releases/download/rel-1.6/offensive-1.6.zip, then you are packaging a release.
1.88 tnn 6665:
1.90 tnn 6666: DISTNAME= offensive-1.6
1.88 tnn 6667: PKGNAME= ${DISTNAME:S/offensive/proper/}
1.90 tnn 6668: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
1.189 bacon 6669: GITHUB_PROJECT= example
1.90 tnn 6670: GITHUB_RELEASE= rel-${PKGVERSION_NOREV} # usually just set this to ${DISTNAME}
6671: EXTRACT_SUFX= .zip
1.88 tnn 6672:
1.154 rillig 6673: 21.3. The configure phase
1.1 dsieger 6674:
1.154 rillig 6675: 21.3.1. Shared libraries - libtool
1.1 dsieger 6676:
6677: pkgsrc supports many different machines, with different object formats like
6678: a.out and ELF, and varying abilities to do shared library and dynamic loading
6679: at all. To accompany this, varying commands and options have to be passed to
6680: the compiler, linker, etc. to get the Right Thing, which can be pretty annoying
6681: especially if you don't have all the machines at your hand to test things. The
6682: devel/libtool pkg can help here, as it just "knows" how to build both static
6683: and dynamic libraries from a set of source files, thus being
6684: platform-independent.
6685:
6686: Here's how to use libtool in a package in seven simple steps:
6687:
6688: 1. Add USE_LIBTOOL=yes to the package Makefile.
6689:
6690: 2. For library objects, use "${LIBTOOL} --mode=compile ${CC}" in place of "$
6691: {CC}". You could even add it to the definition of CC, if only libraries are
6692: being built in a given Makefile. This one command will build both PIC and
6693: non-PIC library objects, so you need not have separate shared and
6694: non-shared library rules.
6695:
6696: 3. For the linking of the library, remove any "ar", "ranlib", and "ld
6697: -Bshareable" commands, and instead use:
6698:
6699: ${LIBTOOL} --mode=link \
6700: ${CC} -o ${.TARGET:.a=.la} \
6701: ${OBJS:.o=.lo} \
6702: -rpath ${PREFIX}/lib \
6703: -version-info major:minor
6704:
6705: Note that the library is changed to have a .la extension, and the objects
6706: are changed to have a .lo extension. Change OBJS as necessary. This
6707: automatically creates all of the .a, .so.major.minor, and ELF symlinks (if
6708: necessary) in the build directory. Be sure to include "-version-info",
6709: especially when major and minor are zero, as libtool will otherwise strip
6710: off the shared library version.
6711:
6712: From the libtool manual:
6713:
6714: So, libtool library versions are described by three integers:
6715:
6716: CURRENT
6717: The most recent interface number that this library implements.
6718:
6719: REVISION
6720: The implementation number of the CURRENT interface.
6721:
6722: AGE
6723: The difference between the newest and oldest interfaces that
6724: this library implements. In other words, the library implements
6725: all the interface numbers in the range from number `CURRENT -
6726: AGE' to `CURRENT'.
6727:
6728: If two libraries have identical CURRENT and AGE numbers, then the
6729: dynamic linker chooses the library with the greater REVISION number.
6730:
6731: The "-release" option will produce different results for a.out and ELF
1.25 wiz 6732: (excluding symlinks) in only one case. An ELF library of the form "
6733: libfoo-release.so.x.y" will have a symlink of "libfoo.so.x.y" on an a.out
1.1 dsieger 6734: platform. This is handled automatically.
6735:
6736: The "-rpath argument" is the install directory of the library being built.
6737:
6738: In the PLIST, include only the .la file, the other files will be added
6739: automatically.
6740:
6741: 4. When linking shared object (.so) files, i.e. files that are loaded via
6742: dlopen(3), NOT shared libraries, use "-module -avoid-version" to prevent
6743: them getting version tacked on.
6744:
6745: The PLIST file gets the foo.so entry.
6746:
6747: 5. When linking programs that depend on these libraries before they are
6748: installed, preface the cc(1) or ld(1) line with "${LIBTOOL} --mode=link",
6749: and it will find the correct libraries (static or shared), but please be
6750: aware that libtool will not allow you to specify a relative path in -L
6751: (such as "-L../somelib"), because it expects you to change that argument to
6752: be the .la file. e.g.
6753:
6754: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
6755:
6756: should be changed to:
6757:
6758: ${LIBTOOL} --mode=link ${CC} -o someprog ../somelib/somelib.la
6759:
6760: and it will do the right thing with the libraries.
6761:
6762: 6. When installing libraries, preface the install(1) or cp(1) command with "$
6763: {LIBTOOL} --mode=install", and change the library name to .la. e.g.
6764:
1.23 jakllsch 6765: ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 dsieger 6766:
6767: This will install the static .a, shared library, any needed symlinks, and
6768: run ldconfig(8).
6769:
6770: 7. In your PLIST, include only the .la file (this is a change from previous
6771: behaviour).
6772:
1.154 rillig 6773: 21.3.2. Using libtool on GNU packages that already support libtool
1.1 dsieger 6774:
6775: Add USE_LIBTOOL=yes to the package Makefile. This will override the package's
6776: own libtool in most cases. For older libtool using packages, libtool is made by
6777: ltconfig script during the do-configure step; you can check the libtool script
6778: location by doing make configure; find work*/ -name libtool.
6779:
6780: LIBTOOL_OVERRIDE specifies which libtool scripts, relative to WRKSRC, to
6781: override. By default, it is set to "libtool */libtool */*/libtool". If this
6782: does not match the location of the package's libtool script(s), set it as
6783: appropriate.
6784:
6785: If you do not need *.a static libraries built and installed, then use
6786: SHLIBTOOL_OVERRIDE instead.
6787:
6788: If your package makes use of the platform-independent library for loading
6789: dynamic shared objects, that comes with libtool (libltdl), you should include
6790: devel/libltdl/buildlink3.mk.
6791:
6792: Some packages use libtool incorrectly so that the package may not work or build
6793: in some circumstances. Some of the more common errors are:
6794:
6795: * The inclusion of a shared object (-module) as a dependent library in an
6796: executable or library. This in itself isn't a problem if one of two things
6797: has been done:
6798:
6799: 1. The shared object is named correctly, i.e. libfoo.la, not foo.la
6800:
6801: 2. The -dlopen option is used when linking an executable.
6802:
6803: * The use of libltdl without the correct calls to initialisation routines.
6804: The function lt_dlinit() should be called and the macro
6805: LTDL_SET_PRELOADED_SYMBOLS included in executables.
6806:
1.154 rillig 6807: 21.3.3. GNU Autoconf/Automake
1.1 dsieger 6808:
6809: If a package needs GNU autoconf or automake to be executed to regenerate the
1.223 nia 6810: configure script and Makefile.in makefile templates from configure.ac and
6811: Makefile.am, then they should be executed in a pre-configure target:
1.1 dsieger 6812:
1.223 nia 6813: USE_TOOLS+= autoconf automake autoreconf
6814: GNU_CONFIGURE= yes
1.1 dsieger 6815: ...
6816:
6817: pre-configure:
1.223 nia 6818: set -e; cd ${WRKSRC} && autoreconf -fi
1.1 dsieger 6819: ...
6820:
1.223 nia 6821: Packages which use GNU Automake will sometimes require GNU Make (gmake in
6822: USE_TOOLS), but not always. Note that autoreconf only needs to be executed if
6823: configure.ac or Makefiles are modified, or configure is not present.
1.1 dsieger 6824:
6825: There are times when the configure process makes additional changes to the
6826: generated files, which then causes the build process to try to re-execute the
6827: automake sequence. This is prevented by touching various files in the configure
6828: stage. If this causes problems with your package you can set AUTOMAKE_OVERRIDE=
6829: NO in the package Makefile.
6830:
1.223 nia 6831: 21.3.4. Meson / ninja
6832:
6833: Packages using Meson to configure need to include:
6834:
6835: .include "../../devel/meson/build.mk"
6836:
6837: In nearly all cases (any program with dependencies), pkg-config needs to be
6838: added to USE_TOOLS. If the package installs translation files for non-English
6839: languages, also add msgfmt and xgettext:
6840:
6841: USE_TOOLS+= pkg-config msgfmt xgettext
6842:
6843: If any options need to be passed to Meson, use MESON_ARGS instead of
6844: CONFIGURE_ARGS:
6845:
6846: MESON_ARGS+= -Dx11=false
6847:
1.154 rillig 6848: 21.4. Programming languages
1.1 dsieger 6849:
1.154 rillig 6850: 21.4.1. C, C++, and Fortran
1.1 dsieger 6851:
1.223 nia 6852: Compilers for the C and C++ languages comes with the NetBSD base system. By
6853: default, pkgsrc assumes that a package is written in C and will hide all other
6854: compilers (via the wrapper framework, see Chapter 18, Buildlink methodology).
1.1 dsieger 6855:
6856: To declare which language's compiler a package needs, set the USE_LANGUAGES
1.212 wiz 6857: variable. Allowed values currently are:
6858:
1.238 wiz 6859: c99, c++, c++03, gnu++03, c++0x, gnu++0x, c++11, gnu++11,
6860: c++14, gnu++14, c++17, gnu++17, c++20, gnu++20, fortran,
6861: fortran77, java, objc, obj-c++, and ada.
1.212 wiz 6862:
6863: (and any combination). The default is "c". Packages using GNU configure
6864: scripts, even if written in C++, usually need a C compiler for the configure
6865: phase.
1.1 dsieger 6866:
1.223 nia 6867: To express a general requirement on a specific C or C++ version, normally only
6868: GCC_REQD needs to be set. For example, GCC 7 includes support for C++17, so if
6869: the package uses C++17 it should specify:
6870:
1.238 wiz 6871: GCC_REQD+= 7
1.223 nia 6872:
6873: Language variants like c++11 for USE_LANGUAGES should only be specified if the
6874: package does not explicitly set -std=... when compiling (i.e. the package
6875: assumes the compiler defaults to C++11 or some other standard). This is usually
6876: a bug in the upstream build system.
6877:
6878: GCC version 5 includes support for C++14, while GCC 4.7 includes more-or-less
6879: complete support for C++11. For more information, consult GCC's own
6880: documentation on programming language support.
6881:
1.154 rillig 6882: 21.4.2. Java
1.1 dsieger 6883:
6884: If a program is written in Java, use the Java framework in pkgsrc. The package
6885: must include ../../mk/java-vm.mk. This Makefile fragment provides the following
6886: variables:
6887:
6888: * USE_JAVA defines if a build dependency on the JDK is added. If USE_JAVA is
6889: set to "run", then there is only a runtime dependency on the JDK. The
6890: default is "yes", which also adds a build dependency on the JDK.
6891:
6892: * Set USE_JAVA2 to declare that a package needs a Java2 implementation. The
6893: supported values are "yes", "1.4", and "1.5". "yes" accepts any Java2
6894: implementation, "1.4" insists on versions 1.4 or above, and "1.5" only
6895: accepts versions 1.5 or above. This variable is not set by default.
6896:
1.25 wiz 6897: * PKG_JAVA_HOME is automatically set to the runtime location of the used Java
6898: implementation dependency. It may be used to set JAVA_HOME to a good value
6899: if the program needs this variable to be defined.
6900:
1.205 wiz 6901: 21.4.3. Go
6902:
6903: If a program is written in Go and has any dependencies on other Go modules,
6904: have the package include ../../lang/go/go-module.mk.
6905:
6906: 1. Generate a list of those dependencies with make clean && make patch && make
6907: show-go-modules > go-modules.mk.
6908:
1.223 nia 6909: 2. Prepend .include "go-modules.mk" to any other .includes.
6910:
6911: 3. Incorporate these modules in distinfo with make makesum.
1.205 wiz 6912:
1.223 nia 6913: 21.4.4. Rust
1.205 wiz 6914:
1.223 nia 6915: If a program is written in Rust and uses Cargo to build, have the package
6916: include ../../lang/rust/cargo.mk.
1.205 wiz 6917:
1.223 nia 6918: 1. Generate a list of those dependencies with make CARGO_ARGS="build
6919: --release" build && make print-cargo-depends > cargo-depends.mk.
1.205 wiz 6920:
1.223 nia 6921: 2. Prepend .include "cargo-depends.mk" to any other .includes.
1.205 wiz 6922:
6923: 3. Incorporate these modules in distinfo with make makesum.
6924:
1.223 nia 6925: 21.4.5. Packages containing Perl scripts
1.1 dsieger 6926:
1.203 nia 6927: If your package contains interpreted Perl scripts, add "perl" to the USE_TOOLS
1.1 dsieger 6928: variable and set REPLACE_PERL to ensure that the proper interpreter path is
6929: set. REPLACE_PERL should contain a list of scripts, relative to WRKSRC, that
1.74 wiz 6930: you want adjusted. Every occurrence of */bin/perl in a she-bang line will be
1.210 gutterid 6931: replaced with the full path to the Perl executable.
1.1 dsieger 6932:
1.210 gutterid 6933: If a particular version of Perl is needed, set the PERL5_REQD variable to the
1.1 dsieger 6934: version number. The default is "5.0".
6935:
1.203 nia 6936: See Section 21.6.6, "Packages installing Perl modules" for information about
1.210 gutterid 6937: handling Perl modules.
6938:
6939: There is also the REPLACE_PERL6 variable for the language now known as Raku.
1.1 dsieger 6940:
1.223 nia 6941: 21.4.6. Packages containing shell scripts
1.41 wiz 6942:
6943: REPLACE_SH, REPLACE_BASH, REPLACE_CSH, and REPLACE_KSH can be used to replace
1.225 gutterid 6944: shell she-bangs in files. Please use the appropriate one, preferring REPLACE_SH
6945: when this shell is sufficient. Each should contain a list of scripts, relative
6946: to WRKSRC, that you want adjusted. Every occurrence of the matching shell in a
6947: she-bang line will be replaced with the full path to the shell executable. When
6948: using REPLACE_BASH, don't forget to add bash to USE_TOOLS.
1.41 wiz 6949:
1.223 nia 6950: 21.4.7. Other programming languages
1.1 dsieger 6951:
1.210 gutterid 6952: There are further similar REPLACE variables available, e.g., REPLACE_AWK for
6953: packages containing awk scripts, and REPLACE_R for R. These two, like the
1.211 gutterid 6954: others noted above, have their actions defined centrally in mk/configure/
6955: replace-interpreter.mk. Other languages define the actions of these variables
6956: within their own dedicated part of the tree, e.g., REPLACE_PHP is actioned in
6957: lang/php/phpversion.mk, and REPLACE_PYTHON is actioned in lang/python/
6958: application.mk. For other languages, consult the mk files found within their
1.216 gutterid 6959: specific directories (the naming convention varies), or check the list found in
6960: Appendix E, Help topics.
1.210 gutterid 6961:
6962: Currently, special handling for other languages varies in pkgsrc. If a compiler
6963: package provides a buildlink3.mk file, include that, otherwise just add a
6964: (build) dependency on the appropriate compiler package.
1.1 dsieger 6965:
1.154 rillig 6966: 21.5. The build phase
1.1 dsieger 6967:
6968: The most common failures when building a package are that some platforms do not
6969: provide certain header files, functions or libraries, or they provide the
6970: functions in a library that the original package author didn't know. To work
6971: around this, you can rewrite the source code in most cases so that it does not
6972: use the missing functions or provides a replacement function.
6973:
1.154 rillig 6974: 21.5.1. Compiling C and C++ code conditionally
1.1 dsieger 6975:
6976: If a package already comes with a GNU configure script, the preferred way to
6977: fix the build failure is to change the configure script, not the code. In the
6978: other cases, you can utilize the C preprocessor, which defines certain macros
6979: depending on the operating system and hardware architecture it compiles for.
6980: These macros can be queried using for example #if defined(__i386). Almost every
6981: operating system, hardware architecture and compiler has its own macro. For
6982: example, if the macros __GNUC__, __i386__ and __NetBSD__ are all defined, you
6983: know that you are using NetBSD on an i386 compatible CPU, and your compiler is
6984: GCC.
6985:
6986: The list of the following macros for hardware and operating system depends on
6987: the compiler that is used. For example, if you want to conditionally compile
6988: code on Solaris, don't use __sun__, as the SunPro compiler does not define it.
6989: Use __sun instead.
6990:
1.154 rillig 6991: 21.5.1.1. C preprocessor macros to identify the operating system
1.1 dsieger 6992:
1.223 nia 6993: To distinguish between specific NetBSD versions, you should use the following
6994: code.
6995:
6996: #ifdef __NetBSD__
6997: #include <sys/param.h>
6998: #if __NetBSD_Prereq__(9,99,17)
6999: /* use a newer feature */
7000: #else
7001: /* older code */
7002: #endif
7003: #endif
7004:
7005: #ifndef _WIN32
7006: /* Unix-like specific code */
7007: #endif
7008:
1.1 dsieger 7009: To distinguish between 4.4 BSD-derived systems and the rest of the world, you
7010: should use the following code.
7011:
7012: #include <sys/param.h>
7013: #if (defined(BSD) && BSD >= 199306)
7014: /* BSD-specific code goes here */
7015: #else
7016: /* non-BSD-specific code goes here */
7017: #endif
7018:
1.223 nia 7019: You can also test for the following macros:
1.1 dsieger 7020:
1.46 obache 7021: Cygwin __CYGWIN__
7022: DragonFly __DragonFly__
1.1 dsieger 7023: FreeBSD __FreeBSD__
1.46 obache 7024: Haiku __HAIKU__
1.1 dsieger 7025: Interix __INTERIX
7026: IRIX __sgi (TODO: get a definite source for this)
1.223 nia 7027: Linux __linux
1.83 dholland 7028: Mac OS X __APPLE__
1.46 obache 7029: MirBSD __MirBSD__ (__OpenBSD__ is also defined)
7030: Minix3 __minix
1.1 dsieger 7031: NetBSD __NetBSD__
7032: OpenBSD __OpenBSD__
7033: Solaris sun, __sun
7034:
1.154 rillig 7035: 21.5.1.2. C preprocessor macros to identify the hardware architecture
1.1 dsieger 7036:
7037: i386 i386, __i386, __i386__
1.223 nia 7038: x86-64 __amd64__, __x86_64__
7039: ARM __arm__
1.1 dsieger 7040: MIPS __mips
7041: SPARC sparc, __sparc
1.223 nia 7042: PowerPC __powerpc
1.1 dsieger 7043:
1.154 rillig 7044: 21.5.1.3. C preprocessor macros to identify the compiler
1.1 dsieger 7045:
7046: GCC __GNUC__ (major version), __GNUC_MINOR__
7047: MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41)
7048: SunPro __SUNPRO_C (0x570 for Sun C 5.7)
7049: SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8)
7050:
1.154 rillig 7051: 21.5.2. How to handle compiler bugs
1.1 dsieger 7052:
7053: Some source files trigger bugs in the compiler, based on combinations of
7054: compiler version and architecture and almost always relation to optimisation
7055: being enabled. Common symptoms are gcc internal errors or never finishing
7056: compiling a file.
7057:
7058: Typically, a workaround involves testing the MACHINE_ARCH and compiler version,
1.87 tnn 7059: disabling optimisation for that combination of file, MACHINE_ARCH and compiler.
7060:
7061: This used to be a big problem in the past, but is rarely needed now as compiler
7062: technology has matured. If you still need to add a compiler specific
7063: workaround, please do so in the file hacks.mk and describe the symptom and
7064: compiler version as detailed as possible.
1.1 dsieger 7065:
1.172 rillig 7066: 21.5.3. No such file or directory
7067:
7068: Compilation sometimes fails with an error message like this:
7069:
7070: .../x11/gtk3/work/gtk+-3.24.12/gdk/gdktypes.h:35:10:
7071: fatal error: pango/pango.h: No such file or directory
7072:
7073: The proper way to fix this problem depends on the type of the header, which is
7074: described in the following sections.
7075:
7076: 21.5.3.1. Headers from other packages
7077:
7078: If the header name looks like it comes from a different package, that other
7079: package should be included via the buildlink3 framework.
7080:
7081: First, look whether the header is somewhere in the buildlink3 directory below
7082: WRKDIR. In the above case of the missing Pango header:
7083:
7084: $ find work/.buildlink/ -print | grep -F pango/pango.h
7085:
7086: In the case of Pango, the output is:
7087:
7088: work/.buildlink/include/pango-1.0/pango/pango.h
7089:
7090: If the pango/pango.h file were placed directly in the .buildlink directory, it
7091: would have been found automatically. There is an extra pango-1.0 path component
7092: though, which means that the compiler command line must contain an option of
7093: the form -I${BUILDLINK3_PREFIX.pango}/include/pango-1.0. In most cases this
7094: option is generated by the configure script, which can be examined using:
7095:
7096: $ $ grep -o '[-]I[^[:space:]]*/pango[^[:space:]]*' work/*/Makefile
7097: -I/usr/pkg/include/pango-1.0
7098: -I/usr/pkg/include/pango-1.0
7099: -I/usr/pkg/include/pango-1.0
7100: -I/usr/pkg/include/pango-1.0
7101: -I/usr/pkg/include/pango-1.0
7102:
7103: This looks good. These options are transformed by the buildlink wrapper to
7104: refer to the correct path inside work/.buildlink.
7105:
7106: Since the compilation fails though, examine the compiler command lines in work
7107: /.work.log to see whether the -I option is included in the particular command
7108: line.
7109:
7110: To further analyze the situation, run bmake build-env, which sets up an
7111: interactive, realistic environment including all the pkgsrc wrapper commands
7112: and environment variables. From there, try to compile some simple example
7113: programs that use the header.
7114:
7115: 21.5.3.2. Headers generated during the build
7116:
7117: If the name of the header seems to come from the package itself, and if the
7118: build is run with parallel jobs, the package may have some undeclared
7119: dependencies between the .c and the .h files, and a C file is compiled before
7120: its required header is generated.
7121:
7122: To see whether the build runs with parallel jobs, run bmake show-all-build |
7123: grep JOBS. Its output looks like this:
7124:
7125: usr MAKE_JOBS= 7
7126: pkg MAKE_JOBS_SAFE # undefined
7127: def _MAKE_JOBS_N= 7
7128:
7129: In this case the pkgsrc user has asked pkgsrc to build packages with 7 jobs in
7130: parallel (MAKE_JOBS). The package could have disabled parallel builds by
7131: setting MAKE_JOBS_SAFE to no, but in this case it hasn't.
7132:
7133: To see whether the build failure is caused by parallel builds, first save the
7134: exact error message and a bit of context, maybe you need it later for reporting
7135: a bug. Next, run:
7136:
7137: MAKE_JOBS_SAFE=no bmake clean build
7138:
7139: If that succeeds, file a bug report against the pkgsrc package, including the
7140: exact error message and the contents of your mk.conf file.
7141:
1.173 rillig 7142: 21.5.3.3. Symlinks
7143:
7144: Pkgsrc does not work reliably if any of LOCALBASE, VARBASE or WRKDIR contains a
7145: symlink. Since 2019Q2, the pkgsrc bootstrap program prevents installing pkgsrc
7146: in symlink-based directories. Existing pkgsrc installations are not checked for
7147: symlinks though.
7148:
7149: The "No such file or directory" error messages are a typical symptom of
7150: symlinks, and it's quite difficult to find out that this is the actual cause.
7151:
7152: 21.5.3.4. Stale working directories
7153:
7154: When building a hierarchy of packages, it may happen that one package is built
7155: and then pkgsrc is updated. This situation can provoke various hard to diagnose
7156: build errors. To clean up the situation:
7157:
1.223 nia 7158: $ (cd ../../ && cat mk/bsd.pkg.mk >/dev/null && rm -rf */*/work)
1.173 rillig 7159:
1.223 nia 7160: (The only purpose of the bsd.pkg.mk is to prevent running this command in the
7161: wrong directory.)
1.173 rillig 7162:
7163: If you have set WRKOBJDIR in mk.conf, remove that directory as well.
7164:
7165: 21.5.3.5. Other possible reasons
7166:
7167: On platforms other than BSD, third-party packages are installed in /usr/
7168: include, together with the base system. This means that pkgsrc cannot
7169: distinguish between headers provided by the base system (which it needs) and
7170: headers from third-party packages (which are often included in pkgsrc as well).
7171: This can lead to subtle version mismatches.
7172:
7173: In pkgsrc installations that have been active for several years, it may happen
7174: that some files are manually deleted. To exclude this unlikely reason, run
7175: pkg_admin check.
7176:
7177: It may help to run pkg_admin rebuild-tree to check/fix dependencies.
7178:
7179: If all of the above doesn't help, see Chapter 2, Getting help for contact
7180: information. Be prepared to describe what you have tried so far and what any
7181: error messages were.
7182:
1.172 rillig 7183: 21.5.4. Undefined reference to "..."
1.1 dsieger 7184:
7185: This error message often means that a package did not link to a shared library
7186: it needs. The following functions are known to cause this error message over
7187: and over.
7188:
7189: +-----------------------------------------------------+
7190: | Function |Library |Affected platforms|
7191: |-------------------------+--------+------------------|
7192: |accept, bind, connect |-lsocket|Solaris |
7193: |-------------------------+--------+------------------|
7194: |crypt |-lcrypt |DragonFly, NetBSD |
7195: |-------------------------+--------+------------------|
7196: |dlopen, dlsym |-ldl |Linux |
7197: |-------------------------+--------+------------------|
7198: |gethost* |-lnsl |Solaris |
7199: |-------------------------+--------+------------------|
7200: |inet_aton |-lresolv|Solaris |
7201: |-------------------------+--------+------------------|
7202: |nanosleep, sem_*, timer_*|-lrt |Solaris |
7203: |-------------------------+--------+------------------|
7204: |openpty |-lutil |Linux |
7205: +-----------------------------------------------------+
7206:
1.223 nia 7207: To fix these linker errors, it is often sufficient to add LIBS.OperatingSystem+
7208: = -lfoo to the package Makefile and then run bmake clean; bmake.
1.1 dsieger 7209:
1.223 nia 7210: 21.5.4.1. The SunPro compiler and inline functions
1.1 dsieger 7211:
7212: When you are using the SunPro compiler, there is another possibility. That
7213: compiler cannot handle the following code:
7214:
7215: extern int extern_func(int);
7216:
7217: static inline int
7218: inline_func(int x)
7219: {
7220: return extern_func(x);
7221: }
7222:
7223: int main(void)
7224: {
7225: return 0;
7226: }
7227:
7228: It generates the code for inline_func even if that function is never used. This
7229: code then refers to extern_func, which can usually not be resolved. To solve
7230: this problem you can try to tell the package to disable inlining of functions.
7231:
1.228 gutterid 7232: 21.5.4.2. Missing atomic functions
7233:
7234: When building for older machine architectures (e.g., i386, PowerPC), builds may
7235: fail because the package expects modern 64-bit atomic functions which the
7236: underlying hardware either doesn't support, or will only support with specific
7237: compiler flags. This is generally handled via inclusion of mk/atomic64.mk.
7238:
1.172 rillig 7239: 21.5.5. Running out of memory
1.1 dsieger 7240:
7241: Sometimes packages fail to build because the compiler runs into an operating
7242: system specific soft limit. With the UNLIMIT_RESOURCES variable pkgsrc can be
1.223 nia 7243: told to unlimit the resources. The allowed values are any combination of "
7244: cputime", "datasize", "memorysize", "stacksize" and "virtualsize". Setting this
7245: variable is similar to running the shell builtin ulimit command to raise the
7246: maximum data segment size or maximum stack size of a process, respectively, to
7247: their hard limits.
1.1 dsieger 7248:
1.154 rillig 7249: 21.6. The install phase
1.1 dsieger 7250:
1.154 rillig 7251: 21.6.1. Creating needed directories
1.1 dsieger 7252:
7253: The BSD-compatible install supplied with some operating systems cannot create
7254: more than one directory at a time. As such, you should call ${INSTALL_*_DIR}
7255: like this:
7256:
7257: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
7258: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
7259:
1.223 nia 7260: Instead of running the install commands directly, you can also append "dir1
7261: dir2" to the INSTALLATION_DIRS variable, which will automatically do the right
7262: thing.
1.1 dsieger 7263:
1.154 rillig 7264: 21.6.2. Where to install documentation
1.1 dsieger 7265:
7266: In general, documentation should be installed into ${PREFIX}/share/doc/$
1.223 nia 7267: {PKGBASE} or ${PREFIX}/share/doc/${PKGNAME_NOREV} (the latter includes the
7268: version number of the package).
1.1 dsieger 7269:
7270: Many modern packages using GNU autoconf allow to set the directory where HTML
7271: documentation is installed with the "--with-html-dir" option. Sometimes using
7272: this flag is needed because otherwise the documentation ends up in ${PREFIX}/
1.223 nia 7273: share/doc/html or other places. In pkgsrc, the HTML documentation should go
7274: into the package-specific directory, just like any other documentation.
1.1 dsieger 7275:
7276: An exception to the above is that library API documentation generated with the
7277: textproc/gtk-doc tools, for use by special browsers (devhelp) should be left at
7278: their default location, which is ${PREFIX}/share/gtk-doc. Such documentation
7279: can be recognized from files ending in .devhelp or .devhelp2. (It is also
7280: acceptable to install such files in ${PREFIX}/share/doc/${PKGBASE} or ${PREFIX}
7281: /share/doc/${PKGNAME}; the .devhelp* file must be directly in that directory
7282: then, no additional subdirectory level is allowed in this case. This is usually
7283: achieved by using "--with-html-dir=${PREFIX}/share/doc". ${PREFIX}/share/
7284: gtk-doc is preferred though.)
7285:
1.154 rillig 7286: 21.6.3. Installing highscore files
1.1 dsieger 7287:
7288: Certain packages, most of them in the games category, install a score file that
7289: allows all users on the system to record their highscores. In order for this to
7290: work, the binaries need to be installed setgid and the score files owned by the
1.36 wiz 7291: appropriate group and/or owner (traditionally the "games" user/group). Set
7292: USE_GAMESGROUP to yes to support this. The following variables, documented in
7293: more detail in mk/defaults/mk.conf, control this behaviour: GAMEDATAMODE,
1.100 leot 7294: GAMEDIRMODE, GAMES_GROUP, GAMEMODE, GAME_USER. Other useful variables are:
7295: GAMEDIR_PERMS, GAMEDATA_PERMS and SETGID_GAMES_PERMS.
7296:
7297: An example that illustrates some of the variables described above is games/
7298: moon-buggy. OWN_DIRS_PERMS is used to properly set directory permissions of the
7299: directory where the scorefile is saved, REQD_FILES_PERMS is used to create a
7300: dummy scorefile (mbscore) with the proper permissions and SPECIAL_PERMS is used
7301: to install setgid the game binary:
7302:
7303: USE_GAMESGROUP= yes
7304:
7305: BUILD_DEFS+= VARBASE
7306:
7307: OWN_DIRS_PERMS+= ${VARBASE}/games/moon-buggy ${GAMEDIR_PERMS}
7308: REQD_FILES_PERMS+= /dev/null ${VARBASE}/games/moon-buggy/mbscore ${GAMEDATA_PERMS}
7309: SPECIAL_PERMS+= ${PREFIX}/bin/moon-buggy ${SETGID_GAMES_PERMS}
7310:
7311: Various INSTALL_* variables are also available: INSTALL_GAME to install setgid
7312: game binaries, INSTALL_GAME_DIR to install game directories that are needed to
7313: be accessed by setgid games and INSTALL_GAME_DATA to install scorefiles.
1.1 dsieger 7314:
1.14 jmcneill 7315: A package should therefore never hard code file ownership or access permissions
1.100 leot 7316: but rely on *_PERMS as described above or alternatively on INSTALL_GAME,
7317: INSTALL_GAME_DATA and INSTALL_GAME_DIR to set these correctly.
1.1 dsieger 7318:
1.154 rillig 7319: 21.6.4. Adding DESTDIR support to packages
1.4 rillig 7320:
1.14 jmcneill 7321: DESTDIR support means that a package installs into a staging directory, not the
7322: final location of the files. Then a binary package is created which can be used
7323: for installation as usual. There are two ways: Either the package must install
1.25 wiz 7324: as root ("destdir") or the package can install as non-root user ("user-destdir"
7325: ).
1.14 jmcneill 7326:
1.113 leot 7327: * PKG_DESTDIR_SUPPORT has to be set to "destdir" or "user-destdir". By
7328: default PKG_DESTDIR_SUPPORT is set to "user-destdir" to help catching more
7329: potential packaging problems. If bsd.prefs.mk is included in the Makefile,
7330: PKG_DESTDIR_SUPPORT needs to be set before the inclusion.
1.14 jmcneill 7331:
1.4 rillig 7332: * All installation operations have to be prefixed with ${DESTDIR}.
7333:
7334: * automake gets this DESTDIR mostly right automatically. Many manual rules
7335: and pre/post-install often are incorrect; fix them.
7336:
1.17 imil 7337: * If files are installed with special owner/group use SPECIAL_PERMS.
1.4 rillig 7338:
7339: * In general, packages should support UNPRIVILEGED to be able to use DESTDIR.
7340:
1.154 rillig 7341: 21.6.5. Packages with hardcoded paths to other interpreters
1.1 dsieger 7342:
7343: Your package may also contain scripts with hardcoded paths to other
1.203 nia 7344: interpreters besides (or as well as) Perl. To correct the full pathname to the
1.1 dsieger 7345: script interpreter, you need to set the following definitions in your Makefile
7346: (we shall use tclsh in this example):
7347:
7348: REPLACE_INTERPRETER+= tcl
7349: REPLACE.tcl.old= .*/bin/tclsh
7350: REPLACE.tcl.new= ${PREFIX}/bin/tclsh
7351: REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
7352: # relative to ${WRKSRC}, just as in REPLACE_PERL
7353:
1.203 nia 7354: 21.6.6. Packages installing Perl modules
1.1 dsieger 7355:
7356: Makefiles of packages providing perl5 modules should include the Makefile
7357: fragment ../../lang/perl5/module.mk. It provides a do-configure target for the
7358: standard perl configuration for such modules as well as various hooks to tune
7359: this configuration. See comments in this file for details.
7360:
7361: Perl5 modules will install into different places depending on the version of
7362: perl used during the build process. To address this, pkgsrc will append lines
7363: to the PLIST corresponding to the files listed in the installed .packlist file
7364: generated by most perl5 modules. This is invoked by defining PERL5_PACKLIST to
1.48 wiz 7365: a space-separated list of packlist files relative to PERL5_PACKLIST_DIR
7366: (PERL5_INSTALLVENDORARCH by default), e.g.:
1.1 dsieger 7367:
1.48 wiz 7368: PERL5_PACKLIST= auto/Pg/.packlist
1.1 dsieger 7369:
1.48 wiz 7370: The perl5 config variables installarchlib, installscript, installvendorbin,
7371: installvendorscript, installvendorarch, installvendorlib, installvendorman1dir,
7372: and installvendorman3dir represent those locations in which components of perl5
7373: modules may be installed, provided as variable with uppercase and prefixed with
7374: PERL5_, e.g. PERL5_INSTALLARCHLIB and may be used by perl5 packages that don't
7375: have a packlist. These variables are also substituted for in the PLIST as
7376: uppercase prefixed with PERL5_SUB_.
1.1 dsieger 7377:
1.154 rillig 7378: 21.6.7. Packages installing info files
1.1 dsieger 7379:
7380: Some packages install info files or use the "makeinfo" or "install-info"
7381: commands. INFO_FILES should be defined in the package Makefile so that INSTALL
7382: and DEINSTALL scripts will be generated to handle registration of the info
7383: files in the Info directory file. The "install-info" command used for the info
7384: files registration is either provided by the system, or by a special purpose
7385: package automatically added as dependency if needed.
7386:
7387: PKGINFODIR is the directory under ${PREFIX} where info files are primarily
7388: located. PKGINFODIR defaults to "info" and can be overridden by the user.
7389:
7390: The info files for the package should be listed in the package PLIST; however
7391: any split info files need not be listed.
7392:
7393: A package which needs the "makeinfo" command at build time must add "makeinfo"
7394: to USE_TOOLS in its Makefile. If a minimum version of the "makeinfo" command is
7395: needed it should be noted with the TEXINFO_REQD variable in the package
7396: Makefile. By default, a minimum version of 3.12 is required. If the system does
7397: not provide a makeinfo command or if it does not match the required minimum, a
7398: build dependency on the devel/gtexinfo package will be added automatically.
7399:
7400: The build and installation process of the software provided by the package
7401: should not use the install-info command as the registration of info files is
1.25 wiz 7402: the task of the package INSTALL script, and it must use the appropriate
1.1 dsieger 7403: makeinfo command.
7404:
7405: To achieve this goal, the pkgsrc infrastructure creates overriding scripts for
7406: the install-info and makeinfo commands in a directory listed early in PATH.
7407:
7408: The script overriding install-info has no effect except the logging of a
7409: message. The script overriding makeinfo logs a message and according to the
7410: value of TEXINFO_REQD either runs the appropriate makeinfo command or exit on
7411: error.
7412:
1.154 rillig 7413: 21.6.8. Packages installing man pages
1.1 dsieger 7414:
7415: All packages that install manual pages should install them into the same
7416: directory, so that there is one common place to look for them. In pkgsrc, this
7417: place is ${PREFIX}/${PKGMANDIR}, and this expression should be used in
1.25 wiz 7418: packages. The default for PKGMANDIR is "man". Another often-used value is "
7419: share/man".
1.1 dsieger 7420:
7421: Note
7422:
7423: The support for a custom PKGMANDIR is far from complete.
7424:
7425: The PLIST files can just use man/ as the top level directory for the man page
7426: file entries, and the pkgsrc framework will convert as needed. In all other
7427: places, the correct PKGMANDIR must be used.
7428:
7429: Packages that are configured with GNU_CONFIGURE set as "yes", by default will
7430: use the ./configure --mandir switch to set where the man pages should be
7431: installed. The path is GNU_CONFIGURE_MANDIR which defaults to ${PREFIX}/$
7432: {PKGMANDIR}.
7433:
7434: Packages that use GNU_CONFIGURE but do not use --mandir, can set
7435: CONFIGURE_HAS_MANDIR to "no". Or if the ./configure script uses a non-standard
7436: use of --mandir, you can set GNU_CONFIGURE_MANDIR as needed.
7437:
1.184 rillig 7438: See Section 19.5, "Man page compression" for information on installation of
1.1 dsieger 7439: compressed manual pages.
7440:
1.203 nia 7441: 21.6.9. Packages installing X11 fonts
1.1 dsieger 7442:
7443: If a package installs font files, you will need to rebuild the fonts database
7444: in the directory where they get installed at installation and deinstallation
7445: time. This can be automatically done by using the pkginstall framework.
7446:
7447: You can list the directories where fonts are installed in the FONTS_DIRS.type
7448: variables, where type can be one of "ttf", "type1" or "x11". Also make sure
7449: that the database file fonts.dir is not listed in the PLIST.
7450:
7451: Note that you should not create new directories for fonts; instead use the
7452: standard ones to avoid that the user needs to manually configure his X server
7453: to find them.
7454:
1.203 nia 7455: 21.6.10. Packages installing SGML or XML data
1.1 dsieger 7456:
7457: If a package installs SGML or XML data files that need to be registered in
7458: system-wide catalogs (like DTDs, sub-catalogs, etc.), you need to take some
7459: extra steps:
7460:
7461: 1. Include ../../textproc/xmlcatmgr/catalogs.mk in your Makefile, which takes
7462: care of registering those files in system-wide catalogs at installation and
7463: deinstallation time.
7464:
7465: 2. Set SGML_CATALOGS to the full path of any SGML catalogs installed by the
7466: package.
7467:
7468: 3. Set XML_CATALOGS to the full path of any XML catalogs installed by the
7469: package.
7470:
7471: 4. Set SGML_ENTRIES to individual entries to be added to the SGML catalog.
7472: These come in groups of three strings; see xmlcatmgr(1) for more
7473: information (specifically, arguments recognized by the 'add' action). Note
7474: that you will normally not use this variable.
7475:
7476: 5. Set XML_ENTRIES to individual entries to be added to the XML catalog. These
7477: come in groups of three strings; see xmlcatmgr(1) for more information
7478: (specifically, arguments recognized by the 'add' action). Note that you
7479: will normally not use this variable.
7480:
1.203 nia 7481: 21.6.11. Packages installing extensions to the MIME database
1.1 dsieger 7482:
7483: If a package provides extensions to the MIME database by installing .xml files
7484: inside ${PREFIX}/share/mime/packages, you need to take some extra steps to
7485: ensure that the database is kept consistent with respect to these new files:
7486:
7487: 1. Include ../../databases/shared-mime-info/mimedb.mk (avoid using the
7488: buildlink3.mk file from this same directory, which is reserved for
7489: inclusion from other buildlink3.mk files). It takes care of rebuilding the
7490: MIME database at installation and deinstallation time, and disallows any
7491: access to it directly from the package.
7492:
1.25 wiz 7493: 2. Check the PLIST and remove any entries under the share/mime directory,
1.1 dsieger 7494: except for files saved under share/mime/packages. The former are handled
7495: automatically by the update-mime-database program, but the latter are
7496: package-dependent and must be removed by the package that installed them in
7497: the first place.
7498:
7499: 3. Remove any share/mime/* directories from the PLIST. They will be handled by
7500: the shared-mime-info package.
7501:
1.203 nia 7502: 21.6.12. Packages using intltool
1.1 dsieger 7503:
7504: If a package uses intltool during its build, add intltool to the USE_TOOLS,
7505: which forces it to use the intltool package provided by pkgsrc, instead of the
7506: one bundled with the distribution file.
7507:
7508: This tracks intltool's build-time dependencies and uses the latest available
7509: version; this way, the package benefits of any bug fixes that may have appeared
7510: since it was released.
7511:
1.203 nia 7512: 21.6.13. Packages installing startup scripts
1.1 dsieger 7513:
7514: If a package contains a rc.d script, it won't be copied into the startup
7515: directory by default, but you can enable it, by adding the option
1.4 rillig 7516: PKG_RCD_SCRIPTS=YES in mk.conf. This option will copy the scripts into /etc/
7517: rc.d when a package is installed, and it will automatically remove the scripts
7518: when the package is deinstalled.
1.1 dsieger 7519:
1.203 nia 7520: 21.6.14. Packages installing TeX modules
1.1 dsieger 7521:
7522: If a package installs TeX packages into the texmf tree, the ls-R database of
7523: the tree needs to be updated.
7524:
7525: Note
7526:
1.23 jakllsch 7527: Except the main TeX packages such as kpathsea, packages should install files
7528: into ${PREFIX}/share/texmf-dist, not ${PREFIX}/share/texmf.
1.1 dsieger 7529:
1.23 jakllsch 7530: 1. Include ../../print/kpathsea/texmf.mk. This takes care of rebuilding the
7531: ls-R database at installation and deinstallation time.
1.1 dsieger 7532:
1.23 jakllsch 7533: 2. If your package installs files into a texmf tree other than the one at $
7534: {PREFIX}/share/texmf-dist, set TEX_TEXMF_DIRS to the list of all texmf
7535: trees that need database update.
1.1 dsieger 7536:
7537: If your package also installs font map files that need to be registered
1.30 dholland 7538: using updmap, include ../../print/tex-tetex/map.mk and set TEX_MAP_FILES
7539: and/or TEX_MIXEDMAP_FILES to the list of all such font map files. Then
7540: updmap will be run automatically at installation/deinstallation to enable/
7541: disable font map files for TeX output drivers.
1.1 dsieger 7542:
7543: 3. Make sure that none of ls-R databases are included in PLIST, as they will
1.30 dholland 7544: be removed only by the kpathsea package.
1.1 dsieger 7545:
1.203 nia 7546: 21.6.15. Packages supporting running binaries in emulation
1.1 dsieger 7547:
7548: There are some packages that provide libraries and executables for running
7549: binaries from a one operating system on a different one (if the latter supports
7550: it). One example is running Linux binaries on NetBSD.
7551:
7552: The pkgtools/rpm2pkg helps in extracting and packaging Linux rpm packages.
7553:
7554: The CHECK_SHLIBS can be set to no to avoid the check-shlibs target, which tests
7555: if all libraries for each installed executable can be found by the dynamic
7556: linker. Since the standard dynamic linker is run, this fails for emulation
7557: packages, because the libraries used by the emulation are not in the standard
7558: directories.
7559:
1.203 nia 7560: 21.6.16. Packages installing hicolor icons
1.1 dsieger 7561:
7562: If a package installs images under the share/icons/hicolor and/or updates the
7563: share/icons/hicolor/icon-theme.cache database, you need to take some extra
7564: steps to make sure that the shared theme directory is handled appropriately and
7565: that the cache database is rebuilt:
7566:
7567: 1. Include ../../graphics/hicolor-icon-theme/buildlink3.mk.
7568:
7569: 2. Check the PLIST and remove the entry that refers to the theme cache.
7570:
7571: 3. Ensure that the PLIST does not remove the shared icon directories from the
7572: share/icons/hicolor hierarchy because they will be handled automatically.
7573:
7574: The best way to verify that the PLIST is correct with respect to the last two
7575: points is to regenerate it using make print-PLIST.
7576:
1.203 nia 7577: 21.6.17. Packages installing desktop files
1.1 dsieger 7578:
7579: If a package installs .desktop files under share/applications and these include
1.54 rodent 7580: MIME information (MimeType key), you need to take extra steps to ensure that
7581: they are registered into the MIME database:
1.1 dsieger 7582:
7583: 1. Include ../../sysutils/desktop-file-utils/desktopdb.mk.
7584:
7585: 2. Check the PLIST and remove the entry that refers to the share/applications/
7586: mimeinfo.cache file. It will be handled automatically.
7587:
7588: The best way to verify that the PLIST is correct with respect to the last point
7589: is to regenerate it using make print-PLIST.
7590:
1.154 rillig 7591: 21.7. Marking packages as having problems
1.1 dsieger 7592:
1.23 jakllsch 7593: In some cases one does not have the time to solve a problem immediately. In
7594: this case, one can plainly mark a package as broken. For this, one just sets
7595: the variable BROKEN to the reason why the package is broken (similar to the
1.162 rillig 7596: PKG_FAIL_REASON variable). A user trying to build the package will immediately
7597: be shown this message, and the build will not be even tried.
1.1 dsieger 7598:
1.23 jakllsch 7599: BROKEN packages are removed from pkgsrc in irregular intervals.
1.1 dsieger 7600:
1.184 rillig 7601: Chapter 22. GNOME packaging and porting
7602:
7603: Table of Contents
7604:
7605: 22.1. Meta packages
7606: 22.2. Packaging a GNOME application
7607: 22.3. Updating GNOME to a newer version
7608: 22.4. Patching guidelines
7609:
7610: Quoting GNOME's web site:
7611:
7612: The GNOME project provides two things: The GNOME desktop environment, an
7613: intuitive and attractive desktop for users, and the GNOME development
7614: platform, an extensive framework for building applications that integrate
7615: into the rest of the desktop.
7616:
7617: pkgsrc provides a seamless way to automatically build and install a complete
7618: GNOME environment under many different platforms. We can say with confidence
7619: that pkgsrc is one of the most advanced build and packaging systems for GNOME
7620: due to its included technologies buildlink3, the wrappers and tools framework
7621: and automatic configuration file management. Lots of efforts are put into
7622: achieving a completely clean deinstallation of installed software components.
7623:
7624: Given that pkgsrc is NetBSD's official packaging system, the above also means
7625: that great efforts are put into making GNOME work under this operating system.
7626:
7627: This chapter is aimed at pkgsrc developers and other people interested in
7628: helping our GNOME porting and packaging efforts. It provides instructions on
7629: how to manage the existing packages and some important information regarding
7630: their internals.
7631:
7632: 22.1. Meta packages
7633:
7634: pkgsrc includes three GNOME-related meta packages:
7635:
7636: * meta-pkgs/gnome-base: Provides the core GNOME desktop environment. It only
7637: includes the necessary bits to get it to boot correctly, although it may
7638: lack important functionality for daily operation. The idea behind this
7639: package is to let end users build their own configurations on top of this
7640: one, first installing this meta package to achieve a functional setup and
7641: then adding individual applications.
7642:
7643: * meta-pkgs/gnome: Provides a complete installation of the GNOME platform and
7644: desktop as defined by the GNOME project; this is based on the components
7645: distributed in the platform/x.y/x.y.z/sources and desktop/x.y/x.y.z/sources
7646: directories of the official FTP server. Developer-only tools found in those
7647: directories are not installed unless required by some other component to
7648: work properly. Similarly, packages from the bindings set (bindings/x.y/
7649: x.y.z/sources) are not pulled in unless required as a dependency for an
7650: end-user component. This package "extends" meta-pkgs/gnome-base.
7651:
7652: * meta-pkgs/gnome-devel: Installs all the tools required to build a GNOME
7653: component when fetched from the CVS repository. These are required to let
7654: the autogen.sh scripts work appropriately.
7655:
7656: In all these packages, the DEPENDS lines are sorted in a way that eases
7657: updates: a package may depend on other packages listed before it but not on any
7658: listed after it. It is very important to keep this order to ease updates so...
7659: do not change it to alphabetical sorting!
7660:
7661: 22.2. Packaging a GNOME application
7662:
7663: Almost all GNOME applications are written in C and use a common set of tools as
7664: their build system. Things get different with the new bindings to other
7665: languages (such as Python), but the following will give you a general idea on
7666: the minimum required tools:
7667:
7668: * Almost all GNOME applications use the GNU Autotools as their build system.
7669: As a general rule you will need to tell this to your package:
7670:
1.223 nia 7671: GNU_CONFIGURE= yes
7672: USE_LIBTOOL= yes
7673: USE_TOOLS+= gmake
1.184 rillig 7674:
7675: * If the package uses pkg-config to detect dependencies, add this tool to the
7676: list of required utilities:
7677:
1.223 nia 7678: USE_TOOLS+= pkg-config
1.184 rillig 7679:
7680: Also use pkgtools/verifypc at the end of the build process to ensure that
7681: you did not miss to specify any dependency in your package and that the
7682: version requirements are all correct.
7683:
7684: * If the package uses intltool, be sure to add intltool to the USE_TOOLS to
7685: handle dependencies and to force the package to use the latest available
7686: version.
7687:
7688: * If the package uses gtk-doc (a documentation generation utility), do not
7689: add a dependency on it. The tool is rather big and the distfile should come
7690: with pregenerated documentation anyway; if it does not, it is a bug that
7691: you ought to report. For such packages you should disable gtk-doc (unless
7692: it is the default):
7693:
1.223 nia 7694: CONFIGURE_ARGS+= --disable-gtk-doc
1.184 rillig 7695:
7696: The default location of installed HTML files (share/gtk-doc/<package-name>)
7697: is correct and should not be changed unless the package insists on
7698: installing them somewhere else. Otherwise programs as devhelp will not be
7699: able to open them. You can do that with an entry similar to:
1.1 dsieger 7700:
1.223 nia 7701: CONFIGURE_ARGS+= --with-html-dir=${PREFIX}/share/gtk-doc/...
1.1 dsieger 7702:
1.184 rillig 7703: GNOME uses multiple shared directories and files under the installation prefix
7704: to maintain databases. In this context, shared means that those exact same
7705: directories and files are used among several different packages, leading to
7706: conflicts in the PLIST. pkgsrc currently includes functionality to handle the
7707: most common cases, so you have to forget about using @unexec ${RMDIR} lines in
7708: your file lists and omitting shared files from them. If you find yourself doing
7709: those, your package is most likely incorrect.
1.1 dsieger 7710:
1.184 rillig 7711: The following table lists the common situations that result in using shared
7712: directories or files. For each of them, the appropriate solution is given.
7713: After applying the solution be sure to regenerate the package's file list with
7714: make print-PLIST and ensure it is correct.
1.1 dsieger 7715:
1.184 rillig 7716: Table 22.1. PLIST handling for GNOME packages
1.1 dsieger 7717:
1.184 rillig 7718: +-----------------------------------------------------------------------------+
7719: | If the package... | Then... |
7720: |-------------------------------------------+---------------------------------|
1.203 nia 7721: |Installs icons under the share/icons/ |See Section 21.6.16, "Packages |
7722: |hicolor hierarchy or updates share/icons/ |installing hicolor icons". |
1.184 rillig 7723: |hicolor/icon-theme.cache. | |
7724: |-------------------------------------------+---------------------------------|
1.203 nia 7725: | |See Section 21.6.11, "Packages |
1.184 rillig 7726: |Installs files under share/mime/packages. |installing extensions to the MIME|
7727: | |database". |
7728: |-------------------------------------------+---------------------------------|
1.203 nia 7729: |Installs .desktop files under share/ |See Section 21.6.17, "Packages |
1.184 rillig 7730: |applications and these include MIME |installing desktop files". |
7731: |information. | |
7732: +-----------------------------------------------------------------------------+
1.1 dsieger 7733:
7734:
1.184 rillig 7735: 22.3. Updating GNOME to a newer version
1.1 dsieger 7736:
1.184 rillig 7737: When seeing GNOME as a whole, there are two kinds of updates:
1.1 dsieger 7738:
1.184 rillig 7739: Major update
1.1 dsieger 7740:
1.184 rillig 7741: Given that there is still a very long way for GNOME 3 (if it ever appears),
7742: we consider a major update one that goes from a 2.X version to a 2.Y one,
7743: where Y is even and greater than X. These are hard to achieve because they
7744: introduce lots of changes in the components' code and almost all GNOME
7745: distfiles are updated to newer versions. Some of them can even break API
7746: and ABI compatibility with the previous major version series. As a result,
7747: the update needs to be done all at once to minimize breakage.
1.1 dsieger 7748:
1.184 rillig 7749: A major update typically consists of around 80 package updates and the
7750: addition of some new ones.
1.1 dsieger 7751:
1.184 rillig 7752: Minor update
1.1 dsieger 7753:
1.184 rillig 7754: We consider a minor update one that goes from a 2.A.X version to a 2.A.Y
7755: one where Y is greater than X. These are easy to achieve because they do
7756: not update all GNOME components, can be done in an incremental way and do
7757: not break API nor ABI compatibility.
1.1 dsieger 7758:
1.184 rillig 7759: A minor update typically consists of around 50 package updates, although
7760: the numbers here may vary a lot.
1.1 dsieger 7761:
1.184 rillig 7762: In order to update the GNOME components in pkgsrc to a new stable release
7763: (either major or minor), the following steps should be followed:
1.1 dsieger 7764:
1.184 rillig 7765: 1. Get a list of all the tarballs that form the new release by using the
7766: following commands. These will leave the full list of the components'
7767: distfiles into the list.txt file:
1.1 dsieger 7768:
1.184 rillig 7769: % echo ls "*.tar.bz2" | \
7770: ftp -V ftp://ftp.gnome.org/pub/gnome/platform/x.y/x.y.z/sources/ | \
7771: awk '{ print $9 }' >list.txt
7772: % echo ls "*.tar.bz2" | \
7773: ftp -V ftp://ftp.gnome.org/pub/gnome/desktop/x.y/x.y.z/sources/ | \
7774: awk '{ print $9 }' >>list.txt
1.1 dsieger 7775:
1.184 rillig 7776: 2. Open each meta package's Makefile and bump their version to the release you
7777: are updating them to. The three meta packages should be always consistent
7778: with versioning. Obviously remove any PKGREVISIONs that might be in them.
1.1 dsieger 7779:
1.184 rillig 7780: 3. For each meta package, update all its DEPENDS lines to match the latest
7781: versions as shown by the above commands. Do not list any newer version
7782: (even if found in the FTP) because the meta packages are supposed to list
7783: the exact versions that form a specific GNOME release. Exceptions are
7784: permitted here if a newer version solves a serious issue in the overall
7785: desktop experience; these typically come in the form of a revision bump in
7786: pkgsrc, not in newer versions from the developers.
1.1 dsieger 7787:
1.184 rillig 7788: Packages not listed in the list.txt file should be updated to the latest
7789: version available (if found in pkgsrc). This is the case, for example, of
7790: the dependencies on the GNU Autotools in the meta-pkgs/gnome-devel meta
7791: package.
1.1 dsieger 7792:
1.184 rillig 7793: 4. Generate a patch from the modified meta packages and extract the list of
7794: "new" lines. This will provide you an outline on what packages need to be
7795: updated in pkgsrc and in what order:
1.1 dsieger 7796:
1.184 rillig 7797: % cvs diff -u gnome-devel gnome-base gnome | grep '^+D' >todo.txt
1.1 dsieger 7798:
1.184 rillig 7799: 5. For major desktop updates it is recommended to zap all your installed
7800: packages and start over from scratch at this point.
1.1 dsieger 7801:
1.184 rillig 7802: 6. Now comes the longest step by far: iterate over the contents of todo.txt
7803: and update the packages listed in it in order. For major desktop updates
7804: none of these should be committed until the entire set is completed because
7805: there are chances of breaking not-yet-updated packages.
1.1 dsieger 7806:
1.184 rillig 7807: 7. Once the packages are up to date and working, commit them to the tree one
7808: by one with appropriate log messages. At the end, commit the three meta
7809: package updates and all the corresponding changes to the doc/CHANGES-<YEAR>
7810: and pkgsrc/doc/TODO files.
1.1 dsieger 7811:
1.184 rillig 7812: 22.4. Patching guidelines
1.1 dsieger 7813:
1.184 rillig 7814: GNOME is a very big component in pkgsrc which approaches 100 packages. Please,
7815: it is very important that you always, always, always feed back any portability
7816: fixes you do to a GNOME package to the mainstream developers (see
7817: Section 12.3.5, "Feedback to the author"). This is the only way to get their
7818: attention on portability issues and to ensure that future versions can be built
7819: out-of-the box on NetBSD. The less custom patches in pkgsrc, the easier further
7820: updates are. Those developers in charge of issuing major GNOME updates will be
7821: grateful if you do that.
1.1 dsieger 7822:
1.200 cirnatda 7823: The most common places to report bugs are the GNOME's GitLab and the
7824: freedesktop.org's GitLab. Not all components use these to track bugs, but most
7825: of them do. Do not be short on your reports: always provide detailed
1.184 rillig 7826: explanations of the current failure, how it can be improved to achieve maximum
1.200 cirnatda 7827: portability and, if at all possible, provide a patch against the main Git
7828: branch. The more verbose you are, the higher chances of your patch being
7829: accepted.
1.1 dsieger 7830:
1.184 rillig 7831: Also, please avoid using preprocessor magic to fix portability issues. While
7832: the FreeBSD GNOME people are doing a great job in porting GNOME to their
7833: operating system, the official GNOME sources are now plagued by conditionals
7834: that check for __FreeBSD__ and similar macros. This hurts portability. Please
7835: see our patching guidelines (Section 12.3.4, "Patching guidelines") for more
7836: details.
1.1 dsieger 7837:
1.154 rillig 7838: Chapter 23. Submitting and Committing
1.1 dsieger 7839:
7840: Table of Contents
7841:
1.154 rillig 7842: 23.1. Submitting binary packages
7843: 23.2. Submitting source packages (for non-NetBSD-developers)
7844: 23.3. General notes when adding, updating, or removing packages
7845: 23.4. Commit Messages
7846: 23.5. Committing: Adding a package to CVS
7847: 23.6. Updating a package to a newer version
7848: 23.7. Renaming a package in pkgsrc
7849: 23.8. Moving a package in pkgsrc
1.1 dsieger 7850:
1.154 rillig 7851: 23.1. Submitting binary packages
1.1 dsieger 7852:
7853: Our policy is that we accept binaries only from pkgsrc developers to guarantee
7854: that the packages don't contain any trojan horses etc. This is not to annoy
7855: anyone but rather to protect our users! You're still free to put up your
7856: home-made binary packages and tell the world where to get them. NetBSD
1.154 rillig 7857: developers doing bulk builds and wanting to upload them please see Chapter 8,
1.66 asau 7858: Creating binary packages for everything in pkgsrc (bulk builds).
1.1 dsieger 7859:
1.154 rillig 7860: 23.2. Submitting source packages (for non-NetBSD-developers)
1.1 dsieger 7861:
1.218 nia 7862: Firstly, you can import new packages into pkgsrc-wip ("pkgsrc work-in-progress"
7863: ); see the homepage at https://pkgsrc.org/wip/ for details.
7864:
7865: Next, check that your package is complete, compiles and runs well; see
1.184 rillig 7866: Chapter 14, Creating a new pkgsrc package from scratch and the rest of this
1.218 nia 7867: document. Run the pkgtools/pkglint tool and fix any errors that appear.
7868:
7869: Finally, send a report to the pkgsrc bug tracking system, either with the
7870: send-pr(1) command, or if you don't have that, go to the web page https://
7871: www.NetBSD.org/support/send-pr.html, which contains some instructions and a
7872: link to a form where you can submit packages. The sysutils/gtk-send-pr package
7873: is also available as a substitute for either of the above two tools.
1.1 dsieger 7874:
7875: In the form of the problem report, the category should be "pkg", the synopsis
7876: should include the package name and version number, and the description field
7877: should contain a short description of your package (contents of the COMMENT
1.218 nia 7878: variable or DESCR file are OK).
1.1 dsieger 7879:
1.154 rillig 7880: 23.3. General notes when adding, updating, or removing packages
1.1 dsieger 7881:
7882: Please note all package additions, updates, moves, and removals in pkgsrc/doc/
7883: CHANGES-YYYY. It's very important to keep this file up to date and conforming
7884: to the existing format, because it will be used by scripts to automatically
7885: update pages on www.NetBSD.org and other sites. Additionally, check the pkgsrc/
7886: doc/TODO file and remove the entry for the package you updated or removed, in
7887: case it was mentioned there.
7888:
7889: When the PKGREVISION of a package is bumped, the change should appear in pkgsrc
7890: /doc/CHANGES-YYYY if it is security related or otherwise relevant. Mass bumps
7891: that result from a dependency being updated should not be mentioned. In all
7892: other cases it's the developer's decision.
7893:
7894: There is a make target that helps in creating proper CHANGES-YYYY entries: make
7895: changes-entry. It uses the optional CTYPE and NETBSD_LOGIN_NAME variables. The
7896: general usage is to first make sure that your CHANGES-YYYY file is up-to-date
7897: (to avoid having to resolve conflicts later-on) and then to cd to the package
7898: directory. For package updates, make changes-entry is enough. For new packages,
7899: or package moves or removals, set the CTYPE variable on the command line to
1.4 rillig 7900: "Added", "Moved", or "Removed". You can set NETBSD_LOGIN_NAME in mk.conf if
1.23 jakllsch 7901: your local login name is not the same as your NetBSD login name. The target
7902: also automatically removes possibly existing entries for the package in the
7903: TODO file. Don't forget to commit the changes, e.g. by using make
1.66 asau 7904: commit-changes-entry! If you are not using a checkout directly from
1.23 jakllsch 7905: cvs.NetBSD.org, but e.g. a local copy of the repository, you can set
7906: USE_NETBSD_REPO=yes. This makes the cvs commands use the main repository.
1.1 dsieger 7907:
1.154 rillig 7908: 23.4. Commit Messages
1.130 wiz 7909:
7910: For several years, there have been mirrors of pkgsrc in fossil, git, and hg.
7911: Standard practise when using these tools is to make the first line of a commit
7912: message function as a summary that can be read without the rest, such as is
7913: commonly done with "git log --oneline". For this reason, we have the following
7914: guidelines for pkgsrc commit messages:
7915:
1.131 wiz 7916: * Start the commit message with a line that explains the big picture in 65
1.130 wiz 7917: characters or less. When a commit is for one package, include the name of
7918: the package. For updates, include the version to which it is updated.
7919:
7920: * Leave the next line empty.
7921:
7922: * Then come the details for the commit (changes in that package, reason for a
7923: change) and any relevant PRs. Wrap this section.
7924:
7925: Here is an example:
7926:
1.238 wiz 7927: libxslt: update to 1.0.30
1.130 wiz 7928:
1.238 wiz 7929: Changes since 1.0.29:
7930: ...
1.130 wiz 7931:
7932: Here is another example:
7933:
1.238 wiz 7934: mk/bsd.pkg.mk: enable SSP by default on NetBSD
1.130 wiz 7935:
1.238 wiz 7936: (rationale)
1.130 wiz 7937:
7938: Commit messages are final: no "cvs admin" is allowed on the pkgsrc repository
7939: to change commit messages.
7940:
1.154 rillig 7941: 23.5. Committing: Adding a package to CVS
1.1 dsieger 7942:
7943: This section is only of interest for pkgsrc developers with write access to the
1.34 wiz 7944: pkgsrc repository.
7945:
7946: When the package is finished, "cvs add" the files. Start by adding the
7947: directory and then files in the directory. Don't forget to add the new package
7948: to the category's Makefile. Make sure you don't forget any files; you can check
7949: by running "cvs status". An example:
7950:
7951: $ cd .../pkgsrc/category
7952: $ cvs add pkgname
7953: $ cd pkgname
7954: $ cvs add DESCR Makefile PLIST distinfo buildlink3.mk patches
7955: $ cvs add patches/p*
7956: $ cvs status | less
1.35 wiz 7957: $ cvs commit
1.34 wiz 7958: $ cd ..
1.236 gutterid 7959: $ vi Makefile # add SUBDIR+=pkgname line
1.35 wiz 7960: $ cvs commit Makefile
1.66 asau 7961: $ cd pkgname
1.73 jnemeth 7962: $ make CTYPE=Added commit-changes-entry
1.1 dsieger 7963:
7964: The commit message of the initial import should include part of the DESCR file,
7965: so people reading the mailing lists know what the package is/does.
7966:
1.34 wiz 7967: Also mention the new package in pkgsrc/doc/CHANGES-20xx.
7968:
7969: Previously, "cvs import" was suggested, but it was much easier to get wrong
7970: than "cvs add".
1.1 dsieger 7971:
1.154 rillig 7972: 23.6. Updating a package to a newer version
1.1 dsieger 7973:
7974: Please always put a concise, appropriate and relevant summary of the changes
7975: between old and new versions into the commit log when updating a package. There
7976: are various reasons for this:
7977:
7978: * A URL is volatile, and can change over time. It may go away completely or
7979: its information may be overwritten by newer information.
7980:
7981: * Having the change information between old and new versions in our CVS
7982: repository is very useful for people who use either cvs or anoncvs.
7983:
7984: * Having the change information between old and new versions in our CVS
7985: repository is very useful for people who read the pkgsrc-changes mailing
7986: list, so that they can make tactical decisions about when to upgrade the
7987: package.
7988:
7989: Please also recognize that, just because a new version of a package has been
7990: released, it should not automatically be upgraded in the CVS repository. We
7991: prefer to be conservative in the packages that are included in pkgsrc -
7992: development or beta packages are not really the best thing for most places in
7993: which pkgsrc is used. Please use your judgement about what should go into
7994: pkgsrc, and bear in mind that stability is to be preferred above new and
7995: possibly untested features.
7996:
1.154 rillig 7997: 23.7. Renaming a package in pkgsrc
1.21 snj 7998:
7999: Renaming packages is not recommended.
8000:
1.175 gutterid 8001: When renaming packages, be sure to fix any references to the old name in other
1.21 snj 8002: Makefiles, options, buildlink files, etc.
8003:
1.175 gutterid 8004: Also, when renaming a package, please add the package name and version pattern
1.167 leot 8005: (s) of the previous package to SUPERSEDES. This may be repeated for multiple
8006: renames. The new package would be an exact replacement. Example:
8007:
8008: SUPERSEDES+= p5-IO-Compress-Zlib<2.017
8009: SUPERSEDES+= optcomp-[0-9]*
1.21 snj 8010:
8011: Note that "successor" in the CHANGES-YYYY file doesn't necessarily mean that it
8012: supersedes, as that successor may not be an exact replacement but is a
8013: suggestion for the replaced functionality.
8014:
1.154 rillig 8015: 23.8. Moving a package in pkgsrc
1.21 snj 8016:
8017: It is preferred that packages are not renamed or moved, but if needed please
8018: follow these steps.
1.1 dsieger 8019:
8020: 1. Make a copy of the directory somewhere else.
8021:
8022: 2. Remove all CVS dirs.
8023:
8024: Alternatively to the first two steps you can also do:
8025:
8026: % cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package
8027:
8028: and use that for further work.
8029:
1.25 wiz 8030: 3. Fix CATEGORIES and any DEPENDS paths that just did "../package" instead of
1.1 dsieger 8031: "../../category/package".
8032:
1.21 snj 8033: 4. In the modified package's Makefile, consider setting PREV_PKGPATH to the
8034: previous category/package pathname. The PREV_PKGPATH can be used by tools
8035: for doing an update using pkgsrc building; for example, it can search the
8036: pkg_summary(5) database for PREV_PKGPATH (if no SUPERSEDES) and then use
8037: the corresponding new PKGPATH for that moved package. Note that it may have
8038: multiple matches, so the tool should also check on the PKGBASE too. The
8039: PREV_PKGPATH probably has no value unless SUPERSEDES is not set, i.e.
8040: PKGBASE stays the same.
8041:
1.237 gutterid 8042: 5. cvs add the modified package in the new place.
1.1 dsieger 8043:
1.21 snj 8044: 6. Check if any package depends on it:
1.1 dsieger 8045:
8046: % cd /usr/pkgsrc
8047: % grep /package */*/Makefile* */*/buildlink*
8048:
1.21 snj 8049: 7. Fix paths in packages from step 5 to point to new location.
1.1 dsieger 8050:
1.21 snj 8051: 8. cvs rm (-f) the package at the old location.
1.1 dsieger 8052:
1.21 snj 8053: 9. Remove from oldcategory/Makefile.
1.1 dsieger 8054:
1.21 snj 8055: 10. Add to newcategory/Makefile.
1.1 dsieger 8056:
1.21 snj 8057: 11. Commit the changed and removed files:
1.1 dsieger 8058:
8059: % cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile
8060:
8061: (and any packages from step 5, of course).
8062:
1.154 rillig 8063: Chapter 24. Frequently Asked Questions
1.1 dsieger 8064:
8065: This section contains the answers to questions that may arise when you are
8066: writing a package. If you don't find your question answered here, first have a
8067: look in the other chapters, and if you still don't have the answer, ask on the
8068: pkgsrc-users mailing list.
8069:
1.154 rillig 8070: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
8071: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
8072: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
1.223 nia 8073: 24.4. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
8074: 24.5. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.232 gutterid 8075: the := inside it.
1.223 nia 8076: 24.6. Which mailing lists are there for package developers?
8077: 24.7. Where is the pkgsrc documentation?
8078: 24.8. I have a little time to kill. What shall I do?
1.1 dsieger 8079:
1.154 rillig 8080: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
1.1 dsieger 8081:
8082: MAKEFLAGS are the flags passed to the pkgsrc-internal invocations of make
1.223 nia 8083: (1).
8084:
8085: MAKE_FLAGS are the flags that are passed to the MAKE_PROGRAM when
8086: building the package.
8087:
8088: .MAKEFLAGS is an internal variable of bmake and should not be used by
8089: packages.
1.1 dsieger 8090:
1.154 rillig 8091: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
1.1 dsieger 8092:
8093: MAKE is the path to the make(1) program that is used in the pkgsrc
1.223 nia 8094: infrastructure.
8095:
8096: GMAKE is the path to GNU Make, but you need to say USE_TOOLS+=gmake to
8097: use that.
8098:
8099: MAKE_PROGRAM is the path to the Make program that is used for building
8100: the package.
1.1 dsieger 8101:
1.154 rillig 8102: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
1.1 dsieger 8103:
8104: CC is the path to the real C compiler, which can be configured by the
1.223 nia 8105: pkgsrc user.
1.1 dsieger 8106:
1.223 nia 8107: PKG_CC is the path to the compiler wrapper.
1.1 dsieger 8108:
1.223 nia 8109: PKGSRC_COMPILER is not a path to a compiler, but the type of compiler
8110: that should be used. See mk/compiler.mk for more information about the
8111: latter variable.
1.1 dsieger 8112:
1.223 nia 8113: 24.4. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
1.1 dsieger 8114:
1.25 wiz 8115: For optimization reasons, some variables are only available in the "
8116: wrapper" phase and later. To "simulate" the wrapper phase, append
1.1 dsieger 8117: PKG_PHASE=wrapper to the above command.
8118:
1.223 nia 8119: 24.5. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.1 dsieger 8120: the := inside it.
8121:
1.223 nia 8122: The := is not an assignment operator, even though it may look like one.
1.108 rillig 8123: Instead, it is a degenerate form of ${LIST:old_string=new_string}, which
8124: is documented in the make(1) man page and which is commonly used in the
8125: form ${SRCS:.c=.o}. In the case of MASTER_SITE_*, old_string is the empty
8126: string and new_string is package/. That's where the : and the = fall
8127: together.
1.1 dsieger 8128:
1.223 nia 8129: 24.6. Which mailing lists are there for package developers?
1.1 dsieger 8130:
8131: tech-pkg
8132:
8133: This is a list for technical discussions related to pkgsrc
8134: development, e.g. soliciting feedback for changes to pkgsrc
8135: infrastructure, proposed new features, questions related to porting
8136: pkgsrc to a new platform, advice for maintaining a package, patches
8137: that affect many packages, help requests moved from pkgsrc-users when
8138: an infrastructure bug is found, etc.
8139:
8140: pkgsrc-bugs
8141:
8142: All bug reports in category "pkg" sent with send-pr(1) appear here.
8143: Please do not report your bugs here directly; use one of the other
8144: mailing lists.
8145:
1.223 nia 8146: 24.7. Where is the pkgsrc documentation?
1.1 dsieger 8147:
8148: There are many places where you can find documentation about pkgsrc:
8149:
8150: * The pkgsrc guide (this document) is a collection of chapters that
8151: explain large parts of pkgsrc, but some chapters tend to be outdated.
8152: Which ones they are is hard to say.
8153:
1.174 leot 8154: * On the mailing list archives (see https://mail-index.NetBSD.org/),
8155: you can find discussions about certain features, announcements of new
1.1 dsieger 8156: parts of the pkgsrc infrastructure and sometimes even announcements
8157: that a certain feature has been marked as obsolete. The benefit here
8158: is that each message has a date appended to it.
8159:
8160: * Many of the files in the mk/ directory start with a comment that
8161: describes the purpose of the file and how it can be used by the
8162: pkgsrc user and package authors. An easy way to find this
8163: documentation is to run bmake help.
8164:
8165: * The CVS log messages are a rich source of information, but they tend
8166: to be highly abbreviated, especially for actions that occur often.
8167: Some contain a detailed description of what has changed, but they are
8168: geared towards the other pkgsrc developers, not towards an average
8169: pkgsrc user. They also only document changes, so if you don't know
8170: what has been before, these messages may not be worth too much to
8171: you.
8172:
8173: * Some parts of pkgsrc are only "implicitly documented", that is the
8174: documentation exists only in the mind of the developer who wrote the
8175: code. To get this information, use the cvs annotate command to see
8176: who has written it and ask on the tech-pkg mailing list, so that
8177: others can find your questions later (see above). To be sure that the
8178: developer in charge reads the mail, you may CC him or her.
8179:
1.223 nia 8180: 24.8. I have a little time to kill. What shall I do?
1.1 dsieger 8181:
8182: This is not really an FAQ yet, but here's the answer anyway.
8183:
8184: * Run pkg_chk -N (from the pkgtools/pkg_chk package). It will tell you
8185: about newer versions of installed packages that are available, but
8186: not yet updated in pkgsrc.
8187:
1.198 leot 8188: * Browse pkgsrc/doc/TODO -- it contains a list of suggested new
8189: packages and a list of cleanups and enhancements for pkgsrc that
8190: would be nice to have.
1.1 dsieger 8191:
1.71 wiz 8192: * Review packages for which review was requested on the tech-pkg
8193: mailing list.
1.1 dsieger 8194:
8195: Part III. The pkgsrc infrastructure internals
8196:
8197: This part of the guide deals with everything from the infrastructure that is
8198: behind the interfaces described in the developer's guide. A casual package
8199: maintainer should not need anything from this part.
8200:
8201: Table of Contents
8202:
1.184 rillig 8203: 25. Design of the pkgsrc infrastructure
8204: 25.1. The meaning of variable definitions
8205: 25.2. Avoiding problems before they arise
8206: 25.3. Variable evaluation
8207: 25.3.1. At load time
8208: 25.3.2. At runtime
8209: 25.4. How can variables be specified?
8210: 25.5. Designing interfaces for Makefile fragments
8211: 25.5.1. Procedures with parameters
8212: 25.5.2. Actions taken on behalf of parameters
8213: 25.6. The order in which files are loaded
8214: 25.6.1. The order in bsd.prefs.mk
8215: 25.6.2. The order in bsd.pkg.mk
8216: 26. Regression tests
8217: 26.1. Running the regression tests
8218: 26.2. Adding a new regression test
8219: 26.2.1. Overridable functions
8220: 26.2.2. Helper functions
8221: 27. Porting pkgsrc
8222: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8223:
1.184 rillig 8224: Chapter 25. Design of the pkgsrc infrastructure
1.1 dsieger 8225:
8226: Table of Contents
8227:
1.184 rillig 8228: 25.1. The meaning of variable definitions
8229: 25.2. Avoiding problems before they arise
8230: 25.3. Variable evaluation
8231: 25.3.1. At load time
8232: 25.3.2. At runtime
8233: 25.4. How can variables be specified?
8234: 25.5. Designing interfaces for Makefile fragments
8235: 25.5.1. Procedures with parameters
8236: 25.5.2. Actions taken on behalf of parameters
8237: 25.6. The order in which files are loaded
8238: 25.6.1. The order in bsd.prefs.mk
8239: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8240:
8241: The pkgsrc infrastructure consists of many small Makefile fragments. Each such
8242: fragment needs a properly specified interface. This chapter explains how such
8243: an interface looks like.
8244:
1.184 rillig 8245: 25.1. The meaning of variable definitions
1.1 dsieger 8246:
8247: Whenever a variable is defined in the pkgsrc infrastructure, the location and
8248: the way of definition provide much information about the intended use of that
8249: variable. Additionally, more documentation may be found in a header comment or
8250: in this pkgsrc guide.
8251:
8252: A special file is mk/defaults/mk.conf, which lists all variables that are
8253: intended to be user-defined. They are either defined using the ?= operator or
8254: they are left undefined because defining them to anything would effectively
8255: mean "yes". All these variables may be overridden by the pkgsrc user in the
8256: MAKECONF file.
8257:
8258: Outside this file, the following conventions apply: Variables that are defined
8259: using the ?= operator may be overridden by a package.
8260:
8261: Variables that are defined using the = operator may be used read-only at
8262: run-time.
8263:
8264: Variables whose name starts with an underscore must not be accessed outside the
8265: pkgsrc infrastructure at all. They may change without further notice.
8266:
8267: Note
8268:
8269: These conventions are currently not applied consistently to the complete pkgsrc
8270: infrastructure.
8271:
1.184 rillig 8272: 25.2. Avoiding problems before they arise
1.1 dsieger 8273:
8274: All variables that contain lists of things should default to being empty. Two
8275: examples that do not follow this rule are USE_LANGUAGES and DISTFILES. These
8276: variables cannot simply be modified using the += operator in package Makefiles
8277: (or other files included by them), since there is no guarantee whether the
8278: variable is already set or not, and what its value is. In the case of
8279: DISTFILES, the packages "know" the default value and just define it as in the
8280: following example.
8281:
8282: DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
8283:
8284: Because of the selection of this default value, the same value appears in many
8285: package Makefiles. Similarly for USE_LANGUAGES, but in this case the default
8286: value ("c") is so short that it doesn't stand out. Nevertheless it is mentioned
8287: in many files.
8288:
1.184 rillig 8289: 25.3. Variable evaluation
1.1 dsieger 8290:
1.184 rillig 8291: 25.3.1. At load time
1.1 dsieger 8292:
8293: Variable evaluation takes place either at load time or at runtime, depending on
8294: the context in which they occur. The contexts where variables are evaluated at
8295: load time are:
8296:
8297: * The right hand side of the := and != operators,
8298:
8299: * Make directives like .if or .for,
8300:
8301: * Dependency lines.
8302:
8303: A special exception are references to the iteration variables of .for loops,
8304: which are expanded inline, no matter in which context they appear.
8305:
8306: As the values of variables may change during load time, care must be taken not
8307: to evaluate them by accident. Typical examples for variables that should not be
8308: evaluated at load time are DEPENDS and CONFIGURE_ARGS. To make the effect more
8309: clear, here is an example:
8310:
8311: CONFIGURE_ARGS= # none
8312: CFLAGS= -O
8313: CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
8314:
8315: CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
8316:
8317: CFLAGS+= -Wall
8318:
8319: This code shows how the use of the := operator can quickly lead to unexpected
8320: results. The first paragraph is fairly common code. The second paragraph
8321: evaluates the CONFIGURE_ARGS variable, which results in CFLAGS=-O. In the third
8322: paragraph, the -Wall is appended to the CFLAGS, but this addition will not
8323: appear in CONFIGURE_ARGS. In actual code, the three paragraphs from above
8324: typically occur in completely unrelated files.
8325:
1.184 rillig 8326: 25.3.2. At runtime
1.1 dsieger 8327:
8328: After all the files have been loaded, the values of the variables cannot be
8329: changed anymore. Variables that are used in the shell commands are expanded at
8330: this point.
8331:
1.184 rillig 8332: 25.4. How can variables be specified?
1.1 dsieger 8333:
8334: There are many ways in which the definition and use of a variable can be
8335: restricted in order to detect bugs and violations of the (mostly unwritten)
1.108 rillig 8336: policies. A package can be checked with pkglint -Wall to see whether it meets
8337: these rules.
1.1 dsieger 8338:
1.184 rillig 8339: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8340:
8341: Most of the .mk files fall into one of the following classes. Cases where a
8342: file falls into more than one class should be avoided as it often leads to
8343: subtle bugs.
8344:
1.184 rillig 8345: 25.5.1. Procedures with parameters
1.1 dsieger 8346:
8347: In a traditional imperative programming language some of the .mk files could be
1.198 leot 8348: described as procedures. They take some input parameters and--after
8349: inclusion--provide a result in output parameters. Since all variables in
1.23 jakllsch 8350: Makefiles have global scope care must be taken not to use parameter names that
8351: have already another meaning. For example, PKGNAME is a bad choice for a
8352: parameter name.
1.1 dsieger 8353:
8354: Procedures are completely evaluated at preprocessing time. That is, when
8355: calling a procedure all input parameters must be completely resolvable. For
8356: example, CONFIGURE_ARGS should never be an input parameter since it is very
8357: likely that further text will be added after calling the procedure, which would
8358: effectively apply the procedure to only a part of the variable. Also,
1.108 rillig 8359: references to other variables will be modified after calling the procedure.
1.1 dsieger 8360:
8361: A procedure can declare its output parameters either as suitable for use in
8362: preprocessing directives or as only available at runtime. The latter
8363: alternative is for variables that contain references to other runtime
8364: variables.
8365:
8366: Procedures shall be written such that it is possible to call the procedure more
8367: than once. That is, the file must not contain multiple-inclusion guards.
8368:
8369: Examples for procedures are mk/bsd.options.mk and mk/buildlink3/bsd.builtin.mk.
8370: To express that the parameters are evaluated at load time, they should be
8371: assigned using the := operator, which should be used only for this purpose.
8372:
1.184 rillig 8373: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8374:
8375: Action files take some input parameters and may define runtime variables. They
8376: shall not define loadtime variables. There are action files that are included
8377: implicitly by the pkgsrc infrastructure, while other must be included
8378: explicitly.
8379:
8380: An example for action files is mk/subst.mk.
8381:
1.184 rillig 8382: 25.6. The order in which files are loaded
1.1 dsieger 8383:
8384: Package Makefiles usually consist of a set of variable definitions, and include
8385: the file ../../mk/bsd.pkg.mk in the very last line. Before that, they may also
8386: include various other *.mk files if they need to query the availability of
8387: certain features like the type of compiler or the X11 implementation. Due to
8388: the heavy use of preprocessor directives like .if and .for, the order in which
8389: the files are loaded matters.
8390:
8391: This section describes at which point the various files are loaded and gives
8392: reasons for that order.
8393:
1.184 rillig 8394: 25.6.1. The order in bsd.prefs.mk
1.1 dsieger 8395:
8396: The very first action in bsd.prefs.mk is to define some essential variables
8397: like OPSYS, OS_VERSION and MACHINE_ARCH.
8398:
1.4 rillig 8399: Then, the user settings are loaded from the file specified in MAKECONF, which
8400: is usually mk.conf. After that, those variables that have not been overridden
8401: by the user are loaded from mk/defaults/mk.conf.
1.1 dsieger 8402:
8403: After the user settings, the system settings and platform settings are loaded,
8404: which may override the user settings.
8405:
8406: Then, the tool definitions are loaded. The tool wrappers are not yet in effect.
8407: This only happens when building a package, so the proper variables must be used
8408: instead of the direct tool names.
8409:
8410: As the last steps, some essential variables from the wrapper and the package
8411: system flavor are loaded, as well as the variables that have been cached in
8412: earlier phases of a package build.
8413:
1.184 rillig 8414: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8415:
8416: First, bsd.prefs.mk is loaded.
8417:
8418: Then, the various *-vars.mk files are loaded, which fill default values for
8419: those variables that have not been defined by the package. These variables may
8420: later be used even in unrelated files.
8421:
8422: Then, the file bsd.pkg.error.mk provides the target error-check that is added
8423: as a special dependency to all other targets that use DELAYED_ERROR_MSG or
8424: DELAYED_WARNING_MSG.
8425:
8426: Then, the package-specific hacks from hacks.mk are included.
8427:
8428: Then, various other files follow. Most of them don't have any dependencies on
8429: what they need to have included before or after them, though some do.
8430:
8431: The code to check PKG_FAIL_REASON and PKG_SKIP_REASON is then executed, which
8432: restricts the use of these variables to all the files that have been included
8433: before. Appearances in later files will be silently ignored.
8434:
8435: Then, the files for the main targets are included, in the order of later
8436: execution, though the actual order should not matter.
8437:
8438: At last, some more files are included that don't set any interesting variables
8439: but rather just define make targets to be executed.
8440:
1.184 rillig 8441: Chapter 26. Regression tests
1.1 dsieger 8442:
8443: Table of Contents
8444:
1.184 rillig 8445: 26.1. Running the regression tests
8446: 26.2. Adding a new regression test
8447: 26.2.1. Overridable functions
8448: 26.2.2. Helper functions
1.1 dsieger 8449:
8450: The pkgsrc infrastructure consists of a large codebase, and there are many
8451: corners where every little bit of a file is well thought out, making pkgsrc
8452: likely to fail as soon as anything is changed near those parts. To prevent most
8453: changes from breaking anything, a suite of regression tests should go along
8454: with every important part of the pkgsrc infrastructure. This chapter describes
8455: how regression tests work in pkgsrc and how you can add new tests.
8456:
1.184 rillig 8457: 26.1. Running the regression tests
1.1 dsieger 8458:
1.25 wiz 8459: You first need to install the pkgtools/pkg_regress package, which provides the
1.1 dsieger 8460: pkg_regress command. Then you can simply run that command, which will run all
1.168 rillig 8461: tests in the regress/ directory.
1.1 dsieger 8462:
1.184 rillig 8463: 26.2. Adding a new regression test
1.1 dsieger 8464:
1.168 rillig 8465: Every directory in the regress/ directory that contains a file called spec is
1.1 dsieger 8466: considered a regression test. This file is a shell program that is included by
8467: the pkg_regress command. The following functions can be overridden to suit your
8468: needs.
8469:
1.184 rillig 8470: 26.2.1. Overridable functions
1.1 dsieger 8471:
1.108 rillig 8472: These functions do not take any parameters. Although they are called in "set -e
1.168 rillig 8473: " mode, they don't stop at the first failing command. See this Stack Overflow
1.108 rillig 8474: question for details.
1.1 dsieger 8475:
1.108 rillig 8476: do_setup
1.1 dsieger 8477:
8478: This function prepares the environment for the test. By default it does
8479: nothing.
8480:
1.108 rillig 8481: do_test
1.1 dsieger 8482:
8483: This function runs the actual test. By default, it calls TEST_MAKE with the
8484: arguments MAKEARGS_TEST and writes its output including error messages into
8485: the file TEST_OUTFILE.
8486:
1.108 rillig 8487: When defining this function, make sure that all output that needs to be
8488: checked is written to the correct output file. Example:
8489:
8490: do_test() {
8491: echo "Example output"
8492: } 1>$TEST_OUTFILE 2>&1
8493:
8494: check_result
1.1 dsieger 8495:
8496: This function is run after the test and is typically used to compare the
8497: actual output from the one that is expected. It can make use of the various
1.108 rillig 8498: helper functions from the next section. Example:
8499:
8500: check_result() {
8501: exit_status 0
8502: output_require "Example"
8503: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
8504: output_prohibit "no such file or directory"
1.169 rillig 8505: regress_fail "expected $expected but got $actual for input $input"
1.108 rillig 8506: }
1.1 dsieger 8507:
1.108 rillig 8508: do_cleanup
1.1 dsieger 8509:
8510: This function cleans everything up after the test has been run. By default
8511: it does nothing.
8512:
1.184 rillig 8513: 26.2.2. Helper functions
1.1 dsieger 8514:
1.168 rillig 8515: regress_fail message...
8516:
8517: This function makes the test fail with the given error message.
8518:
1.108 rillig 8519: exit_status expected
1.1 dsieger 8520:
1.108 rillig 8521: This function compares the exitcode of the do_test function with its first
8522: parameter. If they differ, the test will fail.
1.1 dsieger 8523:
1.108 rillig 8524: output_require regex...
1.1 dsieger 8525:
8526: This function checks for each of its parameters if the output from do_test
1.108 rillig 8527: matches the extended regular expression. If it does not, the test will
8528: fail. Example:
8529:
8530: output_require "looks fine"
8531: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
1.1 dsieger 8532:
1.177 leot 8533: output_prohibit regex...
1.1 dsieger 8534:
8535: This function checks for each of its parameters if the output from do_test
8536: () does not match the extended regular expression. If any of the regular
8537: expressions matches, the test will fail.
8538:
1.184 rillig 8539: Chapter 27. Porting pkgsrc
1.1 dsieger 8540:
8541: Table of Contents
8542:
1.184 rillig 8543: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8544:
8545: The pkgsrc system has already been ported to many operating systems, hardware
8546: architectures and compilers. This chapter explains the necessary steps to make
8547: pkgsrc even more portable.
8548:
1.184 rillig 8549: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8550:
8551: To port pkgsrc to a new operating system (called MyOS in this example), you
8552: need to touch the following files:
8553:
8554: pkgtools/bootstrap-mk-files/files/mods/MyOS.sys.mk
8555:
8556: This file contains some basic definitions, for example the name of the C
8557: compiler.
8558:
8559: mk/bsd.prefs.mk
8560:
1.212 wiz 8561: Insert code that defines the variables OPSYS, OS_VERSION, OPSYS_VERSION,
1.1 dsieger 8562: LOWER_VENDOR, MACHINE_ARCH, OBJECT_FMT, APPEND_ELF, and the other variables
8563: that appear in this file.
8564:
8565: mk/platform/MyOS.mk
8566:
8567: This file contains the platform-specific definitions that are used by
8568: pkgsrc. Start by copying one of the other files and edit it to your needs.
8569:
8570: mk/tools/tools.MyOS.mk
8571:
8572: This file defines the paths to all the tools that are needed by one or the
8573: other package in pkgsrc, as well as by pkgsrc itself. Find out where these
8574: tools are on your platform and add them.
8575:
8576: Now, you should be able to build some basic packages, like lang/perl5, shells/
8577: bash.
8578:
8579: Appendix A. A simple example package: bison
8580:
8581: Table of Contents
8582:
8583: A.1. files
8584: A.1.1. Makefile
8585: A.1.2. DESCR
8586: A.1.3. PLIST
8587: A.1.4. Checking a package with pkglint
8588: A.2. Steps for building, installing, packaging
8589:
8590: We checked to find a piece of software that wasn't in the packages collection,
1.25 wiz 8591: and picked GNU bison. Quite why someone would want to have bison when Berkeley
1.1 dsieger 8592: yacc is already present in the tree is beyond us, but it's useful for the
8593: purposes of this exercise.
8594:
8595: A.1. files
8596:
8597: A.1.1. Makefile
8598:
1.2 rillig 8599: # $NetBSD$
1.1 dsieger 8600: #
8601:
8602: DISTNAME= bison-1.25
8603: CATEGORIES= devel
1.171 rillig 8604: MASTER_SITES= ${MASTER_SITE_GNU:=bison/}
1.1 dsieger 8605:
1.30 dholland 8606: MAINTAINER= pkgsrc-users@NetBSD.org
1.174 leot 8607: HOMEPAGE= https://www.gnu.org/software/bison/bison.html
1.1 dsieger 8608: COMMENT= GNU yacc clone
8609:
8610: GNU_CONFIGURE= yes
1.47 wiz 8611: INFO_FILES= yes
1.1 dsieger 8612:
8613: .include "../../mk/bsd.pkg.mk"
8614:
8615: A.1.2. DESCR
8616:
8617: GNU version of yacc. Can make re-entrant parsers, and numerous other
8618: improvements. Why you would want this when Berkeley yacc(1) is part
8619: of the NetBSD source tree is beyond me.
8620:
8621: A.1.3. PLIST
8622:
1.2 rillig 8623: @comment $NetBSD$
1.1 dsieger 8624: bin/bison
8625: man/man1/bison.1.gz
8626: share/bison.simple
8627: share/bison.hairy
8628:
8629: A.1.4. Checking a package with pkglint
8630:
8631: The NetBSD package system comes with pkgtools/pkglint which helps to check the
8632: contents of these files. After installation it is quite easy to use, just
1.171 rillig 8633: change to the directory of the package you wish to examine and run pkglint:
1.1 dsieger 8634:
8635: $ pkglint
1.171 rillig 8636: ERROR: Makefile: Each package must define its LICENSE.
8637: WARN: Makefile:9: HOMEPAGE should migrate from http to https.
8638: NOTE: PLIST:3: The .gz extension is unnecessary for manual pages.
8639: WARN: PLIST:5: "share/bison.hairy" should be sorted before "share/bison.simple".
8640: 1 error, 2 warnings and 1 note found.
8641: (Run "pkglint -e" to show explanations.)
8642: (Run "pkglint -fs" to show what can be fixed automatically.)
1.172 rillig 8643: (Run "pkglint -F" to automatically fix some issues.)
1.1 dsieger 8644:
8645: Depending on the supplied command line arguments (see pkglint(1)), more checks
1.170 rillig 8646: will be performed. Use e.g. pkglint -Wall for a very thorough check.
1.1 dsieger 8647:
8648: A.2. Steps for building, installing, packaging
8649:
8650: Create the directory where the package lives, plus any auxiliary directories:
8651:
8652: # cd /usr/pkgsrc/lang
8653: # mkdir bison
8654: # cd bison
8655: # mkdir patches
8656:
1.184 rillig 8657: Create Makefile, DESCR and PLIST (see Chapter 12, Package components - files,
1.1 dsieger 8658: directories and contents) then continue with fetching the distfile:
8659:
8660: # make fetch
8661: >> bison-1.25.tar.gz doesn't seem to exist on this system.
8662: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
8663: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8664: ftp: Error retrieving file: 500 Internal error
8665:
8666: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
8667: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8668: ftp: Error retrieving file: 500 Internal error
8669:
8670: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
8671: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8672: Successfully retrieved file.
8673:
8674: Generate the checksum of the distfile into distinfo:
8675:
8676: # make makedistinfo
8677:
8678: Now compile:
8679:
8680: # make
8681: >> Checksum OK for bison-1.25.tar.gz.
8682: ===> Extracting for bison-1.25
8683: ===> Patching for bison-1.25
8684: ===> Ignoring empty patch directory
8685: ===> Configuring for bison-1.25
8686: creating cache ./config.cache
8687: checking for gcc... cc
8688: checking whether we are using GNU C... yes
8689: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
8690: checking how to run the C preprocessor... cc -E
8691: checking for minix/config.h... no
8692: checking for POSIXized ISC... no
8693: checking whether cross-compiling... no
8694: checking for ANSI C header files... yes
8695: checking for string.h... yes
8696: checking for stdlib.h... yes
8697: checking for memory.h... yes
8698: checking for working const... yes
8699: checking for working alloca.h... no
8700: checking for alloca... yes
8701: checking for strerror... yes
8702: updating cache ./config.cache
8703: creating ./config.status
8704: creating Makefile
8705: ===> Building for bison-1.25
8706: 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
8707: 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
8708: 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
8709: 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
8710: 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
8711: 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
8712: 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
8713: 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
8714: 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
8715: 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
8716: 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
8717: 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
8718: 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
8719: 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
8720: 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
8721: 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
8722: 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
8723: 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
8724: 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
8725: 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
8726: 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
8727: 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
8728: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
8729: rm -f bison.s1
8730: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
8731:
8732: Everything seems OK, so install the files:
8733:
8734: # make install
8735: >> Checksum OK for bison-1.25.tar.gz.
8736: ===> Installing for bison-1.25
8737: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
8738: rm -f /usr/pkg/bin/bison
8739: cd /usr/pkg/share; rm -f bison.simple bison.hairy
8740: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
8741: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
8742: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
8743: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
8744: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
8745: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
8746: ===> Registering installation for bison-1.25
8747:
8748: You can now use bison, and also - if you decide so - remove it with pkg_delete
8749: bison. Should you decide that you want a binary package, do this now:
8750:
8751: # make package
8752: >> Checksum OK for bison-1.25.tar.gz.
8753: ===> Building package for bison-1.25
8754: Creating package bison-1.25.tgz
8755: Registering depends:.
8756: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
8757:
8758: Now that you don't need the source and object files any more, clean up:
8759:
8760: # make clean
8761: ===> Cleaning for bison-1.25
8762:
1.207 leot 8763: Appendix B. Security hardening
8764:
8765: Table of Contents
8766:
8767: B.1. Mechanisms
8768: B.1.1. Enabled by default
8769: B.1.2. Not enabled by default
8770: B.2. Caveats
8771: B.2.1. Problems with PKGSRC_MKPIE
8772: B.2.2. Problems with PKGSRC_USE_FORTIFY
8773: B.2.3. Problems with PKGSRC_USE_RELRO
8774: B.2.4. Problems with PKGSRC_USE_SSP
8775: B.3. Auditing the system
8776: B.3.1. Checking for PIE
8777: B.3.2. Checking for partial RELRO
8778: B.3.3. Checking for full RELRO
8779: B.3.4. Checking for SSP
8780:
8781: A number of mechanisms are available in pkgsrc to improve the security of the
8782: resulting system. This page describes the mechanisms, and gives hints about
8783: detecting and fixing problems.
8784:
8785: Mechanisms can be enabled individually in mk.conf, and are individually
8786: described below.
8787:
8788: Typically, a feature will cause some programs to fail to build or work when
8789: first enabled. This can be due to latent problems in the program, and can be
8790: due to other reasons. After enough testing to have confidence that user
8791: problems will be quite rare, individual mechanisms will be enabled by default.
8792:
8793: For each mechanism, see the Caveats section below for an explanation of what
8794: might go wrong at compile time and at run time, and how to notice and address
8795: these problems.
8796:
8797: B.1. Mechanisms
8798:
8799: B.1.1. Enabled by default
8800:
8801: B.1.1.1. PKGSRC_USE_FORTIFY
8802:
8803: This allows substitute wrappers to be used for some commonly used library
8804: functions that do not have built-in bounds checking - but could in some cases.
8805:
8806: Two mitigation levels are available:
8807:
8808: * "weak" only enables checks at compile-time.
8809:
8810: * "strong" enables checks at compile-time and runtime.
8811:
8812: "strong" has been enabled by default since pkgsrc-2017Q3.
8813:
8814: B.1.1.2. PKGSRC_USE_SSP
8815:
8816: This enables a stack-smashing protection mitigation. It is done by adding a
8817: guard variable to functions with vulnerable objects. The guards are initialized
8818: when a function is entered and then checked when the function exits. The guard
8819: check will fail and the program forcibly exited if the variable was modified in
8820: the meantime. This can happen in case of buffer overflows or memory corruption,
8821: and therefore exposing these bugs.
8822:
8823: Different mitigation levels are available:
8824:
8825: * "yes", which will only protect functions considered vulnerable by the
8826: compiler;
8827:
8828: * "all", which will protect every function;
8829:
8830: * "strong", the default, which will apply a better balance between the two
8831: settings above.
8832:
8833: This mitigation is supported by both GCC and clang. It may be supported in
8834: additional compilers, possibly under a different name. It is particularly
8835: useful for unsafe programming languages, such as C/C++.
8836:
8837: * "yes" is enabled by default where known supported since pkgsrc-2017Q3.
8838:
8839: * "strong" is enabled by default where known supported since pkgsrc-2021Q4.
8840:
8841: More details can be found here:
8842:
8843: * Buffer overflow protection on Wikipedia
8844:
8845: B.1.1.3. PKGSRC_MKPIE
8846:
8847: This requests the creation of PIE (Position Independent Executables) for all
8848: executables. The PIE mechanism is normally used for shared libraries, so that
8849: they can be loaded at differing addresses at runtime. PIE itself does not have
8850: useful security properties; however, it is necessary to fully leverage some,
8851: such as ASLR. Some operating systems support Address Space Layout Randomization
8852: (ASLR), which causes different addresses to be used each time a program is run.
8853: This makes it more difficult for an attacker to guess addresses and thus makes
8854: exploits harder to construct. With PIE, ASLR can really be applied to the
8855: entire program, instead of the stack and heap only.
8856:
8857: PIE executables will only be built for toolchains that are known to support
8858: PIE. Currently, this means NetBSD on x86, ARM, SPARC64, m68k, and MIPS.
8859:
8860: PKGSRC_MKPIE was enabled by default after the pkgsrc-2021Q3 branch.
8861:
1.219 nia 8862: B.1.1.4. PKGSRC_USE_RELRO
1.207 leot 8863:
8864: This also makes the exploitation of some security vulnerabilities more
8865: difficult in some cases.
8866:
8867: Two different mitigation levels are available:
8868:
1.219 nia 8869: * partial (the default): the ELF sections are reordered so that internal data
8870: sections precede the program's own data sections, and non-PLT GOT is
8871: read-only;
1.207 leot 8872:
8873: * full: in addition to partial RELRO, every relocation is performed
1.218 nia 8874: immediately when starting the program, allowing the entire GOT to be
8875: read-only. This can greatly slow down startup of large programs.
1.207 leot 8876:
8877: This is currently supported by GCC. Many software distributions now enable this
1.220 nia 8878: feature by default, at the "partial" level.
1.207 leot 8879:
8880: More details can be found here:
8881:
8882: * Hardening ELF binaries using Relocation Read-Only (RELRO)
8883:
1.219 nia 8884: B.1.2. Not enabled by default
8885:
8886: B.1.2.1. PKGSRC_MKREPRO
8887:
8888: With this option, pkgsrc will try to build packages reproducibly. This allows
8889: packages built from the same tree and with the same options, to produce
8890: identical results bit by bit. This option should be combined with ASLR and
8891: PKGSRC_MKPIE to avoid predictable address offsets for attackers attempting to
8892: exploit security vulnerabilities.
8893:
8894: More details can be found here:
8895:
8896: * Reproducible Builds - a set of software development practices that create
8897: an independently-verifiable path from source to binary code
8898:
8899: More work likely needs to be done before pkgsrc is fully reproducible.
8900:
8901: B.1.2.2. PKGSRC_USE_STACK_CHECK
1.207 leot 8902:
8903: This uses -fstack-check with GCC for another stack protection mitigation.
8904:
8905: It asks the compiler to generate code verifying that it does not corrupt the
8906: stack. According to GCC's manual page, this is really only useful for
8907: multi-threaded programs.
8908:
8909: B.2. Caveats
8910:
8911: B.2.1. Problems with PKGSRC_MKPIE
8912:
8913: B.2.1.1. Packages failing to build
8914:
8915: A number of packages may fail to build with this option enabled. The failures
8916: are often related to the absence of the -fPIC compilation flag when building
8917: libraries or executables (or ideally -fPIE in the latter case). This flag is
8918: added to the CFLAGS already, but requires the package to actually support it.
8919:
8920: B.2.1.1.1. How to fix
8921:
8922: These instructions are meant as a reference only; they likely need to be
8923: adapted for many packages individually.
8924:
8925: For packages using Makefiles:
8926:
8927: MAKE_FLAGS+= CFLAGS=${CFLAGS:Q}
8928: MAKE_FLAGS+= LDFLAGS=${LDFLAGS:Q}
8929:
8930: For packages using Imakefiles:
8931:
8932: MAKE_FLAGS+= CCOPTIONS=${CFLAGS:Q}
8933: MAKE_FLAGS+= LOCAL_LDFLAGS=${LDFLAGS:Q}
8934:
8935: B.2.1.2. Run-time crashes
8936:
8937: Some programs may fail to run, or crash at random times once built as PIE. Two
8938: scenarios are essentially possible. This is nearly always due to a bug in the
8939: program being exposed due to ASLR.
8940:
8941: B.2.1.3. Disabling PKGSRC_MKPIE on a per-package basis
8942:
8943: Ideally, packages should be fixed for compatibility with MKPIE. However, in
8944: some cases this is very difficult, due to complex build systems, packages using
8945: non-standard toolchains, or programming languages with odd bootstrapping
8946: mechanisms.
8947:
8948: To disable PKGSRC_MKPIE on a per-package basis, set MKPIE_SUPPORTED= no in the
8949: package's Makefile before bsd.prefs.mk is included.
8950:
8951: B.2.2. Problems with PKGSRC_USE_FORTIFY
8952:
8953: B.2.2.1. Packages failing to build
8954:
8955: This feature makes use of pre-processing directives to look for hardened,
8956: alternative implementations of essential library calls. Some programs may fail
8957: to build as a result; this usually happens for those trying too hard to be
8958: portable, or otherwise abusing definitions in the standard library.
8959:
8960: B.2.2.2. Run-time crashes
8961:
8962: This feature may cause some programs to crash, usually indicating an actual bug
8963: in the program. The fix will typically involve patching the original program's
8964: source code.
8965:
8966: B.2.2.3. Optimization is required
8967:
8968: At least in the case of GCC, FORTIFY will only be applied if optimization is
8969: applied while compiling. This means that the CFLAGS should also contain -O, -O2
8970: or another optimization level. This cannot easily be applied globally, as some
8971: packages may require specific optimization levels.
8972:
8973: B.2.2.4. Disabling FORTIFY on a per-package basis
8974:
8975: Note
8976:
8977: FORTIFY should not be disabled to work around runtime crashes in the program!
8978: This is a very bad idea and will expose you to security vulnerabilities.
8979:
8980: To disable FORTIFY on a per-package basis, set the following in the package's
8981: Makefile before bsd.prefs.mk is included:
8982:
8983: FORTIFY_SUPPORTED= no
8984:
8985: B.2.3. Problems with PKGSRC_USE_RELRO
8986:
8987: B.2.3.1. Performance impact
8988:
8989: For better protection, full RELRO requires every symbol to be resolved when the
8990: program starts, rather than simply when required at run-time. This will have
8991: more impact on programs using a lot of symbols, or linked to libraries exposing
8992: a lot of symbols. Therefore, daemons or programs otherwise running in
8993: background are affected only when started. Programs loading plug-ins at
8994: run-time are affected when loading the plug-ins.
8995:
8996: The impact is not expected to be noticeable on modern hardware, except in some
8997: cases for big programs.
8998:
8999: B.2.3.2. Run-time crashes
9000:
9001: Some programs handle plug-ins and dependencies in a way that conflicts with
9002: RELRO: for instance, with an initialization routine listing any other plug-in
9003: required. With full RELRO, the missing symbols are resolved before the
9004: initialization routine can run, and the dynamic loader will not be able to find
9005: them directly and abort as a result. Unfortunately, this is how Xorg loads its
9006: drivers. Partial RELRO can be applied instead in this case.
9007:
9008: B.2.3.3. Disabling RELRO on a per-package basis
9009:
9010: To disable RELRO on a per-package basis, set the following in the package's
9011: Makefile before bsd.prefs.mk is included:
9012:
9013: RELRO_SUPPORTED= no
9014:
1.209 nia 9015: It is also possible to at most enable partial RELRO, by setting RELRO_SUPPORTED
9016: to partial.
9017:
1.207 leot 9018: B.2.4. Problems with PKGSRC_USE_SSP
9019:
9020: B.2.4.1. Packages failing to build
9021:
9022: The stack-smashing protection provided by this option does not work for some
9023: programs. The most common situation in which this happens is when the program
9024: allocates variables on the stack, with the size determined at run-time.
9025:
9026: B.2.4.2. Run-time crashes
9027:
9028: Again, this feature may cause some programs to crash via a SIGABRT, usually
9029: indicating an actual bug in the program.
9030:
9031: On NetBSD LOG_CRIT level syslog messages are sent and - by default - appended
9032: to /var/log/messages, e.g.:
9033:
9034: Jan 6 15:42:51 hostname -: hostname program - - - buffer overflow detected; terminated
9035:
9036: (where hostname is the hostname(1) and program is the basename(1) of the
9037: program crashed).
9038:
9039: Patching the original program is then required.
9040:
9041: Rebuilding the package via:
9042:
9043: % env CFLAGS=-g INSTALL_UNSTRIPPED=yes make replace
9044:
9045: and inspecting the backtrace of the coredump via the debugger should point out
9046: the problematic call by inspecting the frame calling the _chk() (SSP) function.
9047:
9048: B.2.4.3. Performance impact
9049:
9050: The compiler emits extra code when using this feature: a check for buffer
9051: overflows is performed when entering and exiting functions, requiring an extra
9052: variable on the stack. The level of protection can otherwise be adjusted to
9053: affect only those functions considered more sensitive by the compiler (with
9054: -fstack-protector instead of -fstack-protector-all).
9055:
9056: The impact is not expected to be noticeable on modern hardware. However,
9057: programs with a hard requirement to run at the fastest possible speed should
9058: avoid using this feature, or using libraries built with this feature.
9059:
9060: B.2.4.4. Disabling SSP on a per-package basis
9061:
9062: Note
9063:
9064: SSP should not be disabled to work around runtime crashes in the program! This
9065: is a very bad idea and will expose you to security vulnerabilities.
9066:
9067: To disable SSP on a per-package basis, set the following in the package's
9068: Makefile before bsd.prefs.mk is included:
9069:
9070: SSP_SUPPORTED= no
9071:
9072: B.3. Auditing the system
9073:
9074: The illusion of security is worse than having no security at all. This section
9075: lists a number of ways to ensure the security features requested are actually
9076: effective.
9077:
9078: These instructions were obtained and tested on a system derived from NetBSD 7
9079: (amd64). YMMV.
9080:
9081: B.3.1. Checking for PIE
9082:
9083: The ELF executable type in use changes for binaries built as PIE; without:
9084:
9085: $ file /path/to/bin/ary
9086: /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
9087:
9088: as opposed to the following binary, built as PIE:
9089:
9090: $ file /path/to/pie/bin/ary
9091: /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
9092:
9093: The latter result is then what is expected.
9094:
9095: B.3.2. Checking for partial RELRO
9096:
9097: The following command should list a section called RELRO:
9098:
9099: $ objdump -p /path/to/bin/ary
9100:
9101: /path/to/bin/ary: file format elf64-x86-64
9102:
9103: Program Header:
9104: [...]
9105: RELRO off 0x0000000000000d78 vaddr 0x0000000000600d78 paddr 0x0000000000600d78 align 2**0
9106:
9107: This check is now performed automatically if PKG_DEVELOPER is set and RELRO is
9108: enabled.
9109:
9110: B.3.3. Checking for full RELRO
9111:
9112: The dynamic loader will apply RELRO immediately when detecting the presence of
9113: the BIND_NOW flag:
9114:
9115: $ objdump -x /path/to/bin/ary
9116:
9117: /path/to/bin/ary: file format elf64-x86-64
9118:
9119: Dynamic Section:
9120: [...]
9121: BIND_NOW 0x0000000000000000
9122:
9123: This has to be combined with partial RELRO (see above) to be fully efficient.
9124:
9125: This check is now performed automatically (where supported) if PKG_DEVELOPER is
9126: set.
9127:
9128: B.3.4. Checking for SSP
9129:
1.208 nia 9130: Note
9131:
9132: Checking for SSP using this method only works where the operating system uses
9133: libssp. libssp is not used on recent NetBSD/FreeBSD/Linux versions.
9134:
1.207 leot 9135: Building objects, binaries and libraries with SSP will affect the presence of
9136: additional symbols in the resulting file:
9137:
9138: $ nm /path/to/bin/ary
9139: [...]
9140: U __stack_chk_fail
9141: 0000000000600ea0 B __stack_chk_guard
9142:
9143: This is an indicator that the program was indeed built with support for SSP.
9144:
9145: This check is now performed automatically (where supported) if PKG_DEVELOPER is
9146: set and SSP is enabled.
9147:
9148: Appendix C. Build logs
1.1 dsieger 9149:
9150: Table of Contents
9151:
1.207 leot 9152: C.1. Building figlet
9153: C.2. Packaging figlet
1.1 dsieger 9154:
1.207 leot 9155: C.1. Building figlet
1.1 dsieger 9156:
9157: # make
9158: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9159: => figlet221.tar.gz doesn't seem to exist on this system.
9160: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
9161: => [172219 bytes]
9162: Connected to ftp.plig.net.
9163: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
9164: 331 Guest login ok, send your complete e-mail address as password.
9165: 230-You are user #5 of 500 simultaneous users allowed.
9166: 230-
9167: 230- ___ _ _ _
9168: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
9169: 230- | _| _| . |_| . | | | . |_| . | _| . |
9170: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
9171: 230- |_| |_| |___| |___|
9172: 230-
9173: 230-** Welcome to ftp.plig.org **
9174: 230-
9175: 230-Please note that all transfers from this FTP site are logged. If you
9176: 230-do not like this, please disconnect now.
9177: 230-
1.19 snj 9178: 230-This archive is available via
1.1 dsieger 9179: 230-
9180: 230-HTTP: http://ftp.plig.org/
9181: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
9182: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
9183: 230-
9184: 230-Please email comments, bug reports and requests for packages to be
9185: 230-mirrored to ftp-admin@plig.org.
9186: 230-
9187: 230-
9188: 230 Logged in anonymously.
9189: Remote system type is UNIX.
9190: Using binary mode to transfer files.
9191: 200 Type okay.
9192: 250 "/pub" is new cwd.
9193: 250-"/pub/figlet" is new cwd.
9194: 250-
9195: 250-Welcome to the figlet archive at ftp.figlet.org
9196: 250-
9197: 250- ftp://ftp.figlet.org/pub/figlet/
9198: 250-
9199: 250-The official FIGlet web page is:
9200: 250- http://www.figlet.org/
9201: 250-
9202: 250-If you have questions, please mailto:info@figlet.org. If you want to
9203: 250-contribute a font or something else, you can email us.
9204: 250
9205: 250 "/pub/figlet/program" is new cwd.
9206: 250 "/pub/figlet/program/unix" is new cwd.
9207: local: figlet221.tar.gz remote: figlet221.tar.gz
9208: 502 Unimplemented command.
9209: 227 Entering Passive Mode (195,40,6,41,246,104)
9210: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
9211: 38% |************** | 65800 64.16 KB/s 00:01 ETA
9212: 226 Transfer completed.
9213: 172219 bytes received in 00:02 (75.99 KB/s)
9214: 221 Goodbye.
9215: => Checksum OK for figlet221.tar.gz.
9216: ===> Extracting for figlet-2.2.1nb2
9217: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
9218: ===> Patching for figlet-2.2.1nb2
9219: ===> Applying pkgsrc patches for figlet-2.2.1nb2
9220: ===> Overriding tools for figlet-2.2.1nb2
9221: ===> Creating toolchain wrappers for figlet-2.2.1nb2
9222: ===> Configuring for figlet-2.2.1nb2
9223: ===> Building for figlet-2.2.1nb2
9224: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
9225: chmod a+x figlet
9226: gcc -O2 -o chkfont chkfont.c
9227: => Unwrapping files-to-be-installed.
9228: #
9229: # make install
9230: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9231: ===> Installing for figlet-2.2.1nb2
9232: install -d -o root -g wheel -m 755 /usr/pkg/bin
9233: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
9234: mkdir -p /usr/pkg/share/figlet
9235: cp figlet /usr/pkg/bin
9236: cp chkfont /usr/pkg/bin
9237: chmod 555 figlist showfigfonts
9238: cp figlist /usr/pkg/bin
9239: cp showfigfonts /usr/pkg/bin
9240: cp fonts/*.flf /usr/pkg/share/figlet
9241: cp fonts/*.flc /usr/pkg/share/figlet
9242: cp figlet.6 /usr/pkg/man/man6
9243: ===> Registering installation for figlet-2.2.1nb2
9244: #
9245:
1.207 leot 9246: C.2. Packaging figlet
1.1 dsieger 9247:
9248: # make package
9249: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9250: ===> Packaging figlet-2.2.1nb2
9251: ===> Building binary package for figlet-2.2.1nb2
9252: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
9253: Using SrcDir value of /usr/pkg
9254: Registering depends:.
9255: #
9256:
1.207 leot 9257: Appendix D. Directory layout of the pkgsrc FTP server
1.1 dsieger 9258:
9259: Table of Contents
9260:
1.207 leot 9261: D.1. distfiles: The distributed source files
9262: D.2. misc: Miscellaneous things
9263: D.3. packages: Binary packages
9264: D.4. reports: Bulk build reports
9265: D.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 9266:
9267: As in other big projects, the directory layout of pkgsrc is quite complex for
9268: newbies. This chapter explains where you find things on the FTP server. The
9269: base directory on ftp.NetBSD.org is /pub/pkgsrc/. On other servers it may be
9270: different, but inside this directory, everything should look the same, no
9271: matter on which server you are. This directory contains some subdirectories,
9272: which are explained below.
9273:
1.207 leot 9274: D.1. distfiles: The distributed source files
1.1 dsieger 9275:
9276: The directory distfiles contains lots of archive files from all pkgsrc
9277: packages, which are mirrored here. The subdirectories are called after their
9278: package names and are used when the distributed files have names that don't
9279: explicitly contain a version number or are otherwise too generic (for example
9280: release.tar.gz).
9281:
1.207 leot 9282: D.2. misc: Miscellaneous things
1.1 dsieger 9283:
9284: This directory contains things that individual pkgsrc developers find worth
9285: publishing.
9286:
1.207 leot 9287: D.3. packages: Binary packages
1.1 dsieger 9288:
1.3 rillig 9289: This directory contains binary packages for the various platforms that are
9290: supported by pkgsrc. Each subdirectory is of the form OPSYS/ARCH/OSVERSION_TAG.
9291: The meaning of these variables is:
9292:
9293: * OPSYS is the name of the operating system for which the packages have been
1.9 rillig 9294: built. The name is taken from the output of the uname command, so it may
9295: differ from the one you are used to hear.
1.3 rillig 9296:
1.8 rillig 9297: * ARCH is the hardware architecture of the platform for which the packages
1.10 hubertf 9298: have been built. It also includes the ABI (Application Binary Interface)
9299: for platforms that have several of them.
1.3 rillig 9300:
1.8 rillig 9301: * OSVERSION is the version of the operating system. For version numbers that
9302: change often (for example NetBSD-current), the often-changing part should
9303: be replaced with an x, for example 4.99.x.
1.3 rillig 9304:
1.23 jakllsch 9305: * TAG is either 20xxQy for a stable branch, or head for packages built from
1.8 rillig 9306: the HEAD branch. The latter should only be used when the packages are
9307: updated on a regular basis. Otherwise the date from checking out pkgsrc
9308: should be appended, for example head_20071015.
1.3 rillig 9309:
9310: The rationale for exactly this scheme is that the pkgsrc users looking for
9311: binary packages can quickly click through the directories on the server and
9312: find the best binary packages for their machines. Since they usually know the
9313: operating system and the hardware architecture, OPSYS and ARCH are placed
9314: first. After these choices, they can select the best combination of OSVERSION
9315: and TAG together, since it is usually the case that packages stay compatible
9316: between different version of the operating system.
9317:
9318: In each of these directories, there is a whole binary packages collection for a
9319: specific platform. It has a directory called All which contains all binary
9320: packages. Besides that, there are various category directories that contain
9321: symbolic links to the real binary packages.
1.1 dsieger 9322:
1.207 leot 9323: D.4. reports: Bulk build reports
1.8 rillig 9324:
9325: Here are the reports from bulk builds, for those who want to fix packages that
9326: didn't build on some of the platforms. The structure of subdirectories should
1.207 leot 9327: look like the one in Section D.3, "packages: Binary packages".
1.8 rillig 9328:
1.207 leot 9329: D.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 9330:
9331: These directories contain the "real" pkgsrc, that is the files that define how
9332: to create binary packages from source archives.
9333:
1.149 leot 9334: Each of the current, stable and pkgsrc-20xxQy directories share the same
9335: structure. They each contain a pkgsrc directory and pkgsrc.tar.{bz,gz,xz} file.
9336:
1.1 dsieger 9337: The directory pkgsrc contains a snapshot of the CVS repository, which is
1.149 leot 9338: updated regularly. The file pkgsrc.tar.{bz,gz,xz} contains the same as the
9339: directory, ready to be downloaded as a whole.
1.1 dsieger 9340:
1.149 leot 9341: The current directory contains files related to the HEAD branch of the CVS
9342: repository. In this directory there is an additional file called
9343: pkgsrc-readmes.tar.{bz,gz,xz} that contains all pkgsrc READMEs with information
9344: about categories and packages.
9345:
9346: The stable directory is a symlink to the latest pkgsrc-20xxQy.
9347:
9348: The pkgsrc-20xxQy. directories contain files related to the -20xxQy stable
9349: branch of the CVS repository. In these directories there is an additional file
9350: called pkgsrc-20xxQy.tar.{bz,gz,xz}, which contains the state of pkgsrc when it
9351: was branched.
1.148 leot 9352:
1.207 leot 9353: Appendix E. Help topics
1.154 rillig 9354:
9355: The following list contains all help topics that are available when running
9356: bmake help topic=:index.
9357:
1.232 gutterid 9358: #! -lintl
9359: 32bit 64bit
9360: ABI ACCEPTABLE_LICENSES
9361: ACROREAD_FONTPATH ADDITIONAL
9362: AFAIK AIX
9363: ALLOW_VULNERABLE_PACKAGES ALL_ENV
1.239 ! dholland 9364: ALTERNATIVES_SRC AMANDA_TMP
! 9365: AMANDA_USER AMANDA_VAR
! 9366: APACHE_GROUP APACHE_MODULE_NAME
! 9367: APACHE_MODULE_SRC APACHE_MODULE_SRCDIR
! 9368: APACHE_PKG_PREFIX APACHE_SUEXEC_CONFIGURE_ARGS
! 9369: APACHE_SUEXEC_DOCROOT APACHE_USER
! 9370: APPEND_ABI APPEND_ELF
! 9371: ARLA_CACHE AUDIT_PACKAGES_FLAGS
! 9372: AUTOCONF_REQD AUTOMAKE_OVERRIDE
! 9373: AUTOMAKE_REQD AUTO_MKDIRS
! 9374: BDB185_DEFAULT BDBBASE
! 9375: BDB_ACCEPTED BDB_DEFAULT
! 9376: BDB_LIBS BDB_TYPE
! 9377: BINCIMAP_GROUP BINCIMAP_USER
! 9378: BIND_DIR BIND_GROUP
! 9379: BIND_USER BINOWN
! 9380: BINPKG_SITES BIN_INSTALL_FLAGS
! 9381: BISON_PKGDATADIR BLAS
! 9382: BLAS_ACCEPTED BLAS_C_INTERFACE
! 9383: BLAS_INCLUDES BLAS_INDEX64
! 9384: BLAS_LIBS BLAS_PC
! 9385: BLAS_TYPE BOOTSTRAP_DEPENDS
! 9386: BROKEN BROKEN_EXCEPT_ON_PLATFORM
! 9387: BROKEN_ON_PLATFORM BSDSRCDIR
! 9388: BSDXSRCDIR BSD_MAKE_ENV
! 9389: BUILDLINK_AUTO_DIRS BUILDLINK_AUTO_VARS
! 9390: BUILDLINK_CFLAGS BUILDLINK_CONTENTS_FILTER
! 9391: BUILDLINK_CPPFLAGS BUILDLINK_FILES
1.232 gutterid 9392: BUILDLINK_FILES_CMD BUILDLINK_FNAME_TRANSFORM
9393: BUILDLINK_LDFLAGS BUILDLINK_LIBS
9394: BUILDLINK_OPSYS_SUPPORT_PTHREAD BUILDLINK_PKGNAME
9395: BUILDLINK_PREFIX BUILDLINK_RPATHDIRS
9396: BUILDLINK_TREE BUILD_DEFS
9397: BUILD_DEFS_EFFECTS BUILD_DEPENDS
9398: BUILD_DIRS BUILD_ENV_SHELL
9399: BUILD_MAKE_CMD BUILD_MAKE_FLAGS
9400: BUILD_TARGET BUILTIN_FIND_FILES
9401: BUILTIN_FIND_FILES_VAR BUILTIN_FIND_GREP
9402: BUILTIN_FIND_HEADERS BUILTIN_FIND_HEADERS_VAR
9403: BUILTIN_FIND_PKGCONFIG BUILTIN_FIND_PKGCONFIG_VAR
9404: BUILTIN_PKG BUILTIN_TEST_CURSES_DEFINES
9405: BUILTIN_TEST_CURSES_FUNCS BUILTIN_VERSION_SCRIPT
9406: BUILTIN_X11_TYPE BUILTIN_X11_VERSION
9407: CACTI_GROUP CACTI_USER
9408: CANNA_GROUP CANNA_USER
9409: CAT CBLAS_LIBS
9410: CBLAS_PC CCACHE_BASE
9411: CCACHE_DIR CCACHE_LOGFILE
9412: CC_VERSION CC_VERSION_STRING
9413: CDRECORD_CONF CDROM_PKG_URL_DIR
9414: CDROM_PKG_URL_HOST CHANGES
1.239 ! dholland 9415: CHECK_COMPILER CHECK_FAKEHOME
! 9416: CHECK_FILES CHECK_FILES_SKIP
! 9417: CHECK_FILES_STRICT CHECK_HEADERS
! 9418: CHECK_HEADERS_SKIP CHECK_INTERPRETER
! 9419: CHECK_INTERPRETER_SKIP CHECK_PERMS
! 9420: CHECK_PERMS_AUTOFIX CHECK_PERMS_SKIP
! 9421: CHECK_PIE CHECK_PIE_SKIP
! 9422: CHECK_PIE_SUPPORTED CHECK_PORTABILITY
! 9423: CHECK_PORTABILITY_EXPERIMENTAL CHECK_PORTABILITY_SKIP
! 9424: CHECK_RELRO CHECK_RELRO_SKIP
! 9425: CHECK_RELRO_SUPPORTED CHECK_SHLIBS
! 9426: CHECK_SHLIBS_SKIP CHECK_SHLIBS_SUPPORTED
! 9427: CHECK_SHLIBS_TOXIC CHECK_SSP
! 9428: CHECK_SSP_SKIP CHECK_SSP_SUPPORTED
! 9429: CHECK_STRIPPED CHECK_STRIPPED_SKIP
! 9430: CHECK_WRKREF CHECK_WRKREF_EXTRA_DIRS
! 9431: CHECK_WRKREF_SKIP CLAMAV_DBDIR
! 9432: CLAMAV_GROUP CLAMAV_USER
! 9433: CLANGBASE CLEANDEPENDS
! 9434: CMAKE_DEPENDENCIES_REWRITE CMAKE_INSTALL_NAME_DIR
! 9435: CMAKE_INSTALL_PREFIX CMAKE_MODULE_PATH_OVERRIDE
! 9436: CMAKE_PKGSRC_BUILD_FLAGS CMAKE_PREFIX_PATH
! 9437: CMAKE_USE_GNU_INSTALL_DIRS COMPILER_RPATH_FLAG
1.232 gutterid 9438: COMPILER_USE_SYMLINKS CONFIGURE_ARGS
9439: CONFIGURE_DIRS CONFIGURE_ENV
9440: CONFIGURE_ENV_SHELL CONFIGURE_HAS_INFODIR
9441: CONFIGURE_HAS_MANDIR CONFIGURE_SCRIPT
9442: CONFIG_SHELL CONFIG_SHELL_FLAGS
9443: CONF_FILES CONF_FILES_MODE
9444: CONF_FILES_PERMS CONSERVER_DEFAULTHOST
9445: CONSERVER_DEFAULTPORT CP
9446: CPE CPE_EDITION
9447: CPE_LANG CPE_OTHER
9448: CPE_PART CPE_PRODUCT
9449: CPE_SW_EDITION CPE_TARGET_HW
9450: CPE_TARGET_SW CPE_UPDATE
9451: CPE_URI CPE_VENDOR
9452: CPE_VERSION CPP
9453: CPP_PRECOMP_FLAGS CREATE_WRKDIR_SYMLINK
9454: CROSSBASE CTFCONVERT
9455: CTF_FILES_SKIP CTF_SUPPORTED
9456: CTYPE CUPS_GROUP
9457: CUPS_SYSTEM_GROUPS CUPS_USER
9458: CURSES_DEFAULT CURSES_TYPE
1.239 ! dholland 9459: CXX CYRUS_GROUP
! 9460: CYRUS_IDLE CYRUS_USER
! 9461: DAEMONTOOLS_GROUP DAEMONTOOLS_LOG_USER
! 9462: DARWIN_NO_SYSTEM_LIBS DARWIN_REQUIRES_FILTER
! 9463: DBUS_GROUP DBUS_USER
! 9464: DEFANG_GROUP DEFANG_USER
! 9465: DEFAULT_ACCEPTABLE_LICENSES DEFAULT_DISTFILES
! 9466: DEFAULT_IRC_SERVER DEFAULT_SERIAL_DEVICE
! 9467: DEF_UMASK DEINSTALLDEPENDS
! 9468: DEINSTALL_SRC DEINSTALL_TEMPLATES
! 9469: DELAYED_ERROR_MSG DELAYED_WARNING_MSG
! 9470: DEPENDS DEPENDS_TARGET
! 9471: DEPENDS_TYPE DESTDIR
! 9472: DESTDIR_VARNAME DIALER_GROUP
! 9473: DIGEST_REQD DISTDIR
! 9474: DISTFILES DISTINFO_FILE
! 9475: DISTNAME DIST_PATH
! 9476: DIST_SUBDIR DJBDNS_AXFR_USER
! 9477: DJBDNS_CACHE_USER DJBDNS_DJBDNS_GROUP
! 9478: DJBDNS_LOG_USER DJBDNS_RBL_USER
! 9479: DJBDNS_TINY_USER DLOPEN_REQUIRE_PTHREADS
! 9480: DL_AUTO_VARS DL_CFLAGS
! 9481: DL_LDFLAGS DL_LIBS
! 9482: DNS DOCOWN
! 9483: DOWNLOADED_DISTFILE DQCACHE_GROUP
! 9484: DQCACHE_USER DT_LAYOUT
! 9485: DYNAMIC_SITES_CMD DYNAMIC_SITES_SCRIPT
! 9486: ECHO ECHO_N
! 9487: ELK_GUI EMACS_TYPE
! 9488: EMULDIR EMULSUBDIR
! 9489: EMULSUBDIRSLASH EMUL_ARCH
! 9490: EMUL_DISTRO EMUL_EXEC_FMT
! 9491: EMUL_IS_NATIVE EMUL_MODULES
! 9492: EMUL_OPSYS EMUL_PKG_FMT
! 9493: EMUL_PLATFORM EMUL_PLATFORMS
! 9494: EMUL_PREFER EMUL_REQD
! 9495: EMUL_TYPE ERROR_MSG
! 9496: EXIM_GROUP EXIM_USER
! 9497: EXPORT_SYMBOLS_LDFLAGS EXTRACTOR
! 9498: EXTRACT_CMD EXTRACT_CMD_DEFAULT
! 9499: EXTRACT_DIR EXTRACT_ELEMENTS
! 9500: EXTRACT_ENV EXTRACT_ONLY
! 9501: EXTRACT_OPTS EXTRACT_SUFX
! 9502: EXTRACT_USING FAIL
! 9503: FAILOVER_FETCH FAIL_MSG
! 9504: FAKE_NCURSES FAM
! 9505: FAM_ACCEPTED FAM_DEFAULT
! 9506: FAM_SERVER FCPATH
! 9507: FEATURE_CPPFLAGS FEATURE_LDFLAGS
! 9508: FEATURE_LIBS FETCH_AFTER_ARGS
! 9509: FETCH_BEFORE_ARGS FETCH_CMD
! 9510: FETCH_OUTPUT_ARGS FETCH_PROXY
! 9511: FETCH_RESUME_ARGS FETCH_TIMEOUT
! 9512: FETCH_USE_IPV4_ONLY FETCH_USING
! 9513: FILES_SUBST FILES_SUBST_SED
! 9514: FIX_SYSTEM_HEADERS FONTS_DIRS
1.232 gutterid 9515: FONTS_VERBOSE FOO_HACKS_MK
9516: FOX_USE_XUNICODE FREEWNN_GROUP
9517: FREEWNN_USER FTP_PKG_URL_DIR
9518: FTP_PKG_URL_HOST GAMEDATAMODE
9519: GAMEDATA_PERMS GAMEDIRMODE
9520: GAMEDIR_PERMS GAMEGRP
9521: GAMEMODE GAMEOWN
9522: GAMES_GROUP GAMES_USER
9523: GCC GCCBASE
9524: GCC_REQD GCC_VERSION_SUFFIX
9525: GEM_BUILD GEM_CLEANBUILD
9526: GEM_CLEANBUILD_EXTENSIONS GEM_DOCDIR
9527: GEM_EXTSDIR GEM_HOME
9528: GEM_KEEPBUILD GEM_LIBDIR
9529: GEM_NAME GEM_PATH
9530: GEM_PLUGINSDIR GEM_SPECFILE
9531: GENERATE_PLIST GHC
9532: GHOSTSCRIPT_REQD GITHUB_PROJECT
9533: GITHUB_RELEASE GITHUB_SUBMODULES
9534: GITHUB_TAG GITHUB_TYPE
9535: GITLAB_PROJECT GITLAB_RELEASE
9536: GITLAB_SUBMODULES GITLAB_TAG
1.239 ! dholland 9537: GITLAB_TYPE GNU
! 9538: GNU_CONFIGURE GNU_CONFIGURE_INFODIR
! 9539: GNU_CONFIGURE_MANDIR GNU_CONFIGURE_QUIET
! 9540: GNU_CONFIGURE_STRICT GODEP_REDIRECTS
! 9541: GO_BUILD_PATTERN GO_DEPS
! 9542: GO_DIST_BASE GO_EXTRA_MOD_DIRS
! 9543: GO_MODULE_FILES GO_SRCPATH
! 9544: GROUP_SPECIFIC_PKGS GRUB_NETWORK_CARDS
! 9545: GRUB_PRESET_COMMAND GRUB_SCAN_ARGS
! 9546: GZIP HASKELL_ENABLE_DYNAMIC_EXECUTABLE
1.232 gutterid 9547: HASKELL_ENABLE_HADDOCK_DOCUMENTATION HASKELL_ENABLE_LIBRARY_PROFILING
1.236 gutterid 9548: HASKELL_ENABLE_SHARED_LIBRARY HASKELL_ENABLE_TESTS
9549: HASKELL_OPTIMIZATION_LEVEL HASKELL_PKG_NAME
9550: HASKELL_UNRESTRICT_DEPENDENCIES HEADER_TEMPLATES
1.239 ! dholland 9551: HOMEPAGE HOST_PKGTOOLS_ARGS
! 9552: HOST_SPECIFIC_PKGS HOWL_GROUP
! 9553: HOWL_USER ICCBASE
! 9554: ICECAST_CHROOTDIR ICON_THEMES
! 9555: IDOBASE IGNORE_CCACHE
! 9556: IGNORE_INFO_DIRS IGNORE_INTERACTIVE_FETCH
! 9557: IMAKE IMAKEOPTS
! 9558: IMAKE_MAKE IMAKE_MANINSTALL
! 9559: IMAP_UW_CCLIENT_MBOX_FMT IMDICTDIR
! 9560: INCOMPAT_CURSES INFO_DIR
! 9561: INFO_FILES INFO_FILES_VERBOSE
1.236 gutterid 9562: INFO_MSG INIT_SYSTEM
9563: INN_DATA_DIR INN_GROUP
9564: INN_USER INSTALLATION_DIRS
9565: INSTALLATION_DIRS_FROM_PLIST INSTALL_ENV
9566: INSTALL_SH_OVERRIDE INSTALL_SRC
9567: INSTALL_TEMPLATES INSTALL_UNSTRIPPED
9568: IRCD_HYBRID_IRC_GROUP IRCD_HYBRID_IRC_USER
9569: IRCD_HYBRID_MAXCONN IRCD_HYBRID_NICLEN
9570: IRCD_HYBRID_SYSLOG_EVENTS IRCD_HYBRID_SYSLOG_FACILITY
9571: IRCD_HYBRID_TOPICLEN IRIX
9572: IRRD_USE_PGP JABBERD_GROUP
9573: JABBERD_LOGDIR JABBERD_PIDDIR
9574: JABBERD_SPOOLDIR JABBERD_USER
9575: JAVA_BINPREFIX JAVA_CLASSPATH
9576: JAVA_HOME JAVA_LD_LIBRARY_PATH
9577: JAVA_NAME JAVA_UNLIMIT
9578: JAVA_WRAPPERS JPEG_ACCEPTED
9579: JPEG_DEFAULT KERBEROS
9580: KERMIT_SUID_UUCP KJS_USE_PCRE
9581: KNEWS_DOMAIN_FILE KNEWS_DOMAIN_NAME
9582: KRB5_ACCEPTED KRB5_DEFAULT
9583: LANGUAGES LAPACKE_LIBS
9584: LAPACKE_PC LAPACK_LIBS
9585: LAPACK_PC LATEX2HTML_ICONPATH
9586: LDCONFIG_ADD_CMD LDCONFIG_REMOVE_CMD
9587: LDD LEAFNODE_DATA_DIR
9588: LEAFNODE_GROUP LEAFNODE_USER
9589: LIBDVDCSS_HOMEPAGE LIBDVDCSS_MASTER_SITES
9590: LIBRSVG_TYPE LIBTOOL
9591: LIBTOOLIZE_PLIST LIBTOOL_M4_OVERRIDE
9592: LIBUSB_TYPE LICENSE
9593: LINKER_RPATH_FLAG LINK_RPATH_FLAG
1.239 ! dholland 9594: LINUX_LOCALES LOCALBASE
! 9595: LOCALBASE_LOCKTYPE LOCALPATCHES
! 9596: LOVE_DATA LOVE_GAME
! 9597: LOVE_VERSION LP32PLATFORMS
! 9598: LP64PLATFORMS LUA_BUSTED_ARGS
! 9599: LUA_CDIR LUA_COMPILER
! 9600: LUA_DOCDIR LUA_EXAMPLESDIR
! 9601: LUA_INCDIR LUA_INTERPRETER
! 9602: LUA_LDIR LUA_LINKER_MAGIC
! 9603: LUA_PKGPREFIX LUA_SELF_CONFLICT
! 9604: LUA_USE_BUSTED LUA_VERSIONS_ACCEPTED
! 9605: LUA_VERSIONS_INCOMPATIBLE LUA_VERSION_DEFAULT
! 9606: LUA_VERSION_REQD Lua
! 9607: MACHINE_PLATFORM MAILAGENT_DOMAIN
! 9608: MAILAGENT_EMAIL MAILAGENT_FQDN
! 9609: MAILAGENT_ORGANIZATION MAJORDOMO_HOMEDIR
1.236 gutterid 9610: MAKEINFO_ARGS MAKE_DIRS
9611: MAKE_DIRS_PERMS MAKE_ENV
9612: MAKE_FILE MAKE_FLAGS
9613: MAKE_JOBS MAKE_JOBS_SAFE
9614: MAKE_PROGRAM MANCOMPRESSED_IF_MANZ
9615: MANINSTALL MANZ
9616: MASTER_SITES MASTER_SITE_BACKUP
9617: MASTER_SITE_LOCAL MASTER_SITE_MOZILLA
9618: MASTER_SITE_OVERRIDE MASTER_SITE_PERL_CPAN
9619: MASTER_SORT MASTER_SORT_RANDOM
9620: MASTER_SORT_REGEX MECAB_CHARSET
9621: MEDIATOMB_GROUP MEDIATOMB_USER
9622: MIPSPROBASE MIREDO_GROUP
9623: MIREDO_USER MISSING_FEATURES
9624: MKDIR MKPIE_SUPPORTED
9625: MLDONKEY_GROUP MLDONKEY_HOME
9626: MLDONKEY_USER MONOTONE_GROUP
9627: MONOTONE_USER MOTIFBASE
9628: MOTIF_TYPE MOTIF_TYPE_DEFAULT
9629: MPI_TYPE MSGFMT_STRIP_MSGCTXT
9630: MSGFMT_STRIP_MSGID_PLURAL MTOOLS_ENABLE_FLOPPYD
1.239 ! dholland 9631: MV MYSQL_CHARSET
! 9632: MYSQL_DATADIR MYSQL_EXTRA_CHARSET
! 9633: MYSQL_GROUP MYSQL_USER
! 9634: MYSQL_VERSION MYSQL_VERSIONS_ACCEPTED
! 9635: MYSQL_VERSIONS_ALL MYSQL_VERSION_DEFAULT
! 9636: NAGIOSCMD_GROUP NAGIOSDIR
! 9637: NAGIOS_GROUP NAGIOS_USER
! 9638: NATIVE_APPEND_ABI NATIVE_APPEND_ELF
! 9639: NATIVE_EXEC_FMT NATIVE_MACHINE_PLATFORM
! 9640: NATIVE_OBJECT_FMT NBPAX_PROGRAM_PREFIX
! 9641: NETBSD_LOGIN_NAME NMH_EDITOR
! 9642: NMH_MTA NMH_PAGER
! 9643: NODE_VERSIONS_ACCEPTED NODE_VERSIONS_INCOMPATIBLE
! 9644: NODE_VERSION_DEFAULT NODE_VERSION_REQD
! 9645: NOLOGIN NOTE
! 9646: NOT_FOR_PLATFORM NOT_PAX_ASLR_SAFE
! 9647: NOT_PAX_MPROTECT_SAFE NO_BUILD
! 9648: NO_CHECKSUM NO_CONFIGURE
! 9649: NO_SKIP NS_PREFERRED
! 9650: NULLMAILER_GROUP NULLMAILER_USER
! 9651: OBJHOSTNAME OBJMACHINE
! 9652: OCAML_FINDLIB_DIRS OCAML_FINDLIB_REGISTER
! 9653: OCAML_FINDLIB_REGISTER_VERBOSE OCAML_SITELIBDIR
! 9654: OMF ONLY_FOR_COMPILER
! 9655: ONLY_FOR_PLATFORM OPENSSH_CHROOT
! 9656: OPENSSH_GROUP OPENSSH_USER
! 9657: OPSYS OPSYS_EMULDIR
! 9658: OPSYS_VERSION OS
! 9659: OSS_TYPE OSX
! 9660: OSX_TOLERATE_SDK_SKEW OS_VARIANT
! 9661: OS_VERSION OTF_FONTS_DIR
! 9662: OVERRIDE_DIRDEPTH OVERRIDE_GEMSPEC
! 9663: OVERRIDE_GNU_CONFIG_SCRIPTS OWN_DIRS
1.233 wiz 9664: OWN_DIRS_PERMS P4GROUP
9665: P4PORT P4ROOT
9666: P4USER PACKAGES
9667: PALMOS_DEFAULT_SDK PAMBASE
9668: PAM_DEFAULT PAPERSIZE
9669: PASSIVE_FETCH PATCHDIR
9670: PATCHFILES PATCH_ARGS
9671: PATCH_DEBUG PATCH_DIST_ARGS
9672: PATCH_DIST_CAT PATCH_DIST_STRIP
9673: PATCH_FUZZ_FACTOR PATCH_STRIP
9674: PATH PCCBASE
9675: PEAR_CMD PEAR_LIB
9676: PEAR_PACKAGE_XML PERL5
9677: PERL5_CONFIGURE PERL5_CONFIGURE_DIRS
9678: PERL5_LDFLAGS PERL5_LICENSE
9679: PERL5_MODULE_TYPE PERL5_PACKLIST
9680: PERL5_PACKLIST_DIR PERL5_PERLBASE
9681: PERL5_SITEBASE PERL5_USE_PACKLIST
9682: PERL5_VENDORBASE PFCTL
9683: PFVAR_H PF_VERSION
9684: PGGROUP PGHOME
9685: PGPKGSRCDIR PGSQL_TYPE
9686: PGSQL_VERSION PGSQL_VERSIONS_ACCEPTED
9687: PGSQL_VERSION_DEFAULT PGUSER
9688: PG_LIB_EXT PHP
9689: PHPCOMMON_MK PHPPKGSRCDIR
9690: PHP_BASE_VERS PHP_CHECK_INSTALLED
9691: PHP_EXTENSION_DIR PHP_INITIAL_TEENY
9692: PHP_PKG_PREFIX PHP_VERSION
9693: PHP_VERSIONS_ACCEPTED PHP_VERSIONS_INCOMPATIBLE
9694: PHP_VERSION_DEFAULT PHP_VERSION_REQD
9695: PILRC_USE_GTK PKGCONFIG_BASE
9696: PKGCONFIG_FILE PKGCONFIG_OVERRIDE
9697: PKGCONFIG_OVERRIDE_STAGE PKGDIR
9698: PKGGNUDIR PKGINFODIR
9699: PKGLOCALEDIR PKGMANDIR
9700: PKGNAME PKGNAME_REQD
9701: PKGPATH PKGREVISION
9702: PKGSRC_BLAS_TYPES PKGSRC_CHANGES
9703: PKGSRC_COMPILER PKGSRC_KEEP_BIN_PKGS
9704: PKGSRC_LOCKTYPE PKGSRC_MAKE_ENV
9705: PKGSRC_MESSAGE_RECIPIENTS PKGSRC_MKPIE
9706: PKGSRC_MKREPRO PKGSRC_OVERRIDE_MKPIE
9707: PKGSRC_RUN_TEST PKGSRC_SETENV
9708: PKGSRC_SLEEPSECS PKGSRC_TODO
9709: PKGSRC_USE_CTF PKGSRC_USE_FORTIFY
9710: PKGSRC_USE_MKTOOLS PKGSRC_USE_RELRO
9711: PKGSRC_USE_SSP PKGSRC_USE_STACK_CHECK
9712: PKGTASKS_DATAFILE PKGTOOLS_ARGS
9713: PKGTOOLS_ENV PKG_ALTERNATIVES
9714: PKG_APACHE PKG_APACHE_ACCEPTED
9715: PKG_APACHE_DEFAULT PKG_BEST_EXISTS
9716: PKG_BUILD_OPTIONS PKG_COMPRESSION
9717: PKG_CONFIG PKG_CONFIG_PERMS
9718: PKG_CREATE_USERGROUP PKG_DB_TMPDIR
9719: PKG_DEBUG_LEVEL PKG_DEFAULT_OPTIONS
9720: PKG_DESTDIR_SUPPORT PKG_DEVELOPER
9721: PKG_DISABLED_OPTIONS PKG_FATAL_ERRORS
9722: PKG_FC PKG_FILELIST_CMD
9723: PKG_GECOS PKG_GID
9724: PKG_GROUPS PKG_GROUPS_VARS
9725: PKG_HOME PKG_INIT_SCRIPTS
9726: PKG_JAVA_HOME PKG_JVM
9727: PKG_JVMS_ACCEPTED PKG_JVM_DEFAULT
9728: PKG_LEGACY_OPTIONS PKG_LIBTOOL
9729: PKG_MKSYMLINKS PKG_OPTIONS
9730: PKG_OPTIONS_DEPRECATED_WARNINGS PKG_OPTIONS_LEGACY_OPTS
9731: PKG_OPTIONS_LEGACY_VARS PKG_OPTIONS_NONEMPTY_SETS
9732: PKG_OPTIONS_OPTIONAL_GROUPS PKG_OPTIONS_REQUIRED_GROUPS
9733: PKG_OPTIONS_VAR PKG_PHP
9734: PKG_PHP_MAJOR_VERS PKG_PHP_VERSION
9735: PKG_RCD_SCRIPTS PKG_REFCOUNT_DBDIR
9736: PKG_REGISTER_SHELLS PKG_RESUME_TRANSFERS
9737: PKG_SHELL PKG_SUGGESTED_OPTIONS
9738: PKG_SUPPORTED_OPTIONS PKG_SYSCONFBASE
9739: PKG_SYSCONFBASEDIR PKG_SYSCONFDIR
9740: PKG_SYSCONFDIR_PERMS PKG_SYSCONFSUBDIR
9741: PKG_SYSCONFVAR PKG_TOOLS_BIN
9742: PKG_UID PKG_UPDATE_FONTS_DB
9743: PKG_USERS PKG_USERS_VARS
9744: PKG_VERBOSE PLEASE
9745: PLIST PLIST_AWK
9746: PLIST_AWK_ENV PLIST_SRC
9747: PLIST_SUBST PLIST_TYPE
9748: PLIST_VARS POPTOP_USE_MPPE
9749: POSSIBLE_GFORTRAN_VERSION POST_FETCH_HOOK
9750: PREFER PREFER_NATIVE
9751: PREFER_NATIVE_PTHREADS PREFER_PKGSRC
9752: PREFIX PREPEND_PATH
9753: PRE_ROOT_CMD PRIVILEGED_STAGES
9754: PS PTHREAD_AUTO_VARS
9755: PTHREAD_CFLAGS PTHREAD_LDFLAGS
9756: PTHREAD_LIBS PTHREAD_OPTS
9757: PTHREAD_TYPE PVM_SSH
9758: PYPKGPREFIX PYTHON_FOR_BUILD_ONLY
1.237 gutterid 9759: PYTHON_SELF_CONFLICT PYTHON_VERSION
9760: PYTHON_VERSIONED_DEPENDENCIES PYTHON_VERSIONS_ACCEPTED
9761: PYTHON_VERSIONS_INCOMPATIBLE PYTHON_VERSION_DEFAULT
9762: PYTHON_VERSION_REQD PYVERSSUFFIX
9763: QMAILDIR QMAIL_ALIAS_USER
9764: QMAIL_DAEMON_USER QMAIL_LOG_USER
9765: QMAIL_NOFILES_GROUP QMAIL_PASSWD_USER
9766: QMAIL_QMAIL_GROUP QMAIL_QUEUE_DIR
9767: QMAIL_QUEUE_EXTRA QMAIL_QUEUE_USER
9768: QMAIL_REMOTE_USER QMAIL_ROOT_USER
9769: QMAIL_SEND_USER QORE_LATEST_MODULE_API
9770: QORE_MODULE_API QORE_MODULE_DIR
9771: QORE_USER_MODULE_DIR QORE_VERSION
9772: QPOPPER_FAC QPOPPER_SPOOL_DIR
9773: QPOPPER_USER RAKE_NAME
1.239 ! dholland 9774: RASMOL_DEPTH RCD_SCRIPTS
1.237 gutterid 9775: RCD_SCRIPTS_DIR RCD_SCRIPTS_EXAMPLEDIR
9776: RCD_SCRIPTS_MODE RCD_SCRIPTS_SHELL
1.239 ! dholland 9777: RCD_SCRIPT_SRC RDOC
! 9778: READLINE_ACCEPTED READLINE_DEFAULT
1.238 wiz 9779: READLINE_TYPE REAL_ROOT_GROUP
9780: REAL_ROOT_USER RECURSIVE_MAKE
9781: RELAY_CTRL_DIR RELRO_SUPPORTED
9782: REPLACE_AWK REPLACE_BASH
9783: REPLACE_CSH REPLACE_KSH
9784: REPLACE_LUA REPLACE_NODEJS
9785: REPLACE_OCTAVE REPLACE_PERL
9786: REPLACE_PERL6 REPLACE_PHP
9787: REPLACE_PYTHON REPLACE_QORE
9788: REPLACE_R REPLACE_RUBY
9789: REPLACE_RUBY_DIRS REPLACE_RUBY_PAT
9790: REPLACE_SH REPLACE_TEXLUA
9791: REPLACE_WISH REQD_DIRS
9792: REQD_DIRS_PERMS REQD_FILES
9793: REQD_FILES_MODE REQD_FILES_PERMS
9794: RESOLV_AUTO_VARS RESOLV_LDFLAGS
9795: RESOLV_LIBS RM
9796: ROOT_CMD ROOT_GROUP
9797: ROOT_USER RPCGEN
9798: RPM RPM2PKG_PLIST
9799: RPM2PKG_PREFIX RPM2PKG_STAGE
9800: RPM2PKG_STRIP RPM2PKG_SUBPREFIX
9801: RPMFILES RPMIGNOREPATH
9802: RPM_DB_PREFIX RSSH_CVS_PATH
9803: RSSH_RDIST_PATH RSSH_RSYNC_PATH
9804: RSSH_SCP_PATH RSSH_SFTP_SERVER_PATH
9805: RUBY RUBYGEM
9806: RUBYGEM_MANPAGES RUBYGEM_NAME
9807: RUBYGEM_OPTIONS RUBYGEM_USE_MANPAGES
9808: RUBYGEM_VERBOSE RUBY_ABI_VERSION
9809: RUBY_ARCH RUBY_ARCHINC
9810: RUBY_ARCHLIB RUBY_BASE
9811: RUBY_BASERIDIR RUBY_BUILD_DOCUMENT
9812: RUBY_DLEXT RUBY_DOC
9813: RUBY_DYNAMIC_DIRS RUBY_EG
9814: RUBY_ENCODING_ARG RUBY_EXTCONF
9815: RUBY_EXTCONF_CHECK RUBY_EXTCONF_DEBUG
9816: RUBY_EXTCONF_MAKEFILE RUBY_GEM_ARCH
9817: RUBY_GEM_BASE RUBY_INC
9818: RUBY_LIB RUBY_LIB_BASE
9819: RUBY_NAME RUBY_NOVERSION
9820: RUBY_PKGPREFIX RUBY_RAILS
9821: RUBY_RAILS52_VERSION RUBY_RAILS60_VERSION
9822: RUBY_RAILS61_VERSION RUBY_RAILS70_VERSION
9823: RUBY_RAILS_ACCEPTED RUBY_RAILS_DEFAULT
9824: RUBY_RAILS_REQD RUBY_RAILS_STRICT_DEP
9825: RUBY_RIDIR RUBY_SETUP
9826: RUBY_SHLIB RUBY_SHLIBALIAS
9827: RUBY_SHLIBVER RUBY_SIMPLE_INSTALL
9828: RUBY_SITEARCHLIB RUBY_SITELIB
9829: RUBY_SITELIB_BASE RUBY_SITERIDIR
9830: RUBY_SLEXT RUBY_SRCDIR
9831: RUBY_STATICLIB RUBY_SUFFIX
9832: RUBY_SYSRIDIR RUBY_USE_PTHREAD
9833: RUBY_VENDORARCHLIB RUBY_VENDORLIB
9834: RUBY_VENDORLIB_BASE RUBY_VER
9835: RUBY_VERSION RUBY_VERSIONS_ACCEPTED
9836: RUBY_VERSIONS_INCOMPATIBLE RUBY_VERSION_DEFAULT
9837: RUBY_VERSION_REQD RUBY_VER_DIR
9838: RUN RUN_LDCONFIG
9839: RUST_TYPE SCO
9840: SCREWS_GROUP SCREWS_USER
9841: SCRIPTS_ENV SCROLLKEEPER_DATADIR
9842: SCROLLKEEPER_REBUILDDB SCROLLKEEPER_UPDATEDB
9843: SDIST_PAWD SDL12_TYPE
9844: SERIAL_DEVICES SETGIDGAME
9845: SETGID_GAMES_PERMS SETUID_ROOT_PERMS
9846: SH SHLIB
1.239 ! dholland 9847: SIGN_PACKAGES SILC_CLIENT_WITH_PERL
! 9848: SITE_SPECIFIC_PKGS SKIP_DEPENDS
! 9849: SMF_INSTANCES SMF_MANIFEST
! 9850: SMF_METHODS SMF_METHOD_SHELL
! 9851: SMF_METHOD_SRC SMF_NAME
! 9852: SMF_PREFIX SMF_SRCDIR
! 9853: SNIPROXY_GROUP SNIPROXY_USER
! 9854: SOURCE_BUFFSIZE SPECIAL_PERMS
! 9855: SPECIFIC_PKGS SSH_SUID
! 9856: SSP_SUPPORTED SSYNC_PAWD
! 9857: STEP_MSG STRIP
! 9858: STRIP_DBG STRIP_DEBUG
! 9859: STRIP_DEBUG_SUPPORTED STRIP_FILES_SKIP
! 9860: SU SUBDIR
! 9861: SUBST SUBST_CLASSES
! 9862: SUBST_FILES SUBST_FILTER_CMD
! 9863: SUBST_MESSAGE SUBST_NOOP_OK
! 9864: SUBST_SED SUBST_SHOW_DIFF
! 9865: SUBST_SKIP_TEXT_CHECK SUBST_STAGE
! 9866: SUBST_VARS SUNWSPROBASE
! 9867: SUSE_PREFER SU_CMD
! 9868: SYSCONFBASE TARGET_ARCH
! 9869: TBL TERMCAP_TYPE
! 9870: TERMINFO_DEFAULT TERMINFO_TYPE
! 9871: TEST TEST_DEPENDS
! 9872: TEST_DIRS TEST_ENV
! 9873: TEST_ENV_SHELL TEST_MAKE_CMD
! 9874: TEST_MAKE_FLAGS TEST_TARGET
! 9875: TEXLIVE_IGNORE_PATTERNS TEXLIVE_REV
! 9876: TEXLIVE_UNVERSIONED TEXMFSITE
! 9877: TEX_FORMATS TEX_HYPHEN_DAT
! 9878: TEX_HYPHEN_DEF TEX_TEXMF_DIRS
! 9879: THTTPD_LOG_FACILITY TINYDYN_USER
! 9880: TLSWRAPPER_CHROOT TO
! 9881: TOOLS_ALIASES TOOLS_ALWAYS_WRAP
! 9882: TOOLS_ARGS TOOLS_BROKEN
! 9883: TOOLS_CMD TOOLS_CMDLINE_SED
! 9884: TOOLS_CREATE TOOLS_CROSS_DESTDIR
! 9885: TOOLS_DIR TOOLS_FAIL
! 9886: TOOLS_GNU_MISSING TOOLS_LDCONFIG
! 9887: TOOLS_NOOP TOOLS_PATH
! 9888: TOOLS_SCRIPT TOOLS_USE_CROSS_COMPILE
! 9889: TOOL_DEPENDS TTF_FONTS_DIR
1.238 wiz 9890: TYPE UAC_REQD_EXECS
9891: UCSPI_SSL_GROUP UCSPI_SSL_USER
9892: UNLIMIT_RESOURCES UNPRIVILEGED
9893: UNPRIVILEGED_GROUP UNPRIVILEGED_GROUPS
9894: UNPRIVILEGED_USER UNWRAP_FILES
9895: UNWRAP_PATTERNS UPDATE_GEMSPEC
9896: UPDATE_TARGET URI
9897: USERGROUP_PHASE USERPPP_GROUP
9898: USER_SPECIFIC_PKGS USE_ABI_DEPENDS
9899: USE_APR USE_BSD_MAKEFILE
9900: USE_BUILTIN USE_CROSS_COMPILE
9901: USE_CURSES USE_CWRAPPERS
9902: USE_DB185 USE_FEATURES
9903: USE_GAMESGROUP USE_GCC_RUNTIME
9904: USE_IMAKE USE_JAVA
9905: USE_JAVA2 USE_LANGUAGES
9906: USE_LIBTOOL USE_NATIVE_GCC
9907: USE_NETBSD_REPO USE_PKGSRC_GCC
9908: USE_PKGSRC_GCC_RUNTIME USE_PKGTASKS
9909: USE_PKG_ADMIN_DIGEST USE_RUBY_EXTCONF
9910: USE_RUBY_INSTALL USE_RUBY_SETUP
9911: USE_RUBY_SETUP_PKG USE_TOOLS
9912: UUCP_GROUP UUCP_USER
9913: VARBASE VARNAME
9914: VIM_EXTRA_OPTS WARNING_MSG
9915: WCALC_CGIDIR WCALC_CGIPATH
9916: WCALC_HTMLDIR WCALC_HTMLPATH
9917: WDM_MANAGERS WRAPPER_CC
9918: WRAPPER_REORDER_CMDS WRKDIR
9919: WRKDIR_BASENAME WRKDIR_LOCKTYPE
9920: WRKLOG WRKOBJDIR
9921: WRKSRC X10_PORT
9922: X11 X11BASE
9923: X11_PKGSRCDIR X11_TYPE
9924: X509_CERTIFICATE X509_KEY
9925: XAW_TYPE XLOCK_DEFAULT_MODE
9926: XMKMF XMKMF_FLAGS
1.239 ! dholland 9927: XXX YES
! 9928: ZSH_STATIC __stdc__
! 9929: _vargroups accept
! 9930: acquire-localbase-lock acquire-lock
! 9931: add added
! 9932: administrator alloca
! 9933: alternatives aslr
! 9934: asprintf atlas
! 9935: autoconf automake
! 9936: autoreconf awk
! 9937: bash big-endian
! 9938: bin-install bind
! 9939: binpkg-list blas
! 9940: bootstrap-depends broken
! 9941: broken_on_platform bsd
! 9942: bsd.prog.mk build
! 9943: build-env buildlink-directories
! 9944: buildlink-oss-soundcard-h c
! 9945: c++ ccache
! 9946: cce cdefs
! 9947: ceil changes
! 9948: changes-entry changes-entry-noupdate
! 9949: check check-clean
! 9950: check-files check-files-clean
! 9951: check-vulnerable checksum
! 9952: checksum-phase clean
! 9953: clean-depends cleandir
! 9954: commit commit-changes-entry
! 9955: compact compiler
! 9956: conf config.guess
! 9957: config.sub configuration
! 9958: configure configure-env
! 9959: configure-help configure_args
! 9960: connect cos
! 9961: cpe cputime
! 9962: create-usergroup csh
! 9963: ctf debug
1.238 wiz 9964: declaration declare
9965: defined depend
9966: dependencies depends
9967: depends-checksum depends-fetch
9968: deps describe
9969: destdir disable
9970: distclean distinfo
9971: dl dlopen
9972: do-buildlink do-clean
9973: do-configure do-configure-post-hook
9974: do-extract do-fetch
9975: do-install emul
9976: emul-distinfo emul-fetch
9977: emulation emulator
9978: enable endian
1.239 ! dholland 9979: enomem ensurepip
! 9980: err errx
! 9981: etc exp
! 9982: extract-rpm fabs
! 9983: feature features
! 9984: fetch fetch-list
! 9985: follows forbids
! 9986: form format
! 9987: fortify fortify_source
1.238 wiz 9988: friend fts
9989: fts_close fts_open
9990: fts_read fts_set
9991: gcc gethostbyaddr
9992: gethostbyname gethostbyname2
9993: getopt_long getprogname
9994: getservbyname getservbyport
9995: getservent gettext
1.239 ! dholland 9996: github gitlab
! 9997: glob gnu
! 9998: gnu_configure_strict go
! 9999: go-deps golang
! 10000: guess-license hashbang
! 10001: heimdal help
1.238 wiz 10002: imake increment
10003: indirect inet_aton
10004: interp interpreter
10005: intl ip4
10006: ip6 ipv4
10007: ipv6 iso
10008: kerberos krb
10009: krb5 ksh
10010: lapack latex
10011: libintl_bindtextdomain libintl_gettext
10012: libintl_textdomain libnbcompat
10013: libs libtool
10014: licence license
10015: lintl little-endian
10016: lock locking
10017: lua lvalue
10018: make makesum
1.239 ! dholland 10019: memory meta
! 10020: meta-package meta_package
! 10021: mit-krb5 mk.conf
! 10022: mkl mount
! 10023: move moved
! 10024: mprotect mremap
! 10025: nb nbcompat
! 10026: netlib node
! 10027: node.js nodejs
! 10028: obstack obstack_ptr_grow
! 10029: occurs only
! 10030: openblas options
! 10031: options.mk order
! 10032: override override-intltool
! 10033: override-message-intltool package
! 10034: parallel path
! 10035: pax paxctl
! 10036: pbulk-index pc
! 10037: perl perl5
! 10038: perms php
! 10039: pkg-build-options pkg-config
! 10040: pkg_build_options platform
! 10041: plist post-extract
! 10042: post-fetch post-wrapper
! 10043: pre-build-checks-hook pre-configure-checks-hook
! 10044: pre-extract pre-fetch
! 10045: print-go-deps print-plist
! 10046: print-summary-data privileged-install-hook
! 10047: pypi python
! 10048: r readme-all
! 10049: recursive recv
! 10050: recvfrom regcomp
! 10051: release-localbase-lock release-lock
! 10052: relro remove
! 10053: removed rename
! 10054: renamed reorder
! 10055: replace replace_interpreter
! 10056: reproducible resolv
! 10057: root ruby
! 10058: send sendfile
! 10059: sendto setenv
! 10060: setgid setprogname
! 10061: setuid sh
! 10062: shebang show
! 10063: show-all show-build-defs
! 10064: show-depends show-depends-dirs
! 10065: show-depends-pkgpaths show-depends-recursive
! 10066: show-deps show-distfiles
! 10067: show-downlevel show-subdir-var
! 10068: show-tools show-var
! 10069: show-vars snprintf
! 10070: socket ssp
! 10071: st_mode stage-install
! 10072: strcasestr strict
! 10073: strip strndup
! 10074: strnlen strsep
! 10075: subst substitutions
1.238 wiz 10076: sun sunpro
1.239 ! dholland 10077: sunwspro symlink
! 10078: test test-env
! 10079: tex texlive
! 10080: tmp todo
! 10081: tool tools
! 10082: tools-libtool-m4-override transitive
! 10083: type ulimit
! 10084: undefined undo-replace
! 10085: unlimit unprivileged
! 10086: unprivileged-install-hook unstripped
! 10087: update updated
! 10088: upload upload-distfiles
! 10089: use_tools user
! 10090: utimes vasprintf
! 10091: verbose vsnprintf
! 10092: warn warning
! 10093: warnings warnx
! 10094: wattr_off wattr_on
! 10095: work wrapper
! 10096: wrkdir
1.154 rillig 10097:
1.207 leot 10098: Appendix F. Editing guidelines for the pkgsrc guide
1.1 dsieger 10099:
10100: Table of Contents
10101:
1.207 leot 10102: F.1. Make targets
10103: F.2. Procedure
1.1 dsieger 10104:
10105: This section contains information on editing the pkgsrc guide itself.
10106:
1.207 leot 10107: F.1. Make targets
1.1 dsieger 10108:
10109: The pkgsrc guide's source code is stored in pkgsrc/doc/guide/files, and several
10110: files are created from it:
10111:
10112: * pkgsrc/doc/pkgsrc.txt
10113:
10114: * pkgsrc/doc/pkgsrc.html
10115:
1.174 leot 10116: * https://www.NetBSD.org/docs/pkgsrc/
1.1 dsieger 10117:
1.174 leot 10118: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.pdf: The PDF version of the
10119: pkgsrc guide.
1.1 dsieger 10120:
1.174 leot 10121: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.ps: PostScript version of the
1.2 rillig 10122: pkgsrc guide.
1.1 dsieger 10123:
1.207 leot 10124: F.2. Procedure
1.1 dsieger 10125:
10126: The procedure to edit the pkgsrc guide is:
10127:
1.190 bacon 10128: 1. Make sure you have checked out the htdocs repository into a sibling
10129: directory of your pkgsrc directory. You will need the ability to commit
10130: from both pkgsrc and htdocs.
10131:
10132: 2. Make sure you have the packages needed to regenerate the pkgsrc guide (and
1.46 obache 10133: other XML-based NetBSD documentation) installed. These are automatically
10134: installed when you install the meta-pkgs/pkgsrc-guide-tools package.
1.1 dsieger 10135:
1.190 bacon 10136: 3. Run cd doc/guide to get to the right directory. All further steps will take
1.1 dsieger 10137: place here.
10138:
1.190 bacon 10139: 4. Edit the XML file(s) in files/.
1.1 dsieger 10140:
1.190 bacon 10141: 5. Run bmake to check the pkgsrc guide for valid XML and to build the final
1.1 dsieger 10142: output files. If you get any errors at this stage, you can just edit the
10143: files, as there are only symbolic links in the working directory, pointing
10144: to the files in files/.
10145:
1.190 bacon 10146: 6. (cd files && cvs commit)
1.1 dsieger 10147:
1.190 bacon 10148: 7. Run bmake clean && bmake to regenerate the output files with the proper RCS
1.1 dsieger 10149: Ids.
10150:
1.190 bacon 10151: 8. Run bmake regen to install and commit the files in both pkgsrc/doc and
1.1 dsieger 10152: htdocs.
10153:
10154: Note
10155:
10156: If you have added, removed or renamed some chapters, you need to
10157: synchronize them using cvs add or cvs delete in the htdocs directory.
10158:
CVSweb <webmaster@jp.NetBSD.org>