Annotation of htdocs/docs/pkgsrc/pkgsrc.txt, revision 1.261
1.1 dsieger 1: The pkgsrc guide
2:
3: Documentation on the NetBSD packages system
4:
5: Alistair Crooks
6:
7: <agc@NetBSD.org>
8:
9: Hubert Feyrer
10:
11: <hubertf@NetBSD.org>
12:
13: The pkgsrc Developers
14:
1.259 leot 15: Copyright 1994-2025 The NetBSD Foundation, Inc
1.1 dsieger 16:
1.259 leot 17: $NetBSD: pkgsrc.xml,v 1.44 2025/01/01 01:39:11 jnemeth Exp $
1.1 dsieger 18:
19: Abstract
20:
21: pkgsrc is a centralized package management system for Unix-like operating
22: systems. This guide provides information for users and developers of pkgsrc. It
23: covers installation of binary and source packages, creation of binary and
24: source packages and a high-level overview about the infrastructure.
25:
26: -------------------------------------------------------------------------------
27:
28: Table of Contents
29:
30: 1. What is pkgsrc?
31: 1.1. Introduction
32: 1.1.1. Why pkgsrc?
33: 1.1.2. Supported platforms
34: 1.2. Overview
35: 1.3. Terminology
36: 1.3.1. Roles involved in pkgsrc
37: 1.4. Typography
38: I. The pkgsrc user's guide
1.154 rillig 39: 2. Getting help
40: 3. Where to get pkgsrc and how to keep it up-to-date
41: 3.1. Getting pkgsrc for the first time
42: 3.1.1. As tar archive
43: 3.1.2. Via anonymous CVS
44: 3.2. Keeping pkgsrc up-to-date
45: 3.2.1. Via tar files
46: 3.2.2. Via CVS
47: 4. Using pkgsrc on systems other than NetBSD
48: 4.1. Binary distribution
49: 4.2. Bootstrapping pkgsrc
50: 5. Using pkgsrc
51: 5.1. Using binary packages
52: 5.1.1. Finding binary packages
53: 5.1.2. Installing binary packages
1.202 nia 54: 5.1.3. Updating packages
55: 5.1.4. Deinstalling packages
56: 5.1.5. Getting information about installed packages
57: 5.1.6. Checking for security vulnerabilities in installed packages
58: 5.1.7. Finding if newer versions of your installed packages are in
1.259 leot 59: pkgsrc
1.202 nia 60: 5.1.8. Other administrative functions
1.154 rillig 61: 5.2. Building packages from source
62: 5.2.1. Requirements
63: 5.2.2. Fetching distfiles
64: 5.2.3. How to build and install
65: 6. Configuring pkgsrc
66: 6.1. General configuration
67: 6.2. Variables affecting the build process
1.241 rillig 68: 6.3. Preferences for native or pkgsrc software
69: 6.4. Variables affecting the installation process
70: 6.5. Selecting and configuring the compiler
71: 6.5.1. Selecting the compiler
72: 6.5.2. Additional flags to the compiler (CFLAGS)
73: 6.5.3. Additional flags to the linker (LDFLAGS)
74: 6.6. Developer/advanced settings
75: 6.7. Selecting Build Options
1.154 rillig 76: 7. Creating binary packages
77: 7.1. Building a single binary package
78: 7.2. Settings for creation of binary packages
79: 8. Creating binary packages for everything in pkgsrc (bulk builds)
80: 8.1. Preparations
1.180 rillig 81: 8.2. Running a bulk build
1.154 rillig 82: 8.2.1. Configuration
83: 8.3. Requirements of a full bulk build
1.178 rillig 84: 8.4. Bulk build variants
1.179 rillig 85: 8.4.1. Detect unknown configure options
86: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 87: 8.4.3. Force compiler options only in the build phase
88: 8.4.4. Use custom directories
89: 8.4.5. Turn warnings into errors
90: 8.4.6. Reject packages for which pkglint reports errors
91: 8.4.7. Reject packages that contain forbidden strings
92: 8.4.8. Reject packages whose self-test fails
93: 8.4.9. Reject packages that use undefined shell variables
94: 8.4.10. Turn off verbose logging
1.178 rillig 95: 8.5. Creating a multiple CD-ROM packages collection
96: 8.5.1. Example of cdpack
1.154 rillig 97: 9. Directory layout of the installed files
98: 9.1. File system layout in ${LOCALBASE}
99: 9.2. File system layout in ${VARBASE}
100: 10. Frequently Asked Questions
101: 10.1. Are there any mailing lists for pkg-related discussion?
102: 10.2. Utilities for package management (pkgtools)
103: 10.3. How to use pkgsrc as non-root
104: 10.4. How to resume transfers when fetching distfiles?
105: 10.5. How can I install/use modular X.org from pkgsrc?
106: 10.6. How to fetch files from behind a firewall
107: 10.7. How to fetch files from HTTPS sites
108: 10.8. How do I tell make fetch to do passive FTP?
109: 10.9. How to fetch all distfiles at once
110: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc"
1.259 leot 111: mean?
1.154 rillig 112: 10.11. What does "Could not find bsd.own.mk" mean?
1.221 nia 113: 10.12. Using 'sudo' or `priv` with pkgsrc
1.154 rillig 114: 10.13. How do I change the location of configuration files?
115: 10.14. Automated security checks
116: 10.15. Why do some packages ignore my CFLAGS?
117: 10.16. A package does not build. What shall I do?
118: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/???
1.259 leot 119: merge conflicts" mean?
1.1 dsieger 120: II. The pkgsrc developer's guide
1.154 rillig 121: 11. Getting help
1.184 rillig 122: 12. Package components - files, directories and contents
123: 12.1. Makefile
124: 12.2. distinfo
125: 12.3. patches/*
126: 12.3.1. Structure of a single patch file
127: 12.3.2. Creating patch files
128: 12.3.3. Sources where the patch files come from
129: 12.3.4. Patching guidelines
130: 12.3.5. Feedback to the author
131: 12.4. Other mandatory files
132: 12.5. Optional files
133: 12.5.1. Files affecting the binary package
134: 12.5.2. Files affecting the build process
135: 12.5.3. Files affecting nothing at all
136: 12.6. work*
137: 12.7. files/*
138: 13. The build process
139: 13.1. Introduction
140: 13.2. Program location
141: 13.3. Directories used during the build process
142: 13.4. Running a phase
143: 13.5. The fetch phase
144: 13.5.1. What to fetch and where to get it from
145: 13.5.2. How are the files fetched?
146: 13.6. The checksum phase
147: 13.7. The extract phase
148: 13.8. The patch phase
149: 13.9. The tools phase
150: 13.10. The wrapper phase
151: 13.11. The configure phase
152: 13.12. The build phase
153: 13.13. The test phase
154: 13.14. The install phase
155: 13.15. The package phase
156: 13.16. Cleaning up
157: 13.17. Other helpful targets
158: 14. Creating a new pkgsrc package from scratch
159: 14.1. Common types of packages
1.219 nia 160: 14.1.1. Python modules and programs
161: 14.1.2. R packages
162: 14.1.3. TeXlive packages
1.184 rillig 163: 14.2. Examples
164: 14.2.1. How the www/nvu package came into pkgsrc
165: 15. Programming in Makefiles
166: 15.1. Caveats
167: 15.2. Makefile variables
168: 15.2.1. Naming conventions
169: 15.3. Code snippets
170: 15.3.1. Adding things to a list
171: 15.3.2. Echoing a string exactly as-is
172: 15.3.3. Passing CFLAGS to GNU configure scripts
173: 15.3.4. Handling possibly empty variables
1.229 gutterid 174: 15.3.5. Testing yes/no variables in conditions
1.184 rillig 175: 16. Options handling
176: 16.1. Global default options
177: 16.2. Converting packages to use bsd.options.mk
178: 16.3. Option Names
179: 16.4. Determining the options of dependencies
180: 17. Tools needed for building or running
181: 17.1. Tools for pkgsrc builds
182: 17.2. Tools needed by packages
183: 17.3. Tools provided by platforms
184: 18. Buildlink methodology
185: 18.1. Converting packages to use buildlink3
186: 18.2. Writing buildlink3.mk files
187: 18.2.1. Anatomy of a buildlink3.mk file
188: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and
1.259 leot 189: BUILDLINK_ABI_DEPENDS.pkg in buildlink3.mk files
1.184 rillig 190: 18.3. Writing builtin.mk files
191: 18.3.1. Anatomy of a builtin.mk file
192: 19. PLIST issues
193: 19.1. RCS ID
194: 19.2. Semi-automatic PLIST generation
195: 19.3. Tweaking output of make print-PLIST
196: 19.4. Variable substitution in PLIST
197: 19.5. Man page compression
198: 19.6. Changing PLIST source with PLIST_SRC
199: 19.7. Platform-specific and differing PLISTs
200: 19.8. Build-specific PLISTs
201: 19.9. Sharing directories between packages
202: 20. The pkginstall framework
203: 20.1. Files and directories outside the installation prefix
204: 20.1.1. Directory manipulation
205: 20.1.2. File manipulation
206: 20.2. Configuration files
207: 20.2.1. How PKG_SYSCONFDIR is set
208: 20.2.2. Telling the software where configuration files are
1.239 dholland 209: 20.2.3. Patching installation
210: 20.2.4. Declaring configuration files
211: 20.2.5. Disabling handling of configuration files
1.184 rillig 212: 20.3. System startup scripts
213: 20.3.1. Disabling handling of system startup scripts
214: 20.4. System users and groups
215: 20.5. System shells
216: 20.5.1. Disabling shell registration
217: 20.6. Fonts
218: 20.6.1. Disabling automatic update of the fonts databases
1.154 rillig 219: 21. Making your package work
220: 21.1. General operation
221: 21.1.1. How to pull in user-settable variables from mk.conf
222: 21.1.2. User interaction
223: 21.1.3. Handling licenses
224: 21.1.4. Restricted packages
225: 21.1.5. Handling dependencies
226: 21.1.6. Handling conflicts with other packages
227: 21.1.7. Packages that cannot or should not be built
228: 21.1.8. Packages which should not be deleted, once installed
229: 21.1.9. Handling packages with security problems
230: 21.1.10. How to handle incrementing versions when fixing an
1.259 leot 231: existing package
1.154 rillig 232: 21.1.11. Substituting variable text in the package files (the SUBST
1.259 leot 233: framework)
1.154 rillig 234: 21.2. The fetch phase
235: 21.2.1. Packages whose distfiles aren't available for plain
1.259 leot 236: downloading
1.154 rillig 237: 21.2.2. How to handle modified distfiles with the 'old' name
238: 21.2.3. Packages hosted on github.com
239: 21.3. The configure phase
240: 21.3.1. Shared libraries - libtool
241: 21.3.2. Using libtool on GNU packages that already support libtool
242: 21.3.3. GNU Autoconf/Automake
1.223 nia 243: 21.3.4. Meson / ninja
1.260 wiz 244: 21.3.5. Determining the endianness
1.154 rillig 245: 21.4. Programming languages
246: 21.4.1. C, C++, and Fortran
247: 21.4.2. Java
1.205 wiz 248: 21.4.3. Go
1.223 nia 249: 21.4.4. Rust
250: 21.4.5. Packages containing Perl scripts
251: 21.4.6. Packages containing shell scripts
252: 21.4.7. Other programming languages
1.154 rillig 253: 21.5. The build phase
254: 21.5.1. Compiling C and C++ code conditionally
255: 21.5.2. How to handle compiler bugs
1.172 rillig 256: 21.5.3. No such file or directory
257: 21.5.4. Undefined reference to "..."
258: 21.5.5. Running out of memory
1.154 rillig 259: 21.6. The install phase
260: 21.6.1. Creating needed directories
261: 21.6.2. Where to install documentation
262: 21.6.3. Installing highscore files
263: 21.6.4. Adding DESTDIR support to packages
264: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 265: 21.6.6. Packages installing Perl modules
1.254 wiz 266: 21.6.7. Packages installing pkg-config files
267: 21.6.8. Packages installing info files
268: 21.6.9. Packages installing man pages
269: 21.6.10. Packages installing X11 fonts
270: 21.6.11. Packages installing SGML or XML data
271: 21.6.12. Packages installing extensions to the MIME database
272: 21.6.13. Packages using intltool
273: 21.6.14. Packages installing startup scripts
274: 21.6.15. Packages installing TeX modules
275: 21.6.16. Packages supporting running binaries in emulation
276: 21.6.17. Packages installing hicolor icons
277: 21.6.18. Packages installing desktop files
1.154 rillig 278: 21.7. Marking packages as having problems
1.184 rillig 279: 22. GNOME packaging and porting
280: 22.1. Meta packages
281: 22.2. Packaging a GNOME application
282: 22.3. Updating GNOME to a newer version
283: 22.4. Patching guidelines
1.154 rillig 284: 23. Submitting and Committing
285: 23.1. Submitting binary packages
286: 23.2. Submitting source packages (for non-NetBSD-developers)
287: 23.3. General notes when adding, updating, or removing packages
288: 23.4. Commit Messages
289: 23.5. Committing: Adding a package to CVS
290: 23.6. Updating a package to a newer version
291: 23.7. Renaming a package in pkgsrc
292: 23.8. Moving a package in pkgsrc
293: 24. Frequently Asked Questions
1.1 dsieger 294: III. The pkgsrc infrastructure internals
1.184 rillig 295: 25. Design of the pkgsrc infrastructure
296: 25.1. The meaning of variable definitions
297: 25.2. Avoiding problems before they arise
298: 25.3. Variable evaluation
299: 25.3.1. At load time
300: 25.3.2. At runtime
301: 25.4. How can variables be specified?
302: 25.5. Designing interfaces for Makefile fragments
303: 25.5.1. Procedures with parameters
304: 25.5.2. Actions taken on behalf of parameters
305: 25.6. The order in which files are loaded
306: 25.6.1. The order in bsd.prefs.mk
307: 25.6.2. The order in bsd.pkg.mk
308: 26. Regression tests
309: 26.1. Running the regression tests
310: 26.2. Adding a new regression test
311: 26.2.1. Overridable functions
312: 26.2.2. Helper functions
313: 27. Porting pkgsrc
314: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 315: A. A simple example package: bison
316: A.1. files
317: A.1.1. Makefile
318: A.1.2. DESCR
319: A.1.3. PLIST
320: A.1.4. Checking a package with pkglint
321: A.2. Steps for building, installing, packaging
1.207 leot 322: B. Security hardening
323: B.1. Mechanisms
324: B.1.1. Enabled by default
325: B.1.2. Not enabled by default
326: B.2. Caveats
327: B.2.1. Problems with PKGSRC_MKPIE
328: B.2.2. Problems with PKGSRC_USE_FORTIFY
329: B.2.3. Problems with PKGSRC_USE_RELRO
330: B.2.4. Problems with PKGSRC_USE_SSP
331: B.3. Auditing the system
332: B.3.1. Checking for PIE
333: B.3.2. Checking for partial RELRO
334: B.3.3. Checking for full RELRO
335: B.3.4. Checking for SSP
336: C. Build logs
337: C.1. Building figlet
338: C.2. Packaging figlet
339: D. Directory layout of the pkgsrc FTP server
340: D.1. distfiles: The distributed source files
341: D.2. misc: Miscellaneous things
342: D.3. packages: Binary packages
343: D.4. reports: Bulk build reports
344: D.5. current, stable, pkgsrc-20xxQy: source packages
345: E. Help topics
346: F. Editing guidelines for the pkgsrc guide
347: F.1. Make targets
348: F.2. Procedure
1.1 dsieger 349:
350: List of Tables
351:
352: 1.1. Platforms supported by pkgsrc
1.184 rillig 353: 12.1. Patching examples
354: 22.1. PLIST handling for GNOME packages
1.1 dsieger 355:
356: Chapter 1. What is pkgsrc?
357:
358: Table of Contents
359:
360: 1.1. Introduction
361: 1.1.1. Why pkgsrc?
362: 1.1.2. Supported platforms
363: 1.2. Overview
364: 1.3. Terminology
365: 1.3.1. Roles involved in pkgsrc
366: 1.4. Typography
367:
368: 1.1. Introduction
369:
370: There is a lot of software freely available for Unix-based systems, which is
371: usually available in form of the source code. Before such software can be used,
372: it needs to be configured to the local system, compiled and installed, and this
373: is exactly what The NetBSD Packages Collection (pkgsrc) does. pkgsrc also has
374: some basic commands to handle binary packages, so that not every user has to
375: build the packages for himself, which is a time-costly task.
376:
377: pkgsrc currently contains several thousand packages, including:
378:
1.104 sevan 379: * www/apache24 - The Apache web server
1.1 dsieger 380:
381: * www/firefox - The Firefox web browser
382:
383: * meta-pkgs/gnome - The GNOME Desktop Environment
384:
1.102 ryoon 385: * meta-pkgs/kde4 - The K Desktop Environment
1.1 dsieger 386:
1.108 rillig 387: ? just to name a few.
1.1 dsieger 388:
389: pkgsrc has built-in support for handling varying dependencies, such as pthreads
390: and X11, and extended features such as IPv6 support on a range of platforms.
391:
392: 1.1.1. Why pkgsrc?
393:
394: pkgsrc provides the following key features:
395:
396: * Easy building of software from source as well as the creation and
397: installation of binary packages. The source and latest patches are
398: retrieved from a master or mirror download site, checksum verified, then
399: built on your system. Support for binary-only distributions is available
400: for both native platforms and NetBSD emulated platforms.
401:
402: * All packages are installed in a consistent directory tree, including
403: binaries, libraries, man pages and other documentation.
404:
1.104 sevan 405: * Tracking of package dependencies automatically, including when performing
406: updates, to ensure required packages are installed. The configuration files
407: of various packages are handled automatically during updates, so local
408: changes are preserved.
1.1 dsieger 409:
410: * Like NetBSD, pkgsrc is designed with portability in mind and consists of
411: highly portable code. This allows the greatest speed of development when
1.26 spz 412: porting to a new platform. This portability also ensures that pkgsrc is
1.1 dsieger 413: consistent across all platforms.
414:
415: * The installation prefix, acceptable software licenses, international
416: encryption requirements and build-time options for a large number of
417: packages are all set in a simple, central configuration file.
418:
419: * The entire source (not including the distribution files) is freely
420: available under a BSD license, so you may extend and adapt pkgsrc to your
421: needs. Support for local packages and patches is available right out of the
422: box, so you can configure it specifically for your environment.
423:
424: The following principles are basic to pkgsrc:
425:
1.198 leot 426: * "It should only work if it's right." -- That means, if a package contains
1.1 dsieger 427: bugs, it's better to find them and to complain about them rather than to
428: just install the package and hope that it works. There are numerous checks
1.175 gutterid 429: in pkgsrc that try to find such bugs: static analysis tools (pkgtools/
1.1 dsieger 430: pkglint), build-time checks (portability of shell scripts), and
431: post-installation checks (installed files, references to shared libraries,
432: script interpreters).
433:
1.198 leot 434: * "If it works, it should work everywhere" -- Like NetBSD has been ported to
1.1 dsieger 435: many hardware architectures, pkgsrc has been ported to many operating
436: systems. Care is taken that packages behave the same on all platforms.
437:
438: 1.1.2. Supported platforms
439:
440: pkgsrc consists of both a source distribution and a binary distribution for
441: these operating systems. After retrieving the required source or binaries, you
442: can be up and running with pkgsrc in just minutes!
443:
444: pkgsrc was derived from FreeBSD's ports system, and initially developed for
445: NetBSD only. Since then, pkgsrc has grown a lot, and now supports the following
446: platforms:
447:
448: Table 1.1. Platforms supported by pkgsrc
449:
1.92 sevan 450: +-----------------------------------------------------------------------------+
1.229 gutterid 451: | Platform | Date Support | Notes |
452: | | Added | |
453: |-------------------------------------+---------------+-----------------------|
454: |NetBSD | Aug 1997 | |
455: |-------------------------------------+---------------+-----------------------|
456: |Solaris | Mar 1999 |README.Solaris |
457: |-------------------------------------+---------------+-----------------------|
458: |Linux | Jun 1999 |README.Linux |
459: |-------------------------------------+---------------+-----------------------|
460: |Darwin / Mac OS X / OS X / macOS | Oct 2001 |README.macOS |
461: |-------------------------------------+---------------+-----------------------|
462: |FreeBSD | Nov 2002 |README.FreeBSD |
463: |-------------------------------------+---------------+-----------------------|
464: |OpenBSD | Nov 2002 |README.OpenBSD |
465: |-------------------------------------+---------------+-----------------------|
466: |IRIX | Dec 2002 |README.IRIX |
467: |-------------------------------------+---------------+-----------------------|
468: |BSD/OS | Dec 2003 | |
469: |-------------------------------------+---------------+-----------------------|
470: |AIX | Dec 2003 |README.AIX |
471: |-------------------------------------+---------------+-----------------------|
472: |Interix (Microsoft Windows Services | Mar 2004 |README.Interix |
473: |for Unix) | | |
474: |-------------------------------------+---------------+-----------------------|
475: |DragonFlyBSD | Oct 2004 | |
476: |-------------------------------------+---------------+-----------------------|
477: |OSF/1 | Nov 2004 |README.OSF1 |
478: |-------------------------------------+---------------+-----------------------|
479: |HP-UX | Apr 2007 |README.HPUX |
480: |-------------------------------------+---------------+-----------------------|
481: |Haiku | Sep 2010 |README.Haiku |
482: |-------------------------------------+---------------+-----------------------|
483: |MirBSD | Jan 2011 | |
484: |-------------------------------------+---------------+-----------------------|
485: |Minix3 | Nov 2011 |README.Minix3 |
486: |-------------------------------------+---------------+-----------------------|
487: |Cygwin | Mar 2013 |README.Cygwin |
488: |-------------------------------------+---------------+-----------------------|
1.261 ! maya 489: |GNU/kFreeBSD | Jul 2013 |Removed from pkgsrc Mar|
! 490: | | |2025 |
1.229 gutterid 491: |-------------------------------------+---------------+-----------------------|
492: |Bitrig | Jun 2014 |Removed from pkgsrc Sep|
493: | | |2022 |
1.92 sevan 494: +-----------------------------------------------------------------------------+
1.1 dsieger 495:
496:
497: 1.2. Overview
498:
499: This document is divided into three parts. The first, The pkgsrc user's guide,
500: describes how one can use one of the packages in the Package Collection, either
501: by installing a precompiled binary package, or by building one's own copy using
502: the NetBSD package system. The second part, The pkgsrc developer's guide,
503: explains how to prepare a package so it can be easily built by other NetBSD
504: users without knowing about the package's building details. The third part, The
505: pkgsrc infrastructure internals is intended for those who want to understand
506: how pkgsrc is implemented.
507:
508: This document is available in various formats: HTML, PDF, PS, TXT.
509:
510: 1.3. Terminology
511:
512: There has been a lot of talk about "ports", "packages", etc. so far. Here is a
513: description of all the terminology used within this document.
514:
515: Package
516:
517: A set of files and building instructions that describe what's necessary to
518: build a certain piece of software using pkgsrc. Packages are traditionally
1.123 wiz 519: stored under /usr/pkgsrc, but may be stored in any location, referred to as
520: PKGSRCDIR.
1.1 dsieger 521:
522: The NetBSD package system
523:
524: This is the former name of "pkgsrc". It is part of the NetBSD operating
525: system and can be bootstrapped to run on non-NetBSD operating systems as
526: well. It handles building (compiling), installing, and removing of
527: packages.
528:
529: Distfile
530:
531: This term describes the file or files that are provided by the author of
532: the piece of software to distribute his work. All the changes necessary to
533: build on NetBSD are reflected in the corresponding package. Usually the
534: distfile is in the form of a compressed tar-archive, but other types are
535: possible, too. Distfiles are usually stored below /usr/pkgsrc/distfiles.
536:
537: Port
538:
539: This is the term used by FreeBSD and OpenBSD people for what we call a
540: package. In NetBSD terminology, "port" refers to a different architecture.
541:
542: Precompiled/binary package
543:
544: A set of binaries built with pkgsrc from a distfile and stuffed together in
545: a single .tgz file so it can be installed on machines of the same machine
546: architecture without the need to recompile. Packages are usually generated
547: in /usr/pkgsrc/packages; there is also an archive on ftp.NetBSD.org.
548:
549: Sometimes, this is referred to by the term "package" too, especially in the
550: context of precompiled packages.
551:
552: Program
553:
554: The piece of software to be installed which will be constructed from all
555: the files in the distfile by the actions defined in the corresponding
556: package.
557:
558: 1.3.1. Roles involved in pkgsrc
559:
560: pkgsrc users
561:
562: The pkgsrc users are people who use the packages provided by pkgsrc.
563: Typically they are system administrators. The people using the software
564: that is inside the packages (maybe called "end users") are not covered by
565: the pkgsrc guide.
566:
567: There are two kinds of pkgsrc users: Some only want to install pre-built
568: binary packages. Others build the pkgsrc packages from source, either for
569: installing them directly or for building binary packages themselves. For
570: pkgsrc users Part I, "The pkgsrc user's guide" should provide all necessary
571: documentation.
572:
573: package maintainers
574:
575: A package maintainer creates packages as described in Part II, "The pkgsrc
576: developer's guide".
577:
578: infrastructure developers
579:
580: These people are involved in all those files that live in the mk/ directory
581: and below. Only these people should need to read through Part III, "The
582: pkgsrc infrastructure internals", though others might be curious, too.
583:
584: 1.4. Typography
585:
586: When giving examples for commands, shell prompts are used to show if the
587: command should/can be issued as root, or if "normal" user privileges are
1.115 sevan 588: sufficient. We use a # for root's shell prompt, a % for users' shell prompt,
1.229 gutterid 589: assuming they use the C-shell or tcsh and a $ for Bourne shell and derivatives.
1.1 dsieger 590:
591: Part I. The pkgsrc user's guide
592:
593: Table of Contents
594:
1.154 rillig 595: 2. Getting help
596: 3. Where to get pkgsrc and how to keep it up-to-date
597: 3.1. Getting pkgsrc for the first time
598: 3.1.1. As tar archive
599: 3.1.2. Via anonymous CVS
600: 3.2. Keeping pkgsrc up-to-date
601: 3.2.1. Via tar files
602: 3.2.2. Via CVS
603: 4. Using pkgsrc on systems other than NetBSD
604: 4.1. Binary distribution
605: 4.2. Bootstrapping pkgsrc
606: 5. Using pkgsrc
607: 5.1. Using binary packages
608: 5.1.1. Finding binary packages
609: 5.1.2. Installing binary packages
1.202 nia 610: 5.1.3. Updating packages
611: 5.1.4. Deinstalling packages
612: 5.1.5. Getting information about installed packages
613: 5.1.6. Checking for security vulnerabilities in installed packages
614: 5.1.7. Finding if newer versions of your installed packages are in
1.259 leot 615: pkgsrc
1.202 nia 616: 5.1.8. Other administrative functions
1.154 rillig 617: 5.2. Building packages from source
618: 5.2.1. Requirements
619: 5.2.2. Fetching distfiles
620: 5.2.3. How to build and install
621: 6. Configuring pkgsrc
622: 6.1. General configuration
623: 6.2. Variables affecting the build process
1.241 rillig 624: 6.3. Preferences for native or pkgsrc software
625: 6.4. Variables affecting the installation process
626: 6.5. Selecting and configuring the compiler
627: 6.5.1. Selecting the compiler
628: 6.5.2. Additional flags to the compiler (CFLAGS)
629: 6.5.3. Additional flags to the linker (LDFLAGS)
630: 6.6. Developer/advanced settings
631: 6.7. Selecting Build Options
1.154 rillig 632: 7. Creating binary packages
633: 7.1. Building a single binary package
634: 7.2. Settings for creation of binary packages
635: 8. Creating binary packages for everything in pkgsrc (bulk builds)
636: 8.1. Preparations
1.180 rillig 637: 8.2. Running a bulk build
1.154 rillig 638: 8.2.1. Configuration
639: 8.3. Requirements of a full bulk build
1.178 rillig 640: 8.4. Bulk build variants
1.179 rillig 641: 8.4.1. Detect unknown configure options
642: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 643: 8.4.3. Force compiler options only in the build phase
644: 8.4.4. Use custom directories
645: 8.4.5. Turn warnings into errors
646: 8.4.6. Reject packages for which pkglint reports errors
647: 8.4.7. Reject packages that contain forbidden strings
648: 8.4.8. Reject packages whose self-test fails
649: 8.4.9. Reject packages that use undefined shell variables
650: 8.4.10. Turn off verbose logging
1.178 rillig 651: 8.5. Creating a multiple CD-ROM packages collection
652: 8.5.1. Example of cdpack
1.154 rillig 653: 9. Directory layout of the installed files
654: 9.1. File system layout in ${LOCALBASE}
655: 9.2. File system layout in ${VARBASE}
656: 10. Frequently Asked Questions
657: 10.1. Are there any mailing lists for pkg-related discussion?
658: 10.2. Utilities for package management (pkgtools)
659: 10.3. How to use pkgsrc as non-root
660: 10.4. How to resume transfers when fetching distfiles?
661: 10.5. How can I install/use modular X.org from pkgsrc?
662: 10.6. How to fetch files from behind a firewall
663: 10.7. How to fetch files from HTTPS sites
664: 10.8. How do I tell make fetch to do passive FTP?
665: 10.9. How to fetch all distfiles at once
666: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
667: 10.11. What does "Could not find bsd.own.mk" mean?
1.221 nia 668: 10.12. Using 'sudo' or `priv` with pkgsrc
1.154 rillig 669: 10.13. How do I change the location of configuration files?
670: 10.14. Automated security checks
671: 10.15. Why do some packages ignore my CFLAGS?
672: 10.16. A package does not build. What shall I do?
673: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.259 leot 674: conflicts" mean?
1.1 dsieger 675:
1.154 rillig 676: Chapter 2. Getting help
677:
678: To get help when using pkgsrc, the definitive source is this document, the
679: pkgsrc guide. If you don't find anything here, there are alternatives:
680:
681: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
682: Run bmake help topic=? to get help for any topic, such as a variable name
683: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
684: like strcasecmp or any other topic.
685:
1.207 leot 686: The available help topics are listed in Appendix E, Help topics.
1.154 rillig 687:
1.163 rillig 688: * To see the value of a single variable, run bmake show-var VARNAME=X.
689:
690: * To see the values of the most common variables, run bmake show-all. These
691: variables are grouped by topic. To see the variables for a single topic,
692: run bmake show-all-topic, for example bmake show-all-fetch.
693:
1.154 rillig 694: * The pkgsrc-users mailing list, to which you can subscribe and then ask your
695: questions.
696:
697: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
698: a specialized chat program such as XChat. Pick any user name and join the
699: channel #pkgsrc.
700:
701: Chapter 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 702:
703: Table of Contents
704:
1.154 rillig 705: 3.1. Getting pkgsrc for the first time
706: 3.1.1. As tar archive
707: 3.1.2. Via anonymous CVS
708: 3.2. Keeping pkgsrc up-to-date
709: 3.2.1. Via tar files
710: 3.2.2. Via CVS
1.1 dsieger 711:
712: Before you download and extract the files, you need to decide where you want to
713: extract them. When using pkgsrc as root user, pkgsrc is usually installed in /
714: usr/pkgsrc. You are though free to install the sources and binary packages
715: wherever you want in your filesystem, provided that the pathname does not
716: contain white-space or other characters that are interpreted specially by the
717: shell and some other programs. A safe bet is to use only letters, digits,
718: underscores and dashes.
719:
1.154 rillig 720: 3.1. Getting pkgsrc for the first time
1.1 dsieger 721:
1.25 wiz 722: Before you download any pkgsrc files, you should decide whether you want the
1.1 dsieger 723: current branch or the stable branch. The latter is forked on a quarterly basis
724: from the current branch and only gets modified for security updates. The names
725: of the stable branches are built from the year and the quarter, for example
1.259 leot 726: 2024Q4.
1.1 dsieger 727:
728: The second step is to decide how you want to download pkgsrc. You can get it as
1.24 wiz 729: a tar file or via CVS. Both ways are described here.
1.1 dsieger 730:
1.52 asau 731: Note that tar archive contains CVS working copy. Thus you can switch to using
732: CVS at any later time.
1.1 dsieger 733:
1.154 rillig 734: 3.1.1. As tar archive
1.52 asau 735:
1.151 sevan 736: The primary download location for all pkgsrc files is https://cdn.NetBSD.org/
737: pub/pkgsrc/ or ftp://ftp.NetBSD.org/pub/pkgsrc/ (it points to the same
738: location). There are a number of subdirectories for different purposes, which
1.207 leot 739: are described in detail in Appendix D, Directory layout of the pkgsrc FTP
1.151 sevan 740: server.
1.1 dsieger 741:
1.52 asau 742: The tar archive for the current branch is in the directory current and is
1.118 sevan 743: called pkgsrc.tar.gz. It is autogenerated weekly.
1.52 asau 744:
745: To save download time we provide bzip2- and xz-compressed archives which are
746: published at pkgsrc.tar.bz2 and pkgsrc.tar.xz respectively.
747:
748: You can fetch the same files using FTP.
1.1 dsieger 749:
1.259 leot 750: The tar file for the stable branch 2024Q4 is in the directory pkgsrc-2024Q4 and
1.59 jnemeth 751: is also called pkgsrc.tar.gz.
1.1 dsieger 752:
1.136 leot 753: To download the latest pkgsrc stable tarball, run:
1.12 weinem 754:
1.259 leot 755: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2024Q4/pkgsrc.tar.gz
1.12 weinem 756:
1.78 snj 757: If you prefer, you can also fetch it using "wget", "curl", or your web browser.
1.52 asau 758:
1.12 weinem 759: Then, extract it with:
760:
1.78 snj 761: $ tar -xzf pkgsrc.tar.gz -C /usr
1.12 weinem 762:
763: This will create the directory pkgsrc/ in /usr/ and all the package source will
764: be stored under /usr/pkgsrc/.
765:
766: To download pkgsrc-current, run:
767:
768: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz
1.1 dsieger 769:
1.154 rillig 770: 3.1.2. Via anonymous CVS
1.1 dsieger 771:
1.24 wiz 772: To fetch a specific pkgsrc stable branch, run:
1.1 dsieger 773:
1.259 leot 774: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2024Q4 -P pkgsrc
1.13 weinem 775:
1.24 wiz 776: This will create the directory pkgsrc/ in your /usr/ directory and all the
777: package source will be stored under /usr/pkgsrc/.
778:
779: To fetch the pkgsrc current branch, run:
1.1 dsieger 780:
1.40 wiz 781: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 782:
1.30 dholland 783: Refer to the list of available mirrors to choose a faster CVS mirror, if
784: needed.
1.1 dsieger 785:
1.24 wiz 786: If you get error messages from rsh, you need to set CVS_RSH variable. E.g.:
1.1 dsieger 787:
1.40 wiz 788: $ cd /usr && env CVS_RSH=ssh cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 789:
1.24 wiz 790: Refer to documentation on your command shell how to set CVS_RSH=ssh
791: permanently. For Bourne shells, you can set it in your .profile or better
792: globally in /etc/profile:
793:
794: # set CVS remote shell command
795: CVS_RSH=ssh
796: export CVS_RSH
1.12 weinem 797:
1.13 weinem 798: By default, CVS doesn't do things like most people would expect it to do. But
799: there is a way to convince CVS, by creating a file called .cvsrc in your home
1.12 weinem 800: directory and saving the following lines to it. This file will save you lots of
801: headache and some bug reports, so we strongly recommend it. You can find an
802: explanation of this file in the CVS documentation.
1.2 rillig 803:
804: # recommended CVS configuration file from the pkgsrc guide
1.155 sevan 805: cvs -q
1.2 rillig 806: checkout -P
1.4 rillig 807: update -dP
808: diff -upN
1.2 rillig 809: rdiff -u
1.24 wiz 810: release -d
1.1 dsieger 811:
1.154 rillig 812: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 813:
814: The preferred way to keep pkgsrc up-to-date is via CVS (which also works if you
815: have first installed it via a tar file). It saves bandwidth and hard disk
816: activity, compared to downloading the tar file again.
817:
1.154 rillig 818: 3.2.1. Via tar files
1.1 dsieger 819:
820: Warning
821:
822: When updating from a tar file, you first need to completely remove the old
823: pkgsrc directory. Otherwise those files that have been removed from pkgsrc in
824: the mean time will not be removed on your local disk, resulting in
825: inconsistencies. When removing the old files, any changes that you have done to
826: the pkgsrc files will be lost after updating. Therefore updating via CVS is
827: strongly recommended.
828:
829: Note that by default the distfiles and the binary packages are saved in the
830: pkgsrc tree, so don't forget to rescue them before updating. You can also
1.78 snj 831: configure pkgsrc to store distfiles and packages in directories outside the
1.154 rillig 832: pkgsrc tree by setting the DISTDIR and PACKAGES variables. See Chapter 6,
1.78 snj 833: Configuring pkgsrc for the details.
1.1 dsieger 834:
835: To update pkgsrc from a tar file, download the tar file as explained above.
836: Then, make sure that you have not made any changes to the files in the pkgsrc
837: directory. Remove the pkgsrc directory and extract the new tar file. Done.
838:
1.154 rillig 839: 3.2.2. Via CVS
1.1 dsieger 840:
1.26 spz 841: To update pkgsrc via CVS, change to the pkgsrc directory and run cvs:
1.12 weinem 842:
1.26 spz 843: $ cd /usr/pkgsrc && cvs update -dP
844:
845: If you get error messages from rsh, you need to set CVS_RSH variable as
846: described above. E.g.:
847:
848: $ cd /usr/pkgsrc && env CVS_RSH=ssh cvs up -dP
1.1 dsieger 849:
1.154 rillig 850: 3.2.2.1. Switching between different pkgsrc branches
1.1 dsieger 851:
852: When updating pkgsrc, the CVS program keeps track of the branch you selected.
853: But if you, for whatever reason, want to switch from the stable branch to the
854: current one, you can do it by adding the option "-A" after the "update"
1.25 wiz 855: keyword. To switch from the current branch back to the stable branch, add the "
1.259 leot 856: -rpkgsrc-2024Q4" option.
1.1 dsieger 857:
1.154 rillig 858: 3.2.2.2. What happens to my changes when updating?
1.1 dsieger 859:
860: When you update pkgsrc, the CVS program will only touch those files that are
861: registered in the CVS repository. That means that any packages that you created
862: on your own will stay unmodified. If you change files that are managed by CVS,
863: later updates will try to merge your changes with those that have been done by
864: others. See the CVS manual, chapter "update" for details.
865:
1.154 rillig 866: Chapter 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 867:
868: Table of Contents
869:
1.154 rillig 870: 4.1. Binary distribution
871: 4.2. Bootstrapping pkgsrc
1.1 dsieger 872:
1.154 rillig 873: 4.1. Binary distribution
1.1 dsieger 874:
1.154 rillig 875: See Section 5.1, "Using binary packages".
1.1 dsieger 876:
1.154 rillig 877: 4.2. Bootstrapping pkgsrc
1.1 dsieger 878:
1.44 asau 879: pkgsrc can be bootstrapped for use in two different modes: privileged and
880: unprivileged one. In unprivileged mode in contrast to privileged one all
1.45 asau 881: programs are installed under one particular user and cannot utilise privileged
1.44 asau 882: operations (packages don't create special users and all special file
883: permissions like setuid are ignored).
884:
1.1 dsieger 885: Installing the bootstrap kit from source should be as simple as:
886:
1.60 asau 887: # env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 888: # cd pkgsrc/bootstrap
889: # ./bootstrap
890:
891:
1.44 asau 892: To bootstrap in unprivileged mode pass "--unprivileged" flag to bootstrap
893:
894: By default, in privileged mode pkgsrc uses /usr/pkg for prefix where programs
1.118 sevan 895: will be installed in, and /usr/pkg/pkgdb for the package database directory
896: where pkgsrc will do its internal bookkeeping, /var is used as varbase, where
1.44 asau 897: packages install their persistent data. In unprivileged mode pkgsrc uses ~/pkg
1.118 sevan 898: for prefix, ~/pkg/pkgdb for the package database, and ~/pkg/var for varbase.
1.44 asau 899:
900: You can change default layout using command-line arguments. Run "./bootstrap
901: --help" to get details.
1.1 dsieger 902:
903: Note
904:
905: The bootstrap installs a bmake tool. Use this bmake when building via pkgsrc.
906: For examples in this guide, use bmake instead of "make".
907:
1.44 asau 908: Note
909:
910: It is possible to bootstrap multiple instances of pkgsrc using non-intersecting
911: directories. Use bmake corresponding to the installation you're working with to
912: build and install packages.
913:
1.154 rillig 914: Chapter 5. Using pkgsrc
1.1 dsieger 915:
916: Table of Contents
917:
1.154 rillig 918: 5.1. Using binary packages
919: 5.1.1. Finding binary packages
920: 5.1.2. Installing binary packages
1.202 nia 921: 5.1.3. Updating packages
922: 5.1.4. Deinstalling packages
923: 5.1.5. Getting information about installed packages
924: 5.1.6. Checking for security vulnerabilities in installed packages
925: 5.1.7. Finding if newer versions of your installed packages are in pkgsrc
926: 5.1.8. Other administrative functions
1.154 rillig 927: 5.2. Building packages from source
928: 5.2.1. Requirements
929: 5.2.2. Fetching distfiles
930: 5.2.3. How to build and install
1.1 dsieger 931:
932: Basically, there are two ways of using pkgsrc. The first is to only install the
933: package tools and to use binary packages that someone else has prepared. This
934: is the "pkg" in pkgsrc. The second way is to install the "src" of pkgsrc, too.
935: Then you are able to build your own packages, and you can still use binary
936: packages from someone else.
937:
1.154 rillig 938: 5.1. Using binary packages
1.1 dsieger 939:
1.151 sevan 940: On the cdn.NetBSD.org site and mirrors, there are collections of binary
1.9 rillig 941: packages, ready to be installed. These binary packages have been built using
942: the default settings for the directories, that is:
943:
944: * /usr/pkg for LOCALBASE, where most of the files are installed,
945:
946: * /usr/pkg/etc for configuration files,
947:
948: * /var for VARBASE, where those files are installed that may change after
949: installation.
950:
951: If you cannot use these directories for whatever reasons (maybe because you're
952: not root), you cannot use these binary packages, but have to build the packages
1.154 rillig 953: yourself, which is explained in Section 4.2, "Bootstrapping pkgsrc".
1.1 dsieger 954:
1.154 rillig 955: 5.1.1. Finding binary packages
1.1 dsieger 956:
1.5 weinem 957: To install binary packages, you first need to know from where to get them. The
1.202 nia 958: first place where you should look is on the main pkgsrc CDN in the directory /
959: pub/pkgsrc/packages.
1.5 weinem 960:
961: This directory contains binary packages for multiple platforms. First, select
1.226 gutterid 962: your operating system. Then, select your hardware architecture, and in the
963: third step, the OS version and the "version" of pkgsrc.
1.9 rillig 964:
1.226 gutterid 965: In this directory, you may find a file called bootstrap.tar.gz which contains
1.9 rillig 966: the package management tools. If the file is missing, it is likely that your
967: operating system already provides those tools. Download the file and extract it
968: in the / directory. It will create the directories /usr/pkg (containing the
1.118 sevan 969: tools for managing binary packages and the database of installed packages).
1.1 dsieger 970:
1.154 rillig 971: 5.1.2. Installing binary packages
1.1 dsieger 972:
1.85 wiz 973: In the directory from the last section, there is a subdirectory called All/,
1.9 rillig 974: which contains all the binary packages that are available for the platform,
1.202 nia 975: excluding those that may not be distributed via HTTP or FTP.
1.9 rillig 976:
977: To install packages directly from an FTP or HTTP server, run the following
978: commands in a Bourne-compatible shell (be sure to su to root first):
979:
1.202 nia 980: # PATH="/usr/pkg/sbin:/usr/pkg/bin:$PATH"
981: # PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages"
1.169 rillig 982: # PKG_PATH="$PKG_PATH/OPSYS/ARCH/VERSIONS/All/"
1.9 rillig 983: # export PATH PKG_PATH
1.202 nia 984: # pkg_add pkgin
1.9 rillig 985:
986: Instead of URLs, you can also use local paths, for example if you are
987: installing from a set of CDROMs, DVDs or an NFS-mounted repository. If you want
988: to install packages from multiple sources, you can separate them by a semicolon
989: in PKG_PATH.
990:
991: After these preparations, installing a package is very easy:
992:
1.202 nia 993: # pkgin search nginx
994: nginx-1.19.6 Lightweight HTTP server and mail proxy server
995: nginx-1.18.0nb8 Lightweight HTTP server and mail proxy server
996: # pkgin install zsh nginx-1.19.6 vim
1.1 dsieger 997:
1.202 nia 998: Note that pkgin is a user-friendly frontend to the pkg_* tools.
1.1 dsieger 999:
1.202 nia 1000: Any prerequisite packages needed to run the package in question will be
1001: installed, too, assuming they are present in the repository.
1.1 dsieger 1002:
1003: After you've installed packages, be sure to have /usr/pkg/bin and /usr/pkg/sbin
1004: in your PATH so you can actually start the just installed program.
1005:
1.202 nia 1006: 5.1.3. Updating packages
1.1 dsieger 1007:
1.202 nia 1008: To update binary packages, it is recommended that you use pkgin upgrade. This
1009: will compare the remote package repository to your locally installed packages
1010: and safely replace any older packages.
1.1 dsieger 1011:
1.202 nia 1012: Note that pkgsrc is released as quarterly branches. If you are updating to a
1013: newer quarterly branch of pkgsrc, you may need to adjust the repository in /usr
1014: /pkg/etc/pkgin/repositories.conf.
1.1 dsieger 1015:
1.202 nia 1016: 5.1.4. Deinstalling packages
1.1 dsieger 1017:
1.202 nia 1018: To deinstall a package, it does not matter whether it was installed from source
1019: code or from a binary package. Neither the pkgin or the pkg_delete command need
1020: to know.
1.1 dsieger 1021:
1.202 nia 1022: To delete a package, you can just run pkgin remove package-name. The package
1023: name can be given with or without version number.
1.1 dsieger 1024:
1.202 nia 1025: 5.1.5. Getting information about installed packages
1.1 dsieger 1026:
1027: The pkg_info shows information about installed packages or binary package
1.202 nia 1028: files. As with other management tools, it works with packages installed from
1029: source or binaries.
1.1 dsieger 1030:
1.202 nia 1031: 5.1.6. Checking for security vulnerabilities in installed packages
1.1 dsieger 1032:
1.202 nia 1033: The pkgsrc Security Team and Packages Groups maintain a list of known
1.164 leot 1034: vulnerabilities to packages which are (or have been) included in pkgsrc. The
1.202 nia 1035: list is available from the NetBSD CDN at https://cdn.NetBSD.org/pub/NetBSD/
1.179 rillig 1036: packages/vulns/pkg-vulnerabilities.
1.1 dsieger 1037:
1.202 nia 1038: Please note that not every "vulnerability" with a CVE assignment is exploitable
1039: in every configuration. Some bugs are marked as active simply because an fix
1040: was not marked as such. Operating system specific hardening and mitigation
1041: features may also reduce the impact of bugs.
1042:
1.23 jakllsch 1043: Through pkg_admin fetch-pkg-vulnerabilities, this list can be downloaded
1044: automatically, and a security audit of all packages installed on a system can
1045: take place.
1046:
1047: There are two components to auditing. The first step, pkg_admin
1048: fetch-pkg-vulnerabilities, is for downloading the list of vulnerabilities from
1049: the NetBSD FTP site. The second step, pkg_admin audit, checks to see if any of
1050: your installed packages are vulnerable. If a package is vulnerable, you will
1051: see output similar to the following:
1.1 dsieger 1052:
1053: Package samba-2.0.9 has a local-root-shell vulnerability, see
1.174 leot 1054: https://www.samba.org/samba/whatsnew/macroexploit.html
1.1 dsieger 1055:
1.23 jakllsch 1056: You may wish to have the vulnerabilities file downloaded daily so that it
1057: remains current. This may be done by adding an appropriate entry to the root
1058: users crontab(5) entry. For example the entry
1059:
1.121 sevan 1060: # Download vulnerabilities file
1.118 sevan 1061: 0 3 * * * /usr/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities >/dev/null 2>&1
1.121 sevan 1062: # Audit the installed packages and email results to root
1063: 9 3 * * * /usr/pkg/sbin/pkg_admin audit |mail -s "Installed package audit result" \
1064: root >/dev/null 2>&1
1.118 sevan 1065:
1066:
1067: will update the vulnerability list every day at 3AM, followed by an audit at
1068: 3:09AM. The result of the audit are then emailed to root. On NetBSD this may be
1069: accomplished instead by adding the following line to /etc/daily.conf:
1070:
1071: fetch_pkg_vulnerabilities=YES
1072:
1.23 jakllsch 1073:
1.118 sevan 1074: to fetch the vulnerability list from the daily security script. The system is
1075: set to audit the packages by default but can be set explicitly, if desired (not
1.123 wiz 1076: required), by adding the following line to /etc/security.conf:
1.23 jakllsch 1077:
1.118 sevan 1078: check_pkg_vulnerabilities=YES
1.23 jakllsch 1079:
1080:
1.118 sevan 1081: see daily.conf(5) and security.conf(5) for more details.
1.1 dsieger 1082:
1.202 nia 1083: 5.1.7. Finding if newer versions of your installed packages are in pkgsrc
1.1 dsieger 1084:
1.12 weinem 1085: Install pkgtools/lintpkgsrc and run lintpkgsrc with the "-i" argument to check
1.202 nia 1086: if any packages are stale, e.g.
1.1 dsieger 1087:
1088: % lintpkgsrc -i
1089: ...
1090: Version mismatch: 'tcsh' 6.09.00 vs 6.10.00
1091:
1092:
1.202 nia 1093: 5.1.8. Other administrative functions
1.1 dsieger 1094:
1095: The pkg_admin executes various administrative functions on the package system.
1096:
1.154 rillig 1097: 5.2. Building packages from source
1.1 dsieger 1098:
1099: After obtaining pkgsrc, the pkgsrc directory now contains a set of packages,
1.25 wiz 1100: organized into categories. You can browse the online index of packages, or run
1.1 dsieger 1101: make readme from the pkgsrc directory to build local README.html files for all
1102: packages, viewable with any web browser such as www/lynx or www/firefox.
1103:
1104: The default prefix for installed packages is /usr/pkg. If you wish to change
1105: this, you should do so by setting LOCALBASE in mk.conf. You should not try to
1106: use multiple different LOCALBASE definitions on the same system (inside a
1107: chroot is an exception).
1108:
1109: The rest of this chapter assumes that the package is already in pkgsrc. If it
1110: is not, see Part II, "The pkgsrc developer's guide" for instructions how to
1111: create your own packages.
1112:
1.154 rillig 1113: 5.2.1. Requirements
1.1 dsieger 1114:
1115: To build packages from source, you need a working C compiler. On NetBSD, you
1116: need to install the "comp" and the "text" distribution sets. If you want to
1117: build X11-related packages, the "xbase" and "xcomp" distribution sets are
1118: required, too.
1119:
1.154 rillig 1120: 5.2.2. Fetching distfiles
1.1 dsieger 1121:
1122: The first step for building a package is downloading the distfiles (i.e. the
1123: unmodified source). If they have not yet been downloaded, pkgsrc will fetch
1124: them automatically.
1125:
1126: If you have all files that you need in the distfiles directory, you don't need
1127: to connect. If the distfiles are on CD-ROM, you can mount the CD-ROM on /cdrom
1128: and add:
1129:
1130: DISTDIR=/cdrom/pkgsrc/distfiles
1131:
1132: to your mk.conf.
1133:
1134: By default a list of distribution sites will be randomly intermixed to prevent
1135: huge load on servers which holding popular packages (for example,
1136: SourceForge.net mirrors). Thus, every time when you need to fetch yet another
1137: distfile all the mirrors will be tried in new (random) order. You can turn this
1138: feature off by setting MASTER_SORT_RANDOM=NO (for PKG_DEVELOPERs it's already
1139: disabled).
1140:
1141: You can overwrite some of the major distribution sites to fit to sites that are
1142: close to your own. By setting one or two variables you can modify the order in
1143: which the master sites are accessed. MASTER_SORT contains a whitespace
1144: delimited list of domain suffixes. MASTER_SORT_REGEX is even more flexible, it
1145: contains a whitespace delimited list of regular expressions. It has higher
1146: priority than MASTER_SORT. Have a look at pkgsrc/mk/defaults/mk.conf to find
1147: some examples. This may save some of your bandwidth and time.
1148:
1149: You can change these settings either in your shell's environment, or, if you
1.4 rillig 1150: want to keep the settings, by editing the mk.conf file, and adding the
1.1 dsieger 1151: definitions there.
1152:
1.132 wiz 1153: If a package depends on many other packages (such as meta-pkgs/kde4), the build
1.1 dsieger 1154: process may alternate between periods of downloading source, and compiling. To
1155: ensure you have all the source downloaded initially you can run the command:
1156:
1157: % make fetch-list | sh
1158:
1159: which will output and run a set of shell commands to fetch the necessary files
1160: into the distfiles directory. You can also choose to download the files
1161: manually.
1162:
1.154 rillig 1163: 5.2.3. How to build and install
1.1 dsieger 1164:
1165: Once the software has downloaded, any patches will be applied, then it will be
1166: compiled for you. This may take some time depending on your computer, and how
1167: many other packages the software depends on and their compile time.
1168:
1169: Note
1170:
1171: If using bootstrap or pkgsrc on a non-NetBSD system, use the pkgsrc bmake
1172: command instead of "make" in the examples in this guide.
1173:
1174: For example, type
1175:
1176: % cd misc/figlet
1177: % make
1178:
1179:
1180: at the shell prompt to build the various components of the package.
1181:
1182: The next stage is to actually install the newly compiled program onto your
1183: system. Do this by entering:
1184:
1185: % make install
1186:
1187:
1188: while you are still in the directory for whatever package you are installing.
1189:
1190: Installing the package on your system may require you to be root. However,
1191: pkgsrc has a just-in-time-su feature, which allows you to only become root for
1192: the actual installation step.
1193:
1194: That's it, the software should now be installed and setup for use. You can now
1195: enter:
1196:
1197: % make clean
1198:
1199:
1200: to remove the compiled files in the work directory, as you shouldn't need them
1201: any more. If other packages were also added to your system (dependencies) to
1202: allow your program to compile, you can tidy these up also with the command:
1203:
1204: % make clean-depends
1205:
1206:
1207: Taking the figlet utility as an example, we can install it on our system by
1.207 leot 1208: building as shown in Appendix C, Build logs.
1.1 dsieger 1209:
1210: The program is installed under the default root of the packages tree - /usr/
1211: pkg. Should this not conform to your tastes, set the LOCALBASE variable in your
1212: environment, and it will use that value as the root of your packages tree. So,
1213: to use /usr/local, set LOCALBASE=/usr/local in your environment. Please note
1214: that you should use a directory which is dedicated to packages and not shared
1215: with other programs (i.e., do not try and use LOCALBASE=/usr). Also, you should
1216: not try to add any of your own files or directories (such as src/, obj/, or
1217: pkgsrc/) below the LOCALBASE tree. This is to prevent possible conflicts
1218: between programs and other files installed by the package system and whatever
1219: else may have been installed there.
1220:
1.4 rillig 1221: Some packages look in mk.conf to alter some configuration options at build
1.1 dsieger 1222: time. Have a look at pkgsrc/mk/defaults/mk.conf to get an overview of what will
1223: be set there by default. Environment variables such as LOCALBASE can be set in
1.4 rillig 1224: mk.conf to save having to remember to set them each time you want to use
1.1 dsieger 1225: pkgsrc.
1226:
1227: Occasionally, people want to "look under the covers" to see what is going on
1228: when a package is building or being installed. This may be for debugging
1229: purposes, or out of simple curiosity. A number of utility values have been
1230: added to help with this.
1231:
1232: 1. If you invoke the make(1) command with PKG_DEBUG_LEVEL=2, then a huge
1233: amount of information will be displayed. For example,
1234:
1235: make patch PKG_DEBUG_LEVEL=2
1236:
1.25 wiz 1237: will show all the commands that are invoked, up to and including the "patch
1238: " stage.
1.1 dsieger 1239:
1240: 2. If you want to know the value of a certain make(1) definition, then the
1241: VARNAME definition should be used, in conjunction with the show-var target.
1242: e.g. to show the expansion of the make(1) variable LOCALBASE:
1243:
1244: % make show-var VARNAME=LOCALBASE
1245: /usr/pkg
1246: %
1247:
1248:
1249: If you want to install a binary package that you've either created yourself
1250: (see next section), that you put into pkgsrc/packages manually or that is
1251: located on a remote FTP server, you can use the "bin-install" target. This
1252: target will install a binary package - if available - via pkg_add(1), else do a
1253: make package. The list of remote FTP sites searched is kept in the variable
1254: BINPKG_SITES, which defaults to ftp.NetBSD.org. Any flags that should be added
1255: to pkg_add(1) can be put into BIN_INSTALL_FLAGS. See pkgsrc/mk/defaults/mk.conf
1256: for more details.
1257:
1258: A final word of warning: If you set up a system that has a non-standard setting
1259: for LOCALBASE, be sure to set that before any packages are installed, as you
1260: cannot use several directories for the same purpose. Doing so will result in
1261: pkgsrc not being able to properly detect your installed packages, and fail
1262: miserably. Note also that precompiled binary packages are usually built with
1263: the default LOCALBASE of /usr/pkg, and that you should not install any if you
1264: use a non-standard LOCALBASE.
1265:
1.154 rillig 1266: Chapter 6. Configuring pkgsrc
1.1 dsieger 1267:
1268: Table of Contents
1269:
1.154 rillig 1270: 6.1. General configuration
1271: 6.2. Variables affecting the build process
1.241 rillig 1272: 6.3. Preferences for native or pkgsrc software
1273: 6.4. Variables affecting the installation process
1274: 6.5. Selecting and configuring the compiler
1275: 6.5.1. Selecting the compiler
1276: 6.5.2. Additional flags to the compiler (CFLAGS)
1277: 6.5.3. Additional flags to the linker (LDFLAGS)
1278: 6.6. Developer/advanced settings
1279: 6.7. Selecting Build Options
1.1 dsieger 1280:
1281: The whole pkgsrc system is configured in a single file, usually called mk.conf.
1282: In which directory pkgsrc looks for that file depends on the installation. On
1283: NetBSD, when you use make(1) from the base system, it is in the directory /etc
1284: /. In all other cases the default location is ${PREFIX}/etc/, depending on
1285: where you told the bootstrap program to install the binary packages.
1286:
1287: The format of the configuration file is that of the usual BSD-style Makefiles.
1288: The whole pkgsrc configuration is done by setting variables in this file. Note
1289: that you can define all kinds of variables, and no special error checking (for
1.112 rillig 1290: example for spelling mistakes) takes place.
1.1 dsieger 1291:
1.154 rillig 1292: 6.1. General configuration
1.1 dsieger 1293:
1.112 rillig 1294: The following variables apply to all pkgsrc packages. A complete list of the
1295: variables that can be configured by the user is available in mk/defaults/
1296: mk.conf, together with some comments that describe each variable's intent.
1.1 dsieger 1297:
1298: * LOCALBASE: Where packages will be installed. The default is /usr/pkg. Do
1299: not mix binary packages with different LOCALBASEs!
1300:
1301: * CROSSBASE: Where "cross" category packages will be installed. The default
1302: is ${LOCALBASE}/cross.
1303:
1.84 wiz 1304: * X11BASE: Where X11 is installed on the system. The default is /usr/X11R7.
1.1 dsieger 1305:
1306: * DISTDIR: Where to store the downloaded copies of the original source
1307: distributions used for building pkgsrc packages. The default is $
1308: {PKGSRCDIR}/distfiles.
1309:
1310: * PKG_DBDIR: Where the database about installed packages is stored. The
1.118 sevan 1311: default is /usr/pkg/pkgdb.
1.1 dsieger 1312:
1313: * MASTER_SITE_OVERRIDE: If set, override the packages' MASTER_SITES with this
1314: value.
1315:
1316: * MASTER_SITE_BACKUP: Backup location(s) for distribution files and patch
1317: files if not found locally or in ${MASTER_SITES} or ${PATCH_SITES}
1.118 sevan 1318: respectively. The defaults is ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/$
1.1 dsieger 1319: {DIST_SUBDIR}/.
1320:
1321: * BINPKG_SITES: List of sites carrying binary pkgs. rel and arch are replaced
1322: with OS release ("2.0", etc.) and architecture ("mipsel", etc.).
1323:
1.23 jakllsch 1324: * ACCEPTABLE_LICENSES: List of acceptable licenses. License names are
1325: case-sensitive. Whenever you try to build a package whose license is not in
1326: this list, you will get an error message. If the license condition is
1327: simple enough, the error message will include specific instructions on how
1328: to change this variable.
1.1 dsieger 1329:
1.154 rillig 1330: 6.2. Variables affecting the build process
1.1 dsieger 1331:
1332: * PACKAGES: The top level directory for the binary packages. The default is $
1333: {PKGSRCDIR}/packages.
1334:
1335: * WRKOBJDIR: The top level directory where, if defined, the separate working
1336: directories will get created, and symbolically linked to from ${WRKDIR}
1337: (see below). This is useful for building packages on several architectures,
1338: then ${PKGSRCDIR} can be NFS-mounted while ${WRKOBJDIR} is local to every
1339: architecture. (It should be noted that PKGSRCDIR should not be set by the
1.198 leot 1340: user -- it is an internal definition which refers to the root of the pkgsrc
1.1 dsieger 1341: tree. It is possible to have many pkgsrc tree instances.)
1342:
1343: * LOCALPATCHES: Directory for local patches that aren't part of pkgsrc. See
1.184 rillig 1344: Section 12.3, "patches/*" for more information.
1.1 dsieger 1345:
1346: * PKGMAKECONF: Location of the mk.conf file used by a package's BSD-style
1347: Makefile. If this is not set, MAKECONF is set to /dev/null to avoid picking
1348: up settings used by builds in /usr/src.
1349:
1.241 rillig 1350: 6.3. Preferences for native or pkgsrc software
1351:
1352: Whenever a package depends on a package that has a builtin.mk file, the
1353: dependent package can either use the built-in (native) version from the base
1354: system or the pkgsrc-provided version. This only affects dependencies, so it is
1355: still possible to build the pkgsrc package devel/pcre++ even when other
1356: packages depend on the native pcre++ version instead.
1357:
1358: To force using the pkgsrc-provided version for a particular package, define "
1359: PREFER_PKGSRC = package-ID" in mk.conf. To force using the native package,
1360: define "PREFER_NATIVE = package-ID". In both cases, the package-ID is the one
1361: from the buildlink3.mk of the package. In most cases, this ID is the same as
1362: the directory name of the package, but for example, devel/pcre++ has the
1363: package ID "pcrexx".
1364:
1365: For the packages that are not listed by their package ID, pkgsrc uses the
1366: pkgsrc-provided version if PREFER_PKGSRC contains the word "yes". Otherwise, if
1367: PREFER_NATIVE contains the word "yes", pkgsrc uses the native version. For
1368: example, to require using the pkgsrc-provided versions for all but the most
1369: basic bits on a NetBSD system, you can set:
1370:
1371: PREFER_PKGSRC= yes
1372: PREFER_NATIVE= getopt skey tcp_wrappers
1373:
1374: A package must have a builtin.mk file to be listed in PREFER_NATIVE, otherwise
1375: it is simply ignored in that list.
1376:
1377: PREFER_PKGSRC and PREFER_NATIVE should be set during bootstrap to ensure that
1378: the bootstrap process does not use inapropriate native tools as dependencies
1379: for core packages.
1380:
1381: # ./bootstrap --prefer-pkgsrc yes --prefer-native openssl
1382:
1383: Switching between settings globally at a later date can introduce complications
1384: with dependency resolution. This is caused by packages built with the opposite
1385: preference being installed alongside each other. Hence, when changing any of
1386: these variables after bootstrap, you need to rebuild all packages depending on
1387: those whose preference has been changed. This is not trivial and should be
1388: avoided.
1389:
1390: When using pkgsrc on Linux systems, there is high risk of "leakage", where
1391: programs installed by pkgsrc may inadvertently use a command or library not
1392: installed by pkgsrc, e.g. those installed by yum or apt. Such foreign
1393: dependencies may be installed, removed, or upgraded to a version incompatible
1394: with the pkgsrc package at any time, causing pkgsrc packages to subsequently
1395: malfunction. Pkgsrc cannot prevent this, as it has no control over other
1396: package managers. Another potential problem is that under Redhat Enterprise and
1397: related Linux systems, yum packages are only patched and never upgraded, so
1398: eventually they may become too outdated for use by pkgsrc. Even intentionally
1399: using foreign dependencies, not considered leakage, can lead to these problems,
1400: so it is generally discouraged. In order to minimize such problems,
1401: PREFER_PKGSRC defaults to "yes" on Linux systems. This ensures that pkgsrc is
1402: aware of any changes to dependency packages and can rebuild or upgrade the
1403: entire dependency tree as needed. This default can be overridden by setting
1404: --prefer-pkgsrc to a list of packages and --prefer-native to "yes".
1405:
1406: 6.4. Variables affecting the installation process
1.1 dsieger 1407:
1.198 leot 1408: * PKGSRC_KEEP_BIN_PKGS: By default, binary packages of built packages are
1.150 leot 1409: preserved in ${PACKAGES}/All. Setting this variable to "no" prevents this.
1.1 dsieger 1410:
1.107 jnemeth 1411: Packages have to support installation into a subdirectory of WRKDIR. This
1412: allows a package to be built, before the actual filesystem is touched. DESTDIR
1413: support exists in two variations:
1.4 rillig 1414:
1415: * Basic DESTDIR support means that the package installation and packaging is
1416: still run as root.
1417:
1418: * Full DESTDIR support can run the complete build, installation and packaging
1419: as normal user. Root privileges are only needed to add packages.
1420:
1421: With basic DESTDIR support, make clean needs to be run as root.
1422:
1.17 imil 1423: Considering the foo/bar package, DESTDIR full support can be tested using the
1424: following commands
1425:
1426: $ id
1427: uid=1000(myusername) gid=100(users) groups=100(users),0(wheel)
1428: $ mkdir $HOME/packages
1429: $ cd $PKGSRCDIR/foo/bar
1430:
1431: Verify DESTDIR full support, no root privileges should be needed
1432:
1.66 asau 1433: $ make stage-install
1.17 imil 1434:
1435: Create a package without root privileges
1436:
1.66 asau 1437: $ make PACKAGES=$HOME/packages package
1.17 imil 1438:
1439: For the following command, you must be able to gain root privileges using su(1)
1440:
1.66 asau 1441: $ make PACKAGES=$HOME/packages install
1.17 imil 1442:
1443: Then, as a simple user
1444:
1445: $ make clean
1446:
1.241 rillig 1447: 6.5. Selecting and configuring the compiler
1.4 rillig 1448:
1.241 rillig 1449: 6.5.1. Selecting the compiler
1.1 dsieger 1450:
1451: By default, pkgsrc will use GCC to build packages. This may be overridden by
1452: setting the following variables in /etc/mk.conf:
1453:
1454: PKGSRC_COMPILER:
1455:
1456: This is a list of values specifying the chain of compilers to invoke when
1457: building packages. Valid values are:
1458:
1.259 leot 1459: + ccc: Compaq C Compilers (Tru64)
1.66 asau 1460:
1.259 leot 1461: + ccache: compiler cache (chainable)
1.66 asau 1462:
1.259 leot 1463: + clang: Clang C and Objective-C compiler
1.66 asau 1464:
1.259 leot 1465: + distcc: distributed C/C++ (chainable)
1.1 dsieger 1466:
1.259 leot 1467: + f2c: Fortran 77 to C compiler (chainable)
1.66 asau 1468:
1.259 leot 1469: + icc: Intel C++ Compiler (Linux)
1.66 asau 1470:
1.259 leot 1471: + ido: SGI IRIS Development Option cc (IRIX 5)
1.1 dsieger 1472:
1.259 leot 1473: + gcc: GNU C/C++ Compiler
1.1 dsieger 1474:
1.259 leot 1475: + hp: HP-UX C/aC++ compilers
1.66 asau 1476:
1.259 leot 1477: + mipspro: Silicon Graphics, Inc. MIPSpro (n32/n64)
1.1 dsieger 1478:
1.259 leot 1479: + mipspro-ucode: Silicon Graphics, Inc. MIPSpro (o32)
1.1 dsieger 1480:
1.259 leot 1481: + sunpro: Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio
1.1 dsieger 1482:
1.259 leot 1483: + xlc: IBM's XL C/C++ compiler suite
1.66 asau 1484:
1.1 dsieger 1485: The default is "gcc". You can use ccache and/or distcc with an appropriate
1486: PKGSRC_COMPILER setting, e.g. "ccache gcc". This variable should always be
1487: terminated with a value for a real compiler. Note that only one real
1488: compiler should be listed (e.g. "sunpro gcc" is not allowed).
1489:
1490: GCC_REQD:
1491:
1492: This specifies the minimum version of GCC to use when building packages. If
1493: the system GCC doesn't satisfy this requirement, then pkgsrc will build and
1494: install one of the GCC packages to use instead.
1495:
1.153 leot 1496: PYTHON_VERSION_DEFAULT:
1.114 maya 1497:
1498: Specifies which version of python to use when several options are
1499: available.
1500:
1501: PKGSRC_FORTRAN:
1502:
1.176 gutterid 1503: Specifies the Fortran compiler to use. The default is gfortran.
1.114 maya 1504:
1505: GFORTRAN_VERSION:
1506:
1507: If PKGSRC_FORTRAN= gfortran is used, this option specifies which version to
1508: use.
1509:
1.241 rillig 1510: 6.5.2. Additional flags to the compiler (CFLAGS)
1.1 dsieger 1511:
1512: If you wish to set the CFLAGS variable, please make sure to use the += operator
1513: instead of the = operator:
1514:
1515: CFLAGS+= -your -flags
1516:
1517: Using CFLAGS= (i.e. without the "+") may lead to problems with packages that
1.16 jnemeth 1518: need to add their own flags. You may want to take a look at the devel/cpuflags
1.24 wiz 1519: package if you're interested in optimization specifically for the current CPU.
1.1 dsieger 1520:
1.241 rillig 1521: 6.5.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 1522:
1523: If you want to pass flags to the linker, both in the configure step and the
1524: build step, you can do this in two ways. Either set LDFLAGS or LIBS. The
1525: difference between the two is that LIBS will be appended to the command line,
1526: while LDFLAGS come earlier. LDFLAGS is pre-loaded with rpath settings for ELF
1527: machines depending on the setting of USE_IMAKE or the inclusion of mk/
1528: x11.buildlink3.mk. As with CFLAGS, if you do not wish to override these
1529: settings, use the += operator:
1530:
1531: LDFLAGS+= -your -linkerflags
1532:
1.241 rillig 1533: 6.6. Developer/advanced settings
1.1 dsieger 1534:
1535: * PKG_DEVELOPER: Run some sanity checks that package developers want:
1536:
1.42 asau 1537: + make sure patches apply with zero fuzz
1.1 dsieger 1538:
1.42 asau 1539: + run check-shlibs to see that all binaries will find their shared libs.
1.1 dsieger 1540:
1.232 gutterid 1541: * CHECK_FILES_STRICT: Also check VARBASE and PKG_SYSCONFDIR values in PLIST
1542: entries.
1543:
1.1 dsieger 1544: * PKG_DEBUG_LEVEL: The level of debugging output which is displayed whilst
1545: making and installing the package. The default value for this is 0, which
1546: will not display the commands as they are executed (normal, default, quiet
1547: operation); the value 1 will display all shell commands before their
1548: invocation, and the value 2 will display both the shell commands before
1.112 rillig 1549: their invocation, as well as their actual execution progress with set -x.
1.1 dsieger 1550:
1.241 rillig 1551: 6.7. Selecting Build Options
1.1 dsieger 1552:
1553: Some packages have build time options, usually to select between different
1554: dependencies, enable optional support for big dependencies or enable
1555: experimental features.
1556:
1557: To see which options, if any, a package supports, and which options are
1558: mutually exclusive, run make show-options, for example:
1559:
1560: The following options are supported by this package:
1561: ssl Enable SSL support.
1562: Exactly one of the following gecko options is required:
1563: firefox Use firefox as gecko rendering engine.
1564: mozilla Use mozilla as gecko rendering engine.
1565: At most one of the following database options may be selected:
1566: mysql Enable support for MySQL database.
1567: pgsql Enable support for PostgreSQL database.
1568:
1569: These options are enabled by default: firefox
1570: These options are currently enabled: mozilla ssl
1571:
1.4 rillig 1572: The following variables can be defined in mk.conf to select which options to
1573: enable for a package: PKG_DEFAULT_OPTIONS, which can be used to select or
1.1 dsieger 1574: disable options for all packages that support them, and PKG_OPTIONS.pkgbase,
1575: which can be used to select or disable options specifically for package pkgbase
1576: . Options listed in these variables are selected, options preceded by "-" are
1577: disabled. A few examples:
1578:
1.4 rillig 1579: $ grep "PKG.*OPTION" mk.conf
1.1 dsieger 1580: PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
1581: PKG_OPTIONS.kdebase= debug -sasl
1582: PKG_OPTIONS.apache= suexec
1583:
1.11 rillig 1584: It is important to note that options that were specifically suggested by the
1.19 snj 1585: package maintainer must be explicitly removed if you do not wish to include the
1586: option. If you are unsure you can view the current state with make show-options
1587: .
1.11 rillig 1588:
1.1 dsieger 1589: The following settings are consulted in the order given, and the last setting
1590: that selects or disables an option is used:
1591:
1592: 1. the default options as suggested by the package maintainer
1593:
1594: 2. the options implied by the settings of legacy variables (see below)
1595:
1596: 3. PKG_DEFAULT_OPTIONS
1597:
1598: 4. PKG_OPTIONS.pkgbase
1599:
1600: For groups of mutually exclusive options, the last option selected is used, all
1601: others are automatically disabled. If an option of the group is explicitly
1602: disabled, the previously selected option, if any, is used. It is an error if no
1603: option from a required group of options is selected, and building the package
1604: will fail.
1605:
1606: Before the options framework was introduced, build options were selected by
1.4 rillig 1607: setting a variable (often named USE_FOO) in mk.conf for each option. To ease
1608: transition to the options framework for the user, these legacy variables are
1609: converted to the appropriate options setting (PKG_OPTIONS.pkgbase)
1610: automatically. A warning is issued to prompt the user to update mk.conf to use
1611: the options framework directly. Support for the legacy variables will be
1.1 dsieger 1612: removed eventually.
1613:
1.154 rillig 1614: Chapter 7. Creating binary packages
1.1 dsieger 1615:
1616: Table of Contents
1617:
1.154 rillig 1618: 7.1. Building a single binary package
1619: 7.2. Settings for creation of binary packages
1.1 dsieger 1620:
1.154 rillig 1621: 7.1. Building a single binary package
1.1 dsieger 1622:
1623: Once you have built and installed a package, you can create a binary package
1624: which can be installed on another system with pkg_add(1). This saves having to
1625: build the same package on a group of hosts and wasting CPU time. It also
1626: provides a simple means for others to install your package, should you
1627: distribute it.
1628:
1629: To create a binary package, change into the appropriate directory in pkgsrc,
1630: and run make package:
1631:
1.112 rillig 1632: $ cd misc/figlet
1633: $ make package
1.1 dsieger 1634:
1.242 gutterid 1635: This will build your package (if not already done) and package it into a binary
1636: package. You can then use the pkg_* tools to manipulate it. Binary packages are
1637: created in PACKAGES, which defaults to /usr/pkgsrc/packages, in the form of a
1638: compressed tar file. See Section C.2, "Packaging figlet" for a continuation of
1639: the above misc/figlet example.
1.1 dsieger 1640:
1.154 rillig 1641: See Chapter 23, Submitting and Committing for information on how to submit such
1.1 dsieger 1642: a binary package.
1643:
1.154 rillig 1644: 7.2. Settings for creation of binary packages
1.1 dsieger 1645:
1.184 rillig 1646: See Section 13.17, "Other helpful targets".
1.6 rillig 1647:
1.154 rillig 1648: Chapter 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 1649:
1650: Table of Contents
1651:
1.154 rillig 1652: 8.1. Preparations
1.180 rillig 1653: 8.2. Running a bulk build
1.154 rillig 1654: 8.2.1. Configuration
1655: 8.3. Requirements of a full bulk build
1.178 rillig 1656: 8.4. Bulk build variants
1.179 rillig 1657: 8.4.1. Detect unknown configure options
1658: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 1659: 8.4.3. Force compiler options only in the build phase
1660: 8.4.4. Use custom directories
1661: 8.4.5. Turn warnings into errors
1662: 8.4.6. Reject packages for which pkglint reports errors
1663: 8.4.7. Reject packages that contain forbidden strings
1664: 8.4.8. Reject packages whose self-test fails
1665: 8.4.9. Reject packages that use undefined shell variables
1666: 8.4.10. Turn off verbose logging
1.178 rillig 1667: 8.5. Creating a multiple CD-ROM packages collection
1668: 8.5.1. Example of cdpack
1.6 rillig 1669:
1.175 gutterid 1670: For a number of reasons, you may want to build binary packages for a large
1671: selected set of packages in pkgsrc, or even for all pkgsrc packages. For
1.71 wiz 1672: instance, when you have multiple machines that should run the same software, it
1673: is wasted time if they all build their packages themselves from source. Or you
1674: may want to build a list of packages you want and check them before deploying
1.175 gutterid 1675: onto production systems. There is a way of getting a set of binary packages:
1676: the bulk build system, or pbulk ("p" stands for "parallel"). This chapter
1677: describes how to set it up.
1.71 wiz 1678:
1.154 rillig 1679: 8.1. Preparations
1.71 wiz 1680:
1681: First of all, you have to decide whether you build all packages or a limited
1682: set of them. Full bulk builds usually consume a lot more resources, both space
1.175 gutterid 1683: and time, than builds for some practical sets of packages. A number of
1684: particularly heavy packages exist that are not actually interesting to a wide
1685: audience. (The approximate resource consumption for a full bulk build is given
1686: in section Section 8.3, "Requirements of a full bulk build".) For limited bulk
1687: builds you need to make a list of packages you want to build. Note that all
1688: their dependencies will be built, so you don't need to track them manually.
1.71 wiz 1689:
1690: During bulk builds various packages are installed and deinstalled in /usr/pkg
1691: (or whatever LOCALBASE is), so make sure that you don't need any package during
1.112 rillig 1692: the builds. Essentially, you should provide a fresh system, either a chroot
1.71 wiz 1693: environment or something even more restrictive, depending on what the operating
1694: system provides, or dedicate the whole physical machine. As a useful side
1695: effect this makes sure that bulk builds cannot break anything in your system.
1696: There have been numerous cases where certain packages tried to install files
1697: outside the LOCALBASE or wanted to edit some files in /etc.
1.6 rillig 1698:
1.180 rillig 1699: 8.2. Running a bulk build
1.6 rillig 1700:
1.180 rillig 1701: Running a bulk build works roughly as follows:
1.15 rillig 1702:
1703: * First, build the pbulk infrastructure in a fresh pkgsrc location.
1704:
1705: * Then, build each of the packages from a clean installation directory using
1706: the infrastructure.
1707:
1.154 rillig 1708: 8.2.1. Configuration
1.6 rillig 1709:
1.112 rillig 1710: To simplify configuration, we provide the helper script mk/pbulk/pbulk.sh.
1.6 rillig 1711:
1.68 asau 1712: In order to use it, prepare a clear system (real one, chroot environment, jail,
1713: zone, virtual machine). Configure network access to fetch distribution files.
1.112 rillig 1714: Create a user with name "pbulk".
1.68 asau 1715:
1716: Fetch and extract pkgsrc. Use a command like one of these:
1717:
1.151 sevan 1718: # (cd /usr && ftp -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1719: # (cd /usr && fetch -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1.72 wiz 1720: # (cd /usr && cvs -Q -z3 -d anoncvs@anoncvs.NetBSD.org:/cvsroot get -P pkgsrc)
1.68 asau 1721:
1722: Or any other way that fits (e.g., curl, wget).
1723:
1724: Deploy and configure pbulk tools, e.g.:
1725:
1.118 sevan 1726: # sh pbulk.sh -n # use native make, no bootstrap kit needed (for use on NetBSD)
1.68 asau 1727: # sh pbulk.sh -n -c mk.conf.frag # native, apply settings from given mk.conf fragment
1728: # sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build
1729:
1730: Note
1731:
1732: mk.conf.frag is a fragment of mk.conf that contains settings you want to apply
1733: to packages you build. For instance,
1734:
1.112 rillig 1735: PKG_DEVELOPER= yes # perform more checks
1736: X11_TYPE= modular # use pkgsrc X11
1737: SKIP_LICENSE_CHECK= yes # accept all licences (useful
1738: # when building all packages)
1.68 asau 1739:
1740: If configured for limited list, replace the list in /usr/pbulk/etc/pbulk.list
1.112 rillig 1741: with your list of packages, one per line without empty lines or comments. E.g.:
1.68 asau 1742:
1743: www/firefox
1744: mail/thunderbird
1745: misc/libreoffice4
1746:
1.69 asau 1747: At this point you can also review configuration in /usr/pbulk/etc and make
1748: final amendments, if wanted.
1749:
1.68 asau 1750: Start it:
1751:
1752: # /usr/pbulk/bin/bulkbuild
1753:
1754: After it finishes, you'll have /mnt filled with distribution files, binary
1755: packages, and reports, plain text summary in /mnt/bulklog/meta/report.txt
1756:
1757: Note
1758:
1759: The pbulk.sh script does not cover all possible use cases. While being ready to
1760: run, it serves as a good starting point to understand and build more complex
1761: setups. The script is kept small enough for better understanding.
1762:
1763: Note
1764:
1765: The pbulk.sh script supports running unprivileged bulk build and helps
1.205 wiz 1766: configuring distributed bulk builds. Distributed bulk builds support either
1767: building in worker chroots (each node is a path to a different chroot) that
1768: replicate the target system, including the pbulk prefix, or remote machines
1769: (each node is an IP address that must be accessible over SSH without a
1770: password).
1.15 rillig 1771:
1.154 rillig 1772: 8.3. Requirements of a full bulk build
1.71 wiz 1773:
1774: A complete bulk build requires lots of disk space. Some of the disk space can
1775: be read-only, some other must be writable. Some can be on remote filesystems
1776: (such as NFS) and some should be local. Some can be temporary filesystems,
1777: others must survive a sudden reboot.
1778:
1.205 wiz 1779: * 70 GB for the distfiles (read-write, remote, temporary)
1.71 wiz 1780:
1.205 wiz 1781: * 60 GB for the binary packages (read-write, remote, permanent)
1.71 wiz 1782:
1783: * 1 GB for the pkgsrc tree (read-only, remote, permanent)
1784:
1785: * 5 GB for LOCALBASE (read-write, local, temporary)
1786:
1787: * 10 GB for the log files (read-write, remote, permanent)
1788:
1789: * 5 GB for temporary files (read-write, local, temporary)
1790:
1.178 rillig 1791: 8.4. Bulk build variants
1792:
1793: To ensure that pkgsrc packages work in different configurations, it makes sense
1794: to run non-default bulk builds from time to time. This section lists some ideas
1795: for bulk builds that intentionally let packages fail if they don't follow the
1796: pkgsrc style.
1797:
1.179 rillig 1798: 8.4.1. Detect unknown configure options
1.178 rillig 1799:
1800: Add the following line to mk.conf.
1801:
1802: GNU_CONFIGURE_STRICT= yes
1803:
1804: When a package fails this additional check, the most common cause is that the
1805: configure option was valid for an older version of the package but does not
1806: apply anymore. In that case, just remove it.
1807:
1.179 rillig 1808: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.178 rillig 1809:
1810: The job of a compiler is not restricted to producing executable code, most
1.179 rillig 1811: compilers also detect typical programming mistakes. The pkgsrc compiler
1812: wrappers make it easy to force compiler options when the package is built. This
1813: can be used to find typical bugs across all packages that are in pkgsrc. By
1814: reporting these bugs upstream, the packages will be more reliable with the next
1815: updates.
1.178 rillig 1816:
1.179 rillig 1817: Add some of the following lines to mk.conf:
1.178 rillig 1818:
1819: CFLAGS+= -Werror=char-subscripts
1.179 rillig 1820: CFLAGS+= -Werror=implicit-function-declaration
1.178 rillig 1821:
1.179 rillig 1822: When a package fails to build using these stricter compiler options, document
1823: the circumstances in which the compiler produced the error message. This
1824: includes:
1.178 rillig 1825:
1826: * The platform (MACHINE_PLATFORM)
1827:
1828: * The source file
1829:
1830: * An excerpt of the code. GCC and Clang already do this as part of the
1831: diagnostic.
1832:
1.179 rillig 1833: * The exact error message from the compiler.
1.178 rillig 1834:
1.179 rillig 1835: If a package produces these error messages, but the package is fine, record
1836: this in your local mk.conf, like this, to skip this check in the next builds:
1.178 rillig 1837:
1.179 rillig 1838: .if ${PKGPATH} == category/package
1.178 rillig 1839: # Version ${VERSION} failed on ${MACHINE_PLATFORM}:
1840: # error message
1841: # code
1.179 rillig 1842: # Reason why the code does not need to be fixed.
1.178 rillig 1843: BUILDLINK_TRANSFORM+= rm:-Werror=char-subscripts
1.179 rillig 1844: .endif
1.178 rillig 1845:
1846: If the error messages from the compiler are valid and the code needs to be
1.179 rillig 1847: fixed, prepare a local patch (see LOCALPATCHES) and report the bug to the
1848: upstream authors of the package, providing them with the information you
1849: collected above.
1.178 rillig 1850:
1.179 rillig 1851: Patches that are not essential for the package to work should only be reported
1852: upstream but not committed to pkgsrc, to make future updates easier.
1853:
1.181 rillig 1854: 8.4.3. Force compiler options only in the build phase
1855:
1856: When adding custom compiler flags via CFLAGS, these apply to all phases of the
1857: package build process. Especially in the configure phase, adding -Werror leads
1858: to wrong decisions. The GNU configure scripts feed many small test programs to
1859: the C compiler to see whether certain headers are available, functions are
1860: defined in a library and programs can be run. In many cases these programs
1861: would not survive a strict compiler run with -Wall -Wextra -Werror.
1862:
1863: The pkgsrc infrastructure is flexible enough to support compiler options being
1864: added between the configure and build phases. It's a little more complicated
1865: than the other examples in this section but still easy enough.
1866:
1867: The basic idea is to use the pkgsrc compiler wrapper to inject the desired
1868: compiler options. The compiler wrapper's original task is to hide unwanted
1869: directories of include files and to normalize compiler options. It does this by
1870: wrapping the compiler command and rewriting the command line. To see this in
1871: action, run bmake patch in a package directory and examine the work/.cwrappers/
1872: config directory. It contains individual configurations for the C compiler and
1873: the related tools. The plan is to find a hook between the configure and build
1874: phases, and to modify these configuration files at that point.
1875:
1876: To find this hook, have a look at mk/build/build.mk, which contains among
1877: others the pre-build-checks-hook. The word checks doesn't quite fit, but the
1878: pre-build-hook sounds good enough.
1879:
1880: The code to be included in mk.conf is:
1881:
1882: # Just a few example options.
1883: BUILD_ONLY_CFLAGS= -Wall -Werror -O2 -DTEMPDIR='"/tmp"'
1884:
1885: .if ${BUILD_ONLY_CFLAGS:U:M*}
1886: pre-build-checks-hook: add-build-only-cflags
1887:
1888: add-build-only-cflags: .PHONY
1889: ${RUN} cd ${CWRAPPERS_CONFIG_DIR}; \
1890: ${TEST} ! -f ${.TARGET} || exit 0; \
1891: for flag in ${BUILD_ONLY_CFLAGS}; do \
1892: ${ECHO} "append=$$flag" >> cc; \
1893: done; \
1894: > ${.TARGET}
1895: .endif
1896:
1897: (When editing the mk.conf, make sure that the commands of the
1898: add-build-only-cflags target are indented with a tab, not with spaces.)
1899:
1900: The condition in the .if statement contains the :U modifier to prevent parse
1901: errors if the variable should be undefined, possibly because it is only defined
1902: for a subset of the packages. The :M* modifier ensures that there is at least
1903: one compiler option, to prevent a syntax error in the shell parser.
1904:
1905: The code around the ${.TARGET} variable ensures that the additional compiler
1906: options are only appended once, even if bmake build is run multiple times. To
1907: do this, it creates a marker file.
1908:
1909: To verify that this setup works, run bmake configure in a package directory. Up
1910: to now, everything works as usual. Examine the directory work/.cwrappers/config
1911: to see that the compiler options from BUILD_ONLY_CFLAGS are not yet added to
1912: the file cc. Examine the tail of the work/.work.log file to see that the normal
1913: compiler options are used.
1914:
1915: Now run bmake build. This will append the options to the file cc and will
1916: create the marker file in the same directory. After that, the build starts as
1917: usual, but with the added compiler options. Examine the tail of the file work
1918: /.work.log to see that the lines starting with [*] don't contain the compiler
1919: options, but the corresponding lines starting with <.> do end with these
1920: options.
1921:
1922: Building packages using this setup variant and fixing the resulting bugs is the
1923: same as in Section 8.4.2, "Detect classes of bugs by forcing compiler warnings"
1924: .
1925:
1926: 8.4.4. Use custom directories
1.178 rillig 1927:
1928: Some directories like PREFIX, VARBASE, PKG_SYSCONFDIR, PKGMANDIR, PKG_INFODIR
1929: can be configured in pkgsrc. Set these to arbitrary paths during bootstrap or
1930: afterwards in mk.conf.
1931:
1932: PREFIX= /a-random-uuid
1933: PKG_SYSCONFDIR= /a-random-uuid
1934: VARBASE= /a-random-uuid
1935: PKGMANDIR= a-random-uuid
1936: PKG_INFODIR= a-random-uuid
1937:
1.181 rillig 1938: 8.4.5. Turn warnings into errors
1.178 rillig 1939:
1940: When building a package, warnings are typically ignored since they just flow by
1941: and do not cause the build to fail immediately. To find these warnings,
1942: redefine them to errors in mk.conf.
1943:
1944: DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)"
1945: WARNING_MSG= ${FAIL_MSG} "(was warning)"
1946:
1947: (There are many more classes of warnings in pkgsrc, and most of them can be
1948: redefined with a simple definition like above.
1949:
1.179 rillig 1950: If a package suggests to add USE_TOOLS+=perl to the package Makefile, research
1.178 rillig 1951: whether the package actually needs Perl. If it does, add USE_TOOLS+=perl to the
1952: package Makefile, and if it doesn't, add TOOLS_BROKEN+=perl.
1953:
1.181 rillig 1954: 8.4.6. Reject packages for which pkglint reports errors
1.178 rillig 1955:
1956: Using pkglint as part of the regular build process is mostly a waste of time.
1957: If you want to fix some of the warnings, just run pkglint recursively on the
1958: whole pkgsrc tree. This will take a few minutes (up to 10), which is much
1959: faster than a complete bulk build.
1960:
1.181 rillig 1961: 8.4.7. Reject packages that contain forbidden strings
1.178 rillig 1962:
1963: To ensure that the binary packages don't contain references to the build
1964: directory, there is already CHECK_WRKREF. If that variable includes the item
1965: extra, it is possible to define additional patterns that must not appear in any
1966: installed file. This is specified in mk.conf.
1967:
1968: CHECK_WRKREF= extra
1969: CHECK_WRKREF_EXTRA_DIRS+= /usr/local
1970: CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg
1971: CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@
1972:
1973: The above patterns will probably generate many false positives, therefore the
1974: results need to be taken with a grain of salt.
1975:
1.181 rillig 1976: 8.4.8. Reject packages whose self-test fails
1.178 rillig 1977:
1978: To run the test suites that come with each package, add this line to mk.conf.
1979:
1980: PKGSRC_RUN_TEST= yes
1981:
1982: Be prepared that even the most basic packages fail this test. When doing a bulk
1983: build with this, it will often abort in the early phase where the packages are
1984: scanned for their dependencies since there are cyclic dependencies. There is
1985: still a lot to do in this area.
1986:
1.181 rillig 1987: 8.4.9. Reject packages that use undefined shell variables
1.178 rillig 1988:
1989: To catch typos in the shell snippets from the Makefile fragments, add the -u
1990: flag to most of the commands by adding this line to mk.conf.
1991:
1992: RUN= @set -eu;
1993:
1.181 rillig 1994: After that, ensure that none of the bulk build log files (even those for
1995: successfully built packages) contains the string parameter not set or whatever
1996: error message the command sh -ceu '$undefined' outputs.
1997:
1.178 rillig 1998: See mk/misc/common.mk for the existing definition.
1999:
1.181 rillig 2000: 8.4.10. Turn off verbose logging
1.178 rillig 2001:
2002: The build logs of a package are often quite long. This allows error messages or
2003: other interesting details to hide between the noise. To make the actual error
2004: message stand out more, add these lines to mk.conf.
2005:
2006: GNU_CONFIGURE_QUIET= yes
2007: MAKE_FLAGS+= -s
2008:
2009: The -s option works for both GNU Make and BSD Make. On exotic platforms with
2010: their own make, it may be a little different.
2011:
2012: 8.5. Creating a multiple CD-ROM packages collection
1.1 dsieger 2013:
2014: After your pkgsrc bulk-build has completed, you may wish to create a CD-ROM set
2015: of the resulting binary packages to assist in installing packages on other
2016: machines. The pkgtools/cdpack package provides a simple tool for creating the
2017: ISO 9660 images. cdpack arranges the packages on the CD-ROMs in a way that
2018: keeps all the dependencies for a given package on the same CD as that package.
2019:
1.178 rillig 2020: 8.5.1. Example of cdpack
1.1 dsieger 2021:
2022: Complete documentation for cdpack is found in the cdpack(1) man page. The
2023: following short example assumes that the binary packages are left in /usr/
2024: pkgsrc/packages/All and that sufficient disk space exists in /u2 to hold the
2025: ISO 9660 images.
2026:
2027: # mkdir /u2/images
2028: # pkg_add /usr/pkgsrc/packages/All/cdpack
2029: # cdpack /usr/pkgsrc/packages/All /u2/images
2030:
2031:
2032: If you wish to include a common set of files (COPYRIGHT, README, etc.) on each
2033: CD in the collection, then you need to create a directory which contains these
1.175 gutterid 2034: files, e.g.:
1.1 dsieger 2035:
2036: # mkdir /tmp/common
2037: # echo "This is a README" > /tmp/common/README
2038: # echo "Another file" > /tmp/common/COPYING
2039: # mkdir /tmp/common/bin
2040: # echo "#!/bin/sh" > /tmp/common/bin/myscript
2041: # echo "echo Hello world" >> /tmp/common/bin/myscript
2042: # chmod 755 /tmp/common/bin/myscript
2043:
2044:
2045: Now create the images:
2046:
2047: # cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images
2048:
2049: Each image will contain README, COPYING, and bin/myscript in their root
2050: directories.
2051:
1.154 rillig 2052: Chapter 9. Directory layout of the installed files
1.1 dsieger 2053:
2054: Table of Contents
2055:
1.154 rillig 2056: 9.1. File system layout in ${LOCALBASE}
2057: 9.2. File system layout in ${VARBASE}
1.1 dsieger 2058:
2059: The files that are installed by pkgsrc are organized in a way that is similar
2060: to what you find in the /usr directory of the base system. But some details are
2061: different. This is because pkgsrc initially came from FreeBSD and had adopted
2062: its file system hierarchy. Later it was largely influenced by NetBSD. But no
2063: matter which operating system you are using pkgsrc with, you can expect the
2064: same layout for pkgsrc.
2065:
2066: There are mainly four root directories for pkgsrc, which are all configurable
2067: in the bootstrap/bootstrap script. When pkgsrc has been installed as root, the
2068: default locations are:
2069:
2070: LOCALBASE= /usr/pkg
2071: PKG_SYSCONFBASE= /usr/pkg/etc
2072: VARBASE= /var
1.119 sevan 2073: PKG_DBDIR= /usr/pkg/pkgdb
1.1 dsieger 2074:
2075: In unprivileged mode (when pkgsrc has been installed as any other user), the
2076: default locations are:
2077:
2078: LOCALBASE= ${HOME}/pkg
2079: PKG_SYSCONFBASE= ${HOME}/pkg/etc
2080: VARBASE= ${HOME}/pkg/var
1.119 sevan 2081: PKG_DBDIR= ${HOME}/pkg/pkgdb
1.1 dsieger 2082:
2083: What these four directories are for, and what they look like is explained
2084: below.
2085:
1.25 wiz 2086: * LOCALBASE corresponds to the /usr directory in the base system. It is the "
2087: main" directory where the files are installed and contains the well-known
1.1 dsieger 2088: subdirectories like bin, include, lib, share and sbin.
2089:
2090: * VARBASE corresponds to /var in the base system. Some programs (especially
2091: games, network daemons) need write access to it during normal operation.
2092:
2093: * PKG_SYSCONFDIR corresponds to /etc in the base system. It contains
2094: configuration files of the packages, as well as pkgsrc's mk.conf itself.
2095:
1.154 rillig 2096: 9.1. File system layout in ${LOCALBASE}
1.1 dsieger 2097:
2098: The following directories exist in a typical pkgsrc installation in $
2099: {LOCALBASE}.
2100:
2101: bin
2102:
2103: Contains executable programs that are intended to be directly used by the
2104: end user.
2105:
2106: emul
2107:
2108: Contains files for the emulation layers of various other operating systems,
2109: especially for NetBSD.
2110:
2111: etc (the usual location of ${PKG_SYSCONFDIR})
2112:
2113: Contains the configuration files.
2114:
2115: include
2116:
2117: Contains headers for the C and C++ programming languages.
2118:
2119: info
2120:
2121: Contains GNU info files of various packages.
2122:
2123: lib
2124:
2125: Contains shared and static libraries.
2126:
2127: libdata
2128:
2129: Contains data files that don't change after installation. Other data files
2130: belong into ${VARBASE}.
2131:
2132: libexec
2133:
2134: Contains programs that are not intended to be used by end users, such as
2135: helper programs or network daemons.
2136:
2137: libexec/cgi-bin
2138:
2139: Contains programs that are intended to be executed as CGI scripts by a web
2140: server.
2141:
2142: man (the usual value of ${PKGMANDIR})
2143:
2144: Contains brief documentation in form of manual pages.
2145:
2146: sbin
2147:
2148: Contains programs that are intended to be used only by the super-user.
2149:
2150: share
2151:
2152: Contains platform-independent data files that don't change after
2153: installation.
2154:
2155: share/doc
2156:
2157: Contains documentation files provided by the packages.
2158:
2159: share/examples
2160:
2161: Contains example files provided by the packages. Among others, the original
2162: configuration files are saved here and copied to ${PKG_SYSCONFDIR} during
2163: installation.
2164:
2165: share/examples/rc.d
2166:
2167: Contains the original files for rc.d scripts.
2168:
2169: var (the usual location of ${VARBASE})
2170:
2171: Contains files that may be modified after installation.
2172:
1.154 rillig 2173: 9.2. File system layout in ${VARBASE}
1.1 dsieger 2174:
2175: db/pkg (the usual location of ${PKG_DBDIR})
2176:
2177: Contains information about the currently installed packages.
2178:
2179: games
2180:
2181: Contains highscore files.
2182:
2183: log
2184:
2185: Contains log files.
2186:
2187: run
2188:
2189: Contains informational files about daemons that are currently running.
2190:
1.154 rillig 2191: Chapter 10. Frequently Asked Questions
1.1 dsieger 2192:
2193: Table of Contents
2194:
1.154 rillig 2195: 10.1. Are there any mailing lists for pkg-related discussion?
2196: 10.2. Utilities for package management (pkgtools)
2197: 10.3. How to use pkgsrc as non-root
2198: 10.4. How to resume transfers when fetching distfiles?
2199: 10.5. How can I install/use modular X.org from pkgsrc?
2200: 10.6. How to fetch files from behind a firewall
2201: 10.7. How to fetch files from HTTPS sites
2202: 10.8. How do I tell make fetch to do passive FTP?
2203: 10.9. How to fetch all distfiles at once
2204: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
2205: 10.11. What does "Could not find bsd.own.mk" mean?
1.221 nia 2206: 10.12. Using 'sudo' or `priv` with pkgsrc
1.154 rillig 2207: 10.13. How do I change the location of configuration files?
2208: 10.14. Automated security checks
2209: 10.15. Why do some packages ignore my CFLAGS?
2210: 10.16. A package does not build. What shall I do?
2211: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.259 leot 2212: conflicts" mean?
1.1 dsieger 2213:
2214: This section contains hints, tips & tricks on special things in pkgsrc that we
2215: didn't find a better place for in the previous chapters, and it contains items
2216: for both pkgsrc users and developers.
2217:
1.154 rillig 2218: 10.1. Are there any mailing lists for pkg-related discussion?
1.1 dsieger 2219:
2220: The following mailing lists may be of interest to pkgsrc users:
2221:
2222: * pkgsrc-users: This is a general purpose list for most issues regarding
2223: pkgsrc, regardless of platform, e.g. soliciting user help for pkgsrc
2224: configuration, unexpected build failures, using particular packages,
2225: upgrading pkgsrc installations, questions regarding the pkgsrc release
2226: branches, etc. General announcements or proposals for changes that impact
2227: the pkgsrc user community, e.g. major infrastructure changes, new features,
2228: package removals, etc., may also be posted.
2229:
2230: * pkgsrc-bulk: A list where the results of pkgsrc bulk builds are sent and
2231: discussed.
2232:
2233: * pkgsrc-changes: This list is for those who are interested in getting a
2234: commit message for every change committed to pkgsrc. It is also available
2235: in digest form, meaning one daily message containing all commit messages
2236: for changes to the package source tree in that 24 hour period.
2237:
2238: To subscribe, do:
2239:
2240: % echo subscribe listname | mail majordomo@NetBSD.org
2241:
1.174 leot 2242: Archives for all these mailing lists are available from https://
1.1 dsieger 2243: mail-index.NetBSD.org/.
2244:
1.154 rillig 2245: 10.2. Utilities for package management (pkgtools)
1.1 dsieger 2246:
2247: The directory pkgsrc/pkgtools contains a number of useful utilities for both
2248: users and developers of pkgsrc. This section attempts only to make the reader
1.121 sevan 2249: aware of some of the utilities and when they might be useful, and not to
2250: duplicate the documentation that comes with each package.
1.1 dsieger 2251:
2252: Utilities used by pkgsrc (automatically installed when needed):
2253:
2254: * pkgtools/x11-links: Symlinks for use by buildlink.
2255:
2256: OS tool augmentation (automatically installed when needed):
2257:
1.121 sevan 2258: * pkgtools/digest: Calculates various kinds of checksums (including SHA3).
1.1 dsieger 2259:
2260: * pkgtools/libnbcompat: Compatibility library for pkgsrc tools.
2261:
2262: * pkgtools/mtree: Installed on non-BSD systems due to lack of native mtree.
2263:
2264: * pkgtools/pkg_install: Up-to-date replacement for /usr/sbin/pkg_install, or
2265: for use on operating systems where pkg_install is not present.
2266:
2267: Utilities used by pkgsrc (not automatically installed):
2268:
2269: * pkgtools/pkg_tarup: Create a binary package from an already-installed
2270: package. Used by make replace to save the old package.
2271:
2272: * pkgtools/dfdisk: Adds extra functionality to pkgsrc, allowing it to fetch
2273: distfiles from multiple locations. It currently supports the following
2274: methods: multiple CD-ROMs and network FTP/HTTP connections.
2275:
2276: * devel/cpuflags: Determine the best compiler flags to optimise code for your
1.24 wiz 2277: current CPU and compiler.
1.1 dsieger 2278:
2279: Utilities for keeping track of installed packages, being up to date, etc:
2280:
1.65 wiz 2281: * pkgtools/pkgin: A package update tool similar to apt(1). Download, install,
2282: and upgrade binary packages easily.
2283:
1.1 dsieger 2284: * pkgtools/pkg_chk: Reports on packages whose installed versions do not match
2285: the latest pkgsrc entries.
2286:
2287: * pkgtools/pkgdep: Makes dependency graphs of packages, to aid in choosing a
2288: strategy for updating.
2289:
2290: * pkgtools/pkgdepgraph: Makes graphs from the output of pkgtools/pkgdep (uses
2291: graphviz).
2292:
1.12 weinem 2293: * pkgtools/pkglint: The pkglint(1) program checks a pkgsrc entry for errors.
2294:
2295: * pkgtools/lintpkgsrc: The lintpkgsrc(1) program does various checks on the
2296: complete pkgsrc system.
1.1 dsieger 2297:
2298: * pkgtools/pkgsurvey: Report what packages you have installed.
2299:
2300: Utilities for people maintaining or creating individual packages:
2301:
2302: * pkgtools/pkgdiff: Automate making and maintaining patches for a package
2303: (includes pkgdiff, pkgvi, mkpatches, etc.).
2304:
1.65 wiz 2305: * pkgtools/url2pkg: Aids in converting to pkgsrc.
1.1 dsieger 2306:
2307: Utilities for people maintaining pkgsrc (or: more obscure pkg utilities)
2308:
2309: * pkgtools/pkg_comp: Build packages in a chrooted area.
2310:
2311: * pkgtools/libkver: Spoof kernel version for chrooted cross builds.
2312:
1.154 rillig 2313: 10.3. How to use pkgsrc as non-root
1.1 dsieger 2314:
1.108 rillig 2315: To install packages from source as a non-root user, download pkgsrc as
1.154 rillig 2316: described in Chapter 3, Where to get pkgsrc and how to keep it up-to-date, cd
1.108 rillig 2317: into that directory and run the command ./bootstrap/bootstrap --unprivileged.
2318:
2319: This will install the binary part of pkgsrc to ~/pkg and put the pkgsrc
2320: configuration mk.conf into ~/pkg/etc.
2321:
2322: For more details, see mk/unprivileged.mk.
1.1 dsieger 2323:
1.154 rillig 2324: 10.4. How to resume transfers when fetching distfiles?
1.1 dsieger 2325:
2326: By default, resuming transfers in pkgsrc is disabled, but you can enable this
1.4 rillig 2327: feature by adding the option PKG_RESUME_TRANSFERS=YES into mk.conf. If, during
2328: a fetch step, an incomplete distfile is found, pkgsrc will try to resume it.
1.1 dsieger 2329:
1.61 wiz 2330: You can also use a different program than the platform default program by
2331: changing the FETCH_USING variable. You can specify the program by using of ftp,
2332: fetch, wget or curl. Alternatively, fetching can be disabled by using the value
2333: manual. A value of custom disables the system defaults and dependency tracking
2334: for the fetch program. In that case you have to provide FETCH_CMD,
2335: FETCH_BEFORE_ARGS, FETCH_RESUME_ARGS, FETCH_OUTPUT_ARGS, FETCH_AFTER_ARGS.
1.1 dsieger 2336:
1.16 jnemeth 2337: For example, if you want to use wget to download, you'll have to use something
2338: like:
1.1 dsieger 2339:
1.16 jnemeth 2340: FETCH_USING= wget
1.1 dsieger 2341:
1.154 rillig 2342: 10.5. How can I install/use modular X.org from pkgsrc?
1.1 dsieger 2343:
1.4 rillig 2344: If you want to use modular X.org from pkgsrc instead of your system's own X11
2345: (/usr/X11R6, /usr/openwin, ...) you will have to add the following line into
1.1 dsieger 2346: mk.conf:
2347:
1.4 rillig 2348: X11_TYPE=modular
1.1 dsieger 2349:
1.154 rillig 2350: 10.6. How to fetch files from behind a firewall
1.1 dsieger 2351:
2352: If you are sitting behind a firewall which does not allow direct connections to
2353: Internet hosts (i.e. non-NAT), you may specify the relevant proxy hosts. This
2354: is done using an environment variable in the form of a URL, e.g. in Amdahl, the
2355: machine "orpheus.amdahl.com" is one of the firewalls, and it uses port 80 as
2356: the proxy port number. So the proxy environment variables are:
2357:
2358: ftp_proxy=ftp://orpheus.amdahl.com:80/
2359: http_proxy=http://orpheus.amdahl.com:80/
2360:
1.154 rillig 2361: 10.7. How to fetch files from HTTPS sites
1.65 wiz 2362:
2363: Some fetch tools are not prepared to support HTTPS by default (for example, the
2364: one in NetBSD 6.0), or the one installed by the pkgsrc bootstrap (to avoid an
2365: openssl dependency that low in the dependency graph).
2366:
2367: Usually you won't notice, because distribution files are mirrored weekly to "
2368: ftp.NetBSD.org", but that might not be often enough if you are following
2369: pkgsrc-current. In that case, set FETCH_USING in your mk.conf file to "curl" or
2370: "wget", which are both compiled with HTTPS support by default. Of course, these
2371: tools need to be installed before you can use them this way.
2372:
1.154 rillig 2373: 10.8. How do I tell make fetch to do passive FTP?
1.1 dsieger 2374:
2375: This depends on which utility is used to retrieve distfiles. From bsd.pkg.mk,
2376: FETCH_CMD is assigned the first available command from the following list:
2377:
2378: * ${LOCALBASE}/bin/ftp
2379:
2380: * /usr/bin/ftp
2381:
2382: On a default NetBSD installation, this will be /usr/bin/ftp, which
2383: automatically tries passive connections first, and falls back to active
2384: connections if the server refuses to do passive. For the other tools, add the
1.4 rillig 2385: following to your mk.conf file: PASSIVE_FETCH=1.
1.1 dsieger 2386:
2387: Having that option present will prevent /usr/bin/ftp from falling back to
2388: active transfers.
2389:
1.154 rillig 2390: 10.9. How to fetch all distfiles at once
1.1 dsieger 2391:
2392: You would like to download all the distfiles in a single batch from work or
2393: university, where you can't run a make fetch. There is an archive of distfiles
2394: on ftp.NetBSD.org, but downloading the entire directory may not be appropriate.
2395:
2396: The answer here is to do a make fetch-list in /usr/pkgsrc or one of its
2397: subdirectories, carry the resulting list to your machine at work/school and use
2398: it there. If you don't have a NetBSD-compatible ftp(1) (like tnftp) at work,
2399: don't forget to set FETCH_CMD to something that fetches a URL:
2400:
2401: At home:
2402:
2403: % cd /usr/pkgsrc
2404: % make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh
2405: % scp /tmp/fetch.sh work:/tmp
2406:
2407: At work:
2408:
2409: % sh /tmp/fetch.sh
2410:
2411: then tar up /tmp/distfiles and take it home.
2412:
2413: If you have a machine running NetBSD, and you want to get all distfiles (even
2414: ones that aren't for your machine architecture), you can do so by using the
2415: above-mentioned make fetch-list approach, or fetch the distfiles directly by
2416: running:
2417:
2418: % make mirror-distfiles
2419:
2420: If you even decide to ignore NO_{SRC,BIN}_ON_{FTP,CDROM}, then you can get
2421: everything by running:
2422:
2423: % make fetch NO_SKIP=yes
2424:
1.154 rillig 2425: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
1.1 dsieger 2426:
2427: When compiling the pkgtools/pkg_install package, you get the error from make
2428: that it doesn't know how to make /usr/share/tmac/tmac.andoc? This indicates
2429: that you don't have installed the "text" set (nroff, ...) from the NetBSD base
2430: distribution on your machine. It is recommended to do that to format man pages.
2431:
2432: In the case of the pkgtools/pkg_install package, you can get away with setting
1.4 rillig 2433: NOMAN=YES either in the environment or in mk.conf.
1.1 dsieger 2434:
1.154 rillig 2435: 10.11. What does "Could not find bsd.own.mk" mean?
1.1 dsieger 2436:
2437: You didn't install the compiler set, comp.tgz, when you installed your NetBSD
2438: machine. Please get and install it, by extracting it in /:
2439:
2440: # cd /
2441: # tar --unlink -zxvpf .../comp.tgz
2442:
2443: comp.tgz is part of every NetBSD release. Get the one that corresponds to your
2444: release (determine via uname -r).
2445:
1.221 nia 2446: 10.12. Using 'sudo' or `priv` with pkgsrc
1.1 dsieger 2447:
2448: When installing packages as non-root user and using the just-in-time su(1)
2449: feature of pkgsrc, it can become annoying to type in the root password for each
2450: required package installed. To avoid this, the sudo package can be used, which
1.221 nia 2451: does password caching over a limited time. To use it, install sudo or priv
2452: (either as binary package, from security/priv, or security/sudo) and then put
2453: the following into your mk.conf, somewhere after the definition of the
2454: LOCALBASE variable:
1.1 dsieger 2455:
2456: .if exists(${LOCALBASE}/bin/sudo)
1.260 wiz 2457: SU_CMD= ${LOCALBASE}/bin/sudo -E /bin/sh -c
1.1 dsieger 2458: .endif
2459:
1.260 wiz 2460: Note the -E flag; that tells sudo to preserve the environment. Without this,
2461: the bin-install target will fail when building a package with a non-default
2462: python version.
2463:
1.154 rillig 2464: 10.13. How do I change the location of configuration files?
1.1 dsieger 2465:
2466: As the system administrator, you can choose where configuration files are
2467: installed. The default settings make all these files go into ${PREFIX}/etc or
2468: some of its subdirectories; this may be suboptimal depending on your
2469: expectations (e.g., a read-only, NFS-exported PREFIX with a need of per-machine
2470: configuration of the provided packages).
2471:
2472: In order to change the defaults, you can modify the PKG_SYSCONFBASE variable
1.4 rillig 2473: (in mk.conf) to point to your preferred configuration directory; some common
2474: examples include /etc or /etc/pkg.
1.1 dsieger 2475:
2476: Furthermore, you can change this value on a per-package basis by setting the
2477: PKG_SYSCONFDIR.${PKG_SYSCONFVAR} variable. PKG_SYSCONFVAR's value usually
2478: matches the name of the package you would like to modify, that is, the contents
2479: of PKGBASE.
2480:
2481: Note that after changing these settings, you must rebuild and reinstall any
2482: affected packages.
2483:
1.154 rillig 2484: 10.14. Automated security checks
1.1 dsieger 2485:
2486: Please be aware that there can often be bugs in third-party software, and some
2487: of these bugs can leave a machine vulnerable to exploitation by attackers. In
2488: an effort to lessen the exposure, the NetBSD packages team maintains a database
2489: of known-exploits to packages which have at one time been included in pkgsrc.
2490: The database can be downloaded automatically, and a security audit of all
1.14 jmcneill 2491: packages installed on a system can take place. To do this, refer to the
2492: following two tools (installed as part of the pkgtools/pkg_install package):
1.1 dsieger 2493:
1.21 snj 2494: 1. pkg_admin fetch-pkg-vulnerabilities, an easy way to download a list of the
2495: security vulnerabilities information. This list is kept up to date by the
1.26 spz 2496: pkgsrc security team, and is distributed from the NetBSD ftp server:
1.1 dsieger 2497:
1.177 leot 2498: https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities
1.1 dsieger 2499:
1.21 snj 2500: 2. pkg_admin audit, an easy way to audit the current machine, checking each
1.24 wiz 2501: known vulnerability. If a vulnerable package is installed, it will be shown
2502: by output to stdout, including a description of the type of vulnerability,
2503: and a URL containing more information.
1.1 dsieger 2504:
1.202 nia 2505: Use of these tools is strongly recommended! See Section 5.1.6, "Checking for
1.121 sevan 2506: security vulnerabilities in installed packages" for instructions on how to
2507: automate checking and reporting.
2508:
2509: If this database is installed, pkgsrc builds will use it to perform a security
2510: check before building any package.
1.1 dsieger 2511:
1.154 rillig 2512: 10.15. Why do some packages ignore my CFLAGS?
1.1 dsieger 2513:
2514: When you add your own preferences to the CFLAGS variable in your mk.conf, these
2515: flags are passed in environment variables to the ./configure scripts and to
2516: make(1). Some package authors ignore the CFLAGS from the environment variable
2517: by overriding them in the Makefiles of their package.
2518:
2519: Currently there is no solution to this problem. If you really need the package
2520: to use your CFLAGS you should run make patch in the package directory and then
2521: inspect any Makefile and Makefile.in for whether they define CFLAGS explicitly.
2522: Usually you can remove these lines. But be aware that some "smart" programmers
2523: write so bad code that it only works for the specific combination of CFLAGS
2524: they have chosen.
2525:
1.172 rillig 2526: To find out where the CFLAGS are ignored, add the following lines to mk.conf:
2527:
2528: CPPFLAGS+= -Dpkgsrc___CPPFLAGS
2529: CFLAGS+= -Dpkgsrc___CFLAGS
2530: CXXFLAGS+= -Dpkgsrc___CXXFLAGS
2531:
2532: Then run bmake show-all-configure show-all-build to see whether the above flags
2533: are passed to the actual build commands in general.
2534:
2535: To find out whether the flags are passed to individual compiler commands, have
2536: a look at the file work/.work.log. In most cases, the flags from the original
2537: command lines (the lines starting with [*]) are passed unmodified to the actual
2538: compiler (the lines starting with <.>). If the flag is missing from the actual
2539: compiler command, it must have been removed by the pkgsrc compiler wrappers.
2540:
1.154 rillig 2541: 10.16. A package does not build. What shall I do?
1.1 dsieger 2542:
2543: 1. Make sure that your copy of pkgsrc is consistent. A case that occurs often
2544: is that people only update pkgsrc in parts, because of performance reasons.
2545: Since pkgsrc is one large system, not a collection of many small systems,
2546: there are sometimes changes that only work when the whole pkgsrc tree is
2547: updated.
2548:
1.25 wiz 2549: 2. Make sure that you don't have any CVS conflicts. Search for "<<<<<<" or "
2550: >>>>>>" in all your pkgsrc files.
1.1 dsieger 2551:
1.25 wiz 2552: 3. Make sure that you don't have old copies of the packages extracted. Run
1.1 dsieger 2553: make clean clean-depends to verify this.
2554:
1.108 rillig 2555: 4. If you are a package developer who wants to invest some work, have a look
1.154 rillig 2556: at Chapter 21, Making your package work.
1.108 rillig 2557:
2558: 5. If the problem still exists, write a mail to the pkgsrc-users mailing list.
1.1 dsieger 2559:
1.154 rillig 2560: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.1 dsieger 2561: conflicts" mean?
2562:
2563: You have modified a file from pkgsrc, and someone else has modified that same
2564: file afterwards in the CVS repository. Both changes are in the same region of
2565: the file, so when you updated pkgsrc, the cvs command marked the conflicting
2566: changes in the file. Because of these markers, the file is no longer a valid
2567: Makefile.
2568:
2569: Have a look at that file, and if you don't need your local changes anymore, you
2570: can remove that file and run cvs -q update -dP in that directory to download
2571: the current version.
2572:
2573: Part II. The pkgsrc developer's guide
2574:
2575: This part of the book deals with creating and modifying packages. It starts
2576: with a "HOWTO"-like guide on creating a new package. The remaining chapters are
2577: more like a reference manual for pkgsrc.
2578:
2579: Table of Contents
2580:
1.154 rillig 2581: 11. Getting help
1.184 rillig 2582: 12. Package components - files, directories and contents
2583: 12.1. Makefile
2584: 12.2. distinfo
2585: 12.3. patches/*
2586: 12.3.1. Structure of a single patch file
2587: 12.3.2. Creating patch files
2588: 12.3.3. Sources where the patch files come from
2589: 12.3.4. Patching guidelines
2590: 12.3.5. Feedback to the author
2591: 12.4. Other mandatory files
2592: 12.5. Optional files
2593: 12.5.1. Files affecting the binary package
2594: 12.5.2. Files affecting the build process
2595: 12.5.3. Files affecting nothing at all
2596: 12.6. work*
2597: 12.7. files/*
2598: 13. The build process
2599: 13.1. Introduction
2600: 13.2. Program location
2601: 13.3. Directories used during the build process
2602: 13.4. Running a phase
2603: 13.5. The fetch phase
2604: 13.5.1. What to fetch and where to get it from
2605: 13.5.2. How are the files fetched?
2606: 13.6. The checksum phase
2607: 13.7. The extract phase
2608: 13.8. The patch phase
2609: 13.9. The tools phase
2610: 13.10. The wrapper phase
2611: 13.11. The configure phase
2612: 13.12. The build phase
2613: 13.13. The test phase
2614: 13.14. The install phase
2615: 13.15. The package phase
2616: 13.16. Cleaning up
2617: 13.17. Other helpful targets
2618: 14. Creating a new pkgsrc package from scratch
2619: 14.1. Common types of packages
1.219 nia 2620: 14.1.1. Python modules and programs
2621: 14.1.2. R packages
2622: 14.1.3. TeXlive packages
1.184 rillig 2623: 14.2. Examples
2624: 14.2.1. How the www/nvu package came into pkgsrc
2625: 15. Programming in Makefiles
2626: 15.1. Caveats
2627: 15.2. Makefile variables
2628: 15.2.1. Naming conventions
2629: 15.3. Code snippets
2630: 15.3.1. Adding things to a list
2631: 15.3.2. Echoing a string exactly as-is
2632: 15.3.3. Passing CFLAGS to GNU configure scripts
2633: 15.3.4. Handling possibly empty variables
1.229 gutterid 2634: 15.3.5. Testing yes/no variables in conditions
1.184 rillig 2635: 16. Options handling
2636: 16.1. Global default options
2637: 16.2. Converting packages to use bsd.options.mk
2638: 16.3. Option Names
2639: 16.4. Determining the options of dependencies
2640: 17. Tools needed for building or running
2641: 17.1. Tools for pkgsrc builds
2642: 17.2. Tools needed by packages
2643: 17.3. Tools provided by platforms
2644: 18. Buildlink methodology
2645: 18.1. Converting packages to use buildlink3
2646: 18.2. Writing buildlink3.mk files
2647: 18.2.1. Anatomy of a buildlink3.mk file
2648: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.
1.259 leot 2649: pkg in buildlink3.mk files
1.184 rillig 2650: 18.3. Writing builtin.mk files
2651: 18.3.1. Anatomy of a builtin.mk file
2652: 19. PLIST issues
2653: 19.1. RCS ID
2654: 19.2. Semi-automatic PLIST generation
2655: 19.3. Tweaking output of make print-PLIST
2656: 19.4. Variable substitution in PLIST
2657: 19.5. Man page compression
2658: 19.6. Changing PLIST source with PLIST_SRC
2659: 19.7. Platform-specific and differing PLISTs
2660: 19.8. Build-specific PLISTs
2661: 19.9. Sharing directories between packages
2662: 20. The pkginstall framework
2663: 20.1. Files and directories outside the installation prefix
2664: 20.1.1. Directory manipulation
2665: 20.1.2. File manipulation
2666: 20.2. Configuration files
2667: 20.2.1. How PKG_SYSCONFDIR is set
2668: 20.2.2. Telling the software where configuration files are
1.239 dholland 2669: 20.2.3. Patching installation
2670: 20.2.4. Declaring configuration files
2671: 20.2.5. Disabling handling of configuration files
1.184 rillig 2672: 20.3. System startup scripts
2673: 20.3.1. Disabling handling of system startup scripts
2674: 20.4. System users and groups
2675: 20.5. System shells
2676: 20.5.1. Disabling shell registration
2677: 20.6. Fonts
2678: 20.6.1. Disabling automatic update of the fonts databases
1.154 rillig 2679: 21. Making your package work
2680: 21.1. General operation
2681: 21.1.1. How to pull in user-settable variables from mk.conf
2682: 21.1.2. User interaction
2683: 21.1.3. Handling licenses
2684: 21.1.4. Restricted packages
2685: 21.1.5. Handling dependencies
2686: 21.1.6. Handling conflicts with other packages
2687: 21.1.7. Packages that cannot or should not be built
2688: 21.1.8. Packages which should not be deleted, once installed
2689: 21.1.9. Handling packages with security problems
2690: 21.1.10. How to handle incrementing versions when fixing an existing
1.259 leot 2691: package
1.154 rillig 2692: 21.1.11. Substituting variable text in the package files (the SUBST
1.259 leot 2693: framework)
1.154 rillig 2694: 21.2. The fetch phase
2695: 21.2.1. Packages whose distfiles aren't available for plain downloading
2696: 21.2.2. How to handle modified distfiles with the 'old' name
2697: 21.2.3. Packages hosted on github.com
2698: 21.3. The configure phase
2699: 21.3.1. Shared libraries - libtool
2700: 21.3.2. Using libtool on GNU packages that already support libtool
2701: 21.3.3. GNU Autoconf/Automake
1.223 nia 2702: 21.3.4. Meson / ninja
1.260 wiz 2703: 21.3.5. Determining the endianness
1.154 rillig 2704: 21.4. Programming languages
2705: 21.4.1. C, C++, and Fortran
2706: 21.4.2. Java
1.205 wiz 2707: 21.4.3. Go
1.223 nia 2708: 21.4.4. Rust
2709: 21.4.5. Packages containing Perl scripts
2710: 21.4.6. Packages containing shell scripts
2711: 21.4.7. Other programming languages
1.154 rillig 2712: 21.5. The build phase
2713: 21.5.1. Compiling C and C++ code conditionally
2714: 21.5.2. How to handle compiler bugs
1.172 rillig 2715: 21.5.3. No such file or directory
2716: 21.5.4. Undefined reference to "..."
2717: 21.5.5. Running out of memory
1.154 rillig 2718: 21.6. The install phase
2719: 21.6.1. Creating needed directories
2720: 21.6.2. Where to install documentation
2721: 21.6.3. Installing highscore files
2722: 21.6.4. Adding DESTDIR support to packages
2723: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 2724: 21.6.6. Packages installing Perl modules
1.254 wiz 2725: 21.6.7. Packages installing pkg-config files
2726: 21.6.8. Packages installing info files
2727: 21.6.9. Packages installing man pages
2728: 21.6.10. Packages installing X11 fonts
2729: 21.6.11. Packages installing SGML or XML data
2730: 21.6.12. Packages installing extensions to the MIME database
2731: 21.6.13. Packages using intltool
2732: 21.6.14. Packages installing startup scripts
2733: 21.6.15. Packages installing TeX modules
2734: 21.6.16. Packages supporting running binaries in emulation
2735: 21.6.17. Packages installing hicolor icons
2736: 21.6.18. Packages installing desktop files
1.154 rillig 2737: 21.7. Marking packages as having problems
1.184 rillig 2738: 22. GNOME packaging and porting
2739: 22.1. Meta packages
2740: 22.2. Packaging a GNOME application
2741: 22.3. Updating GNOME to a newer version
2742: 22.4. Patching guidelines
1.154 rillig 2743: 23. Submitting and Committing
2744: 23.1. Submitting binary packages
2745: 23.2. Submitting source packages (for non-NetBSD-developers)
2746: 23.3. General notes when adding, updating, or removing packages
2747: 23.4. Commit Messages
2748: 23.5. Committing: Adding a package to CVS
2749: 23.6. Updating a package to a newer version
2750: 23.7. Renaming a package in pkgsrc
2751: 23.8. Moving a package in pkgsrc
2752: 24. Frequently Asked Questions
2753:
2754: Chapter 11. Getting help
2755:
2756: To get help when developing pkgsrc, the definitive source is this document, the
2757: pkgsrc guide. If you don't find anything here, there are alternatives:
2758:
2759: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
2760: Run bmake help topic=? to get help for any topic, such as a variable name
2761: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
2762: like strcasecmp or any other topic.
2763:
1.207 leot 2764: The available help topics are listed in Appendix E, Help topics.
1.154 rillig 2765:
1.163 rillig 2766: * To see the value of a single variable, run bmake show-var VARNAME=X.
2767:
2768: * To see the values of the most common variables, run bmake show-all. These
2769: variables are grouped by topic. To see the variables for a single topic,
2770: run bmake show-all-topic, for example bmake show-all-fetch.
2771:
1.154 rillig 2772: * The tech-pkg mailing list, to which you can subscribe and then ask your
2773: questions.
2774:
2775: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
2776: a specialized chat program such as XChat. Pick any user name and join the
2777: channel #pkgsrc.
1.1 dsieger 2778:
1.184 rillig 2779: Chapter 12. Package components - files, directories and contents
1.1 dsieger 2780:
2781: Table of Contents
2782:
1.184 rillig 2783: 12.1. Makefile
2784: 12.2. distinfo
2785: 12.3. patches/*
2786: 12.3.1. Structure of a single patch file
2787: 12.3.2. Creating patch files
2788: 12.3.3. Sources where the patch files come from
2789: 12.3.4. Patching guidelines
2790: 12.3.5. Feedback to the author
2791: 12.4. Other mandatory files
2792: 12.5. Optional files
2793: 12.5.1. Files affecting the binary package
2794: 12.5.2. Files affecting the build process
2795: 12.5.3. Files affecting nothing at all
2796: 12.6. work*
2797: 12.7. files/*
1.1 dsieger 2798:
1.184 rillig 2799: Whenever you're preparing a package, there are a number of files involved which
2800: are described in the following sections.
1.1 dsieger 2801:
1.184 rillig 2802: 12.1. Makefile
1.1 dsieger 2803:
1.184 rillig 2804: Building, installation and creation of a binary package are all controlled by
2805: the package's Makefile. The Makefile describes various things about a package,
2806: for example from where to get it, how to configure, build, and install it.
1.1 dsieger 2807:
1.184 rillig 2808: A package Makefile contains several sections that describe the package.
1.1 dsieger 2809:
1.184 rillig 2810: In the first section there are the following variables, which should appear
2811: exactly in the order given here. The order and grouping of the variables is
2812: mostly historical and has no further meaning.
1.1 dsieger 2813:
1.184 rillig 2814: * DISTNAME is the basename of the distribution file to be downloaded from the
2815: package's website.
1.1 dsieger 2816:
1.184 rillig 2817: * PKGNAME is the name of the package, as used by pkgsrc. You need to provide
2818: it if DISTNAME (which is the default) is not a good name for the package in
2819: pkgsrc or DISTNAME is not provided (no distribution file is required).
2820: Usually it is the pkgsrc directory name together with the version number.
2821: It must match the regular expression ^[A-Za-z0-9][A-Za-z0-9-_.+]*$, that
2822: is, it starts with a letter or digit, and contains only letters, digits,
1.204 nia 2823: dashes, underscores, dots and plus signs. New packages should have entirely
2824: lower-case names, with the exception of some that must follow pre-existing
2825: conventions (e.g. R packages begin with R-). You can use the :tl variable
2826: modifier to lower-case the package name.
1.26 spz 2827:
1.184 rillig 2828: * CATEGORIES is a list of categories which the package fits in. You can
2829: choose any of the top-level directories of pkgsrc for it.
1.1 dsieger 2830:
1.184 rillig 2831: Currently the following values are available for CATEGORIES. If more than
2832: one is used, they need to be separated by spaces:
1.1 dsieger 2833:
1.184 rillig 2834: archivers cross geography meta-pkgs security
2835: audio databases graphics misc shells
2836: benchmarks devel ham multimedia sysutils
2837: biology editors inputmethod net textproc
2838: cad emulators lang news time
2839: chat finance mail parallel wm
2840: comms fonts math pkgtools www
2841: converters games mbone print x11
1.1 dsieger 2842:
1.184 rillig 2843: * MASTER_SITES, DYNAMIC_MASTER_SITES, DIST_SUBDIR, EXTRACT_SUFX and DISTFILES
2844: are discussed in detail in Section 13.5, "The fetch phase".
1.1 dsieger 2845:
1.184 rillig 2846: The second section contains information about separately downloaded patches, if
2847: any.
1.1 dsieger 2848:
1.184 rillig 2849: * PATCHFILES: Name(s) of additional files that contain distribution patches.
2850: There is no default. pkgsrc will look for them at PATCH_SITES. They will
2851: automatically be uncompressed before patching if the names end with .gz or
2852: .Z.
1.1 dsieger 2853:
1.184 rillig 2854: * PATCH_SITES: Primary location(s) for distribution patch files (see
2855: PATCHFILES above) if not found locally.
1.1 dsieger 2856:
1.184 rillig 2857: * PATCH_DIST_STRIP: an argument to patch(1) that sets the pathname strip
2858: count to help find the correct files to patch. It defaults to -p0.
1.1 dsieger 2859:
1.184 rillig 2860: The third section contains the following variables.
1.1 dsieger 2861:
1.253 gutterid 2862: * MAINTAINER is the email address of the person who is currently responsible
2863: for this package. In theory, the maintainer will be aware of upstream
2864: release, keep it updated, and generally resolve problems. Others
2865: contemplating significant changes should ask the maintainer for advice or
2866: review of a proposed change. This is not necessary for micro updates, bug
2867: fixes, pkgsrc-wide changes affecting many packages, and other things
2868: expected to be uncontroversial. It goes with this "should ask" that the
2869: maintainer should respond to inquiries reasonably promptly (most of the
2870: time), and either approve changes or provide reasons why not. Typically,
2871: when packaging a new program, set MAINTAINER to yourself. If you don't
2872: intend to maintain the package (especially if you feel you have no special
2873: insight), set it to <pkgsrc-users@NetBSD.org>. This special value is a code
2874: point indicating that there is no maintainer, but the variable is
2875: mandatory, absent OWNER.
2876:
2877: * OWNER can be used instead of MAINTAINER in relatively rare circumstances
2878: when the package is such that modifying it is riskier than normal. This is
2879: a stronger form of being the maintainer, with an expectation that others
2880: will ask for almost all changes, except revbumps and accommodating
2881: structural changes. Someone who becomes OWNER has a strong obligation to
2882: keep the package very well maintained, to answer queries promptly and to be
2883: a steward of the package on behalf of users. In this case, MAINTAINER
2884: should be omitted.
2885:
2886: Because of the friction that OWNER adds, PMC may downgrade it to MAINTAINER
2887: at any time.
1.1 dsieger 2888:
1.184 rillig 2889: * HOMEPAGE is a URL where users can find more information about the package.
1.1 dsieger 2890:
1.184 rillig 2891: * COMMENT is a one-line description of the package (should not include the
2892: package name).
1.1 dsieger 2893:
1.184 rillig 2894: * LICENSE indicates the license(s) applicable for the package. See
2895: Section 21.1.3, "Handling licenses" for further details.
1.1 dsieger 2896:
1.184 rillig 2897: Other variables that affect the build:
1.1 dsieger 2898:
1.184 rillig 2899: * WRKSRC: The directory where the interesting distribution files of the
2900: package are found. The default is ${WRKDIR}/${DISTNAME}, which works for
2901: most packages.
1.1 dsieger 2902:
1.184 rillig 2903: If a package doesn't create a subdirectory for itself (most GNU software
2904: does, for instance), but extracts itself in the current directory, you
2905: should set WRKSRC=${WRKDIR}.
1.1 dsieger 2906:
1.184 rillig 2907: If a package doesn't create a subdirectory with the name of DISTNAME but
2908: some different name, set WRKSRC to point to the proper name in ${WRKDIR},
2909: for example WRKSRC=${WRKDIR}/${DISTNAME}/unix. See lang/tcl and x11/tk for
2910: other examples.
1.17 imil 2911:
1.184 rillig 2912: The name of the working directory created by pkgsrc is taken from the
2913: WRKDIR_BASENAME variable. By default, its value is work. If you want to use
2914: the same pkgsrc tree for building different kinds of binary packages, you
2915: can change the variable according to your needs. Two other variables handle
2916: common cases of setting WRKDIR_BASENAME individually. If OBJHOSTNAME is
2917: defined in mk.conf, the first component of the host's name is attached to
2918: the directory name. If OBJMACHINE is defined, the platform name is
2919: attached, which might look like work.i386 or work.sparc.
1.17 imil 2920:
1.184 rillig 2921: Please pay attention to the following gotchas:
1.17 imil 2922:
1.184 rillig 2923: * Add MANCOMPRESSED if man pages are installed in compressed form by the
2924: package. For packages using BSD-style makefiles which honor MANZ, there is
2925: MANCOMPRESSED_IF_MANZ.
1.17 imil 2926:
1.184 rillig 2927: * Replace /usr/local with "${PREFIX}" in all files (see patches, below).
1.103 wiz 2928:
1.254 wiz 2929: * If the package installs any info files, see Section 21.6.8, "Packages
1.184 rillig 2930: installing info files".
1.103 wiz 2931:
1.184 rillig 2932: 12.2. distinfo
1.17 imil 2933:
1.184 rillig 2934: The distinfo file contains the message digest, or checksum, of each distfile
2935: needed for the package. This ensures that the distfiles retrieved from the
2936: Internet have not been corrupted during transfer or altered by a malign force
2937: to introduce a security hole. To provide maximum security, all distfiles are
1.243 gutterid 2938: protected using two different message digest algorithms (BLAKE2s and SHA512),
2939: as well as the file size.
1.17 imil 2940:
1.184 rillig 2941: The distinfo file also contains the checksums for all the patches found in the
2942: patches directory (see Section 12.3, "patches/*"). These checksums ensure that
2943: patches are only applied intentionally and that they don't accidentally change,
2944: e.g. when merging different changes together. They also make sure that new
2945: patches are actually added to CVS and old ones are removed. Too see whether the
2946: patches and the distinfo file match, run pkglint after changing the patches.
1.17 imil 2947:
1.184 rillig 2948: To regenerate the distinfo file, use the make distinfo command.
1.17 imil 2949:
1.184 rillig 2950: Some packages have different sets of distfiles depending on the platform, for
2951: example lang/openjdk8. These are kept in the same distinfo file and care should
2952: be taken when upgrading such a package to ensure distfile information is not
2953: lost.
1.17 imil 2954:
1.184 rillig 2955: 12.3. patches/*
1.63 wiz 2956:
1.184 rillig 2957: Some packages don't work out-of-the box on the various platforms that are
2958: supported by pkgsrc. These packages need to be patched to make them work. The
2959: patch files can be found in the patches/ directory.
1.17 imil 2960:
1.184 rillig 2961: In the patch phase, these patches are applied to the files in WRKSRC directory
2962: after extracting them, in alphabetic order.
1.160 brook 2963:
1.184 rillig 2964: 12.3.1. Structure of a single patch file
1.160 brook 2965:
1.184 rillig 2966: The patch-* files should be in diff -bu format, and apply without a fuzz to
2967: avoid problems. (To force patches to apply with fuzz you can set
2968: PATCH_FUZZ_FACTOR=-F2). Furthermore, each patch should contain only changes for
2969: a single file, and no file should be patched by more than one patch file. This
2970: helps to keep future modifications simple.
1.160 brook 2971:
1.184 rillig 2972: Each patch file is structured as follows: In the first line, there is the RCS
2973: Id of the patch itself. The second line should be empty for aesthetic reasons.
2974: After that, there should be a comment for each change that the patch does.
2975: There are a number of standard cases:
1.160 brook 2976:
1.184 rillig 2977: * Patches for commonly known vulnerabilities should mention the vulnerability
2978: ID (CAN, CVE).
1.160 brook 2979:
1.184 rillig 2980: * Patches that change source code should mention the platform and other
2981: environment (for example, the compiler) that the patch is needed for.
1.160 brook 2982:
1.184 rillig 2983: The patch should be commented so that any developer who knows the code of the
2984: application can make some use of the patch. Special care should be taken for
2985: the upstream developers, since we generally want that they accept our patches,
2986: so we have less work in the future.
1.160 brook 2987:
1.184 rillig 2988: 12.3.2. Creating patch files
1.160 brook 2989:
1.184 rillig 2990: One important thing to mention is to pay attention that no RCS IDs get stored
2991: in the patch files, as these will cause problems when later checked into the
2992: NetBSD CVS tree. Use the pkgdiff command from the pkgtools/pkgdiff package to
2993: avoid these problems.
1.160 brook 2994:
1.184 rillig 2995: For even more automation, we recommend using mkpatches from the same package to
1.222 gutterid 2996: make a whole set of patches. You just have to back up files before you edit
2997: them to filename.orig, e.g., with cp -p filename filename.orig or, easier, by
2998: using pkgvi again from the same package. If you upgrade a package this way, you
2999: can easily compare the new set of patches with the previously existing one with
1.184 rillig 3000: patchdiff. The files in patches are replaced by new files, so carefully check
3001: if you want to take all the changes.
1.160 brook 3002:
1.184 rillig 3003: When you have finished a package, remember to generate the checksums for the
3004: patch files by using the make makepatchsum command, see Section 12.2,
3005: "distinfo".
1.1 dsieger 3006:
1.184 rillig 3007: When adding a patch that corrects a problem in the distfile (rather than e.g.
3008: enforcing pkgsrc's view of where man pages should go), send the patch as a bug
3009: report to the maintainer. This benefits non-pkgsrc users of the package, and
3010: usually makes it possible to remove the patch in future version.
1.1 dsieger 3011:
1.184 rillig 3012: The file names of the patch files are usually of the form patch-
3013: path_to_file__with__underscores.c. Many packages still use the previous
3014: convention patch-[a-z][a-z], but new patches should be of the form containing
3015: the filename. mkpatches included in pkgtools/pkgdiff takes care of the name
3016: automatically.
1.1 dsieger 3017:
1.222 gutterid 3018: When updating pre-existing patch files, if a file uses the old patch-[a-z][a-z]
3019: convention, it's best not to change it to the new form, as that will just cause
3020: churn that makes it harder to track changes to patching over time. Similarly,
3021: if a patch now applies at different line offsets, but still applies cleanly
3022: as-is, there's no need to update it, as that also unnecessarily complicates the
3023: patch history.
3024:
1.184 rillig 3025: 12.3.3. Sources where the patch files come from
1.1 dsieger 3026:
1.184 rillig 3027: If you want to share patches between multiple packages in pkgsrc, e.g. because
3028: they use the same distfiles, set PATCHDIR to the path where the patch files can
3029: be found, e.g.:
1.1 dsieger 3030:
1.184 rillig 3031: PATCHDIR= ../../editors/xemacs/patches
1.1 dsieger 3032:
1.184 rillig 3033: Patch files that are distributed by the author or other maintainers can be
3034: listed in PATCHFILES.
1.1 dsieger 3035:
1.184 rillig 3036: If it is desired to store any patches that should not be committed into pkgsrc,
3037: they can be kept outside the pkgsrc tree in the $LOCALPATCHES directory. The
3038: directory tree there is expected to have the same "category/package" structure
3039: as pkgsrc, and patches are expected to be stored inside these dirs (also known
3040: as $LOCALPATCHES/$PKGPATH). For example, if you want to keep a private patch
3041: for pkgsrc/graphics/png, keep it in $LOCALPATCHES/graphics/png/mypatch. All
3042: files in the named directory are expected to be patch files, and they are
3043: applied after pkgsrc patches are applied.
1.1 dsieger 3044:
1.184 rillig 3045: 12.3.4. Patching guidelines
1.1 dsieger 3046:
1.184 rillig 3047: When fixing a portability issue in the code do not use preprocessor magic to
3048: check for the current operating system nor platform. Doing so hurts portability
3049: to other platforms because the OS-specific details are not abstracted
3050: appropriately.
1.1 dsieger 3051:
1.184 rillig 3052: The general rule to follow is: instead of checking for the operating system the
3053: application is being built on, check for the specific features you need. For
3054: example, instead of assuming that kqueue is available under NetBSD and using
3055: the __NetBSD__ macro to conditionalize kqueue support, add a check that detects
1.198 leot 3056: kqueue itself -- yes, this generally involves patching the configure script.
1.184 rillig 3057: There is absolutely nothing that prevents some OSes from adopting interfaces
3058: from other OSes (e.g. Linux implementing kqueue), something that the above
3059: checks cannot take into account.
1.1 dsieger 3060:
1.184 rillig 3061: Of course, checking for features generally involves more work on the
3062: developer's side, but the resulting changes are cleaner and there are chances
3063: they will work on many other platforms. Not to mention that there are higher
3064: chances of being later integrated into the mainstream sources. Remember: It
3065: doesn't work unless it is right!
1.1 dsieger 3066:
1.184 rillig 3067: Some typical examples:
1.121 sevan 3068:
1.184 rillig 3069: Table 12.1. Patching examples
1.1 dsieger 3070:
1.184 rillig 3071: +-------------------------------------------------------------------------------------------+
3072: | Where | Incorrect | Correct |
3073: |---------+--------------------------+------------------------------------------------------|
3074: | |case ${target_os} in | |
3075: |configure|netbsd*) have_kvm=yes ;; |AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)|
3076: |script |*) have_kvm=no ;; | |
3077: | |esac | |
3078: |---------+--------------------------+------------------------------------------------------|
3079: |C source |#if defined(__NetBSD__) |#if defined(HAVE_SYS_EVENT_H) |
3080: |file |# include <sys/event.h> |# include <sys/event.h> |
3081: | |#endif |#endif |
3082: |---------+--------------------------+------------------------------------------------------|
3083: | |int |int |
3084: | |monitor_file(...) |monitor_file(...) |
3085: | |{ |{ |
3086: | |#if defined(__NetBSD__) |#if defined(HAVE_KQUEUE) |
3087: |C source | int fd = kqueue();| int fd = kqueue(); |
3088: |file | ... | ... |
3089: | |#else |#else |
3090: | | ... | ... |
3091: | |#endif |#endif |
3092: | |} |} |
3093: +-------------------------------------------------------------------------------------------+
1.1 dsieger 3094:
3095:
1.184 rillig 3096: 12.3.5. Feedback to the author
1.1 dsieger 3097:
1.184 rillig 3098: Always, always, always feed back any portability fixes or improvements you do
3099: to a package to the mainstream developers. This is the only way to get their
3100: attention on portability issues and to ensure that future versions can be built
3101: out-of-the box on NetBSD. Furthermore, any user that gets newer distfiles will
3102: get the fixes straight from the packaged code.
1.1 dsieger 3103:
1.184 rillig 3104: This generally involves cleaning up the patches (because sometimes the patches
3105: that are added to pkgsrc are quick hacks), filing bug reports in the
3106: appropriate trackers for the projects and working with the mainstream authors
3107: to accept your changes. It is extremely important that you do it so that the
3108: packages in pkgsrc are kept simple and thus further changes can be done without
3109: much hassle.
1.1 dsieger 3110:
1.184 rillig 3111: When you have done this, please add a URL to the upstream bug report to the
3112: patch comment.
1.1 dsieger 3113:
1.184 rillig 3114: Support the idea of free software!
1.1 dsieger 3115:
1.184 rillig 3116: 12.4. Other mandatory files
1.1 dsieger 3117:
1.184 rillig 3118: DESCR
1.1 dsieger 3119:
1.184 rillig 3120: A multi-line description of the piece of software. This should include any
3121: credits where they are due. Please bear in mind that others do not share
3122: your sense of humour (or spelling idiosyncrasies), and that others will
3123: read everything that you write here.
1.1 dsieger 3124:
1.184 rillig 3125: PLIST
1.1 dsieger 3126:
1.184 rillig 3127: This file governs the files that are installed on your system: all the
3128: binaries, manual pages, etc. There are other directives which may be
3129: entered in this file, to control the creation and deletion of directories,
3130: and the location of inserted files. See Chapter 19, PLIST issues for more
3131: information.
1.1 dsieger 3132:
1.184 rillig 3133: 12.5. Optional files
1.1 dsieger 3134:
1.184 rillig 3135: 12.5.1. Files affecting the binary package
1.1 dsieger 3136:
1.184 rillig 3137: INSTALL
1.1 dsieger 3138:
1.184 rillig 3139: This shell script is invoked twice by pkg_add(1). First time after package
3140: extraction and before files are moved in place, the second time after the
3141: files to install are moved in place. This can be used to do any custom
3142: procedures not possible with @exec commands in PLIST. See pkg_add(1) and
3143: pkg_create(1) for more information. See also Section 20.1, "Files and
3144: directories outside the installation prefix". Please note that you can
3145: modify variables in it easily by using FILES_SUBST in the package's
3146: Makefile:
1.1 dsieger 3147:
1.184 rillig 3148: FILES_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 3149:
1.184 rillig 3150: replaces "@SOMEVAR@" with "somevalue" in the INSTALL. By default,
3151: substitution is performed for PREFIX, LOCALBASE, X11BASE, VARBASE, and a
3152: few others, type make help topic=FILES_SUBST for a complete list.
1.1 dsieger 3153:
1.184 rillig 3154: DEINSTALL
1.1 dsieger 3155:
1.184 rillig 3156: This script is executed before and after any files are removed. It is this
3157: script's responsibility to clean up any additional messy details around the
3158: package's installation, since all pkg_delete knows is how to delete the
3159: files created in the original distribution. See pkg_delete(1) and
3160: pkg_create(1) for more information. The same methods to replace variables
3161: can be used as for the INSTALL file.
1.1 dsieger 3162:
1.184 rillig 3163: MESSAGE
1.1 dsieger 3164:
1.198 leot 3165: This file is displayed after installation of the package. While this was
3166: used often in the past, it has two problems: the display will be missed if
1.257 jkoshy 3167: many packages are installed at once, and the person installing the package
1.198 leot 3168: and the one using or configuring it may be different. It should therefore
3169: be used only in exceptional circumstances where lasting negative
3170: consequences would result from someone not reading it.
3171:
3172: MESSAGE should not be used for:
3173:
1.259 leot 3174: + exhortations to read the documentation
1.198 leot 3175:
1.259 leot 3176: + reminders to install rc.d files and set variables
1.198 leot 3177:
1.259 leot 3178: + anything that should be explained in the installation/configuration
1.198 leot 3179: documentation that should come with the package
3180:
3181: If the documentation provided by upstream needs enhancing, create e.g.
3182: files/README.pkgsrc and install it in the package's documentation
3183: directory.
3184:
3185: Note that MESSAGE is shown for all operating systems and all init systems.
3186: If a MESSAGE is necessary, it should be narrowed to only those operating
3187: systems and init systems to which it applies.
3188:
3189: Note that you can modify variables in it easily by using MESSAGE_SUBST in
3190: the package's Makefile:
1.1 dsieger 3191:
1.184 rillig 3192: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 3193:
1.184 rillig 3194: replaces "${SOMEVAR}" with "somevalue" in MESSAGE. By default, substitution
3195: is performed for PKGNAME, PKGBASE, PREFIX, LOCALBASE, X11BASE,
3196: PKG_SYSCONFDIR, ROOT_GROUP, and ROOT_USER.
1.1 dsieger 3197:
1.184 rillig 3198: You can display a different or additional files by setting the MESSAGE_SRC
3199: variable. Its default is MESSAGE, if the file exists.
1.1 dsieger 3200:
1.184 rillig 3201: ALTERNATIVES
1.1 dsieger 3202:
1.184 rillig 3203: This file is used by the alternatives framework. It creates, configures,
3204: and destroys generic wrappers used to run programs with similar interfaces.
3205: See pkg_alternatives(8) from pkgtools/pkg_alternatives for more
3206: information.
1.1 dsieger 3207:
1.184 rillig 3208: Each line of the file contains two filenames, first the wrapper and then
3209: the alternative provided by the package. Both paths are relative to PREFIX.
1.1 dsieger 3210:
1.184 rillig 3211: 12.5.2. Files affecting the build process
1.1 dsieger 3212:
1.184 rillig 3213: Makefile.common
1.1 dsieger 3214:
1.184 rillig 3215: This file contains arbitrary things that could also go into a Makefile, but
3216: its purpose is to be used by more than one package. This file should only
3217: be used when the packages that will use the file are known in advance. For
3218: other purposes it is often better to write a *.mk file and give it a good
3219: name that describes what it does.
1.1 dsieger 3220:
1.184 rillig 3221: buildlink3.mk
1.1 dsieger 3222:
1.184 rillig 3223: This file contains the dependency information for the buildlink3 framework
3224: (see Chapter 18, Buildlink methodology).
1.1 dsieger 3225:
1.184 rillig 3226: hacks.mk
1.1 dsieger 3227:
1.184 rillig 3228: This file contains workarounds for compiler bugs and similar things. It is
3229: included automatically by the pkgsrc infrastructure, so you don't need an
3230: extra .include line for it.
1.1 dsieger 3231:
1.184 rillig 3232: options.mk
1.1 dsieger 3233:
1.184 rillig 3234: This file contains the code for the package-specific options (see
3235: Chapter 16, Options handling) that can be selected by the user. If a
3236: package has only one or two options, it is equally acceptable to put the
3237: code directly into the Makefile.
1.1 dsieger 3238:
1.184 rillig 3239: 12.5.3. Files affecting nothing at all
1.1 dsieger 3240:
1.184 rillig 3241: README*
1.1 dsieger 3242:
1.184 rillig 3243: These files do not take place in the creation of a package and thus are
3244: purely informative to the package developer.
1.1 dsieger 3245:
1.184 rillig 3246: TODO
1.1 dsieger 3247:
1.184 rillig 3248: This file contains things that need to be done to make the package even
3249: better.
1.1 dsieger 3250:
1.184 rillig 3251: 12.6. work*
1.1 dsieger 3252:
1.184 rillig 3253: When you type make, the distribution files are unpacked into the directory
3254: denoted by WRKDIR. It can be removed by running make clean. Besides the
3255: sources, this directory is also used to keep various timestamp files. The
3256: directory gets removed completely on clean. The default is ${.CURDIR}/work or $
3257: {.CURDIR}/work.${MACHINE_ARCH} if OBJMACHINE is set.
1.1 dsieger 3258:
1.184 rillig 3259: 12.7. files/*
1.80 wiz 3260:
1.184 rillig 3261: If you have any files that you wish to be placed in the package prior to
3262: configuration or building, you can place these files here and use a ${CP}
3263: command in the "post-extract" target to achieve this.
1.1 dsieger 3264:
1.184 rillig 3265: If you want to share files in this way with other packages, set the FILESDIR
3266: variable to point to the other package's files directory, e.g.:
1.1 dsieger 3267:
1.184 rillig 3268: FILESDIR= ../../editors/xemacs/files
1.14 jmcneill 3269:
1.184 rillig 3270: Chapter 13. The build process
1.1 dsieger 3271:
1.184 rillig 3272: Table of Contents
1.1 dsieger 3273:
1.184 rillig 3274: 13.1. Introduction
3275: 13.2. Program location
3276: 13.3. Directories used during the build process
3277: 13.4. Running a phase
3278: 13.5. The fetch phase
3279: 13.5.1. What to fetch and where to get it from
3280: 13.5.2. How are the files fetched?
3281: 13.6. The checksum phase
3282: 13.7. The extract phase
3283: 13.8. The patch phase
3284: 13.9. The tools phase
3285: 13.10. The wrapper phase
3286: 13.11. The configure phase
3287: 13.12. The build phase
3288: 13.13. The test phase
3289: 13.14. The install phase
3290: 13.15. The package phase
3291: 13.16. Cleaning up
3292: 13.17. Other helpful targets
1.1 dsieger 3293:
1.184 rillig 3294: 13.1. Introduction
1.122 leot 3295:
1.184 rillig 3296: This chapter gives a detailed description on how a package is built. Building a
3297: package is separated into different phases (for example fetch, build, install),
3298: all of which are described in the following sections. Each phase is split into
3299: so-called stages, which take the name of the containing phase, prefixed by one
3300: of pre-, do- or post-. (Examples are pre-configure, post-build.) Most of the
3301: actual work is done in the do-* stages.
1.1 dsieger 3302:
1.184 rillig 3303: Never override the regular targets (like fetch), if you have to, override the
3304: do-* ones instead.
1.1 dsieger 3305:
1.184 rillig 3306: The basic steps for building a program are always the same. First the program's
3307: source (distfile) must be brought to the local system and then extracted. After
3308: any pkgsrc-specific patches to compile properly are applied, the software can
3309: be configured, then built (usually by compiling), and finally the generated
3310: binaries, etc. can be put into place on the system.
1.1 dsieger 3311:
1.184 rillig 3312: To get more details about what is happening at each step, you can set the
3313: PKG_VERBOSE variable, or the PATCH_DEBUG variable if you are just interested in
3314: more details about the patch step.
1.1 dsieger 3315:
1.184 rillig 3316: 13.2. Program location
1.1 dsieger 3317:
1.184 rillig 3318: Before outlining the process performed by the NetBSD package system in the next
3319: section, here's a brief discussion on where programs are installed, and which
3320: variables influence this.
1.1 dsieger 3321:
1.184 rillig 3322: The automatic variable PREFIX indicates where all files of the final program
3323: shall be installed. It is usually set to LOCALBASE (/usr/pkg), or CROSSBASE for
3324: pkgs in the cross category. The value of PREFIX needs to be put into the
3325: various places in the program's source where paths to these files are encoded.
3326: See Section 12.3, "patches/*" and Section 21.3.1, "Shared libraries - libtool"
3327: for more details.
1.1 dsieger 3328:
1.184 rillig 3329: When choosing which of these variables to use, follow the following rules:
1.1 dsieger 3330:
1.184 rillig 3331: * PREFIX always points to the location where the current pkg will be
3332: installed. When referring to a pkg's own installation path, use "${PREFIX}"
3333: .
1.1 dsieger 3334:
1.223 nia 3335: * LOCALBASE is where all pkgs are installed. If you need to construct a -I or
3336: -L argument to the compiler to find includes and libraries installed by
3337: another pkg, use "${LOCALBASE}". The name LOCALBASE stems from FreeBSD,
3338: which installed all packages in /usr/local. As pkgsrc leaves /usr/local for
3339: the system administrator, this variable is a misnomer.
1.1 dsieger 3340:
1.184 rillig 3341: * X11BASE is where the actual X11 distribution (from xsrc, etc.) is
3342: installed. When looking for standard X11 includes (not those installed by a
3343: package), use "${X11BASE}".
1.1 dsieger 3344:
1.184 rillig 3345: * X11-based packages using imake must set USE_IMAKE to be installed correctly
3346: under LOCALBASE.
1.1 dsieger 3347:
1.184 rillig 3348: * Within ${PREFIX}, packages should install files according to hier(7), with
3349: the exception that manual pages go into ${PREFIX}/man, not ${PREFIX}/share/
3350: man.
1.1 dsieger 3351:
1.184 rillig 3352: 13.3. Directories used during the build process
1.2 rillig 3353:
1.184 rillig 3354: When building a package, various directories are used to store source files,
3355: temporary files, pkgsrc-internal files, and so on. These directories are
3356: explained here.
1.1 dsieger 3357:
1.184 rillig 3358: Some of the directory variables contain relative pathnames. There are two
3359: common base directories for these relative directories: PKGSRCDIR/PKGPATH is
3360: used for directories that are pkgsrc-specific. WRKSRC is used for directories
3361: inside the package itself.
1.1 dsieger 3362:
1.184 rillig 3363: PKGSRCDIR
1.1 dsieger 3364:
1.184 rillig 3365: This is an absolute pathname that points to the pkgsrc root directory.
3366: Generally, you don't need it.
1.1 dsieger 3367:
1.184 rillig 3368: PKGDIR
1.1 dsieger 3369:
1.184 rillig 3370: This is an absolute pathname that points to the current package.
1.1 dsieger 3371:
1.184 rillig 3372: PKGPATH
1.1 dsieger 3373:
1.184 rillig 3374: This is a pathname relative to PKGSRCDIR that points to the current
1.228 gutterid 3375: package. It is defined after including bsd.prefs.mk and can be used in
3376: makefile fragments that are used by several packages to distinguish between
3377: these packages. Other variables that would serve the same purpose are
3378: PKGBASE and PKGNAME, but these are only defined after including bsd.pkg.mk,
3379: which is too late.
3380:
3381: In mk.conf, the pkgsrc user can use PKGPATH to tweak variables like
3382: MAKE_JOBS and CFLAGS.
1.1 dsieger 3383:
1.184 rillig 3384: WRKDIR
1.1 dsieger 3385:
1.184 rillig 3386: This is an absolute pathname pointing to the directory where all work takes
3387: place. The distfiles are extracted to this directory. It also contains
3388: temporary directories and log files used by the various pkgsrc frameworks,
3389: like buildlink or the wrappers.
1.1 dsieger 3390:
1.184 rillig 3391: WRKSRC
1.1 dsieger 3392:
1.184 rillig 3393: This is an absolute pathname pointing to the directory where the distfiles
3394: are extracted. It is usually a direct subdirectory of WRKDIR, and often
3395: it's the only directory entry that isn't hidden. This variable may be
3396: changed by a package Makefile.
1.1 dsieger 3397:
1.184 rillig 3398: The CREATE_WRKDIR_SYMLINK definition takes either the value yes or no and
3399: defaults to no. It indicates whether a symbolic link to the WRKDIR is to be
3400: created in the pkgsrc entry's directory. If users would like to have their
3401: pkgsrc trees behave in a read-only manner, then the value of
3402: CREATE_WRKDIR_SYMLINK should be set to no.
1.1 dsieger 3403:
1.184 rillig 3404: 13.4. Running a phase
1.1 dsieger 3405:
1.184 rillig 3406: You can run a particular phase by typing make phase, where phase is the name of
3407: the phase. This will automatically run all phases that are required for this
3408: phase. The default phase is build, that is, when you run make without
3409: parameters in a package directory, the package will be built, but not
3410: installed.
1.1 dsieger 3411:
1.184 rillig 3412: 13.5. The fetch phase
1.1 dsieger 3413:
1.184 rillig 3414: The first step in building a package is to fetch the distribution files
3415: (distfiles) from the sites that are providing them. This is the task of the
3416: fetch phase.
1.25 wiz 3417:
1.184 rillig 3418: 13.5.1. What to fetch and where to get it from
1.1 dsieger 3419:
1.184 rillig 3420: In simple cases, MASTER_SITES defines all URLs from where the distfile, whose
3421: name is derived from the DISTNAME variable, is fetched. The more complicated
3422: cases are described below.
1.1 dsieger 3423:
1.184 rillig 3424: The variable DISTFILES specifies the list of distfiles that have to be fetched.
3425: Its value defaults to ${DEFAULT_DISTFILES} and its value is ${DISTNAME}$
3426: {EXTRACT_SUFX}, so that most packages don't need to define it at all.
3427: EXTRACT_SUFX is .tar.gz by default, but can be changed freely. Note that if
3428: your package requires additional distfiles to the default one, you cannot just
3429: append the additional filenames using the += operator, but you have write for
3430: example:
1.1 dsieger 3431:
1.184 rillig 3432: DISTFILES= ${DEFAULT_DISTFILES} additional-files.tar.gz
1.1 dsieger 3433:
1.184 rillig 3434: Each distfile is fetched from a list of sites, usually MASTER_SITES. If the
3435: package has multiple DISTFILES or multiple PATCHFILES from different sites, you
3436: can set SITES.distfile to the list of URLs where the file distfile (including
3437: the suffix) can be found.
1.1 dsieger 3438:
1.184 rillig 3439: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
3440: DISTFILES+= foo-file.tar.gz
3441: SITES.foo-file.tar.gz= \
3442: https://www.somewhere.com/somehow/ \
3443: https://www.somewhereelse.com/mirror/somehow/
1.1 dsieger 3444:
1.184 rillig 3445: When actually fetching the distfiles, each item from MASTER_SITES or SITES.*
3446: gets the name of each distfile appended to it, without an intermediate slash.
3447: Therefore, all site values have to end with a slash or other separator
3448: character. This allows for example to set MASTER_SITES to a URL of a CGI script
3449: that gets the name of the distfile as a parameter. In this case, the definition
3450: would look like:
1.1 dsieger 3451:
1.184 rillig 3452: MASTER_SITES= https://www.example.com/download.cgi?file=
1.1 dsieger 3453:
1.184 rillig 3454: The exception to this rule are URLs starting with a dash. In that case the URL
3455: is taken as is, fetched and the result stored under the name of the distfile.
3456: You can use this style for the case when the download URL style does not match
3457: the above common case. For example, if permanent download URL is a redirector
3458: to the real download URL, or the download file name is offered by an HTTP
3459: Content-Disposition header. In the following example, foo-1.0.0.tar.gz will be
3460: created instead of the default v1.0.0.tar.gz.
1.1 dsieger 3461:
1.184 rillig 3462: DISTNAME= foo-1.0.0
3463: MASTER_SITES= -https://www.example.com/archive/v1.0.0.tar.gz
1.29 wiz 3464:
1.184 rillig 3465: There are some predefined values for MASTER_SITES, which can be used in
3466: packages. The names of the variables should speak for themselves.
1.29 wiz 3467:
1.260 wiz 3468: MASTER_SITE_APACHE MASTER_SITE_BACKUP
3469: MASTER_SITE_CRATESIO MASTER_SITE_CYGWIN
3470: MASTER_SITE_DEBIAN MASTER_SITE_FREEBSD
3471: MASTER_SITE_FREEBSD_LOCAL MASTER_SITE_GENTOO
3472: MASTER_SITE_GITHUB MASTER_SITE_GITLAB
3473: MASTER_SITE_GNOME MASTER_SITE_GNU
3474: MASTER_SITE_GNUPG MASTER_SITE_GNUSTEP
3475: MASTER_SITE_HASKELL_HACKAGE MASTER_SITE_IFARCHIVE
3476: MASTER_SITE_KDE MASTER_SITE_MOZILLA
3477: MASTER_SITE_MOZILLA_ALL MASTER_SITE_MYSQL
3478: MASTER_SITE_NETLIB MASTER_SITE_OPENBSD
3479: MASTER_SITE_OPENOFFICE MASTER_SITE_OSDN
3480: MASTER_SITE_PERL_CPAN MASTER_SITE_PGSQL
3481: MASTER_SITE_PYPI MASTER_SITE_RUBYGEMS
3482: MASTER_SITE_R_CRAN MASTER_SITE_SOURCEFORGE
3483: MASTER_SITE_SUNSITE MASTER_SITE_SUSE
3484: MASTER_SITE_TEX_CTAN MASTER_SITE_XCONTRIB
3485: MASTER_SITE_XEMACS MASTER_SITE_XORG
1.1 dsieger 3486:
1.184 rillig 3487: Some explanations for the less self-explaining ones: MASTER_SITE_BACKUP
3488: contains backup sites for packages that are maintained in ftp://ftp.NetBSD.org/
3489: pub/pkgsrc/distfiles/${DIST_SUBDIR}. MASTER_SITE_LOCAL contains local package
3490: source distributions that are maintained in ftp://ftp.NetBSD.org/pub/pkgsrc/
3491: distfiles/LOCAL_PORTS/.
1.1 dsieger 3492:
1.184 rillig 3493: If you choose one of these predefined sites, you may want to specify a
3494: subdirectory of that site. Since these macros may expand to more than one
3495: actual site, you must use the following construct to specify a subdirectory:
1.1 dsieger 3496:
1.184 rillig 3497: MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/}
3498: MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.1 dsieger 3499:
1.184 rillig 3500: Note the trailing slash after the subdirectory name.
1.1 dsieger 3501:
1.184 rillig 3502: 13.5.2. How are the files fetched?
1.1 dsieger 3503:
1.184 rillig 3504: The fetch phase makes sure that all the distfiles exist in a local directory
3505: (DISTDIR, which can be set by the pkgsrc user). If the files do not exist, they
3506: are fetched using commands of the form
1.1 dsieger 3507:
1.184 rillig 3508: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 dsieger 3509:
1.184 rillig 3510: where ${site} varies through several possibilities in turn: first,
3511: MASTER_SITE_OVERRIDE is tried, then the sites specified in either SITES.file if
3512: defined, else MASTER_SITES or PATCH_SITES, as applies, then finally the value
3513: of MASTER_SITE_BACKUP. The order of all except the first and the last can be
3514: optionally sorted by the user, via setting either MASTER_SORT_RANDOM, and
3515: MASTER_SORT_AWK or MASTER_SORT_REGEX.
1.1 dsieger 3516:
1.184 rillig 3517: The specific command and arguments used depend on the FETCH_USING parameter.
3518: The example above is for FETCH_USING=custom.
1.66 asau 3519:
1.184 rillig 3520: The distfiles mirror run by the NetBSD Foundation uses the mirror-distfiles
3521: target to mirror the distfiles, if they are freely distributable. Packages
3522: setting NO_SRC_ON_FTP (usually to "${RESTRICTED}") will not have their
3523: distfiles mirrored.
1.1 dsieger 3524:
1.184 rillig 3525: 13.6. The checksum phase
1.1 dsieger 3526:
1.184 rillig 3527: After the distfile(s) are fetched, their checksum is generated and compared
3528: with the checksums stored in the distinfo file. If the checksums don't match,
3529: the build is aborted. This is to ensure the same distfile is used for building,
3530: and that the distfile wasn't changed, e.g. by some malign force, deliberately
3531: changed distfiles on the master distribution site or network lossage.
1.1 dsieger 3532:
1.184 rillig 3533: 13.7. The extract phase
1.1 dsieger 3534:
1.184 rillig 3535: When the distfiles are present on the local system, they need to be extracted,
3536: as they usually come in the form of some compressed archive format.
1.1 dsieger 3537:
1.184 rillig 3538: By default, all DISTFILES are extracted. If you only need some of them, you can
3539: set the EXTRACT_ONLY variable to the list of those files.
1.1 dsieger 3540:
1.184 rillig 3541: Extracting the files is usually done by a little program, mk/extract/extract,
3542: which already knows how to extract various archive formats, so most likely you
3543: will not need to change anything here. But if you need, the following variables
3544: may help you:
1.1 dsieger 3545:
1.184 rillig 3546: EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}
1.1 dsieger 3547:
1.184 rillig 3548: Use these variables to override the default options for an extract command,
3549: which are defined in mk/extract/extract.
1.1 dsieger 3550:
1.184 rillig 3551: EXTRACT_USING
1.1 dsieger 3552:
1.184 rillig 3553: This variable can be set to bsdtar, gtar, nbtar (which is the default
3554: value), pax, or an absolute pathname pointing to the command with which tar
3555: archives should be extracted. It is preferred to choose bsdtar over gtar if
3556: NetBSD's pax-as-tar is not good enough.
1.1 dsieger 3557:
1.184 rillig 3558: If the extract program doesn't serve your needs, you can also override the
3559: EXTRACT_CMD variable, which holds the command used for extracting the files.
3560: This command is executed in the ${WRKSRC} directory. During execution of this
3561: command, the shell variable extract_file holds the absolute pathname of the
3562: file that is going to be extracted.
1.1 dsieger 3563:
1.184 rillig 3564: And if that still does not suffice, you can override the do-extract target in
3565: the package Makefile.
1.1 dsieger 3566:
1.184 rillig 3567: 13.8. The patch phase
1.1 dsieger 3568:
1.184 rillig 3569: After extraction, all the patches named by the PATCHFILES, those present in the
3570: patches subdirectory of the package as well as in $LOCALPATCHES/$PKGPATH (e.g.
3571: /usr/local/patches/graphics/png) are applied. Patchfiles ending in .Z or .gz
3572: are uncompressed before they are applied, files ending in .orig or .rej are
3573: ignored. Any special options to patch(1) can be handed in PATCH_DIST_ARGS. See
3574: Section 12.3, "patches/*" for more details.
1.1 dsieger 3575:
1.184 rillig 3576: By default patch(1) is given special arguments to make it fail if the expected
3577: text from the patch context is not found in the patched file. If that happens,
3578: fix the patch file by comparing it with the actual text in the file to be
3579: patched.
1.1 dsieger 3580:
1.184 rillig 3581: 13.9. The tools phase
1.1 dsieger 3582:
1.184 rillig 3583: This is covered in Chapter 17, Tools needed for building or running.
1.1 dsieger 3584:
1.184 rillig 3585: 13.10. The wrapper phase
1.1 dsieger 3586:
1.184 rillig 3587: This phase creates wrapper programs for the compilers and linkers. The
3588: following variables can be used to tweak the wrappers.
1.1 dsieger 3589:
1.184 rillig 3590: ECHO_WRAPPER_MSG
1.1 dsieger 3591:
1.184 rillig 3592: The command used to print progress messages. Does nothing by default. Set
3593: to ${ECHO} to see the progress messages.
1.1 dsieger 3594:
1.184 rillig 3595: WRAPPER_DEBUG
1.1 dsieger 3596:
1.184 rillig 3597: This variable can be set to yes (default) or no, depending on whether you
3598: want additional information in the wrapper log file.
1.1 dsieger 3599:
1.184 rillig 3600: WRAPPER_UPDATE_CACHE
1.1 dsieger 3601:
1.184 rillig 3602: This variable can be set to yes or no, depending on whether the wrapper
3603: should use its cache, which will improve the speed. The default value is
3604: yes, but is forced to no if the platform does not support it.
1.1 dsieger 3605:
1.184 rillig 3606: WRAPPER_REORDER_CMDS
1.1 dsieger 3607:
1.184 rillig 3608: A list of reordering commands. A reordering command has the form reorder:l:
3609: lib1:lib2. It ensures that that -llib1 occurs before -llib2.
1.1 dsieger 3610:
1.184 rillig 3611: 13.11. The configure phase
1.1 dsieger 3612:
1.184 rillig 3613: Most pieces of software need information on the header files, system calls, and
3614: library routines which are available on the platform they run on. The process
3615: of determining this information is known as configuration, and is usually
3616: automated. In most cases, a script is supplied with the distfiles, and its
3617: invocation results in generation of header files, Makefiles, etc.
1.1 dsieger 3618:
1.184 rillig 3619: If the package contains a configure script, this can be invoked by setting
3620: HAS_CONFIGURE to "yes". If the configure script is a GNU autoconf script, you
1.187 rillig 3621: should set GNU_CONFIGURE to "yes" instead.
1.1 dsieger 3622:
1.187 rillig 3623: In the do-configure stage, a rough equivalent of the following command is run.
3624: See mk/configure/configure.mk, target do-configure-script for the exact
3625: definition.
3626:
3627: .for dir in ${CONFIGURE_DIRS}
3628: cd ${WRKSRC} && cd ${dir} \
3629: && env ${CONFIGURE_ENV} \
3630: ${CONFIG_SHELL} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
1.184 rillig 3631: .endfor
1.1 dsieger 3632:
1.184 rillig 3633: CONFIGURE_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In
3634: each of these directories, the configure script is run with the environment
3635: CONFIGURE_ENV and arguments CONFIGURE_ARGS. The variables CONFIGURE_ENV,
3636: CONFIGURE_SCRIPT (default: "./configure") and CONFIGURE_ARGS may all be changed
3637: by the package.
1.1 dsieger 3638:
1.184 rillig 3639: If the program uses the Perl way of configuration (mainly Perl modules, but not
3640: only), i.e. a file called Makefile.PL, it should include ../../lang/perl5/
3641: module.mk. To set any parameter for Makefile.PL use the MAKE_PARAMS variable
3642: (e.g., MAKE_PARAMS+=foo=bar
1.1 dsieger 3643:
1.184 rillig 3644: If the program uses an Imakefile for configuration, the appropriate steps can
3645: be invoked by setting USE_IMAKE to "yes". If you only need xmkmf, add it to
3646: USE_TOOLS. You can add variables to xmkmf's environment by adding them to the
3647: SCRIPTS_ENV variable.
1.1 dsieger 3648:
1.184 rillig 3649: If the program uses cmake for configuration, the appropriate steps can be
1.233 wiz 3650: invoked by including ../../devel/cmake/build.mk. You can add variables to
3651: cmake's environment by adding them to the CONFIGURE_ENV variable and arguments
1.256 wiz 3652: to cmake by adding them to the CMAKE_CONFIGURE_ARGS variable. If you want to
3653: add arguments only for particular stages, you can use the CMAKE_CONFIGURE_ARGS,
1.233 wiz 3654: CMAKE_BUILD_ARGS, and CMAKE_INSTALL_ARGS variables. You can set the
3655: CONFIGURE_DIRS variable to the directories in which CMake should be run,
3656: relative to WRKSRC. This defaults to to ".".
1.1 dsieger 3657:
1.256 wiz 3658: Any package using the now-deprecated USE_CMAKE=yes should be converted.
3659: Essentially, replace with an include of ../../devel/cmake/build.mk, prune
3660: creation of a build directory and settings to use it, and check/fix settings
3661: that intend to perform the build in a subdirectory.
3662:
1.184 rillig 3663: If there is no configure step at all, set NO_CONFIGURE to "yes".
1.1 dsieger 3664:
1.184 rillig 3665: 13.12. The build phase
1.1 dsieger 3666:
1.187 rillig 3667: For building a package, a rough equivalent of the following code is executed;
3668: see mk/build/build.mk, target do-build for the exact definition.
1.154 rillig 3669:
1.187 rillig 3670: .for dir in ${BUILD_DIRS}
3671: cd ${WRKSRC} && cd ${dir} \
1.184 rillig 3672: && env ${MAKE_ENV} \
1.187 rillig 3673: ${MAKE_PROGRAM} ${MAKE_FLAGS} ${BUILD_MAKE_FLAGS} \
1.184 rillig 3674: -f ${MAKE_FILE} \
3675: ${BUILD_TARGET}
3676: .endfor
1.1 dsieger 3677:
1.184 rillig 3678: BUILD_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In each of
3679: these directories, MAKE_PROGRAM is run with the environment MAKE_ENV and
3680: arguments BUILD_MAKE_FLAGS. The variables MAKE_ENV, BUILD_MAKE_FLAGS, MAKE_FILE
3681: and BUILD_TARGET may all be changed by the package.
1.1 dsieger 3682:
1.184 rillig 3683: The default value of MAKE_PROGRAM is "gmake" if USE_TOOLS contains "gmake", "
3684: make" otherwise. The default value of MAKE_FILE is "Makefile", and BUILD_TARGET
3685: defaults to "all".
1.1 dsieger 3686:
1.184 rillig 3687: If there is no build step at all, set NO_BUILD to "yes".
1.1 dsieger 3688:
1.184 rillig 3689: 13.13. The test phase
1.1 dsieger 3690:
1.184 rillig 3691: [TODO]
1.1 dsieger 3692:
1.184 rillig 3693: 13.14. The install phase
1.1 dsieger 3694:
1.184 rillig 3695: Once the build stage has completed, the final step is to install the software
3696: in public directories, so users can access the programs and files.
1.1 dsieger 3697:
1.187 rillig 3698: In the install phase, a rough equivalent of the following code is executed; see
3699: mk/install/install.mk, target do-install for the exact definition.
3700: Additionally, before and after this code, several consistency checks are run
3701: against the files-to-be-installed, see mk/check/*.mk for details.
3702:
3703: .for dir in ${INSTALL_DIRS}
3704: cd ${WRKSRC} && cd ${dir} \
3705: && env ${INSTALL_ENV} ${MAKE_ENV} \
3706: ${MAKE_PROGRAM} ${MAKE_FLAGS} ${INSTALL_MAKE_FLAGS} \
3707: -f ${MAKE_FILE} ${INSTALL_TARGET}
1.184 rillig 3708: .endfor
1.1 dsieger 3709:
1.184 rillig 3710: The variable's meanings are analogous to the ones in the build phase.
3711: INSTALL_DIRS defaults to BUILD_DIRS. INSTALL_TARGET is "install" by default,
3712: plus "install.man" if USE_IMAKE is defined and NO_INSTALL_MANPAGES is not
3713: defined.
1.1 dsieger 3714:
1.184 rillig 3715: In the install phase, the following variables are useful. They are all
3716: variations of the install(1) command that have the owner, group and permissions
3717: preset. INSTALL is the plain install command. The specialized variants,
3718: together with their intended use, are:
1.1 dsieger 3719:
1.184 rillig 3720: INSTALL_PROGRAM_DIR
1.1 dsieger 3721:
1.184 rillig 3722: directories that contain binaries
1.1 dsieger 3723:
1.184 rillig 3724: INSTALL_SCRIPT_DIR
1.1 dsieger 3725:
1.184 rillig 3726: directories that contain scripts
1.1 dsieger 3727:
1.184 rillig 3728: INSTALL_LIB_DIR
1.1 dsieger 3729:
1.184 rillig 3730: directories that contain shared and static libraries
1.1 dsieger 3731:
1.184 rillig 3732: INSTALL_DATA_DIR
1.108 rillig 3733:
1.184 rillig 3734: directories that contain data files
1.108 rillig 3735:
1.184 rillig 3736: INSTALL_MAN_DIR
1.108 rillig 3737:
1.184 rillig 3738: directories that contain man pages
1.108 rillig 3739:
1.184 rillig 3740: INSTALL_GAME_DIR
1.108 rillig 3741:
1.184 rillig 3742: directories that contain data files for games
1.108 rillig 3743:
1.184 rillig 3744: INSTALL_PROGRAM
1.108 rillig 3745:
1.184 rillig 3746: binaries that can be stripped from debugging symbols
1.108 rillig 3747:
1.184 rillig 3748: INSTALL_SCRIPT
1.108 rillig 3749:
1.184 rillig 3750: binaries that cannot be stripped
1.108 rillig 3751:
1.184 rillig 3752: INSTALL_GAME
1.108 rillig 3753:
1.184 rillig 3754: game binaries
1.108 rillig 3755:
1.184 rillig 3756: INSTALL_LIB
1.108 rillig 3757:
1.184 rillig 3758: shared and static libraries
1.108 rillig 3759:
1.184 rillig 3760: INSTALL_DATA
1.108 rillig 3761:
1.184 rillig 3762: data files
1.1 dsieger 3763:
1.184 rillig 3764: INSTALL_GAME_DATA
1.1 dsieger 3765:
1.184 rillig 3766: data files for games
1.108 rillig 3767:
1.184 rillig 3768: INSTALL_MAN
1.108 rillig 3769:
1.184 rillig 3770: man pages
1.1 dsieger 3771:
1.184 rillig 3772: Some other variables are:
1.1 dsieger 3773:
1.184 rillig 3774: INSTALL_UNSTRIPPED
1.1 dsieger 3775:
1.184 rillig 3776: If set to yes, do not run strip(1) when installing binaries. Any debugging
3777: sections and symbols present in binaries will be preserved.
1.1 dsieger 3778:
1.184 rillig 3779: INSTALLATION_DIRS
1.1 dsieger 3780:
1.184 rillig 3781: A list of directories relative to PREFIX that are created by pkgsrc at the
3782: beginning of the install phase. The package is supposed to create all
3783: needed directories itself before installing files to it and list all other
3784: directories here.
1.1 dsieger 3785:
1.184 rillig 3786: In the rare cases that a package shouldn't install anything, set NO_INSTALL to
3787: "yes". This is mostly relevant for packages in the regress category.
1.1 dsieger 3788:
1.184 rillig 3789: 13.15. The package phase
1.121 sevan 3790:
1.184 rillig 3791: Once the install stage has completed, a binary package of the installed files
3792: can be built. These binary packages can be used for quick installation without
3793: previous compilation, e.g. by the make bin-install or by using pkg_add.
1.1 dsieger 3794:
1.184 rillig 3795: By default, the binary packages are created in ${PACKAGES}/All and symlinks are
3796: created in ${PACKAGES}/category, one for each category in the CATEGORIES
3797: variable. PACKAGES defaults to pkgsrc/packages.
1.1 dsieger 3798:
1.184 rillig 3799: 13.16. Cleaning up
1.1 dsieger 3800:
1.184 rillig 3801: Once you're finished with a package, you can clean the work directory by
3802: running make clean. If you want to clean the work directories of all
3803: dependencies too, use make clean-depends.
1.1 dsieger 3804:
1.184 rillig 3805: 13.17. Other helpful targets
1.1 dsieger 3806:
1.184 rillig 3807: pre/post-*
1.1 dsieger 3808:
1.184 rillig 3809: For any of the main targets described in the previous section (configure,
3810: build, install, etc.), two auxiliary targets exist with "pre-" and "post-"
3811: used as a prefix for the main target's name. These targets are invoked
3812: before and after the main target is called, allowing extra configuration or
3813: installation steps be performed from a package's Makefile, for example,
3814: which a program's configure script or install target omitted.
3815:
3816: About 5% of the pkgsrc packages define their custom post-extract target,
3817: another 5% define pre-configure, and 10% define post-install. The other pre
3818: /post-* targets are defined even less often.
1.1 dsieger 3819:
1.184 rillig 3820: do-*
1.182 leot 3821:
1.184 rillig 3822: Should one of the main targets do the wrong thing, and should there be no
3823: variable to fix this, you can redefine it with the do-* target. (Note that
3824: redefining the target itself instead of the do-* target is a bad idea, as
3825: the pre-* and post-* targets won't be called anymore, etc.)
1.1 dsieger 3826:
1.184 rillig 3827: About 15% of the pkgsrc packages override the default do-install, the other
3828: do-* targets are overridden even less often.
1.1 dsieger 3829:
1.184 rillig 3830: reinstall
1.1 dsieger 3831:
1.184 rillig 3832: If you did a make install and you noticed some file was not installed
3833: properly, you can repeat the installation with this target, which will
3834: ignore the "already installed" flag.
1.1 dsieger 3835:
1.184 rillig 3836: This is the default value of DEPENDS_TARGET except in the case of make
3837: update and make package, where the defaults are "package" and "update",
3838: respectively.
1.1 dsieger 3839:
1.184 rillig 3840: deinstall
1.1 dsieger 3841:
1.184 rillig 3842: This target does a pkg_delete(1) in the current directory, effectively
3843: de-installing the package. The following variables can be used to tune the
3844: behaviour:
1.1 dsieger 3845:
1.184 rillig 3846: PKG_VERBOSE
1.1 dsieger 3847:
1.184 rillig 3848: Add a "-v" to the pkg_delete(1) command.
1.1 dsieger 3849:
1.184 rillig 3850: DEINSTALLDEPENDS
1.1 dsieger 3851:
1.184 rillig 3852: Remove all packages that require (depend on) the given package. This
3853: can be used to remove any packages that may have been pulled in by a
3854: given package, e.g. if make deinstall DEINSTALLDEPENDS=1 is done in
3855: pkgsrc/x11/kde, this is likely to remove whole KDE. Works by adding "-R
3856: " to the pkg_delete(1) command line.
1.1 dsieger 3857:
1.184 rillig 3858: bin-install
1.1 dsieger 3859:
1.184 rillig 3860: Install a binary package from local disk and via FTP from a list of sites
3861: (see the BINPKG_SITES variable), and do a make package if no binary package
3862: is available anywhere. The arguments given to pkg_add can be set via
3863: BIN_INSTALL_FLAGS e.g., to do verbose operation, etc.
1.1 dsieger 3864:
1.184 rillig 3865: install-clean
1.1 dsieger 3866:
1.184 rillig 3867: This target removes the state files for the "install" and later phases so
3868: that the "install" target may be re-invoked. This can be used after editing
3869: the PLIST to install the package without rebuilding it.
1.1 dsieger 3870:
1.184 rillig 3871: build-clean
1.18 mishka 3872:
1.184 rillig 3873: This target removes the state files for the "build" and later phases so
3874: that the "build" target may be re-invoked.
1.18 mishka 3875:
1.184 rillig 3876: update
1.18 mishka 3877:
1.184 rillig 3878: This target causes the current package to be updated to the latest version.
3879: The package and all depending packages first get de-installed, then current
3880: versions of the corresponding packages get compiled and installed. This is
3881: similar to manually noting which packages are currently installed, then
3882: performing a series of make deinstall and make install (or whatever
3883: UPDATE_TARGET is set to) for these packages.
1.18 mishka 3884:
1.184 rillig 3885: You can use the "update" target to resume package updating in case a
3886: previous make update was interrupted for some reason. However, in this
3887: case, make sure you don't call make clean or otherwise remove the list of
3888: dependent packages in WRKDIR. Otherwise, you lose the ability to
3889: automatically update the current package along with the dependent packages
3890: you have installed.
1.121 sevan 3891:
1.184 rillig 3892: Resuming an interrupted make update will only work as long as the package
3893: tree remains unchanged. If the source code for one of the packages to be
3894: updated has been changed, resuming make update will most certainly fail!
1.1 dsieger 3895:
1.184 rillig 3896: The following variables can be used either on the command line or in
3897: mk.conf to alter the behaviour of make update:
1.1 dsieger 3898:
1.184 rillig 3899: UPDATE_TARGET
1.1 dsieger 3900:
1.184 rillig 3901: Install target to recursively use for the updated package and the
3902: dependent packages. Defaults to DEPENDS_TARGET if set, "install"
3903: otherwise for make update. Other good targets are "package" or "
3904: bin-install". Do not set this to "update" or you will get stuck in an
3905: endless loop!
1.1 dsieger 3906:
1.184 rillig 3907: NOCLEAN
1.1 dsieger 3908:
1.184 rillig 3909: Don't clean up after updating. Useful if you want to leave the work
3910: sources of the updated packages around for inspection or other
3911: purposes. Be sure you eventually clean up the source tree (see the "
3912: clean-update" target below) or you may run into troubles with old
3913: source code still lying around on your next make or make update.
1.1 dsieger 3914:
1.184 rillig 3915: REINSTALL
1.1 dsieger 3916:
1.184 rillig 3917: Deinstall each package before installing (making DEPENDS_TARGET). This
3918: may be necessary if the "clean-update" target (see below) was called
3919: after interrupting a running make update.
1.1 dsieger 3920:
1.184 rillig 3921: DEPENDS_TARGET
1.1 dsieger 3922:
1.184 rillig 3923: Allows you to disable recursion and hardcode the target for packages.
3924: The default is "update" for the update target, facilitating a recursive
3925: update of prerequisite packages. Only set DEPENDS_TARGET if you want to
3926: disable recursive updates. Use UPDATE_TARGET instead to just set a
3927: specific target for each package to be installed during make update
3928: (see above).
1.1 dsieger 3929:
1.184 rillig 3930: clean-update
1.1 dsieger 3931:
1.184 rillig 3932: Clean the source tree for all packages that would get updated if make
3933: update was called from the current directory. This target should not be
3934: used if the current package (or any of its depending packages) have already
3935: been de-installed (e.g., after calling make update) or you may lose some
3936: packages you intended to update. As a rule of thumb: only use this target
3937: before the first time you run make update and only if you have a dirty
3938: package tree (e.g., if you used NOCLEAN).
1.86 wiz 3939:
1.184 rillig 3940: If you are unsure about whether your tree is clean, you can either perform
3941: a make clean at the top of the tree, or use the following sequence of
3942: commands from the directory of the package you want to update (before
3943: running make update for the first time, otherwise you lose all the packages
3944: you wanted to update!):
1.86 wiz 3945:
1.184 rillig 3946: # make clean-update
3947: # make clean CLEANDEPENDS=YES
3948: # make update
1.86 wiz 3949:
3950:
1.184 rillig 3951: The following variables can be used either on the command line or in
3952: mk.conf to alter the behaviour of make clean-update:
1.86 wiz 3953:
1.184 rillig 3954: CLEAR_DIRLIST
1.86 wiz 3955:
1.184 rillig 3956: After make clean, do not reconstruct the list of directories to update
3957: for this package. Only use this if make update successfully installed
3958: all packages you wanted to update. Normally, this is done automatically
3959: on make update, but may have been suppressed by the NOCLEAN variable
3960: (see above).
1.1 dsieger 3961:
1.184 rillig 3962: replace
1.1 dsieger 3963:
1.184 rillig 3964: Update the installation of the current package. This differs from update in
3965: that it does not replace dependent packages. You will need to install
3966: pkgtools/pkg_tarup for this target to work.
1.1 dsieger 3967:
1.184 rillig 3968: Be careful when using this target! There are no guarantees that dependent
3969: packages will still work, in particular they will most certainly break if
3970: you make replace a library package whose shared library major version
3971: changed between your installed version and the new one. For this reason,
3972: this target is not officially supported and only recommended for advanced
3973: users.
1.1 dsieger 3974:
1.184 rillig 3975: info
1.1 dsieger 3976:
1.184 rillig 3977: This target invokes pkg_info(1) for the current package. You can use this
3978: to check which version of a package is installed.
1.86 wiz 3979:
1.184 rillig 3980: index
1.1 dsieger 3981:
1.184 rillig 3982: This is a top-level command, i.e. it should be used in the pkgsrc
3983: directory. It creates a database of all packages in the local pkgsrc tree,
3984: including dependencies, comment, maintainer, and some other useful
3985: information. Individual entries are created by running make describe in the
3986: packages' directories. This index file is saved as pkgsrc/INDEX. It can be
3987: displayed in verbose format by running make print-index. You can search in
3988: it with make search key=something. You can extract a list of all packages
3989: that depend on a particular one by running make show-deps PKG=somepackage.
1.1 dsieger 3990:
1.184 rillig 3991: Running this command takes a very long time, some hours even on fast
3992: machines!
1.1 dsieger 3993:
1.184 rillig 3994: readme
1.1 dsieger 3995:
1.199 nia 3996: This target generates a index.html file, which can be viewed using a
1.184 rillig 3997: browser such as www/firefox or www/links. The generated files contain
3998: references to any packages which are in the PACKAGES directory on the local
3999: host. The generated files can be made to refer to URLs based on
4000: FTP_PKG_URL_HOST and FTP_PKG_URL_DIR. For example, if I wanted to generate
1.199 nia 4001: index.html files which pointed to binary packages on the local machine, in
1.184 rillig 4002: the directory /usr/packages, set FTP_PKG_URL_HOST=file://localhost and
4003: FTP_PKG_URL_DIR=/usr/packages. The ${PACKAGES} directory and its
4004: subdirectories will be searched for all the binary packages.
1.1 dsieger 4005:
1.184 rillig 4006: The target can be run at the toplevel or in category directories, in which
4007: case it descends recursively.
1.1 dsieger 4008:
1.184 rillig 4009: readme-all
1.1 dsieger 4010:
1.184 rillig 4011: This is a top-level command, run it in pkgsrc. Use this target to create a
4012: file README-all.html which contains a list of all packages currently
4013: available in the NetBSD Packages Collection, together with the category
4014: they belong to and a short description. This file is compiled from the
1.199 nia 4015: pkgsrc/*/index.html files, so be sure to run this after a make readme.
1.1 dsieger 4016:
1.184 rillig 4017: cdrom-readme
1.1 dsieger 4018:
1.184 rillig 4019: This is very much the same as the "readme" target (see above), but is to be
4020: used when generating a pkgsrc tree to be written to a CD-ROM. This target
1.199 nia 4021: also produces index.html files, and can be made to refer to URLs based on
1.184 rillig 4022: CDROM_PKG_URL_HOST and CDROM_PKG_URL_DIR.
1.1 dsieger 4023:
1.184 rillig 4024: show-distfiles
1.1 dsieger 4025:
1.184 rillig 4026: This target shows which distfiles and patchfiles are needed to build the
4027: package (ALLFILES, which contains all DISTFILES and PATCHFILES, but not
4028: patches/*).
1.1 dsieger 4029:
1.184 rillig 4030: show-downlevel
1.1 dsieger 4031:
1.184 rillig 4032: This target shows nothing if the package is not installed. If a version of
4033: this package is installed, but is not the version provided in this version
4034: of pkgsrc, then a warning message is displayed. This target can be used to
4035: show which of your installed packages are downlevel, and so the old
4036: versions can be deleted, and the current ones added.
1.1 dsieger 4037:
1.184 rillig 4038: show-pkgsrc-dir
1.1 dsieger 4039:
1.184 rillig 4040: This target shows the directory in the pkgsrc hierarchy from which the
4041: package can be built and installed. This may not be the same directory as
4042: the one from which the package was installed. This target is intended to be
4043: used by people who may wish to upgrade many packages on a single host, and
4044: can be invoked from the top-level pkgsrc Makefile by using the "
4045: show-host-specific-pkgs" target.
1.1 dsieger 4046:
1.184 rillig 4047: show-installed-depends
1.1 dsieger 4048:
1.184 rillig 4049: This target shows which installed packages match the current package's
4050: DEPENDS. Useful if out of date dependencies are causing build problems.
1.1 dsieger 4051:
1.184 rillig 4052: print-build-depends-list
1.1 dsieger 4053:
1.184 rillig 4054: This target shows the list of packages that the current package depends on
4055: for building.
1.1 dsieger 4056:
1.184 rillig 4057: print-run-depends-list
1.1 dsieger 4058:
1.184 rillig 4059: This target shows the list of packages that the current package depends on
4060: for running.
1.1 dsieger 4061:
1.184 rillig 4062: check-shlibs
1.1 dsieger 4063:
1.184 rillig 4064: After a package is installed, check all its binaries and (on ELF platforms)
4065: shared libraries to see if they find the shared libs they need. Run by
4066: default if PKG_DEVELOPER is set in mk.conf.
1.1 dsieger 4067:
1.184 rillig 4068: print-PLIST
1.1 dsieger 4069:
1.184 rillig 4070: After a "make install" from a new or upgraded pkg, this prints out an
4071: attempt to generate a new PLIST from a find -newer work/.extract_done. An
4072: attempt is made to care for shared libs etc., but it is strongly
4073: recommended to review the result before putting it into PLIST. On upgrades,
4074: it's useful to diff the output of this command against an already existing
4075: PLIST file.
1.1 dsieger 4076:
1.184 rillig 4077: If the package installs files via tar(1) or other methods that don't update
4078: file access times, be sure to add these files manually to your PLIST, as
4079: the "find -newer" command used by this target won't catch them!
1.56 ryoon 4080:
1.184 rillig 4081: See Section 19.3, "Tweaking output of make print-PLIST" for more
4082: information on this target.
1.1 dsieger 4083:
1.255 wiz 4084: rebuild
4085:
4086: If you did a make build and you noticed some further modifications of
4087: sources are needed, you can repeat the build with this target, which will
4088: ignore the "already built" flag. This target is helpful while working with
4089: patches.
4090:
4091: repackage
4092:
4093: If you did a make package and you noticed some further modifications of
4094: sources are needed, you can repeat the package with this target, which will
4095: ignore the "already packaged" flag. This target is helpful while working
4096: with patches, PLIST* files etc.
4097:
4098: retest
4099:
4100: If you did a make test and you noticed some further modifications of
4101: sources are needed, you can repeat the test with this target, which will
4102: ignore the "already tested" flag. This target is helpful while working with
4103: patches.
4104:
1.184 rillig 4105: Chapter 14. Creating a new pkgsrc package from scratch
1.1 dsieger 4106:
1.184 rillig 4107: Table of Contents
1.1 dsieger 4108:
1.184 rillig 4109: 14.1. Common types of packages
1.219 nia 4110: 14.1.1. Python modules and programs
4111: 14.1.2. R packages
4112: 14.1.3. TeXlive packages
1.184 rillig 4113: 14.2. Examples
4114: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 4115:
1.184 rillig 4116: When you find a package that is not yet in pkgsrc, you most likely have a URL
4117: from where you can download the source code. Starting with this URL, creating a
4118: package involves only a few steps.
1.1 dsieger 4119:
1.184 rillig 4120: 1. In your mk.conf, set PKG_DEVELOPER=yes to enable the basic quality checks.
1.1 dsieger 4121:
1.184 rillig 4122: 2. Install the package meta-pkgs/pkg_developer, which among others will
4123: install the utilities url2pkg, pkglint, pkgvi and mkpatches:
1.1 dsieger 4124:
1.184 rillig 4125: $ cd /usr/pkgsrc
4126: $ (cd meta-pkgs/pkg_developer && bmake update)
1.1 dsieger 4127:
1.184 rillig 4128: 3. Choose one of the top-level directories as the category in which you want
4129: to place your package. You can also create a directory of your own (maybe
1.219 nia 4130: called local). Change into that category directory:
1.1 dsieger 4131:
1.219 nia 4132: $ cd category
1.1 dsieger 4133:
1.219 nia 4134: 4. Run the program url2pkg, passing as argument the URL of the distribution
4135: file (in most cases a .tar.gz file). This will download the distribution
4136: file and create the necessary files of the package, based on what's in the
4137: distribution file:
1.1 dsieger 4138:
1.184 rillig 4139: $ url2pkg https://www.example.org/packages/package-1.0.tar.gz
1.1 dsieger 4140:
1.184 rillig 4141: 5. Examine the extracted files to determine the dependencies of your package.
4142: Ideally, this is mentioned in some README file, but things may differ. For
4143: each of these dependencies, look where it exists in pkgsrc, and if there is
4144: a file called buildlink3.mk in that directory, add a line to your package
4145: Makefile which includes that file just before the last line. If the
4146: buildlink3.mk file does not exist, it must be created first. The
4147: buildlink3.mk file makes sure that the package's include files and
4148: libraries are provided.
1.1 dsieger 4149:
1.219 nia 4150: If you just need binaries from a dependent package, add a DEPENDS line to
4151: the Makefile, which specifies the version of the dependency and where it
4152: can be found in pkgsrc. This line should be placed in the third paragraph.
4153: If the dependency is only needed for building the package, but not when
4154: using it, use TOOL_DEPENDS or BUILD_DEPENDS instead of DEPENDS. The
4155: difference between TOOL_DEPENDS and BUILD_DEPENDS occurs when
4156: cross-compiling: TOOL_DEPENDS are native packages, i.e. packages for the
4157: platform where the package is built; BUILD_DEPENDS are target packages,
4158: i.e. packages for the platform for which the package is built. There is
4159: also TEST_DEPENDS, which specifies a dependency used only for testing the
4160: resulting package built, using the upstream project's included test suite,
4161: on the native platform. Your package may then look like this:
1.1 dsieger 4162:
1.184 rillig 4163: [...]
1.1 dsieger 4164:
1.184 rillig 4165: TOOL_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt
4166: DEPENDS+= screen-[0-9]*:../../misc/screen
4167: DEPENDS+= screen>=4.0:../../misc/screen
1.1 dsieger 4168:
1.184 rillig 4169: [...]
1.1 dsieger 4170:
1.184 rillig 4171: .include "../../category/package/buildlink3.mk"
4172: .include "../../devel/glib2/buildlink3.mk"
4173: .include "../../mk/bsd.pkg.mk"
1.1 dsieger 4174:
1.184 rillig 4175: 6. Run pkglint to see what things still need to be done to make your package a
4176: "good" one. If you don't know what pkglint's warnings want to tell you, try
4177: pkglint --explain or pkglint -e, which outputs additional explanations.
1.1 dsieger 4178:
1.184 rillig 4179: 7. In many cases the package is not yet ready to build. You can find
4180: instructions for the most common cases in the next section, Section 14.1,
4181: "Common types of packages". After you have followed the instructions over
4182: there, you can hopefully continue here.
1.1 dsieger 4183:
1.184 rillig 4184: 8. Run bmake clean to clean the working directory from the extracted files.
1.219 nia 4185: Besides these files, a lot of cache files and other system information have
4186: been saved in the working directory, which may have become outdated after
4187: you edited the Makefile.
1.1 dsieger 4188:
1.184 rillig 4189: 9. Now, run bmake to build the package. For the various things that can go
4190: wrong in this phase, consult Chapter 21, Making your package work.
1.1 dsieger 4191:
1.184 rillig 4192: If the extracted files from the package need to be fixed, run multiple
4193: rounds of these commands:
1.1 dsieger 4194:
1.219 nia 4195: $ bmake
1.184 rillig 4196: $ pkgvi ${WRKSRC}/some/file/that/does/not/compile
4197: $ mkpatches
1.219 nia 4198: $ bmake mps
4199: $ bmake clean
1.1 dsieger 4200:
1.184 rillig 4201: 10. When the package builds fine, the next step is to install the package. Run
4202: bmake install and hope that everything works.
1.1 dsieger 4203:
1.184 rillig 4204: 11. Up to now, the file PLIST, which contains a list of the files that are
4205: installed by the package, is nearly empty. Run bmake print-PLIST >PLIST to
4206: generate a probably correct list. Check the file using your preferred text
4207: editor to see if the list of files looks plausible.
1.1 dsieger 4208:
1.184 rillig 4209: 12. Run pkglint again to see if the generated PLIST contains garbage or not.
1.1 dsieger 4210:
1.184 rillig 4211: 13. When you ran bmake install, the package had been registered in the database
4212: of installed files, but with an empty list of files. To fix this, run bmake
4213: deinstall and bmake install again. Now the package is registered with the
4214: list of files from PLIST.
1.48 wiz 4215:
1.219 nia 4216: 14. Run bmake clean update to run everything from above again in a single step,
1.184 rillig 4217: making sure that the PLIST is correct and the whole package is created as
4218: intended.
1.48 wiz 4219:
1.219 nia 4220: 15. Run pkglint to see if there's anything left to do.
1.48 wiz 4221:
1.219 nia 4222: 16. Commit the package to pkgsrc-wip or main pkgsrc; see Chapter 23, Submitting
1.184 rillig 4223: and Committing.
1.50 wiz 4224:
1.184 rillig 4225: 14.1. Common types of packages
1.1 dsieger 4226:
1.219 nia 4227: 14.1.1. Python modules and programs
1.1 dsieger 4228:
1.184 rillig 4229: Python modules and programs packages are easily created using a set of
4230: predefined variables.
1.1 dsieger 4231:
1.184 rillig 4232: If some Python versions are not supported by the software, set the
4233: PYTHON_VERSIONS_INCOMPATIBLE variable to the Python versions that are not
4234: supported, e.g.
1.1 dsieger 4235:
1.184 rillig 4236: PYTHON_VERSIONS_INCOMPATIBLE= 27
1.1 dsieger 4237:
1.249 gutterid 4238: If the packaged software is a Python module, include ../../lang/python/
1.258 wiz 4239: wheel.mk. Note per PEP-518, the minimum and default requirement to create .whl
4240: files is devel/py-setuptools; however, there are various other possible tools
4241: that projects can use. Thus inclusion of wheel.mk does not imply these defaults
4242: are defined as TOOL_DEPENDS. Whatever the project specifically requires as
4243: packaging tools must be defined in the package Makefile.
1.1 dsieger 4244:
1.248 wiz 4245: The package directory should be called "py-software" and PKGNAME should be set
4246: to "${PYPKGPREFIX}-${DISTNAME}", e.g.
1.1 dsieger 4247:
1.184 rillig 4248: DISTNAME= foopymodule-1.2.10
4249: PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
1.1 dsieger 4250:
1.226 gutterid 4251: For software in PyPi, the name should match what PyPi specifies for "pip
4252: install software".
4253:
1.184 rillig 4254: If it is an application, include "../../lang/python/application.mk". In order
4255: to correctly set the path to the Python interpreter, use the REPLACE_PYTHON
4256: variable and set it to the list of files (paths relative to WRKSRC) that must
4257: be corrected. For example:
1.1 dsieger 4258:
1.184 rillig 4259: REPLACE_PYTHON= *.py
1.1 dsieger 4260:
1.219 nia 4261: 14.1.2. R packages
1.1 dsieger 4262:
1.184 rillig 4263: Simple R packages from CRAN are handled automatically by R2pkg, which is
4264: available in pkgtools/R2pkg. Individual packages (and optionally their
4265: dependencies) may be created and updated. R packages generally follow the same
4266: form, and most of the relevant information needed is contained in a DESCRIPTION
4267: file as part of each R package on CRAN. Consequently, R2pkg downloads that
4268: information and creates or updates a package in the canonical form. The
4269: resulting package should be reviewed for correctness.
1.1 dsieger 4270:
1.219 nia 4271: 14.1.3. TeXlive packages
1.1 dsieger 4272:
1.184 rillig 4273: TeXlive packages from CTAN are handled automatically by texlive2pkg, which is
4274: available in pkgtools/texlive2pkg.
1.1 dsieger 4275:
1.184 rillig 4276: If the TeXlive package name is not known, it may be useful to search CTAN. A "
4277: Contained in" field on the package page typically identifies the basename of
4278: the package file in the TeXlive archive.
1.1 dsieger 4279:
1.184 rillig 4280: If the TeXlive package name is known, download the files from the TeXlive
4281: archive. For package foo, you will need to download foo.tar.xz. Most TeXlive
4282: packages also have associated documentation packages, so download
4283: foo.doc.tar.xz at the same time. These files should be placed in the
4284: appropriate category directory, which is often but not always print. Then run
4285: the following command in the category directory.
1.1 dsieger 4286:
1.184 rillig 4287: texlive2pkg foo.tar.xz foo.doc.tar.xz
1.1 dsieger 4288:
1.184 rillig 4289: This will create two packages, tex-foo and tex-foo-doc. Be sure to check that
4290: both packages are correct.
1.1 dsieger 4291:
1.184 rillig 4292: Finally, CTAN currently does not include version information in package
4293: filenames and changes their contents periodically when updates occur.
4294: Consequently, pkgsrc avoids downloading distfiles directly from CTAN and
4295: instead relies on the pkgsrc archives. For each new or updated TeXlive package,
4296: e.g., the main one and the corresponding documentation, upload the distfiles
4297: with the following command in each package directory.
1.1 dsieger 4298:
1.184 rillig 4299: make upload-distfiles
1.117 sevan 4300:
1.184 rillig 4301: 14.2. Examples
1.117 sevan 4302:
1.184 rillig 4303: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 4304:
1.184 rillig 4305: 14.2.1.1. The initial package
1.1 dsieger 4306:
1.184 rillig 4307: Looking at the file pkgsrc/doc/TODO, I saw that the "nvu" package has not yet
4308: been imported into pkgsrc. As the description says it has to do with the web,
4309: the obvious choice for the category is "www".
1.1 dsieger 4310:
1.184 rillig 4311: $ mkdir www/nvu
4312: $ cd www/nvu
1.1 dsieger 4313:
1.184 rillig 4314: The web site says that the sources are available as a tar file, so I fed that
4315: URL to the url2pkg program:
1.1 dsieger 4316:
1.184 rillig 4317: $ url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
1.1 dsieger 4318:
1.184 rillig 4319: My editor popped up, and I added a PKGNAME line below the DISTNAME line, as the
4320: package name should not have the word "sources" in it. I also filled in the
4321: MAINTAINER, HOMEPAGE and COMMENT fields. Then the package Makefile looked like
4322: that:
1.1 dsieger 4323:
1.184 rillig 4324: # $NetBSD $
4325: #
1.1 dsieger 4326:
1.184 rillig 4327: DISTNAME= nvu-1.0-sources
4328: PKGNAME= nvu-1.0
4329: CATEGORIES= www
4330: MASTER_SITES= http://cvs.nvu.com/download/
4331: EXTRACT_SUFX= .tar.bz2
1.1 dsieger 4332:
1.184 rillig 4333: MAINTAINER= rillig@NetBSD.org
4334: HOMEPAGE= http://cvs.nvu.com/
4335: COMMENT= Web Authoring System
1.1 dsieger 4336:
1.184 rillig 4337: # url2pkg-marker (please do not remove this line.)
4338: .include "../../mk/bsd.pkg.mk"
1.1 dsieger 4339:
1.184 rillig 4340: On the first line of output above, an artificial space has been added between
4341: NetBSD and $, this is a workaround to prevent CVS expanding to the filename of
4342: the guide.
1.1 dsieger 4343:
1.184 rillig 4344: Then, I quit the editor and watched pkgsrc downloading a large source archive:
1.1 dsieger 4345:
1.184 rillig 4346: url2pkg> Running "make makesum" ...
4347: => Required installed package digest>=20010302: digest-20060826 found
4348: => Fetching nvu-1.0-sources.tar.bz2
4349: Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
4350: 100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA
4351: 29687976 bytes retrieved in 03:12 (150.77 KB/s)
4352: url2pkg> Running "make extract" ...
4353: => Required installed package digest>=20010302: digest-20060826 found
4354: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
4355: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
4356: work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc
4357: ===> Installing dependencies for nvu-1.0
4358: ===> Overriding tools for nvu-1.0
4359: ===> Extracting for nvu-1.0
4360: url2pkg> Adjusting the Makefile.
1.1 dsieger 4361:
1.184 rillig 4362: Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
1.1 dsieger 4363:
1.184 rillig 4364: Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
1.1 dsieger 4365:
1.184 rillig 4366: 14.2.1.2. Fixing all kinds of problems to make the package work
1.1 dsieger 4367:
1.184 rillig 4368: Now that the package has been extracted, let's see what's inside it. The
4369: package has a README.txt, but that only says something about mozilla, so it's
4370: probably useless for seeing what dependencies this package has. But since there
4371: is a GNU configure script in the package, let's hope that it will complain
4372: about everything it needs.
1.1 dsieger 4373:
1.184 rillig 4374: $ bmake
4375: => Required installed package digest>=20010302: digest-20060826 found
4376: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
4377: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
4378: ===> Patching for nvu-1.0
4379: ===> Creating toolchain wrappers for nvu-1.0
4380: ===> Configuring for nvu-1.0
4381: [...]
4382: configure: error: Perl 5.004 or higher is required.
4383: [...]
4384: WARNING: Please add USE_TOOLS+=perl to the package Makefile.
4385: [...]
1.1 dsieger 4386:
1.184 rillig 4387: That worked quite well. So I opened the package Makefile in my editor, and
4388: since it already has a USE_TOOLS line, I just appended "perl" to it. Since the
4389: dependencies of the package have changed now, and since a perl wrapper is
4390: automatically installed in the "tools" phase, I need to build the package from
4391: scratch.
1.1 dsieger 4392:
1.184 rillig 4393: $ bmake clean
4394: ===> Cleaning for nvu-1.0
4395: $ bmake
4396: [...]
4397: *** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
4398: GNU Make. You will not be able to build Mozilla without GNU Make.
4399: [...]
1.1 dsieger 4400:
1.184 rillig 4401: So I added "gmake" to the USE_TOOLS line and tried again (from scratch).
1.1 dsieger 4402:
1.184 rillig 4403: [...]
4404: checking for GTK - version >= 1.2.0... no
4405: *** Could not run GTK test program, checking why...
4406: [...]
1.1 dsieger 4407:
1.184 rillig 4408: Now to the other dependencies. The first question is: Where is the GTK package
4409: hidden in pkgsrc?
1.1 dsieger 4410:
1.184 rillig 4411: $ echo ../../*/gtk*
4412: [many packages ...]
4413: $ echo ../../*/gtk
4414: ../../x11/gtk
4415: $ echo ../../*/gtk2
4416: ../../x11/gtk2
4417: $ echo ../../*/gtk2/bui*
4418: ../../x11/gtk2/buildlink3.mk
1.1 dsieger 4419:
1.184 rillig 4420: The first try was definitely too broad. The second one had exactly one result,
4421: which is very good. But there is one pitfall with GNOME packages. Before GNOME
4422: 2 had been released, there were already many GNOME 1 packages in pkgsrc. To be
4423: able to continue to use these packages, the GNOME 2 packages were imported as
4424: separate packages, and their names usually have a "2" appended. So I checked
4425: whether this was the case here, and indeed it was.
1.1 dsieger 4426:
1.184 rillig 4427: Since the GTK2 package has a buildlink3.mk file, adding the dependency is very
4428: easy. I just inserted an .include line before the last line of the package
4429: Makefile, so that it now looks like this:
1.1 dsieger 4430:
1.184 rillig 4431: [...]
4432: .include "../../x11/gtk2/buildlink3.mk"
4433: .include "../../mk/bsd.pkg.mk
1.1 dsieger 4434:
1.184 rillig 4435: After another bmake clean && bmake, the answer was:
1.108 rillig 4436:
1.184 rillig 4437: [...]
4438: checking for gtk-config... /home/roland/pkg/bin/gtk-config
4439: checking for GTK - version >= 1.2.0... no
4440: *** Could not run GTK test program, checking why...
4441: *** The test program failed to compile or link. See the file config.log for the
4442: *** exact error that occured. This usually means GTK was incorrectly installed
4443: *** or that you have moved GTK since it was installed. In the latter case, you
4444: *** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
4445: configure: error: Test for GTK failed.
4446: [...]
1.1 dsieger 4447:
1.184 rillig 4448: In this particular case, the assumption that "every package prefers GNOME 2"
4449: had been wrong. The first of the lines above told me that this package really
4450: wanted to have the GNOME 1 version of GTK. If the package had looked for GTK2,
4451: it would have looked for pkg-config instead of gtk-config. So I changed the x11
4452: /gtk2 to x11/gtk in the package Makefile, and tried again.
1.1 dsieger 4453:
1.184 rillig 4454: [...]
4455: cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...]
4456: In file included from xpidl.c:42:
4457: xpidl.h:53:24: libIDL/IDL.h: No such file or directory
4458: In file included from xpidl.c:42:
4459: xpidl.h:132: error: parse error before "IDL_ns"
4460: [...]
1.1 dsieger 4461:
1.184 rillig 4462: The package still does not find all of its dependencies. Now the question is:
4463: Which package provides the libIDL/IDL.h header file?
1.1 dsieger 4464:
1.184 rillig 4465: $ echo ../../*/*idl*
4466: ../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
4467: $ echo ../../*/*IDL*
4468: ../../net/libIDL
1.1 dsieger 4469:
1.184 rillig 4470: Let's take the one from the second try. So I included the ../../net/libIDL/
4471: buildlink3.mk file and tried again. But the error didn't change. After digging
4472: through some of the code, I concluded that the build process of the package was
4473: broken and couldn't have ever worked, but since the Mozilla source tree is
4474: quite large, I didn't want to fix it. So I added the following to the package
4475: Makefile and tried again:
1.1 dsieger 4476:
1.184 rillig 4477: CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
4478: BUILDLINK_TRANSFORM+= l:IDL:IDL-2
1.1 dsieger 4479:
1.184 rillig 4480: The latter line is needed because the package expects the library libIDL.so,
4481: but only libIDL-2.so is available. So I told the compiler wrapper to rewrite
4482: that on the fly.
1.1 dsieger 4483:
1.184 rillig 4484: The next problem was related to a recent change of the FreeType interface. I
4485: looked up in www/seamonkey which patch files were relevant for this issue and
4486: copied them to the patches directory. Then I retried, fixed the patches so that
4487: they applied cleanly and retried again. This time, everything worked.
1.1 dsieger 4488:
1.184 rillig 4489: 14.2.1.3. Installing the package
1.1 dsieger 4490:
1.184 rillig 4491: $ bmake CHECK_FILES=no install
4492: [...]
4493: $ bmake print-PLIST >PLIST
4494: $ bmake deinstall
4495: $ bmake install
1.1 dsieger 4496:
1.184 rillig 4497: Chapter 15. Programming in Makefiles
1.1 dsieger 4498:
1.184 rillig 4499: Table of Contents
1.1 dsieger 4500:
1.184 rillig 4501: 15.1. Caveats
4502: 15.2. Makefile variables
4503: 15.2.1. Naming conventions
4504: 15.3. Code snippets
4505: 15.3.1. Adding things to a list
4506: 15.3.2. Echoing a string exactly as-is
4507: 15.3.3. Passing CFLAGS to GNU configure scripts
4508: 15.3.4. Handling possibly empty variables
1.229 gutterid 4509: 15.3.5. Testing yes/no variables in conditions
1.1 dsieger 4510:
1.184 rillig 4511: Pkgsrc consists of many Makefile fragments, each of which forms a well-defined
4512: part of the pkgsrc system. Using the make(1) system as a programming language
4513: for a big system like pkgsrc requires some discipline to keep the code correct
4514: and understandable.
1.1 dsieger 4515:
1.184 rillig 4516: The basic ingredients for Makefile programming are variables and shell
4517: commands. Among these shell commands may even be more complex ones like awk(1)
4518: programs. To make sure that every shell command runs as intended it is
4519: necessary to quote all variables correctly when they are used.
1.1 dsieger 4520:
1.184 rillig 4521: This chapter describes some patterns that appear quite often in Makefiles,
4522: including the pitfalls that come along with them.
1.1 dsieger 4523:
1.184 rillig 4524: 15.1. Caveats
1.1 dsieger 4525:
1.184 rillig 4526: * When you are creating a file as a target of a rule, always write the data
4527: to a temporary file first and finally rename that file. Otherwise there
4528: might occur an error in the middle of generating the file, and when the
4529: user runs make(1) for the second time, the file exists and will not be
4530: regenerated properly. Example:
1.1 dsieger 4531:
1.184 rillig 4532: wrong:
4533: @echo "line 1" > ${.TARGET}
4534: @echo "line 2" >> ${.TARGET}
4535: @false
1.1 dsieger 4536:
1.184 rillig 4537: correct:
4538: @echo "line 1" > ${.TARGET}.tmp
4539: @echo "line 2" >> ${.TARGET}.tmp
4540: @false
4541: @mv ${.TARGET}.tmp ${.TARGET}
1.1 dsieger 4542:
1.184 rillig 4543: When you run make wrong twice, the file wrong will exist, although there
4544: was an error message in the first run. On the other hand, running make
4545: correct gives an error message twice, as expected.
1.1 dsieger 4546:
1.184 rillig 4547: You might remember that make(1) sometimes removes ${.TARGET} in case of
4548: error, but this only happens when it is interrupted, for example by
4549: pressing Ctrl+C. This does not happen when one of the commands fails (like
4550: false(1) above).
1.1 dsieger 4551:
1.184 rillig 4552: 15.2. Makefile variables
1.1 dsieger 4553:
1.184 rillig 4554: Makefile variables contain strings that can be processed using the five
4555: operators =, +=, ?=, := and !=, which are described in the make(1) man page.
1.1 dsieger 4556:
1.184 rillig 4557: When a variable's value is parsed from a Makefile, the hash character # and the
4558: backslash character \ are handled specially. If a backslash is the last
4559: character in a line, that backslash is removed from the line and the line
4560: continues with the next line of the file.
1.1 dsieger 4561:
1.184 rillig 4562: The # character starts a comment that reaches until the end of the line. To get
4563: an actual # character, such as in a URL, write \# instead.
1.1 dsieger 4564:
1.184 rillig 4565: The evaluation of variables either happens immediately or lazy. It happens
4566: immediately when the variable occurs on the right-hand side of the := or the !=
4567: operator, in a .if condition or a .for loop. In the other cases, it is
4568: evaluated lazily.
1.1 dsieger 4569:
1.184 rillig 4570: Some of the modifiers split the string into words and then operate on the
4571: words, others operate on the string as a whole. When a string is split into
4572: words, double quotes and single quotes are interpreted as delimiters, just like
4573: in sh(1).
1.1 dsieger 4574:
1.184 rillig 4575: 15.2.1. Naming conventions
1.1 dsieger 4576:
1.184 rillig 4577: * All variable names starting with an underscore are reserved for use by the
4578: pkgsrc infrastructure. They shall not be used by packages.
1.1 dsieger 4579:
1.184 rillig 4580: * In .for loops you should use lowercase variable names for the iteration
4581: variables.
1.1 dsieger 4582:
1.184 rillig 4583: * All list variables should have a plural name, such as PKG_OPTIONS or
4584: DISTFILES.
1.1 dsieger 4585:
1.184 rillig 4586: 15.3. Code snippets
1.1 dsieger 4587:
1.184 rillig 4588: 15.3.1. Adding things to a list
1.1 dsieger 4589:
1.184 rillig 4590: When adding a string that possibly contains whitespace or quotes to a list
4591: (example 1), it must be quoted using the :Q modifier.
1.1 dsieger 4592:
1.184 rillig 4593: When adding another list to a list (example 2), it must not be quoted, since
4594: its elements are already quoted.
1.1 dsieger 4595:
1.184 rillig 4596: STRING= foo * bar `date`
4597: LIST= # empty
4598: ANOTHER_LIST= a=b c=d
1.1 dsieger 4599:
1.184 rillig 4600: LIST+= ${STRING:Q} # 1
4601: LIST+= ${ANOTHER_LIST} # 2
1.1 dsieger 4602:
1.184 rillig 4603: 15.3.2. Echoing a string exactly as-is
1.1 dsieger 4604:
1.184 rillig 4605: Echoing a string containing special characters needs special work.
1.1 dsieger 4606:
1.184 rillig 4607: STRING= foo bar < > * `date` $$HOME ' "
4608: EXAMPLE_ENV= string=${STRING:Q} x=multiple\ quoted\ words
1.1 dsieger 4609:
1.184 rillig 4610: all:
4611: echo ${STRING} # 1
4612: echo ${STRING:Q} # 2
4613: printf '%s\n' ${STRING:Q}'' # 3
4614: env ${EXAMPLE_ENV} sh -c 'echo "$$string"; echo "$$x"' # 4
1.1 dsieger 4615:
1.184 rillig 4616: Example 1 leads to a syntax error in the shell, as the characters are just
4617: copied.
1.1 dsieger 4618:
1.184 rillig 4619: Example 2 quotes the string so that the shell interprets it correctly. But the
4620: echo command may additionally interpret strings with a leading dash or those
4621: containing backslashes.
1.1 dsieger 4622:
1.184 rillig 4623: Example 3 can handle arbitrary strings, since printf(1) only interprets the
4624: format string, but not the next argument. The trailing single quotes handle the
4625: case when the string is empty. In that case, the :Q modifier would result in an
4626: empty string too, which would then be skipped by the shell. For printf(1) this
4627: doesn't make a difference, but other programs may care.
1.1 dsieger 4628:
1.184 rillig 4629: In example 4, the EXAMPLE_ENV does not need to be quoted because the quoting
4630: has already been done when adding elements to the list.
1.1 dsieger 4631:
1.184 rillig 4632: 15.3.3. Passing CFLAGS to GNU configure scripts
1.1 dsieger 4633:
1.184 rillig 4634: When passing CFLAGS or similar variables to a GNU-style configure script
4635: (especially those that call other configure scripts), it must not have leading
4636: or trailing whitespace, since otherwise the configure script gets confused. To
4637: trim leading and trailing whitespace, use the :M modifier, as in the following
4638: example:
1.1 dsieger 4639:
1.184 rillig 4640: CPPFLAGS= # empty
4641: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX}\"
4642: CPPFLAGS+= ${MY_CPPFLAGS}
1.1 dsieger 4643:
1.184 rillig 4644: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
1.1 dsieger 4645:
1.184 rillig 4646: all:
4647: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
4648: echo x${CONFIGURE_ARGS:Q}x # properly trimmed
1.1 dsieger 4649:
1.184 rillig 4650: In this example, CPPFLAGS has both leading and trailing whitespace because the
4651: += operator always adds a space.
1.1 dsieger 4652:
1.184 rillig 4653: 15.3.4. Handling possibly empty variables
1.1 dsieger 4654:
1.184 rillig 4655: When a possibly empty variable is used in a shell program, it may lead to a
4656: syntax error.
1.1 dsieger 4657:
1.184 rillig 4658: EGFILES= # empty
1.1 dsieger 4659:
1.184 rillig 4660: install-examples: # produces a syntax error in the shell
4661: for egfile in ${EGFILES}; do \
4662: echo "Installing $$egfile"; \
4663: done
1.1 dsieger 4664:
1.184 rillig 4665: The shell only sees the text for egfile in ; do, since ${EGFILES} is replaced
4666: with an empty string by make(1). To fix this syntax error, use one of the
4667: snippets below.
1.1 dsieger 4668:
1.229 gutterid 4669: EGFILES= # empty
1.1 dsieger 4670:
1.184 rillig 4671: install-examples:
4672: for egfile in ${EGFILES} ""; do \
4673: [ -n "$$egfile" ] || continue; \
4674: echo "Installing $$egfile"; \
4675: done
1.1 dsieger 4676:
1.184 rillig 4677: In this case, an empty string is appended to the iteration list (to prevent the
4678: syntax error) and filtered out later.
1.1 dsieger 4679:
1.184 rillig 4680: EGFILES= # empty
1.1 dsieger 4681:
1.184 rillig 4682: install-examples:
4683: .for egfile in ${EGFILES}
4684: echo "Installing ${egfile}"
4685: .endfor
1.1 dsieger 4686:
1.184 rillig 4687: If one of the filenames contains special characters, it should be enclosed in
4688: single or double quotes.
1.1 dsieger 4689:
1.184 rillig 4690: To have a shell command test whether a make variable is empty, use the
4691: following code: ${TEST} -z ${POSSIBLY_EMPTY:Q}"".
1.1 dsieger 4692:
1.229 gutterid 4693: 15.3.5. Testing yes/no variables in conditions
4694:
4695: When a variable can have the values yes or no, use the following pattern to
4696: test the variable:
4697:
4698: .if ${VAR:U:tl} == "yes"
4699: # do something
4700: .endif
4701:
4702: The :U modifier is only necessary if the variable can be undefined. If the
4703: variable is guaranteed to be defined, the :U can be omitted.
4704:
4705: The :tl modifier converts the variable value to lowercase, allowing for the
4706: values yes, Yes, YES.
4707:
1.184 rillig 4708: Chapter 16. Options handling
1.1 dsieger 4709:
4710: Table of Contents
4711:
1.184 rillig 4712: 16.1. Global default options
4713: 16.2. Converting packages to use bsd.options.mk
4714: 16.3. Option Names
4715: 16.4. Determining the options of dependencies
1.1 dsieger 4716:
4717: Many packages have the ability to be built to support different sets of
4718: features. bsd.options.mk is a framework in pkgsrc that provides generic
4719: handling of those options that determine different ways in which the packages
4720: can be built. It's possible for the user to specify exactly which sets of
4721: options will be built into a package or to allow a set of global default
4722: options apply.
4723:
1.7 rillig 4724: There are two broad classes of behaviors that one might want to control via
4725: options. One is whether some particular feature is enabled in a program that
4726: will be built anyway, often by including or not including a dependency on some
4727: other package. The other is whether or not an additional program will be built
4728: as part of the package. Generally, it is better to make a split package for
4729: such additional programs instead of using options, because it enables binary
4730: packages to be built which can then be added separately. For example, the foo
4731: package might have minimal dependencies (those packages without which foo
4732: doesn't make sense), and then the foo-gfoo package might include the GTK
4733: frontend program gfoo. This is better than including a gtk option to foo that
4734: adds gfoo, because either that option is default, in which case binary users
4735: can't get foo without gfoo, or not default, in which case they can't get gfoo.
4736: With split packages, they can install foo without having GTK, and later decide
4737: to install gfoo (pulling in GTK at that time). This is an advantage to source
4738: users too, avoiding the need for rebuilds.
4739:
4740: Plugins with widely varying dependencies should usually be split instead of
4741: options.
4742:
4743: It is often more work to maintain split packages, especially if the upstream
4744: package does not support this. The decision of split vs. option should be made
4745: based on the likelihood that users will want or object to the various pieces,
4746: the size of the dependencies that are included, and the amount of work.
4747:
4748: A further consideration is licensing. Non-free parts, or parts that depend on
4749: non-free dependencies (especially plugins) should almost always be split if
4750: feasible.
4751:
1.184 rillig 4752: 16.1. Global default options
1.1 dsieger 4753:
4754: Global default options are listed in PKG_DEFAULT_OPTIONS, which is a list of
4755: the options that should be built into every package if that option is
1.4 rillig 4756: supported. This variable should be set in mk.conf.
1.1 dsieger 4757:
1.184 rillig 4758: 16.2. Converting packages to use bsd.options.mk
1.1 dsieger 4759:
4760: The following example shows how bsd.options.mk should be used by the
4761: hypothetical ``wibble'' package, either in the package Makefile, or in a file,
4762: e.g. options.mk, that is included by the main package Makefile.
4763:
4764: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
4765: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
4766: PKG_OPTIONS_OPTIONAL_GROUPS= database
4767: PKG_OPTIONS_GROUP.database= mysql pgsql
4768: PKG_SUGGESTED_OPTIONS= wibble-foo
4769: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
4770: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
4771:
4772: .include "../../mk/bsd.prefs.mk"
4773:
4774: # this package was previously named wibble2
4775: .if defined(PKG_OPTIONS.wibble2)
4776: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
4777: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
4778: "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead."
4779: .endif
4780:
4781: .include "../../mk/bsd.options.mk"
4782:
4783: # Package-specific option-handling
4784:
4785: ###
4786: ### FOO support
4787: ###
4788: .if !empty(PKG_OPTIONS:Mwibble-foo)
4789: CONFIGURE_ARGS+= --enable-foo
4790: .endif
4791:
4792: ###
4793: ### LDAP support
4794: ###
4795: .if !empty(PKG_OPTIONS:Mldap)
4796: . include "../../databases/openldap-client/buildlink3.mk"
4797: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client}
4798: .endif
4799:
4800: ###
4801: ### database support
4802: ###
4803: .if !empty(PKG_OPTIONS:Mmysql)
4804: . include "../../mk/mysql.buildlink3.mk"
4805: .endif
4806: .if !empty(PKG_OPTIONS:Mpgsql)
4807: . include "../../mk/pgsql.buildlink3.mk"
4808: .endif
4809:
4810: The first section contains the information about which build options are
4811: supported by the package, and any default options settings if needed.
4812:
4813: 1. PKG_OPTIONS_VAR is the name of the make(1) variable that the user can set
4814: to override the default options. It should be set to PKG_OPTIONS.pkgbase.
4815: Do not set it to PKG_OPTIONS.${PKGBASE}, since PKGBASE is not defined at
4816: the point where the options are processed.
4817:
4818: 2. PKG_SUPPORTED_OPTIONS is a list of build options supported by the package.
4819:
4820: 3. PKG_OPTIONS_OPTIONAL_GROUPS is a list of names of groups of mutually
4821: exclusive options. The options in each group are listed in
4822: PKG_OPTIONS_GROUP.groupname. The most specific setting of any option from
4823: the group takes precedence over all other options in the group. Options
4824: from the groups will be automatically added to PKG_SUPPORTED_OPTIONS.
4825:
4826: 4. PKG_OPTIONS_REQUIRED_GROUPS is like PKG_OPTIONS_OPTIONAL_GROUPS, but
4827: building the packages will fail if no option from the group is selected.
4828:
4829: 5. PKG_OPTIONS_NONEMPTY_SETS is a list of names of sets of options. At least
4830: one option from each set must be selected. The options in each set are
4831: listed in PKG_OPTIONS_SET.setname. Options from the sets will be
4832: automatically added to PKG_SUPPORTED_OPTIONS. Building the package will
4833: fail if no option from the set is selected.
4834:
4835: 6. PKG_SUGGESTED_OPTIONS is a list of build options which are enabled by
4836: default.
4837:
4838: 7. PKG_OPTIONS_LEGACY_VARS is a list of "USE_VARIABLE:option" pairs that map
1.4 rillig 4839: legacy mk.conf variables to their option counterparts. Pairs should be
1.1 dsieger 4840: added with "+=" to keep the listing of global legacy variables. A warning
4841: will be issued if the user uses a legacy variable.
4842:
4843: 8. PKG_OPTIONS_LEGACY_OPTS is a list of "old-option:new-option" pairs that map
4844: options that have been renamed to their new counterparts. Pairs should be
4845: added with "+=" to keep the listing of global legacy options. A warning
4846: will be issued if the user uses a legacy option.
4847:
4848: 9. PKG_LEGACY_OPTIONS is a list of options implied by deprecated variables
4849: used. This can be used for cases that neither PKG_OPTIONS_LEGACY_VARS nor
4850: PKG_OPTIONS_LEGACY_OPTS can handle, e. g. when PKG_OPTIONS_VAR is renamed.
4851:
4852: 10. PKG_OPTIONS_DEPRECATED_WARNINGS is a list of warnings about deprecated
4853: variables or options used, and what to use instead.
4854:
4855: A package should never modify PKG_DEFAULT_OPTIONS or the variable named in
4856: PKG_OPTIONS_VAR. These are strictly user-settable. To suggest a default set of
4857: options, use PKG_SUGGESTED_OPTIONS.
4858:
4859: PKG_OPTIONS_VAR must be defined before including bsd.options.mk. If none of
4860: PKG_SUPPORTED_OPTIONS, PKG_OPTIONS_OPTIONAL_GROUPS, and
4861: PKG_OPTIONS_REQUIRED_GROUPS are defined (as can happen with platform-specific
4862: options if none of them is supported on the current platform), PKG_OPTIONS is
4863: set to the empty list and the package is otherwise treated as not using the
4864: options framework.
4865:
4866: After the inclusion of bsd.options.mk, the variable PKG_OPTIONS contains the
4867: list of selected build options, properly filtered to remove unsupported and
4868: duplicate options.
4869:
4870: The remaining sections contain the logic that is specific to each option. The
4871: correct way to check for an option is to check whether it is listed in
4872: PKG_OPTIONS:
4873:
4874: .if !empty(PKG_OPTIONS:Moption)
4875:
1.184 rillig 4876: 16.3. Option Names
1.1 dsieger 4877:
4878: Options that enable similar features in different packages (like optional
4879: support for a library) should use a common name in all packages that support it
4880: (like the name of the library). If another package already has an option with
4881: the same meaning, use the same name.
4882:
4883: Options that enable features specific to one package, where it's unlikely that
4884: another (unrelated) package has the same (or a similar) optional feature,
4885: should use a name prefixed with pkgname-.
4886:
4887: If a group of related packages share an optional feature specific to that
4888: group, prefix it with the name of the "main" package (e. g.
4889: djbware-errno-hack).
4890:
4891: For new options, add a line to mk/defaults/options.description. Lines have two
4892: fields, separated by tab. The first field is the option name, the second its
4893: description. The description should be a whole sentence (starting with an
4894: uppercase letter and ending with a period) that describes what enabling the
4895: option does. E. g. "Enable ispell support." The file is sorted by option names.
4896:
1.184 rillig 4897: 16.4. Determining the options of dependencies
1.7 rillig 4898:
4899: When writing buildlink3.mk files, it is often necessary to list different
4900: dependencies based on the options with which the package was built. For
4901: querying these options, the file pkgsrc/mk/pkg-build-options.mk should be used.
4902: A typical example looks like this:
4903:
4904: pkgbase := libpurple
4905: .include "../../mk/pkg-build-options.mk"
4906:
4907: .if !empty(PKG_BUILD_OPTIONS.libpurple:Mdbus)
4908: ...
4909: .endif
4910:
4911: Including pkg-build-options.mk here will set the variable
4912: PKG_BUILD_OPTIONS.libpurple to the build options of the libpurple package,
4913: which can then be queried like PKG_OPTIONS in the options.mk file. See the file
4914: pkg-build-options.mk for more details.
4915:
1.184 rillig 4916: Chapter 17. Tools needed for building or running
4917:
4918: Table of Contents
4919:
4920: 17.1. Tools for pkgsrc builds
4921: 17.2. Tools needed by packages
4922: 17.3. Tools provided by platforms
4923:
4924: The USE_TOOLS definition is used both internally by pkgsrc and also for
4925: individual packages to define what commands are needed for building a package
4926: (like TOOL_DEPENDS) or for later run-time of an installed packaged (such as
4927: DEPENDS). If the native system provides an adequate tool, then in many cases, a
4928: pkgsrc package will not be used.
4929:
4930: When building a package, the replacement tools are made available in a
4931: directory (as symlinks or wrapper scripts) that is early in the executable
4932: search path. Just like the buildlink system, this helps with consistent builds.
4933:
4934: A tool may be needed to help build a specific package. For example, perl, GNU
4935: make (gmake) or yacc may be needed.
4936:
4937: Also a tool may be needed, for example, because the native system's supplied
4938: tool may be inefficient for building a package with pkgsrc. For example, a
4939: package may need GNU awk, bison (instead of yacc) or a better sed.
4940:
4941: The tools used by a package can be listed by running make show-tools.
4942:
4943: 17.1. Tools for pkgsrc builds
4944:
4945: The default set of tools used by pkgsrc is defined in bsd.pkg.mk. This includes
4946: standard Unix tools, such as: cat, awk, chmod, test, and so on. These can be
4947: seen by running: make show-var VARNAME=USE_TOOLS.
4948:
4949: If a package needs a specific program to build then the USE_TOOLS variable can
4950: be used to define the tools needed.
4951:
4952: 17.2. Tools needed by packages
4953:
4954: In the following examples, the :run means that it is needed at run-time (and
4955: becomes a DEPENDS). The default is a build dependency which can be set with
4956: :build. (So in this example, it is the same as gmake:build and
4957: pkg-config:build.)
4958:
4959: USE_TOOLS+= gmake perl:run pkg-config
4960:
4961: When using the tools framework, a TOOLS_PATH.foo variable is defined which
4962: contains the full path to the appropriate tool. For example, TOOLS_PATH.bash
4963: could be "/bin/bash" on Linux systems.
4964:
4965: If you always need a pkgsrc version of the tool at run-time, then just use
4966: DEPENDS instead.
4967:
4968: 17.3. Tools provided by platforms
4969:
4970: When improving or porting pkgsrc to a new platform, have a look at (or create)
4971: the corresponding platform specific make file fragment under pkgsrc/mk/tools/
4972: tools.${OPSYS}.mk which defines the name of the common tools. For example:
4973:
4974: .if exists(/usr/bin/bzcat)
4975: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
4976: .elif exists(/usr/bin/bzip2)
4977: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
4978: .endif
4979:
4980: TOOLS_PLATFORM.true?= true # shell builtin
4981:
4982: Chapter 18. Buildlink methodology
1.1 dsieger 4983:
4984: Table of Contents
4985:
1.184 rillig 4986: 18.1. Converting packages to use buildlink3
4987: 18.2. Writing buildlink3.mk files
4988: 18.2.1. Anatomy of a buildlink3.mk file
4989: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
1.259 leot 4990: buildlink3.mk files
1.184 rillig 4991: 18.3. Writing builtin.mk files
4992: 18.3.1. Anatomy of a builtin.mk file
4993:
4994: Buildlink is a framework in pkgsrc that controls what headers and libraries are
4995: seen by a package's configure and build processes. This is implemented in a two
4996: step process:
4997:
4998: 1. Symlink headers and libraries for dependencies into BUILDLINK_DIR, which by
4999: default is a subdirectory of WRKDIR.
5000:
5001: 2. Create wrapper scripts that are used in place of the normal compiler tools
5002: that translate -I${LOCALBASE}/include and -L${LOCALBASE}/lib into
5003: references to BUILDLINK_DIR. The wrapper scripts also make native compiler
5004: on some operating systems look like GCC, so that packages that expect GCC
5005: won't require modifications to build with those native compilers.
5006:
5007: This normalizes the environment in which a package is built so that the package
5008: may be built consistently despite what other software may be installed. Please
5009: note that the normal system header and library paths, e.g. /usr/include, /usr/
5010: lib, etc., are always searched -- buildlink3 is designed to insulate the
5011: package build from non-system-supplied software.
5012:
5013: 18.1. Converting packages to use buildlink3
1.1 dsieger 5014:
1.184 rillig 5015: The process of converting packages to use the buildlink3 framework ("bl3ifying"
5016: ) is fairly straightforward. The things to keep in mind are:
1.1 dsieger 5017:
1.184 rillig 5018: 1. Ensure that the build always calls the wrapper scripts instead of the
5019: actual toolchain. Some packages are tricky, and the only way to know for
5020: sure is the check ${WRKDIR}/.work.log to see if the wrappers are being
5021: invoked.
1.1 dsieger 5022:
1.184 rillig 5023: 2. Don't override PREFIX from within the package Makefile, e.g. Java VMs,
5024: standalone shells, etc., because the code to symlink files into $
5025: {BUILDLINK_DIR} looks for files relative to "pkg_info -qp pkgname".
1.1 dsieger 5026:
1.184 rillig 5027: 3. Remember that only the buildlink3.mk files that you list in a package's
5028: Makefile are added as dependencies for that package.
1.1 dsieger 5029:
1.184 rillig 5030: If a dependency on a particular package is required for its libraries and
5031: headers, then we replace:
1.1 dsieger 5032:
1.184 rillig 5033: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 dsieger 5034:
1.184 rillig 5035: with
1.1 dsieger 5036:
1.184 rillig 5037: .include "../../category/foo/buildlink3.mk"
1.1 dsieger 5038:
1.184 rillig 5039: The buildlink3.mk files usually define the required dependencies. If you need a
5040: newer version of the dependency when using buildlink3.mk files, then you can
5041: define it in your Makefile; for example:
1.1 dsieger 5042:
1.184 rillig 5043: BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0
5044: .include "../../category/foo/buildlink3.mk"
1.1 dsieger 5045:
1.184 rillig 5046: There are several buildlink3.mk files in pkgsrc/mk that handle special package
5047: issues:
1.1 dsieger 5048:
1.184 rillig 5049: * bdb.buildlink3.mk chooses either the native or a pkgsrc Berkeley DB
5050: implementation based on the values of BDB_ACCEPTED and BDB_DEFAULT.
1.1 dsieger 5051:
1.184 rillig 5052: * curses.buildlink3.mk: If the system comes with neither Curses nor NCurses,
5053: this will take care to install the devel/ncurses package.
1.1 dsieger 5054:
1.184 rillig 5055: * krb5.buildlink3.mk uses the value of KRB5_ACCEPTED to choose between adding
5056: a dependency on Heimdal or MIT-krb5 for packages that require a Kerberos 5
5057: implementation.
1.1 dsieger 5058:
1.184 rillig 5059: * motif.buildlink3.mk checks for a system-provided Motif installation or adds
5060: a dependency on x11/lesstif or x11/motif. The user can set MOTIF_TYPE to "
5061: dt", "lesstif" or "motif" to choose which Motif version will be used.
1.1 dsieger 5062:
1.184 rillig 5063: * readline.buildlink3.mk checks for a system-provided GNU readline or
5064: editline (libedit) installation, or adds a dependency on devel/readline,
5065: devel/editline. The user can set READLINE_DEFAULT to choose readline
5066: implementation. If your package really needs GNU readline library, its
5067: Makefile should include devel/readline/buildlink3.mk instead of
5068: readline.buildlink3.mk.
1.1 dsieger 5069:
1.184 rillig 5070: * oss.buildlink3.mk defines several variables that may be used by packages
5071: that use the Open Sound System (OSS) API.
1.1 dsieger 5072:
1.184 rillig 5073: * pgsql.buildlink3.mk will accept any of the Postgres versions in the
5074: variable PGSQL_VERSIONS_ACCEPTED and default to the version
5075: PGSQL_VERSION_DEFAULT. See the file for more information.
1.1 dsieger 5076:
1.184 rillig 5077: * pthread.buildlink3.mk uses the value of PTHREAD_OPTS and checks for native
5078: pthreads or adds a dependency on devel/pth as needed.
1.1 dsieger 5079:
1.184 rillig 5080: * xaw.buildlink3.mk uses the value of XAW_TYPE to choose a particular Athena
5081: widgets library.
1.1 dsieger 5082:
1.184 rillig 5083: The comments in those buildlink3.mk files provide a more complete description
5084: of how to use them properly.
1.1 dsieger 5085:
1.184 rillig 5086: 18.2. Writing buildlink3.mk files
1.1 dsieger 5087:
1.184 rillig 5088: A package's buildlink3.mk file is included by Makefiles to indicate the need to
5089: compile and link against header files and libraries provided by the package. A
5090: buildlink3.mk file should always provide enough information to add the correct
5091: type of dependency relationship and include any other buildlink3.mk files that
5092: it needs to find headers and libraries that it needs in turn.
1.1 dsieger 5093:
1.184 rillig 5094: To generate an initial buildlink3.mk file for further editing, Rene Hexel's
5095: pkgtools/createbuildlink package is highly recommended. For most packages, the
5096: following command will generate a good starting point for buildlink3.mk files:
1.1 dsieger 5097:
1.184 rillig 5098: % cd pkgsrc/category/pkgdir
5099: % createbuildlink >buildlink3.mk
1.1 dsieger 5100:
5101:
1.184 rillig 5102: 18.2.1. Anatomy of a buildlink3.mk file
1.1 dsieger 5103:
1.184 rillig 5104: The following real-life example buildlink3.mk is taken from pkgsrc/graphics/
5105: tiff:
1.14 jmcneill 5106:
1.184 rillig 5107: BUILDLINK_TREE+= tiff
1.1 dsieger 5108:
1.184 rillig 5109: .if !defined(TIFF_BUILDLINK3_MK)
5110: TIFF_BUILDLINK3_MK:=
1.1 dsieger 5111:
1.184 rillig 5112: BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1
5113: BUILDLINK_ABI_DEPENDS.tiff+= tiff>=3.7.2nb1
5114: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
1.1 dsieger 5115:
1.184 rillig 5116: .include "../../devel/zlib/buildlink3.mk"
5117: .include "../../graphics/jpeg/buildlink3.mk"
5118: .endif # TIFF_BUILDLINK3_MK
1.1 dsieger 5119:
1.184 rillig 5120: BUILDLINK_TREE+= -tiff
1.1 dsieger 5121:
1.184 rillig 5122: The header and footer manipulate BUILDLINK_TREE, which is common across all
5123: buildlink3.mk files and is used to track the dependency tree.
1.1 dsieger 5124:
1.184 rillig 5125: The main section is protected from multiple inclusion and controls how the
5126: dependency on pkg is added. Several important variables are set in the section:
1.1 dsieger 5127:
1.185 wiz 5128: * BUILDLINK_API_DEPENDS.pkg is the dependency version recorded in the
1.184 rillig 5129: installed package; this should always be set using += to ensure that we're
5130: appending to any pre-existing list of values. This variable should be set
1.185 wiz 5131: to the last version of the package that had an backwards-incompatible API
1.184 rillig 5132: change.
1.1 dsieger 5133:
1.184 rillig 5134: * BUILDLINK_PKGSRCDIR.pkg is the location of the pkg pkgsrc directory.
1.1 dsieger 5135:
1.184 rillig 5136: * BUILDLINK_DEPMETHOD.pkg (not shown above) controls whether we use
1.236 gutterid 5137: BUILD_DEPENDS or DEPENDS to add the dependency on pkg. The build dependency
5138: is selected by setting BUILDLINK_DEPMETHOD.pkg to "build". By default, the
5139: full dependency is used.
1.1 dsieger 5140:
1.184 rillig 5141: * BUILDLINK_INCDIRS.pkg and BUILDLINK_LIBDIRS.pkg (not shown above) are lists
5142: of subdirectories of ${BUILDLINK_PREFIX.pkg} to add to the header and
5143: library search paths. These default to "include" and "lib" respectively.
1.1 dsieger 5144:
1.184 rillig 5145: * BUILDLINK_CPPFLAGS.pkg (not shown above) is the list of preprocessor flags
5146: to add to CPPFLAGS, which are passed on to the configure and build phases.
5147: The "-I" option should be avoided and instead be handled using
5148: BUILDLINK_INCDIRS.pkg as above.
1.66 asau 5149:
1.184 rillig 5150: The following variables are all optionally defined within this second section
5151: (protected against multiple inclusion) and control which package files are
5152: symlinked into ${BUILDLINK_DIR} and how their names are transformed during the
5153: symlinking:
1.23 jakllsch 5154:
1.184 rillig 5155: * BUILDLINK_FILES.pkg (not shown above) is a shell glob pattern relative to $
5156: {BUILDLINK_PREFIX.pkg} to be symlinked into ${BUILDLINK_DIR}, e.g. include/
5157: *.h.
1.1 dsieger 5158:
1.184 rillig 5159: * BUILDLINK_FILES_CMD.pkg (not shown above) is a shell pipeline that outputs
5160: to stdout a list of files relative to ${BUILDLINK_PREFIX.pkg}. The
5161: resulting files are to be symlinked into ${BUILDLINK_DIR}. By default, this
5162: takes the +CONTENTS of a pkg and filters it through $
5163: {BUILDLINK_CONTENTS_FILTER.pkg}.
1.1 dsieger 5164:
1.184 rillig 5165: * BUILDLINK_CONTENTS_FILTER.pkg (not shown above) is a filter command that
5166: filters +CONTENTS input into a list of files relative to $
5167: {BUILDLINK_PREFIX.pkg} on stdout. By default, BUILDLINK_CONTENTS_FILTER.pkg
5168: outputs the contents of the include and lib directories in the package
5169: +CONTENTS.
1.1 dsieger 5170:
1.184 rillig 5171: * BUILDLINK_FNAME_TRANSFORM.pkg (not shown above) is a list of sed arguments
5172: used to transform the name of the source filename into a destination
5173: filename, e.g. -e "s|/curses.h|/ncurses.h|g".
1.1 dsieger 5174:
1.184 rillig 5175: This section can additionally include any buildlink3.mk needed for pkg's
5176: library dependencies. Including these buildlink3.mk files means that the
5177: headers and libraries for these dependencies are also symlinked into $
5178: {BUILDLINK_DIR} whenever the pkg buildlink3.mk file is included. Dependencies
5179: are only added for directly include buildlink3.mk files.
1.1 dsieger 5180:
1.184 rillig 5181: When providing a buildlink3.mk and including other buildlink3.mk files in it,
5182: please only add necessary ones, i.e., those whose libraries or header files are
5183: automatically exposed when the package is use.
1.1 dsieger 5184:
1.184 rillig 5185: In particular, if only an executable (bin/foo) is linked against a library,
5186: that library does not need to be propagated in the buildlink3.mk file.
1.1 dsieger 5187:
1.184 rillig 5188: The following steps should help you decide if a buildlink3.mk file needs to be
5189: included:
1.1 dsieger 5190:
1.184 rillig 5191: * Look at the installed header files: What headers do they include? The
5192: packages providing these files must be buildlinked.
1.1 dsieger 5193:
1.184 rillig 5194: * Run ldd on all installed libraries and look against what other libraries
5195: they link. Some of the packages providing these probably need to be
5196: buildlinked; however, it's not automatic, since e.g. GTK on some systems
5197: pulls in the X libraries, so they will show up in the ldd output, while on
5198: others (like OS X) it won't. ldd output can thus only be used as a hint.
1.1 dsieger 5199:
1.184 rillig 5200: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
5201: buildlink3.mk files
1.16 jnemeth 5202:
1.185 wiz 5203: Both variables set lower bounds for a version of this package. The two
5204: variables differ in that one describes source compatibility (API) and the other
5205: binary compatibility (ABI). The difference is that a change in the API breaks
5206: compilation of programs while changes in the ABI stop compiled programs from
5207: running.
5208:
5209: The BUILDLINK_API_DEPENDS.pkg variable in a buildlink3.mk should be changed
5210: very rarely. (One possible scenario: If all packages using this package need a
5211: higher version than defined in the buildlink3.mk, BUILDLINK_API_DEPENDS.pkg
5212: could be updated to that higher version.)
5213:
5214: On the other hand, changes to BUILDLINK_ABI_DEPENDS.pkg are more common. The
5215: variable will need to be updated every time the major version of one of its
5216: shared libraries is changed, or any other change where a binary built against
5217: the previous version of the package will not run against the new version any
5218: longer.
5219:
5220: In such a case, the package's BUILDLINK_ABI_DEPENDS.pkg must be increased to
5221: require the new package version. Then the PKGREVISION of all packages foo that
5222: depend on this package need to be increased, and if they have buildlink3.mk
5223: files, BUILDLINK_ABI_DEPENDS.foo in their buildlink3.mk files must be increased
5224: to the new version as well. This is required so that a package will pull in the
5225: versions of the packages that use the new ABI and that the packages'
5226: PKGREVISIONs uniquely identify the packages built against the new ABI. The
5227: pkgtools/revbump package can help with these updates.
1.1 dsieger 5228:
1.184 rillig 5229: See Section 21.1.5, "Handling dependencies" for more information about
1.185 wiz 5230: dependencies on other packages, including the BUILDLINK_API_DEPENDS
5231: definitions.
1.1 dsieger 5232:
1.184 rillig 5233: Please take careful consideration before adjusting BUILDLINK_API_DEPENDS.pkg or
1.185 wiz 5234: BUILDLINK_ABI_DEPENDS.pkg in a buildlink3.mk file as we don't want to cause
5235: unneeded package deletions and rebuilds. In many cases, new versions of
5236: packages work just fine with older dependencies.
1.1 dsieger 5237:
1.211 gutterid 5238: Also, it is not needed to set BUILDLINK_ABI_DEPENDS.pkg when it is identical to
1.184 rillig 5239: BUILDLINK_API_DEPENDS.pkg.
1.1 dsieger 5240:
1.211 gutterid 5241: Note there is also the distinction that users are able to disable enforcement
5242: of ABI dependencies using the USE_ABI_DEPENDS variable, but there is no
5243: equivalent option for API dependencies.
5244:
1.184 rillig 5245: 18.3. Writing builtin.mk files
1.1 dsieger 5246:
1.184 rillig 5247: Some packages in pkgsrc install headers and libraries that coincide with
5248: headers and libraries present in the base system. Aside from a buildlink3.mk
5249: file, these packages should also include a builtin.mk file that includes the
5250: necessary checks to decide whether using the built-in software or the pkgsrc
5251: software is appropriate.
1.1 dsieger 5252:
1.184 rillig 5253: The only requirements of a builtin.mk file for pkg are:
1.1 dsieger 5254:
1.184 rillig 5255: 1. It should set USE_BUILTIN.pkg to either "yes" or "no" after it is included.
1.1 dsieger 5256:
1.184 rillig 5257: 2. It should not override any USE_BUILTIN.pkg which is already set before the
5258: builtin.mk file is included.
1.1 dsieger 5259:
1.184 rillig 5260: 3. It should be written to allow multiple inclusion. This is very important
5261: and takes careful attention to Makefile coding.
1.1 dsieger 5262:
1.184 rillig 5263: 18.3.1. Anatomy of a builtin.mk file
1.1 dsieger 5264:
1.184 rillig 5265: The following is the recommended template for builtin.mk files:
1.1 dsieger 5266:
1.184 rillig 5267: .if !defined(IS_BUILTIN.foo)
5268: #
5269: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
5270: # genuinely exists in the system or not.
5271: #
5272: IS_BUILTIN.foo?= no
1.1 dsieger 5273:
1.184 rillig 5274: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
5275: # version can be determined.
5276: #
5277: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
5278: BUILTIN_PKG.foo?= foo-1.0
5279: . endif
5280: .endif # IS_BUILTIN.foo
1.1 dsieger 5281:
1.184 rillig 5282: .if !defined(USE_BUILTIN.foo)
5283: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
5284: . if defined(BUILTIN_PKG.foo)
5285: . for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
5286: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
5287: USE_BUILTIN.foo!= \
5288: ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \
5289: && ${ECHO} "yes" || ${ECHO} "no"
5290: . endif
5291: . endfor
5292: . endif
5293: .endif # USE_BUILTIN.foo
1.1 dsieger 5294:
1.184 rillig 5295: CHECK_BUILTIN.foo?= no
5296: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
5297: #
5298: # Here we place code that depends on whether USE_BUILTIN.foo is set to
5299: # "yes" or "no".
5300: #
5301: .endif # CHECK_BUILTIN.foo
1.1 dsieger 5302:
1.184 rillig 5303: The first section sets IS_BUILTIN.pkg depending on if pkg really exists in the
5304: base system. This should not be a base system software with similar
5305: functionality to pkg; it should only be "yes" if the actual package is included
5306: as part of the base system. This variable is only used internally within the
5307: builtin.mk file.
1.1 dsieger 5308:
1.184 rillig 5309: The second section sets BUILTIN_PKG.pkg to the version of pkg in the base
5310: system if it exists (if IS_BUILTIN.pkg is "yes"). This variable is only used
5311: internally within the builtin.mk file.
1.1 dsieger 5312:
1.184 rillig 5313: The third section sets USE_BUILTIN.pkg and is required in all builtin.mk files.
5314: The code in this section must make the determination whether the built-in
5315: software is adequate to satisfy the dependencies listed in
5316: BUILDLINK_API_DEPENDS.pkg. This is typically done by comparing BUILTIN_PKG.pkg
5317: against each of the dependencies in BUILDLINK_API_DEPENDS.pkg. USE_BUILTIN.pkg
5318: must be set to the correct value by the end of the builtin.mk file. Note that
5319: USE_BUILTIN.pkg may be "yes" even if IS_BUILTIN.pkg is "no" because we may make
5320: the determination that the built-in version of the software is similar enough
5321: to be used as a replacement.
1.1 dsieger 5322:
1.184 rillig 5323: The last section is guarded by CHECK_BUILTIN.pkg, and includes code that uses
5324: the value of USE_BUILTIN.pkg set in the previous section. This typically
5325: includes, e.g., adding additional dependency restrictions and listing
5326: additional files to symlink into ${BUILDLINK_DIR} (via BUILDLINK_FILES.pkg).
1.1 dsieger 5327:
1.184 rillig 5328: Chapter 19. PLIST issues
1.1 dsieger 5329:
1.184 rillig 5330: Table of Contents
1.1 dsieger 5331:
1.184 rillig 5332: 19.1. RCS ID
5333: 19.2. Semi-automatic PLIST generation
5334: 19.3. Tweaking output of make print-PLIST
5335: 19.4. Variable substitution in PLIST
5336: 19.5. Man page compression
5337: 19.6. Changing PLIST source with PLIST_SRC
5338: 19.7. Platform-specific and differing PLISTs
5339: 19.8. Build-specific PLISTs
5340: 19.9. Sharing directories between packages
1.1 dsieger 5341:
1.184 rillig 5342: The PLIST file contains a package's "packing list", i.e. a list of files that
5343: belong to the package (relative to the ${PREFIX} directory it's been installed
5344: in) plus some additional statements - see the pkg_create(1) man page for a full
5345: list. This chapter addresses some issues that need attention when dealing with
5346: the PLIST file (or files, see below!).
1.1 dsieger 5347:
1.184 rillig 5348: 19.1. RCS ID
1.1 dsieger 5349:
1.184 rillig 5350: Be sure to add a RCS ID line as the first thing in any PLIST file you write:
1.1 dsieger 5351:
1.184 rillig 5352: @comment $NetBSD $
1.1 dsieger 5353:
1.184 rillig 5354: An artificial space has been added between NetBSD and $, this is a workaround
5355: here to prevent CVS expanding to the filename of the guide. When adding the RCS
5356: ID the space should be omitted.
1.38 wiz 5357:
1.184 rillig 5358: 19.2. Semi-automatic PLIST generation
1.1 dsieger 5359:
1.184 rillig 5360: You can use the make print-PLIST command to output a PLIST that matches any new
5361: files since the package was extracted. See Section 13.17, "Other helpful
5362: targets" for more information on this target.
1.11 rillig 5363:
1.184 rillig 5364: 19.3. Tweaking output of make print-PLIST
1.1 dsieger 5365:
1.184 rillig 5366: The PRINT_PLIST_AWK variable takes a set of AWK patterns and actions that are
5367: used to filter the output of print-PLIST. You can append any chunk of AWK
5368: scripting you like to it, but be careful with quoting.
1.1 dsieger 5369:
1.184 rillig 5370: For example, to get all files inside the libdata/foo directory removed from the
5371: resulting PLIST:
1.1 dsieger 5372:
1.184 rillig 5373: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 dsieger 5374:
1.185 wiz 5375: The PRINT_PLIST_AWK transformations are evaluated after the file list and
5376: directory list are sorted. EARLY_PRINT_PLIST_AWK is like PRINT_PLIST_AWK except
5377: it operates before the file list and directory list are sorted.
5378:
1.184 rillig 5379: 19.4. Variable substitution in PLIST
1.1 dsieger 5380:
1.184 rillig 5381: A number of variables are substituted automatically in PLISTs when a package is
5382: installed on a system. This includes the following variables:
1.1 dsieger 5383:
1.184 rillig 5384: ${MACHINE_ARCH}, ${MACHINE_GNU_ARCH}
1.1 dsieger 5385:
1.184 rillig 5386: Some packages like emacs and perl embed information about which
5387: architecture they were built on into the pathnames where they install their
5388: files. To handle this case, PLIST will be preprocessed before actually
5389: used, and the symbol "${MACHINE_ARCH}" will be replaced by what uname -p
5390: gives. The same is done if the string ${MACHINE_GNU_ARCH} is embedded in
5391: PLIST somewhere - use this on packages that have GNU autoconf-created
5392: configure scripts.
1.1 dsieger 5393:
1.184 rillig 5394: Legacy note
1.1 dsieger 5395:
1.184 rillig 5396: There used to be a symbol "$ARCH" that was replaced by the output of uname
5397: -m, but that's no longer supported and has been removed.
1.1 dsieger 5398:
1.184 rillig 5399: ${OPSYS}, ${LOWER_OPSYS}, ${OS_VERSION}
1.1 dsieger 5400:
1.184 rillig 5401: Some packages want to embed the OS name and version into some paths. To do
5402: this, use these variables in the PLIST:
1.1 dsieger 5403:
1.259 leot 5404: + ${OPSYS} - output of "uname -s"
1.1 dsieger 5405:
1.259 leot 5406: + ${LOWER_OPSYS} - lowercase common name (eg. "solaris")
1.1 dsieger 5407:
1.259 leot 5408: + ${OS_VERSION} - "uname -r"
1.1 dsieger 5409:
1.184 rillig 5410: For a list of values which are replaced by default, the output of make help
5411: topic=PLIST_SUBST as well as searching the pkgsrc/mk directory with grep for
5412: PLIST_SUBST should help.
1.1 dsieger 5413:
1.184 rillig 5414: If you want to change other variables not listed above, you can add variables
5415: and their expansions to this variable in the following way, similar to
5416: MESSAGE_SUBST (see Section 12.5, "Optional files"):
1.1 dsieger 5417:
1.184 rillig 5418: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 5419:
1.184 rillig 5420: This replaces all occurrences of "${SOMEVAR}" in the PLIST with "somevalue".
1.1 dsieger 5421:
1.184 rillig 5422: The PLIST_VARS variable can be used to simplify the common case of
5423: conditionally including some PLIST entries. It can be done by adding
5424: PLIST_VARS+=foo and setting the corresponding PLIST.foo variable to yes if the
5425: entry should be included. This will substitute "${PLIST.foo}" in the PLIST with
5426: either """" or ""@comment "". For example, in Makefile:
1.1 dsieger 5427:
1.184 rillig 5428: PLIST_VARS+= foo
5429: .if condition
5430: PLIST.foo= yes
5431: .else
1.1 dsieger 5432:
1.184 rillig 5433: And then in PLIST:
1.1 dsieger 5434:
1.184 rillig 5435: @comment $NetBSD $
5436: bin/bar
5437: man/man1/bar.1
5438: ${PLIST.foo}bin/foo
5439: ${PLIST.foo}man/man1/foo.1
5440: ${PLIST.foo}share/bar/foo.data
1.1 dsieger 5441:
1.184 rillig 5442: An artificial space has been added between NetBSD and $, this is a workaround
5443: here to prevent CVS expanding to the filename of the guide. When adding the RCS
1.195 gutterid 5444: ID the space should be omitted.
1.1 dsieger 5445:
1.184 rillig 5446: 19.5. Man page compression
1.1 dsieger 5447:
1.184 rillig 5448: Man pages should be installed in compressed form if MANZ is set (in
5449: bsd.own.mk), and uncompressed otherwise. To handle this in the PLIST file, the
5450: suffix ".gz" is appended/removed automatically for man pages according to MANZ
5451: and MANCOMPRESSED being set or not, see above for details. This modification of
5452: the PLIST file is done on a copy of it, not PLIST itself.
1.100 leot 5453:
1.184 rillig 5454: 19.6. Changing PLIST source with PLIST_SRC
1.100 leot 5455:
1.184 rillig 5456: To use one or more files as source for the PLIST used in generating the binary
5457: package, set the variable PLIST_SRC to the names of that file(s). The files are
5458: later concatenated using cat(1), and the order of things is important. The
5459: default for PLIST_SRC is ${PKGDIR}/PLIST.
1.1 dsieger 5460:
1.184 rillig 5461: 19.7. Platform-specific and differing PLISTs
1.1 dsieger 5462:
1.184 rillig 5463: Some packages decide to install a different set of files based on the operating
5464: system being used. These differences can be automatically handled by using the
5465: following files:
1.1 dsieger 5466:
1.184 rillig 5467: * PLIST.common
1.1 dsieger 5468:
1.184 rillig 5469: * PLIST.${OPSYS}
1.1 dsieger 5470:
1.184 rillig 5471: * PLIST.${MACHINE_ARCH}
1.1 dsieger 5472:
1.184 rillig 5473: * PLIST.${OPSYS}-${MACHINE_ARCH}
1.1 dsieger 5474:
1.184 rillig 5475: * PLIST.common_end
1.1 dsieger 5476:
1.184 rillig 5477: 19.8. Build-specific PLISTs
1.1 dsieger 5478:
1.184 rillig 5479: Some packages decide to generate hard-to-guess file names during installation
5480: that are hard to wire down.
1.1 dsieger 5481:
1.184 rillig 5482: In such cases, you can set the GENERATE_PLIST variable to shell code terminated
5483: (with a semicolon) that will output PLIST entries which will be appended to the
5484: PLIST
1.1 dsieger 5485:
1.184 rillig 5486: You can find one example in editors/xemacs:
1.1 dsieger 5487:
1.184 rillig 5488: GENERATE_PLIST+= ${ECHO} bin/${DISTNAME}-`${WRKSRC}/src/xemacs -sd`.dmp ;
1.1 dsieger 5489:
1.184 rillig 5490: which will append something like bin/xemacs-21.4.23-54e8ea71.dmp to the PLIST.
1.1 dsieger 5491:
1.184 rillig 5492: 19.9. Sharing directories between packages
1.1 dsieger 5493:
1.184 rillig 5494: A "shared directory" is a directory where multiple (and unrelated) packages
5495: install files. These directories were problematic because you had to add
5496: special tricks in the PLIST to conditionally remove them, or have some
5497: centralized package handle them.
1.106 tnn 5498:
1.184 rillig 5499: In pkgsrc, it is now easy: Each package should create directories and install
5500: files as needed; pkg_delete will remove any directories left empty after
5501: uninstalling a package.
1.106 tnn 5502:
1.184 rillig 5503: If a package needs an empty directory to work, create the directory during
5504: installation as usual, and also add an entry to the PLIST:
1.1 dsieger 5505:
1.184 rillig 5506: @pkgdir path/to/empty/directory
1.1 dsieger 5507:
1.184 rillig 5508: or take a look at MAKE_DIRS and OWN_DIRS.
1.1 dsieger 5509:
1.184 rillig 5510: Chapter 20. The pkginstall framework
1.1 dsieger 5511:
1.184 rillig 5512: Table of Contents
1.1 dsieger 5513:
1.184 rillig 5514: 20.1. Files and directories outside the installation prefix
5515: 20.1.1. Directory manipulation
5516: 20.1.2. File manipulation
5517: 20.2. Configuration files
5518: 20.2.1. How PKG_SYSCONFDIR is set
5519: 20.2.2. Telling the software where configuration files are
1.239 dholland 5520: 20.2.3. Patching installation
5521: 20.2.4. Declaring configuration files
5522: 20.2.5. Disabling handling of configuration files
1.184 rillig 5523: 20.3. System startup scripts
5524: 20.3.1. Disabling handling of system startup scripts
5525: 20.4. System users and groups
5526: 20.5. System shells
5527: 20.5.1. Disabling shell registration
5528: 20.6. Fonts
5529: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 5530:
1.184 rillig 5531: This chapter describes the framework known as pkginstall, whose key features
5532: are:
1.1 dsieger 5533:
1.184 rillig 5534: * Generic installation and manipulation of directories and files outside the
5535: pkgsrc-handled tree, LOCALBASE.
1.1 dsieger 5536:
1.184 rillig 5537: * Automatic handling of configuration files during installation, provided
5538: that packages are correctly designed.
1.1 dsieger 5539:
1.184 rillig 5540: * Generation and installation of system startup scripts.
1.1 dsieger 5541:
1.184 rillig 5542: * Registration of system users and groups.
1.1 dsieger 5543:
1.184 rillig 5544: * Registration of system shells.
1.1 dsieger 5545:
1.184 rillig 5546: * Automatic updating of fonts databases.
1.1 dsieger 5547:
1.184 rillig 5548: The following sections inspect each of the above points in detail.
1.1 dsieger 5549:
1.184 rillig 5550: You may be thinking that many of the things described here could be easily done
5551: with simple code in the package's post-installation target (post-install). This
5552: is incorrect, as the code in them is only executed when building from source.
5553: Machines using binary packages could not benefit from it at all (as the code
5554: itself could be unavailable). Therefore, the only way to achieve any of the
5555: items described above is by means of the installation scripts, which are
5556: automatically generated by pkginstall.
1.1 dsieger 5557:
1.184 rillig 5558: 20.1. Files and directories outside the installation prefix
1.95 wiz 5559:
1.184 rillig 5560: As you already know, the PLIST file holds a list of files and directories that
5561: belong to a package. The names used in it are relative to the installation
5562: prefix (${PREFIX}), which means that it cannot register files outside this
5563: directory (absolute path names are not allowed). Despite this restriction, some
5564: packages need to install files outside this location; e.g., under ${VARBASE} or
5565: ${PKG_SYSCONFDIR}. The only way to achieve this is to create such files during
5566: installation time by using installation scripts.
1.95 wiz 5567:
1.184 rillig 5568: The generic installation scripts are shell scripts that can contain arbitrary
5569: code. The list of scripts to execute is taken from the INSTALL_FILE variable,
5570: which defaults to INSTALL. A similar variable exists for package removal
5571: (DEINSTALL_FILE, whose default is DEINSTALL). These scripts can run arbitrary
5572: commands, so they have the potential to create and manage files anywhere in the
5573: file system.
1.95 wiz 5574:
1.184 rillig 5575: Using these general installation files is not recommended, but may be needed in
5576: some special cases. One reason for avoiding them is that the user has to trust
5577: the packager that there is no unwanted or simply erroneous code included in the
5578: installation script. Also, previously there were many similar scripts for the
5579: same functionality, and fixing a common error involved finding and changing all
5580: of them.
1.95 wiz 5581:
1.184 rillig 5582: The pkginstall framework offers another, standardized way. It provides generic
5583: scripts to abstract the manipulation of such files and directories based on
5584: variables set in the package's Makefile. The rest of this section describes
5585: these variables.
1.1 dsieger 5586:
1.184 rillig 5587: 20.1.1. Directory manipulation
1.1 dsieger 5588:
1.184 rillig 5589: The following variables can be set to request the creation of directories
5590: anywhere in the file system:
1.1 dsieger 5591:
1.184 rillig 5592: * MAKE_DIRS and OWN_DIRS contain a list of directories that should be created
5593: and should attempt to be destroyed by the installation scripts. The
5594: difference between the two is that the latter prompts the administrator to
5595: remove any directories that may be left after deinstallation (because they
5596: were not empty), while the former does not. Example:
1.1 dsieger 5597:
1.184 rillig 5598: MAKE_DIRS+= ${VARBASE}/foo/private
1.1 dsieger 5599:
1.184 rillig 5600: * MAKE_DIRS_PERMS and OWN_DIRS_PERMS contain a list of tuples describing
5601: which directories should be created and should attempt to be destroyed by
5602: the installation scripts. Each tuple holds the following values, separated
5603: by spaces: the directory name, its owner, its group and its numerical mode.
5604: For example:
1.1 dsieger 5605:
1.184 rillig 5606: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private \
5607: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 5608:
1.184 rillig 5609: The difference between the two is exactly the same as their non-PERMS
5610: counterparts.
1.1 dsieger 5611:
1.184 rillig 5612: 20.1.2. File manipulation
1.1 dsieger 5613:
1.184 rillig 5614: Creating non-empty files outside the installation prefix is tricky because the
5615: PLIST forces all files to be inside it. To overcome this problem, the only
1.239 dholland 5616: solution is to extract the file in a known place (i.e., inside the installation
5617: prefix) and copy it to the appropriate location during installation (done by
5618: the installation scripts generated by pkginstall). We will call the former the
5619: reference file in the following paragraphs, which describe the variables that
5620: can be used to automatically and consistently handle files outside the
5621: installation prefix:
5622:
5623: * REQD_FILES is a list of pairs of reference and target files. At
5624: installation time, the reference file is copied to the target if and only
5625: if the latter does not exist. Upon deinstallation, the reference file is
1.184 rillig 5626: removed provided that it was not modified by the installation.
1.1 dsieger 5627:
1.239 dholland 5628: * REQD_FILES_PERMS contains tuples describing reference files and targets,
5629: including owner, group, and numeric permissions that should be set. For
5630: example:
1.1 dsieger 5631:
1.184 rillig 5632: REQD_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile \
5633: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 5634:
1.239 dholland 5635: * CONF_FILES and CONF_FILES_PERMS have the same syntax as REQD_FILES and
5636: REQD_FILES_PERMS respectively. The difference is that these variables are
5637: specifically intended for handling configuration files, for which
5638: additional conventions and constraints apply. See Section 20.2,
5639: "Configuration files" for further discussion. Note in particular that while
5640: handling of configuration files can be disabled by the user (see
5641: Section 20.2.5, "Disabling handling of configuration files"), this setting
5642: does not affect REQD_FILES and REQD_FILES_PERMS.
5643:
5644: To install an empty file, one can use these macros and /dev/null as the
5645: reference file.
1.1 dsieger 5646:
1.184 rillig 5647: 20.2. Configuration files
1.1 dsieger 5648:
1.239 dholland 5649: There are two principles that govern the handling of configuration files in
5650: pkgsrc: first, the user's configuration must not be lost or overwritten by
5651: upgrades or reinstallations; and second, the default configuration should
5652: always be available for reference. To that end, pkgsrc has a framework
5653: specifically for handling configuration files. In general, configuration files
5654: are installed into ${PREFIX}/share/examples, and copied from there to the
5655: pertinent etc directory as a separate step and only as needed.
5656:
5657: To make this work, there are three things that need to happen, any of which may
5658: require patching. First, the package must be told to read its configuration
5659: from the correct place at runtime; this place is ${PKG_SYSCONFDIR} (or possibly
5660: a subdirectory of it) which is often but not always ${PREFIX}/etc. Second, the
5661: package must be taught to install its default configuration files in ${PREFIX}/
5662: share/examples/${PKGBASE}; this is the point at which patching often becomes
5663: required because it is not the same place as the runtime location. Third, the
5664: configuration files need to be declared in the package makefile; this is the
5665: easy part.
5666:
5667: With those elements in place, the right things will happen: the package install
5668: phase and resulting binary package will not touch ${PKG_SYSCONFDIR}, and the
5669: default configuration will be copied into place by the pkgsrc framework only if
5670: not already present. Similarly, upon deinstall the configuration will not be
5671: removed if it has been modified. (This means that in the case of reinstallation
5672: and upgrades, unmodified configuration files are updated but modifications are
5673: never discarded.)
5674:
5675: The following sections describe how to make these things happen and document
5676: other relevant knobs available in the pkgsrc infrastructure.
1.1 dsieger 5677:
1.184 rillig 5678: 20.2.1. How PKG_SYSCONFDIR is set
1.1 dsieger 5679:
1.184 rillig 5680: As said before, the PKG_SYSCONFDIR variable specifies where configuration files
5681: shall be installed. Its contents are set based upon the following variables:
1.1 dsieger 5682:
1.184 rillig 5683: * PKG_SYSCONFBASE: The configuration's root directory. Defaults to ${PREFIX}/
1.239 dholland 5684: etc although it may be overridden by the user to point to their preferred
1.184 rillig 5685: location (e.g., /etc, /etc/pkg, etc.). Packages must not use it directly.
1.1 dsieger 5686:
1.184 rillig 5687: * PKG_SYSCONFSUBDIR: A subdirectory of PKG_SYSCONFBASE under which the
5688: configuration files for the package being built shall be installed. The
5689: definition of this variable only makes sense in the package's Makefile
5690: (i.e., it is not user-customizable).
1.1 dsieger 5691:
1.184 rillig 5692: As an example, consider the Apache package, www/apache24, which places its
5693: configuration files under the httpd/ subdirectory of PKG_SYSCONFBASE. This
5694: should be set in the package Makefile.
1.1 dsieger 5695:
1.184 rillig 5696: * PKG_SYSCONFVAR: Specifies the name of the variable that holds this
5697: package's configuration directory (if different from PKG_SYSCONFBASE). It
5698: defaults to PKGBASE's value, and is always prefixed with PKG_SYSCONFDIR.
1.1 dsieger 5699:
1.184 rillig 5700: * PKG_SYSCONFDIR.${PKG_SYSCONFVAR}: Holds the directory where the
5701: configuration files for the package identified by PKG_SYSCONFVAR's shall be
5702: placed.
1.1 dsieger 5703:
1.184 rillig 5704: Based on the above variables, pkginstall determines the value of
1.239 dholland 5705: PKG_SYSCONFDIR, which is the only variable that may be used within a package to
1.184 rillig 5706: refer to its configuration directory. The algorithm used to set its value is
5707: basically the following:
1.1 dsieger 5708:
1.184 rillig 5709: 1. If PKG_SYSCONFDIR.${PKG_SYSCONFVAR} is set, its value is used.
1.1 dsieger 5710:
1.184 rillig 5711: 2. If the previous variable is not defined but PKG_SYSCONFSUBDIR is set in the
5712: package's Makefile, the resulting value is ${PKG_SYSCONFBASE}/$
5713: {PKG_SYSCONFSUBDIR}.
1.1 dsieger 5714:
1.184 rillig 5715: 3. Otherwise, it is set to ${PKG_SYSCONFBASE}.
1.1 dsieger 5716:
1.184 rillig 5717: It is worth mentioning that ${PKG_SYSCONFDIR} is automatically added to
1.239 dholland 5718: OWN_DIRS. This causes it to be automatically created if needed. See
5719: Section 20.1.1, "Directory manipulation" for further details. This does not
5720: apply to subdirectories of ${PKG_SYSCONFDIR}; they must be manually created
5721: with OWN_DIRS or MAKE_DIRS.
1.1 dsieger 5722:
1.184 rillig 5723: 20.2.2. Telling the software where configuration files are
1.1 dsieger 5724:
1.184 rillig 5725: Given that pkgsrc (and users!) expect configuration files to be in a known
1.239 dholland 5726: place, you need to teach each package where to install its files. In some cases
5727: you will have to patch the package Makefiles to achieve it. If you are lucky,
5728: though, it may be as easy as passing an extra flag to the configuration script.
5729: This is the case for packages using GNU autoconf:
1.1 dsieger 5730:
1.184 rillig 5731: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.1 dsieger 5732:
1.184 rillig 5733: Note that this specifies where the package has to look for its configuration
1.239 dholland 5734: files, not where they will be installed. Fortunately, there is a different way
1.240 gutterid 5735: to specify the latter, as seen in the next section, although the combination is
5736: rather confusing at first glance.
1.1 dsieger 5737:
1.239 dholland 5738: 20.2.3. Patching installation
1.1 dsieger 5739:
1.239 dholland 5740: As discussed above, packages themselves must not touch the contents of $
1.184 rillig 5741: {PKG_SYSCONFDIR} directly. Bad news is that many software installation scripts
5742: will, out of the box, mess with the contents of that directory. So what is the
5743: correct procedure to fix this issue?
1.1 dsieger 5744:
1.184 rillig 5745: You must teach the package (usually by manually patching it) to install any
5746: configuration files under the examples hierarchy, share/examples/${PKGBASE}/.
5747: This way, the PLIST registers them and the administrator always has the
5748: original copies available.
1.1 dsieger 5749:
1.239 dholland 5750: It turns out that for packages using GNU autoconf it is possible to create the
5751: desired effect by setting sysconfdir on the make command line at install time.
5752: Consider this example taken from mail/mutt:
5753:
5754: EGDIR= ${PREFIX}/share/examples/mutt
5755: INSTALL_MAKE_FLAGS= ${MAKE_FLAGS} sysconfdir=${EGDIR}
5756:
5757: Note that the EGDIR variable, though commonly used for this purpose, is local
5758: to that package and has no meaning outside it.
1.1 dsieger 5759:
1.239 dholland 5760: 20.2.4. Declaring configuration files
1.1 dsieger 5761:
1.239 dholland 5762: Once the required configuration files are in place (i.e., under the examples
5763: hierarchy), the pkginstall framework can use them as reference copies during
5764: the package installation to update what is in ${PKG_SYSCONFDIR}. To achieve
5765: this, the variables CONF_FILES and CONF_FILES_PERMS are used. Check out
5766: Section 20.1.2, "File manipulation" for further information about their syntax
5767: and their purpose. Here is an example, taken from the mail/mutt package:
5768:
5769: EGDIR= ${PREFIX}/share/examples/mutt
5770: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
5771:
5772: Note that (as in the previous section's example) the EGDIR variable is specific
5773: to the package and has no meaning outside it.
5774:
5775: For reference, the complete example from Mutt is as follows:
5776:
5777: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
5778: EGDIR= ${PREFIX}/share/examples/mutt
5779: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
5780: INSTALLATION_DIRS+= ${EGDIR}
5781: INSTALL_MAKE_FLAGS= ${MAKE_FLAGS} sysconfdir=${EGDIR}
1.1 dsieger 5782:
1.239 dholland 5783: 20.2.5. Disabling handling of configuration files
1.1 dsieger 5784:
1.184 rillig 5785: The automatic copying of config files can be toggled by setting the environment
5786: variable PKG_CONFIG prior to package installation.
1.1 dsieger 5787:
1.184 rillig 5788: 20.3. System startup scripts
1.1 dsieger 5789:
1.184 rillig 5790: System startup scripts are special files because they must be installed in a
5791: place known by the underlying OS, usually outside the installation prefix.
5792: Therefore, the same rules described in Section 20.1, "Files and directories
5793: outside the installation prefix" apply, and the same solutions can be used.
5794: However, pkginstall provides a special mechanism to handle these files.
1.1 dsieger 5795:
1.184 rillig 5796: In order to provide system startup scripts, the package has to:
1.1 dsieger 5797:
1.184 rillig 5798: 1. Store the script inside ${FILESDIR}, with the .sh suffix appended.
1.223 nia 5799: Considering the print/cups-base package as an example, it has a cupsd.sh in
5800: its files directory.
1.95 wiz 5801:
1.184 rillig 5802: 2. Tell pkginstall to handle it, appending the name of the script, without its
5803: extension, to the RCD_SCRIPTS variable. Continuing the previous example:
1.95 wiz 5804:
1.184 rillig 5805: RCD_SCRIPTS+= cupsd
1.95 wiz 5806:
1.184 rillig 5807: Once this is done, pkginstall will do the following steps for each script in an
5808: automated fashion:
1.95 wiz 5809:
1.184 rillig 5810: 1. Process the file found in the files directory applying all the
5811: substitutions described in the FILES_SUBST variable.
1.1 dsieger 5812:
1.184 rillig 5813: 2. Copy the script from the files directory to the examples hierarchy, $
1.239 dholland 5814: {PREFIX}/share/examples/rc.d/. Note that this reference file must be
1.184 rillig 5815: explicitly registered in the PLIST.
1.1 dsieger 5816:
1.184 rillig 5817: 3. Add code to the installation scripts to copy the startup script from the
5818: examples hierarchy into the system-wide startup scripts directory.
1.1 dsieger 5819:
1.184 rillig 5820: 20.3.1. Disabling handling of system startup scripts
1.1 dsieger 5821:
1.184 rillig 5822: The automatic copying of config files can be toggled by setting the environment
5823: variable PKG_RCD_SCRIPTS prior to package installation. Note that the scripts
5824: will be always copied inside the examples hierarchy, ${PREFIX}/share/examples/
5825: rc.d/, no matter what the value of this variable is.
1.1 dsieger 5826:
1.184 rillig 5827: 20.4. System users and groups
1.1 dsieger 5828:
1.184 rillig 5829: If a package needs to create special users and/or groups during installation,
5830: it can do so by using the pkginstall framework.
1.1 dsieger 5831:
1.184 rillig 5832: Users can be created by adding entries to the PKG_USERS variable. Each entry
5833: has the following syntax:
1.1 dsieger 5834:
1.184 rillig 5835: user:group
1.1 dsieger 5836:
1.184 rillig 5837: Further specification of user details may be done by setting per-user
5838: variables. PKG_UID.user is the numeric UID for the user. PKG_GECOS.user is the
5839: user's description or comment. PKG_HOME.user is the user's home directory, and
5840: defaults to /nonexistent if not specified. PKG_SHELL.user is the user's shell,
5841: and defaults to /sbin/nologin if not specified.
1.1 dsieger 5842:
1.184 rillig 5843: Similarly, groups can be created by adding entries to the PKG_GROUPS variable,
5844: whose syntax is:
1.1 dsieger 5845:
1.184 rillig 5846: group
1.1 dsieger 5847:
1.184 rillig 5848: The numeric GID of the group may be set by defining PKG_GID.group.
1.1 dsieger 5849:
1.184 rillig 5850: If a package needs to create the users and groups at an earlier stage, then it
5851: can set USERGROUP_PHASE to either configure,build, or pre-install to indicate
5852: the phase before which the users and groups are created. In this case, the
5853: numeric UIDs and GIDs of the created users and groups are automatically
5854: hardcoded into the final installation scripts.
1.1 dsieger 5855:
1.184 rillig 5856: 20.5. System shells
1.1 dsieger 5857:
1.184 rillig 5858: Packages that install system shells should register them in the shell database,
5859: /etc/shells, to make things easier to the administrator. This must be done from
5860: the installation scripts to keep binary packages working on any system.
5861: pkginstall provides an easy way to accomplish this task.
1.1 dsieger 5862:
1.184 rillig 5863: When a package provides a shell interpreter, it has to set the PKG_SHELL
5864: variable to its absolute file name. This will add some hooks to the
5865: installation scripts to handle it. Consider the following example, taken from
5866: shells/zsh:
1.1 dsieger 5867:
1.184 rillig 5868: PKG_SHELL= ${PREFIX}/bin/zsh
1.1 dsieger 5869:
1.184 rillig 5870: 20.5.1. Disabling shell registration
1.1 dsieger 5871:
1.184 rillig 5872: The automatic registration of shell interpreters can be disabled by the
5873: administrator by setting the PKG_REGISTER_SHELLS environment variable to NO.
1.1 dsieger 5874:
1.184 rillig 5875: 20.6. Fonts
1.1 dsieger 5876:
1.184 rillig 5877: Packages that install X11 fonts should update the database files that index the
5878: fonts within each fonts directory. This can easily be accomplished within the
5879: pkginstall framework.
1.1 dsieger 5880:
1.184 rillig 5881: When a package installs X11 fonts, it must list the directories in which fonts
5882: are installed in the FONTS_DIRS.type variables, where type can be one of "ttf",
5883: "type1" or "x11". This will add hooks to the installation scripts to run the
5884: appropriate commands to update the fonts database files within each of those
5885: directories. For convenience, if the directory path is relative, it is taken to
5886: be relative to the package's installation prefix. Consider the following
5887: example, taken from fonts/dbz-ttf:
1.1 dsieger 5888:
1.184 rillig 5889: FONTS_DIRS.ttf= ${PREFIX}/share/fonts/X11/TTF
1.1 dsieger 5890:
1.184 rillig 5891: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 5892:
1.184 rillig 5893: The automatic update of fonts databases can be disabled by the administrator by
5894: setting the PKG_UPDATE_FONTS_DB environment variable to NO.
1.1 dsieger 5895:
1.154 rillig 5896: Chapter 21. Making your package work
1.1 dsieger 5897:
5898: Table of Contents
5899:
1.154 rillig 5900: 21.1. General operation
5901: 21.1.1. How to pull in user-settable variables from mk.conf
5902: 21.1.2. User interaction
5903: 21.1.3. Handling licenses
5904: 21.1.4. Restricted packages
5905: 21.1.5. Handling dependencies
5906: 21.1.6. Handling conflicts with other packages
5907: 21.1.7. Packages that cannot or should not be built
5908: 21.1.8. Packages which should not be deleted, once installed
5909: 21.1.9. Handling packages with security problems
5910: 21.1.10. How to handle incrementing versions when fixing an existing
1.259 leot 5911: package
1.154 rillig 5912: 21.1.11. Substituting variable text in the package files (the SUBST
1.259 leot 5913: framework)
1.154 rillig 5914: 21.2. The fetch phase
5915: 21.2.1. Packages whose distfiles aren't available for plain downloading
5916: 21.2.2. How to handle modified distfiles with the 'old' name
5917: 21.2.3. Packages hosted on github.com
5918: 21.3. The configure phase
5919: 21.3.1. Shared libraries - libtool
5920: 21.3.2. Using libtool on GNU packages that already support libtool
5921: 21.3.3. GNU Autoconf/Automake
1.223 nia 5922: 21.3.4. Meson / ninja
1.260 wiz 5923: 21.3.5. Determining the endianness
1.154 rillig 5924: 21.4. Programming languages
5925: 21.4.1. C, C++, and Fortran
5926: 21.4.2. Java
1.205 wiz 5927: 21.4.3. Go
1.223 nia 5928: 21.4.4. Rust
5929: 21.4.5. Packages containing Perl scripts
5930: 21.4.6. Packages containing shell scripts
5931: 21.4.7. Other programming languages
1.154 rillig 5932: 21.5. The build phase
5933: 21.5.1. Compiling C and C++ code conditionally
5934: 21.5.2. How to handle compiler bugs
1.172 rillig 5935: 21.5.3. No such file or directory
5936: 21.5.4. Undefined reference to "..."
5937: 21.5.5. Running out of memory
1.154 rillig 5938: 21.6. The install phase
5939: 21.6.1. Creating needed directories
5940: 21.6.2. Where to install documentation
5941: 21.6.3. Installing highscore files
5942: 21.6.4. Adding DESTDIR support to packages
5943: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 5944: 21.6.6. Packages installing Perl modules
1.254 wiz 5945: 21.6.7. Packages installing pkg-config files
5946: 21.6.8. Packages installing info files
5947: 21.6.9. Packages installing man pages
5948: 21.6.10. Packages installing X11 fonts
5949: 21.6.11. Packages installing SGML or XML data
5950: 21.6.12. Packages installing extensions to the MIME database
5951: 21.6.13. Packages using intltool
5952: 21.6.14. Packages installing startup scripts
5953: 21.6.15. Packages installing TeX modules
5954: 21.6.16. Packages supporting running binaries in emulation
5955: 21.6.17. Packages installing hicolor icons
5956: 21.6.18. Packages installing desktop files
1.154 rillig 5957: 21.7. Marking packages as having problems
1.1 dsieger 5958:
1.154 rillig 5959: 21.1. General operation
1.1 dsieger 5960:
5961: One appealing feature of pkgsrc is that it runs on many different platforms. As
5962: a result, it is important to ensure, where possible, that packages in pkgsrc
5963: are portable. This chapter mentions some particular details you should pay
5964: attention to while working on pkgsrc.
5965:
1.154 rillig 5966: 21.1.1. How to pull in user-settable variables from mk.conf
1.1 dsieger 5967:
5968: The pkgsrc user can configure pkgsrc by overriding several variables in the
1.4 rillig 5969: file pointed to by MAKECONF, which is mk.conf by default. When you want to use
5970: those variables in the preprocessor directives of make(1) (for example .if or
5971: .for), you need to include the file ../../mk/bsd.prefs.mk before, which in turn
5972: loads the user preferences.
1.1 dsieger 5973:
5974: But note that some variables may not be completely defined after ../../mk/
5975: bsd.prefs.mk has been included, as they may contain references to variables
1.108 rillig 5976: that are not yet defined. In shell commands (the lines in Makefile that are
5977: indented with a tab) this is no problem, since variables are only expanded when
5978: they are used. But in the preprocessor directives mentioned above and in
5979: dependency lines (of the form target: dependencies) the variables are expanded
5980: at load time.
1.1 dsieger 5981:
5982: Note
5983:
1.108 rillig 5984: To check whether a variable can be used at load time, run pkglint -Wall on your
5985: package.
1.1 dsieger 5986:
1.154 rillig 5987: 21.1.2. User interaction
1.1 dsieger 5988:
5989: Occasionally, packages require interaction from the user, and this can be in a
5990: number of ways:
5991:
5992: * When fetching the distfiles, some packages require user interaction such as
5993: entering username/password or accepting a license on a web page.
5994:
5995: * When extracting the distfiles, some packages may ask for passwords.
5996:
5997: * help to configure the package before it is built
5998:
5999: * help during the build process
6000:
6001: * help during the installation of a package
6002:
1.108 rillig 6003: A package can set the INTERACTIVE_STAGE variable to define which stages need
6004: interaction. This should be done in the package's Makefile, e.g.:
1.1 dsieger 6005:
6006: INTERACTIVE_STAGE= configure install
6007:
6008: The user can then decide to skip this package by setting the BATCH variable.
1.108 rillig 6009: Packages that require interaction are also excluded from bulk builds.
1.1 dsieger 6010:
1.154 rillig 6011: 21.1.3. Handling licenses
1.1 dsieger 6012:
6013: Authors of software can choose the licence under which software can be copied.
1.111 sevan 6014: The Free Software Foundation has declared some licenses "Free", and the Open
6015: Source Initiative has a definition of "Open Source".
6016:
6017: By default, pkgsrc allows packages with Free or Open Source licenses to be
6018: built. To allow packages with other licenses to be built as well, the pkgsrc
6019: user needs to add these licenses to the ACCEPTABLE_LICENSES variable in mk.conf
6020: . Note that this variable only affects which packages may be built, while the
6021: license terms often also restrict the actual use of the package and its
6022: redistribution.
1.1 dsieger 6023:
6024: One might want to only install packages with a BSD license, or the GPL, and not
1.20 jnemeth 6025: the other. The free licenses are added to the default ACCEPTABLE_LICENSES
1.111 sevan 6026: variable. The pkgsrc user can override the default by setting the
6027: ACCEPTABLE_LICENSES variable with "=" instead of "+=". The licenses accepted by
6028: default are defined in the DEFAULT_ACCEPTABLE_LICENSES variable in the file
6029: pkgsrc/mk/license.mk.
1.1 dsieger 6030:
6031: The license tag mechanism is intended to address copyright-related issues
6032: surrounding building, installing and using a package, and not to address
1.20 jnemeth 6033: redistribution issues (see RESTRICTED and NO_SRC_ON_FTP, etc.). Packages with
6034: redistribution restrictions should set these tags.
1.1 dsieger 6035:
6036: Denoting that a package may be copied according to a particular license is done
6037: by placing the license in pkgsrc/licenses and setting the LICENSE variable to a
6038: string identifying the license, e.g. in graphics/xv:
6039:
6040: LICENSE= xv-license
6041:
6042: When trying to build, the user will get a notice that the package is covered by
6043: a license which has not been placed in the ACCEPTABLE_LICENSES variable:
6044:
6045: % make
6046: ===> xv-3.10anb9 has an unacceptable license: xv-license.
6047: ===> To view the license, enter "/usr/bin/make show-license".
6048: ===> To indicate acceptance, add this line to your /etc/mk.conf:
6049: ===> ACCEPTABLE_LICENSES+=xv-license
6050: *** Error code 1
6051:
1.260 wiz 6052: In case a package requires multiple licenses, you can add all of them to the
6053: LICENSE variable, connected with the upper-case keyword AND. If the user has a
6054: choice between multiple licenses, you can add them connected with the
6055: upper-case keyword OR, for example:
6056:
6057: LICENSE= isc AND apache-2.0
6058: LICENSE= 2-clause-bsd OR ruby-license
6059:
1.1 dsieger 6060: The license can be viewed with make show-license, and if the user so chooses,
1.4 rillig 6061: the line printed above can be added to mk.conf to convey to pkgsrc that it
1.1 dsieger 6062: should not in the future fail because of that license:
6063:
6064: ACCEPTABLE_LICENSES+=xv-license
6065:
1.111 sevan 6066: The use of LICENSE=shareware, LICENSE=no-commercial-use, and similar language
6067: is deprecated because it does not crisply refer to a particular license text.
6068: Another problem with such usage is that it does not enable a user to tell
6069: pkgsrc to proceed for a single package without also telling pkgsrc to proceed
6070: for all packages with that tag.
6071:
1.154 rillig 6072: 21.1.3.1. Adding a package with a new license
1.1 dsieger 6073:
1.49 rodent 6074: When adding a package with a new license, the following steps are required:
6075:
1.111 sevan 6076: 1. Check whether the license qualifies as Free or Open Source by referencing
6077: Various Licenses and Comments about Them and Licenses by Name | Open Source
6078: Initiative. If this is the case, the filename in pkgsrc/licenses/ does not
6079: need the -license suffix, and the license name should be added to:
1.49 rodent 6080:
6081: + DEFAULT_ACCEPTABLE_LICENSES in pkgsrc/mk/license.mk
6082:
6083: + default_acceptable_licenses in pkgsrc/pkgtools/pkg_install/files/lib/
6084: license.c
6085:
6086: 2. The license text should be added to pkgsrc/licenses for displaying. A list
6087: of known licenses can be seen in this directory.
1.1 dsieger 6088:
1.154 rillig 6089: 21.1.3.2. Change to the license
1.1 dsieger 6090:
1.111 sevan 6091: When the license changes (in a way other than formatting), make sure that the
6092: new license has a different name (e.g., append the version number if it exists,
6093: or the date). Just because a user told pkgsrc to build programs under a
6094: previous version of a license does not mean that pkgsrc should build programs
6095: under the new licenses. The higher-level point is that pkgsrc does not evaluate
6096: licenses for reasonableness; the only test is a mechanistic test of whether a
6097: particular text has been approved by either of two bodies (FSF or OSI).
1.1 dsieger 6098:
1.154 rillig 6099: 21.1.4. Restricted packages
1.1 dsieger 6100:
1.111 sevan 6101: Some licenses restrict how software may be re-distributed. By declaring the
6102: restrictions, package tools can automatically refrain from e.g. placing binary
6103: packages on FTP sites.
6104:
6105: There are four possible restrictions, which are the cross product of sources
6106: (distfiles) and binaries not being placed on FTP sites and CD-ROMs. Because
6107: this is rarely the exact language in any license, and because non-Free licenses
6108: tend to be different from each other, pkgsrc adopts a definition of FTP and
6109: CD-ROM. "FTP" means making the source or binary file available over the
6110: Internet at no charge. "CD-ROM" means making the source or binary available on
6111: some kind of media, together with other source and binary packages, which is
6112: sold for a distribution charge.
1.1 dsieger 6113:
6114: In order to encode these restrictions, the package system defines five make
6115: variables that can be set to note these restrictions:
6116:
6117: * RESTRICTED
6118:
6119: This variable should be set whenever a restriction exists (regardless of
6120: its kind). Set this variable to a string containing the reason for the
6121: restriction. It should be understood that those wanting to understand the
6122: restriction will have to read the license, and perhaps seek advice of
6123: counsel.
6124:
6125: * NO_BIN_ON_CDROM
6126:
6127: Binaries may not be placed on CD-ROM containing other binary packages, for
6128: which a distribution charge may be made. In this case, set this variable to
6129: ${RESTRICTED}.
6130:
6131: * NO_BIN_ON_FTP
6132:
6133: Binaries may not made available on the Internet without charge. In this
6134: case, set this variable to ${RESTRICTED}. If this variable is set, binary
6135: packages will not be included on ftp.NetBSD.org.
6136:
6137: * NO_SRC_ON_CDROM
6138:
6139: Distfiles may not be placed on CD-ROM, together with other distfiles, for
6140: which a fee may be charged. In this case, set this variable to $
6141: {RESTRICTED}.
6142:
6143: * NO_SRC_ON_FTP
6144:
6145: Distfiles may not made available via FTP at no charge. In this case, set
6146: this variable to ${RESTRICTED}. If this variable is set, the distfile(s)
6147: will not be mirrored on ftp.NetBSD.org.
6148:
1.111 sevan 6149: Please note that packages will be removed from pkgsrc when the distfiles are
1.33 wiz 6150: not distributable and cannot be obtained for a period of one full quarter
1.111 sevan 6151: branch. Packages with manual/interactive fetch must have a maintainer and it is
6152: his/her responsibility to ensure this.
1.33 wiz 6153:
1.154 rillig 6154: 21.1.5. Handling dependencies
1.1 dsieger 6155:
1.175 gutterid 6156: Your package may depend on some other package being present, and there are
6157: various ways of expressing this dependency. pkgsrc supports the DEPENDS,
6158: BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS definitions, the USE_TOOLS
6159: definition, as well as dependencies via buildlink3.mk, which is the preferred
6160: way to handle dependencies, and which uses the variables named above. See
1.184 rillig 6161: Chapter 18, Buildlink methodology for more information.
1.175 gutterid 6162:
6163: The basic difference is that the DEPENDS definition registers that
6164: pre-requisite in the binary package so it will be pulled in when the binary
6165: package is later installed, whilst the BUILD_DEPENDS, TOOL_DEPENDS, and
6166: TEST_DEPENDS definitions do not, marking a dependency that is only needed for
1.184 rillig 6167: building or testing the resulting package. See also Chapter 14, Creating a new
1.175 gutterid 6168: pkgsrc package from scratch for more information.
6169:
6170: This means that if you only need a package present whilst you are building or
6171: testing, it should be noted as a TOOL_DEPENDS, BUILD_DEPENDS, or TEST_DEPENDS.
6172: When cross-compiling, TOOL_DEPENDS are native packages, i.e. packages for the
6173: architecture where the package is built; BUILD_DEPENDS are target packages,
6174: i.e., packages for the architecture for which the package is built.
1.1 dsieger 6175:
1.175 gutterid 6176: The format for a DEPENDS, BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS
6177: definition is:
1.1 dsieger 6178:
6179: <pre-req-package-name>:../../<category>/<pre-req-package>
6180:
6181: Please note that the "pre-req-package-name" may include any of the wildcard
6182: version numbers recognized by pkg_info(1).
6183:
1.55 wiz 6184: 1. If your package needs another package's binaries or libraries to build and
1.1 dsieger 6185: run, and if that package has a buildlink3.mk file available, use it:
6186:
6187: .include "../../graphics/jpeg/buildlink3.mk"
6188:
1.55 wiz 6189: 2. If your package needs another package's binaries or libraries only for
6190: building, and if that package has a buildlink3.mk file available, use it:
6191:
6192: .include "../../graphics/jpeg/buildlink3.mk"
6193:
6194: but set BUILDLINK_DEPMETHOD.jpeg?=build to make it a build dependency only.
6195: This case is rather rare.
6196:
6197: 3. If your package needs binaries from another package to build, use the
1.156 leot 6198: TOOL_DEPENDS definition:
6199:
6200: TOOL_DEPENDS+= itstool-[0-9]*:../../textproc/itstool
1.1 dsieger 6201:
1.156 leot 6202: 4. If your package needs static libraries to link against, header files to
6203: include, etc. from another package to build, use the BUILD_DEPENDS
6204: definition.
1.1 dsieger 6205:
1.156 leot 6206: 5. If your package needs a library with which to link and there is no
1.26 spz 6207: buildlink3.mk file available, create one. Using DEPENDS won't be sufficient
6208: because the include files and libraries will be hidden from the compiler.
1.1 dsieger 6209:
1.156 leot 6210: 6. If your package needs some executable to be able to run correctly and if
1.26 spz 6211: there's no buildlink3.mk file, this is specified using the DEPENDS
6212: variable. The print/lyx package needs to be able to execute the latex
1.129 wiz 6213: binary from the tex-latex-bin package when it runs, and that is specified:
1.1 dsieger 6214:
1.129 wiz 6215: DEPENDS+= tex-latex-bin-[0-9]*:../../print/tex-latex-bin
1.1 dsieger 6216:
1.175 gutterid 6217: 7. If your package includes a test suite that has extra dependencies only
6218: required for this purpose (frequently this can be run as a "make test"
6219: target), use the TEST_DEPENDS variable.
6220:
6221: 8. You can use wildcards in package dependencies. Note that such wildcard
1.26 spz 6222: dependencies are retained when creating binary packages. The dependency is
6223: checked when installing the binary package and any package which matches
6224: the pattern will be used. Wildcard dependencies should be used with care.
1.1 dsieger 6225:
6226: The "-[0-9]*" should be used instead of "-*" to avoid potentially ambiguous
6227: matches such as "tk-postgresql" matching a "tk-*" DEPENDS.
6228:
6229: Wildcards can also be used to specify that a package will only build
6230: against a certain minimum version of a pre-requisite:
6231:
1.26 spz 6232: DEPENDS+= ImageMagick>=6.0:../../graphics/ImageMagick
1.1 dsieger 6233:
1.26 spz 6234: This means that the package will build using version 6.0 of ImageMagick or
6235: newer. Such a dependency may be warranted if, for example, the command line
6236: options of an executable have changed.
6237:
1.183 wiz 6238: If you need to depend on minimum versions of libraries, set
6239: BUILDLINK_API_DEPENDS.pkg to the appropriate pattern before including its
6240: buildlink3.mk file, e.g.
6241:
6242: BUILDLINK_API_DEPENDS.jpeg+= jpeg>=9.0
6243: .include "../../graphics/jpeg/buildlink3.mk"
1.1 dsieger 6244:
6245: For security fixes, please update the package vulnerabilities file. See
1.154 rillig 6246: Section 21.1.9, "Handling packages with security problems" for more
1.1 dsieger 6247: information.
6248:
6249: If your package needs files from another package to build, add the relevant
6250: distribution files to DISTFILES, so they will be extracted automatically. See
6251: the print/ghostscript package for an example. (It relies on the jpeg sources
6252: being present in source form during the build.)
6253:
1.154 rillig 6254: 21.1.6. Handling conflicts with other packages
1.1 dsieger 6255:
1.226 gutterid 6256: Your package may conflict with other packages users might already have
6257: installed on their system, e.g., if your package installs the same set of files
1.227 wiz 6258: as another package in the pkgsrc tree.
1.1 dsieger 6259:
1.142 leot 6260: For example, x11/libXaw3d and x11/Xaw-Xpm install the same shared library, thus
6261: you set in pkgsrc/x11/libXaw3d/Makefile:
1.1 dsieger 6262:
1.142 leot 6263: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 dsieger 6264:
1.142 leot 6265: and in pkgsrc/x11/Xaw-Xpm/Makefile:
1.1 dsieger 6266:
1.142 leot 6267: CONFLICTS= libXaw3d-[0-9]*
1.1 dsieger 6268:
1.142 leot 6269: pkg_add(1) is able to detect attempts to install packages that conflict with
6270: existing packages and abort. However, in many situations this is too late in
6271: the process. Binary package managers will not know about the conflict until
6272: they attempt to install the package after already downloading it and all its
6273: dependencies. Users may also waste time building a package and its dependencies
6274: only to find out at the end that it conflicts with another package they have
6275: installed.
6276:
6277: To avoid these issues CONFLICTS entries should be added in all cases where it
6278: is known that packages conflict with each other. These CONFLICTS entries are
6279: exported in pkg_summary(5) files and consumed by binary package managers to
6280: inform users that packages cannot be installed onto the target system.
1.1 dsieger 6281:
1.154 rillig 6282: 21.1.7. Packages that cannot or should not be built
1.1 dsieger 6283:
6284: There are several reasons why a package might be instructed to not build under
6285: certain circumstances. If the package builds and runs on most platforms, the
1.83 dholland 6286: exceptions should be noted with BROKEN_ON_PLATFORM. If the package builds and
6287: runs on a small handful of platforms, set BROKEN_EXCEPT_ON_PLATFORM instead.
6288: Both BROKEN_ON_PLATFORM and BROKEN_EXCEPT_ON_PLATFORM are OS triples
6289: (OS-version-platform) that can use glob-style wildcards.
6290:
1.114 maya 6291: If a package is not appropriate for some platforms (as opposed to merely
1.83 dholland 6292: broken), a different set of variables should be used as this affects failure
6293: reporting and statistics. If the package is appropriate for most platforms, the
6294: exceptions should be noted with NOT_FOR_PLATFORM. If the package is appropriate
6295: for only a small handful of platforms (often exactly one), set
6296: ONLY_FOR_PLATFORM instead. Both ONLY_FOR_PLATFORM and NOT_FOR_PLATFORM are OS
6297: triples (OS-version-platform) that can use glob-style wildcards.
1.1 dsieger 6298:
6299: Some packages are tightly bound to a specific version of an operating system,
6300: e.g. LKMs or sysutils/lsof. Such binary packages are not backwards compatible
6301: with other versions of the OS, and should be uploaded to a version specific
6302: directory on the FTP server. Mark these packages by setting OSVERSION_SPECIFIC
6303: to "yes". This variable is not currently used by any of the package system
6304: internals, but may be used in the future.
6305:
6306: If the package should be skipped (for example, because it provides
6307: functionality already provided by the system), set PKG_SKIP_REASON to a
6308: descriptive message. If the package should fail because some preconditions are
6309: not met, set PKG_FAIL_REASON to a descriptive message.
6310:
1.154 rillig 6311: 21.1.8. Packages which should not be deleted, once installed
1.1 dsieger 6312:
6313: To ensure that a package may not be deleted, once it has been installed, the
6314: PKG_PRESERVE definition should be set in the package Makefile. This will be
1.25 wiz 6315: carried into any binary package that is made from this pkgsrc entry. A "
6316: preserved" package will not be deleted using pkg_delete(1) unless the "-f"
1.1 dsieger 6317: option is used.
6318:
1.154 rillig 6319: 21.1.9. Handling packages with security problems
1.1 dsieger 6320:
1.247 wiz 6321: When a vulnerability is found, this should be noted in pkgsrc/doc/
6322: pkg-vulnerabilities. Entries in that file consist of three parts:
1.205 wiz 6323:
6324: * package version pattern
6325:
6326: * type of vulnerability (please cut'n'paste an existing one where possible)
6327:
6328: * URL providing additional information about the issue
6329:
6330: For the package version pattern please always use `<' to mark an upper bound
6331: (not `<='!). This will avoid possible problems due unrelated PKGREVISION bumps
6332: not related to security fixes. Lower bounds can be added too, using '>' or '>=
1.206 wiz 6333: '. For example, "foo>=1<1.2" would mark versions 1.0 (included) to 1.2
1.205 wiz 6334: (excluded) of "foo" as affected by the security issue.
6335:
6336: Entries should always be added at the bottom of the file.
6337:
6338: When fixing packages, please modify the upper bound of the corresponding entry.
6339: To continue the previous example, if a fix was backported to version 1.1nb2,
1.206 wiz 6340: change the previous pattern to "foo>=1<1.1nb2".
1.205 wiz 6341:
6342: To locally test a package version pattern against a PKGNAME you can use the
6343: pkg_admin pmatch command.
6344:
6345: The URL should be as permanent as possible and provide as much information
6346: about the issue as possible. CVE entries are preferred.
6347:
6348: After committing that file, ask pkgsrc-security@NetBSD.org to update the file
6349: on ftp.NetBSD.org.
1.1 dsieger 6350:
6351: After fixing the vulnerability by a patch, its PKGREVISION should be increased
6352: (this is of course not necessary if the problem is fixed by using a newer
1.32 wiz 6353: release of the software), and the pattern in the pkg-vulnerabilities file must
6354: be updated.
1.1 dsieger 6355:
6356: Also, if the fix should be applied to the stable pkgsrc branch, be sure to
6357: submit a pullup request!
6358:
6359: Binary packages already on ftp.NetBSD.org will be handled semi-automatically by
6360: a weekly cron job.
6361:
1.205 wiz 6362: In case a security issue is disputed, please contact
6363: pkgsrc-security@NetBSD.org.
6364:
1.154 rillig 6365: 21.1.10. How to handle incrementing versions when fixing an existing package
1.1 dsieger 6366:
6367: When making fixes to an existing package it can be useful to change the version
6368: number in PKGNAME. To avoid conflicting with future versions by the original
6369: author, a "nb1", "nb2", ... suffix can be used on package versions by setting
6370: PKGREVISION=1 (2, ...). The "nb" is treated like a "." by the package tools.
6371: e.g.
6372:
6373: DISTNAME= foo-17.42
6374: PKGREVISION= 9
6375:
6376: will result in a PKGNAME of "foo-17.42nb9". If you want to use the original
6377: value of PKGNAME without the "nbX" suffix, e.g. for setting DIST_SUBDIR, use
6378: PKGNAME_NOREV.
6379:
6380: When a new release of the package is released, the PKGREVISION should be
6381: removed, e.g. on a new minor release of the above package, things should be
6382: like:
6383:
6384: DISTNAME= foo-17.43
6385:
6386: PKGREVISION should be incremented for any non-trivial change in the resulting
6387: binary package. Without a PKGREVISION bump, someone with the previous version
6388: installed has no way of knowing that their package is out of date. Thus,
6389: changes without increasing PKGREVISION are essentially labeled "this is so
6390: trivial that no reasonable person would want to upgrade", and this is the rough
6391: test for when increasing PKGREVISION is appropriate. Examples of changes that
6392: do not merit increasing PKGREVISION are:
6393:
1.14 jmcneill 6394: * Changing HOMEPAGE, MAINTAINER, OWNER, or comments in Makefile.
1.1 dsieger 6395:
6396: * Changing build variables if the resulting binary package is the same.
6397:
6398: * Changing DESCR.
6399:
6400: * Adding PKG_OPTIONS if the default options don't change.
6401:
6402: Examples of changes that do merit an increase to PKGREVISION include:
6403:
6404: * Security fixes
6405:
6406: * Changes or additions to a patch file
6407:
6408: * Changes to the PLIST
6409:
1.12 weinem 6410: * A dependency is changed or renamed.
6411:
1.1 dsieger 6412: PKGREVISION must also be incremented when dependencies have ABI changes.
6413:
1.154 rillig 6414: 21.1.11. Substituting variable text in the package files (the SUBST framework)
1.1 dsieger 6415:
1.180 rillig 6416: When you want to replace the same text in multiple files, or multiple times in
6417: the same file, it is cumbersome to maintain a patch file for this. This is
6418: where the SUBST framework steps in. It provides an easy-to-use interface for
6419: replacing text in files. It just needs the following information:
1.172 rillig 6420:
1.180 rillig 6421: * In which phase of the package build cycle should the replacement happen?
1.172 rillig 6422:
1.180 rillig 6423: * In which files should the replacement happen?
1.172 rillig 6424:
6425: * Which text should be replaced with what?
6426:
1.180 rillig 6427: This information is encoded in a block of SUBST variables. A minimal example
6428: is:
6429:
6430: SUBST_CLASSES+= paths
6431: SUBST_STAGE.paths= pre-configure
6432: SUBST_FILES.paths= src/*.c
6433: SUBST_SED.paths= -e 's,/usr/local,${PREFIX},g'
6434:
6435: Translated into English, it means: In the pre-configure stage (that is, after
6436: applying the patches from the patches/ directory and before running the
6437: configure script and the portability check), replace the text /usr/local with
6438: the content of the variable PREFIX.
6439:
6440: Each SUBST block starts by appending an identifier to SUBST_CLASSES (note the +
6441: =). This identifier can be chosen freely by the package. If there should ever
6442: be duplicate identifiers, the pkgsrc infrastructure will catch this and fail
6443: early, so don't worry about name collisions.
6444:
6445: Except for SUBST_CLASSES, all variables in a SUBST block are parameterized
6446: using this identifier. In the remainder of this section, these parameterized
6447: variables are written as SUBST_STAGE.*.
6448:
6449: SUBST_CLASSES+= paths
6450: SUBST_STAGE.paths= pre-configure
6451: SUBST_MESSAGE.paths= Fixing absolute paths.
6452: SUBST_FILES.paths= src/*.c
6453: SUBST_FILES.paths+= scripts/*.sh
6454: SUBST_SED.paths= -e 's,"/usr/local,"${PREFIX},g'
6455: SUBST_SED.paths+= -e 's,"/var/log,"${VARBASE}/log,g'
6456: SUBST_VARS.paths= LOCALBASE PREFIX PKGVERSION
6457:
6458: To get a complete picture about the SUBST substitutions, run bmake
6459: show-all-subst. If something doesn't work as expected, run pkglint on the
6460: package, which detects several typical mistakes surrounding the SUBST blocks.
6461: For any questions that might remain after this, have a look at mk/subst.mk.
6462:
6463: 21.1.11.1. Choosing the time where the substitutions happen
6464:
6465: The SUBST_STAGE.* is one of {pre,do,post}-
6466: {extract,patch,configure,build,test,install}. Of these, pre-configure is used
6467: most often, by far. The most popular stages are, in chronological order:
6468:
6469: post-extract
6470:
6471: The substitutions are applied immediately after the distfiles are
6472: extracted. Running bmake extract on the package will leave no traces of the
6473: original files.
6474:
6475: When the substitution applies to files for which there is also a patch in
6476: the patches/ directory, this means that the patches will be computed based
6477: on the result of the substitution. When these patches are sent to the
6478: upstream maintainer later, to be fixed in the upstream package, these
6479: patches may no longer match what the upstream author is used to. Because of
6480: this, pre-configure is often a better choice.
6481:
6482: pre-configure
6483:
6484: The substitutions are applied after the patches from the patches/
6485: directory. This makes it possible to run bmake patch on the package, after
6486: which the patches can be edited using the tools pkgvi and mkpatches from
6487: the pkgtools/pkgdiff package.
6488:
6489: When updating the patches, it is helpful to explicitly separate the bmake
6490: patch from the bmake configure, and to only edit the patches between these
6491: commands. Otherwise the substitutions from the SUBST block will end up in
6492: the patch file. When this happens in really obvious ways, pkglint will
6493: complain about patches that contain a hard-coded /usr/pkg instead of the
6494: correct and intended @PREFIX@, but it can only detect these really obvious
6495: cases.
6496:
6497: do-configure
6498:
6499: This stage should only be used if the package defines a pre-configure
6500: action itself, and the substitution must happen after that. Typical
6501: examples are packages that use the pre-configure stage to regenerate the
6502: GNU configure script from configure.ac.
6503:
6504: post-configure
6505:
6506: This stage is used to fix up any mistakes by the configure stage.
6507:
6508: pre-build
6509:
6510: This stage should only be used for substitutions that are clearly related
6511: to building the package, not for fixing the configuration. Substitutions
6512: for pathnames (such as replacing /usr/local with ${PREFIX}) or user names
6513: (such as replacing @MY_USER@ with the actual username) belong in
6514: pre-configure or post-configure instead.
6515:
6516: post-build
6517:
6518: Just as with pre-build, this stage should only be used for substitutions
6519: that are clearly related to building the package, not for fixing the
6520: configuration. Substitutions for pathnames (such as replacing /usr/local
6521: with ${PREFIX}) or user names (such as replacing @MY_USER@ with the actual
6522: username) belong in pre-configure or post-configure instead.
6523:
6524: A typical use is to update pkg-config files to include the rpath compiler
6525: options.
6526:
6527: pre-install
6528:
6529: In general, the install phase should be as simple as possible. As with the
6530: pre-build and post-build stages, it should not be used to fix pathnames or
6531: user names, these belong in pre-configure instead. There are only few
6532: legitimate use cases for applying substitutions in this stage.
6533:
1.181 rillig 6534: 21.1.11.2. Choosing the files where the substitutions happen
1.180 rillig 6535:
6536: The SUBST_FILES.* variable contains a list of filename patterns. These patterns
6537: are relative to WRKSRC since that is where most substitutions happen. A typical
6538: example is:
6539:
6540: SUBST_FILES.path= Makefile */Makefile */*/Makefile *.[ch]
6541:
6542: The above patterns, especially the last, are quite broad. The SUBST
6543: implementation checks that each filename pattern that is mentioned here has an
6544: effect. For example, if none of the */*/Makefile files contains the patterns to
6545: be found and substituted, that filename pattern is redundant and should be left
1.181 rillig 6546: out. By default, the SUBST framework will complain with an error message. If
6547: the text to be substituted occurs in some of the files from a single pattern,
6548: but not in all of them, that is totally ok, and the SUBST framework will only
6549: print an INFO message for those files.
1.180 rillig 6550:
6551: If there is a good reason for having redundant filename patterns, set
1.181 rillig 6552: SUBST_NOOP_OK.* to yes.
1.180 rillig 6553:
6554: Another popular way of choosing the files for the substitutions is via a shell
6555: command, like this:
6556:
1.181 rillig 6557: C_FILES_CMD= cd ${WRKSRC} && ${FIND} . -name '*.c'
1.180 rillig 6558: SUBST_FILES.path= ${C_FILES_CMD:sh}
6559:
6560: The variable name C_FILES_CMD in this example is freely chosen and independent
6561: of the SUBST framework.
6562:
6563: In this variant, the SUBST_FILES.* variable lists each file individually.
6564: Thereby chances are higher that there are filename patterns in which no
6565: substitution happens. Since the SUBST framework cannot know whether the
6566: filename patterns in SUBST_FILES.* have been explicitly listed in the Makefile
6567: (where any redundant filename pattern would be suspicious) or been generated by
6568: a shell command (in which redundant filename patterns are more likely and to be
6569: expected), it will complain about these redundant filename patterns. Therefore,
6570: SUBST blocks that use a shell command to generate the list of filename patterns
6571: often need to set SUBST_NOOP_OK.* to yes.
6572:
6573: 21.1.11.3. Choosing what to substitute
6574:
6575: In most cases, the substitutions are given using one or more sed(1) commands,
6576: like this:
6577:
6578: SUBST_SED.path= -e 's|/usr/local|${PREFIX}|g'
6579:
6580: Each of the sed commands needs to be preceded by the -e option and should be
6581: specified on a line of its own, to avoid hiding short sed commands at the end
6582: of a line.
6583:
6584: Since the sed commands often contain shell metacharacters as the separator (the
6585: | in the above example), it is common to enclose them in single quotes.
6586:
6587: A common substitution is to replace placeholders of the form @VARNAME@ with
6588: their pkgsrc counterpart variable ${VARNAME}. A typical example is:
6589:
6590: SUBST_VARS.path= PREFIX
6591:
1.181 rillig 6592: This type of substitutions is typically done by the GNU configure scripts
6593: during the do-configure stage, but in some cases these need to be overridden.
6594: The same pattern is also used when a package defines patches that replace
6595: previously hard-coded paths like /usr/local with a @PREFIX@ placeholder first,
6596: which then gets substituted by the actual ${PREFIX} in the pre-configure stage.
6597: In many of these cases, it works equally well to just use the SUBST framework
6598: to directly replace /usr/local with ${PREFIX}, thereby omitting the
6599: intermediate patch file.
1.180 rillig 6600:
6601: If the above is not flexible enough, it is possible to not use sed at all for
6602: the substitution but to specify an entirely different command, like this:
6603:
6604: SUBST_FILTER_CMD.path= LC_ALL=C ${TR} -d '\r'
1.1 dsieger 6605:
1.180 rillig 6606: This is used for the few remaining packages in which the distributed files use
6607: Windows-style line endings that need to be converted to UNIX-style line
6608: endings.
1.1 dsieger 6609:
1.180 rillig 6610: 21.1.11.4. Other SUBST variables
1.172 rillig 6611:
1.180 rillig 6612: When a SUBST block is applied during a package build, a message is logged. The
6613: default message is fine for most purposes but can be overridden by setting
6614: SUBST_MESSAGE.* to an individual message.
1.1 dsieger 6615:
1.154 rillig 6616: 21.2. The fetch phase
1.1 dsieger 6617:
1.154 rillig 6618: 21.2.1. Packages whose distfiles aren't available for plain downloading
1.1 dsieger 6619:
6620: If you need to download from a dynamic URL you can set DYNAMIC_MASTER_SITES and
6621: a make fetch will call files/getsite.sh with the name of each file to download
6622: as an argument, expecting it to output the URL of the directory from which to
6623: download it. graphics/ns-cult3d is an example of this usage.
6624:
6625: If the download can't be automated, because the user must submit personal
6626: information to apply for a password, or must pay for the source, or whatever,
6627: you can set FETCH_MESSAGE to a list of lines that are displayed to the user
6628: before aborting the build. Example:
6629:
6630: FETCH_MESSAGE= "Please download the files"
6631: FETCH_MESSAGE+= " "${DISTFILES:Q}
6632: FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"."
6633:
1.154 rillig 6634: 21.2.2. How to handle modified distfiles with the 'old' name
1.1 dsieger 6635:
6636: Sometimes authors of a software package make some modifications after the
6637: software was released, and they put up a new distfile without changing the
6638: package's version number. If a package is already in pkgsrc at that time, the
6639: checksum will no longer match. The contents of the new distfile should be
6640: compared against the old one before changing anything, to make sure the
6641: distfile was really updated on purpose, and that no trojan horse or so crept
6642: in. Please mention that the distfiles were compared and what was found in your
1.54 rodent 6643: commit message.
6644:
6645: Then, the correct way to work around this is to set DIST_SUBDIR to a unique
1.109 wiz 6646: directory name, usually based on PKGNAME_NOREV (but take care with python or
6647: ruby packages, where PKGNAME includes a variable prefix). All DISTFILES and
6648: PATCHFILES for this package will be put in that subdirectory of the local
1.154 rillig 6649: distfiles directory. (See Section 21.1.10, "How to handle incrementing versions
1.109 wiz 6650: when fixing an existing package" for more details.) In case this happens more
6651: often, PKGNAME can be used (thus including the nbX suffix) or a date stamp can
6652: be appended, like ${PKGNAME_NOREV}-YYYYMMDD.
1.54 rodent 6653:
6654: DIST_SUBDIR is also used when a distfile's name does not contain a version and
6655: the distfile is apt to change. In cases where the likelihood of this is very
6656: small, DIST_SUBDIR might not be required. Additionally, DIST_SUBDIR must not be
6657: removed unless the distfile name changes, even if a package is being moved or
6658: renamed.
6659:
6660: Do not forget regenerating the distinfo file after that, since it contains the
6661: DIST_SUBDIR path in the filenames. Also, increase the PKGREVISION if the
6662: installed package is different. Furthermore, a mail to the package's authors
6663: seems appropriate telling them that changing distfiles after releases without
6664: changing the file names is not good practice.
1.1 dsieger 6665:
1.154 rillig 6666: 21.2.3. Packages hosted on github.com
1.88 tnn 6667:
1.90 tnn 6668: Helper methods exist for packages hosted on github.com which will often have
6669: distfile names that clash with other packages, for example 1.0.tar.gz. Use one
6670: of the three recipes from below:
1.88 tnn 6671:
1.154 rillig 6672: 21.2.3.1. Fetch based on a tagged release
1.88 tnn 6673:
1.189 bacon 6674: If your distfile URL looks similar to https://github.com/username/example/
6675: archive/v1.0.zip, then you are packaging a tagged release.
1.88 tnn 6676:
1.189 bacon 6677: DISTNAME= example-1.0
1.90 tnn 6678: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
1.189 bacon 6679: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
1.90 tnn 6680: GITHUB_TAG= v${PKGVERSION_NOREV}
1.88 tnn 6681: EXTRACT_SUFX= .zip
6682:
1.230 gutterid 6683: Here, DISTNAME combined with use of GITHUB_TAG leads the file fetching
6684: infrastructure to save the resulting file locally as example-1.0.zip.
6685:
1.189 bacon 6686: 21.2.3.2. Fetch based on a specific commit before the first release
6687:
6688: If your distfile looks similar to https://github.com/username/example/archive/
6689: 988881adc9fc3655077dc2d4d757d480b5ea0e11 and is from a commit before the first
6690: release, then set the package version to 0.0.0.N, where N is the number of
6691: commits to the repository, and set GITHUB_TAG to the commit hash. This will
6692: (almost) ensure that the first tagged release will have a version greater than
6693: this one so that package upgrades will function properly.
6694:
6695: DISTNAME= example-0.0.0.347
6696: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6697: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
6698: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
6699:
6700: 21.2.3.3. Fetch based on a specific commit after a release
1.88 tnn 6701:
1.189 bacon 6702: If your distfile looks similar to https://github.com/username/example/archive/
6703: 988881adc9fc3655077dc2d4d757d480b5ea0e11 and is from a commit after a release,
6704: then include the last release version and the commit count since that release
6705: in the package version and set GITHUB_TAG to the commit hash. The latest
6706: release and commit count are shown in the output of "git describe --tags":
6707:
6708: # git clone https://github.com/username/example
6709: # cd example
6710: # git describe --tags
6711: 1.2.3-5-g988881a
1.88 tnn 6712:
1.189 bacon 6713: DISTNAME= example-1.2.3.5
6714: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6715: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
1.90 tnn 6716: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
1.88 tnn 6717:
1.189 bacon 6718: 21.2.3.4. Fetch based on release
1.88 tnn 6719:
1.189 bacon 6720: If your distfile URL looks similar to https://github.com/username/example/
6721: releases/download/rel-1.6/offensive-1.6.zip, then you are packaging a release.
1.88 tnn 6722:
1.90 tnn 6723: DISTNAME= offensive-1.6
1.88 tnn 6724: PKGNAME= ${DISTNAME:S/offensive/proper/}
1.90 tnn 6725: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
1.189 bacon 6726: GITHUB_PROJECT= example
1.90 tnn 6727: GITHUB_RELEASE= rel-${PKGVERSION_NOREV} # usually just set this to ${DISTNAME}
6728: EXTRACT_SUFX= .zip
1.88 tnn 6729:
1.154 rillig 6730: 21.3. The configure phase
1.1 dsieger 6731:
1.154 rillig 6732: 21.3.1. Shared libraries - libtool
1.1 dsieger 6733:
6734: pkgsrc supports many different machines, with different object formats like
6735: a.out and ELF, and varying abilities to do shared library and dynamic loading
6736: at all. To accompany this, varying commands and options have to be passed to
6737: the compiler, linker, etc. to get the Right Thing, which can be pretty annoying
6738: especially if you don't have all the machines at your hand to test things. The
6739: devel/libtool pkg can help here, as it just "knows" how to build both static
6740: and dynamic libraries from a set of source files, thus being
6741: platform-independent.
6742:
6743: Here's how to use libtool in a package in seven simple steps:
6744:
6745: 1. Add USE_LIBTOOL=yes to the package Makefile.
6746:
6747: 2. For library objects, use "${LIBTOOL} --mode=compile ${CC}" in place of "$
6748: {CC}". You could even add it to the definition of CC, if only libraries are
6749: being built in a given Makefile. This one command will build both PIC and
6750: non-PIC library objects, so you need not have separate shared and
6751: non-shared library rules.
6752:
6753: 3. For the linking of the library, remove any "ar", "ranlib", and "ld
6754: -Bshareable" commands, and instead use:
6755:
6756: ${LIBTOOL} --mode=link \
6757: ${CC} -o ${.TARGET:.a=.la} \
6758: ${OBJS:.o=.lo} \
6759: -rpath ${PREFIX}/lib \
6760: -version-info major:minor
6761:
6762: Note that the library is changed to have a .la extension, and the objects
6763: are changed to have a .lo extension. Change OBJS as necessary. This
6764: automatically creates all of the .a, .so.major.minor, and ELF symlinks (if
6765: necessary) in the build directory. Be sure to include "-version-info",
6766: especially when major and minor are zero, as libtool will otherwise strip
6767: off the shared library version.
6768:
6769: From the libtool manual:
6770:
6771: So, libtool library versions are described by three integers:
6772:
6773: CURRENT
6774: The most recent interface number that this library implements.
6775:
6776: REVISION
6777: The implementation number of the CURRENT interface.
6778:
6779: AGE
6780: The difference between the newest and oldest interfaces that
6781: this library implements. In other words, the library implements
6782: all the interface numbers in the range from number `CURRENT -
6783: AGE' to `CURRENT'.
6784:
6785: If two libraries have identical CURRENT and AGE numbers, then the
6786: dynamic linker chooses the library with the greater REVISION number.
6787:
6788: The "-release" option will produce different results for a.out and ELF
1.25 wiz 6789: (excluding symlinks) in only one case. An ELF library of the form "
6790: libfoo-release.so.x.y" will have a symlink of "libfoo.so.x.y" on an a.out
1.1 dsieger 6791: platform. This is handled automatically.
6792:
6793: The "-rpath argument" is the install directory of the library being built.
6794:
6795: In the PLIST, include only the .la file, the other files will be added
6796: automatically.
6797:
6798: 4. When linking shared object (.so) files, i.e. files that are loaded via
6799: dlopen(3), NOT shared libraries, use "-module -avoid-version" to prevent
6800: them getting version tacked on.
6801:
6802: The PLIST file gets the foo.so entry.
6803:
6804: 5. When linking programs that depend on these libraries before they are
6805: installed, preface the cc(1) or ld(1) line with "${LIBTOOL} --mode=link",
6806: and it will find the correct libraries (static or shared), but please be
6807: aware that libtool will not allow you to specify a relative path in -L
6808: (such as "-L../somelib"), because it expects you to change that argument to
6809: be the .la file. e.g.
6810:
6811: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
6812:
6813: should be changed to:
6814:
6815: ${LIBTOOL} --mode=link ${CC} -o someprog ../somelib/somelib.la
6816:
6817: and it will do the right thing with the libraries.
6818:
6819: 6. When installing libraries, preface the install(1) or cp(1) command with "$
6820: {LIBTOOL} --mode=install", and change the library name to .la. e.g.
6821:
1.23 jakllsch 6822: ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 dsieger 6823:
6824: This will install the static .a, shared library, any needed symlinks, and
6825: run ldconfig(8).
6826:
6827: 7. In your PLIST, include only the .la file (this is a change from previous
6828: behaviour).
6829:
1.154 rillig 6830: 21.3.2. Using libtool on GNU packages that already support libtool
1.1 dsieger 6831:
6832: Add USE_LIBTOOL=yes to the package Makefile. This will override the package's
6833: own libtool in most cases. For older libtool using packages, libtool is made by
6834: ltconfig script during the do-configure step; you can check the libtool script
6835: location by doing make configure; find work*/ -name libtool.
6836:
6837: LIBTOOL_OVERRIDE specifies which libtool scripts, relative to WRKSRC, to
6838: override. By default, it is set to "libtool */libtool */*/libtool". If this
6839: does not match the location of the package's libtool script(s), set it as
6840: appropriate.
6841:
6842: If you do not need *.a static libraries built and installed, then use
6843: SHLIBTOOL_OVERRIDE instead.
6844:
6845: If your package makes use of the platform-independent library for loading
6846: dynamic shared objects, that comes with libtool (libltdl), you should include
6847: devel/libltdl/buildlink3.mk.
6848:
6849: Some packages use libtool incorrectly so that the package may not work or build
6850: in some circumstances. Some of the more common errors are:
6851:
6852: * The inclusion of a shared object (-module) as a dependent library in an
6853: executable or library. This in itself isn't a problem if one of two things
6854: has been done:
6855:
6856: 1. The shared object is named correctly, i.e. libfoo.la, not foo.la
6857:
6858: 2. The -dlopen option is used when linking an executable.
6859:
6860: * The use of libltdl without the correct calls to initialisation routines.
6861: The function lt_dlinit() should be called and the macro
6862: LTDL_SET_PRELOADED_SYMBOLS included in executables.
6863:
1.154 rillig 6864: 21.3.3. GNU Autoconf/Automake
1.1 dsieger 6865:
6866: If a package needs GNU autoconf or automake to be executed to regenerate the
1.223 nia 6867: configure script and Makefile.in makefile templates from configure.ac and
6868: Makefile.am, then they should be executed in a pre-configure target:
1.1 dsieger 6869:
1.223 nia 6870: USE_TOOLS+= autoconf automake autoreconf
6871: GNU_CONFIGURE= yes
1.1 dsieger 6872: ...
6873:
6874: pre-configure:
1.223 nia 6875: set -e; cd ${WRKSRC} && autoreconf -fi
1.1 dsieger 6876: ...
6877:
1.223 nia 6878: Packages which use GNU Automake will sometimes require GNU Make (gmake in
6879: USE_TOOLS), but not always. Note that autoreconf only needs to be executed if
6880: configure.ac or Makefiles are modified, or configure is not present.
1.1 dsieger 6881:
6882: There are times when the configure process makes additional changes to the
6883: generated files, which then causes the build process to try to re-execute the
6884: automake sequence. This is prevented by touching various files in the configure
6885: stage. If this causes problems with your package you can set AUTOMAKE_OVERRIDE=
6886: NO in the package Makefile.
6887:
1.223 nia 6888: 21.3.4. Meson / ninja
6889:
6890: Packages using Meson to configure need to include:
6891:
6892: .include "../../devel/meson/build.mk"
6893:
6894: In nearly all cases (any program with dependencies), pkg-config needs to be
6895: added to USE_TOOLS. If the package installs translation files for non-English
6896: languages, also add msgfmt and xgettext:
6897:
6898: USE_TOOLS+= pkg-config msgfmt xgettext
6899:
6900: If any options need to be passed to Meson, use MESON_ARGS instead of
6901: CONFIGURE_ARGS:
6902:
6903: MESON_ARGS+= -Dx11=false
6904:
1.260 wiz 6905: 21.3.5. Determining the endianness
6906:
6907: To determine the endianness of the target platform, have a look at mk/
6908: endian.mk.
6909:
1.154 rillig 6910: 21.4. Programming languages
1.1 dsieger 6911:
1.154 rillig 6912: 21.4.1. C, C++, and Fortran
1.1 dsieger 6913:
1.244 gutterid 6914: Compilers for the C and C++ languages come with the NetBSD base system. By
1.223 nia 6915: default, pkgsrc assumes that a package is written in C and will hide all other
6916: compilers (via the wrapper framework, see Chapter 18, Buildlink methodology).
1.1 dsieger 6917:
1.243 gutterid 6918: To declare which languages should be made available through pkgsrc's compiler
6919: wrappers, use the USE_LANGUAGES variable. Allowed values currently are:
1.212 wiz 6920:
1.244 gutterid 6921: c, c++, fortran, fortran77, java, objc, obj-c++, and ada.
1.212 wiz 6922:
6923: (and any combination). The default is "c". Packages using GNU configure
6924: scripts, even if written in C++, usually need a C compiler for the configure
1.244 gutterid 6925: phase.
1.243 gutterid 6926:
1.250 jnemeth 6927: To declare which features a package requires from the compiler, set either
1.243 gutterid 6928: USE_CC_FEATURES or USE_CXX_FEATURES. Allowed values for USE_CC_FEATURES are
6929: currently:
6930:
6931: c11, c99, has_include
6932:
6933: Allowed values for USE_CXX_FEATURES are currently:
6934:
6935: c++11, c++14, c++17, c++20, has_include, regex, filesystem,
6936: charconv, parallelism_ts, unique_ptr, put_time,
6937: is_trivially_copy_constructible
1.1 dsieger 6938:
1.251 gutterid 6939: Note at present these variables only affect use of GCC, not other compilers.
6940:
1.244 gutterid 6941: Language variants like gnu99 and c++11 can be specified in FORCE_C_STD and
6942: FORCE_CXX_STD if the package does not explicitly set -std=... when compiling
6943: (i.e. the package assumes the compiler defaults to C++11 or some other
6944: standard). This is a common bug in upstream build systems.
6945:
6946: Allowed values for FORCE_C_STD are currently:
6947:
6948: c90, c99, c11, gnu90, gnu99, gnu11
6949:
6950: Allowed values for FORCE_CXX_STD are currently:
6951:
6952: c++03, c++11, c++14, c++17, c++20,
6953: gnu++03, gnu++11, gnu++14, gnu++17, gnu++20
6954:
1.251 gutterid 6955: Note at present these variables only affect use of GCC and Clang.
6956:
1.154 rillig 6957: 21.4.2. Java
1.1 dsieger 6958:
6959: If a program is written in Java, use the Java framework in pkgsrc. The package
6960: must include ../../mk/java-vm.mk. This Makefile fragment provides the following
6961: variables:
6962:
6963: * USE_JAVA defines if a build dependency on the JDK is added. If USE_JAVA is
6964: set to "run", then there is only a runtime dependency on the JDK. The
6965: default is "yes", which also adds a build dependency on the JDK.
6966:
6967: * Set USE_JAVA2 to declare that a package needs a Java2 implementation. The
6968: supported values are "yes", "1.4", and "1.5". "yes" accepts any Java2
6969: implementation, "1.4" insists on versions 1.4 or above, and "1.5" only
6970: accepts versions 1.5 or above. This variable is not set by default.
6971:
1.25 wiz 6972: * PKG_JAVA_HOME is automatically set to the runtime location of the used Java
6973: implementation dependency. It may be used to set JAVA_HOME to a good value
6974: if the program needs this variable to be defined.
6975:
1.205 wiz 6976: 21.4.3. Go
6977:
6978: If a program is written in Go and has any dependencies on other Go modules,
6979: have the package include ../../lang/go/go-module.mk.
6980:
6981: 1. Generate a list of those dependencies with make clean && make patch && make
6982: show-go-modules > go-modules.mk.
6983:
1.223 nia 6984: 2. Prepend .include "go-modules.mk" to any other .includes.
6985:
6986: 3. Incorporate these modules in distinfo with make makesum.
1.205 wiz 6987:
1.223 nia 6988: 21.4.4. Rust
1.205 wiz 6989:
1.223 nia 6990: If a program is written in Rust and uses Cargo to build, have the package
6991: include ../../lang/rust/cargo.mk.
1.205 wiz 6992:
1.223 nia 6993: 1. Generate a list of those dependencies with make CARGO_ARGS="build
6994: --release" build && make print-cargo-depends > cargo-depends.mk.
1.205 wiz 6995:
1.223 nia 6996: 2. Prepend .include "cargo-depends.mk" to any other .includes.
1.205 wiz 6997:
6998: 3. Incorporate these modules in distinfo with make makesum.
6999:
1.223 nia 7000: 21.4.5. Packages containing Perl scripts
1.1 dsieger 7001:
1.203 nia 7002: If your package contains interpreted Perl scripts, add "perl" to the USE_TOOLS
1.1 dsieger 7003: variable and set REPLACE_PERL to ensure that the proper interpreter path is
7004: set. REPLACE_PERL should contain a list of scripts, relative to WRKSRC, that
1.74 wiz 7005: you want adjusted. Every occurrence of */bin/perl in a she-bang line will be
1.210 gutterid 7006: replaced with the full path to the Perl executable.
1.1 dsieger 7007:
1.210 gutterid 7008: If a particular version of Perl is needed, set the PERL5_REQD variable to the
1.1 dsieger 7009: version number. The default is "5.0".
7010:
1.203 nia 7011: See Section 21.6.6, "Packages installing Perl modules" for information about
1.210 gutterid 7012: handling Perl modules.
7013:
7014: There is also the REPLACE_PERL6 variable for the language now known as Raku.
1.1 dsieger 7015:
1.223 nia 7016: 21.4.6. Packages containing shell scripts
1.41 wiz 7017:
7018: REPLACE_SH, REPLACE_BASH, REPLACE_CSH, and REPLACE_KSH can be used to replace
1.225 gutterid 7019: shell she-bangs in files. Please use the appropriate one, preferring REPLACE_SH
7020: when this shell is sufficient. Each should contain a list of scripts, relative
7021: to WRKSRC, that you want adjusted. Every occurrence of the matching shell in a
7022: she-bang line will be replaced with the full path to the shell executable. When
7023: using REPLACE_BASH, don't forget to add bash to USE_TOOLS.
1.41 wiz 7024:
1.223 nia 7025: 21.4.7. Other programming languages
1.1 dsieger 7026:
1.210 gutterid 7027: There are further similar REPLACE variables available, e.g., REPLACE_AWK for
7028: packages containing awk scripts, and REPLACE_R for R. These two, like the
1.211 gutterid 7029: others noted above, have their actions defined centrally in mk/configure/
7030: replace-interpreter.mk. Other languages define the actions of these variables
7031: within their own dedicated part of the tree, e.g., REPLACE_PHP is actioned in
1.245 gutterid 7032: lang/php/replace.mk, and REPLACE_PYTHON is actioned in lang/python/
1.211 gutterid 7033: application.mk. For other languages, consult the mk files found within their
1.216 gutterid 7034: specific directories (the naming convention varies), or check the list found in
7035: Appendix E, Help topics.
1.210 gutterid 7036:
7037: Currently, special handling for other languages varies in pkgsrc. If a compiler
7038: package provides a buildlink3.mk file, include that, otherwise just add a
7039: (build) dependency on the appropriate compiler package.
1.1 dsieger 7040:
1.154 rillig 7041: 21.5. The build phase
1.1 dsieger 7042:
7043: The most common failures when building a package are that some platforms do not
7044: provide certain header files, functions or libraries, or they provide the
7045: functions in a library that the original package author didn't know. To work
7046: around this, you can rewrite the source code in most cases so that it does not
7047: use the missing functions or provides a replacement function.
7048:
1.154 rillig 7049: 21.5.1. Compiling C and C++ code conditionally
1.1 dsieger 7050:
7051: If a package already comes with a GNU configure script, the preferred way to
7052: fix the build failure is to change the configure script, not the code. In the
7053: other cases, you can utilize the C preprocessor, which defines certain macros
7054: depending on the operating system and hardware architecture it compiles for.
7055: These macros can be queried using for example #if defined(__i386). Almost every
7056: operating system, hardware architecture and compiler has its own macro. For
7057: example, if the macros __GNUC__, __i386__ and __NetBSD__ are all defined, you
7058: know that you are using NetBSD on an i386 compatible CPU, and your compiler is
7059: GCC.
7060:
7061: The list of the following macros for hardware and operating system depends on
7062: the compiler that is used. For example, if you want to conditionally compile
7063: code on Solaris, don't use __sun__, as the SunPro compiler does not define it.
7064: Use __sun instead.
7065:
1.154 rillig 7066: 21.5.1.1. C preprocessor macros to identify the operating system
1.1 dsieger 7067:
1.223 nia 7068: To distinguish between specific NetBSD versions, you should use the following
7069: code.
7070:
7071: #ifdef __NetBSD__
7072: #include <sys/param.h>
7073: #if __NetBSD_Prereq__(9,99,17)
7074: /* use a newer feature */
7075: #else
7076: /* older code */
7077: #endif
7078: #endif
7079:
7080: #ifndef _WIN32
7081: /* Unix-like specific code */
7082: #endif
7083:
1.1 dsieger 7084: To distinguish between 4.4 BSD-derived systems and the rest of the world, you
7085: should use the following code.
7086:
7087: #include <sys/param.h>
7088: #if (defined(BSD) && BSD >= 199306)
7089: /* BSD-specific code goes here */
7090: #else
7091: /* non-BSD-specific code goes here */
7092: #endif
7093:
1.223 nia 7094: You can also test for the following macros:
1.1 dsieger 7095:
1.46 obache 7096: Cygwin __CYGWIN__
7097: DragonFly __DragonFly__
1.1 dsieger 7098: FreeBSD __FreeBSD__
1.46 obache 7099: Haiku __HAIKU__
1.1 dsieger 7100: Interix __INTERIX
7101: IRIX __sgi (TODO: get a definite source for this)
1.223 nia 7102: Linux __linux
1.83 dholland 7103: Mac OS X __APPLE__
1.46 obache 7104: MirBSD __MirBSD__ (__OpenBSD__ is also defined)
7105: Minix3 __minix
1.1 dsieger 7106: NetBSD __NetBSD__
7107: OpenBSD __OpenBSD__
7108: Solaris sun, __sun
7109:
1.154 rillig 7110: 21.5.1.2. C preprocessor macros to identify the hardware architecture
1.1 dsieger 7111:
7112: i386 i386, __i386, __i386__
1.223 nia 7113: x86-64 __amd64__, __x86_64__
7114: ARM __arm__
1.1 dsieger 7115: MIPS __mips
7116: SPARC sparc, __sparc
1.223 nia 7117: PowerPC __powerpc
1.1 dsieger 7118:
1.154 rillig 7119: 21.5.1.3. C preprocessor macros to identify the compiler
1.1 dsieger 7120:
7121: GCC __GNUC__ (major version), __GNUC_MINOR__
7122: MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41)
7123: SunPro __SUNPRO_C (0x570 for Sun C 5.7)
7124: SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8)
7125:
1.154 rillig 7126: 21.5.2. How to handle compiler bugs
1.1 dsieger 7127:
7128: Some source files trigger bugs in the compiler, based on combinations of
7129: compiler version and architecture and almost always relation to optimisation
7130: being enabled. Common symptoms are gcc internal errors or never finishing
7131: compiling a file.
7132:
7133: Typically, a workaround involves testing the MACHINE_ARCH and compiler version,
1.87 tnn 7134: disabling optimisation for that combination of file, MACHINE_ARCH and compiler.
7135:
7136: This used to be a big problem in the past, but is rarely needed now as compiler
7137: technology has matured. If you still need to add a compiler specific
7138: workaround, please do so in the file hacks.mk and describe the symptom and
7139: compiler version as detailed as possible.
1.1 dsieger 7140:
1.172 rillig 7141: 21.5.3. No such file or directory
7142:
7143: Compilation sometimes fails with an error message like this:
7144:
7145: .../x11/gtk3/work/gtk+-3.24.12/gdk/gdktypes.h:35:10:
7146: fatal error: pango/pango.h: No such file or directory
7147:
7148: The proper way to fix this problem depends on the type of the header, which is
7149: described in the following sections.
7150:
7151: 21.5.3.1. Headers from other packages
7152:
7153: If the header name looks like it comes from a different package, that other
7154: package should be included via the buildlink3 framework.
7155:
7156: First, look whether the header is somewhere in the buildlink3 directory below
7157: WRKDIR. In the above case of the missing Pango header:
7158:
7159: $ find work/.buildlink/ -print | grep -F pango/pango.h
7160:
7161: In the case of Pango, the output is:
7162:
7163: work/.buildlink/include/pango-1.0/pango/pango.h
7164:
7165: If the pango/pango.h file were placed directly in the .buildlink directory, it
7166: would have been found automatically. There is an extra pango-1.0 path component
7167: though, which means that the compiler command line must contain an option of
7168: the form -I${BUILDLINK3_PREFIX.pango}/include/pango-1.0. In most cases this
7169: option is generated by the configure script, which can be examined using:
7170:
7171: $ $ grep -o '[-]I[^[:space:]]*/pango[^[:space:]]*' work/*/Makefile
7172: -I/usr/pkg/include/pango-1.0
7173: -I/usr/pkg/include/pango-1.0
7174: -I/usr/pkg/include/pango-1.0
7175: -I/usr/pkg/include/pango-1.0
7176: -I/usr/pkg/include/pango-1.0
7177:
7178: This looks good. These options are transformed by the buildlink wrapper to
7179: refer to the correct path inside work/.buildlink.
7180:
7181: Since the compilation fails though, examine the compiler command lines in work
7182: /.work.log to see whether the -I option is included in the particular command
7183: line.
7184:
7185: To further analyze the situation, run bmake build-env, which sets up an
7186: interactive, realistic environment including all the pkgsrc wrapper commands
7187: and environment variables. From there, try to compile some simple example
7188: programs that use the header.
7189:
7190: 21.5.3.2. Headers generated during the build
7191:
7192: If the name of the header seems to come from the package itself, and if the
7193: build is run with parallel jobs, the package may have some undeclared
7194: dependencies between the .c and the .h files, and a C file is compiled before
7195: its required header is generated.
7196:
7197: To see whether the build runs with parallel jobs, run bmake show-all-build |
7198: grep JOBS. Its output looks like this:
7199:
7200: usr MAKE_JOBS= 7
7201: pkg MAKE_JOBS_SAFE # undefined
7202: def _MAKE_JOBS_N= 7
7203:
7204: In this case the pkgsrc user has asked pkgsrc to build packages with 7 jobs in
7205: parallel (MAKE_JOBS). The package could have disabled parallel builds by
7206: setting MAKE_JOBS_SAFE to no, but in this case it hasn't.
7207:
7208: To see whether the build failure is caused by parallel builds, first save the
7209: exact error message and a bit of context, maybe you need it later for reporting
7210: a bug. Next, run:
7211:
7212: MAKE_JOBS_SAFE=no bmake clean build
7213:
7214: If that succeeds, file a bug report against the pkgsrc package, including the
7215: exact error message and the contents of your mk.conf file.
7216:
1.173 rillig 7217: 21.5.3.3. Symlinks
7218:
7219: Pkgsrc does not work reliably if any of LOCALBASE, VARBASE or WRKDIR contains a
7220: symlink. Since 2019Q2, the pkgsrc bootstrap program prevents installing pkgsrc
7221: in symlink-based directories. Existing pkgsrc installations are not checked for
7222: symlinks though.
7223:
7224: The "No such file or directory" error messages are a typical symptom of
7225: symlinks, and it's quite difficult to find out that this is the actual cause.
7226:
7227: 21.5.3.4. Stale working directories
7228:
7229: When building a hierarchy of packages, it may happen that one package is built
7230: and then pkgsrc is updated. This situation can provoke various hard to diagnose
7231: build errors. To clean up the situation:
7232:
1.223 nia 7233: $ (cd ../../ && cat mk/bsd.pkg.mk >/dev/null && rm -rf */*/work)
1.173 rillig 7234:
1.223 nia 7235: (The only purpose of the bsd.pkg.mk is to prevent running this command in the
7236: wrong directory.)
1.173 rillig 7237:
7238: If you have set WRKOBJDIR in mk.conf, remove that directory as well.
7239:
7240: 21.5.3.5. Other possible reasons
7241:
7242: On platforms other than BSD, third-party packages are installed in /usr/
7243: include, together with the base system. This means that pkgsrc cannot
7244: distinguish between headers provided by the base system (which it needs) and
7245: headers from third-party packages (which are often included in pkgsrc as well).
7246: This can lead to subtle version mismatches.
7247:
7248: In pkgsrc installations that have been active for several years, it may happen
7249: that some files are manually deleted. To exclude this unlikely reason, run
7250: pkg_admin check.
7251:
7252: It may help to run pkg_admin rebuild-tree to check/fix dependencies.
7253:
7254: If all of the above doesn't help, see Chapter 2, Getting help for contact
7255: information. Be prepared to describe what you have tried so far and what any
7256: error messages were.
7257:
1.172 rillig 7258: 21.5.4. Undefined reference to "..."
1.1 dsieger 7259:
7260: This error message often means that a package did not link to a shared library
7261: it needs. The following functions are known to cause this error message over
7262: and over.
7263:
7264: +-----------------------------------------------------+
7265: | Function |Library |Affected platforms|
7266: |-------------------------+--------+------------------|
7267: |accept, bind, connect |-lsocket|Solaris |
7268: |-------------------------+--------+------------------|
7269: |crypt |-lcrypt |DragonFly, NetBSD |
7270: |-------------------------+--------+------------------|
7271: |dlopen, dlsym |-ldl |Linux |
7272: |-------------------------+--------+------------------|
7273: |gethost* |-lnsl |Solaris |
7274: |-------------------------+--------+------------------|
7275: |inet_aton |-lresolv|Solaris |
7276: |-------------------------+--------+------------------|
7277: |nanosleep, sem_*, timer_*|-lrt |Solaris |
7278: |-------------------------+--------+------------------|
7279: |openpty |-lutil |Linux |
7280: +-----------------------------------------------------+
7281:
1.223 nia 7282: To fix these linker errors, it is often sufficient to add LIBS.OperatingSystem+
7283: = -lfoo to the package Makefile and then run bmake clean; bmake.
1.1 dsieger 7284:
1.223 nia 7285: 21.5.4.1. The SunPro compiler and inline functions
1.1 dsieger 7286:
7287: When you are using the SunPro compiler, there is another possibility. That
7288: compiler cannot handle the following code:
7289:
7290: extern int extern_func(int);
7291:
7292: static inline int
7293: inline_func(int x)
7294: {
7295: return extern_func(x);
7296: }
7297:
7298: int main(void)
7299: {
7300: return 0;
7301: }
7302:
7303: It generates the code for inline_func even if that function is never used. This
7304: code then refers to extern_func, which can usually not be resolved. To solve
7305: this problem you can try to tell the package to disable inlining of functions.
7306:
1.228 gutterid 7307: 21.5.4.2. Missing atomic functions
7308:
7309: When building for older machine architectures (e.g., i386, PowerPC), builds may
7310: fail because the package expects modern 64-bit atomic functions which the
7311: underlying hardware either doesn't support, or will only support with specific
7312: compiler flags. This is generally handled via inclusion of mk/atomic64.mk.
7313:
1.172 rillig 7314: 21.5.5. Running out of memory
1.1 dsieger 7315:
7316: Sometimes packages fail to build because the compiler runs into an operating
7317: system specific soft limit. With the UNLIMIT_RESOURCES variable pkgsrc can be
1.223 nia 7318: told to unlimit the resources. The allowed values are any combination of "
7319: cputime", "datasize", "memorysize", "stacksize" and "virtualsize". Setting this
7320: variable is similar to running the shell builtin ulimit command to raise the
7321: maximum data segment size or maximum stack size of a process, respectively, to
7322: their hard limits.
1.1 dsieger 7323:
1.154 rillig 7324: 21.6. The install phase
1.1 dsieger 7325:
1.154 rillig 7326: 21.6.1. Creating needed directories
1.1 dsieger 7327:
7328: The BSD-compatible install supplied with some operating systems cannot create
7329: more than one directory at a time. As such, you should call ${INSTALL_*_DIR}
7330: like this:
7331:
7332: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
7333: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
7334:
1.223 nia 7335: Instead of running the install commands directly, you can also append "dir1
7336: dir2" to the INSTALLATION_DIRS variable, which will automatically do the right
7337: thing.
1.1 dsieger 7338:
1.154 rillig 7339: 21.6.2. Where to install documentation
1.1 dsieger 7340:
7341: In general, documentation should be installed into ${PREFIX}/share/doc/$
1.223 nia 7342: {PKGBASE} or ${PREFIX}/share/doc/${PKGNAME_NOREV} (the latter includes the
7343: version number of the package).
1.1 dsieger 7344:
7345: Many modern packages using GNU autoconf allow to set the directory where HTML
7346: documentation is installed with the "--with-html-dir" option. Sometimes using
7347: this flag is needed because otherwise the documentation ends up in ${PREFIX}/
1.223 nia 7348: share/doc/html or other places. In pkgsrc, the HTML documentation should go
7349: into the package-specific directory, just like any other documentation.
1.1 dsieger 7350:
7351: An exception to the above is that library API documentation generated with the
7352: textproc/gtk-doc tools, for use by special browsers (devhelp) should be left at
7353: their default location, which is ${PREFIX}/share/gtk-doc. Such documentation
7354: can be recognized from files ending in .devhelp or .devhelp2. (It is also
7355: acceptable to install such files in ${PREFIX}/share/doc/${PKGBASE} or ${PREFIX}
7356: /share/doc/${PKGNAME}; the .devhelp* file must be directly in that directory
7357: then, no additional subdirectory level is allowed in this case. This is usually
7358: achieved by using "--with-html-dir=${PREFIX}/share/doc". ${PREFIX}/share/
7359: gtk-doc is preferred though.)
7360:
1.154 rillig 7361: 21.6.3. Installing highscore files
1.1 dsieger 7362:
7363: Certain packages, most of them in the games category, install a score file that
7364: allows all users on the system to record their highscores. In order for this to
7365: work, the binaries need to be installed setgid and the score files owned by the
1.36 wiz 7366: appropriate group and/or owner (traditionally the "games" user/group). Set
7367: USE_GAMESGROUP to yes to support this. The following variables, documented in
7368: more detail in mk/defaults/mk.conf, control this behaviour: GAMEDATAMODE,
1.100 leot 7369: GAMEDIRMODE, GAMES_GROUP, GAMEMODE, GAME_USER. Other useful variables are:
7370: GAMEDIR_PERMS, GAMEDATA_PERMS and SETGID_GAMES_PERMS.
7371:
7372: An example that illustrates some of the variables described above is games/
7373: moon-buggy. OWN_DIRS_PERMS is used to properly set directory permissions of the
7374: directory where the scorefile is saved, REQD_FILES_PERMS is used to create a
7375: dummy scorefile (mbscore) with the proper permissions and SPECIAL_PERMS is used
7376: to install setgid the game binary:
7377:
7378: USE_GAMESGROUP= yes
7379:
7380: BUILD_DEFS+= VARBASE
7381:
7382: OWN_DIRS_PERMS+= ${VARBASE}/games/moon-buggy ${GAMEDIR_PERMS}
7383: REQD_FILES_PERMS+= /dev/null ${VARBASE}/games/moon-buggy/mbscore ${GAMEDATA_PERMS}
7384: SPECIAL_PERMS+= ${PREFIX}/bin/moon-buggy ${SETGID_GAMES_PERMS}
7385:
7386: Various INSTALL_* variables are also available: INSTALL_GAME to install setgid
7387: game binaries, INSTALL_GAME_DIR to install game directories that are needed to
7388: be accessed by setgid games and INSTALL_GAME_DATA to install scorefiles.
1.1 dsieger 7389:
1.14 jmcneill 7390: A package should therefore never hard code file ownership or access permissions
1.100 leot 7391: but rely on *_PERMS as described above or alternatively on INSTALL_GAME,
7392: INSTALL_GAME_DATA and INSTALL_GAME_DIR to set these correctly.
1.1 dsieger 7393:
1.154 rillig 7394: 21.6.4. Adding DESTDIR support to packages
1.4 rillig 7395:
1.14 jmcneill 7396: DESTDIR support means that a package installs into a staging directory, not the
7397: final location of the files. Then a binary package is created which can be used
7398: for installation as usual. There are two ways: Either the package must install
1.25 wiz 7399: as root ("destdir") or the package can install as non-root user ("user-destdir"
7400: ).
1.14 jmcneill 7401:
1.113 leot 7402: * PKG_DESTDIR_SUPPORT has to be set to "destdir" or "user-destdir". By
7403: default PKG_DESTDIR_SUPPORT is set to "user-destdir" to help catching more
7404: potential packaging problems. If bsd.prefs.mk is included in the Makefile,
7405: PKG_DESTDIR_SUPPORT needs to be set before the inclusion.
1.14 jmcneill 7406:
1.4 rillig 7407: * All installation operations have to be prefixed with ${DESTDIR}.
7408:
7409: * automake gets this DESTDIR mostly right automatically. Many manual rules
7410: and pre/post-install often are incorrect; fix them.
7411:
1.17 imil 7412: * If files are installed with special owner/group use SPECIAL_PERMS.
1.4 rillig 7413:
7414: * In general, packages should support UNPRIVILEGED to be able to use DESTDIR.
7415:
1.154 rillig 7416: 21.6.5. Packages with hardcoded paths to other interpreters
1.1 dsieger 7417:
7418: Your package may also contain scripts with hardcoded paths to other
1.203 nia 7419: interpreters besides (or as well as) Perl. To correct the full pathname to the
1.1 dsieger 7420: script interpreter, you need to set the following definitions in your Makefile
7421: (we shall use tclsh in this example):
7422:
7423: REPLACE_INTERPRETER+= tcl
7424: REPLACE.tcl.old= .*/bin/tclsh
7425: REPLACE.tcl.new= ${PREFIX}/bin/tclsh
7426: REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
7427: # relative to ${WRKSRC}, just as in REPLACE_PERL
7428:
1.203 nia 7429: 21.6.6. Packages installing Perl modules
1.1 dsieger 7430:
7431: Makefiles of packages providing perl5 modules should include the Makefile
7432: fragment ../../lang/perl5/module.mk. It provides a do-configure target for the
7433: standard perl configuration for such modules as well as various hooks to tune
7434: this configuration. See comments in this file for details.
7435:
7436: Perl5 modules will install into different places depending on the version of
7437: perl used during the build process. To address this, pkgsrc will append lines
7438: to the PLIST corresponding to the files listed in the installed .packlist file
7439: generated by most perl5 modules. This is invoked by defining PERL5_PACKLIST to
1.48 wiz 7440: a space-separated list of packlist files relative to PERL5_PACKLIST_DIR
7441: (PERL5_INSTALLVENDORARCH by default), e.g.:
1.1 dsieger 7442:
1.48 wiz 7443: PERL5_PACKLIST= auto/Pg/.packlist
1.1 dsieger 7444:
1.48 wiz 7445: The perl5 config variables installarchlib, installscript, installvendorbin,
7446: installvendorscript, installvendorarch, installvendorlib, installvendorman1dir,
7447: and installvendorman3dir represent those locations in which components of perl5
7448: modules may be installed, provided as variable with uppercase and prefixed with
7449: PERL5_, e.g. PERL5_INSTALLARCHLIB and may be used by perl5 packages that don't
7450: have a packlist. These variables are also substituted for in the PLIST as
7451: uppercase prefixed with PERL5_SUB_.
1.1 dsieger 7452:
1.254 wiz 7453: 21.6.7. Packages installing pkg-config files
7454:
7455: Some packages, usually those providing libraries, install pkg-config files so
7456: that their headers and libraries can easily be found. The file names end with
7457: .pc.
7458:
7459: Most of the time, these files only provide the linker flags for the library,
7460: but do not include the flags for setting the rpath so the libraries can also be
7461: found at runtime. Since this is so common, pkgsrc provides PKGCONFIG_OVERRIDE
7462: for this. Many packages generate the .pc from .pc.in, in that case add those
7463: files to the PKGCONFIG_OVERRIDE variable:
7464:
7465: PKGCONFIG_OVERRIDE+= foo.pc.in
7466:
7467:
7468: For packages using meson, the files are generated during build and you also
7469: need to change the phase in which the replacement is done. For example:
7470:
7471: PKGCONFIG_OVERRIDE+= output/meson-private/foo.pc
7472: PKGCONFIG_OVERRIDE_STAGE= post-build
7473:
7474:
7475: 21.6.8. Packages installing info files
1.1 dsieger 7476:
7477: Some packages install info files or use the "makeinfo" or "install-info"
7478: commands. INFO_FILES should be defined in the package Makefile so that INSTALL
7479: and DEINSTALL scripts will be generated to handle registration of the info
7480: files in the Info directory file. The "install-info" command used for the info
7481: files registration is either provided by the system, or by a special purpose
7482: package automatically added as dependency if needed.
7483:
7484: PKGINFODIR is the directory under ${PREFIX} where info files are primarily
7485: located. PKGINFODIR defaults to "info" and can be overridden by the user.
7486:
7487: The info files for the package should be listed in the package PLIST; however
7488: any split info files need not be listed.
7489:
7490: A package which needs the "makeinfo" command at build time must add "makeinfo"
7491: to USE_TOOLS in its Makefile. If a minimum version of the "makeinfo" command is
7492: needed it should be noted with the TEXINFO_REQD variable in the package
7493: Makefile. By default, a minimum version of 3.12 is required. If the system does
7494: not provide a makeinfo command or if it does not match the required minimum, a
7495: build dependency on the devel/gtexinfo package will be added automatically.
7496:
7497: The build and installation process of the software provided by the package
7498: should not use the install-info command as the registration of info files is
1.25 wiz 7499: the task of the package INSTALL script, and it must use the appropriate
1.1 dsieger 7500: makeinfo command.
7501:
7502: To achieve this goal, the pkgsrc infrastructure creates overriding scripts for
7503: the install-info and makeinfo commands in a directory listed early in PATH.
7504:
7505: The script overriding install-info has no effect except the logging of a
7506: message. The script overriding makeinfo logs a message and according to the
7507: value of TEXINFO_REQD either runs the appropriate makeinfo command or exit on
7508: error.
7509:
1.254 wiz 7510: 21.6.9. Packages installing man pages
1.1 dsieger 7511:
7512: All packages that install manual pages should install them into the same
7513: directory, so that there is one common place to look for them. In pkgsrc, this
7514: place is ${PREFIX}/${PKGMANDIR}, and this expression should be used in
1.25 wiz 7515: packages. The default for PKGMANDIR is "man". Another often-used value is "
7516: share/man".
1.1 dsieger 7517:
7518: Note
7519:
7520: The support for a custom PKGMANDIR is far from complete.
7521:
7522: The PLIST files can just use man/ as the top level directory for the man page
7523: file entries, and the pkgsrc framework will convert as needed. In all other
7524: places, the correct PKGMANDIR must be used.
7525:
7526: Packages that are configured with GNU_CONFIGURE set as "yes", by default will
7527: use the ./configure --mandir switch to set where the man pages should be
7528: installed. The path is GNU_CONFIGURE_MANDIR which defaults to ${PREFIX}/$
7529: {PKGMANDIR}.
7530:
7531: Packages that use GNU_CONFIGURE but do not use --mandir, can set
7532: CONFIGURE_HAS_MANDIR to "no". Or if the ./configure script uses a non-standard
7533: use of --mandir, you can set GNU_CONFIGURE_MANDIR as needed.
7534:
1.184 rillig 7535: See Section 19.5, "Man page compression" for information on installation of
1.1 dsieger 7536: compressed manual pages.
7537:
1.254 wiz 7538: 21.6.10. Packages installing X11 fonts
1.1 dsieger 7539:
7540: If a package installs font files, you will need to rebuild the fonts database
7541: in the directory where they get installed at installation and deinstallation
7542: time. This can be automatically done by using the pkginstall framework.
7543:
7544: You can list the directories where fonts are installed in the FONTS_DIRS.type
7545: variables, where type can be one of "ttf", "type1" or "x11". Also make sure
7546: that the database file fonts.dir is not listed in the PLIST.
7547:
7548: Note that you should not create new directories for fonts; instead use the
7549: standard ones to avoid that the user needs to manually configure his X server
7550: to find them.
7551:
1.254 wiz 7552: 21.6.11. Packages installing SGML or XML data
1.1 dsieger 7553:
7554: If a package installs SGML or XML data files that need to be registered in
7555: system-wide catalogs (like DTDs, sub-catalogs, etc.), you need to take some
7556: extra steps:
7557:
7558: 1. Include ../../textproc/xmlcatmgr/catalogs.mk in your Makefile, which takes
7559: care of registering those files in system-wide catalogs at installation and
7560: deinstallation time.
7561:
7562: 2. Set SGML_CATALOGS to the full path of any SGML catalogs installed by the
7563: package.
7564:
7565: 3. Set XML_CATALOGS to the full path of any XML catalogs installed by the
7566: package.
7567:
7568: 4. Set SGML_ENTRIES to individual entries to be added to the SGML catalog.
7569: These come in groups of three strings; see xmlcatmgr(1) for more
7570: information (specifically, arguments recognized by the 'add' action). Note
7571: that you will normally not use this variable.
7572:
7573: 5. Set XML_ENTRIES to individual entries to be added to the XML catalog. These
7574: come in groups of three strings; see xmlcatmgr(1) for more information
7575: (specifically, arguments recognized by the 'add' action). Note that you
7576: will normally not use this variable.
7577:
1.254 wiz 7578: 21.6.12. Packages installing extensions to the MIME database
1.1 dsieger 7579:
7580: If a package provides extensions to the MIME database by installing .xml files
7581: inside ${PREFIX}/share/mime/packages, you need to take some extra steps to
7582: ensure that the database is kept consistent with respect to these new files:
7583:
7584: 1. Include ../../databases/shared-mime-info/mimedb.mk (avoid using the
7585: buildlink3.mk file from this same directory, which is reserved for
7586: inclusion from other buildlink3.mk files). It takes care of rebuilding the
7587: MIME database at installation and deinstallation time, and disallows any
7588: access to it directly from the package.
7589:
1.25 wiz 7590: 2. Check the PLIST and remove any entries under the share/mime directory,
1.1 dsieger 7591: except for files saved under share/mime/packages. The former are handled
7592: automatically by the update-mime-database program, but the latter are
7593: package-dependent and must be removed by the package that installed them in
7594: the first place.
7595:
7596: 3. Remove any share/mime/* directories from the PLIST. They will be handled by
7597: the shared-mime-info package.
7598:
1.254 wiz 7599: 21.6.13. Packages using intltool
1.1 dsieger 7600:
7601: If a package uses intltool during its build, add intltool to the USE_TOOLS,
7602: which forces it to use the intltool package provided by pkgsrc, instead of the
7603: one bundled with the distribution file.
7604:
7605: This tracks intltool's build-time dependencies and uses the latest available
7606: version; this way, the package benefits of any bug fixes that may have appeared
7607: since it was released.
7608:
1.254 wiz 7609: 21.6.14. Packages installing startup scripts
1.1 dsieger 7610:
1.256 wiz 7611: If a package contains an rc.d script, it won't be copied into the startup
7612: directory (/etc/rc.d) by default, but you can enable copying by setting the
7613: option PKG_RCD_SCRIPTS=YES in mk.conf. With PKG_RCD_SCRIPTS=YES, rc.d scripts
7614: will be copied into /etc/rc.d when a package is installed, but only if the
7615: target does not already exist. Copies in /etc/rc.d will be automatically
7616: removed only if they have not been modified.
7617:
7618: Note that this alone does not enable the service: It must still be added to /
7619: etc/rc.conf.
1.1 dsieger 7620:
1.254 wiz 7621: 21.6.15. Packages installing TeX modules
1.1 dsieger 7622:
7623: If a package installs TeX packages into the texmf tree, the ls-R database of
7624: the tree needs to be updated.
7625:
7626: Note
7627:
1.23 jakllsch 7628: Except the main TeX packages such as kpathsea, packages should install files
7629: into ${PREFIX}/share/texmf-dist, not ${PREFIX}/share/texmf.
1.1 dsieger 7630:
1.23 jakllsch 7631: 1. Include ../../print/kpathsea/texmf.mk. This takes care of rebuilding the
7632: ls-R database at installation and deinstallation time.
1.1 dsieger 7633:
1.23 jakllsch 7634: 2. If your package installs files into a texmf tree other than the one at $
7635: {PREFIX}/share/texmf-dist, set TEX_TEXMF_DIRS to the list of all texmf
7636: trees that need database update.
1.1 dsieger 7637:
7638: If your package also installs font map files that need to be registered
1.30 dholland 7639: using updmap, include ../../print/tex-tetex/map.mk and set TEX_MAP_FILES
7640: and/or TEX_MIXEDMAP_FILES to the list of all such font map files. Then
7641: updmap will be run automatically at installation/deinstallation to enable/
7642: disable font map files for TeX output drivers.
1.1 dsieger 7643:
7644: 3. Make sure that none of ls-R databases are included in PLIST, as they will
1.30 dholland 7645: be removed only by the kpathsea package.
1.1 dsieger 7646:
1.254 wiz 7647: 21.6.16. Packages supporting running binaries in emulation
1.1 dsieger 7648:
7649: There are some packages that provide libraries and executables for running
7650: binaries from a one operating system on a different one (if the latter supports
7651: it). One example is running Linux binaries on NetBSD.
7652:
7653: The pkgtools/rpm2pkg helps in extracting and packaging Linux rpm packages.
7654:
7655: The CHECK_SHLIBS can be set to no to avoid the check-shlibs target, which tests
7656: if all libraries for each installed executable can be found by the dynamic
7657: linker. Since the standard dynamic linker is run, this fails for emulation
7658: packages, because the libraries used by the emulation are not in the standard
7659: directories.
7660:
1.254 wiz 7661: 21.6.17. Packages installing hicolor icons
1.1 dsieger 7662:
7663: If a package installs images under the share/icons/hicolor and/or updates the
7664: share/icons/hicolor/icon-theme.cache database, you need to take some extra
7665: steps to make sure that the shared theme directory is handled appropriately and
7666: that the cache database is rebuilt:
7667:
7668: 1. Include ../../graphics/hicolor-icon-theme/buildlink3.mk.
7669:
7670: 2. Check the PLIST and remove the entry that refers to the theme cache.
7671:
7672: 3. Ensure that the PLIST does not remove the shared icon directories from the
7673: share/icons/hicolor hierarchy because they will be handled automatically.
7674:
7675: The best way to verify that the PLIST is correct with respect to the last two
7676: points is to regenerate it using make print-PLIST.
7677:
1.254 wiz 7678: 21.6.18. Packages installing desktop files
1.1 dsieger 7679:
7680: If a package installs .desktop files under share/applications and these include
1.54 rodent 7681: MIME information (MimeType key), you need to take extra steps to ensure that
7682: they are registered into the MIME database:
1.1 dsieger 7683:
7684: 1. Include ../../sysutils/desktop-file-utils/desktopdb.mk.
7685:
7686: 2. Check the PLIST and remove the entry that refers to the share/applications/
7687: mimeinfo.cache file. It will be handled automatically.
7688:
7689: The best way to verify that the PLIST is correct with respect to the last point
7690: is to regenerate it using make print-PLIST.
7691:
1.154 rillig 7692: 21.7. Marking packages as having problems
1.1 dsieger 7693:
1.23 jakllsch 7694: In some cases one does not have the time to solve a problem immediately. In
7695: this case, one can plainly mark a package as broken. For this, one just sets
7696: the variable BROKEN to the reason why the package is broken (similar to the
1.162 rillig 7697: PKG_FAIL_REASON variable). A user trying to build the package will immediately
7698: be shown this message, and the build will not be even tried.
1.1 dsieger 7699:
1.23 jakllsch 7700: BROKEN packages are removed from pkgsrc in irregular intervals.
1.1 dsieger 7701:
1.184 rillig 7702: Chapter 22. GNOME packaging and porting
7703:
7704: Table of Contents
7705:
7706: 22.1. Meta packages
7707: 22.2. Packaging a GNOME application
7708: 22.3. Updating GNOME to a newer version
7709: 22.4. Patching guidelines
7710:
7711: Quoting GNOME's web site:
7712:
7713: The GNOME project provides two things: The GNOME desktop environment, an
7714: intuitive and attractive desktop for users, and the GNOME development
7715: platform, an extensive framework for building applications that integrate
7716: into the rest of the desktop.
7717:
7718: pkgsrc provides a seamless way to automatically build and install a complete
7719: GNOME environment under many different platforms. We can say with confidence
7720: that pkgsrc is one of the most advanced build and packaging systems for GNOME
7721: due to its included technologies buildlink3, the wrappers and tools framework
7722: and automatic configuration file management. Lots of efforts are put into
7723: achieving a completely clean deinstallation of installed software components.
7724:
7725: Given that pkgsrc is NetBSD's official packaging system, the above also means
7726: that great efforts are put into making GNOME work under this operating system.
7727:
7728: This chapter is aimed at pkgsrc developers and other people interested in
7729: helping our GNOME porting and packaging efforts. It provides instructions on
7730: how to manage the existing packages and some important information regarding
7731: their internals.
7732:
7733: 22.1. Meta packages
7734:
7735: pkgsrc includes three GNOME-related meta packages:
7736:
7737: * meta-pkgs/gnome-base: Provides the core GNOME desktop environment. It only
7738: includes the necessary bits to get it to boot correctly, although it may
7739: lack important functionality for daily operation. The idea behind this
7740: package is to let end users build their own configurations on top of this
7741: one, first installing this meta package to achieve a functional setup and
7742: then adding individual applications.
7743:
7744: * meta-pkgs/gnome: Provides a complete installation of the GNOME platform and
7745: desktop as defined by the GNOME project; this is based on the components
7746: distributed in the platform/x.y/x.y.z/sources and desktop/x.y/x.y.z/sources
7747: directories of the official FTP server. Developer-only tools found in those
7748: directories are not installed unless required by some other component to
7749: work properly. Similarly, packages from the bindings set (bindings/x.y/
7750: x.y.z/sources) are not pulled in unless required as a dependency for an
7751: end-user component. This package "extends" meta-pkgs/gnome-base.
7752:
7753: * meta-pkgs/gnome-devel: Installs all the tools required to build a GNOME
7754: component when fetched from the CVS repository. These are required to let
7755: the autogen.sh scripts work appropriately.
7756:
7757: In all these packages, the DEPENDS lines are sorted in a way that eases
7758: updates: a package may depend on other packages listed before it but not on any
7759: listed after it. It is very important to keep this order to ease updates so...
7760: do not change it to alphabetical sorting!
7761:
7762: 22.2. Packaging a GNOME application
7763:
7764: Almost all GNOME applications are written in C and use a common set of tools as
7765: their build system. Things get different with the new bindings to other
7766: languages (such as Python), but the following will give you a general idea on
7767: the minimum required tools:
7768:
7769: * Almost all GNOME applications use the GNU Autotools as their build system.
7770: As a general rule you will need to tell this to your package:
7771:
1.223 nia 7772: GNU_CONFIGURE= yes
7773: USE_LIBTOOL= yes
7774: USE_TOOLS+= gmake
1.184 rillig 7775:
7776: * If the package uses pkg-config to detect dependencies, add this tool to the
7777: list of required utilities:
7778:
1.223 nia 7779: USE_TOOLS+= pkg-config
1.184 rillig 7780:
7781: Also use pkgtools/verifypc at the end of the build process to ensure that
7782: you did not miss to specify any dependency in your package and that the
7783: version requirements are all correct.
7784:
7785: * If the package uses intltool, be sure to add intltool to the USE_TOOLS to
7786: handle dependencies and to force the package to use the latest available
7787: version.
7788:
7789: * If the package uses gtk-doc (a documentation generation utility), do not
7790: add a dependency on it. The tool is rather big and the distfile should come
7791: with pregenerated documentation anyway; if it does not, it is a bug that
7792: you ought to report. For such packages you should disable gtk-doc (unless
7793: it is the default):
7794:
1.223 nia 7795: CONFIGURE_ARGS+= --disable-gtk-doc
1.184 rillig 7796:
7797: The default location of installed HTML files (share/gtk-doc/<package-name>)
7798: is correct and should not be changed unless the package insists on
7799: installing them somewhere else. Otherwise programs as devhelp will not be
7800: able to open them. You can do that with an entry similar to:
1.1 dsieger 7801:
1.223 nia 7802: CONFIGURE_ARGS+= --with-html-dir=${PREFIX}/share/gtk-doc/...
1.1 dsieger 7803:
1.184 rillig 7804: GNOME uses multiple shared directories and files under the installation prefix
7805: to maintain databases. In this context, shared means that those exact same
7806: directories and files are used among several different packages, leading to
7807: conflicts in the PLIST. pkgsrc currently includes functionality to handle the
7808: most common cases, so you have to forget about using @unexec ${RMDIR} lines in
7809: your file lists and omitting shared files from them. If you find yourself doing
7810: those, your package is most likely incorrect.
1.1 dsieger 7811:
1.184 rillig 7812: The following table lists the common situations that result in using shared
7813: directories or files. For each of them, the appropriate solution is given.
7814: After applying the solution be sure to regenerate the package's file list with
7815: make print-PLIST and ensure it is correct.
1.1 dsieger 7816:
1.184 rillig 7817: Table 22.1. PLIST handling for GNOME packages
1.1 dsieger 7818:
1.184 rillig 7819: +-----------------------------------------------------------------------------+
7820: | If the package... | Then... |
7821: |-------------------------------------------+---------------------------------|
1.254 wiz 7822: |Installs icons under the share/icons/ |See Section 21.6.17, "Packages |
1.203 nia 7823: |hicolor hierarchy or updates share/icons/ |installing hicolor icons". |
1.184 rillig 7824: |hicolor/icon-theme.cache. | |
7825: |-------------------------------------------+---------------------------------|
1.254 wiz 7826: | |See Section 21.6.12, "Packages |
1.184 rillig 7827: |Installs files under share/mime/packages. |installing extensions to the MIME|
7828: | |database". |
7829: |-------------------------------------------+---------------------------------|
1.254 wiz 7830: |Installs .desktop files under share/ |See Section 21.6.18, "Packages |
1.184 rillig 7831: |applications and these include MIME |installing desktop files". |
7832: |information. | |
7833: +-----------------------------------------------------------------------------+
1.1 dsieger 7834:
7835:
1.184 rillig 7836: 22.3. Updating GNOME to a newer version
1.1 dsieger 7837:
1.184 rillig 7838: When seeing GNOME as a whole, there are two kinds of updates:
1.1 dsieger 7839:
1.184 rillig 7840: Major update
1.1 dsieger 7841:
1.184 rillig 7842: Given that there is still a very long way for GNOME 3 (if it ever appears),
7843: we consider a major update one that goes from a 2.X version to a 2.Y one,
7844: where Y is even and greater than X. These are hard to achieve because they
7845: introduce lots of changes in the components' code and almost all GNOME
7846: distfiles are updated to newer versions. Some of them can even break API
7847: and ABI compatibility with the previous major version series. As a result,
7848: the update needs to be done all at once to minimize breakage.
1.1 dsieger 7849:
1.184 rillig 7850: A major update typically consists of around 80 package updates and the
7851: addition of some new ones.
1.1 dsieger 7852:
1.184 rillig 7853: Minor update
1.1 dsieger 7854:
1.184 rillig 7855: We consider a minor update one that goes from a 2.A.X version to a 2.A.Y
7856: one where Y is greater than X. These are easy to achieve because they do
7857: not update all GNOME components, can be done in an incremental way and do
7858: not break API nor ABI compatibility.
1.1 dsieger 7859:
1.184 rillig 7860: A minor update typically consists of around 50 package updates, although
7861: the numbers here may vary a lot.
1.1 dsieger 7862:
1.184 rillig 7863: In order to update the GNOME components in pkgsrc to a new stable release
7864: (either major or minor), the following steps should be followed:
1.1 dsieger 7865:
1.184 rillig 7866: 1. Get a list of all the tarballs that form the new release by using the
7867: following commands. These will leave the full list of the components'
7868: distfiles into the list.txt file:
1.1 dsieger 7869:
1.184 rillig 7870: % echo ls "*.tar.bz2" | \
7871: ftp -V ftp://ftp.gnome.org/pub/gnome/platform/x.y/x.y.z/sources/ | \
7872: awk '{ print $9 }' >list.txt
7873: % echo ls "*.tar.bz2" | \
7874: ftp -V ftp://ftp.gnome.org/pub/gnome/desktop/x.y/x.y.z/sources/ | \
7875: awk '{ print $9 }' >>list.txt
1.1 dsieger 7876:
1.184 rillig 7877: 2. Open each meta package's Makefile and bump their version to the release you
7878: are updating them to. The three meta packages should be always consistent
7879: with versioning. Obviously remove any PKGREVISIONs that might be in them.
1.1 dsieger 7880:
1.184 rillig 7881: 3. For each meta package, update all its DEPENDS lines to match the latest
7882: versions as shown by the above commands. Do not list any newer version
7883: (even if found in the FTP) because the meta packages are supposed to list
7884: the exact versions that form a specific GNOME release. Exceptions are
7885: permitted here if a newer version solves a serious issue in the overall
7886: desktop experience; these typically come in the form of a revision bump in
7887: pkgsrc, not in newer versions from the developers.
1.1 dsieger 7888:
1.184 rillig 7889: Packages not listed in the list.txt file should be updated to the latest
7890: version available (if found in pkgsrc). This is the case, for example, of
7891: the dependencies on the GNU Autotools in the meta-pkgs/gnome-devel meta
7892: package.
1.1 dsieger 7893:
1.184 rillig 7894: 4. Generate a patch from the modified meta packages and extract the list of
7895: "new" lines. This will provide you an outline on what packages need to be
7896: updated in pkgsrc and in what order:
1.1 dsieger 7897:
1.184 rillig 7898: % cvs diff -u gnome-devel gnome-base gnome | grep '^+D' >todo.txt
1.1 dsieger 7899:
1.184 rillig 7900: 5. For major desktop updates it is recommended to zap all your installed
7901: packages and start over from scratch at this point.
1.1 dsieger 7902:
1.184 rillig 7903: 6. Now comes the longest step by far: iterate over the contents of todo.txt
7904: and update the packages listed in it in order. For major desktop updates
7905: none of these should be committed until the entire set is completed because
7906: there are chances of breaking not-yet-updated packages.
1.1 dsieger 7907:
1.184 rillig 7908: 7. Once the packages are up to date and working, commit them to the tree one
7909: by one with appropriate log messages. At the end, commit the three meta
7910: package updates and all the corresponding changes to the doc/CHANGES-<YEAR>
7911: and pkgsrc/doc/TODO files.
1.1 dsieger 7912:
1.184 rillig 7913: 22.4. Patching guidelines
1.1 dsieger 7914:
1.184 rillig 7915: GNOME is a very big component in pkgsrc which approaches 100 packages. Please,
7916: it is very important that you always, always, always feed back any portability
7917: fixes you do to a GNOME package to the mainstream developers (see
7918: Section 12.3.5, "Feedback to the author"). This is the only way to get their
7919: attention on portability issues and to ensure that future versions can be built
7920: out-of-the box on NetBSD. The less custom patches in pkgsrc, the easier further
7921: updates are. Those developers in charge of issuing major GNOME updates will be
7922: grateful if you do that.
1.1 dsieger 7923:
1.200 cirnatda 7924: The most common places to report bugs are the GNOME's GitLab and the
7925: freedesktop.org's GitLab. Not all components use these to track bugs, but most
7926: of them do. Do not be short on your reports: always provide detailed
1.184 rillig 7927: explanations of the current failure, how it can be improved to achieve maximum
1.200 cirnatda 7928: portability and, if at all possible, provide a patch against the main Git
7929: branch. The more verbose you are, the higher chances of your patch being
7930: accepted.
1.1 dsieger 7931:
1.184 rillig 7932: Also, please avoid using preprocessor magic to fix portability issues. While
7933: the FreeBSD GNOME people are doing a great job in porting GNOME to their
7934: operating system, the official GNOME sources are now plagued by conditionals
7935: that check for __FreeBSD__ and similar macros. This hurts portability. Please
7936: see our patching guidelines (Section 12.3.4, "Patching guidelines") for more
7937: details.
1.1 dsieger 7938:
1.154 rillig 7939: Chapter 23. Submitting and Committing
1.1 dsieger 7940:
7941: Table of Contents
7942:
1.154 rillig 7943: 23.1. Submitting binary packages
7944: 23.2. Submitting source packages (for non-NetBSD-developers)
7945: 23.3. General notes when adding, updating, or removing packages
7946: 23.4. Commit Messages
7947: 23.5. Committing: Adding a package to CVS
7948: 23.6. Updating a package to a newer version
7949: 23.7. Renaming a package in pkgsrc
7950: 23.8. Moving a package in pkgsrc
1.1 dsieger 7951:
1.154 rillig 7952: 23.1. Submitting binary packages
1.1 dsieger 7953:
7954: Our policy is that we accept binaries only from pkgsrc developers to guarantee
7955: that the packages don't contain any trojan horses etc. This is not to annoy
7956: anyone but rather to protect our users! You're still free to put up your
7957: home-made binary packages and tell the world where to get them. NetBSD
1.154 rillig 7958: developers doing bulk builds and wanting to upload them please see Chapter 8,
1.66 asau 7959: Creating binary packages for everything in pkgsrc (bulk builds).
1.1 dsieger 7960:
1.154 rillig 7961: 23.2. Submitting source packages (for non-NetBSD-developers)
1.1 dsieger 7962:
1.218 nia 7963: Firstly, you can import new packages into pkgsrc-wip ("pkgsrc work-in-progress"
7964: ); see the homepage at https://pkgsrc.org/wip/ for details.
7965:
7966: Next, check that your package is complete, compiles and runs well; see
1.184 rillig 7967: Chapter 14, Creating a new pkgsrc package from scratch and the rest of this
1.218 nia 7968: document. Run the pkgtools/pkglint tool and fix any errors that appear.
7969:
7970: Finally, send a report to the pkgsrc bug tracking system, either with the
7971: send-pr(1) command, or if you don't have that, go to the web page https://
7972: www.NetBSD.org/support/send-pr.html, which contains some instructions and a
7973: link to a form where you can submit packages. The sysutils/gtk-send-pr package
7974: is also available as a substitute for either of the above two tools.
1.1 dsieger 7975:
7976: In the form of the problem report, the category should be "pkg", the synopsis
7977: should include the package name and version number, and the description field
7978: should contain a short description of your package (contents of the COMMENT
1.218 nia 7979: variable or DESCR file are OK).
1.1 dsieger 7980:
1.154 rillig 7981: 23.3. General notes when adding, updating, or removing packages
1.1 dsieger 7982:
7983: Please note all package additions, updates, moves, and removals in pkgsrc/doc/
7984: CHANGES-YYYY. It's very important to keep this file up to date and conforming
7985: to the existing format, because it will be used by scripts to automatically
7986: update pages on www.NetBSD.org and other sites. Additionally, check the pkgsrc/
7987: doc/TODO file and remove the entry for the package you updated or removed, in
7988: case it was mentioned there.
7989:
7990: When the PKGREVISION of a package is bumped, the change should appear in pkgsrc
7991: /doc/CHANGES-YYYY if it is security related or otherwise relevant. Mass bumps
7992: that result from a dependency being updated should not be mentioned. In all
7993: other cases it's the developer's decision.
7994:
7995: There is a make target that helps in creating proper CHANGES-YYYY entries: make
7996: changes-entry. It uses the optional CTYPE and NETBSD_LOGIN_NAME variables. The
7997: general usage is to first make sure that your CHANGES-YYYY file is up-to-date
7998: (to avoid having to resolve conflicts later-on) and then to cd to the package
7999: directory. For package updates, make changes-entry is enough. For new packages,
8000: or package moves or removals, set the CTYPE variable on the command line to
1.4 rillig 8001: "Added", "Moved", or "Removed". You can set NETBSD_LOGIN_NAME in mk.conf if
1.23 jakllsch 8002: your local login name is not the same as your NetBSD login name. The target
8003: also automatically removes possibly existing entries for the package in the
8004: TODO file. Don't forget to commit the changes, e.g. by using make
1.66 asau 8005: commit-changes-entry! If you are not using a checkout directly from
1.23 jakllsch 8006: cvs.NetBSD.org, but e.g. a local copy of the repository, you can set
8007: USE_NETBSD_REPO=yes. This makes the cvs commands use the main repository.
1.1 dsieger 8008:
1.154 rillig 8009: 23.4. Commit Messages
1.130 wiz 8010:
8011: For several years, there have been mirrors of pkgsrc in fossil, git, and hg.
1.257 jkoshy 8012: Standard practice when using these tools is to make the first line of a commit
1.130 wiz 8013: message function as a summary that can be read without the rest, such as is
8014: commonly done with "git log --oneline". For this reason, we have the following
8015: guidelines for pkgsrc commit messages:
8016:
1.131 wiz 8017: * Start the commit message with a line that explains the big picture in 65
1.130 wiz 8018: characters or less. When a commit is for one package, include the name of
8019: the package. For updates, include the version to which it is updated.
8020:
8021: * Leave the next line empty.
8022:
8023: * Then come the details for the commit (changes in that package, reason for a
8024: change) and any relevant PRs. Wrap this section.
8025:
8026: Here is an example:
8027:
1.238 wiz 8028: libxslt: update to 1.0.30
1.130 wiz 8029:
1.238 wiz 8030: Changes since 1.0.29:
8031: ...
1.130 wiz 8032:
8033: Here is another example:
8034:
1.238 wiz 8035: mk/bsd.pkg.mk: enable SSP by default on NetBSD
1.130 wiz 8036:
1.238 wiz 8037: (rationale)
1.130 wiz 8038:
8039: Commit messages are final: no "cvs admin" is allowed on the pkgsrc repository
8040: to change commit messages.
8041:
1.154 rillig 8042: 23.5. Committing: Adding a package to CVS
1.1 dsieger 8043:
8044: This section is only of interest for pkgsrc developers with write access to the
1.34 wiz 8045: pkgsrc repository.
8046:
8047: When the package is finished, "cvs add" the files. Start by adding the
8048: directory and then files in the directory. Don't forget to add the new package
8049: to the category's Makefile. Make sure you don't forget any files; you can check
8050: by running "cvs status". An example:
8051:
8052: $ cd .../pkgsrc/category
8053: $ cvs add pkgname
8054: $ cd pkgname
8055: $ cvs add DESCR Makefile PLIST distinfo buildlink3.mk patches
8056: $ cvs add patches/p*
8057: $ cvs status | less
1.35 wiz 8058: $ cvs commit
1.34 wiz 8059: $ cd ..
1.236 gutterid 8060: $ vi Makefile # add SUBDIR+=pkgname line
1.35 wiz 8061: $ cvs commit Makefile
1.66 asau 8062: $ cd pkgname
1.73 jnemeth 8063: $ make CTYPE=Added commit-changes-entry
1.1 dsieger 8064:
8065: The commit message of the initial import should include part of the DESCR file,
8066: so people reading the mailing lists know what the package is/does.
8067:
1.34 wiz 8068: Also mention the new package in pkgsrc/doc/CHANGES-20xx.
8069:
8070: Previously, "cvs import" was suggested, but it was much easier to get wrong
8071: than "cvs add".
1.1 dsieger 8072:
1.154 rillig 8073: 23.6. Updating a package to a newer version
1.1 dsieger 8074:
8075: Please always put a concise, appropriate and relevant summary of the changes
8076: between old and new versions into the commit log when updating a package. There
8077: are various reasons for this:
8078:
8079: * A URL is volatile, and can change over time. It may go away completely or
8080: its information may be overwritten by newer information.
8081:
8082: * Having the change information between old and new versions in our CVS
8083: repository is very useful for people who use either cvs or anoncvs.
8084:
8085: * Having the change information between old and new versions in our CVS
8086: repository is very useful for people who read the pkgsrc-changes mailing
8087: list, so that they can make tactical decisions about when to upgrade the
8088: package.
8089:
8090: Please also recognize that, just because a new version of a package has been
8091: released, it should not automatically be upgraded in the CVS repository. We
8092: prefer to be conservative in the packages that are included in pkgsrc -
8093: development or beta packages are not really the best thing for most places in
8094: which pkgsrc is used. Please use your judgement about what should go into
8095: pkgsrc, and bear in mind that stability is to be preferred above new and
8096: possibly untested features.
8097:
1.154 rillig 8098: 23.7. Renaming a package in pkgsrc
1.21 snj 8099:
8100: Renaming packages is not recommended.
8101:
1.175 gutterid 8102: When renaming packages, be sure to fix any references to the old name in other
1.21 snj 8103: Makefiles, options, buildlink files, etc.
8104:
1.175 gutterid 8105: Also, when renaming a package, please add the package name and version pattern
1.167 leot 8106: (s) of the previous package to SUPERSEDES. This may be repeated for multiple
8107: renames. The new package would be an exact replacement. Example:
8108:
8109: SUPERSEDES+= p5-IO-Compress-Zlib<2.017
8110: SUPERSEDES+= optcomp-[0-9]*
1.21 snj 8111:
8112: Note that "successor" in the CHANGES-YYYY file doesn't necessarily mean that it
8113: supersedes, as that successor may not be an exact replacement but is a
8114: suggestion for the replaced functionality.
8115:
1.154 rillig 8116: 23.8. Moving a package in pkgsrc
1.21 snj 8117:
8118: It is preferred that packages are not renamed or moved, but if needed please
8119: follow these steps.
1.1 dsieger 8120:
8121: 1. Make a copy of the directory somewhere else.
8122:
8123: 2. Remove all CVS dirs.
8124:
8125: Alternatively to the first two steps you can also do:
8126:
8127: % cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package
8128:
8129: and use that for further work.
8130:
1.25 wiz 8131: 3. Fix CATEGORIES and any DEPENDS paths that just did "../package" instead of
1.1 dsieger 8132: "../../category/package".
8133:
1.21 snj 8134: 4. In the modified package's Makefile, consider setting PREV_PKGPATH to the
8135: previous category/package pathname. The PREV_PKGPATH can be used by tools
8136: for doing an update using pkgsrc building; for example, it can search the
8137: pkg_summary(5) database for PREV_PKGPATH (if no SUPERSEDES) and then use
8138: the corresponding new PKGPATH for that moved package. Note that it may have
8139: multiple matches, so the tool should also check on the PKGBASE too. The
8140: PREV_PKGPATH probably has no value unless SUPERSEDES is not set, i.e.
8141: PKGBASE stays the same.
8142:
1.237 gutterid 8143: 5. cvs add the modified package in the new place.
1.1 dsieger 8144:
1.21 snj 8145: 6. Check if any package depends on it:
1.1 dsieger 8146:
8147: % cd /usr/pkgsrc
8148: % grep /package */*/Makefile* */*/buildlink*
8149:
1.21 snj 8150: 7. Fix paths in packages from step 5 to point to new location.
1.1 dsieger 8151:
1.21 snj 8152: 8. cvs rm (-f) the package at the old location.
1.1 dsieger 8153:
1.21 snj 8154: 9. Remove from oldcategory/Makefile.
1.1 dsieger 8155:
1.21 snj 8156: 10. Add to newcategory/Makefile.
1.1 dsieger 8157:
1.21 snj 8158: 11. Commit the changed and removed files:
1.1 dsieger 8159:
8160: % cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile
8161:
8162: (and any packages from step 5, of course).
8163:
1.154 rillig 8164: Chapter 24. Frequently Asked Questions
1.1 dsieger 8165:
8166: This section contains the answers to questions that may arise when you are
8167: writing a package. If you don't find your question answered here, first have a
8168: look in the other chapters, and if you still don't have the answer, ask on the
8169: pkgsrc-users mailing list.
8170:
1.154 rillig 8171: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
8172: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
8173: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
1.223 nia 8174: 24.4. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
8175: 24.5. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.259 leot 8176: the := inside it.
1.223 nia 8177: 24.6. Which mailing lists are there for package developers?
8178: 24.7. Where is the pkgsrc documentation?
8179: 24.8. I have a little time to kill. What shall I do?
1.1 dsieger 8180:
1.154 rillig 8181: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
1.1 dsieger 8182:
8183: MAKEFLAGS are the flags passed to the pkgsrc-internal invocations of make
1.223 nia 8184: (1).
8185:
8186: MAKE_FLAGS are the flags that are passed to the MAKE_PROGRAM when
8187: building the package.
8188:
8189: .MAKEFLAGS is an internal variable of bmake and should not be used by
8190: packages.
1.1 dsieger 8191:
1.154 rillig 8192: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
1.1 dsieger 8193:
8194: MAKE is the path to the make(1) program that is used in the pkgsrc
1.223 nia 8195: infrastructure.
8196:
8197: GMAKE is the path to GNU Make, but you need to say USE_TOOLS+=gmake to
8198: use that.
8199:
8200: MAKE_PROGRAM is the path to the Make program that is used for building
8201: the package.
1.1 dsieger 8202:
1.154 rillig 8203: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
1.1 dsieger 8204:
8205: CC is the path to the real C compiler, which can be configured by the
1.223 nia 8206: pkgsrc user.
1.1 dsieger 8207:
1.223 nia 8208: PKG_CC is the path to the compiler wrapper.
1.1 dsieger 8209:
1.223 nia 8210: PKGSRC_COMPILER is not a path to a compiler, but the type of compiler
8211: that should be used. See mk/compiler.mk for more information about the
8212: latter variable.
1.1 dsieger 8213:
1.223 nia 8214: 24.4. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
1.1 dsieger 8215:
1.25 wiz 8216: For optimization reasons, some variables are only available in the "
8217: wrapper" phase and later. To "simulate" the wrapper phase, append
1.1 dsieger 8218: PKG_PHASE=wrapper to the above command.
8219:
1.223 nia 8220: 24.5. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.1 dsieger 8221: the := inside it.
8222:
1.223 nia 8223: The := is not an assignment operator, even though it may look like one.
1.108 rillig 8224: Instead, it is a degenerate form of ${LIST:old_string=new_string}, which
8225: is documented in the make(1) man page and which is commonly used in the
8226: form ${SRCS:.c=.o}. In the case of MASTER_SITE_*, old_string is the empty
8227: string and new_string is package/. That's where the : and the = fall
8228: together.
1.1 dsieger 8229:
1.223 nia 8230: 24.6. Which mailing lists are there for package developers?
1.1 dsieger 8231:
8232: tech-pkg
8233:
8234: This is a list for technical discussions related to pkgsrc
8235: development, e.g. soliciting feedback for changes to pkgsrc
8236: infrastructure, proposed new features, questions related to porting
8237: pkgsrc to a new platform, advice for maintaining a package, patches
8238: that affect many packages, help requests moved from pkgsrc-users when
8239: an infrastructure bug is found, etc.
8240:
8241: pkgsrc-bugs
8242:
8243: All bug reports in category "pkg" sent with send-pr(1) appear here.
8244: Please do not report your bugs here directly; use one of the other
8245: mailing lists.
1.259 leot 8246:
1.223 nia 8247: 24.7. Where is the pkgsrc documentation?
1.1 dsieger 8248:
8249: There are many places where you can find documentation about pkgsrc:
8250:
8251: * The pkgsrc guide (this document) is a collection of chapters that
8252: explain large parts of pkgsrc, but some chapters tend to be outdated.
8253: Which ones they are is hard to say.
8254:
1.174 leot 8255: * On the mailing list archives (see https://mail-index.NetBSD.org/),
8256: you can find discussions about certain features, announcements of new
1.1 dsieger 8257: parts of the pkgsrc infrastructure and sometimes even announcements
8258: that a certain feature has been marked as obsolete. The benefit here
8259: is that each message has a date appended to it.
8260:
8261: * Many of the files in the mk/ directory start with a comment that
8262: describes the purpose of the file and how it can be used by the
8263: pkgsrc user and package authors. An easy way to find this
8264: documentation is to run bmake help.
8265:
8266: * The CVS log messages are a rich source of information, but they tend
8267: to be highly abbreviated, especially for actions that occur often.
8268: Some contain a detailed description of what has changed, but they are
8269: geared towards the other pkgsrc developers, not towards an average
8270: pkgsrc user. They also only document changes, so if you don't know
8271: what has been before, these messages may not be worth too much to
8272: you.
8273:
8274: * Some parts of pkgsrc are only "implicitly documented", that is the
8275: documentation exists only in the mind of the developer who wrote the
8276: code. To get this information, use the cvs annotate command to see
8277: who has written it and ask on the tech-pkg mailing list, so that
8278: others can find your questions later (see above). To be sure that the
8279: developer in charge reads the mail, you may CC him or her.
8280:
1.223 nia 8281: 24.8. I have a little time to kill. What shall I do?
1.1 dsieger 8282:
8283: This is not really an FAQ yet, but here's the answer anyway.
8284:
8285: * Run pkg_chk -N (from the pkgtools/pkg_chk package). It will tell you
8286: about newer versions of installed packages that are available, but
8287: not yet updated in pkgsrc.
8288:
1.198 leot 8289: * Browse pkgsrc/doc/TODO -- it contains a list of suggested new
8290: packages and a list of cleanups and enhancements for pkgsrc that
8291: would be nice to have.
1.1 dsieger 8292:
1.71 wiz 8293: * Review packages for which review was requested on the tech-pkg
8294: mailing list.
1.1 dsieger 8295:
8296: Part III. The pkgsrc infrastructure internals
8297:
8298: This part of the guide deals with everything from the infrastructure that is
8299: behind the interfaces described in the developer's guide. A casual package
8300: maintainer should not need anything from this part.
8301:
8302: Table of Contents
8303:
1.184 rillig 8304: 25. Design of the pkgsrc infrastructure
8305: 25.1. The meaning of variable definitions
8306: 25.2. Avoiding problems before they arise
8307: 25.3. Variable evaluation
8308: 25.3.1. At load time
8309: 25.3.2. At runtime
8310: 25.4. How can variables be specified?
8311: 25.5. Designing interfaces for Makefile fragments
8312: 25.5.1. Procedures with parameters
8313: 25.5.2. Actions taken on behalf of parameters
8314: 25.6. The order in which files are loaded
8315: 25.6.1. The order in bsd.prefs.mk
8316: 25.6.2. The order in bsd.pkg.mk
8317: 26. Regression tests
8318: 26.1. Running the regression tests
8319: 26.2. Adding a new regression test
8320: 26.2.1. Overridable functions
8321: 26.2.2. Helper functions
8322: 27. Porting pkgsrc
8323: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8324:
1.184 rillig 8325: Chapter 25. Design of the pkgsrc infrastructure
1.1 dsieger 8326:
8327: Table of Contents
8328:
1.184 rillig 8329: 25.1. The meaning of variable definitions
8330: 25.2. Avoiding problems before they arise
8331: 25.3. Variable evaluation
8332: 25.3.1. At load time
8333: 25.3.2. At runtime
8334: 25.4. How can variables be specified?
8335: 25.5. Designing interfaces for Makefile fragments
8336: 25.5.1. Procedures with parameters
8337: 25.5.2. Actions taken on behalf of parameters
8338: 25.6. The order in which files are loaded
8339: 25.6.1. The order in bsd.prefs.mk
8340: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8341:
8342: The pkgsrc infrastructure consists of many small Makefile fragments. Each such
8343: fragment needs a properly specified interface. This chapter explains how such
8344: an interface looks like.
8345:
1.184 rillig 8346: 25.1. The meaning of variable definitions
1.1 dsieger 8347:
8348: Whenever a variable is defined in the pkgsrc infrastructure, the location and
8349: the way of definition provide much information about the intended use of that
8350: variable. Additionally, more documentation may be found in a header comment or
8351: in this pkgsrc guide.
8352:
8353: A special file is mk/defaults/mk.conf, which lists all variables that are
8354: intended to be user-defined. They are either defined using the ?= operator or
8355: they are left undefined because defining them to anything would effectively
8356: mean "yes". All these variables may be overridden by the pkgsrc user in the
8357: MAKECONF file.
8358:
8359: Outside this file, the following conventions apply: Variables that are defined
8360: using the ?= operator may be overridden by a package.
8361:
8362: Variables that are defined using the = operator may be used read-only at
8363: run-time.
8364:
8365: Variables whose name starts with an underscore must not be accessed outside the
8366: pkgsrc infrastructure at all. They may change without further notice.
8367:
8368: Note
8369:
8370: These conventions are currently not applied consistently to the complete pkgsrc
8371: infrastructure.
8372:
1.184 rillig 8373: 25.2. Avoiding problems before they arise
1.1 dsieger 8374:
8375: All variables that contain lists of things should default to being empty. Two
8376: examples that do not follow this rule are USE_LANGUAGES and DISTFILES. These
8377: variables cannot simply be modified using the += operator in package Makefiles
8378: (or other files included by them), since there is no guarantee whether the
8379: variable is already set or not, and what its value is. In the case of
8380: DISTFILES, the packages "know" the default value and just define it as in the
8381: following example.
8382:
8383: DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
8384:
8385: Because of the selection of this default value, the same value appears in many
8386: package Makefiles. Similarly for USE_LANGUAGES, but in this case the default
8387: value ("c") is so short that it doesn't stand out. Nevertheless it is mentioned
8388: in many files.
8389:
1.184 rillig 8390: 25.3. Variable evaluation
1.1 dsieger 8391:
1.184 rillig 8392: 25.3.1. At load time
1.1 dsieger 8393:
8394: Variable evaluation takes place either at load time or at runtime, depending on
8395: the context in which they occur. The contexts where variables are evaluated at
8396: load time are:
8397:
8398: * The right hand side of the := and != operators,
8399:
8400: * Make directives like .if or .for,
8401:
8402: * Dependency lines.
8403:
8404: A special exception are references to the iteration variables of .for loops,
8405: which are expanded inline, no matter in which context they appear.
8406:
8407: As the values of variables may change during load time, care must be taken not
8408: to evaluate them by accident. Typical examples for variables that should not be
8409: evaluated at load time are DEPENDS and CONFIGURE_ARGS. To make the effect more
8410: clear, here is an example:
8411:
8412: CONFIGURE_ARGS= # none
8413: CFLAGS= -O
8414: CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
8415:
8416: CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
8417:
8418: CFLAGS+= -Wall
8419:
8420: This code shows how the use of the := operator can quickly lead to unexpected
8421: results. The first paragraph is fairly common code. The second paragraph
8422: evaluates the CONFIGURE_ARGS variable, which results in CFLAGS=-O. In the third
8423: paragraph, the -Wall is appended to the CFLAGS, but this addition will not
8424: appear in CONFIGURE_ARGS. In actual code, the three paragraphs from above
8425: typically occur in completely unrelated files.
8426:
1.184 rillig 8427: 25.3.2. At runtime
1.1 dsieger 8428:
8429: After all the files have been loaded, the values of the variables cannot be
8430: changed anymore. Variables that are used in the shell commands are expanded at
8431: this point.
8432:
1.184 rillig 8433: 25.4. How can variables be specified?
1.1 dsieger 8434:
8435: There are many ways in which the definition and use of a variable can be
8436: restricted in order to detect bugs and violations of the (mostly unwritten)
1.108 rillig 8437: policies. A package can be checked with pkglint -Wall to see whether it meets
8438: these rules.
1.1 dsieger 8439:
1.184 rillig 8440: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8441:
8442: Most of the .mk files fall into one of the following classes. Cases where a
8443: file falls into more than one class should be avoided as it often leads to
8444: subtle bugs.
8445:
1.184 rillig 8446: 25.5.1. Procedures with parameters
1.1 dsieger 8447:
8448: In a traditional imperative programming language some of the .mk files could be
1.198 leot 8449: described as procedures. They take some input parameters and--after
8450: inclusion--provide a result in output parameters. Since all variables in
1.23 jakllsch 8451: Makefiles have global scope care must be taken not to use parameter names that
8452: have already another meaning. For example, PKGNAME is a bad choice for a
8453: parameter name.
1.1 dsieger 8454:
8455: Procedures are completely evaluated at preprocessing time. That is, when
8456: calling a procedure all input parameters must be completely resolvable. For
8457: example, CONFIGURE_ARGS should never be an input parameter since it is very
8458: likely that further text will be added after calling the procedure, which would
8459: effectively apply the procedure to only a part of the variable. Also,
1.108 rillig 8460: references to other variables will be modified after calling the procedure.
1.1 dsieger 8461:
8462: A procedure can declare its output parameters either as suitable for use in
8463: preprocessing directives or as only available at runtime. The latter
8464: alternative is for variables that contain references to other runtime
8465: variables.
8466:
8467: Procedures shall be written such that it is possible to call the procedure more
8468: than once. That is, the file must not contain multiple-inclusion guards.
8469:
8470: Examples for procedures are mk/bsd.options.mk and mk/buildlink3/bsd.builtin.mk.
8471: To express that the parameters are evaluated at load time, they should be
8472: assigned using the := operator, which should be used only for this purpose.
8473:
1.184 rillig 8474: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8475:
8476: Action files take some input parameters and may define runtime variables. They
8477: shall not define loadtime variables. There are action files that are included
8478: implicitly by the pkgsrc infrastructure, while other must be included
8479: explicitly.
8480:
8481: An example for action files is mk/subst.mk.
8482:
1.184 rillig 8483: 25.6. The order in which files are loaded
1.1 dsieger 8484:
8485: Package Makefiles usually consist of a set of variable definitions, and include
8486: the file ../../mk/bsd.pkg.mk in the very last line. Before that, they may also
8487: include various other *.mk files if they need to query the availability of
8488: certain features like the type of compiler or the X11 implementation. Due to
8489: the heavy use of preprocessor directives like .if and .for, the order in which
8490: the files are loaded matters.
8491:
8492: This section describes at which point the various files are loaded and gives
8493: reasons for that order.
8494:
1.184 rillig 8495: 25.6.1. The order in bsd.prefs.mk
1.1 dsieger 8496:
8497: The very first action in bsd.prefs.mk is to define some essential variables
8498: like OPSYS, OS_VERSION and MACHINE_ARCH.
8499:
1.4 rillig 8500: Then, the user settings are loaded from the file specified in MAKECONF, which
8501: is usually mk.conf. After that, those variables that have not been overridden
8502: by the user are loaded from mk/defaults/mk.conf.
1.1 dsieger 8503:
8504: After the user settings, the system settings and platform settings are loaded,
8505: which may override the user settings.
8506:
8507: Then, the tool definitions are loaded. The tool wrappers are not yet in effect.
8508: This only happens when building a package, so the proper variables must be used
8509: instead of the direct tool names.
8510:
8511: As the last steps, some essential variables from the wrapper and the package
8512: system flavor are loaded, as well as the variables that have been cached in
8513: earlier phases of a package build.
8514:
1.184 rillig 8515: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8516:
8517: First, bsd.prefs.mk is loaded.
8518:
8519: Then, the various *-vars.mk files are loaded, which fill default values for
8520: those variables that have not been defined by the package. These variables may
8521: later be used even in unrelated files.
8522:
8523: Then, the file bsd.pkg.error.mk provides the target error-check that is added
8524: as a special dependency to all other targets that use DELAYED_ERROR_MSG or
8525: DELAYED_WARNING_MSG.
8526:
8527: Then, the package-specific hacks from hacks.mk are included.
8528:
8529: Then, various other files follow. Most of them don't have any dependencies on
8530: what they need to have included before or after them, though some do.
8531:
8532: The code to check PKG_FAIL_REASON and PKG_SKIP_REASON is then executed, which
8533: restricts the use of these variables to all the files that have been included
8534: before. Appearances in later files will be silently ignored.
8535:
8536: Then, the files for the main targets are included, in the order of later
8537: execution, though the actual order should not matter.
8538:
8539: At last, some more files are included that don't set any interesting variables
8540: but rather just define make targets to be executed.
8541:
1.184 rillig 8542: Chapter 26. Regression tests
1.1 dsieger 8543:
8544: Table of Contents
8545:
1.184 rillig 8546: 26.1. Running the regression tests
8547: 26.2. Adding a new regression test
8548: 26.2.1. Overridable functions
8549: 26.2.2. Helper functions
1.1 dsieger 8550:
8551: The pkgsrc infrastructure consists of a large codebase, and there are many
8552: corners where every little bit of a file is well thought out, making pkgsrc
8553: likely to fail as soon as anything is changed near those parts. To prevent most
8554: changes from breaking anything, a suite of regression tests should go along
8555: with every important part of the pkgsrc infrastructure. This chapter describes
8556: how regression tests work in pkgsrc and how you can add new tests.
8557:
1.184 rillig 8558: 26.1. Running the regression tests
1.1 dsieger 8559:
1.25 wiz 8560: You first need to install the pkgtools/pkg_regress package, which provides the
1.1 dsieger 8561: pkg_regress command. Then you can simply run that command, which will run all
1.168 rillig 8562: tests in the regress/ directory.
1.1 dsieger 8563:
1.184 rillig 8564: 26.2. Adding a new regression test
1.1 dsieger 8565:
1.168 rillig 8566: Every directory in the regress/ directory that contains a file called spec is
1.1 dsieger 8567: considered a regression test. This file is a shell program that is included by
8568: the pkg_regress command. The following functions can be overridden to suit your
8569: needs.
8570:
1.184 rillig 8571: 26.2.1. Overridable functions
1.1 dsieger 8572:
1.108 rillig 8573: These functions do not take any parameters. Although they are called in "set -e
1.168 rillig 8574: " mode, they don't stop at the first failing command. See this Stack Overflow
1.108 rillig 8575: question for details.
1.1 dsieger 8576:
1.108 rillig 8577: do_setup
1.1 dsieger 8578:
8579: This function prepares the environment for the test. By default it does
8580: nothing.
8581:
1.108 rillig 8582: do_test
1.1 dsieger 8583:
8584: This function runs the actual test. By default, it calls TEST_MAKE with the
8585: arguments MAKEARGS_TEST and writes its output including error messages into
8586: the file TEST_OUTFILE.
8587:
1.108 rillig 8588: When defining this function, make sure that all output that needs to be
8589: checked is written to the correct output file. Example:
8590:
8591: do_test() {
8592: echo "Example output"
8593: } 1>$TEST_OUTFILE 2>&1
8594:
8595: check_result
1.1 dsieger 8596:
8597: This function is run after the test and is typically used to compare the
8598: actual output from the one that is expected. It can make use of the various
1.108 rillig 8599: helper functions from the next section. Example:
8600:
8601: check_result() {
8602: exit_status 0
8603: output_require "Example"
8604: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
8605: output_prohibit "no such file or directory"
1.169 rillig 8606: regress_fail "expected $expected but got $actual for input $input"
1.108 rillig 8607: }
1.1 dsieger 8608:
1.108 rillig 8609: do_cleanup
1.1 dsieger 8610:
8611: This function cleans everything up after the test has been run. By default
8612: it does nothing.
8613:
1.184 rillig 8614: 26.2.2. Helper functions
1.1 dsieger 8615:
1.168 rillig 8616: regress_fail message...
8617:
8618: This function makes the test fail with the given error message.
8619:
1.108 rillig 8620: exit_status expected
1.1 dsieger 8621:
1.108 rillig 8622: This function compares the exitcode of the do_test function with its first
8623: parameter. If they differ, the test will fail.
1.1 dsieger 8624:
1.108 rillig 8625: output_require regex...
1.1 dsieger 8626:
8627: This function checks for each of its parameters if the output from do_test
1.108 rillig 8628: matches the extended regular expression. If it does not, the test will
8629: fail. Example:
8630:
8631: output_require "looks fine"
8632: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
1.1 dsieger 8633:
1.177 leot 8634: output_prohibit regex...
1.1 dsieger 8635:
8636: This function checks for each of its parameters if the output from do_test
8637: () does not match the extended regular expression. If any of the regular
8638: expressions matches, the test will fail.
8639:
1.184 rillig 8640: Chapter 27. Porting pkgsrc
1.1 dsieger 8641:
8642: Table of Contents
8643:
1.184 rillig 8644: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8645:
8646: The pkgsrc system has already been ported to many operating systems, hardware
8647: architectures and compilers. This chapter explains the necessary steps to make
8648: pkgsrc even more portable.
8649:
1.184 rillig 8650: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8651:
8652: To port pkgsrc to a new operating system (called MyOS in this example), you
8653: need to touch the following files:
8654:
8655: pkgtools/bootstrap-mk-files/files/mods/MyOS.sys.mk
8656:
8657: This file contains some basic definitions, for example the name of the C
8658: compiler.
8659:
8660: mk/bsd.prefs.mk
8661:
1.212 wiz 8662: Insert code that defines the variables OPSYS, OS_VERSION, OPSYS_VERSION,
1.1 dsieger 8663: LOWER_VENDOR, MACHINE_ARCH, OBJECT_FMT, APPEND_ELF, and the other variables
8664: that appear in this file.
8665:
8666: mk/platform/MyOS.mk
8667:
8668: This file contains the platform-specific definitions that are used by
8669: pkgsrc. Start by copying one of the other files and edit it to your needs.
8670:
8671: mk/tools/tools.MyOS.mk
8672:
8673: This file defines the paths to all the tools that are needed by one or the
8674: other package in pkgsrc, as well as by pkgsrc itself. Find out where these
8675: tools are on your platform and add them.
8676:
8677: Now, you should be able to build some basic packages, like lang/perl5, shells/
8678: bash.
8679:
8680: Appendix A. A simple example package: bison
8681:
8682: Table of Contents
8683:
8684: A.1. files
8685: A.1.1. Makefile
8686: A.1.2. DESCR
8687: A.1.3. PLIST
8688: A.1.4. Checking a package with pkglint
8689: A.2. Steps for building, installing, packaging
8690:
8691: We checked to find a piece of software that wasn't in the packages collection,
1.25 wiz 8692: and picked GNU bison. Quite why someone would want to have bison when Berkeley
1.1 dsieger 8693: yacc is already present in the tree is beyond us, but it's useful for the
8694: purposes of this exercise.
8695:
8696: A.1. files
8697:
8698: A.1.1. Makefile
8699:
1.2 rillig 8700: # $NetBSD$
1.1 dsieger 8701: #
8702:
8703: DISTNAME= bison-1.25
8704: CATEGORIES= devel
1.171 rillig 8705: MASTER_SITES= ${MASTER_SITE_GNU:=bison/}
1.1 dsieger 8706:
1.30 dholland 8707: MAINTAINER= pkgsrc-users@NetBSD.org
1.174 leot 8708: HOMEPAGE= https://www.gnu.org/software/bison/bison.html
1.1 dsieger 8709: COMMENT= GNU yacc clone
8710:
8711: GNU_CONFIGURE= yes
1.47 wiz 8712: INFO_FILES= yes
1.1 dsieger 8713:
8714: .include "../../mk/bsd.pkg.mk"
8715:
8716: A.1.2. DESCR
8717:
8718: GNU version of yacc. Can make re-entrant parsers, and numerous other
8719: improvements. Why you would want this when Berkeley yacc(1) is part
8720: of the NetBSD source tree is beyond me.
8721:
8722: A.1.3. PLIST
8723:
1.2 rillig 8724: @comment $NetBSD$
1.1 dsieger 8725: bin/bison
8726: man/man1/bison.1.gz
8727: share/bison.simple
8728: share/bison.hairy
8729:
8730: A.1.4. Checking a package with pkglint
8731:
8732: The NetBSD package system comes with pkgtools/pkglint which helps to check the
8733: contents of these files. After installation it is quite easy to use, just
1.171 rillig 8734: change to the directory of the package you wish to examine and run pkglint:
1.1 dsieger 8735:
8736: $ pkglint
1.171 rillig 8737: ERROR: Makefile: Each package must define its LICENSE.
8738: WARN: Makefile:9: HOMEPAGE should migrate from http to https.
8739: NOTE: PLIST:3: The .gz extension is unnecessary for manual pages.
8740: WARN: PLIST:5: "share/bison.hairy" should be sorted before "share/bison.simple".
8741: 1 error, 2 warnings and 1 note found.
8742: (Run "pkglint -e" to show explanations.)
8743: (Run "pkglint -fs" to show what can be fixed automatically.)
1.172 rillig 8744: (Run "pkglint -F" to automatically fix some issues.)
1.1 dsieger 8745:
8746: Depending on the supplied command line arguments (see pkglint(1)), more checks
1.170 rillig 8747: will be performed. Use e.g. pkglint -Wall for a very thorough check.
1.1 dsieger 8748:
8749: A.2. Steps for building, installing, packaging
8750:
8751: Create the directory where the package lives, plus any auxiliary directories:
8752:
8753: # cd /usr/pkgsrc/lang
8754: # mkdir bison
8755: # cd bison
8756: # mkdir patches
8757:
1.184 rillig 8758: Create Makefile, DESCR and PLIST (see Chapter 12, Package components - files,
1.1 dsieger 8759: directories and contents) then continue with fetching the distfile:
8760:
8761: # make fetch
8762: >> bison-1.25.tar.gz doesn't seem to exist on this system.
8763: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
8764: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8765: ftp: Error retrieving file: 500 Internal error
8766:
8767: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
8768: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8769: ftp: Error retrieving file: 500 Internal error
8770:
8771: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
8772: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8773: Successfully retrieved file.
8774:
8775: Generate the checksum of the distfile into distinfo:
8776:
8777: # make makedistinfo
8778:
8779: Now compile:
8780:
8781: # make
8782: >> Checksum OK for bison-1.25.tar.gz.
8783: ===> Extracting for bison-1.25
8784: ===> Patching for bison-1.25
8785: ===> Ignoring empty patch directory
8786: ===> Configuring for bison-1.25
8787: creating cache ./config.cache
8788: checking for gcc... cc
8789: checking whether we are using GNU C... yes
8790: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
8791: checking how to run the C preprocessor... cc -E
8792: checking for minix/config.h... no
8793: checking for POSIXized ISC... no
8794: checking whether cross-compiling... no
8795: checking for ANSI C header files... yes
8796: checking for string.h... yes
8797: checking for stdlib.h... yes
8798: checking for memory.h... yes
8799: checking for working const... yes
8800: checking for working alloca.h... no
8801: checking for alloca... yes
8802: checking for strerror... yes
8803: updating cache ./config.cache
8804: creating ./config.status
8805: creating Makefile
8806: ===> Building for bison-1.25
8807: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g LR0.c
8808: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g allocate.c
8809: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g closure.c
8810: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g conflicts.c
8811: 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
8812: 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
8813: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getargs.c
8814: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g gram.c
8815: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lalr.c
8816: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lex.c
8817: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g main.c
8818: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g nullable.c
8819: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g output.c
8820: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g print.c
8821: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g reader.c
8822: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g reduce.c
8823: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g symtab.c
8824: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g warshall.c
8825: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g version.c
8826: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getopt.c
8827: 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
8828: 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
8829: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
8830: rm -f bison.s1
8831: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
8832:
8833: Everything seems OK, so install the files:
8834:
8835: # make install
8836: >> Checksum OK for bison-1.25.tar.gz.
8837: ===> Installing for bison-1.25
8838: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
8839: rm -f /usr/pkg/bin/bison
8840: cd /usr/pkg/share; rm -f bison.simple bison.hairy
8841: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
8842: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
8843: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
8844: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
8845: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
8846: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
8847: ===> Registering installation for bison-1.25
8848:
8849: You can now use bison, and also - if you decide so - remove it with pkg_delete
8850: bison. Should you decide that you want a binary package, do this now:
8851:
8852: # make package
8853: >> Checksum OK for bison-1.25.tar.gz.
8854: ===> Building package for bison-1.25
8855: Creating package bison-1.25.tgz
8856: Registering depends:.
8857: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
8858:
8859: Now that you don't need the source and object files any more, clean up:
8860:
8861: # make clean
8862: ===> Cleaning for bison-1.25
8863:
1.207 leot 8864: Appendix B. Security hardening
8865:
8866: Table of Contents
8867:
8868: B.1. Mechanisms
8869: B.1.1. Enabled by default
8870: B.1.2. Not enabled by default
8871: B.2. Caveats
8872: B.2.1. Problems with PKGSRC_MKPIE
8873: B.2.2. Problems with PKGSRC_USE_FORTIFY
8874: B.2.3. Problems with PKGSRC_USE_RELRO
8875: B.2.4. Problems with PKGSRC_USE_SSP
8876: B.3. Auditing the system
8877: B.3.1. Checking for PIE
8878: B.3.2. Checking for partial RELRO
8879: B.3.3. Checking for full RELRO
8880: B.3.4. Checking for SSP
8881:
8882: A number of mechanisms are available in pkgsrc to improve the security of the
8883: resulting system. This page describes the mechanisms, and gives hints about
8884: detecting and fixing problems.
8885:
8886: Mechanisms can be enabled individually in mk.conf, and are individually
8887: described below.
8888:
8889: Typically, a feature will cause some programs to fail to build or work when
8890: first enabled. This can be due to latent problems in the program, and can be
8891: due to other reasons. After enough testing to have confidence that user
8892: problems will be quite rare, individual mechanisms will be enabled by default.
8893:
8894: For each mechanism, see the Caveats section below for an explanation of what
8895: might go wrong at compile time and at run time, and how to notice and address
8896: these problems.
8897:
8898: B.1. Mechanisms
8899:
8900: B.1.1. Enabled by default
8901:
8902: B.1.1.1. PKGSRC_USE_FORTIFY
8903:
8904: This allows substitute wrappers to be used for some commonly used library
8905: functions that do not have built-in bounds checking - but could in some cases.
8906:
8907: Two mitigation levels are available:
8908:
8909: * "weak" only enables checks at compile-time.
8910:
8911: * "strong" enables checks at compile-time and runtime.
8912:
8913: "strong" has been enabled by default since pkgsrc-2017Q3.
8914:
8915: B.1.1.2. PKGSRC_USE_SSP
8916:
8917: This enables a stack-smashing protection mitigation. It is done by adding a
8918: guard variable to functions with vulnerable objects. The guards are initialized
8919: when a function is entered and then checked when the function exits. The guard
8920: check will fail and the program forcibly exited if the variable was modified in
8921: the meantime. This can happen in case of buffer overflows or memory corruption,
8922: and therefore exposing these bugs.
8923:
8924: Different mitigation levels are available:
8925:
8926: * "yes", which will only protect functions considered vulnerable by the
8927: compiler;
8928:
8929: * "all", which will protect every function;
8930:
8931: * "strong", the default, which will apply a better balance between the two
8932: settings above.
8933:
8934: This mitigation is supported by both GCC and clang. It may be supported in
8935: additional compilers, possibly under a different name. It is particularly
8936: useful for unsafe programming languages, such as C/C++.
8937:
8938: * "yes" is enabled by default where known supported since pkgsrc-2017Q3.
8939:
8940: * "strong" is enabled by default where known supported since pkgsrc-2021Q4.
8941:
8942: More details can be found here:
8943:
8944: * Buffer overflow protection on Wikipedia
8945:
8946: B.1.1.3. PKGSRC_MKPIE
8947:
8948: This requests the creation of PIE (Position Independent Executables) for all
8949: executables. The PIE mechanism is normally used for shared libraries, so that
8950: they can be loaded at differing addresses at runtime. PIE itself does not have
8951: useful security properties; however, it is necessary to fully leverage some,
8952: such as ASLR. Some operating systems support Address Space Layout Randomization
8953: (ASLR), which causes different addresses to be used each time a program is run.
8954: This makes it more difficult for an attacker to guess addresses and thus makes
8955: exploits harder to construct. With PIE, ASLR can really be applied to the
8956: entire program, instead of the stack and heap only.
8957:
8958: PIE executables will only be built for toolchains that are known to support
8959: PIE. Currently, this means NetBSD on x86, ARM, SPARC64, m68k, and MIPS.
8960:
8961: PKGSRC_MKPIE was enabled by default after the pkgsrc-2021Q3 branch.
8962:
1.219 nia 8963: B.1.1.4. PKGSRC_USE_RELRO
1.207 leot 8964:
8965: This also makes the exploitation of some security vulnerabilities more
8966: difficult in some cases.
8967:
8968: Two different mitigation levels are available:
8969:
1.219 nia 8970: * partial (the default): the ELF sections are reordered so that internal data
8971: sections precede the program's own data sections, and non-PLT GOT is
8972: read-only;
1.207 leot 8973:
8974: * full: in addition to partial RELRO, every relocation is performed
1.218 nia 8975: immediately when starting the program, allowing the entire GOT to be
8976: read-only. This can greatly slow down startup of large programs.
1.207 leot 8977:
8978: This is currently supported by GCC. Many software distributions now enable this
1.220 nia 8979: feature by default, at the "partial" level.
1.207 leot 8980:
8981: More details can be found here:
8982:
8983: * Hardening ELF binaries using Relocation Read-Only (RELRO)
8984:
1.219 nia 8985: B.1.2. Not enabled by default
8986:
8987: B.1.2.1. PKGSRC_MKREPRO
8988:
8989: With this option, pkgsrc will try to build packages reproducibly. This allows
8990: packages built from the same tree and with the same options, to produce
8991: identical results bit by bit. This option should be combined with ASLR and
8992: PKGSRC_MKPIE to avoid predictable address offsets for attackers attempting to
8993: exploit security vulnerabilities.
8994:
8995: More details can be found here:
8996:
8997: * Reproducible Builds - a set of software development practices that create
8998: an independently-verifiable path from source to binary code
8999:
9000: More work likely needs to be done before pkgsrc is fully reproducible.
9001:
9002: B.1.2.2. PKGSRC_USE_STACK_CHECK
1.207 leot 9003:
9004: This uses -fstack-check with GCC for another stack protection mitigation.
9005:
9006: It asks the compiler to generate code verifying that it does not corrupt the
9007: stack. According to GCC's manual page, this is really only useful for
9008: multi-threaded programs.
9009:
9010: B.2. Caveats
9011:
9012: B.2.1. Problems with PKGSRC_MKPIE
9013:
9014: B.2.1.1. Packages failing to build
9015:
9016: A number of packages may fail to build with this option enabled. The failures
9017: are often related to the absence of the -fPIC compilation flag when building
9018: libraries or executables (or ideally -fPIE in the latter case). This flag is
9019: added to the CFLAGS already, but requires the package to actually support it.
9020:
9021: B.2.1.1.1. How to fix
9022:
9023: These instructions are meant as a reference only; they likely need to be
9024: adapted for many packages individually.
9025:
9026: For packages using Makefiles:
9027:
9028: MAKE_FLAGS+= CFLAGS=${CFLAGS:Q}
9029: MAKE_FLAGS+= LDFLAGS=${LDFLAGS:Q}
9030:
9031: For packages using Imakefiles:
9032:
9033: MAKE_FLAGS+= CCOPTIONS=${CFLAGS:Q}
9034: MAKE_FLAGS+= LOCAL_LDFLAGS=${LDFLAGS:Q}
9035:
9036: B.2.1.2. Run-time crashes
9037:
9038: Some programs may fail to run, or crash at random times once built as PIE. Two
9039: scenarios are essentially possible. This is nearly always due to a bug in the
9040: program being exposed due to ASLR.
9041:
9042: B.2.1.3. Disabling PKGSRC_MKPIE on a per-package basis
9043:
9044: Ideally, packages should be fixed for compatibility with MKPIE. However, in
9045: some cases this is very difficult, due to complex build systems, packages using
9046: non-standard toolchains, or programming languages with odd bootstrapping
9047: mechanisms.
9048:
9049: To disable PKGSRC_MKPIE on a per-package basis, set MKPIE_SUPPORTED= no in the
9050: package's Makefile before bsd.prefs.mk is included.
9051:
9052: B.2.2. Problems with PKGSRC_USE_FORTIFY
9053:
9054: B.2.2.1. Packages failing to build
9055:
9056: This feature makes use of pre-processing directives to look for hardened,
9057: alternative implementations of essential library calls. Some programs may fail
9058: to build as a result; this usually happens for those trying too hard to be
9059: portable, or otherwise abusing definitions in the standard library.
9060:
9061: B.2.2.2. Run-time crashes
9062:
9063: This feature may cause some programs to crash, usually indicating an actual bug
9064: in the program. The fix will typically involve patching the original program's
9065: source code.
9066:
9067: B.2.2.3. Optimization is required
9068:
9069: At least in the case of GCC, FORTIFY will only be applied if optimization is
9070: applied while compiling. This means that the CFLAGS should also contain -O, -O2
9071: or another optimization level. This cannot easily be applied globally, as some
9072: packages may require specific optimization levels.
9073:
9074: B.2.2.4. Disabling FORTIFY on a per-package basis
9075:
9076: Note
9077:
9078: FORTIFY should not be disabled to work around runtime crashes in the program!
9079: This is a very bad idea and will expose you to security vulnerabilities.
9080:
9081: To disable FORTIFY on a per-package basis, set the following in the package's
9082: Makefile before bsd.prefs.mk is included:
9083:
9084: FORTIFY_SUPPORTED= no
9085:
9086: B.2.3. Problems with PKGSRC_USE_RELRO
9087:
9088: B.2.3.1. Performance impact
9089:
9090: For better protection, full RELRO requires every symbol to be resolved when the
9091: program starts, rather than simply when required at run-time. This will have
9092: more impact on programs using a lot of symbols, or linked to libraries exposing
9093: a lot of symbols. Therefore, daemons or programs otherwise running in
9094: background are affected only when started. Programs loading plug-ins at
9095: run-time are affected when loading the plug-ins.
9096:
9097: The impact is not expected to be noticeable on modern hardware, except in some
9098: cases for big programs.
9099:
9100: B.2.3.2. Run-time crashes
9101:
9102: Some programs handle plug-ins and dependencies in a way that conflicts with
9103: RELRO: for instance, with an initialization routine listing any other plug-in
9104: required. With full RELRO, the missing symbols are resolved before the
9105: initialization routine can run, and the dynamic loader will not be able to find
9106: them directly and abort as a result. Unfortunately, this is how Xorg loads its
9107: drivers. Partial RELRO can be applied instead in this case.
9108:
9109: B.2.3.3. Disabling RELRO on a per-package basis
9110:
9111: To disable RELRO on a per-package basis, set the following in the package's
9112: Makefile before bsd.prefs.mk is included:
9113:
9114: RELRO_SUPPORTED= no
9115:
1.209 nia 9116: It is also possible to at most enable partial RELRO, by setting RELRO_SUPPORTED
9117: to partial.
9118:
1.207 leot 9119: B.2.4. Problems with PKGSRC_USE_SSP
9120:
9121: B.2.4.1. Packages failing to build
9122:
9123: The stack-smashing protection provided by this option does not work for some
9124: programs. The most common situation in which this happens is when the program
9125: allocates variables on the stack, with the size determined at run-time.
9126:
9127: B.2.4.2. Run-time crashes
9128:
9129: Again, this feature may cause some programs to crash via a SIGABRT, usually
9130: indicating an actual bug in the program.
9131:
9132: On NetBSD LOG_CRIT level syslog messages are sent and - by default - appended
9133: to /var/log/messages, e.g.:
9134:
9135: Jan 6 15:42:51 hostname -: hostname program - - - buffer overflow detected; terminated
9136:
9137: (where hostname is the hostname(1) and program is the basename(1) of the
9138: program crashed).
9139:
9140: Patching the original program is then required.
9141:
9142: Rebuilding the package via:
9143:
9144: % env CFLAGS=-g INSTALL_UNSTRIPPED=yes make replace
9145:
9146: and inspecting the backtrace of the coredump via the debugger should point out
9147: the problematic call by inspecting the frame calling the _chk() (SSP) function.
9148:
9149: B.2.4.3. Performance impact
9150:
9151: The compiler emits extra code when using this feature: a check for buffer
9152: overflows is performed when entering and exiting functions, requiring an extra
9153: variable on the stack. The level of protection can otherwise be adjusted to
9154: affect only those functions considered more sensitive by the compiler (with
9155: -fstack-protector instead of -fstack-protector-all).
9156:
9157: The impact is not expected to be noticeable on modern hardware. However,
9158: programs with a hard requirement to run at the fastest possible speed should
9159: avoid using this feature, or using libraries built with this feature.
9160:
9161: B.2.4.4. Disabling SSP on a per-package basis
9162:
9163: Note
9164:
9165: SSP should not be disabled to work around runtime crashes in the program! This
9166: is a very bad idea and will expose you to security vulnerabilities.
9167:
9168: To disable SSP on a per-package basis, set the following in the package's
9169: Makefile before bsd.prefs.mk is included:
9170:
9171: SSP_SUPPORTED= no
9172:
9173: B.3. Auditing the system
9174:
9175: The illusion of security is worse than having no security at all. This section
9176: lists a number of ways to ensure the security features requested are actually
9177: effective.
9178:
9179: These instructions were obtained and tested on a system derived from NetBSD 7
9180: (amd64). YMMV.
9181:
9182: B.3.1. Checking for PIE
9183:
9184: The ELF executable type in use changes for binaries built as PIE; without:
9185:
9186: $ file /path/to/bin/ary
9187: /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
9188:
9189: as opposed to the following binary, built as PIE:
9190:
9191: $ file /path/to/pie/bin/ary
9192: /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
9193:
9194: The latter result is then what is expected.
9195:
9196: B.3.2. Checking for partial RELRO
9197:
9198: The following command should list a section called RELRO:
9199:
9200: $ objdump -p /path/to/bin/ary
9201:
9202: /path/to/bin/ary: file format elf64-x86-64
9203:
9204: Program Header:
9205: [...]
9206: RELRO off 0x0000000000000d78 vaddr 0x0000000000600d78 paddr 0x0000000000600d78 align 2**0
9207:
9208: This check is now performed automatically if PKG_DEVELOPER is set and RELRO is
9209: enabled.
9210:
9211: B.3.3. Checking for full RELRO
9212:
9213: The dynamic loader will apply RELRO immediately when detecting the presence of
9214: the BIND_NOW flag:
9215:
9216: $ objdump -x /path/to/bin/ary
9217:
9218: /path/to/bin/ary: file format elf64-x86-64
9219:
9220: Dynamic Section:
9221: [...]
9222: BIND_NOW 0x0000000000000000
9223:
9224: This has to be combined with partial RELRO (see above) to be fully efficient.
9225:
9226: This check is now performed automatically (where supported) if PKG_DEVELOPER is
9227: set.
9228:
9229: B.3.4. Checking for SSP
9230:
1.208 nia 9231: Note
9232:
9233: Checking for SSP using this method only works where the operating system uses
9234: libssp. libssp is not used on recent NetBSD/FreeBSD/Linux versions.
9235:
1.207 leot 9236: Building objects, binaries and libraries with SSP will affect the presence of
9237: additional symbols in the resulting file:
9238:
9239: $ nm /path/to/bin/ary
9240: [...]
9241: U __stack_chk_fail
9242: 0000000000600ea0 B __stack_chk_guard
9243:
9244: This is an indicator that the program was indeed built with support for SSP.
9245:
9246: This check is now performed automatically (where supported) if PKG_DEVELOPER is
9247: set and SSP is enabled.
9248:
9249: Appendix C. Build logs
1.1 dsieger 9250:
9251: Table of Contents
9252:
1.207 leot 9253: C.1. Building figlet
9254: C.2. Packaging figlet
1.1 dsieger 9255:
1.207 leot 9256: C.1. Building figlet
1.1 dsieger 9257:
9258: # make
9259: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9260: => figlet221.tar.gz doesn't seem to exist on this system.
9261: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
9262: => [172219 bytes]
9263: Connected to ftp.plig.net.
9264: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
9265: 331 Guest login ok, send your complete e-mail address as password.
9266: 230-You are user #5 of 500 simultaneous users allowed.
9267: 230-
9268: 230- ___ _ _ _
9269: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
9270: 230- | _| _| . |_| . | | | . |_| . | _| . |
9271: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
9272: 230- |_| |_| |___| |___|
9273: 230-
9274: 230-** Welcome to ftp.plig.org **
9275: 230-
9276: 230-Please note that all transfers from this FTP site are logged. If you
9277: 230-do not like this, please disconnect now.
9278: 230-
1.19 snj 9279: 230-This archive is available via
1.1 dsieger 9280: 230-
9281: 230-HTTP: http://ftp.plig.org/
9282: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
9283: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
9284: 230-
9285: 230-Please email comments, bug reports and requests for packages to be
9286: 230-mirrored to ftp-admin@plig.org.
9287: 230-
9288: 230-
9289: 230 Logged in anonymously.
9290: Remote system type is UNIX.
9291: Using binary mode to transfer files.
9292: 200 Type okay.
9293: 250 "/pub" is new cwd.
9294: 250-"/pub/figlet" is new cwd.
9295: 250-
9296: 250-Welcome to the figlet archive at ftp.figlet.org
9297: 250-
9298: 250- ftp://ftp.figlet.org/pub/figlet/
9299: 250-
9300: 250-The official FIGlet web page is:
9301: 250- http://www.figlet.org/
9302: 250-
9303: 250-If you have questions, please mailto:info@figlet.org. If you want to
9304: 250-contribute a font or something else, you can email us.
9305: 250
9306: 250 "/pub/figlet/program" is new cwd.
9307: 250 "/pub/figlet/program/unix" is new cwd.
9308: local: figlet221.tar.gz remote: figlet221.tar.gz
9309: 502 Unimplemented command.
9310: 227 Entering Passive Mode (195,40,6,41,246,104)
9311: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
9312: 38% |************** | 65800 64.16 KB/s 00:01 ETA
9313: 226 Transfer completed.
9314: 172219 bytes received in 00:02 (75.99 KB/s)
9315: 221 Goodbye.
9316: => Checksum OK for figlet221.tar.gz.
9317: ===> Extracting for figlet-2.2.1nb2
9318: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
9319: ===> Patching for figlet-2.2.1nb2
9320: ===> Applying pkgsrc patches for figlet-2.2.1nb2
9321: ===> Overriding tools for figlet-2.2.1nb2
9322: ===> Creating toolchain wrappers for figlet-2.2.1nb2
9323: ===> Configuring for figlet-2.2.1nb2
9324: ===> Building for figlet-2.2.1nb2
9325: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
9326: chmod a+x figlet
9327: gcc -O2 -o chkfont chkfont.c
9328: => Unwrapping files-to-be-installed.
9329: #
9330: # make install
9331: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9332: ===> Installing for figlet-2.2.1nb2
9333: install -d -o root -g wheel -m 755 /usr/pkg/bin
9334: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
9335: mkdir -p /usr/pkg/share/figlet
9336: cp figlet /usr/pkg/bin
9337: cp chkfont /usr/pkg/bin
9338: chmod 555 figlist showfigfonts
9339: cp figlist /usr/pkg/bin
9340: cp showfigfonts /usr/pkg/bin
9341: cp fonts/*.flf /usr/pkg/share/figlet
9342: cp fonts/*.flc /usr/pkg/share/figlet
9343: cp figlet.6 /usr/pkg/man/man6
9344: ===> Registering installation for figlet-2.2.1nb2
9345: #
9346:
1.207 leot 9347: C.2. Packaging figlet
1.1 dsieger 9348:
9349: # make package
9350: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9351: ===> Packaging figlet-2.2.1nb2
9352: ===> Building binary package for figlet-2.2.1nb2
9353: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
9354: Using SrcDir value of /usr/pkg
9355: Registering depends:.
9356: #
9357:
1.207 leot 9358: Appendix D. Directory layout of the pkgsrc FTP server
1.1 dsieger 9359:
9360: Table of Contents
9361:
1.207 leot 9362: D.1. distfiles: The distributed source files
9363: D.2. misc: Miscellaneous things
9364: D.3. packages: Binary packages
9365: D.4. reports: Bulk build reports
9366: D.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 9367:
9368: As in other big projects, the directory layout of pkgsrc is quite complex for
9369: newbies. This chapter explains where you find things on the FTP server. The
9370: base directory on ftp.NetBSD.org is /pub/pkgsrc/. On other servers it may be
9371: different, but inside this directory, everything should look the same, no
9372: matter on which server you are. This directory contains some subdirectories,
9373: which are explained below.
9374:
1.207 leot 9375: D.1. distfiles: The distributed source files
1.1 dsieger 9376:
9377: The directory distfiles contains lots of archive files from all pkgsrc
9378: packages, which are mirrored here. The subdirectories are called after their
9379: package names and are used when the distributed files have names that don't
9380: explicitly contain a version number or are otherwise too generic (for example
9381: release.tar.gz).
9382:
1.207 leot 9383: D.2. misc: Miscellaneous things
1.1 dsieger 9384:
9385: This directory contains things that individual pkgsrc developers find worth
9386: publishing.
9387:
1.207 leot 9388: D.3. packages: Binary packages
1.1 dsieger 9389:
1.3 rillig 9390: This directory contains binary packages for the various platforms that are
9391: supported by pkgsrc. Each subdirectory is of the form OPSYS/ARCH/OSVERSION_TAG.
9392: The meaning of these variables is:
9393:
9394: * OPSYS is the name of the operating system for which the packages have been
1.9 rillig 9395: built. The name is taken from the output of the uname command, so it may
9396: differ from the one you are used to hear.
1.3 rillig 9397:
1.8 rillig 9398: * ARCH is the hardware architecture of the platform for which the packages
1.10 hubertf 9399: have been built. It also includes the ABI (Application Binary Interface)
9400: for platforms that have several of them.
1.3 rillig 9401:
1.255 wiz 9402: * OSVERSION is the version of the operating system. Typically it is the
9403: version defining an ABI, e.g. 9.0.
9404:
9405: * TAG is either 20YYQN for a stable branch, or current for packages built
9406: from the HEAD branch. The latter should only be used when the packages are
9407: updated on a regular basis.
9408:
9409: The rationale for this scheme is that users can first search by OPSYS and ARCH,
9410: since these are more or less unchangeable. After that, there is a management
9411: set of directories with OSVERSION and TAG.
9412:
9413: See also README.md in packages for more details, including about symlinks.
1.3 rillig 9414:
9415: In each of these directories, there is a whole binary packages collection for a
9416: specific platform. It has a directory called All which contains all binary
1.255 wiz 9417: packages.
1.1 dsieger 9418:
1.207 leot 9419: D.4. reports: Bulk build reports
1.8 rillig 9420:
9421: Here are the reports from bulk builds, for those who want to fix packages that
9422: didn't build on some of the platforms. The structure of subdirectories should
1.207 leot 9423: look like the one in Section D.3, "packages: Binary packages".
1.8 rillig 9424:
1.207 leot 9425: D.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 9426:
9427: These directories contain the "real" pkgsrc, that is the files that define how
9428: to create binary packages from source archives.
9429:
1.149 leot 9430: Each of the current, stable and pkgsrc-20xxQy directories share the same
9431: structure. They each contain a pkgsrc directory and pkgsrc.tar.{bz,gz,xz} file.
9432:
1.1 dsieger 9433: The directory pkgsrc contains a snapshot of the CVS repository, which is
1.149 leot 9434: updated regularly. The file pkgsrc.tar.{bz,gz,xz} contains the same as the
9435: directory, ready to be downloaded as a whole.
1.1 dsieger 9436:
1.149 leot 9437: The current directory contains files related to the HEAD branch of the CVS
9438: repository. In this directory there is an additional file called
9439: pkgsrc-readmes.tar.{bz,gz,xz} that contains all pkgsrc READMEs with information
9440: about categories and packages.
9441:
9442: The stable directory is a symlink to the latest pkgsrc-20xxQy.
9443:
9444: The pkgsrc-20xxQy. directories contain files related to the -20xxQy stable
9445: branch of the CVS repository. In these directories there is an additional file
9446: called pkgsrc-20xxQy.tar.{bz,gz,xz}, which contains the state of pkgsrc when it
9447: was branched.
1.148 leot 9448:
1.207 leot 9449: Appendix E. Help topics
1.154 rillig 9450:
9451: The following list contains all help topics that are available when running
9452: bmake help topic=:index.
9453:
1.260 wiz 9454: #! -lintl
9455: 32bit 64bit
9456: ABI ACCEPTABLE_LICENSES
9457: ACROREAD_FONTPATH ADDITIONAL
9458: AFAIK AIX
9459: ALLOW_NETWORK_ACCESS ALLOW_NEWER_COMPILER
9460: ALLOW_VULNERABLE_PACKAGES ALL_ENV
9461: ALSA_PC ALTERNATIVES_SRC
9462: AMANDA_TMP AMANDA_USER
9463: AMANDA_VAR APACHE_GROUP
9464: APACHE_MODULE_NAME APACHE_MODULE_SRC
9465: APACHE_MODULE_SRCDIR APACHE_PKG_PREFIX
9466: APACHE_SUEXEC_CONFIGURE_ARGS APACHE_SUEXEC_DOCROOT
9467: APACHE_USER ARGMAX_REQ
9468: ARG_MAX ARLA_CACHE
9469: AUDIT_PACKAGES_FLAGS AUTOCONF_REQD
9470: AUTOMAKE_OVERRIDE AUTOMAKE_REQD
9471: AUTO_MKDIRS AUX
9472: BDB185_DEFAULT BDBBASE
9473: BDB_ACCEPTED BDB_DEFAULT
9474: BDB_LIBS BDB_TYPE
9475: BINCIMAP_GROUP BINCIMAP_LOG_USER
9476: BINCIMAP_USER BIND_DIR
9477: BIND_GROUP BIND_USER
9478: BINOWN BINPKG_SITES
9479: BIN_INSTALL_FLAGS BISON_PKGDATADIR
9480: BLAS BLAS_ACCEPTED
9481: BLAS_C_INTERFACE BLAS_INCLUDES
9482: BLAS_INDEX64 BLAS_LIBS
9483: BLAS_PC BLAS_TYPE
9484: BOOTSTRAP_DEPENDS BROKEN
9485: BROKEN_EXCEPT_ON_PLATFORM BROKEN_ON_PLATFORM
9486: BSDSRCDIR BSDXSRCDIR
9487: BSD_MAKE_ENV BUILDLINK_AUTO_DIRS
9488: BUILDLINK_AUTO_VARS BUILDLINK_CFLAGS
9489: BUILDLINK_CONTENTS_FILTER BUILDLINK_CPPFLAGS
9490: BUILDLINK_DEPMETHOD BUILDLINK_FILES
9491: BUILDLINK_FILES_CMD BUILDLINK_FNAME_TRANSFORM
9492: BUILDLINK_LDFLAGS BUILDLINK_LIBS
9493: BUILDLINK_OPSYS_SUPPORT_PTHREAD BUILDLINK_PKGNAME
9494: BUILDLINK_PREFIX BUILDLINK_RPATHDIRS
9495: BUILDLINK_TREE BUILD_DEFS
9496: BUILD_DEFS_EFFECTS BUILD_DEPENDS
9497: BUILD_DIRS BUILD_ENV_SHELL
9498: BUILD_MAKE_CMD BUILD_MAKE_FLAGS
9499: BUILD_TARGET BUILTIN_FIND_FILES
9500: BUILTIN_FIND_FILES_VAR BUILTIN_FIND_GREP
9501: BUILTIN_FIND_HEADERS BUILTIN_FIND_HEADERS_VAR
9502: BUILTIN_FIND_PKGCONFIG BUILTIN_FIND_PKGCONFIG_VAR
9503: BUILTIN_PKG BUILTIN_TEST_CURSES_DEFINES
9504: BUILTIN_TEST_CURSES_FUNCS BUILTIN_VERSION_SCRIPT
9505: BUILTIN_X11_TYPE BUILTIN_X11_VERSION
9506: CACTI_GROUP CACTI_USER
9507: CANNA_GROUP CANNA_USER
9508: CAT CBLAS_LIBS
9509: CBLAS_PC CCACHE_BASE
9510: CCACHE_DIR CCACHE_LOGFILE
9511: CCACHE_RECACHE CC_VERSION
9512: CC_VERSION_STRING CDRECORD_CONF
9513: CDROM_PKG_URL_DIR CDROM_PKG_URL_HOST
9514: CHANGES CHECKOUT_DATE
9515: CHECK_COMPILER CHECK_FAKEHOME
9516: CHECK_FILES CHECK_FILES_ONLY_PREFIX
9517: CHECK_FILES_SKIP CHECK_FILES_STRICT
9518: CHECK_HEADERS CHECK_HEADERS_SKIP
9519: CHECK_INTERPRETER CHECK_INTERPRETER_SKIP
9520: CHECK_PERMS CHECK_PERMS_AUTOFIX
9521: CHECK_PERMS_SKIP CHECK_PIE
9522: CHECK_PIE_SKIP CHECK_PIE_SUPPORTED
9523: CHECK_PORTABILITY CHECK_PORTABILITY_EXPERIMENTAL
9524: CHECK_PORTABILITY_SKIP CHECK_RELRO
9525: CHECK_RELRO_SKIP CHECK_RELRO_SUPPORTED
9526: CHECK_SHLIBS CHECK_SHLIBS_SKIP
9527: CHECK_SHLIBS_SUPPORTED CHECK_SHLIBS_TOXIC
9528: CHECK_SSP CHECK_SSP_SKIP
9529: CHECK_SSP_SUPPORTED CHECK_STRIPPED
9530: CHECK_STRIPPED_SKIP CHECK_WRKREF
9531: CHECK_WRKREF_EXTRA_DIRS CHECK_WRKREF_SKIP
9532: CLAMAV_DBDIR CLAMAV_GROUP
9533: CLAMAV_USER CLANGBASE
9534: CLEANDEPENDS CLT
9535: CMAKE_DEPENDENCIES_REWRITE CMAKE_INSTALL_NAME_DIR
9536: CMAKE_INSTALL_PREFIX CMAKE_MODULE_PATH_OVERRIDE
9537: CMAKE_PKGSRC_BUILD_FLAGS CMAKE_PREFIX_PATH
9538: CMAKE_USE_GNU_INSTALL_DIRS COMMON_LISP_DOCFILES
9539: COMMON_LISP_EXAMPLES COMMON_LISP_EXTRAFILES
9540: COMMON_LISP_PACKAGES COMMON_LISP_SYSTEM
9541: COMPILER_RPATH_FLAG COMPILER_USE_SYMLINKS
9542: CONFIGURE_ARGS CONFIGURE_DIRS
9543: CONFIGURE_ENV CONFIGURE_ENV_SHELL
9544: CONFIGURE_HAS_INFODIR CONFIGURE_HAS_MANDIR
9545: CONFIGURE_SCRIPT CONFIG_SHELL
9546: CONFIG_SHELL_FLAGS CONF_FILES
9547: CONF_FILES_MODE CONF_FILES_PERMS
9548: CONSERVER_DEFAULTHOST CONSERVER_DEFAULTPORT
9549: CP CPE
9550: CPE_EDITION CPE_LANG
9551: CPE_OTHER CPE_PART
9552: CPE_PRODUCT CPE_SW_EDITION
9553: CPE_TARGET_HW CPE_TARGET_SW
9554: CPE_UPDATE CPE_URI
9555: CPE_VENDOR CPE_VERSION
9556: CPP CPP_PRECOMP_FLAGS
9557: CREATE_WRKDIR_SYMLINK CROSSBASE
9558: CTFCONVERT CTF_FILES_SKIP
9559: CTF_SUPPORTED CTYPE
9560: CUPS_GROUP CUPS_SYSTEM_GROUPS
9561: CUPS_USER CURSES_DEFAULT
9562: CURSES_TYPE CVS_EXTRACTDIR
9563: CVS_MODULE CVS_PROJECT
9564: CVS_REPOSITORIES CVS_ROOT
9565: CVS_ROOT_GNU CVS_ROOT_NONGNU
9566: CVS_ROOT_SOURCEFORGE CVS_TAG
9567: CXX CYRUS_GROUP
9568: CYRUS_IDLE CYRUS_USER
9569: DAEMONTOOLS_GROUP DAEMONTOOLS_LOG_USER
9570: DARWIN_NO_SYSTEM_LIBS DARWIN_REQUIRES_FILTER
9571: DBUS_GROUP DBUS_USER
9572: DEFANG_GROUP DEFANG_USER
9573: DEFAULT_ACCEPTABLE_LICENSES DEFAULT_DISTFILES
9574: DEFAULT_IRC_SERVER DEFAULT_SERIAL_DEVICE
9575: DEF_UMASK DEINSTALLDEPENDS
9576: DEINSTALL_SRC DEINSTALL_TEMPLATES
9577: DELAYED_ERROR_MSG DELAYED_WARNING_MSG
9578: DEPENDS DEPENDS_TARGET
9579: DEPENDS_TYPE DESTDIR
9580: DESTDIR_VARNAME DIALER_GROUP
9581: DIGEST_REQD DISTDIR
9582: DISTFILES DISTINFO_FILE
9583: DISTNAME DIST_PATH
9584: DIST_SUBDIR DJBDNS_AXFR_USER
9585: DJBDNS_CACHE_USER DJBDNS_DJBDNS_GROUP
9586: DJBDNS_LOG_USER DJBDNS_RBL_USER
9587: DJBDNS_TINY_USER DLOPEN_REQUIRE_PTHREADS
9588: DL_AUTO_VARS DL_CFLAGS
9589: DL_LDFLAGS DL_LIBS
9590: DNS DOCOWN
9591: DOWNLOADED_DISTFILE DQCACHE_GROUP
9592: DQCACHE_USER DT_LAYOUT
9593: DYNAMIC_SITES_CMD DYNAMIC_SITES_SCRIPT
9594: ECHO ECHO_N
9595: ELK_GUI EMACS_TYPE
9596: EMULDIR EMULSUBDIR
9597: EMULSUBDIRSLASH EMUL_ARCH
9598: EMUL_DISTRO EMUL_EXEC_FMT
9599: EMUL_IS_NATIVE EMUL_MODULES
9600: EMUL_OPSYS EMUL_PKG_FMT
9601: EMUL_PLATFORM EMUL_PLATFORMS
9602: EMUL_PREFER EMUL_REQD
9603: EMUL_TYPE ERROR_MSG
9604: EXIM_GROUP EXIM_USER
9605: EXPORT_SYMBOLS_LDFLAGS EXTRACTOR
9606: EXTRACT_CMD EXTRACT_CMD_DEFAULT
9607: EXTRACT_DIR EXTRACT_ELEMENTS
9608: EXTRACT_ENV EXTRACT_ONLY
9609: EXTRACT_OPTS EXTRACT_SUFX
9610: EXTRACT_USING FAIL
9611: FAILOVER_FETCH FAIL_MSG
9612: FAKE_NCURSES FAM
9613: FAM_ACCEPTED FAM_DEFAULT
9614: FAM_SERVER FCPATH
9615: FETCH_AFTER_ARGS FETCH_BEFORE_ARGS
9616: FETCH_CMD FETCH_INSECURE
9617: FETCH_OUTPUT_ARGS FETCH_PROXY
9618: FETCH_RESUME_ARGS FETCH_TIMEOUT
9619: FETCH_USE_IPV4_ONLY FETCH_USING
9620: FILES_SUBST FILES_SUBST_SED
9621: FIX_SYSTEM_HEADERS FONTDIR
9622: FONTS_DIRS FONTS_VERBOSE
9623: FOO_HACKS_MK FORCE_CXX_STD
9624: FORCE_C_STD FOSSIL_EXTRACTDIR
9625: FOSSIL_REPO FOSSIL_REPOSITORIES
9626: FOSSIL_VERSION FOX_USE_XUNICODE
9627: FREEWNN_GROUP FREEWNN_USER
9628: FTP_PKG_URL_DIR FTP_PKG_URL_HOST
9629: GAMEDATAMODE GAMEDATA_PERMS
9630: GAMEDIRMODE GAMEDIR_PERMS
9631: GAMEGRP GAMEMODE
9632: GAMEOWN GAMES_GROUP
9633: GAMES_USER GCC
9634: GCCBASE GCC_REQD
9635: GCC_VERSION_SUFFIX GEM_BUILD
9636: GEM_CLEANBUILD GEM_CLEANBUILD_EXTENSIONS
9637: GEM_DOCDIR GEM_EXTSDIR
9638: GEM_HOME GEM_KEEPBUILD
9639: GEM_LIBDIR GEM_NAME
9640: GEM_PATH GEM_PLUGINSDIR
9641: GEM_SPECFILE GENERATE_PLIST
9642: GHC GHOSTSCRIPT_REQD
9643: GITHUB_PROJECT GITHUB_RELEASE
9644: GITHUB_SUBMODULES GITHUB_TAG
9645: GITHUB_TYPE GITLAB_PROJECT
9646: GITLAB_RELEASE GITLAB_SUBMODULES
9647: GITLAB_TAG GITLAB_TYPE
9648: GIT_BRANCH GIT_ENV
9649: GIT_EXTRACTDIR GIT_REPO
9650: GIT_REPOSITORIES GIT_REVISION
9651: GIT_TAG GNU
9652: GNU_CONFIGURE GNU_CONFIGURE_ICONV
9653: GNU_CONFIGURE_INFODIR GNU_CONFIGURE_MANDIR
9654: GNU_CONFIGURE_QUIET GNU_CONFIGURE_STRICT
9655: GODEP_REDIRECTS GO_BUILD_PATTERN
9656: GO_DEPS GO_DIST_BASE
9657: GO_EXTRA_MOD_DIRS GO_MODULE_EXTRACT
9658: GO_MODULE_FILES GO_SRCPATH
9659: GROUP_SPECIFIC_PKGS GRUB_NETWORK_CARDS
9660: GRUB_PRESET_COMMAND GRUB_SCAN_ARGS
9661: GZIP HASKELL_COMPILER
9662: HASKELL_DISABLE_EXECUTABLES HASKELL_DISABLE_LIBRARIES
9663: HASKELL_ENABLE_DYNAMIC_EXECUTABLE HASKELL_ENABLE_HADDOCK_DOCUMENTATION
9664: HASKELL_ENABLE_LIBRARY_PROFILING HASKELL_ENABLE_SHARED_LIBRARY
9665: HASKELL_ENABLE_TESTS HASKELL_OPTIMIZATION_LEVEL
9666: HASKELL_PKG_NAME HASKELL_UNRESTRICT_DEPENDENCIES
9667: HEADER_TEMPLATES HG_REPO
9668: HG_REPOSITORIES HG_TAG
9669: HOMEPAGE HOST_PKGTOOLS_ARGS
9670: HOST_SPECIFIC_PKGS HOWL_GROUP
9671: HOWL_USER ICCBASE
9672: ICECAST_CHROOTDIR ICON_THEMES
9673: IDOBASE IGNORE_CCACHE
9674: IGNORE_INFO_DIRS IGNORE_INTERACTIVE_FETCH
9675: IMAKE IMAKEOPTS
9676: IMAKE_MAKE IMAKE_MANINSTALL
9677: IMAP_UW_CCLIENT_MBOX_FMT IMDICTDIR
9678: INCOMPAT_CURSES INFO_DIR
9679: INFO_FILES INFO_MSG
9680: INIT_SYSTEM INN_DATA_DIR
9681: INN_GROUP INN_USER
9682: INSTALLATION_DIRS INSTALLATION_DIRS_FROM_PLIST
9683: INSTALL_ENV INSTALL_ENV_SHELL
9684: INSTALL_SH_OVERRIDE INSTALL_SRC
9685: INSTALL_TEMPLATES INSTALL_UNSTRIPPED
9686: IRCD_HYBRID_IRC_GROUP IRCD_HYBRID_IRC_USER
9687: IRCD_HYBRID_MAXCONN IRCD_HYBRID_NICLEN
9688: IRCD_HYBRID_SYSLOG_EVENTS IRCD_HYBRID_SYSLOG_FACILITY
9689: IRCD_HYBRID_TOPICLEN IRIX
9690: IRRD_USE_PGP JABBERD_GROUP
9691: JABBERD_LOGDIR JABBERD_PIDDIR
9692: JABBERD_SPOOLDIR JABBERD_USER
9693: JAVA_APP_PATH JAVA_APP_TARGETS
9694: JAVA_BINPREFIX JAVA_CLASSPATH
9695: JAVA_HOME JAVA_LD_LIBRARY_PATH
9696: JAVA_NAME JAVA_UNLIMIT
9697: JAVA_WRAPPERS JPEG_ACCEPTED
9698: JPEG_DEFAULT KERBEROS
9699: KERMIT_SUID_UUCP KJS_USE_PCRE
9700: KNEWS_DOMAIN_FILE KNEWS_DOMAIN_NAME
9701: KRB5_ACCEPTED KRB5_DEFAULT
9702: LANGUAGES LAPACKE_LIBS
9703: LAPACKE_PC LAPACK_LIBS
9704: LAPACK_PC LATEX2HTML_ICONPATH
9705: LDCONFIG_ADD_CMD LDCONFIG_REMOVE_CMD
9706: LDD LEAFNODE_DATA_DIR
9707: LEAFNODE_GROUP LEAFNODE_USER
9708: LIBDVDCSS_HOMEPAGE LIBDVDCSS_MASTER_SITES
9709: LIBIMAGEQUANT_TYPE LIBRSVG_TYPE
9710: LIBTOOL LIBTOOLIZE_PLIST
9711: LIBTOOL_M4_OVERRIDE LIBUSB_TYPE
9712: LICENSE LINKER_RPATH_FLAG
9713: LINK_RPATH_FLAG LINUX_BASE_NODEPS
9714: LINUX_BASE_PREFERRED LINUX_BASE_REQUIRED
9715: LINUX_LOCALES LOCALBASE
9716: LOCALBASE_LOCKTYPE LOCALPATCHES
9717: LOVE_DATA LOVE_GAME
9718: LOVE_VERSION LOWER_OPSYS
9719: LOWER_OPSYS_VERSUFFIX LOWER_VARIANT_VERSION
9720: LOWER_VENDOR LP32PLATFORMS
9721: LP64PLATFORMS LUA_BUSTED_ARGS
9722: LUA_CDIR LUA_COMPILER
9723: LUA_DOCDIR LUA_EXAMPLESDIR
9724: LUA_INCDIR LUA_INTERPRETER
9725: LUA_LDIR LUA_LINKER_MAGIC
9726: LUA_PKGPREFIX LUA_SELF_CONFLICT
9727: LUA_USE_BUSTED LUA_VERSIONS_ACCEPTED
9728: LUA_VERSIONS_INCOMPATIBLE LUA_VERSION_DEFAULT
9729: LUA_VERSION_REQD Lua
9730: MACHINE_PLATFORM MAILAGENT_DOMAIN
9731: MAILAGENT_EMAIL MAILAGENT_FQDN
9732: MAILAGENT_ORGANIZATION MAJORDOMO_HOMEDIR
9733: MAJOR_OS_VERSION MAKEINFO_ARGS
9734: MAKE_DIRS MAKE_DIRS_PERMS
9735: MAKE_ENV MAKE_FILE
9736: MAKE_FLAGS MAKE_JOBS
9737: MAKE_JOBS_SAFE MAKE_PROGRAM
9738: MANCOMPRESSED_IF_MANZ MANINSTALL
9739: MANZ MARIADB_VERSIONS_ALL
9740: MASTER_SITES MASTER_SITE_BACKUP
9741: MASTER_SITE_LOCAL MASTER_SITE_MOZILLA
9742: MASTER_SITE_OVERRIDE MASTER_SITE_PERL_CPAN
9743: MASTER_SORT MASTER_SORT_RANDOM
9744: MASTER_SORT_REGEX MECAB_CHARSET
9745: MEDIATOMB_GROUP MEDIATOMB_USER
9746: MIPSPROBASE MIREDO_GROUP
9747: MIREDO_USER MISSING_FEATURES
9748: MKDIR MKPIE_SUPPORTED
9749: MLDONKEY_GROUP MLDONKEY_HOME
9750: MLDONKEY_USER MONOTONE_GROUP
9751: MONOTONE_USER MOTIFBASE
9752: MOTIF_TYPE MOTIF_TYPE_DEFAULT
9753: MPI_TYPE MSGFMT_STRIP_MSGCTXT
9754: MSGFMT_STRIP_MSGID_PLURAL MTOOLS_ENABLE_FLOPPYD
9755: MUST MV
9756: MYSQL_CHARSET MYSQL_DATADIR
9757: MYSQL_EXTRA_CHARSET MYSQL_GROUP
9758: MYSQL_USER MYSQL_VERSION
9759: MYSQL_VERSIONS_ACCEPTED MYSQL_VERSION_DEFAULT
9760: NAGIOSCMD_GROUP NAGIOSDIR
9761: NAGIOS_GROUP NAGIOS_USER
9762: NATIVE_EXEC_FMT NATIVE_LOWER_OPSYS
9763: NATIVE_LOWER_VENDOR NATIVE_MACHINE_PLATFORM
9764: NATIVE_OBJECT_FMT NATIVE_OPSYS_VERSION
9765: NATIVE_OS_VARIANT NATIVE_OS_VERSION
9766: NBPAX_PROGRAM_PREFIX NETBSD_LOGIN_NAME
9767: NMH_EDITOR NMH_MTA
9768: NMH_PAGER NODE_VERSIONS_ACCEPTED
9769: NODE_VERSIONS_INCOMPATIBLE NODE_VERSION_DEFAULT
9770: NODE_VERSION_REQD NOLOGIN
9771: NOTE NOT_FOR_PLATFORM
9772: NOT_PAX_ASLR_SAFE NOT_PAX_MPROTECT_SAFE
9773: NO_BUILD NO_CHECKSUM
9774: NO_CONFIGURE NO_SKIP
9775: NSD_GROUP NSD_LOG_FACILITY
9776: NSD_USER NS_PREFERRED
9777: NULLMAILER_GROUP NULLMAILER_USER
9778: OBJECT_FMT OBJHOSTNAME
9779: OBJMACHINE OCAML_FINDLIB_DIRS
9780: OCAML_FINDLIB_REGISTER OCAML_FINDLIB_REGISTER_VERBOSE
9781: OCAML_SITELIBDIR OMF
9782: ONLY_FOR_COMPILER ONLY_FOR_PLATFORM
9783: OPENSSH_CHROOT OPENSSH_GROUP
9784: OPENSSH_USER OPSYS
9785: OPSYS_EMULDIR OPSYS_VERSION
9786: OS OSS_TYPE
9787: OSX OSX_PATH_TO_M4
9788: OSX_PATH_TO_YACC OS_HAVE_ALSA
9789: OS_HAVE_RCD OS_VARIANT
9790: OS_VERSION OTF_FONTS_DIR
9791: OVERRIDE_DIRDEPTH OVERRIDE_GEMSPEC
9792: OVERRIDE_GNU_CONFIG_SCRIPTS OVERRIDE_ROCKSPEC
9793: OWN_DIRS OWN_DIRS_PERMS
9794: P4GROUP P4PORT
9795: P4ROOT P4USER
9796: PACKAGES PALMOS_DEFAULT_SDK
9797: PAMBASE PAM_DEFAULT
9798: PAPERSIZE PASSIVE_FETCH
9799: PATCHDIR PATCHFILES
9800: PATCH_ARGS PATCH_DEBUG
9801: PATCH_DIST_ARGS PATCH_DIST_CAT
9802: PATCH_DIST_STRIP PATCH_FUZZ_FACTOR
9803: PATCH_STRIP PATH
9804: PCCBASE PEAR
9805: PEAR_CHANNEL PEAR_CHANNEL_ALIAS
9806: PEAR_CHANNEL_VERSION PEAR_CMD
9807: PEAR_LIB PEAR_PACKAGE_XML
9808: PEP-518 PERL5
9809: PERL5_CONFIGURE PERL5_CONFIGURE_DIRS
9810: PERL5_LDFLAGS PERL5_LICENSE
9811: PERL5_MODULE_TYPE PERL5_PACKLIST
9812: PERL5_PACKLIST_DIR PERL5_PERLBASE
9813: PERL5_SITEBASE PERL5_USE_PACKLIST
9814: PERL5_VENDORBASE PFCTL
9815: PFVAR_H PF_VERSION
9816: PGGROUP PGHOME
9817: PGPKGSRCDIR PGSQL_TYPE
9818: PGSQL_VERSION PGSQL_VERSIONS_ACCEPTED
9819: PGSQL_VERSION_DEFAULT PGUSER
9820: PG_LIB_EXT PHP
9821: PHPCOMMON_MK PHPPKGSRCDIR
9822: PHP_BASE_VERS PHP_EGDIR
9823: PHP_EXTENSION_DIR PHP_INCDIR
9824: PHP_LIBDIR PHP_MAJOR_VERS
9825: PHP_MINIMUM_TEENY PHP_MINOR_VERS
9826: PHP_PKG_PREFIX PHP_SHAREDIR
9827: PHP_VER PHP_VERSION
9828: PHP_VERSIONS_ACCEPTED PHP_VERSIONS_INCOMPATIBLE
9829: PHP_VERSION_DEFAULT PHP_VERSION_REQD
9830: PILRC_USE_GTK PKGCONFIG_BASE
9831: PKGCONFIG_FILE PKGCONFIG_OVERRIDE
9832: PKGCONFIG_OVERRIDE_STAGE PKGDIR
9833: PKGGNUDIR PKGINFODIR
9834: PKGLOCALEDIR PKGMANDIR
9835: PKGNAME PKGNAME_REQD
9836: PKGPATH PKGREVISION
9837: PKGSRC_BLAS_TYPES PKGSRC_CHANGES
9838: PKGSRC_COMPILER PKGSRC_KEEP_BIN_PKGS
9839: PKGSRC_LOCKTYPE PKGSRC_MAKE_ENV
9840: PKGSRC_MESSAGE_RECIPIENTS PKGSRC_MKPIE
9841: PKGSRC_MKREPRO PKGSRC_OVERRIDE_MKPIE
9842: PKGSRC_RUN_TEST PKGSRC_SETENV
9843: PKGSRC_SLEEPSECS PKGSRC_TODO
9844: PKGSRC_USE_CTF PKGSRC_USE_FORTIFY
9845: PKGSRC_USE_MKTOOLS PKGSRC_USE_RELRO
9846: PKGSRC_USE_SSP PKGSRC_USE_STACK_CHECK
9847: PKGTASKS_DATAFILE PKGTOOLS_ARGS
9848: PKGTOOLS_ENV PKG_ALTERNATIVES
9849: PKG_APACHE PKG_APACHE_ACCEPTED
9850: PKG_APACHE_DEFAULT PKG_BEST_EXISTS
9851: PKG_BUILD_OPTIONS PKG_COMPRESSION
9852: PKG_CONFIG PKG_CONFIG_PERMS
9853: PKG_CREATE_USERGROUP PKG_DBDIR
9854: PKG_DB_TMPDIR PKG_DEBUG_LEVEL
9855: PKG_DEFAULT_OPTIONS PKG_DESTDIR_SUPPORT
9856: PKG_DEVELOPER PKG_DISABLED_OPTIONS
9857: PKG_FATAL_ERRORS PKG_FC
9858: PKG_FILELIST_CMD PKG_GECOS
9859: PKG_GID PKG_GROUPS
9860: PKG_GROUPS_VARS PKG_HOME
9861: PKG_INIT_SCRIPTS PKG_JAVA_HOME
9862: PKG_JVM PKG_JVMS_ACCEPTED
9863: PKG_JVM_DEFAULT PKG_LEGACY_OPTIONS
9864: PKG_LIBTOOL PKG_MKSYMLINKS
9865: PKG_OPTIONS PKG_OPTIONS_DEPRECATED_WARNINGS
9866: PKG_OPTIONS_LEGACY_OPTS PKG_OPTIONS_LEGACY_VARS
9867: PKG_OPTIONS_NONEMPTY_SETS PKG_OPTIONS_OPTIONAL_GROUPS
9868: PKG_OPTIONS_REQUIRED_GROUPS PKG_OPTIONS_VAR
9869: PKG_RCD_SCRIPTS PKG_REFCOUNT_DBDIR
9870: PKG_REGISTER_SHELLS PKG_RESUME_TRANSFERS
9871: PKG_SHELL PKG_SUGGESTED_OPTIONS
9872: PKG_SUPPORTED_OPTIONS PKG_SYSCONFBASE
9873: PKG_SYSCONFBASEDIR PKG_SYSCONFDIR
9874: PKG_SYSCONFDIR_PERMS PKG_SYSCONFSUBDIR
9875: PKG_SYSCONFVAR PKG_TOOLS_BIN
9876: PKG_UID PKG_UPDATE_FONTS_DB
9877: PKG_USERS PKG_USERS_VARS
9878: PKG_VERBOSE PLEASE
9879: PLIST PLIST_AWK
9880: PLIST_AWK_ENV PLIST_SRC
9881: PLIST_SUBST PLIST_TYPE
9882: PLIST_VARS POPTOP_USE_MPPE
9883: POSSIBLE_GFORTRAN_VERSION POST_FETCH_HOOK
9884: PREFER PREFER_NATIVE
9885: PREFER_NATIVE_PTHREADS PREFER_PKGSRC
9886: PREFIX PREPEND_PATH
9887: PRE_ROOT_CMD PRIVILEGED_STAGES
9888: PS PTHREAD_AUTO_VARS
9889: PTHREAD_CFLAGS PTHREAD_LDFLAGS
9890: PTHREAD_LIBS PTHREAD_OPTS
9891: PTHREAD_TYPE PVM_SSH
9892: PYPKGPREFIX PYTHON_FOR_BUILD_ONLY
9893: PYTHON_SELF_CONFLICT PYTHON_VERSION
9894: PYTHON_VERSIONED_DEPENDENCIES PYTHON_VERSIONS_ACCEPTED
9895: PYTHON_VERSIONS_INCOMPATIBLE PYTHON_VERSION_DEFAULT
9896: PYTHON_VERSION_REQD PYVERSSUFFIX
9897: QMAILDIR QMAIL_ALIAS_USER
9898: QMAIL_DAEMON_USER QMAIL_LOG_USER
9899: QMAIL_NOFILES_GROUP QMAIL_PASSWD_USER
9900: QMAIL_QMAIL_GROUP QMAIL_QUEUE_DIR
9901: QMAIL_QUEUE_EXTRA QMAIL_QUEUE_USER
9902: QMAIL_REMOTE_USER QMAIL_ROOT_USER
9903: QMAIL_SEND_USER QORE_LATEST_MODULE_API
9904: QORE_MODULE_API QORE_MODULE_DIR
9905: QORE_USER_MODULE_DIR QORE_VERSION
9906: QPOPPER_FAC QPOPPER_SPOOL_DIR
9907: QPOPPER_USER RAKE_NAME
9908: RASMOL_DEPTH RCD_DIR
9909: RCD_ORDER RCD_SCRIPTS
9910: RCD_SCRIPTS_DIR RCD_SCRIPTS_EXAMPLEDIR
9911: RCD_SCRIPTS_MODE RCD_SCRIPTS_SHELL
9912: RCD_SCRIPT_SRC RCD_SUBR
9913: RDOC READLINE_DEFAULT
9914: READLINE_TYPE REAL_ROOT_GROUP
9915: REAL_ROOT_USER RECURSIVE_MAKE
9916: RELAY_CTRL_DIR RELRO_SUPPORTED
9917: REPLACE_AWK REPLACE_BASH
9918: REPLACE_CSH REPLACE_KSH
9919: REPLACE_LUA REPLACE_NODEJS
9920: REPLACE_OCTAVE REPLACE_PERL
9921: REPLACE_PERL6 REPLACE_PHP
9922: REPLACE_PYTHON REPLACE_QORE
9923: REPLACE_R REPLACE_RUBY
9924: REPLACE_RUBY_DIRS REPLACE_RUBY_PAT
9925: REPLACE_SH REPLACE_TEXLUA
9926: REPLACE_TOOL_PYTHON REPLACE_WISH
9927: REQD_DIRS REQD_DIRS_PERMS
9928: REQD_FILES REQD_FILES_MODE
9929: REQD_FILES_PERMS RESOLV_AUTO_VARS
9930: RESOLV_LDFLAGS RESOLV_LIBS
9931: RM ROCKSPEC_NAME
9932: ROCKSPEC_SPECFILE ROOT_CMD
9933: ROOT_GROUP ROOT_USER
9934: RPCGEN RPM
9935: RPM2PKG_PLIST RPM2PKG_PREFIX
9936: RPM2PKG_STAGE RPM2PKG_STRIP
9937: RPM2PKG_SUBPREFIX RPMFILES
9938: RPMIGNOREPATH RPM_DB_PREFIX
9939: RSSH_CVS_PATH RSSH_RDIST_PATH
9940: RSSH_RSYNC_PATH RSSH_SCP_PATH
9941: RSSH_SFTP_SERVER_PATH RUBY
9942: RUBYGEM RUBYGEM_MANPAGES
9943: RUBYGEM_NAME RUBYGEM_OPTIONS
9944: RUBYGEM_USE_MANPAGES RUBYGEM_VERBOSE
9945: RUBY_ABI_VERSION RUBY_ARCH
9946: RUBY_ARCHINC RUBY_ARCHLIB
9947: RUBY_BASE RUBY_BASERIDIR
9948: RUBY_BUILD_DOCUMENT RUBY_DLEXT
9949: RUBY_DOC RUBY_DYNAMIC_DIRS
9950: RUBY_EG RUBY_ENCODING_ARG
9951: RUBY_EXTCONF RUBY_EXTCONF_CHECK
9952: RUBY_EXTCONF_DEBUG RUBY_EXTCONF_MAKEFILE
9953: RUBY_GEM_ARCH RUBY_GEM_BASE
9954: RUBY_INC RUBY_LIB
9955: RUBY_LIB_BASE RUBY_NAME
9956: RUBY_NOVERSION RUBY_PKGPREFIX
9957: RUBY_RAILS RUBY_RAILS61_VERSION
9958: RUBY_RAILS70_VERSION RUBY_RAILS71_VERSION
9959: RUBY_RAILS72_VERSION RUBY_RAILS80_VERSION
9960: RUBY_RAILS_ACCEPTED RUBY_RAILS_DEFAULT
9961: RUBY_RAILS_REQD RUBY_RAILS_STRICT_DEP
9962: RUBY_RIDIR RUBY_SETUP
9963: RUBY_SHLIB RUBY_SHLIBALIAS
9964: RUBY_SHLIBVER RUBY_SIMPLE_INSTALL
9965: RUBY_SITEARCHLIB RUBY_SITELIB
9966: RUBY_SITELIB_BASE RUBY_SITERIDIR
9967: RUBY_SLEXT RUBY_SRCDIR
9968: RUBY_STATICLIB RUBY_SUFFIX
9969: RUBY_SYSRIDIR RUBY_USE_PTHREAD
9970: RUBY_VENDORARCHLIB RUBY_VENDORLIB
9971: RUBY_VENDORLIB_BASE RUBY_VER
9972: RUBY_VERSION RUBY_VERSIONS_ACCEPTED
9973: RUBY_VERSIONS_INCOMPATIBLE RUBY_VERSION_DEFAULT
9974: RUBY_VERSION_REQD RUBY_VER_DIR
9975: RUN RUN_LDCONFIG
9976: RUST_TYPE SCO
9977: SCREWS_GROUP SCREWS_USER
9978: SCRIPTS_ENV SCROLLKEEPER_DATADIR
9979: SCROLLKEEPER_REBUILDDB SCROLLKEEPER_UPDATEDB
9980: SDIST_PAWD SDL12_TYPE
9981: SERIAL_DEVICES SETGIDGAME
9982: SETGID_GAMES_PERMS SETUID_ROOT_PERMS
9983: SH SHLIB
9984: SHORTNAME SIGN_PACKAGES
9985: SILC_CLIENT_WITH_PERL SITE_SPECIFIC_PKGS
9986: SKIP_DEPENDS SMF_INSTANCES
9987: SMF_MANIFEST SMF_METHODS
9988: SMF_METHOD_SHELL SMF_METHOD_SRC
9989: SMF_NAME SMF_PREFIX
9990: SMF_SRCDIR SNIPROXY_GROUP
9991: SNIPROXY_USER SOURCE_BUFFSIZE
9992: SPECIAL_PERMS SPECIFIC_PKGS
9993: SSH_SUID SSLCERTBUNDLE
9994: SSLCERTS SSLDIR
9995: SSLKEYS SSP_SUPPORTED
9996: SSYNC_PAWD STEP_MSG
9997: STRIP STRIP_DBG
9998: STRIP_DEBUG STRIP_DEBUG_SUPPORTED
9999: STRIP_FILES_SKIP SU
10000: SUBDIR SUBST
10001: SUBST_CLASSES SUBST_FILES
10002: SUBST_FILTER_CMD SUBST_MESSAGE
10003: SUBST_NOOP_OK SUBST_SED
10004: SUBST_SHOW_DIFF SUBST_SKIP_TEXT_CHECK
10005: SUBST_STAGE SUBST_VARS
10006: SUNWSPROBASE SUSE_PREFER
10007: SU_CMD SVN_EXTRACTDIR
10008: SVN_REPO SVN_REPOSITORIES
10009: SVN_REVISION SYSCONFBASE
10010: TARGET_MACHINE_ARCH TBL
10011: TERMCAP_TYPE TERMINFO_DEFAULT
10012: TERMINFO_TYPE TEST
10013: TEST_DEPENDS TEST_DIRS
10014: TEST_ENV TEST_ENV_SHELL
10015: TEST_MAKE_CMD TEST_MAKE_FLAGS
10016: TEST_TARGET TEXLIVE_IGNORE_PATTERNS
10017: TEXLIVE_REV TEXLIVE_UNVERSIONED
10018: TEXMFSITE TEX_FORMATS
10019: TEX_HYPHEN_DAT TEX_HYPHEN_DEF
10020: TEX_TEXMF_DIRS THTTPD_LOG_FACILITY
10021: TINYDYN_USER TLS
10022: TLSWRAPPER_CHROOT TO
10023: TOOLDIR TOOLS_ALIASES
10024: TOOLS_ALWAYS_WRAP TOOLS_ARGS
10025: TOOLS_BROKEN TOOLS_CMD
10026: TOOLS_CMDLINE_SED TOOLS_CREATE
10027: TOOLS_CROSS_DESTDIR TOOLS_DIR
10028: TOOLS_FAIL TOOLS_GNU_MISSING
10029: TOOLS_LDCONFIG TOOLS_NOOP
10030: TOOLS_PATH TOOLS_SCRIPT
10031: TOOLS_USE_CROSS_COMPILE TOOL_DEPENDS
10032: TTF_FONTDIR TTF_FONTS_DIR
10033: TYPE UAC_REQD_EXECS
10034: UCSPI_SSL_GROUP UCSPI_SSL_USER
10035: UNBOUND_GROUP UNBOUND_LOG_FACILITY
10036: UNBOUND_USER UNLIMIT_RESOURCES
10037: UNPRIVILEGED UNPRIVILEGED_GROUP
10038: UNPRIVILEGED_GROUPS UNPRIVILEGED_USER
10039: UNWRAP_FILES UNWRAP_PATTERNS
10040: UPDATE_GEMSPEC UPDATE_TARGET
10041: URI USERGROUP_PHASE
10042: USERPPP_GROUP USER_SPECIFIC_PKGS
10043: USE_ABI_DEPENDS USE_APR
10044: USE_BSD_MAKEFILE USE_BUILTIN
10045: USE_CC_FEATURES USE_CROSS_COMPILE
10046: USE_CURSES USE_CWRAPPERS
10047: USE_CXX_FEATURES USE_DB185
10048: USE_FEATURES USE_GAMESGROUP
10049: USE_GCC_RUNTIME USE_IMAKE
10050: USE_INDIRECT_DEPENDS USE_JAVA
10051: USE_JAVA2 USE_LANGUAGES
10052: USE_LIBTOOL USE_NATIVE_GCC
10053: USE_NETBSD_REPO USE_PKGSRC_GCC
10054: USE_PKGSRC_GCC_RUNTIME USE_PKGTASKS
10055: USE_PKG_ADMIN_DIGEST USE_RUBY_EXTCONF
10056: USE_RUBY_INSTALL USE_RUBY_SETUP
10057: USE_RUBY_SETUP_PKG USE_TMPFILES
10058: USE_TOOLS UUCP_GROUP
10059: UUCP_USER VARBASE
10060: VARNAME VIM_EXTRA_OPTS
10061: WARNING_MSG WCALC_CGIDIR
10062: WCALC_CGIPATH WCALC_HTMLDIR
10063: WCALC_HTMLPATH WDM_MANAGERS
10064: WRAPPER_CC WRAPPER_REORDER_CMDS
10065: WRKDIR WRKDIR_BASENAME
10066: WRKDIR_LOCKTYPE WRKLOG
10067: WRKOBJDIR WRKSRC
10068: X10_PORT X11
10069: X11BASE X11_PKGSRCDIR
10070: X11_TYPE X509_CERTIFICATE
10071: X509_KEY XAW_TYPE
10072: XLOCK_DEFAULT_MODE XMKMF
10073: XMKMF_FLAGS XXX
10074: XXXX YES
10075: ZSH_STATIC __stdc__
10076: _vargroups accept
10077: acquire-localbase-lock acquire-lock
10078: add added
10079: administrator alloca
10080: alternatives aslr
10081: asprintf atlas
10082: autoconf automake
10083: autoreconf awk
10084: bash big-endian
10085: bin-install bind
10086: binpkg-list blas
10087: bootstrap-depends broken
10088: broken_on_platform bsd
10089: bsd.prog.mk build
10090: build-env buildlink-directories
10091: buildlink-oss-soundcard-h built-in
10092: builtin c
10093: c++ ccache
10094: cce cdefs
10095: ceil changes
10096: changes-entry changes-entry-noupdate
10097: check check-clean
10098: check-files check-files-clean
10099: check-hackage check-vulnerable
10100: checksum checksum-phase
10101: clean clean-depends
10102: cleandir commit
10103: commit-changes-entry compact
10104: compiler conf
10105: config.guess config.sub
10106: configuration configure
10107: configure-env configure-help
10108: configure_args connect
10109: cos cpe
10110: cputime create-usergroup
10111: csh ctf
10112: cvs debug
10113: declaration declare
10114: defined depend
10115: dependencies depends
10116: depends-checksum depends-fetch
10117: deps describe
10118: destdir disable
10119: distclean distfiles
10120: distinfo dl
10121: dlopen do-buildlink
10122: do-clean do-configure
10123: do-configure-post-hook do-extract
10124: do-fetch do-install
10125: download emul
10126: emul-distinfo emul-fetch
10127: emulation emulator
10128: enable endian
10129: endif enomem
10130: ensurepip err
10131: errx etc
10132: exp extract-rpm
10133: fabs feature
10134: features fetch
10135: fetch-list follows
10136: forbids form
10137: format fortify
10138: fortify_source fossil
10139: friend fts
10140: fts_close fts_open
10141: fts_read fts_set
10142: gcc gethostbyaddr
10143: gethostbyname gethostbyname2
10144: getopt_long getprogname
10145: getservbyname getservbyport
10146: getservent gettext
10147: git github
10148: gitlab glob
10149: gnu gnu_configure_strict
10150: go go-deps
10151: golang guess-license
10152: hashbang heimdal
10153: help hg
10154: imake in-tree
10155: increment indirect
10156: inet_aton install
10157: install-env interp
10158: interpreter intl
10159: ip4 ip6
10160: ipv4 ipv6
10161: iso kerberos
10162: krb krb5
10163: ksh lapack
10164: latex libiconv
10165: libintl_bindtextdomain libintl_gettext
10166: libintl_textdomain libnbcompat
10167: libs libtool
10168: licence license
10169: lintl little-endian
10170: lock locking
10171: lua lvalue
10172: machine_endian make
10173: makedistinfo makepatchsum
10174: makesum mdi
10175: memory mercurial
10176: meta meta-package
10177: meta_package mit-krb5
10178: mk.conf mkl
10179: mount move
10180: moved mprotect
10181: mps mremap
10182: native nb
10183: nbcompat netlib
10184: network node
10185: node.js nodejs
10186: obstack obstack_ptr_grow
10187: occurs only
10188: openblas options
10189: options.mk order
10190: override override-intltool
10191: override-message-intltool package
10192: parallel path
10193: pax paxctl
10194: pbulk-index pc
10195: perl perl5
10196: perms php
10197: pkg-build-options pkg-config
10198: pkg_build_options pkgsrc
10199: platform plist
10200: post-extract post-fetch
10201: post-wrapper pre-build-checks-hook
10202: pre-configure-checks-hook pre-extract
10203: pre-fetch print-go-deps
10204: print-plist print-summary-data
10205: privileged-install-hook pypi
10206: python r
10207: readme-all recursive
10208: recv recvfrom
10209: regcomp release-localbase-lock
10210: release-lock relro
10211: remove removed
10212: rename renamed
10213: reorder replace
10214: replace_interpreter reproducible
10215: resolv root
10216: ruby send
10217: sendfile sendto
10218: setenv setgid
10219: setprogname setuid
10220: sh shebang
10221: show show-all
10222: show-build-defs show-depends
10223: show-depends-dirs show-depends-pkgpaths
10224: show-depends-recursive show-deps
10225: show-distfiles show-downlevel
10226: show-subdir-var show-tools
10227: show-var show-vars
10228: snprintf socket
10229: ssp st_mode
10230: stage-install strcasestr
10231: strict strip
10232: strndup strnlen
10233: strsep subst
10234: substitutions subversion
10235: sun sunpro
10236: sunwspro svn
10237: symlink test
10238: test-env tex
10239: texlive tmp
10240: todo tool
10241: tools tools-libtool-m4-override
10242: transitive type
10243: ulimit undefined
10244: undo-replace unlimit
10245: unprivileged unprivileged-install-hook
10246: unstripped update
10247: updated upload
10248: upload-distfiles use_tools
10249: user utimes
10250: vasprintf verbose
10251: vsnprintf warn
10252: warning warnings
10253: warnx wattr_off
10254: wattr_on work
10255: wrapper wrkdir
1.154 rillig 10256:
1.207 leot 10257: Appendix F. Editing guidelines for the pkgsrc guide
1.1 dsieger 10258:
10259: Table of Contents
10260:
1.207 leot 10261: F.1. Make targets
10262: F.2. Procedure
1.1 dsieger 10263:
10264: This section contains information on editing the pkgsrc guide itself.
10265:
1.207 leot 10266: F.1. Make targets
1.1 dsieger 10267:
10268: The pkgsrc guide's source code is stored in pkgsrc/doc/guide/files, and several
10269: files are created from it:
10270:
10271: * pkgsrc/doc/pkgsrc.txt
10272:
10273: * pkgsrc/doc/pkgsrc.html
10274:
1.174 leot 10275: * https://www.NetBSD.org/docs/pkgsrc/
1.1 dsieger 10276:
1.174 leot 10277: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.pdf: The PDF version of the
10278: pkgsrc guide.
1.1 dsieger 10279:
1.174 leot 10280: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.ps: PostScript version of the
1.2 rillig 10281: pkgsrc guide.
1.1 dsieger 10282:
1.207 leot 10283: F.2. Procedure
1.1 dsieger 10284:
10285: The procedure to edit the pkgsrc guide is:
10286:
1.190 bacon 10287: 1. Make sure you have checked out the htdocs repository into a sibling
10288: directory of your pkgsrc directory. You will need the ability to commit
10289: from both pkgsrc and htdocs.
10290:
10291: 2. Make sure you have the packages needed to regenerate the pkgsrc guide (and
1.46 obache 10292: other XML-based NetBSD documentation) installed. These are automatically
10293: installed when you install the meta-pkgs/pkgsrc-guide-tools package.
1.1 dsieger 10294:
1.190 bacon 10295: 3. Run cd doc/guide to get to the right directory. All further steps will take
1.1 dsieger 10296: place here.
10297:
1.190 bacon 10298: 4. Edit the XML file(s) in files/.
1.1 dsieger 10299:
1.190 bacon 10300: 5. Run bmake to check the pkgsrc guide for valid XML and to build the final
1.1 dsieger 10301: output files. If you get any errors at this stage, you can just edit the
10302: files, as there are only symbolic links in the working directory, pointing
10303: to the files in files/.
10304:
1.190 bacon 10305: 6. (cd files && cvs commit)
1.1 dsieger 10306:
1.190 bacon 10307: 7. Run bmake clean && bmake to regenerate the output files with the proper RCS
1.1 dsieger 10308: Ids.
10309:
1.190 bacon 10310: 8. Run bmake regen to install and commit the files in both pkgsrc/doc and
1.1 dsieger 10311: htdocs.
10312:
10313: Note
10314:
10315: If you have added, removed or renamed some chapters, you need to
10316: synchronize them using cvs add or cvs delete in the htdocs directory.
10317:
CVSweb <webmaster@jp.NetBSD.org>