Annotation of htdocs/docs/pkgsrc/pkgsrc.txt, revision 1.221
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.213 jnemeth 15: Copyright 1994-2022 The NetBSD Foundation, Inc
1.1 dsieger 16:
1.213 jnemeth 17: $NetBSD: pkgsrc.xml,v 1.41 2022/01/01 06:45:38 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:
32: 1.1. Introduction
33:
34: 1.1.1. Why pkgsrc?
35: 1.1.2. Supported platforms
36:
37: 1.2. Overview
38: 1.3. Terminology
39:
40: 1.3.1. Roles involved in pkgsrc
41:
42: 1.4. Typography
43:
44: I. The pkgsrc user's guide
45:
1.154 rillig 46: 2. Getting help
47: 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 48:
1.154 rillig 49: 3.1. Getting pkgsrc for the first time
1.1 dsieger 50:
1.154 rillig 51: 3.1.1. As tar archive
52: 3.1.2. Via anonymous CVS
1.1 dsieger 53:
1.154 rillig 54: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 55:
1.154 rillig 56: 3.2.1. Via tar files
57: 3.2.2. Via CVS
1.1 dsieger 58:
1.154 rillig 59: 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 60:
1.154 rillig 61: 4.1. Binary distribution
62: 4.2. Bootstrapping pkgsrc
1.1 dsieger 63:
1.154 rillig 64: 5. Using pkgsrc
1.1 dsieger 65:
1.154 rillig 66: 5.1. Using binary packages
1.1 dsieger 67:
1.154 rillig 68: 5.1.1. Finding binary packages
69: 5.1.2. Installing binary packages
1.202 nia 70: 5.1.3. Updating packages
71: 5.1.4. Deinstalling packages
72: 5.1.5. Getting information about installed packages
73: 5.1.6. Checking for security vulnerabilities in installed packages
74: 5.1.7. Finding if newer versions of your installed packages are in
1.1 dsieger 75: pkgsrc
1.202 nia 76: 5.1.8. Other administrative functions
1.1 dsieger 77:
1.154 rillig 78: 5.2. Building packages from source
1.1 dsieger 79:
1.154 rillig 80: 5.2.1. Requirements
81: 5.2.2. Fetching distfiles
82: 5.2.3. How to build and install
1.1 dsieger 83:
1.154 rillig 84: 6. Configuring pkgsrc
1.1 dsieger 85:
1.154 rillig 86: 6.1. General configuration
87: 6.2. Variables affecting the build process
88: 6.3. Variables affecting the installation process
89: 6.4. Selecting and configuring the compiler
1.1 dsieger 90:
1.154 rillig 91: 6.4.1. Selecting the compiler
92: 6.4.2. Additional flags to the compiler (CFLAGS)
93: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 94:
1.154 rillig 95: 6.5. Developer/advanced settings
96: 6.6. Selecting Build Options
1.1 dsieger 97:
1.154 rillig 98: 7. Creating binary packages
1.1 dsieger 99:
1.154 rillig 100: 7.1. Building a single binary package
101: 7.2. Settings for creation of binary packages
1.1 dsieger 102:
1.154 rillig 103: 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 104:
1.154 rillig 105: 8.1. Preparations
1.180 rillig 106: 8.2. Running a bulk build
1.6 rillig 107:
1.154 rillig 108: 8.2.1. Configuration
1.6 rillig 109:
1.154 rillig 110: 8.3. Requirements of a full bulk build
1.178 rillig 111: 8.4. Bulk build variants
1.6 rillig 112:
1.179 rillig 113: 8.4.1. Detect unknown configure options
114: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 115: 8.4.3. Force compiler options only in the build phase
116: 8.4.4. Use custom directories
117: 8.4.5. Turn warnings into errors
118: 8.4.6. Reject packages for which pkglint reports errors
119: 8.4.7. Reject packages that contain forbidden strings
120: 8.4.8. Reject packages whose self-test fails
121: 8.4.9. Reject packages that use undefined shell variables
122: 8.4.10. Turn off verbose logging
1.178 rillig 123:
124: 8.5. Creating a multiple CD-ROM packages collection
125:
126: 8.5.1. Example of cdpack
1.6 rillig 127:
1.154 rillig 128: 9. Directory layout of the installed files
1.6 rillig 129:
1.154 rillig 130: 9.1. File system layout in ${LOCALBASE}
131: 9.2. File system layout in ${VARBASE}
1.6 rillig 132:
1.154 rillig 133: 10. Frequently Asked Questions
1.6 rillig 134:
1.154 rillig 135: 10.1. Are there any mailing lists for pkg-related discussion?
136: 10.2. Utilities for package management (pkgtools)
137: 10.3. How to use pkgsrc as non-root
138: 10.4. How to resume transfers when fetching distfiles?
139: 10.5. How can I install/use modular X.org from pkgsrc?
140: 10.6. How to fetch files from behind a firewall
141: 10.7. How to fetch files from HTTPS sites
142: 10.8. How do I tell make fetch to do passive FTP?
143: 10.9. How to fetch all distfiles at once
144: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc"
1.24 wiz 145: mean?
1.154 rillig 146: 10.11. What does "Could not find bsd.own.mk" mean?
1.221 ! nia 147: 10.12. Using 'sudo' or `priv` with pkgsrc
1.154 rillig 148: 10.13. How do I change the location of configuration files?
149: 10.14. Automated security checks
150: 10.15. Why do some packages ignore my CFLAGS?
151: 10.16. A package does not build. What shall I do?
152: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/???
1.24 wiz 153: merge conflicts" mean?
1.1 dsieger 154:
155: II. The pkgsrc developer's guide
156:
1.154 rillig 157: 11. Getting help
1.184 rillig 158: 12. Package components - files, directories and contents
1.1 dsieger 159:
1.184 rillig 160: 12.1. Makefile
161: 12.2. distinfo
162: 12.3. patches/*
1.1 dsieger 163:
1.184 rillig 164: 12.3.1. Structure of a single patch file
165: 12.3.2. Creating patch files
166: 12.3.3. Sources where the patch files come from
167: 12.3.4. Patching guidelines
168: 12.3.5. Feedback to the author
1.1 dsieger 169:
1.184 rillig 170: 12.4. Other mandatory files
171: 12.5. Optional files
1.1 dsieger 172:
1.184 rillig 173: 12.5.1. Files affecting the binary package
174: 12.5.2. Files affecting the build process
175: 12.5.3. Files affecting nothing at all
1.1 dsieger 176:
1.184 rillig 177: 12.6. work*
178: 12.7. files/*
1.1 dsieger 179:
1.184 rillig 180: 13. The build process
1.1 dsieger 181:
1.184 rillig 182: 13.1. Introduction
183: 13.2. Program location
184: 13.3. Directories used during the build process
185: 13.4. Running a phase
186: 13.5. The fetch phase
1.1 dsieger 187:
1.184 rillig 188: 13.5.1. What to fetch and where to get it from
189: 13.5.2. How are the files fetched?
1.1 dsieger 190:
1.184 rillig 191: 13.6. The checksum phase
192: 13.7. The extract phase
193: 13.8. The patch phase
194: 13.9. The tools phase
195: 13.10. The wrapper phase
196: 13.11. The configure phase
197: 13.12. The build phase
198: 13.13. The test phase
199: 13.14. The install phase
200: 13.15. The package phase
201: 13.16. Cleaning up
202: 13.17. Other helpful targets
1.1 dsieger 203:
1.184 rillig 204: 14. Creating a new pkgsrc package from scratch
1.1 dsieger 205:
1.184 rillig 206: 14.1. Common types of packages
1.1 dsieger 207:
1.219 nia 208: 14.1.1. Python modules and programs
209: 14.1.2. R packages
210: 14.1.3. TeXlive packages
1.1 dsieger 211:
1.184 rillig 212: 14.2. Examples
1.1 dsieger 213:
1.184 rillig 214: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 215:
1.184 rillig 216: 15. Programming in Makefiles
1.1 dsieger 217:
1.184 rillig 218: 15.1. Caveats
219: 15.2. Makefile variables
1.1 dsieger 220:
1.184 rillig 221: 15.2.1. Naming conventions
1.1 dsieger 222:
1.184 rillig 223: 15.3. Code snippets
1.1 dsieger 224:
1.184 rillig 225: 15.3.1. Adding things to a list
226: 15.3.2. Echoing a string exactly as-is
227: 15.3.3. Passing CFLAGS to GNU configure scripts
228: 15.3.4. Handling possibly empty variables
1.1 dsieger 229:
1.184 rillig 230: 16. Options handling
1.1 dsieger 231:
1.184 rillig 232: 16.1. Global default options
233: 16.2. Converting packages to use bsd.options.mk
234: 16.3. Option Names
235: 16.4. Determining the options of dependencies
1.1 dsieger 236:
1.184 rillig 237: 17. Tools needed for building or running
1.1 dsieger 238:
1.184 rillig 239: 17.1. Tools for pkgsrc builds
240: 17.2. Tools needed by packages
241: 17.3. Tools provided by platforms
1.1 dsieger 242:
1.184 rillig 243: 18. Buildlink methodology
1.1 dsieger 244:
1.184 rillig 245: 18.1. Converting packages to use buildlink3
246: 18.2. Writing buildlink3.mk files
1.1 dsieger 247:
1.184 rillig 248: 18.2.1. Anatomy of a buildlink3.mk file
249: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and
250: BUILDLINK_ABI_DEPENDS.pkg in buildlink3.mk files
1.1 dsieger 251:
1.184 rillig 252: 18.3. Writing builtin.mk files
1.1 dsieger 253:
1.184 rillig 254: 18.3.1. Anatomy of a builtin.mk file
255: 18.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 256:
1.184 rillig 257: 19. PLIST issues
1.1 dsieger 258:
1.184 rillig 259: 19.1. RCS ID
260: 19.2. Semi-automatic PLIST generation
261: 19.3. Tweaking output of make print-PLIST
262: 19.4. Variable substitution in PLIST
263: 19.5. Man page compression
264: 19.6. Changing PLIST source with PLIST_SRC
265: 19.7. Platform-specific and differing PLISTs
266: 19.8. Build-specific PLISTs
267: 19.9. Sharing directories between packages
1.1 dsieger 268:
1.184 rillig 269: 20. The pkginstall framework
1.1 dsieger 270:
1.184 rillig 271: 20.1. Files and directories outside the installation prefix
1.1 dsieger 272:
1.184 rillig 273: 20.1.1. Directory manipulation
274: 20.1.2. File manipulation
1.1 dsieger 275:
1.184 rillig 276: 20.2. Configuration files
1.1 dsieger 277:
1.184 rillig 278: 20.2.1. How PKG_SYSCONFDIR is set
279: 20.2.2. Telling the software where configuration files are
280: 20.2.3. Patching installations
281: 20.2.4. Disabling handling of configuration files
1.1 dsieger 282:
1.184 rillig 283: 20.3. System startup scripts
1.1 dsieger 284:
1.184 rillig 285: 20.3.1. Disabling handling of system startup scripts
1.1 dsieger 286:
1.184 rillig 287: 20.4. System users and groups
288: 20.5. System shells
1.1 dsieger 289:
1.184 rillig 290: 20.5.1. Disabling shell registration
1.1 dsieger 291:
1.184 rillig 292: 20.6. Fonts
1.1 dsieger 293:
1.184 rillig 294: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 295:
1.154 rillig 296: 21. Making your package work
1.1 dsieger 297:
1.154 rillig 298: 21.1. General operation
1.1 dsieger 299:
1.154 rillig 300: 21.1.1. How to pull in user-settable variables from mk.conf
301: 21.1.2. User interaction
302: 21.1.3. Handling licenses
303: 21.1.4. Restricted packages
304: 21.1.5. Handling dependencies
305: 21.1.6. Handling conflicts with other packages
306: 21.1.7. Packages that cannot or should not be built
307: 21.1.8. Packages which should not be deleted, once installed
308: 21.1.9. Handling packages with security problems
309: 21.1.10. How to handle incrementing versions when fixing an
1.1 dsieger 310: existing package
1.154 rillig 311: 21.1.11. Substituting variable text in the package files (the SUBST
1.1 dsieger 312: framework)
313:
1.154 rillig 314: 21.2. The fetch phase
1.1 dsieger 315:
1.154 rillig 316: 21.2.1. Packages whose distfiles aren't available for plain
1.1 dsieger 317: downloading
1.154 rillig 318: 21.2.2. How to handle modified distfiles with the 'old' name
319: 21.2.3. Packages hosted on github.com
1.1 dsieger 320:
1.154 rillig 321: 21.3. The configure phase
1.1 dsieger 322:
1.154 rillig 323: 21.3.1. Shared libraries - libtool
324: 21.3.2. Using libtool on GNU packages that already support libtool
325: 21.3.3. GNU Autoconf/Automake
326:
327: 21.4. Programming languages
328:
329: 21.4.1. C, C++, and Fortran
330: 21.4.2. Java
1.205 wiz 331: 21.4.3. Go
332: 21.4.4. Packages containing Perl scripts
333: 21.4.5. Packages containing shell scripts
334: 21.4.6. Other programming languages
1.154 rillig 335:
336: 21.5. The build phase
337:
338: 21.5.1. Compiling C and C++ code conditionally
339: 21.5.2. How to handle compiler bugs
1.172 rillig 340: 21.5.3. No such file or directory
341: 21.5.4. Undefined reference to "..."
342: 21.5.5. Running out of memory
1.154 rillig 343:
344: 21.6. The install phase
345:
346: 21.6.1. Creating needed directories
347: 21.6.2. Where to install documentation
348: 21.6.3. Installing highscore files
349: 21.6.4. Adding DESTDIR support to packages
350: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 351: 21.6.6. Packages installing Perl modules
1.154 rillig 352: 21.6.7. Packages installing info files
353: 21.6.8. Packages installing man pages
1.203 nia 354: 21.6.9. Packages installing X11 fonts
355: 21.6.10. Packages installing SGML or XML data
356: 21.6.11. Packages installing extensions to the MIME database
357: 21.6.12. Packages using intltool
358: 21.6.13. Packages installing startup scripts
359: 21.6.14. Packages installing TeX modules
360: 21.6.15. Packages supporting running binaries in emulation
361: 21.6.16. Packages installing hicolor icons
362: 21.6.17. Packages installing desktop files
1.154 rillig 363:
364: 21.7. Marking packages as having problems
365:
1.184 rillig 366: 22. GNOME packaging and porting
367:
368: 22.1. Meta packages
369: 22.2. Packaging a GNOME application
370: 22.3. Updating GNOME to a newer version
371: 22.4. Patching guidelines
372:
1.154 rillig 373: 23. Submitting and Committing
374:
375: 23.1. Submitting binary packages
376: 23.2. Submitting source packages (for non-NetBSD-developers)
377: 23.3. General notes when adding, updating, or removing packages
378: 23.4. Commit Messages
379: 23.5. Committing: Adding a package to CVS
380: 23.6. Updating a package to a newer version
381: 23.7. Renaming a package in pkgsrc
382: 23.8. Moving a package in pkgsrc
383:
384: 24. Frequently Asked Questions
1.1 dsieger 385:
386: III. The pkgsrc infrastructure internals
387:
1.184 rillig 388: 25. Design of the pkgsrc infrastructure
1.1 dsieger 389:
1.184 rillig 390: 25.1. The meaning of variable definitions
391: 25.2. Avoiding problems before they arise
392: 25.3. Variable evaluation
1.1 dsieger 393:
1.184 rillig 394: 25.3.1. At load time
395: 25.3.2. At runtime
1.1 dsieger 396:
1.184 rillig 397: 25.4. How can variables be specified?
398: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 399:
1.184 rillig 400: 25.5.1. Procedures with parameters
401: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 402:
1.184 rillig 403: 25.6. The order in which files are loaded
1.1 dsieger 404:
1.184 rillig 405: 25.6.1. The order in bsd.prefs.mk
406: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 407:
1.184 rillig 408: 26. Regression tests
1.1 dsieger 409:
1.184 rillig 410: 26.1. Running the regression tests
411: 26.2. Adding a new regression test
1.1 dsieger 412:
1.184 rillig 413: 26.2.1. Overridable functions
414: 26.2.2. Helper functions
1.1 dsieger 415:
1.184 rillig 416: 27. Porting pkgsrc
1.1 dsieger 417:
1.184 rillig 418: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 419:
420: A. A simple example package: bison
421:
422: A.1. files
423:
424: A.1.1. Makefile
425: A.1.2. DESCR
426: A.1.3. PLIST
427: A.1.4. Checking a package with pkglint
428:
429: A.2. Steps for building, installing, packaging
430:
1.207 leot 431: B. Security hardening
1.1 dsieger 432:
1.207 leot 433: B.1. Mechanisms
1.1 dsieger 434:
1.207 leot 435: B.1.1. Enabled by default
436: B.1.2. Not enabled by default
1.1 dsieger 437:
1.207 leot 438: B.2. Caveats
1.1 dsieger 439:
1.207 leot 440: B.2.1. Problems with PKGSRC_MKPIE
441: B.2.2. Problems with PKGSRC_USE_FORTIFY
442: B.2.3. Problems with PKGSRC_USE_RELRO
443: B.2.4. Problems with PKGSRC_USE_SSP
1.1 dsieger 444:
1.207 leot 445: B.3. Auditing the system
446:
447: B.3.1. Checking for PIE
448: B.3.2. Checking for partial RELRO
449: B.3.3. Checking for full RELRO
450: B.3.4. Checking for SSP
451:
452: C. Build logs
453:
454: C.1. Building figlet
455: C.2. Packaging figlet
456:
457: D. Directory layout of the pkgsrc FTP server
458:
459: D.1. distfiles: The distributed source files
460: D.2. misc: Miscellaneous things
461: D.3. packages: Binary packages
462: D.4. reports: Bulk build reports
463: D.5. current, stable, pkgsrc-20xxQy: source packages
464:
465: E. Help topics
466: F. Editing guidelines for the pkgsrc guide
467:
468: F.1. Make targets
469: F.2. Procedure
1.1 dsieger 470:
471: List of Tables
472:
473: 1.1. Platforms supported by pkgsrc
1.184 rillig 474: 12.1. Patching examples
475: 22.1. PLIST handling for GNOME packages
1.1 dsieger 476:
477: Chapter 1. What is pkgsrc?
478:
479: Table of Contents
480:
481: 1.1. Introduction
482:
483: 1.1.1. Why pkgsrc?
484: 1.1.2. Supported platforms
485:
486: 1.2. Overview
487: 1.3. Terminology
488:
489: 1.3.1. Roles involved in pkgsrc
490:
491: 1.4. Typography
492:
493: 1.1. Introduction
494:
495: There is a lot of software freely available for Unix-based systems, which is
496: usually available in form of the source code. Before such software can be used,
497: it needs to be configured to the local system, compiled and installed, and this
498: is exactly what The NetBSD Packages Collection (pkgsrc) does. pkgsrc also has
499: some basic commands to handle binary packages, so that not every user has to
500: build the packages for himself, which is a time-costly task.
501:
502: pkgsrc currently contains several thousand packages, including:
503:
1.104 sevan 504: * www/apache24 - The Apache web server
1.1 dsieger 505:
506: * www/firefox - The Firefox web browser
507:
508: * meta-pkgs/gnome - The GNOME Desktop Environment
509:
1.102 ryoon 510: * meta-pkgs/kde4 - The K Desktop Environment
1.1 dsieger 511:
1.108 rillig 512: ? just to name a few.
1.1 dsieger 513:
514: pkgsrc has built-in support for handling varying dependencies, such as pthreads
515: and X11, and extended features such as IPv6 support on a range of platforms.
516:
517: 1.1.1. Why pkgsrc?
518:
519: pkgsrc provides the following key features:
520:
521: * Easy building of software from source as well as the creation and
522: installation of binary packages. The source and latest patches are
523: retrieved from a master or mirror download site, checksum verified, then
524: built on your system. Support for binary-only distributions is available
525: for both native platforms and NetBSD emulated platforms.
526:
527: * All packages are installed in a consistent directory tree, including
528: binaries, libraries, man pages and other documentation.
529:
1.104 sevan 530: * Tracking of package dependencies automatically, including when performing
531: updates, to ensure required packages are installed. The configuration files
532: of various packages are handled automatically during updates, so local
533: changes are preserved.
1.1 dsieger 534:
535: * Like NetBSD, pkgsrc is designed with portability in mind and consists of
536: highly portable code. This allows the greatest speed of development when
1.26 spz 537: porting to a new platform. This portability also ensures that pkgsrc is
1.1 dsieger 538: consistent across all platforms.
539:
540: * The installation prefix, acceptable software licenses, international
541: encryption requirements and build-time options for a large number of
542: packages are all set in a simple, central configuration file.
543:
544: * The entire source (not including the distribution files) is freely
545: available under a BSD license, so you may extend and adapt pkgsrc to your
546: needs. Support for local packages and patches is available right out of the
547: box, so you can configure it specifically for your environment.
548:
549: The following principles are basic to pkgsrc:
550:
1.198 leot 551: * "It should only work if it's right." -- That means, if a package contains
1.1 dsieger 552: bugs, it's better to find them and to complain about them rather than to
553: just install the package and hope that it works. There are numerous checks
1.175 gutterid 554: in pkgsrc that try to find such bugs: static analysis tools (pkgtools/
1.1 dsieger 555: pkglint), build-time checks (portability of shell scripts), and
556: post-installation checks (installed files, references to shared libraries,
557: script interpreters).
558:
1.198 leot 559: * "If it works, it should work everywhere" -- Like NetBSD has been ported to
1.1 dsieger 560: many hardware architectures, pkgsrc has been ported to many operating
561: systems. Care is taken that packages behave the same on all platforms.
562:
563: 1.1.2. Supported platforms
564:
565: pkgsrc consists of both a source distribution and a binary distribution for
566: these operating systems. After retrieving the required source or binaries, you
567: can be up and running with pkgsrc in just minutes!
568:
569: pkgsrc was derived from FreeBSD's ports system, and initially developed for
570: NetBSD only. Since then, pkgsrc has grown a lot, and now supports the following
571: platforms:
572:
573: Table 1.1. Platforms supported by pkgsrc
574:
1.92 sevan 575: +-----------------------------------------------------------------------------+
576: | Platform | Date Support | Notes |
577: | | Added | |
578: |--------------------------------------+---------------+----------------------|
579: |NetBSD | Aug 1997 | |
580: |--------------------------------------+---------------+----------------------|
581: |Solaris | Mar 1999 |README.Solaris |
582: |--------------------------------------+---------------+----------------------|
583: |Linux | Jun 1999 |README.Linux |
584: |--------------------------------------+---------------+----------------------|
1.191 bacon 585: |Darwin / Mac OS X / OS X / macOS | Oct 2001 |README.macOS |
1.92 sevan 586: |--------------------------------------+---------------+----------------------|
587: |FreeBSD | Nov 2002 |README.FreeBSD |
588: |--------------------------------------+---------------+----------------------|
589: |OpenBSD | Nov 2002 |README.OpenBSD |
590: |--------------------------------------+---------------+----------------------|
591: |IRIX | Dec 2002 |README.IRIX |
592: | | |README.IRIX5.3 |
593: |--------------------------------------+---------------+----------------------|
594: |BSD/OS | Dec 2003 | |
595: |--------------------------------------+---------------+----------------------|
596: |AIX | Dec 2003 |README.AIX |
597: |--------------------------------------+---------------+----------------------|
598: |Interix (Microsoft Windows Services | Mar 2004 |README.Interix |
599: |for Unix) | | |
600: |--------------------------------------+---------------+----------------------|
601: |DragonFlyBSD | Oct 2004 | |
602: |--------------------------------------+---------------+----------------------|
603: |OSF/1 | Nov 2004 |README.OSF1 |
604: |--------------------------------------+---------------+----------------------|
605: |HP-UX | Apr 2007 |README.HPUX |
606: |--------------------------------------+---------------+----------------------|
607: |Haiku | Sep 2010 |README.Haiku |
608: |--------------------------------------+---------------+----------------------|
609: |MirBSD | Jan 2011 | |
610: |--------------------------------------+---------------+----------------------|
611: |Minix3 | Nov 2011 |README.Minix3 |
612: |--------------------------------------+---------------+----------------------|
613: |Cygwin | Mar 2013 |README.Cygwin |
614: |--------------------------------------+---------------+----------------------|
615: |GNU/kFreeBSD | Jul 2013 |README.GNUkFreeBSD |
1.104 sevan 616: |--------------------------------------+---------------+----------------------|
617: |Bitrig | Jun 2014 |README.Bitrig |
1.92 sevan 618: +-----------------------------------------------------------------------------+
1.1 dsieger 619:
620:
621: 1.2. Overview
622:
623: This document is divided into three parts. The first, The pkgsrc user's guide,
624: describes how one can use one of the packages in the Package Collection, either
625: by installing a precompiled binary package, or by building one's own copy using
626: the NetBSD package system. The second part, The pkgsrc developer's guide,
627: explains how to prepare a package so it can be easily built by other NetBSD
628: users without knowing about the package's building details. The third part, The
629: pkgsrc infrastructure internals is intended for those who want to understand
630: how pkgsrc is implemented.
631:
632: This document is available in various formats: HTML, PDF, PS, TXT.
633:
634: 1.3. Terminology
635:
636: There has been a lot of talk about "ports", "packages", etc. so far. Here is a
637: description of all the terminology used within this document.
638:
639: Package
640:
641: A set of files and building instructions that describe what's necessary to
642: build a certain piece of software using pkgsrc. Packages are traditionally
1.123 wiz 643: stored under /usr/pkgsrc, but may be stored in any location, referred to as
644: PKGSRCDIR.
1.1 dsieger 645:
646: The NetBSD package system
647:
648: This is the former name of "pkgsrc". It is part of the NetBSD operating
649: system and can be bootstrapped to run on non-NetBSD operating systems as
650: well. It handles building (compiling), installing, and removing of
651: packages.
652:
653: Distfile
654:
655: This term describes the file or files that are provided by the author of
656: the piece of software to distribute his work. All the changes necessary to
657: build on NetBSD are reflected in the corresponding package. Usually the
658: distfile is in the form of a compressed tar-archive, but other types are
659: possible, too. Distfiles are usually stored below /usr/pkgsrc/distfiles.
660:
661: Port
662:
663: This is the term used by FreeBSD and OpenBSD people for what we call a
664: package. In NetBSD terminology, "port" refers to a different architecture.
665:
666: Precompiled/binary package
667:
668: A set of binaries built with pkgsrc from a distfile and stuffed together in
669: a single .tgz file so it can be installed on machines of the same machine
670: architecture without the need to recompile. Packages are usually generated
671: in /usr/pkgsrc/packages; there is also an archive on ftp.NetBSD.org.
672:
673: Sometimes, this is referred to by the term "package" too, especially in the
674: context of precompiled packages.
675:
676: Program
677:
678: The piece of software to be installed which will be constructed from all
679: the files in the distfile by the actions defined in the corresponding
680: package.
681:
682: 1.3.1. Roles involved in pkgsrc
683:
684: pkgsrc users
685:
686: The pkgsrc users are people who use the packages provided by pkgsrc.
687: Typically they are system administrators. The people using the software
688: that is inside the packages (maybe called "end users") are not covered by
689: the pkgsrc guide.
690:
691: There are two kinds of pkgsrc users: Some only want to install pre-built
692: binary packages. Others build the pkgsrc packages from source, either for
693: installing them directly or for building binary packages themselves. For
694: pkgsrc users Part I, "The pkgsrc user's guide" should provide all necessary
695: documentation.
696:
697: package maintainers
698:
699: A package maintainer creates packages as described in Part II, "The pkgsrc
700: developer's guide".
701:
702: infrastructure developers
703:
704: These people are involved in all those files that live in the mk/ directory
705: and below. Only these people should need to read through Part III, "The
706: pkgsrc infrastructure internals", though others might be curious, too.
707:
708: 1.4. Typography
709:
710: When giving examples for commands, shell prompts are used to show if the
711: command should/can be issued as root, or if "normal" user privileges are
1.115 sevan 712: sufficient. We use a # for root's shell prompt, a % for users' shell prompt,
713: assuming they use the C-shell or tcsh and a $ for bourne shell and derivatives.
1.1 dsieger 714:
715: Part I. The pkgsrc user's guide
716:
717: Table of Contents
718:
1.154 rillig 719: 2. Getting help
720: 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 721:
1.154 rillig 722: 3.1. Getting pkgsrc for the first time
1.1 dsieger 723:
1.154 rillig 724: 3.1.1. As tar archive
725: 3.1.2. Via anonymous CVS
1.1 dsieger 726:
1.154 rillig 727: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 728:
1.154 rillig 729: 3.2.1. Via tar files
730: 3.2.2. Via CVS
1.1 dsieger 731:
1.154 rillig 732: 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 733:
1.154 rillig 734: 4.1. Binary distribution
735: 4.2. Bootstrapping pkgsrc
1.1 dsieger 736:
1.154 rillig 737: 5. Using pkgsrc
1.1 dsieger 738:
1.154 rillig 739: 5.1. Using binary packages
1.1 dsieger 740:
1.154 rillig 741: 5.1.1. Finding binary packages
742: 5.1.2. Installing binary packages
1.202 nia 743: 5.1.3. Updating packages
744: 5.1.4. Deinstalling packages
745: 5.1.5. Getting information about installed packages
746: 5.1.6. Checking for security vulnerabilities in installed packages
747: 5.1.7. Finding if newer versions of your installed packages are in
1.1 dsieger 748: pkgsrc
1.202 nia 749: 5.1.8. Other administrative functions
1.1 dsieger 750:
1.154 rillig 751: 5.2. Building packages from source
1.1 dsieger 752:
1.154 rillig 753: 5.2.1. Requirements
754: 5.2.2. Fetching distfiles
755: 5.2.3. How to build and install
1.1 dsieger 756:
1.154 rillig 757: 6. Configuring pkgsrc
1.1 dsieger 758:
1.154 rillig 759: 6.1. General configuration
760: 6.2. Variables affecting the build process
761: 6.3. Variables affecting the installation process
762: 6.4. Selecting and configuring the compiler
1.1 dsieger 763:
1.154 rillig 764: 6.4.1. Selecting the compiler
765: 6.4.2. Additional flags to the compiler (CFLAGS)
766: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 767:
1.154 rillig 768: 6.5. Developer/advanced settings
769: 6.6. Selecting Build Options
1.1 dsieger 770:
1.154 rillig 771: 7. Creating binary packages
1.1 dsieger 772:
1.154 rillig 773: 7.1. Building a single binary package
774: 7.2. Settings for creation of binary packages
1.1 dsieger 775:
1.154 rillig 776: 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 777:
1.154 rillig 778: 8.1. Preparations
1.180 rillig 779: 8.2. Running a bulk build
1.6 rillig 780:
1.154 rillig 781: 8.2.1. Configuration
1.6 rillig 782:
1.154 rillig 783: 8.3. Requirements of a full bulk build
1.178 rillig 784: 8.4. Bulk build variants
785:
1.179 rillig 786: 8.4.1. Detect unknown configure options
787: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 788: 8.4.3. Force compiler options only in the build phase
789: 8.4.4. Use custom directories
790: 8.4.5. Turn warnings into errors
791: 8.4.6. Reject packages for which pkglint reports errors
792: 8.4.7. Reject packages that contain forbidden strings
793: 8.4.8. Reject packages whose self-test fails
794: 8.4.9. Reject packages that use undefined shell variables
795: 8.4.10. Turn off verbose logging
1.6 rillig 796:
1.178 rillig 797: 8.5. Creating a multiple CD-ROM packages collection
798:
799: 8.5.1. Example of cdpack
1.6 rillig 800:
1.154 rillig 801: 9. Directory layout of the installed files
1.6 rillig 802:
1.154 rillig 803: 9.1. File system layout in ${LOCALBASE}
804: 9.2. File system layout in ${VARBASE}
1.6 rillig 805:
1.154 rillig 806: 10. Frequently Asked Questions
1.6 rillig 807:
1.154 rillig 808: 10.1. Are there any mailing lists for pkg-related discussion?
809: 10.2. Utilities for package management (pkgtools)
810: 10.3. How to use pkgsrc as non-root
811: 10.4. How to resume transfers when fetching distfiles?
812: 10.5. How can I install/use modular X.org from pkgsrc?
813: 10.6. How to fetch files from behind a firewall
814: 10.7. How to fetch files from HTTPS sites
815: 10.8. How do I tell make fetch to do passive FTP?
816: 10.9. How to fetch all distfiles at once
817: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
818: 10.11. What does "Could not find bsd.own.mk" mean?
1.221 ! nia 819: 10.12. Using 'sudo' or `priv` with pkgsrc
1.154 rillig 820: 10.13. How do I change the location of configuration files?
821: 10.14. Automated security checks
822: 10.15. Why do some packages ignore my CFLAGS?
823: 10.16. A package does not build. What shall I do?
824: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.24 wiz 825: conflicts" mean?
1.1 dsieger 826:
1.154 rillig 827: Chapter 2. Getting help
828:
829: To get help when using pkgsrc, the definitive source is this document, the
830: pkgsrc guide. If you don't find anything here, there are alternatives:
831:
832: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
833: Run bmake help topic=? to get help for any topic, such as a variable name
834: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
835: like strcasecmp or any other topic.
836:
1.207 leot 837: The available help topics are listed in Appendix E, Help topics.
1.154 rillig 838:
1.163 rillig 839: * To see the value of a single variable, run bmake show-var VARNAME=X.
840:
841: * To see the values of the most common variables, run bmake show-all. These
842: variables are grouped by topic. To see the variables for a single topic,
843: run bmake show-all-topic, for example bmake show-all-fetch.
844:
1.154 rillig 845: * The pkgsrc-users mailing list, to which you can subscribe and then ask your
846: questions.
847:
848: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
849: a specialized chat program such as XChat. Pick any user name and join the
850: channel #pkgsrc.
851:
852: Chapter 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 853:
854: Table of Contents
855:
1.154 rillig 856: 3.1. Getting pkgsrc for the first time
1.1 dsieger 857:
1.154 rillig 858: 3.1.1. As tar archive
859: 3.1.2. Via anonymous CVS
1.1 dsieger 860:
1.154 rillig 861: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 862:
1.154 rillig 863: 3.2.1. Via tar files
864: 3.2.2. Via CVS
1.1 dsieger 865:
866: Before you download and extract the files, you need to decide where you want to
867: extract them. When using pkgsrc as root user, pkgsrc is usually installed in /
868: usr/pkgsrc. You are though free to install the sources and binary packages
869: wherever you want in your filesystem, provided that the pathname does not
870: contain white-space or other characters that are interpreted specially by the
871: shell and some other programs. A safe bet is to use only letters, digits,
872: underscores and dashes.
873:
1.154 rillig 874: 3.1. Getting pkgsrc for the first time
1.1 dsieger 875:
1.25 wiz 876: Before you download any pkgsrc files, you should decide whether you want the
1.1 dsieger 877: current branch or the stable branch. The latter is forked on a quarterly basis
878: from the current branch and only gets modified for security updates. The names
879: of the stable branches are built from the year and the quarter, for example
1.214 leot 880: 2021Q4.
1.1 dsieger 881:
882: The second step is to decide how you want to download pkgsrc. You can get it as
1.24 wiz 883: a tar file or via CVS. Both ways are described here.
1.1 dsieger 884:
1.52 asau 885: Note that tar archive contains CVS working copy. Thus you can switch to using
886: CVS at any later time.
1.1 dsieger 887:
1.154 rillig 888: 3.1.1. As tar archive
1.52 asau 889:
1.151 sevan 890: The primary download location for all pkgsrc files is https://cdn.NetBSD.org/
891: pub/pkgsrc/ or ftp://ftp.NetBSD.org/pub/pkgsrc/ (it points to the same
892: location). There are a number of subdirectories for different purposes, which
1.207 leot 893: are described in detail in Appendix D, Directory layout of the pkgsrc FTP
1.151 sevan 894: server.
1.1 dsieger 895:
1.52 asau 896: The tar archive for the current branch is in the directory current and is
1.118 sevan 897: called pkgsrc.tar.gz. It is autogenerated weekly.
1.52 asau 898:
899: To save download time we provide bzip2- and xz-compressed archives which are
900: published at pkgsrc.tar.bz2 and pkgsrc.tar.xz respectively.
901:
902: You can fetch the same files using FTP.
1.1 dsieger 903:
1.214 leot 904: The tar file for the stable branch 2021Q4 is in the directory pkgsrc-2021Q4 and
1.59 jnemeth 905: is also called pkgsrc.tar.gz.
1.1 dsieger 906:
1.136 leot 907: To download the latest pkgsrc stable tarball, run:
1.12 weinem 908:
1.214 leot 909: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2021Q4/pkgsrc.tar.gz
1.12 weinem 910:
1.78 snj 911: If you prefer, you can also fetch it using "wget", "curl", or your web browser.
1.52 asau 912:
1.12 weinem 913: Then, extract it with:
914:
1.78 snj 915: $ tar -xzf pkgsrc.tar.gz -C /usr
1.12 weinem 916:
917: This will create the directory pkgsrc/ in /usr/ and all the package source will
918: be stored under /usr/pkgsrc/.
919:
920: To download pkgsrc-current, run:
921:
922: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz
1.1 dsieger 923:
1.154 rillig 924: 3.1.2. Via anonymous CVS
1.1 dsieger 925:
1.24 wiz 926: To fetch a specific pkgsrc stable branch, run:
1.1 dsieger 927:
1.214 leot 928: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2021Q4 -P pkgsrc
1.13 weinem 929:
1.24 wiz 930: This will create the directory pkgsrc/ in your /usr/ directory and all the
931: package source will be stored under /usr/pkgsrc/.
932:
933: To fetch the pkgsrc current branch, run:
1.1 dsieger 934:
1.40 wiz 935: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 936:
1.30 dholland 937: Refer to the list of available mirrors to choose a faster CVS mirror, if
938: needed.
1.1 dsieger 939:
1.24 wiz 940: If you get error messages from rsh, you need to set CVS_RSH variable. E.g.:
1.1 dsieger 941:
1.40 wiz 942: $ cd /usr && env CVS_RSH=ssh cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 943:
1.24 wiz 944: Refer to documentation on your command shell how to set CVS_RSH=ssh
945: permanently. For Bourne shells, you can set it in your .profile or better
946: globally in /etc/profile:
947:
948: # set CVS remote shell command
949: CVS_RSH=ssh
950: export CVS_RSH
1.12 weinem 951:
1.13 weinem 952: By default, CVS doesn't do things like most people would expect it to do. But
953: there is a way to convince CVS, by creating a file called .cvsrc in your home
1.12 weinem 954: directory and saving the following lines to it. This file will save you lots of
955: headache and some bug reports, so we strongly recommend it. You can find an
956: explanation of this file in the CVS documentation.
1.2 rillig 957:
958: # recommended CVS configuration file from the pkgsrc guide
1.155 sevan 959: cvs -q
1.2 rillig 960: checkout -P
1.4 rillig 961: update -dP
962: diff -upN
1.2 rillig 963: rdiff -u
1.24 wiz 964: release -d
1.1 dsieger 965:
1.154 rillig 966: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 967:
968: The preferred way to keep pkgsrc up-to-date is via CVS (which also works if you
969: have first installed it via a tar file). It saves bandwidth and hard disk
970: activity, compared to downloading the tar file again.
971:
1.154 rillig 972: 3.2.1. Via tar files
1.1 dsieger 973:
974: Warning
975:
976: When updating from a tar file, you first need to completely remove the old
977: pkgsrc directory. Otherwise those files that have been removed from pkgsrc in
978: the mean time will not be removed on your local disk, resulting in
979: inconsistencies. When removing the old files, any changes that you have done to
980: the pkgsrc files will be lost after updating. Therefore updating via CVS is
981: strongly recommended.
982:
983: Note that by default the distfiles and the binary packages are saved in the
984: pkgsrc tree, so don't forget to rescue them before updating. You can also
1.78 snj 985: configure pkgsrc to store distfiles and packages in directories outside the
1.154 rillig 986: pkgsrc tree by setting the DISTDIR and PACKAGES variables. See Chapter 6,
1.78 snj 987: Configuring pkgsrc for the details.
1.1 dsieger 988:
989: To update pkgsrc from a tar file, download the tar file as explained above.
990: Then, make sure that you have not made any changes to the files in the pkgsrc
991: directory. Remove the pkgsrc directory and extract the new tar file. Done.
992:
1.154 rillig 993: 3.2.2. Via CVS
1.1 dsieger 994:
1.26 spz 995: To update pkgsrc via CVS, change to the pkgsrc directory and run cvs:
1.12 weinem 996:
1.26 spz 997: $ cd /usr/pkgsrc && cvs update -dP
998:
999: If you get error messages from rsh, you need to set CVS_RSH variable as
1000: described above. E.g.:
1001:
1002: $ cd /usr/pkgsrc && env CVS_RSH=ssh cvs up -dP
1.1 dsieger 1003:
1.154 rillig 1004: 3.2.2.1. Switching between different pkgsrc branches
1.1 dsieger 1005:
1006: When updating pkgsrc, the CVS program keeps track of the branch you selected.
1007: But if you, for whatever reason, want to switch from the stable branch to the
1008: current one, you can do it by adding the option "-A" after the "update"
1.25 wiz 1009: keyword. To switch from the current branch back to the stable branch, add the "
1.214 leot 1010: -rpkgsrc-2021Q4" option.
1.1 dsieger 1011:
1.154 rillig 1012: 3.2.2.2. What happens to my changes when updating?
1.1 dsieger 1013:
1014: When you update pkgsrc, the CVS program will only touch those files that are
1015: registered in the CVS repository. That means that any packages that you created
1016: on your own will stay unmodified. If you change files that are managed by CVS,
1017: later updates will try to merge your changes with those that have been done by
1018: others. See the CVS manual, chapter "update" for details.
1019:
1.154 rillig 1020: Chapter 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 1021:
1022: Table of Contents
1023:
1.154 rillig 1024: 4.1. Binary distribution
1025: 4.2. Bootstrapping pkgsrc
1.1 dsieger 1026:
1.154 rillig 1027: 4.1. Binary distribution
1.1 dsieger 1028:
1.154 rillig 1029: See Section 5.1, "Using binary packages".
1.1 dsieger 1030:
1.154 rillig 1031: 4.2. Bootstrapping pkgsrc
1.1 dsieger 1032:
1.44 asau 1033: pkgsrc can be bootstrapped for use in two different modes: privileged and
1034: unprivileged one. In unprivileged mode in contrast to privileged one all
1.45 asau 1035: programs are installed under one particular user and cannot utilise privileged
1.44 asau 1036: operations (packages don't create special users and all special file
1037: permissions like setuid are ignored).
1038:
1.1 dsieger 1039: Installing the bootstrap kit from source should be as simple as:
1040:
1.60 asau 1041: # env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 1042: # cd pkgsrc/bootstrap
1043: # ./bootstrap
1044:
1045:
1.44 asau 1046: To bootstrap in unprivileged mode pass "--unprivileged" flag to bootstrap
1047:
1048: By default, in privileged mode pkgsrc uses /usr/pkg for prefix where programs
1.118 sevan 1049: will be installed in, and /usr/pkg/pkgdb for the package database directory
1050: where pkgsrc will do its internal bookkeeping, /var is used as varbase, where
1.44 asau 1051: packages install their persistent data. In unprivileged mode pkgsrc uses ~/pkg
1.118 sevan 1052: for prefix, ~/pkg/pkgdb for the package database, and ~/pkg/var for varbase.
1.44 asau 1053:
1054: You can change default layout using command-line arguments. Run "./bootstrap
1055: --help" to get details.
1.1 dsieger 1056:
1057: Note
1058:
1059: The bootstrap installs a bmake tool. Use this bmake when building via pkgsrc.
1060: For examples in this guide, use bmake instead of "make".
1061:
1.44 asau 1062: Note
1063:
1064: It is possible to bootstrap multiple instances of pkgsrc using non-intersecting
1065: directories. Use bmake corresponding to the installation you're working with to
1066: build and install packages.
1067:
1.154 rillig 1068: Chapter 5. Using pkgsrc
1.1 dsieger 1069:
1070: Table of Contents
1071:
1.154 rillig 1072: 5.1. Using binary packages
1.1 dsieger 1073:
1.154 rillig 1074: 5.1.1. Finding binary packages
1075: 5.1.2. Installing binary packages
1.202 nia 1076: 5.1.3. Updating packages
1077: 5.1.4. Deinstalling packages
1078: 5.1.5. Getting information about installed packages
1079: 5.1.6. Checking for security vulnerabilities in installed packages
1080: 5.1.7. Finding if newer versions of your installed packages are in pkgsrc
1081: 5.1.8. Other administrative functions
1.154 rillig 1082:
1083: 5.2. Building packages from source
1084:
1085: 5.2.1. Requirements
1086: 5.2.2. Fetching distfiles
1087: 5.2.3. How to build and install
1.1 dsieger 1088:
1089: Basically, there are two ways of using pkgsrc. The first is to only install the
1090: package tools and to use binary packages that someone else has prepared. This
1091: is the "pkg" in pkgsrc. The second way is to install the "src" of pkgsrc, too.
1092: Then you are able to build your own packages, and you can still use binary
1093: packages from someone else.
1094:
1.154 rillig 1095: 5.1. Using binary packages
1.1 dsieger 1096:
1.151 sevan 1097: On the cdn.NetBSD.org site and mirrors, there are collections of binary
1.9 rillig 1098: packages, ready to be installed. These binary packages have been built using
1099: the default settings for the directories, that is:
1100:
1101: * /usr/pkg for LOCALBASE, where most of the files are installed,
1102:
1103: * /usr/pkg/etc for configuration files,
1104:
1105: * /var for VARBASE, where those files are installed that may change after
1106: installation.
1107:
1108: If you cannot use these directories for whatever reasons (maybe because you're
1109: not root), you cannot use these binary packages, but have to build the packages
1.154 rillig 1110: yourself, which is explained in Section 4.2, "Bootstrapping pkgsrc".
1.1 dsieger 1111:
1.154 rillig 1112: 5.1.1. Finding binary packages
1.1 dsieger 1113:
1.5 weinem 1114: To install binary packages, you first need to know from where to get them. The
1.202 nia 1115: first place where you should look is on the main pkgsrc CDN in the directory /
1116: pub/pkgsrc/packages.
1.5 weinem 1117:
1118: This directory contains binary packages for multiple platforms. First, select
1119: your operating system. (Ignore the directories with version numbers attached to
1120: it, they just exist for legacy reasons.) Then, select your hardware
1121: architecture, and in the third step, the OS version and the "version" of
1.9 rillig 1122: pkgsrc.
1123:
1124: In this directory, you often find a file called bootstrap.tar.gz which contains
1125: the package management tools. If the file is missing, it is likely that your
1126: operating system already provides those tools. Download the file and extract it
1127: in the / directory. It will create the directories /usr/pkg (containing the
1.118 sevan 1128: tools for managing binary packages and the database of installed packages).
1.1 dsieger 1129:
1.154 rillig 1130: 5.1.2. Installing binary packages
1.1 dsieger 1131:
1.85 wiz 1132: In the directory from the last section, there is a subdirectory called All/,
1.9 rillig 1133: which contains all the binary packages that are available for the platform,
1.202 nia 1134: excluding those that may not be distributed via HTTP or FTP.
1.9 rillig 1135:
1136: To install packages directly from an FTP or HTTP server, run the following
1137: commands in a Bourne-compatible shell (be sure to su to root first):
1138:
1.202 nia 1139: # PATH="/usr/pkg/sbin:/usr/pkg/bin:$PATH"
1140: # PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages"
1.169 rillig 1141: # PKG_PATH="$PKG_PATH/OPSYS/ARCH/VERSIONS/All/"
1.9 rillig 1142: # export PATH PKG_PATH
1.202 nia 1143: # pkg_add pkgin
1.9 rillig 1144:
1145: Instead of URLs, you can also use local paths, for example if you are
1146: installing from a set of CDROMs, DVDs or an NFS-mounted repository. If you want
1147: to install packages from multiple sources, you can separate them by a semicolon
1148: in PKG_PATH.
1149:
1150: After these preparations, installing a package is very easy:
1151:
1.202 nia 1152: # pkgin search nginx
1153: nginx-1.19.6 Lightweight HTTP server and mail proxy server
1154: nginx-1.18.0nb8 Lightweight HTTP server and mail proxy server
1155: # pkgin install zsh nginx-1.19.6 vim
1.1 dsieger 1156:
1.202 nia 1157: Note that pkgin is a user-friendly frontend to the pkg_* tools.
1.1 dsieger 1158:
1.202 nia 1159: Any prerequisite packages needed to run the package in question will be
1160: installed, too, assuming they are present in the repository.
1.1 dsieger 1161:
1162: After you've installed packages, be sure to have /usr/pkg/bin and /usr/pkg/sbin
1163: in your PATH so you can actually start the just installed program.
1164:
1.202 nia 1165: 5.1.3. Updating packages
1.1 dsieger 1166:
1.202 nia 1167: To update binary packages, it is recommended that you use pkgin upgrade. This
1168: will compare the remote package repository to your locally installed packages
1169: and safely replace any older packages.
1.1 dsieger 1170:
1.202 nia 1171: Note that pkgsrc is released as quarterly branches. If you are updating to a
1172: newer quarterly branch of pkgsrc, you may need to adjust the repository in /usr
1173: /pkg/etc/pkgin/repositories.conf.
1.1 dsieger 1174:
1.202 nia 1175: 5.1.4. Deinstalling packages
1.1 dsieger 1176:
1.202 nia 1177: To deinstall a package, it does not matter whether it was installed from source
1178: code or from a binary package. Neither the pkgin or the pkg_delete command need
1179: to know.
1.1 dsieger 1180:
1.202 nia 1181: To delete a package, you can just run pkgin remove package-name. The package
1182: name can be given with or without version number.
1.1 dsieger 1183:
1.202 nia 1184: 5.1.5. Getting information about installed packages
1.1 dsieger 1185:
1186: The pkg_info shows information about installed packages or binary package
1.202 nia 1187: files. As with other management tools, it works with packages installed from
1188: source or binaries.
1.1 dsieger 1189:
1.202 nia 1190: 5.1.6. Checking for security vulnerabilities in installed packages
1.1 dsieger 1191:
1.202 nia 1192: The pkgsrc Security Team and Packages Groups maintain a list of known
1.164 leot 1193: vulnerabilities to packages which are (or have been) included in pkgsrc. The
1.202 nia 1194: list is available from the NetBSD CDN at https://cdn.NetBSD.org/pub/NetBSD/
1.179 rillig 1195: packages/vulns/pkg-vulnerabilities.
1.1 dsieger 1196:
1.202 nia 1197: Please note that not every "vulnerability" with a CVE assignment is exploitable
1198: in every configuration. Some bugs are marked as active simply because an fix
1199: was not marked as such. Operating system specific hardening and mitigation
1200: features may also reduce the impact of bugs.
1201:
1.23 jakllsch 1202: Through pkg_admin fetch-pkg-vulnerabilities, this list can be downloaded
1203: automatically, and a security audit of all packages installed on a system can
1204: take place.
1205:
1206: There are two components to auditing. The first step, pkg_admin
1207: fetch-pkg-vulnerabilities, is for downloading the list of vulnerabilities from
1208: the NetBSD FTP site. The second step, pkg_admin audit, checks to see if any of
1209: your installed packages are vulnerable. If a package is vulnerable, you will
1210: see output similar to the following:
1.1 dsieger 1211:
1212: Package samba-2.0.9 has a local-root-shell vulnerability, see
1.174 leot 1213: https://www.samba.org/samba/whatsnew/macroexploit.html
1.1 dsieger 1214:
1.23 jakllsch 1215: You may wish to have the vulnerabilities file downloaded daily so that it
1216: remains current. This may be done by adding an appropriate entry to the root
1217: users crontab(5) entry. For example the entry
1218:
1.121 sevan 1219: # Download vulnerabilities file
1.118 sevan 1220: 0 3 * * * /usr/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities >/dev/null 2>&1
1.121 sevan 1221: # Audit the installed packages and email results to root
1222: 9 3 * * * /usr/pkg/sbin/pkg_admin audit |mail -s "Installed package audit result" \
1223: root >/dev/null 2>&1
1.118 sevan 1224:
1225:
1226: will update the vulnerability list every day at 3AM, followed by an audit at
1227: 3:09AM. The result of the audit are then emailed to root. On NetBSD this may be
1228: accomplished instead by adding the following line to /etc/daily.conf:
1229:
1230: fetch_pkg_vulnerabilities=YES
1231:
1.23 jakllsch 1232:
1.118 sevan 1233: to fetch the vulnerability list from the daily security script. The system is
1234: set to audit the packages by default but can be set explicitly, if desired (not
1.123 wiz 1235: required), by adding the following line to /etc/security.conf:
1.23 jakllsch 1236:
1.118 sevan 1237: check_pkg_vulnerabilities=YES
1.23 jakllsch 1238:
1239:
1.118 sevan 1240: see daily.conf(5) and security.conf(5) for more details.
1.1 dsieger 1241:
1.202 nia 1242: 5.1.7. Finding if newer versions of your installed packages are in pkgsrc
1.1 dsieger 1243:
1.12 weinem 1244: Install pkgtools/lintpkgsrc and run lintpkgsrc with the "-i" argument to check
1.202 nia 1245: if any packages are stale, e.g.
1.1 dsieger 1246:
1247: % lintpkgsrc -i
1248: ...
1249: Version mismatch: 'tcsh' 6.09.00 vs 6.10.00
1250:
1251:
1.202 nia 1252: 5.1.8. Other administrative functions
1.1 dsieger 1253:
1254: The pkg_admin executes various administrative functions on the package system.
1255:
1.154 rillig 1256: 5.2. Building packages from source
1.1 dsieger 1257:
1258: After obtaining pkgsrc, the pkgsrc directory now contains a set of packages,
1.25 wiz 1259: organized into categories. You can browse the online index of packages, or run
1.1 dsieger 1260: make readme from the pkgsrc directory to build local README.html files for all
1261: packages, viewable with any web browser such as www/lynx or www/firefox.
1262:
1263: The default prefix for installed packages is /usr/pkg. If you wish to change
1264: this, you should do so by setting LOCALBASE in mk.conf. You should not try to
1265: use multiple different LOCALBASE definitions on the same system (inside a
1266: chroot is an exception).
1267:
1268: The rest of this chapter assumes that the package is already in pkgsrc. If it
1269: is not, see Part II, "The pkgsrc developer's guide" for instructions how to
1270: create your own packages.
1271:
1.154 rillig 1272: 5.2.1. Requirements
1.1 dsieger 1273:
1274: To build packages from source, you need a working C compiler. On NetBSD, you
1275: need to install the "comp" and the "text" distribution sets. If you want to
1276: build X11-related packages, the "xbase" and "xcomp" distribution sets are
1277: required, too.
1278:
1.154 rillig 1279: 5.2.2. Fetching distfiles
1.1 dsieger 1280:
1281: The first step for building a package is downloading the distfiles (i.e. the
1282: unmodified source). If they have not yet been downloaded, pkgsrc will fetch
1283: them automatically.
1284:
1285: If you have all files that you need in the distfiles directory, you don't need
1286: to connect. If the distfiles are on CD-ROM, you can mount the CD-ROM on /cdrom
1287: and add:
1288:
1289: DISTDIR=/cdrom/pkgsrc/distfiles
1290:
1291: to your mk.conf.
1292:
1293: By default a list of distribution sites will be randomly intermixed to prevent
1294: huge load on servers which holding popular packages (for example,
1295: SourceForge.net mirrors). Thus, every time when you need to fetch yet another
1296: distfile all the mirrors will be tried in new (random) order. You can turn this
1297: feature off by setting MASTER_SORT_RANDOM=NO (for PKG_DEVELOPERs it's already
1298: disabled).
1299:
1300: You can overwrite some of the major distribution sites to fit to sites that are
1301: close to your own. By setting one or two variables you can modify the order in
1302: which the master sites are accessed. MASTER_SORT contains a whitespace
1303: delimited list of domain suffixes. MASTER_SORT_REGEX is even more flexible, it
1304: contains a whitespace delimited list of regular expressions. It has higher
1305: priority than MASTER_SORT. Have a look at pkgsrc/mk/defaults/mk.conf to find
1306: some examples. This may save some of your bandwidth and time.
1307:
1308: You can change these settings either in your shell's environment, or, if you
1.4 rillig 1309: want to keep the settings, by editing the mk.conf file, and adding the
1.1 dsieger 1310: definitions there.
1311:
1.132 wiz 1312: If a package depends on many other packages (such as meta-pkgs/kde4), the build
1.1 dsieger 1313: process may alternate between periods of downloading source, and compiling. To
1314: ensure you have all the source downloaded initially you can run the command:
1315:
1316: % make fetch-list | sh
1317:
1318: which will output and run a set of shell commands to fetch the necessary files
1319: into the distfiles directory. You can also choose to download the files
1320: manually.
1321:
1.154 rillig 1322: 5.2.3. How to build and install
1.1 dsieger 1323:
1324: Once the software has downloaded, any patches will be applied, then it will be
1325: compiled for you. This may take some time depending on your computer, and how
1326: many other packages the software depends on and their compile time.
1327:
1328: Note
1329:
1330: If using bootstrap or pkgsrc on a non-NetBSD system, use the pkgsrc bmake
1331: command instead of "make" in the examples in this guide.
1332:
1333: For example, type
1334:
1335: % cd misc/figlet
1336: % make
1337:
1338:
1339: at the shell prompt to build the various components of the package.
1340:
1341: The next stage is to actually install the newly compiled program onto your
1342: system. Do this by entering:
1343:
1344: % make install
1345:
1346:
1347: while you are still in the directory for whatever package you are installing.
1348:
1349: Installing the package on your system may require you to be root. However,
1350: pkgsrc has a just-in-time-su feature, which allows you to only become root for
1351: the actual installation step.
1352:
1353: That's it, the software should now be installed and setup for use. You can now
1354: enter:
1355:
1356: % make clean
1357:
1358:
1359: to remove the compiled files in the work directory, as you shouldn't need them
1360: any more. If other packages were also added to your system (dependencies) to
1361: allow your program to compile, you can tidy these up also with the command:
1362:
1363: % make clean-depends
1364:
1365:
1366: Taking the figlet utility as an example, we can install it on our system by
1.207 leot 1367: building as shown in Appendix C, Build logs.
1.1 dsieger 1368:
1369: The program is installed under the default root of the packages tree - /usr/
1370: pkg. Should this not conform to your tastes, set the LOCALBASE variable in your
1371: environment, and it will use that value as the root of your packages tree. So,
1372: to use /usr/local, set LOCALBASE=/usr/local in your environment. Please note
1373: that you should use a directory which is dedicated to packages and not shared
1374: with other programs (i.e., do not try and use LOCALBASE=/usr). Also, you should
1375: not try to add any of your own files or directories (such as src/, obj/, or
1376: pkgsrc/) below the LOCALBASE tree. This is to prevent possible conflicts
1377: between programs and other files installed by the package system and whatever
1378: else may have been installed there.
1379:
1.4 rillig 1380: Some packages look in mk.conf to alter some configuration options at build
1.1 dsieger 1381: time. Have a look at pkgsrc/mk/defaults/mk.conf to get an overview of what will
1382: be set there by default. Environment variables such as LOCALBASE can be set in
1.4 rillig 1383: mk.conf to save having to remember to set them each time you want to use
1.1 dsieger 1384: pkgsrc.
1385:
1386: Occasionally, people want to "look under the covers" to see what is going on
1387: when a package is building or being installed. This may be for debugging
1388: purposes, or out of simple curiosity. A number of utility values have been
1389: added to help with this.
1390:
1391: 1. If you invoke the make(1) command with PKG_DEBUG_LEVEL=2, then a huge
1392: amount of information will be displayed. For example,
1393:
1394: make patch PKG_DEBUG_LEVEL=2
1395:
1.25 wiz 1396: will show all the commands that are invoked, up to and including the "patch
1397: " stage.
1.1 dsieger 1398:
1399: 2. If you want to know the value of a certain make(1) definition, then the
1400: VARNAME definition should be used, in conjunction with the show-var target.
1401: e.g. to show the expansion of the make(1) variable LOCALBASE:
1402:
1403: % make show-var VARNAME=LOCALBASE
1404: /usr/pkg
1405: %
1406:
1407:
1408: If you want to install a binary package that you've either created yourself
1409: (see next section), that you put into pkgsrc/packages manually or that is
1410: located on a remote FTP server, you can use the "bin-install" target. This
1411: target will install a binary package - if available - via pkg_add(1), else do a
1412: make package. The list of remote FTP sites searched is kept in the variable
1413: BINPKG_SITES, which defaults to ftp.NetBSD.org. Any flags that should be added
1414: to pkg_add(1) can be put into BIN_INSTALL_FLAGS. See pkgsrc/mk/defaults/mk.conf
1415: for more details.
1416:
1417: A final word of warning: If you set up a system that has a non-standard setting
1418: for LOCALBASE, be sure to set that before any packages are installed, as you
1419: cannot use several directories for the same purpose. Doing so will result in
1420: pkgsrc not being able to properly detect your installed packages, and fail
1421: miserably. Note also that precompiled binary packages are usually built with
1422: the default LOCALBASE of /usr/pkg, and that you should not install any if you
1423: use a non-standard LOCALBASE.
1424:
1.154 rillig 1425: Chapter 6. Configuring pkgsrc
1.1 dsieger 1426:
1427: Table of Contents
1428:
1.154 rillig 1429: 6.1. General configuration
1430: 6.2. Variables affecting the build process
1431: 6.3. Variables affecting the installation process
1432: 6.4. Selecting and configuring the compiler
1433:
1434: 6.4.1. Selecting the compiler
1435: 6.4.2. Additional flags to the compiler (CFLAGS)
1436: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 1437:
1.154 rillig 1438: 6.5. Developer/advanced settings
1439: 6.6. Selecting Build Options
1.1 dsieger 1440:
1441: The whole pkgsrc system is configured in a single file, usually called mk.conf.
1442: In which directory pkgsrc looks for that file depends on the installation. On
1443: NetBSD, when you use make(1) from the base system, it is in the directory /etc
1444: /. In all other cases the default location is ${PREFIX}/etc/, depending on
1445: where you told the bootstrap program to install the binary packages.
1446:
1447: The format of the configuration file is that of the usual BSD-style Makefiles.
1448: The whole pkgsrc configuration is done by setting variables in this file. Note
1449: that you can define all kinds of variables, and no special error checking (for
1.112 rillig 1450: example for spelling mistakes) takes place.
1.1 dsieger 1451:
1.154 rillig 1452: 6.1. General configuration
1.1 dsieger 1453:
1.112 rillig 1454: The following variables apply to all pkgsrc packages. A complete list of the
1455: variables that can be configured by the user is available in mk/defaults/
1456: mk.conf, together with some comments that describe each variable's intent.
1.1 dsieger 1457:
1458: * LOCALBASE: Where packages will be installed. The default is /usr/pkg. Do
1459: not mix binary packages with different LOCALBASEs!
1460:
1461: * CROSSBASE: Where "cross" category packages will be installed. The default
1462: is ${LOCALBASE}/cross.
1463:
1.84 wiz 1464: * X11BASE: Where X11 is installed on the system. The default is /usr/X11R7.
1.1 dsieger 1465:
1466: * DISTDIR: Where to store the downloaded copies of the original source
1467: distributions used for building pkgsrc packages. The default is $
1468: {PKGSRCDIR}/distfiles.
1469:
1470: * PKG_DBDIR: Where the database about installed packages is stored. The
1.118 sevan 1471: default is /usr/pkg/pkgdb.
1.1 dsieger 1472:
1473: * MASTER_SITE_OVERRIDE: If set, override the packages' MASTER_SITES with this
1474: value.
1475:
1476: * MASTER_SITE_BACKUP: Backup location(s) for distribution files and patch
1477: files if not found locally or in ${MASTER_SITES} or ${PATCH_SITES}
1.118 sevan 1478: respectively. The defaults is ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/$
1.1 dsieger 1479: {DIST_SUBDIR}/.
1480:
1481: * BINPKG_SITES: List of sites carrying binary pkgs. rel and arch are replaced
1482: with OS release ("2.0", etc.) and architecture ("mipsel", etc.).
1483:
1.23 jakllsch 1484: * ACCEPTABLE_LICENSES: List of acceptable licenses. License names are
1485: case-sensitive. Whenever you try to build a package whose license is not in
1486: this list, you will get an error message. If the license condition is
1487: simple enough, the error message will include specific instructions on how
1488: to change this variable.
1.1 dsieger 1489:
1.154 rillig 1490: 6.2. Variables affecting the build process
1.1 dsieger 1491:
1492: * PACKAGES: The top level directory for the binary packages. The default is $
1493: {PKGSRCDIR}/packages.
1494:
1495: * WRKOBJDIR: The top level directory where, if defined, the separate working
1496: directories will get created, and symbolically linked to from ${WRKDIR}
1497: (see below). This is useful for building packages on several architectures,
1498: then ${PKGSRCDIR} can be NFS-mounted while ${WRKOBJDIR} is local to every
1499: architecture. (It should be noted that PKGSRCDIR should not be set by the
1.198 leot 1500: user -- it is an internal definition which refers to the root of the pkgsrc
1.1 dsieger 1501: tree. It is possible to have many pkgsrc tree instances.)
1502:
1503: * LOCALPATCHES: Directory for local patches that aren't part of pkgsrc. See
1.184 rillig 1504: Section 12.3, "patches/*" for more information.
1.1 dsieger 1505:
1506: * PKGMAKECONF: Location of the mk.conf file used by a package's BSD-style
1507: Makefile. If this is not set, MAKECONF is set to /dev/null to avoid picking
1508: up settings used by builds in /usr/src.
1509:
1.154 rillig 1510: 6.3. Variables affecting the installation process
1.1 dsieger 1511:
1.198 leot 1512: * PKGSRC_KEEP_BIN_PKGS: By default, binary packages of built packages are
1.150 leot 1513: preserved in ${PACKAGES}/All. Setting this variable to "no" prevents this.
1.1 dsieger 1514:
1.107 jnemeth 1515: Packages have to support installation into a subdirectory of WRKDIR. This
1516: allows a package to be built, before the actual filesystem is touched. DESTDIR
1517: support exists in two variations:
1.4 rillig 1518:
1519: * Basic DESTDIR support means that the package installation and packaging is
1520: still run as root.
1521:
1522: * Full DESTDIR support can run the complete build, installation and packaging
1523: as normal user. Root privileges are only needed to add packages.
1524:
1525: With basic DESTDIR support, make clean needs to be run as root.
1526:
1.17 imil 1527: Considering the foo/bar package, DESTDIR full support can be tested using the
1528: following commands
1529:
1530: $ id
1531: uid=1000(myusername) gid=100(users) groups=100(users),0(wheel)
1532: $ mkdir $HOME/packages
1533: $ cd $PKGSRCDIR/foo/bar
1534:
1535: Verify DESTDIR full support, no root privileges should be needed
1536:
1.66 asau 1537: $ make stage-install
1.17 imil 1538:
1539: Create a package without root privileges
1540:
1.66 asau 1541: $ make PACKAGES=$HOME/packages package
1.17 imil 1542:
1543: For the following command, you must be able to gain root privileges using su(1)
1544:
1.66 asau 1545: $ make PACKAGES=$HOME/packages install
1.17 imil 1546:
1547: Then, as a simple user
1548:
1549: $ make clean
1550:
1.154 rillig 1551: 6.4. Selecting and configuring the compiler
1.4 rillig 1552:
1.154 rillig 1553: 6.4.1. Selecting the compiler
1.1 dsieger 1554:
1555: By default, pkgsrc will use GCC to build packages. This may be overridden by
1556: setting the following variables in /etc/mk.conf:
1557:
1558: PKGSRC_COMPILER:
1559:
1560: This is a list of values specifying the chain of compilers to invoke when
1561: building packages. Valid values are:
1562:
1.66 asau 1563: + ccc: Compaq C Compilers (Tru64)
1564:
1565: + ccache: compiler cache (chainable)
1566:
1567: + clang: Clang C and Objective-C compiler
1568:
1.42 asau 1569: + distcc: distributed C/C++ (chainable)
1.1 dsieger 1570:
1.66 asau 1571: + f2c: Fortran 77 to C compiler (chainable)
1572:
1573: + icc: Intel C++ Compiler (Linux)
1574:
1575: + ido: SGI IRIS Development Option cc (IRIX 5)
1.1 dsieger 1576:
1.42 asau 1577: + gcc: GNU C/C++ Compiler
1.1 dsieger 1578:
1.66 asau 1579: + hp: HP-UX C/aC++ compilers
1580:
1.42 asau 1581: + mipspro: Silicon Graphics, Inc. MIPSpro (n32/n64)
1.1 dsieger 1582:
1.66 asau 1583: + mipspro-ucode: Silicon Graphics, Inc. MIPSpro (o32)
1.1 dsieger 1584:
1.42 asau 1585: + sunpro: Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio
1.1 dsieger 1586:
1.118 sevan 1587: + xlc: IBM's XL C/C++ compiler suite
1.66 asau 1588:
1.1 dsieger 1589: The default is "gcc". You can use ccache and/or distcc with an appropriate
1590: PKGSRC_COMPILER setting, e.g. "ccache gcc". This variable should always be
1591: terminated with a value for a real compiler. Note that only one real
1592: compiler should be listed (e.g. "sunpro gcc" is not allowed).
1593:
1594: GCC_REQD:
1595:
1596: This specifies the minimum version of GCC to use when building packages. If
1597: the system GCC doesn't satisfy this requirement, then pkgsrc will build and
1598: install one of the GCC packages to use instead.
1599:
1.153 leot 1600: PYTHON_VERSION_DEFAULT:
1.114 maya 1601:
1602: Specifies which version of python to use when several options are
1603: available.
1604:
1605: PKGSRC_FORTRAN:
1606:
1.176 gutterid 1607: Specifies the Fortran compiler to use. The default is gfortran.
1.114 maya 1608:
1609: GFORTRAN_VERSION:
1610:
1611: If PKGSRC_FORTRAN= gfortran is used, this option specifies which version to
1612: use.
1613:
1.154 rillig 1614: 6.4.2. Additional flags to the compiler (CFLAGS)
1.1 dsieger 1615:
1616: If you wish to set the CFLAGS variable, please make sure to use the += operator
1617: instead of the = operator:
1618:
1619: CFLAGS+= -your -flags
1620:
1621: Using CFLAGS= (i.e. without the "+") may lead to problems with packages that
1.16 jnemeth 1622: need to add their own flags. You may want to take a look at the devel/cpuflags
1.24 wiz 1623: package if you're interested in optimization specifically for the current CPU.
1.1 dsieger 1624:
1.154 rillig 1625: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 1626:
1627: If you want to pass flags to the linker, both in the configure step and the
1628: build step, you can do this in two ways. Either set LDFLAGS or LIBS. The
1629: difference between the two is that LIBS will be appended to the command line,
1630: while LDFLAGS come earlier. LDFLAGS is pre-loaded with rpath settings for ELF
1631: machines depending on the setting of USE_IMAKE or the inclusion of mk/
1632: x11.buildlink3.mk. As with CFLAGS, if you do not wish to override these
1633: settings, use the += operator:
1634:
1635: LDFLAGS+= -your -linkerflags
1636:
1.154 rillig 1637: 6.5. Developer/advanced settings
1.1 dsieger 1638:
1639: * PKG_DEVELOPER: Run some sanity checks that package developers want:
1640:
1.42 asau 1641: + make sure patches apply with zero fuzz
1.1 dsieger 1642:
1.42 asau 1643: + run check-shlibs to see that all binaries will find their shared libs.
1.1 dsieger 1644:
1645: * PKG_DEBUG_LEVEL: The level of debugging output which is displayed whilst
1646: making and installing the package. The default value for this is 0, which
1647: will not display the commands as they are executed (normal, default, quiet
1648: operation); the value 1 will display all shell commands before their
1649: invocation, and the value 2 will display both the shell commands before
1.112 rillig 1650: their invocation, as well as their actual execution progress with set -x.
1.1 dsieger 1651:
1.154 rillig 1652: 6.6. Selecting Build Options
1.1 dsieger 1653:
1654: Some packages have build time options, usually to select between different
1655: dependencies, enable optional support for big dependencies or enable
1656: experimental features.
1657:
1658: To see which options, if any, a package supports, and which options are
1659: mutually exclusive, run make show-options, for example:
1660:
1661: The following options are supported by this package:
1662: ssl Enable SSL support.
1663: Exactly one of the following gecko options is required:
1664: firefox Use firefox as gecko rendering engine.
1665: mozilla Use mozilla as gecko rendering engine.
1666: At most one of the following database options may be selected:
1667: mysql Enable support for MySQL database.
1668: pgsql Enable support for PostgreSQL database.
1669:
1670: These options are enabled by default: firefox
1671: These options are currently enabled: mozilla ssl
1672:
1.4 rillig 1673: The following variables can be defined in mk.conf to select which options to
1674: enable for a package: PKG_DEFAULT_OPTIONS, which can be used to select or
1.1 dsieger 1675: disable options for all packages that support them, and PKG_OPTIONS.pkgbase,
1676: which can be used to select or disable options specifically for package pkgbase
1677: . Options listed in these variables are selected, options preceded by "-" are
1678: disabled. A few examples:
1679:
1.4 rillig 1680: $ grep "PKG.*OPTION" mk.conf
1.1 dsieger 1681: PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
1682: PKG_OPTIONS.kdebase= debug -sasl
1683: PKG_OPTIONS.apache= suexec
1684:
1.11 rillig 1685: It is important to note that options that were specifically suggested by the
1.19 snj 1686: package maintainer must be explicitly removed if you do not wish to include the
1687: option. If you are unsure you can view the current state with make show-options
1688: .
1.11 rillig 1689:
1.1 dsieger 1690: The following settings are consulted in the order given, and the last setting
1691: that selects or disables an option is used:
1692:
1693: 1. the default options as suggested by the package maintainer
1694:
1695: 2. the options implied by the settings of legacy variables (see below)
1696:
1697: 3. PKG_DEFAULT_OPTIONS
1698:
1699: 4. PKG_OPTIONS.pkgbase
1700:
1701: For groups of mutually exclusive options, the last option selected is used, all
1702: others are automatically disabled. If an option of the group is explicitly
1703: disabled, the previously selected option, if any, is used. It is an error if no
1704: option from a required group of options is selected, and building the package
1705: will fail.
1706:
1707: Before the options framework was introduced, build options were selected by
1.4 rillig 1708: setting a variable (often named USE_FOO) in mk.conf for each option. To ease
1709: transition to the options framework for the user, these legacy variables are
1710: converted to the appropriate options setting (PKG_OPTIONS.pkgbase)
1711: automatically. A warning is issued to prompt the user to update mk.conf to use
1712: the options framework directly. Support for the legacy variables will be
1.1 dsieger 1713: removed eventually.
1714:
1.154 rillig 1715: Chapter 7. Creating binary packages
1.1 dsieger 1716:
1717: Table of Contents
1718:
1.154 rillig 1719: 7.1. Building a single binary package
1720: 7.2. Settings for creation of binary packages
1.1 dsieger 1721:
1.154 rillig 1722: 7.1. Building a single binary package
1.1 dsieger 1723:
1724: Once you have built and installed a package, you can create a binary package
1725: which can be installed on another system with pkg_add(1). This saves having to
1726: build the same package on a group of hosts and wasting CPU time. It also
1727: provides a simple means for others to install your package, should you
1728: distribute it.
1729:
1730: To create a binary package, change into the appropriate directory in pkgsrc,
1731: and run make package:
1732:
1.112 rillig 1733: $ cd misc/figlet
1734: $ make package
1.1 dsieger 1735:
1736: This will build and install your package (if not already done), and then build
1737: a binary package from what was installed. You can then use the pkg_* tools to
1738: manipulate it. Binary packages are created by default in /usr/pkgsrc/packages,
1.207 leot 1739: in the form of a gzipped tar file. See Section C.2, "Packaging figlet" for a
1.1 dsieger 1740: continuation of the above misc/figlet example.
1741:
1.154 rillig 1742: See Chapter 23, Submitting and Committing for information on how to submit such
1.1 dsieger 1743: a binary package.
1744:
1.154 rillig 1745: 7.2. Settings for creation of binary packages
1.1 dsieger 1746:
1.184 rillig 1747: See Section 13.17, "Other helpful targets".
1.6 rillig 1748:
1.154 rillig 1749: Chapter 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 1750:
1751: Table of Contents
1752:
1.154 rillig 1753: 8.1. Preparations
1.180 rillig 1754: 8.2. Running a bulk build
1.6 rillig 1755:
1.154 rillig 1756: 8.2.1. Configuration
1.6 rillig 1757:
1.154 rillig 1758: 8.3. Requirements of a full bulk build
1.178 rillig 1759: 8.4. Bulk build variants
1760:
1.179 rillig 1761: 8.4.1. Detect unknown configure options
1762: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 1763: 8.4.3. Force compiler options only in the build phase
1764: 8.4.4. Use custom directories
1765: 8.4.5. Turn warnings into errors
1766: 8.4.6. Reject packages for which pkglint reports errors
1767: 8.4.7. Reject packages that contain forbidden strings
1768: 8.4.8. Reject packages whose self-test fails
1769: 8.4.9. Reject packages that use undefined shell variables
1770: 8.4.10. Turn off verbose logging
1.6 rillig 1771:
1.178 rillig 1772: 8.5. Creating a multiple CD-ROM packages collection
1773:
1774: 8.5.1. Example of cdpack
1.6 rillig 1775:
1.175 gutterid 1776: For a number of reasons, you may want to build binary packages for a large
1777: selected set of packages in pkgsrc, or even for all pkgsrc packages. For
1.71 wiz 1778: instance, when you have multiple machines that should run the same software, it
1779: is wasted time if they all build their packages themselves from source. Or you
1780: may want to build a list of packages you want and check them before deploying
1.175 gutterid 1781: onto production systems. There is a way of getting a set of binary packages:
1782: the bulk build system, or pbulk ("p" stands for "parallel"). This chapter
1783: describes how to set it up.
1.71 wiz 1784:
1.154 rillig 1785: 8.1. Preparations
1.71 wiz 1786:
1787: First of all, you have to decide whether you build all packages or a limited
1788: set of them. Full bulk builds usually consume a lot more resources, both space
1.175 gutterid 1789: and time, than builds for some practical sets of packages. A number of
1790: particularly heavy packages exist that are not actually interesting to a wide
1791: audience. (The approximate resource consumption for a full bulk build is given
1792: in section Section 8.3, "Requirements of a full bulk build".) For limited bulk
1793: builds you need to make a list of packages you want to build. Note that all
1794: their dependencies will be built, so you don't need to track them manually.
1.71 wiz 1795:
1796: During bulk builds various packages are installed and deinstalled in /usr/pkg
1797: (or whatever LOCALBASE is), so make sure that you don't need any package during
1.112 rillig 1798: the builds. Essentially, you should provide a fresh system, either a chroot
1.71 wiz 1799: environment or something even more restrictive, depending on what the operating
1800: system provides, or dedicate the whole physical machine. As a useful side
1801: effect this makes sure that bulk builds cannot break anything in your system.
1802: There have been numerous cases where certain packages tried to install files
1803: outside the LOCALBASE or wanted to edit some files in /etc.
1.6 rillig 1804:
1.180 rillig 1805: 8.2. Running a bulk build
1.6 rillig 1806:
1.180 rillig 1807: Running a bulk build works roughly as follows:
1.15 rillig 1808:
1809: * First, build the pbulk infrastructure in a fresh pkgsrc location.
1810:
1811: * Then, build each of the packages from a clean installation directory using
1812: the infrastructure.
1813:
1.154 rillig 1814: 8.2.1. Configuration
1.6 rillig 1815:
1.112 rillig 1816: To simplify configuration, we provide the helper script mk/pbulk/pbulk.sh.
1.6 rillig 1817:
1.68 asau 1818: In order to use it, prepare a clear system (real one, chroot environment, jail,
1819: zone, virtual machine). Configure network access to fetch distribution files.
1.112 rillig 1820: Create a user with name "pbulk".
1.68 asau 1821:
1822: Fetch and extract pkgsrc. Use a command like one of these:
1823:
1.151 sevan 1824: # (cd /usr && ftp -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1825: # (cd /usr && fetch -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1.72 wiz 1826: # (cd /usr && cvs -Q -z3 -d anoncvs@anoncvs.NetBSD.org:/cvsroot get -P pkgsrc)
1.68 asau 1827:
1828: Or any other way that fits (e.g., curl, wget).
1829:
1830: Deploy and configure pbulk tools, e.g.:
1831:
1.118 sevan 1832: # sh pbulk.sh -n # use native make, no bootstrap kit needed (for use on NetBSD)
1.68 asau 1833: # sh pbulk.sh -n -c mk.conf.frag # native, apply settings from given mk.conf fragment
1834: # sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build
1835:
1836: Note
1837:
1838: mk.conf.frag is a fragment of mk.conf that contains settings you want to apply
1839: to packages you build. For instance,
1840:
1.112 rillig 1841: PKG_DEVELOPER= yes # perform more checks
1842: X11_TYPE= modular # use pkgsrc X11
1843: SKIP_LICENSE_CHECK= yes # accept all licences (useful
1844: # when building all packages)
1.68 asau 1845:
1846: If configured for limited list, replace the list in /usr/pbulk/etc/pbulk.list
1.112 rillig 1847: with your list of packages, one per line without empty lines or comments. E.g.:
1.68 asau 1848:
1849: www/firefox
1850: mail/thunderbird
1851: misc/libreoffice4
1852:
1.69 asau 1853: At this point you can also review configuration in /usr/pbulk/etc and make
1854: final amendments, if wanted.
1855:
1.68 asau 1856: Start it:
1857:
1858: # /usr/pbulk/bin/bulkbuild
1859:
1860: After it finishes, you'll have /mnt filled with distribution files, binary
1861: packages, and reports, plain text summary in /mnt/bulklog/meta/report.txt
1862:
1863: Note
1864:
1865: The pbulk.sh script does not cover all possible use cases. While being ready to
1866: run, it serves as a good starting point to understand and build more complex
1867: setups. The script is kept small enough for better understanding.
1868:
1869: Note
1870:
1871: The pbulk.sh script supports running unprivileged bulk build and helps
1.205 wiz 1872: configuring distributed bulk builds. Distributed bulk builds support either
1873: building in worker chroots (each node is a path to a different chroot) that
1874: replicate the target system, including the pbulk prefix, or remote machines
1875: (each node is an IP address that must be accessible over SSH without a
1876: password).
1.15 rillig 1877:
1.154 rillig 1878: 8.3. Requirements of a full bulk build
1.71 wiz 1879:
1880: A complete bulk build requires lots of disk space. Some of the disk space can
1881: be read-only, some other must be writable. Some can be on remote filesystems
1882: (such as NFS) and some should be local. Some can be temporary filesystems,
1883: others must survive a sudden reboot.
1884:
1.205 wiz 1885: * 70 GB for the distfiles (read-write, remote, temporary)
1.71 wiz 1886:
1.205 wiz 1887: * 60 GB for the binary packages (read-write, remote, permanent)
1.71 wiz 1888:
1889: * 1 GB for the pkgsrc tree (read-only, remote, permanent)
1890:
1891: * 5 GB for LOCALBASE (read-write, local, temporary)
1892:
1893: * 10 GB for the log files (read-write, remote, permanent)
1894:
1895: * 5 GB for temporary files (read-write, local, temporary)
1896:
1.178 rillig 1897: 8.4. Bulk build variants
1898:
1899: To ensure that pkgsrc packages work in different configurations, it makes sense
1900: to run non-default bulk builds from time to time. This section lists some ideas
1901: for bulk builds that intentionally let packages fail if they don't follow the
1902: pkgsrc style.
1903:
1.179 rillig 1904: 8.4.1. Detect unknown configure options
1.178 rillig 1905:
1906: Add the following line to mk.conf.
1907:
1908: GNU_CONFIGURE_STRICT= yes
1909:
1910: When a package fails this additional check, the most common cause is that the
1911: configure option was valid for an older version of the package but does not
1912: apply anymore. In that case, just remove it.
1913:
1.179 rillig 1914: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.178 rillig 1915:
1916: The job of a compiler is not restricted to producing executable code, most
1.179 rillig 1917: compilers also detect typical programming mistakes. The pkgsrc compiler
1918: wrappers make it easy to force compiler options when the package is built. This
1919: can be used to find typical bugs across all packages that are in pkgsrc. By
1920: reporting these bugs upstream, the packages will be more reliable with the next
1921: updates.
1.178 rillig 1922:
1.179 rillig 1923: Add some of the following lines to mk.conf:
1.178 rillig 1924:
1925: CFLAGS+= -Werror=char-subscripts
1.179 rillig 1926: CFLAGS+= -Werror=implicit-function-declaration
1.178 rillig 1927:
1.179 rillig 1928: When a package fails to build using these stricter compiler options, document
1929: the circumstances in which the compiler produced the error message. This
1930: includes:
1.178 rillig 1931:
1932: * The platform (MACHINE_PLATFORM)
1933:
1934: * The source file
1935:
1936: * An excerpt of the code. GCC and Clang already do this as part of the
1937: diagnostic.
1938:
1.179 rillig 1939: * The exact error message from the compiler.
1.178 rillig 1940:
1.179 rillig 1941: If a package produces these error messages, but the package is fine, record
1942: this in your local mk.conf, like this, to skip this check in the next builds:
1.178 rillig 1943:
1.179 rillig 1944: .if ${PKGPATH} == category/package
1.178 rillig 1945: # Version ${VERSION} failed on ${MACHINE_PLATFORM}:
1946: # error message
1947: # code
1.179 rillig 1948: # Reason why the code does not need to be fixed.
1.178 rillig 1949: BUILDLINK_TRANSFORM+= rm:-Werror=char-subscripts
1.179 rillig 1950: .endif
1.178 rillig 1951:
1952: If the error messages from the compiler are valid and the code needs to be
1.179 rillig 1953: fixed, prepare a local patch (see LOCALPATCHES) and report the bug to the
1954: upstream authors of the package, providing them with the information you
1955: collected above.
1.178 rillig 1956:
1.179 rillig 1957: Patches that are not essential for the package to work should only be reported
1958: upstream but not committed to pkgsrc, to make future updates easier.
1959:
1.181 rillig 1960: 8.4.3. Force compiler options only in the build phase
1961:
1962: When adding custom compiler flags via CFLAGS, these apply to all phases of the
1963: package build process. Especially in the configure phase, adding -Werror leads
1964: to wrong decisions. The GNU configure scripts feed many small test programs to
1965: the C compiler to see whether certain headers are available, functions are
1966: defined in a library and programs can be run. In many cases these programs
1967: would not survive a strict compiler run with -Wall -Wextra -Werror.
1968:
1969: The pkgsrc infrastructure is flexible enough to support compiler options being
1970: added between the configure and build phases. It's a little more complicated
1971: than the other examples in this section but still easy enough.
1972:
1973: The basic idea is to use the pkgsrc compiler wrapper to inject the desired
1974: compiler options. The compiler wrapper's original task is to hide unwanted
1975: directories of include files and to normalize compiler options. It does this by
1976: wrapping the compiler command and rewriting the command line. To see this in
1977: action, run bmake patch in a package directory and examine the work/.cwrappers/
1978: config directory. It contains individual configurations for the C compiler and
1979: the related tools. The plan is to find a hook between the configure and build
1980: phases, and to modify these configuration files at that point.
1981:
1982: To find this hook, have a look at mk/build/build.mk, which contains among
1983: others the pre-build-checks-hook. The word checks doesn't quite fit, but the
1984: pre-build-hook sounds good enough.
1985:
1986: The code to be included in mk.conf is:
1987:
1988: # Just a few example options.
1989: BUILD_ONLY_CFLAGS= -Wall -Werror -O2 -DTEMPDIR='"/tmp"'
1990:
1991: .if ${BUILD_ONLY_CFLAGS:U:M*}
1992: pre-build-checks-hook: add-build-only-cflags
1993:
1994: add-build-only-cflags: .PHONY
1995: ${RUN} cd ${CWRAPPERS_CONFIG_DIR}; \
1996: ${TEST} ! -f ${.TARGET} || exit 0; \
1997: for flag in ${BUILD_ONLY_CFLAGS}; do \
1998: ${ECHO} "append=$$flag" >> cc; \
1999: done; \
2000: > ${.TARGET}
2001: .endif
2002:
2003: (When editing the mk.conf, make sure that the commands of the
2004: add-build-only-cflags target are indented with a tab, not with spaces.)
2005:
2006: The condition in the .if statement contains the :U modifier to prevent parse
2007: errors if the variable should be undefined, possibly because it is only defined
2008: for a subset of the packages. The :M* modifier ensures that there is at least
2009: one compiler option, to prevent a syntax error in the shell parser.
2010:
2011: The code around the ${.TARGET} variable ensures that the additional compiler
2012: options are only appended once, even if bmake build is run multiple times. To
2013: do this, it creates a marker file.
2014:
2015: To verify that this setup works, run bmake configure in a package directory. Up
2016: to now, everything works as usual. Examine the directory work/.cwrappers/config
2017: to see that the compiler options from BUILD_ONLY_CFLAGS are not yet added to
2018: the file cc. Examine the tail of the work/.work.log file to see that the normal
2019: compiler options are used.
2020:
2021: Now run bmake build. This will append the options to the file cc and will
2022: create the marker file in the same directory. After that, the build starts as
2023: usual, but with the added compiler options. Examine the tail of the file work
2024: /.work.log to see that the lines starting with [*] don't contain the compiler
2025: options, but the corresponding lines starting with <.> do end with these
2026: options.
2027:
2028: Building packages using this setup variant and fixing the resulting bugs is the
2029: same as in Section 8.4.2, "Detect classes of bugs by forcing compiler warnings"
2030: .
2031:
2032: 8.4.4. Use custom directories
1.178 rillig 2033:
2034: Some directories like PREFIX, VARBASE, PKG_SYSCONFDIR, PKGMANDIR, PKG_INFODIR
2035: can be configured in pkgsrc. Set these to arbitrary paths during bootstrap or
2036: afterwards in mk.conf.
2037:
2038: PREFIX= /a-random-uuid
2039: PKG_SYSCONFDIR= /a-random-uuid
2040: VARBASE= /a-random-uuid
2041: PKGMANDIR= a-random-uuid
2042: PKG_INFODIR= a-random-uuid
2043:
1.181 rillig 2044: 8.4.5. Turn warnings into errors
1.178 rillig 2045:
2046: When building a package, warnings are typically ignored since they just flow by
2047: and do not cause the build to fail immediately. To find these warnings,
2048: redefine them to errors in mk.conf.
2049:
2050: DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)"
2051: WARNING_MSG= ${FAIL_MSG} "(was warning)"
2052:
2053: (There are many more classes of warnings in pkgsrc, and most of them can be
2054: redefined with a simple definition like above.
2055:
1.179 rillig 2056: If a package suggests to add USE_TOOLS+=perl to the package Makefile, research
1.178 rillig 2057: whether the package actually needs Perl. If it does, add USE_TOOLS+=perl to the
2058: package Makefile, and if it doesn't, add TOOLS_BROKEN+=perl.
2059:
1.181 rillig 2060: 8.4.6. Reject packages for which pkglint reports errors
1.178 rillig 2061:
2062: Using pkglint as part of the regular build process is mostly a waste of time.
2063: If you want to fix some of the warnings, just run pkglint recursively on the
2064: whole pkgsrc tree. This will take a few minutes (up to 10), which is much
2065: faster than a complete bulk build.
2066:
1.181 rillig 2067: 8.4.7. Reject packages that contain forbidden strings
1.178 rillig 2068:
2069: To ensure that the binary packages don't contain references to the build
2070: directory, there is already CHECK_WRKREF. If that variable includes the item
2071: extra, it is possible to define additional patterns that must not appear in any
2072: installed file. This is specified in mk.conf.
2073:
2074: CHECK_WRKREF= extra
2075: CHECK_WRKREF_EXTRA_DIRS+= /usr/local
2076: CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg
2077: CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@
2078:
2079: The above patterns will probably generate many false positives, therefore the
2080: results need to be taken with a grain of salt.
2081:
1.181 rillig 2082: 8.4.8. Reject packages whose self-test fails
1.178 rillig 2083:
2084: To run the test suites that come with each package, add this line to mk.conf.
2085:
2086: PKGSRC_RUN_TEST= yes
2087:
2088: Be prepared that even the most basic packages fail this test. When doing a bulk
2089: build with this, it will often abort in the early phase where the packages are
2090: scanned for their dependencies since there are cyclic dependencies. There is
2091: still a lot to do in this area.
2092:
1.181 rillig 2093: 8.4.9. Reject packages that use undefined shell variables
1.178 rillig 2094:
2095: To catch typos in the shell snippets from the Makefile fragments, add the -u
2096: flag to most of the commands by adding this line to mk.conf.
2097:
2098: RUN= @set -eu;
2099:
1.181 rillig 2100: After that, ensure that none of the bulk build log files (even those for
2101: successfully built packages) contains the string parameter not set or whatever
2102: error message the command sh -ceu '$undefined' outputs.
2103:
1.178 rillig 2104: See mk/misc/common.mk for the existing definition.
2105:
1.181 rillig 2106: 8.4.10. Turn off verbose logging
1.178 rillig 2107:
2108: The build logs of a package are often quite long. This allows error messages or
2109: other interesting details to hide between the noise. To make the actual error
2110: message stand out more, add these lines to mk.conf.
2111:
2112: GNU_CONFIGURE_QUIET= yes
2113: MAKE_FLAGS+= -s
2114:
2115: The -s option works for both GNU Make and BSD Make. On exotic platforms with
2116: their own make, it may be a little different.
2117:
2118: 8.5. Creating a multiple CD-ROM packages collection
1.1 dsieger 2119:
2120: After your pkgsrc bulk-build has completed, you may wish to create a CD-ROM set
2121: of the resulting binary packages to assist in installing packages on other
2122: machines. The pkgtools/cdpack package provides a simple tool for creating the
2123: ISO 9660 images. cdpack arranges the packages on the CD-ROMs in a way that
2124: keeps all the dependencies for a given package on the same CD as that package.
2125:
1.178 rillig 2126: 8.5.1. Example of cdpack
1.1 dsieger 2127:
2128: Complete documentation for cdpack is found in the cdpack(1) man page. The
2129: following short example assumes that the binary packages are left in /usr/
2130: pkgsrc/packages/All and that sufficient disk space exists in /u2 to hold the
2131: ISO 9660 images.
2132:
2133: # mkdir /u2/images
2134: # pkg_add /usr/pkgsrc/packages/All/cdpack
2135: # cdpack /usr/pkgsrc/packages/All /u2/images
2136:
2137:
2138: If you wish to include a common set of files (COPYRIGHT, README, etc.) on each
2139: CD in the collection, then you need to create a directory which contains these
1.175 gutterid 2140: files, e.g.:
1.1 dsieger 2141:
2142: # mkdir /tmp/common
2143: # echo "This is a README" > /tmp/common/README
2144: # echo "Another file" > /tmp/common/COPYING
2145: # mkdir /tmp/common/bin
2146: # echo "#!/bin/sh" > /tmp/common/bin/myscript
2147: # echo "echo Hello world" >> /tmp/common/bin/myscript
2148: # chmod 755 /tmp/common/bin/myscript
2149:
2150:
2151: Now create the images:
2152:
2153: # cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images
2154:
2155: Each image will contain README, COPYING, and bin/myscript in their root
2156: directories.
2157:
1.154 rillig 2158: Chapter 9. Directory layout of the installed files
1.1 dsieger 2159:
2160: Table of Contents
2161:
1.154 rillig 2162: 9.1. File system layout in ${LOCALBASE}
2163: 9.2. File system layout in ${VARBASE}
1.1 dsieger 2164:
2165: The files that are installed by pkgsrc are organized in a way that is similar
2166: to what you find in the /usr directory of the base system. But some details are
2167: different. This is because pkgsrc initially came from FreeBSD and had adopted
2168: its file system hierarchy. Later it was largely influenced by NetBSD. But no
2169: matter which operating system you are using pkgsrc with, you can expect the
2170: same layout for pkgsrc.
2171:
2172: There are mainly four root directories for pkgsrc, which are all configurable
2173: in the bootstrap/bootstrap script. When pkgsrc has been installed as root, the
2174: default locations are:
2175:
2176: LOCALBASE= /usr/pkg
2177: PKG_SYSCONFBASE= /usr/pkg/etc
2178: VARBASE= /var
1.119 sevan 2179: PKG_DBDIR= /usr/pkg/pkgdb
1.1 dsieger 2180:
2181: In unprivileged mode (when pkgsrc has been installed as any other user), the
2182: default locations are:
2183:
2184: LOCALBASE= ${HOME}/pkg
2185: PKG_SYSCONFBASE= ${HOME}/pkg/etc
2186: VARBASE= ${HOME}/pkg/var
1.119 sevan 2187: PKG_DBDIR= ${HOME}/pkg/pkgdb
1.1 dsieger 2188:
2189: What these four directories are for, and what they look like is explained
2190: below.
2191:
1.25 wiz 2192: * LOCALBASE corresponds to the /usr directory in the base system. It is the "
2193: main" directory where the files are installed and contains the well-known
1.1 dsieger 2194: subdirectories like bin, include, lib, share and sbin.
2195:
2196: * VARBASE corresponds to /var in the base system. Some programs (especially
2197: games, network daemons) need write access to it during normal operation.
2198:
2199: * PKG_SYSCONFDIR corresponds to /etc in the base system. It contains
2200: configuration files of the packages, as well as pkgsrc's mk.conf itself.
2201:
1.154 rillig 2202: 9.1. File system layout in ${LOCALBASE}
1.1 dsieger 2203:
2204: The following directories exist in a typical pkgsrc installation in $
2205: {LOCALBASE}.
2206:
2207: bin
2208:
2209: Contains executable programs that are intended to be directly used by the
2210: end user.
2211:
2212: emul
2213:
2214: Contains files for the emulation layers of various other operating systems,
2215: especially for NetBSD.
2216:
2217: etc (the usual location of ${PKG_SYSCONFDIR})
2218:
2219: Contains the configuration files.
2220:
2221: include
2222:
2223: Contains headers for the C and C++ programming languages.
2224:
2225: info
2226:
2227: Contains GNU info files of various packages.
2228:
2229: lib
2230:
2231: Contains shared and static libraries.
2232:
2233: libdata
2234:
2235: Contains data files that don't change after installation. Other data files
2236: belong into ${VARBASE}.
2237:
2238: libexec
2239:
2240: Contains programs that are not intended to be used by end users, such as
2241: helper programs or network daemons.
2242:
2243: libexec/cgi-bin
2244:
2245: Contains programs that are intended to be executed as CGI scripts by a web
2246: server.
2247:
2248: man (the usual value of ${PKGMANDIR})
2249:
2250: Contains brief documentation in form of manual pages.
2251:
2252: sbin
2253:
2254: Contains programs that are intended to be used only by the super-user.
2255:
2256: share
2257:
2258: Contains platform-independent data files that don't change after
2259: installation.
2260:
2261: share/doc
2262:
2263: Contains documentation files provided by the packages.
2264:
2265: share/examples
2266:
2267: Contains example files provided by the packages. Among others, the original
2268: configuration files are saved here and copied to ${PKG_SYSCONFDIR} during
2269: installation.
2270:
2271: share/examples/rc.d
2272:
2273: Contains the original files for rc.d scripts.
2274:
2275: var (the usual location of ${VARBASE})
2276:
2277: Contains files that may be modified after installation.
2278:
1.154 rillig 2279: 9.2. File system layout in ${VARBASE}
1.1 dsieger 2280:
2281: db/pkg (the usual location of ${PKG_DBDIR})
2282:
2283: Contains information about the currently installed packages.
2284:
2285: games
2286:
2287: Contains highscore files.
2288:
2289: log
2290:
2291: Contains log files.
2292:
2293: run
2294:
2295: Contains informational files about daemons that are currently running.
2296:
1.154 rillig 2297: Chapter 10. Frequently Asked Questions
1.1 dsieger 2298:
2299: Table of Contents
2300:
1.154 rillig 2301: 10.1. Are there any mailing lists for pkg-related discussion?
2302: 10.2. Utilities for package management (pkgtools)
2303: 10.3. How to use pkgsrc as non-root
2304: 10.4. How to resume transfers when fetching distfiles?
2305: 10.5. How can I install/use modular X.org from pkgsrc?
2306: 10.6. How to fetch files from behind a firewall
2307: 10.7. How to fetch files from HTTPS sites
2308: 10.8. How do I tell make fetch to do passive FTP?
2309: 10.9. How to fetch all distfiles at once
2310: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
2311: 10.11. What does "Could not find bsd.own.mk" mean?
1.221 ! nia 2312: 10.12. Using 'sudo' or `priv` with pkgsrc
1.154 rillig 2313: 10.13. How do I change the location of configuration files?
2314: 10.14. Automated security checks
2315: 10.15. Why do some packages ignore my CFLAGS?
2316: 10.16. A package does not build. What shall I do?
2317: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.24 wiz 2318: conflicts" mean?
1.1 dsieger 2319:
2320: This section contains hints, tips & tricks on special things in pkgsrc that we
2321: didn't find a better place for in the previous chapters, and it contains items
2322: for both pkgsrc users and developers.
2323:
1.154 rillig 2324: 10.1. Are there any mailing lists for pkg-related discussion?
1.1 dsieger 2325:
2326: The following mailing lists may be of interest to pkgsrc users:
2327:
2328: * pkgsrc-users: This is a general purpose list for most issues regarding
2329: pkgsrc, regardless of platform, e.g. soliciting user help for pkgsrc
2330: configuration, unexpected build failures, using particular packages,
2331: upgrading pkgsrc installations, questions regarding the pkgsrc release
2332: branches, etc. General announcements or proposals for changes that impact
2333: the pkgsrc user community, e.g. major infrastructure changes, new features,
2334: package removals, etc., may also be posted.
2335:
2336: * pkgsrc-bulk: A list where the results of pkgsrc bulk builds are sent and
2337: discussed.
2338:
2339: * pkgsrc-changes: This list is for those who are interested in getting a
2340: commit message for every change committed to pkgsrc. It is also available
2341: in digest form, meaning one daily message containing all commit messages
2342: for changes to the package source tree in that 24 hour period.
2343:
2344: To subscribe, do:
2345:
2346: % echo subscribe listname | mail majordomo@NetBSD.org
2347:
1.174 leot 2348: Archives for all these mailing lists are available from https://
1.1 dsieger 2349: mail-index.NetBSD.org/.
2350:
1.154 rillig 2351: 10.2. Utilities for package management (pkgtools)
1.1 dsieger 2352:
2353: The directory pkgsrc/pkgtools contains a number of useful utilities for both
2354: users and developers of pkgsrc. This section attempts only to make the reader
1.121 sevan 2355: aware of some of the utilities and when they might be useful, and not to
2356: duplicate the documentation that comes with each package.
1.1 dsieger 2357:
2358: Utilities used by pkgsrc (automatically installed when needed):
2359:
2360: * pkgtools/x11-links: Symlinks for use by buildlink.
2361:
2362: OS tool augmentation (automatically installed when needed):
2363:
1.121 sevan 2364: * pkgtools/digest: Calculates various kinds of checksums (including SHA3).
1.1 dsieger 2365:
2366: * pkgtools/libnbcompat: Compatibility library for pkgsrc tools.
2367:
2368: * pkgtools/mtree: Installed on non-BSD systems due to lack of native mtree.
2369:
2370: * pkgtools/pkg_install: Up-to-date replacement for /usr/sbin/pkg_install, or
2371: for use on operating systems where pkg_install is not present.
2372:
2373: Utilities used by pkgsrc (not automatically installed):
2374:
2375: * pkgtools/pkg_tarup: Create a binary package from an already-installed
2376: package. Used by make replace to save the old package.
2377:
2378: * pkgtools/dfdisk: Adds extra functionality to pkgsrc, allowing it to fetch
2379: distfiles from multiple locations. It currently supports the following
2380: methods: multiple CD-ROMs and network FTP/HTTP connections.
2381:
2382: * devel/cpuflags: Determine the best compiler flags to optimise code for your
1.24 wiz 2383: current CPU and compiler.
1.1 dsieger 2384:
2385: Utilities for keeping track of installed packages, being up to date, etc:
2386:
1.65 wiz 2387: * pkgtools/pkgin: A package update tool similar to apt(1). Download, install,
2388: and upgrade binary packages easily.
2389:
1.1 dsieger 2390: * pkgtools/pkg_chk: Reports on packages whose installed versions do not match
2391: the latest pkgsrc entries.
2392:
2393: * pkgtools/pkgdep: Makes dependency graphs of packages, to aid in choosing a
2394: strategy for updating.
2395:
2396: * pkgtools/pkgdepgraph: Makes graphs from the output of pkgtools/pkgdep (uses
2397: graphviz).
2398:
1.12 weinem 2399: * pkgtools/pkglint: The pkglint(1) program checks a pkgsrc entry for errors.
2400:
2401: * pkgtools/lintpkgsrc: The lintpkgsrc(1) program does various checks on the
2402: complete pkgsrc system.
1.1 dsieger 2403:
2404: * pkgtools/pkgsurvey: Report what packages you have installed.
2405:
2406: Utilities for people maintaining or creating individual packages:
2407:
2408: * pkgtools/pkgdiff: Automate making and maintaining patches for a package
2409: (includes pkgdiff, pkgvi, mkpatches, etc.).
2410:
1.65 wiz 2411: * pkgtools/url2pkg: Aids in converting to pkgsrc.
1.1 dsieger 2412:
2413: Utilities for people maintaining pkgsrc (or: more obscure pkg utilities)
2414:
2415: * pkgtools/pkg_comp: Build packages in a chrooted area.
2416:
2417: * pkgtools/libkver: Spoof kernel version for chrooted cross builds.
2418:
1.154 rillig 2419: 10.3. How to use pkgsrc as non-root
1.1 dsieger 2420:
1.108 rillig 2421: To install packages from source as a non-root user, download pkgsrc as
1.154 rillig 2422: described in Chapter 3, Where to get pkgsrc and how to keep it up-to-date, cd
1.108 rillig 2423: into that directory and run the command ./bootstrap/bootstrap --unprivileged.
2424:
2425: This will install the binary part of pkgsrc to ~/pkg and put the pkgsrc
2426: configuration mk.conf into ~/pkg/etc.
2427:
2428: For more details, see mk/unprivileged.mk.
1.1 dsieger 2429:
1.154 rillig 2430: 10.4. How to resume transfers when fetching distfiles?
1.1 dsieger 2431:
2432: By default, resuming transfers in pkgsrc is disabled, but you can enable this
1.4 rillig 2433: feature by adding the option PKG_RESUME_TRANSFERS=YES into mk.conf. If, during
2434: a fetch step, an incomplete distfile is found, pkgsrc will try to resume it.
1.1 dsieger 2435:
1.61 wiz 2436: You can also use a different program than the platform default program by
2437: changing the FETCH_USING variable. You can specify the program by using of ftp,
2438: fetch, wget or curl. Alternatively, fetching can be disabled by using the value
2439: manual. A value of custom disables the system defaults and dependency tracking
2440: for the fetch program. In that case you have to provide FETCH_CMD,
2441: FETCH_BEFORE_ARGS, FETCH_RESUME_ARGS, FETCH_OUTPUT_ARGS, FETCH_AFTER_ARGS.
1.1 dsieger 2442:
1.16 jnemeth 2443: For example, if you want to use wget to download, you'll have to use something
2444: like:
1.1 dsieger 2445:
1.16 jnemeth 2446: FETCH_USING= wget
1.1 dsieger 2447:
1.154 rillig 2448: 10.5. How can I install/use modular X.org from pkgsrc?
1.1 dsieger 2449:
1.4 rillig 2450: If you want to use modular X.org from pkgsrc instead of your system's own X11
2451: (/usr/X11R6, /usr/openwin, ...) you will have to add the following line into
1.1 dsieger 2452: mk.conf:
2453:
1.4 rillig 2454: X11_TYPE=modular
1.1 dsieger 2455:
1.154 rillig 2456: 10.6. How to fetch files from behind a firewall
1.1 dsieger 2457:
2458: If you are sitting behind a firewall which does not allow direct connections to
2459: Internet hosts (i.e. non-NAT), you may specify the relevant proxy hosts. This
2460: is done using an environment variable in the form of a URL, e.g. in Amdahl, the
2461: machine "orpheus.amdahl.com" is one of the firewalls, and it uses port 80 as
2462: the proxy port number. So the proxy environment variables are:
2463:
2464: ftp_proxy=ftp://orpheus.amdahl.com:80/
2465: http_proxy=http://orpheus.amdahl.com:80/
2466:
1.154 rillig 2467: 10.7. How to fetch files from HTTPS sites
1.65 wiz 2468:
2469: Some fetch tools are not prepared to support HTTPS by default (for example, the
2470: one in NetBSD 6.0), or the one installed by the pkgsrc bootstrap (to avoid an
2471: openssl dependency that low in the dependency graph).
2472:
2473: Usually you won't notice, because distribution files are mirrored weekly to "
2474: ftp.NetBSD.org", but that might not be often enough if you are following
2475: pkgsrc-current. In that case, set FETCH_USING in your mk.conf file to "curl" or
2476: "wget", which are both compiled with HTTPS support by default. Of course, these
2477: tools need to be installed before you can use them this way.
2478:
1.154 rillig 2479: 10.8. How do I tell make fetch to do passive FTP?
1.1 dsieger 2480:
2481: This depends on which utility is used to retrieve distfiles. From bsd.pkg.mk,
2482: FETCH_CMD is assigned the first available command from the following list:
2483:
2484: * ${LOCALBASE}/bin/ftp
2485:
2486: * /usr/bin/ftp
2487:
2488: On a default NetBSD installation, this will be /usr/bin/ftp, which
2489: automatically tries passive connections first, and falls back to active
2490: connections if the server refuses to do passive. For the other tools, add the
1.4 rillig 2491: following to your mk.conf file: PASSIVE_FETCH=1.
1.1 dsieger 2492:
2493: Having that option present will prevent /usr/bin/ftp from falling back to
2494: active transfers.
2495:
1.154 rillig 2496: 10.9. How to fetch all distfiles at once
1.1 dsieger 2497:
2498: You would like to download all the distfiles in a single batch from work or
2499: university, where you can't run a make fetch. There is an archive of distfiles
2500: on ftp.NetBSD.org, but downloading the entire directory may not be appropriate.
2501:
2502: The answer here is to do a make fetch-list in /usr/pkgsrc or one of its
2503: subdirectories, carry the resulting list to your machine at work/school and use
2504: it there. If you don't have a NetBSD-compatible ftp(1) (like tnftp) at work,
2505: don't forget to set FETCH_CMD to something that fetches a URL:
2506:
2507: At home:
2508:
2509: % cd /usr/pkgsrc
2510: % make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh
2511: % scp /tmp/fetch.sh work:/tmp
2512:
2513: At work:
2514:
2515: % sh /tmp/fetch.sh
2516:
2517: then tar up /tmp/distfiles and take it home.
2518:
2519: If you have a machine running NetBSD, and you want to get all distfiles (even
2520: ones that aren't for your machine architecture), you can do so by using the
2521: above-mentioned make fetch-list approach, or fetch the distfiles directly by
2522: running:
2523:
2524: % make mirror-distfiles
2525:
2526: If you even decide to ignore NO_{SRC,BIN}_ON_{FTP,CDROM}, then you can get
2527: everything by running:
2528:
2529: % make fetch NO_SKIP=yes
2530:
1.154 rillig 2531: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
1.1 dsieger 2532:
2533: When compiling the pkgtools/pkg_install package, you get the error from make
2534: that it doesn't know how to make /usr/share/tmac/tmac.andoc? This indicates
2535: that you don't have installed the "text" set (nroff, ...) from the NetBSD base
2536: distribution on your machine. It is recommended to do that to format man pages.
2537:
2538: In the case of the pkgtools/pkg_install package, you can get away with setting
1.4 rillig 2539: NOMAN=YES either in the environment or in mk.conf.
1.1 dsieger 2540:
1.154 rillig 2541: 10.11. What does "Could not find bsd.own.mk" mean?
1.1 dsieger 2542:
2543: You didn't install the compiler set, comp.tgz, when you installed your NetBSD
2544: machine. Please get and install it, by extracting it in /:
2545:
2546: # cd /
2547: # tar --unlink -zxvpf .../comp.tgz
2548:
2549: comp.tgz is part of every NetBSD release. Get the one that corresponds to your
2550: release (determine via uname -r).
2551:
1.221 ! nia 2552: 10.12. Using 'sudo' or `priv` with pkgsrc
1.1 dsieger 2553:
2554: When installing packages as non-root user and using the just-in-time su(1)
2555: feature of pkgsrc, it can become annoying to type in the root password for each
2556: required package installed. To avoid this, the sudo package can be used, which
1.221 ! nia 2557: does password caching over a limited time. To use it, install sudo or priv
! 2558: (either as binary package, from security/priv, or security/sudo) and then put
! 2559: the following into your mk.conf, somewhere after the definition of the
! 2560: LOCALBASE variable:
1.1 dsieger 2561:
2562: .if exists(${LOCALBASE}/bin/sudo)
2563: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
2564: .endif
2565:
1.154 rillig 2566: 10.13. How do I change the location of configuration files?
1.1 dsieger 2567:
2568: As the system administrator, you can choose where configuration files are
2569: installed. The default settings make all these files go into ${PREFIX}/etc or
2570: some of its subdirectories; this may be suboptimal depending on your
2571: expectations (e.g., a read-only, NFS-exported PREFIX with a need of per-machine
2572: configuration of the provided packages).
2573:
2574: In order to change the defaults, you can modify the PKG_SYSCONFBASE variable
1.4 rillig 2575: (in mk.conf) to point to your preferred configuration directory; some common
2576: examples include /etc or /etc/pkg.
1.1 dsieger 2577:
2578: Furthermore, you can change this value on a per-package basis by setting the
2579: PKG_SYSCONFDIR.${PKG_SYSCONFVAR} variable. PKG_SYSCONFVAR's value usually
2580: matches the name of the package you would like to modify, that is, the contents
2581: of PKGBASE.
2582:
2583: Note that after changing these settings, you must rebuild and reinstall any
2584: affected packages.
2585:
1.154 rillig 2586: 10.14. Automated security checks
1.1 dsieger 2587:
2588: Please be aware that there can often be bugs in third-party software, and some
2589: of these bugs can leave a machine vulnerable to exploitation by attackers. In
2590: an effort to lessen the exposure, the NetBSD packages team maintains a database
2591: of known-exploits to packages which have at one time been included in pkgsrc.
2592: The database can be downloaded automatically, and a security audit of all
1.14 jmcneill 2593: packages installed on a system can take place. To do this, refer to the
2594: following two tools (installed as part of the pkgtools/pkg_install package):
1.1 dsieger 2595:
1.21 snj 2596: 1. pkg_admin fetch-pkg-vulnerabilities, an easy way to download a list of the
2597: security vulnerabilities information. This list is kept up to date by the
1.26 spz 2598: pkgsrc security team, and is distributed from the NetBSD ftp server:
1.1 dsieger 2599:
1.177 leot 2600: https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities
1.1 dsieger 2601:
1.21 snj 2602: 2. pkg_admin audit, an easy way to audit the current machine, checking each
1.24 wiz 2603: known vulnerability. If a vulnerable package is installed, it will be shown
2604: by output to stdout, including a description of the type of vulnerability,
2605: and a URL containing more information.
1.1 dsieger 2606:
1.202 nia 2607: Use of these tools is strongly recommended! See Section 5.1.6, "Checking for
1.121 sevan 2608: security vulnerabilities in installed packages" for instructions on how to
2609: automate checking and reporting.
2610:
2611: If this database is installed, pkgsrc builds will use it to perform a security
2612: check before building any package.
1.1 dsieger 2613:
1.154 rillig 2614: 10.15. Why do some packages ignore my CFLAGS?
1.1 dsieger 2615:
2616: When you add your own preferences to the CFLAGS variable in your mk.conf, these
2617: flags are passed in environment variables to the ./configure scripts and to
2618: make(1). Some package authors ignore the CFLAGS from the environment variable
2619: by overriding them in the Makefiles of their package.
2620:
2621: Currently there is no solution to this problem. If you really need the package
2622: to use your CFLAGS you should run make patch in the package directory and then
2623: inspect any Makefile and Makefile.in for whether they define CFLAGS explicitly.
2624: Usually you can remove these lines. But be aware that some "smart" programmers
2625: write so bad code that it only works for the specific combination of CFLAGS
2626: they have chosen.
2627:
1.172 rillig 2628: To find out where the CFLAGS are ignored, add the following lines to mk.conf:
2629:
2630: CPPFLAGS+= -Dpkgsrc___CPPFLAGS
2631: CFLAGS+= -Dpkgsrc___CFLAGS
2632: CXXFLAGS+= -Dpkgsrc___CXXFLAGS
2633:
2634: Then run bmake show-all-configure show-all-build to see whether the above flags
2635: are passed to the actual build commands in general.
2636:
2637: To find out whether the flags are passed to individual compiler commands, have
2638: a look at the file work/.work.log. In most cases, the flags from the original
2639: command lines (the lines starting with [*]) are passed unmodified to the actual
2640: compiler (the lines starting with <.>). If the flag is missing from the actual
2641: compiler command, it must have been removed by the pkgsrc compiler wrappers.
2642:
1.154 rillig 2643: 10.16. A package does not build. What shall I do?
1.1 dsieger 2644:
2645: 1. Make sure that your copy of pkgsrc is consistent. A case that occurs often
2646: is that people only update pkgsrc in parts, because of performance reasons.
2647: Since pkgsrc is one large system, not a collection of many small systems,
2648: there are sometimes changes that only work when the whole pkgsrc tree is
2649: updated.
2650:
1.25 wiz 2651: 2. Make sure that you don't have any CVS conflicts. Search for "<<<<<<" or "
2652: >>>>>>" in all your pkgsrc files.
1.1 dsieger 2653:
1.25 wiz 2654: 3. Make sure that you don't have old copies of the packages extracted. Run
1.1 dsieger 2655: make clean clean-depends to verify this.
2656:
1.108 rillig 2657: 4. If you are a package developer who wants to invest some work, have a look
1.154 rillig 2658: at Chapter 21, Making your package work.
1.108 rillig 2659:
2660: 5. If the problem still exists, write a mail to the pkgsrc-users mailing list.
1.1 dsieger 2661:
1.154 rillig 2662: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.1 dsieger 2663: conflicts" mean?
2664:
2665: You have modified a file from pkgsrc, and someone else has modified that same
2666: file afterwards in the CVS repository. Both changes are in the same region of
2667: the file, so when you updated pkgsrc, the cvs command marked the conflicting
2668: changes in the file. Because of these markers, the file is no longer a valid
2669: Makefile.
2670:
2671: Have a look at that file, and if you don't need your local changes anymore, you
2672: can remove that file and run cvs -q update -dP in that directory to download
2673: the current version.
2674:
2675: Part II. The pkgsrc developer's guide
2676:
2677: This part of the book deals with creating and modifying packages. It starts
2678: with a "HOWTO"-like guide on creating a new package. The remaining chapters are
2679: more like a reference manual for pkgsrc.
2680:
2681: Table of Contents
2682:
1.154 rillig 2683: 11. Getting help
1.184 rillig 2684: 12. Package components - files, directories and contents
1.1 dsieger 2685:
1.184 rillig 2686: 12.1. Makefile
2687: 12.2. distinfo
2688: 12.3. patches/*
1.1 dsieger 2689:
1.184 rillig 2690: 12.3.1. Structure of a single patch file
2691: 12.3.2. Creating patch files
2692: 12.3.3. Sources where the patch files come from
2693: 12.3.4. Patching guidelines
2694: 12.3.5. Feedback to the author
1.1 dsieger 2695:
1.184 rillig 2696: 12.4. Other mandatory files
2697: 12.5. Optional files
1.1 dsieger 2698:
1.184 rillig 2699: 12.5.1. Files affecting the binary package
2700: 12.5.2. Files affecting the build process
2701: 12.5.3. Files affecting nothing at all
1.1 dsieger 2702:
1.184 rillig 2703: 12.6. work*
2704: 12.7. files/*
1.1 dsieger 2705:
1.184 rillig 2706: 13. The build process
1.1 dsieger 2707:
1.184 rillig 2708: 13.1. Introduction
2709: 13.2. Program location
2710: 13.3. Directories used during the build process
2711: 13.4. Running a phase
2712: 13.5. The fetch phase
1.1 dsieger 2713:
1.184 rillig 2714: 13.5.1. What to fetch and where to get it from
2715: 13.5.2. How are the files fetched?
1.1 dsieger 2716:
1.184 rillig 2717: 13.6. The checksum phase
2718: 13.7. The extract phase
2719: 13.8. The patch phase
2720: 13.9. The tools phase
2721: 13.10. The wrapper phase
2722: 13.11. The configure phase
2723: 13.12. The build phase
2724: 13.13. The test phase
2725: 13.14. The install phase
2726: 13.15. The package phase
2727: 13.16. Cleaning up
2728: 13.17. Other helpful targets
1.1 dsieger 2729:
1.184 rillig 2730: 14. Creating a new pkgsrc package from scratch
1.1 dsieger 2731:
1.184 rillig 2732: 14.1. Common types of packages
1.1 dsieger 2733:
1.219 nia 2734: 14.1.1. Python modules and programs
2735: 14.1.2. R packages
2736: 14.1.3. TeXlive packages
1.1 dsieger 2737:
1.184 rillig 2738: 14.2. Examples
1.1 dsieger 2739:
1.184 rillig 2740: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 2741:
1.184 rillig 2742: 15. Programming in Makefiles
1.1 dsieger 2743:
1.184 rillig 2744: 15.1. Caveats
2745: 15.2. Makefile variables
1.1 dsieger 2746:
1.184 rillig 2747: 15.2.1. Naming conventions
1.1 dsieger 2748:
1.184 rillig 2749: 15.3. Code snippets
1.1 dsieger 2750:
1.184 rillig 2751: 15.3.1. Adding things to a list
2752: 15.3.2. Echoing a string exactly as-is
2753: 15.3.3. Passing CFLAGS to GNU configure scripts
2754: 15.3.4. Handling possibly empty variables
1.1 dsieger 2755:
1.184 rillig 2756: 16. Options handling
1.1 dsieger 2757:
1.184 rillig 2758: 16.1. Global default options
2759: 16.2. Converting packages to use bsd.options.mk
2760: 16.3. Option Names
2761: 16.4. Determining the options of dependencies
1.1 dsieger 2762:
1.184 rillig 2763: 17. Tools needed for building or running
1.1 dsieger 2764:
1.184 rillig 2765: 17.1. Tools for pkgsrc builds
2766: 17.2. Tools needed by packages
2767: 17.3. Tools provided by platforms
1.1 dsieger 2768:
1.184 rillig 2769: 18. Buildlink methodology
1.1 dsieger 2770:
1.184 rillig 2771: 18.1. Converting packages to use buildlink3
2772: 18.2. Writing buildlink3.mk files
1.1 dsieger 2773:
1.184 rillig 2774: 18.2.1. Anatomy of a buildlink3.mk file
2775: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.
2776: pkg in buildlink3.mk files
1.1 dsieger 2777:
1.184 rillig 2778: 18.3. Writing builtin.mk files
1.1 dsieger 2779:
1.184 rillig 2780: 18.3.1. Anatomy of a builtin.mk file
2781: 18.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 2782:
1.184 rillig 2783: 19. PLIST issues
1.1 dsieger 2784:
1.184 rillig 2785: 19.1. RCS ID
2786: 19.2. Semi-automatic PLIST generation
2787: 19.3. Tweaking output of make print-PLIST
2788: 19.4. Variable substitution in PLIST
2789: 19.5. Man page compression
2790: 19.6. Changing PLIST source with PLIST_SRC
2791: 19.7. Platform-specific and differing PLISTs
2792: 19.8. Build-specific PLISTs
2793: 19.9. Sharing directories between packages
1.1 dsieger 2794:
1.184 rillig 2795: 20. The pkginstall framework
1.1 dsieger 2796:
1.184 rillig 2797: 20.1. Files and directories outside the installation prefix
1.1 dsieger 2798:
1.184 rillig 2799: 20.1.1. Directory manipulation
2800: 20.1.2. File manipulation
1.1 dsieger 2801:
1.184 rillig 2802: 20.2. Configuration files
1.1 dsieger 2803:
1.184 rillig 2804: 20.2.1. How PKG_SYSCONFDIR is set
2805: 20.2.2. Telling the software where configuration files are
2806: 20.2.3. Patching installations
2807: 20.2.4. Disabling handling of configuration files
1.1 dsieger 2808:
1.184 rillig 2809: 20.3. System startup scripts
1.1 dsieger 2810:
1.184 rillig 2811: 20.3.1. Disabling handling of system startup scripts
1.1 dsieger 2812:
1.184 rillig 2813: 20.4. System users and groups
2814: 20.5. System shells
1.1 dsieger 2815:
1.184 rillig 2816: 20.5.1. Disabling shell registration
1.1 dsieger 2817:
1.184 rillig 2818: 20.6. Fonts
1.1 dsieger 2819:
1.184 rillig 2820: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 2821:
1.154 rillig 2822: 21. Making your package work
1.1 dsieger 2823:
1.154 rillig 2824: 21.1. General operation
1.1 dsieger 2825:
1.154 rillig 2826: 21.1.1. How to pull in user-settable variables from mk.conf
2827: 21.1.2. User interaction
2828: 21.1.3. Handling licenses
2829: 21.1.4. Restricted packages
2830: 21.1.5. Handling dependencies
2831: 21.1.6. Handling conflicts with other packages
2832: 21.1.7. Packages that cannot or should not be built
2833: 21.1.8. Packages which should not be deleted, once installed
2834: 21.1.9. Handling packages with security problems
2835: 21.1.10. How to handle incrementing versions when fixing an existing
1.1 dsieger 2836: package
1.154 rillig 2837: 21.1.11. Substituting variable text in the package files (the SUBST
1.1 dsieger 2838: framework)
2839:
1.154 rillig 2840: 21.2. The fetch phase
1.1 dsieger 2841:
1.154 rillig 2842: 21.2.1. Packages whose distfiles aren't available for plain downloading
2843: 21.2.2. How to handle modified distfiles with the 'old' name
2844: 21.2.3. Packages hosted on github.com
2845:
2846: 21.3. The configure phase
2847:
2848: 21.3.1. Shared libraries - libtool
2849: 21.3.2. Using libtool on GNU packages that already support libtool
2850: 21.3.3. GNU Autoconf/Automake
2851:
2852: 21.4. Programming languages
2853:
2854: 21.4.1. C, C++, and Fortran
2855: 21.4.2. Java
1.205 wiz 2856: 21.4.3. Go
2857: 21.4.4. Packages containing Perl scripts
2858: 21.4.5. Packages containing shell scripts
2859: 21.4.6. Other programming languages
1.154 rillig 2860:
2861: 21.5. The build phase
2862:
2863: 21.5.1. Compiling C and C++ code conditionally
2864: 21.5.2. How to handle compiler bugs
1.172 rillig 2865: 21.5.3. No such file or directory
2866: 21.5.4. Undefined reference to "..."
2867: 21.5.5. Running out of memory
1.154 rillig 2868:
2869: 21.6. The install phase
2870:
2871: 21.6.1. Creating needed directories
2872: 21.6.2. Where to install documentation
2873: 21.6.3. Installing highscore files
2874: 21.6.4. Adding DESTDIR support to packages
2875: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 2876: 21.6.6. Packages installing Perl modules
1.154 rillig 2877: 21.6.7. Packages installing info files
2878: 21.6.8. Packages installing man pages
1.203 nia 2879: 21.6.9. Packages installing X11 fonts
2880: 21.6.10. Packages installing SGML or XML data
2881: 21.6.11. Packages installing extensions to the MIME database
2882: 21.6.12. Packages using intltool
2883: 21.6.13. Packages installing startup scripts
2884: 21.6.14. Packages installing TeX modules
2885: 21.6.15. Packages supporting running binaries in emulation
2886: 21.6.16. Packages installing hicolor icons
2887: 21.6.17. Packages installing desktop files
1.154 rillig 2888:
2889: 21.7. Marking packages as having problems
2890:
1.184 rillig 2891: 22. GNOME packaging and porting
2892:
2893: 22.1. Meta packages
2894: 22.2. Packaging a GNOME application
2895: 22.3. Updating GNOME to a newer version
2896: 22.4. Patching guidelines
2897:
1.154 rillig 2898: 23. Submitting and Committing
2899:
2900: 23.1. Submitting binary packages
2901: 23.2. Submitting source packages (for non-NetBSD-developers)
2902: 23.3. General notes when adding, updating, or removing packages
2903: 23.4. Commit Messages
2904: 23.5. Committing: Adding a package to CVS
2905: 23.6. Updating a package to a newer version
2906: 23.7. Renaming a package in pkgsrc
2907: 23.8. Moving a package in pkgsrc
2908:
2909: 24. Frequently Asked Questions
2910:
2911: Chapter 11. Getting help
2912:
2913: To get help when developing pkgsrc, the definitive source is this document, the
2914: pkgsrc guide. If you don't find anything here, there are alternatives:
2915:
2916: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
2917: Run bmake help topic=? to get help for any topic, such as a variable name
2918: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
2919: like strcasecmp or any other topic.
2920:
1.207 leot 2921: The available help topics are listed in Appendix E, Help topics.
1.154 rillig 2922:
1.163 rillig 2923: * To see the value of a single variable, run bmake show-var VARNAME=X.
2924:
2925: * To see the values of the most common variables, run bmake show-all. These
2926: variables are grouped by topic. To see the variables for a single topic,
2927: run bmake show-all-topic, for example bmake show-all-fetch.
2928:
1.154 rillig 2929: * The tech-pkg mailing list, to which you can subscribe and then ask your
2930: questions.
2931:
2932: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
2933: a specialized chat program such as XChat. Pick any user name and join the
2934: channel #pkgsrc.
1.1 dsieger 2935:
1.184 rillig 2936: Chapter 12. Package components - files, directories and contents
1.1 dsieger 2937:
2938: Table of Contents
2939:
1.184 rillig 2940: 12.1. Makefile
2941: 12.2. distinfo
2942: 12.3. patches/*
2943:
2944: 12.3.1. Structure of a single patch file
2945: 12.3.2. Creating patch files
2946: 12.3.3. Sources where the patch files come from
2947: 12.3.4. Patching guidelines
2948: 12.3.5. Feedback to the author
2949:
2950: 12.4. Other mandatory files
2951: 12.5. Optional files
2952:
2953: 12.5.1. Files affecting the binary package
2954: 12.5.2. Files affecting the build process
2955: 12.5.3. Files affecting nothing at all
1.1 dsieger 2956:
1.184 rillig 2957: 12.6. work*
2958: 12.7. files/*
1.1 dsieger 2959:
1.184 rillig 2960: Whenever you're preparing a package, there are a number of files involved which
2961: are described in the following sections.
1.1 dsieger 2962:
1.184 rillig 2963: 12.1. Makefile
1.1 dsieger 2964:
1.184 rillig 2965: Building, installation and creation of a binary package are all controlled by
2966: the package's Makefile. The Makefile describes various things about a package,
2967: for example from where to get it, how to configure, build, and install it.
1.1 dsieger 2968:
1.184 rillig 2969: A package Makefile contains several sections that describe the package.
1.1 dsieger 2970:
1.184 rillig 2971: In the first section there are the following variables, which should appear
2972: exactly in the order given here. The order and grouping of the variables is
2973: mostly historical and has no further meaning.
1.1 dsieger 2974:
1.184 rillig 2975: * DISTNAME is the basename of the distribution file to be downloaded from the
2976: package's website.
1.1 dsieger 2977:
1.184 rillig 2978: * PKGNAME is the name of the package, as used by pkgsrc. You need to provide
2979: it if DISTNAME (which is the default) is not a good name for the package in
2980: pkgsrc or DISTNAME is not provided (no distribution file is required).
2981: Usually it is the pkgsrc directory name together with the version number.
2982: It must match the regular expression ^[A-Za-z0-9][A-Za-z0-9-_.+]*$, that
2983: is, it starts with a letter or digit, and contains only letters, digits,
1.204 nia 2984: dashes, underscores, dots and plus signs. New packages should have entirely
2985: lower-case names, with the exception of some that must follow pre-existing
2986: conventions (e.g. R packages begin with R-). You can use the :tl variable
2987: modifier to lower-case the package name.
1.26 spz 2988:
1.184 rillig 2989: * CATEGORIES is a list of categories which the package fits in. You can
2990: choose any of the top-level directories of pkgsrc for it.
1.1 dsieger 2991:
1.184 rillig 2992: Currently the following values are available for CATEGORIES. If more than
2993: one is used, they need to be separated by spaces:
1.1 dsieger 2994:
1.184 rillig 2995: archivers cross geography meta-pkgs security
2996: audio databases graphics misc shells
2997: benchmarks devel ham multimedia sysutils
2998: biology editors inputmethod net textproc
2999: cad emulators lang news time
3000: chat finance mail parallel wm
3001: comms fonts math pkgtools www
3002: converters games mbone print x11
1.1 dsieger 3003:
1.184 rillig 3004: * MASTER_SITES, DYNAMIC_MASTER_SITES, DIST_SUBDIR, EXTRACT_SUFX and DISTFILES
3005: are discussed in detail in Section 13.5, "The fetch phase".
1.1 dsieger 3006:
1.184 rillig 3007: The second section contains information about separately downloaded patches, if
3008: any.
1.1 dsieger 3009:
1.184 rillig 3010: * PATCHFILES: Name(s) of additional files that contain distribution patches.
3011: There is no default. pkgsrc will look for them at PATCH_SITES. They will
3012: automatically be uncompressed before patching if the names end with .gz or
3013: .Z.
1.1 dsieger 3014:
1.184 rillig 3015: * PATCH_SITES: Primary location(s) for distribution patch files (see
3016: PATCHFILES above) if not found locally.
1.1 dsieger 3017:
1.184 rillig 3018: * PATCH_DIST_STRIP: an argument to patch(1) that sets the pathname strip
3019: count to help find the correct files to patch. It defaults to -p0.
1.1 dsieger 3020:
1.184 rillig 3021: The third section contains the following variables.
1.1 dsieger 3022:
1.184 rillig 3023: * MAINTAINER is the email address of the person who feels responsible for
3024: this package, and who is most likely to look at problems or questions
3025: regarding this package which have been reported with send-pr(1). Other
3026: developers may contact the MAINTAINER before making changes to the package,
3027: but are not required to do so. When packaging a new program, set MAINTAINER
3028: to yourself. If you really can't maintain the package for future updates,
3029: set it to <pkgsrc-users@NetBSD.org>.
1.1 dsieger 3030:
1.184 rillig 3031: * OWNER should be used instead of MAINTAINER when you do not want other
3032: developers to update or change the package without contacting you first. A
3033: package Makefile should contain one of MAINTAINER or OWNER, but not both.
1.1 dsieger 3034:
1.184 rillig 3035: * HOMEPAGE is a URL where users can find more information about the package.
1.1 dsieger 3036:
1.184 rillig 3037: * COMMENT is a one-line description of the package (should not include the
3038: package name).
1.1 dsieger 3039:
1.184 rillig 3040: * LICENSE indicates the license(s) applicable for the package. See
3041: Section 21.1.3, "Handling licenses" for further details.
1.1 dsieger 3042:
1.184 rillig 3043: Other variables that affect the build:
1.1 dsieger 3044:
1.184 rillig 3045: * WRKSRC: The directory where the interesting distribution files of the
3046: package are found. The default is ${WRKDIR}/${DISTNAME}, which works for
3047: most packages.
1.1 dsieger 3048:
1.184 rillig 3049: If a package doesn't create a subdirectory for itself (most GNU software
3050: does, for instance), but extracts itself in the current directory, you
3051: should set WRKSRC=${WRKDIR}.
1.1 dsieger 3052:
1.184 rillig 3053: If a package doesn't create a subdirectory with the name of DISTNAME but
3054: some different name, set WRKSRC to point to the proper name in ${WRKDIR},
3055: for example WRKSRC=${WRKDIR}/${DISTNAME}/unix. See lang/tcl and x11/tk for
3056: other examples.
1.17 imil 3057:
1.184 rillig 3058: The name of the working directory created by pkgsrc is taken from the
3059: WRKDIR_BASENAME variable. By default, its value is work. If you want to use
3060: the same pkgsrc tree for building different kinds of binary packages, you
3061: can change the variable according to your needs. Two other variables handle
3062: common cases of setting WRKDIR_BASENAME individually. If OBJHOSTNAME is
3063: defined in mk.conf, the first component of the host's name is attached to
3064: the directory name. If OBJMACHINE is defined, the platform name is
3065: attached, which might look like work.i386 or work.sparc.
1.17 imil 3066:
1.184 rillig 3067: Please pay attention to the following gotchas:
1.17 imil 3068:
1.184 rillig 3069: * Add MANCOMPRESSED if man pages are installed in compressed form by the
3070: package. For packages using BSD-style makefiles which honor MANZ, there is
3071: MANCOMPRESSED_IF_MANZ.
1.17 imil 3072:
1.184 rillig 3073: * Replace /usr/local with "${PREFIX}" in all files (see patches, below).
1.103 wiz 3074:
1.184 rillig 3075: * If the package installs any info files, see Section 21.6.7, "Packages
3076: installing info files".
1.103 wiz 3077:
1.184 rillig 3078: 12.2. distinfo
1.17 imil 3079:
1.184 rillig 3080: The distinfo file contains the message digest, or checksum, of each distfile
3081: needed for the package. This ensures that the distfiles retrieved from the
3082: Internet have not been corrupted during transfer or altered by a malign force
3083: to introduce a security hole. To provide maximum security, all distfiles are
3084: protected using three different message digest algorithms (SHA1, RMD160,
3085: SHA512), as well as the file size.
1.17 imil 3086:
1.184 rillig 3087: The distinfo file also contains the checksums for all the patches found in the
3088: patches directory (see Section 12.3, "patches/*"). These checksums ensure that
3089: patches are only applied intentionally and that they don't accidentally change,
3090: e.g. when merging different changes together. They also make sure that new
3091: patches are actually added to CVS and old ones are removed. Too see whether the
3092: patches and the distinfo file match, run pkglint after changing the patches.
1.17 imil 3093:
1.184 rillig 3094: To regenerate the distinfo file, use the make distinfo command.
1.17 imil 3095:
1.184 rillig 3096: Some packages have different sets of distfiles depending on the platform, for
3097: example lang/openjdk8. These are kept in the same distinfo file and care should
3098: be taken when upgrading such a package to ensure distfile information is not
3099: lost.
1.17 imil 3100:
1.184 rillig 3101: 12.3. patches/*
1.63 wiz 3102:
1.184 rillig 3103: Some packages don't work out-of-the box on the various platforms that are
3104: supported by pkgsrc. These packages need to be patched to make them work. The
3105: patch files can be found in the patches/ directory.
1.17 imil 3106:
1.184 rillig 3107: In the patch phase, these patches are applied to the files in WRKSRC directory
3108: after extracting them, in alphabetic order.
1.160 brook 3109:
1.184 rillig 3110: 12.3.1. Structure of a single patch file
1.160 brook 3111:
1.184 rillig 3112: The patch-* files should be in diff -bu format, and apply without a fuzz to
3113: avoid problems. (To force patches to apply with fuzz you can set
3114: PATCH_FUZZ_FACTOR=-F2). Furthermore, each patch should contain only changes for
3115: a single file, and no file should be patched by more than one patch file. This
3116: helps to keep future modifications simple.
1.160 brook 3117:
1.184 rillig 3118: Each patch file is structured as follows: In the first line, there is the RCS
3119: Id of the patch itself. The second line should be empty for aesthetic reasons.
3120: After that, there should be a comment for each change that the patch does.
3121: There are a number of standard cases:
1.160 brook 3122:
1.184 rillig 3123: * Patches for commonly known vulnerabilities should mention the vulnerability
3124: ID (CAN, CVE).
1.160 brook 3125:
1.184 rillig 3126: * Patches that change source code should mention the platform and other
3127: environment (for example, the compiler) that the patch is needed for.
1.160 brook 3128:
1.184 rillig 3129: The patch should be commented so that any developer who knows the code of the
3130: application can make some use of the patch. Special care should be taken for
3131: the upstream developers, since we generally want that they accept our patches,
3132: so we have less work in the future.
1.160 brook 3133:
1.184 rillig 3134: 12.3.2. Creating patch files
1.160 brook 3135:
1.184 rillig 3136: One important thing to mention is to pay attention that no RCS IDs get stored
3137: in the patch files, as these will cause problems when later checked into the
3138: NetBSD CVS tree. Use the pkgdiff command from the pkgtools/pkgdiff package to
3139: avoid these problems.
1.160 brook 3140:
1.184 rillig 3141: For even more automation, we recommend using mkpatches from the same package to
3142: make a whole set of patches. You just have to backup files before you edit them
3143: to filename.orig, e.g. with cp -p filename filename.orig or, easier, by using
3144: pkgvi again from the same package. If you upgrade a package this way, you can
3145: easily compare the new set of patches with the previously existing one with
3146: patchdiff. The files in patches are replaced by new files, so carefully check
3147: if you want to take all the changes.
1.160 brook 3148:
1.184 rillig 3149: When you have finished a package, remember to generate the checksums for the
3150: patch files by using the make makepatchsum command, see Section 12.2,
3151: "distinfo".
1.1 dsieger 3152:
1.184 rillig 3153: When adding a patch that corrects a problem in the distfile (rather than e.g.
3154: enforcing pkgsrc's view of where man pages should go), send the patch as a bug
3155: report to the maintainer. This benefits non-pkgsrc users of the package, and
3156: usually makes it possible to remove the patch in future version.
1.1 dsieger 3157:
1.184 rillig 3158: The file names of the patch files are usually of the form patch-
3159: path_to_file__with__underscores.c. Many packages still use the previous
3160: convention patch-[a-z][a-z], but new patches should be of the form containing
3161: the filename. mkpatches included in pkgtools/pkgdiff takes care of the name
3162: automatically.
1.1 dsieger 3163:
1.184 rillig 3164: 12.3.3. Sources where the patch files come from
1.1 dsieger 3165:
1.184 rillig 3166: If you want to share patches between multiple packages in pkgsrc, e.g. because
3167: they use the same distfiles, set PATCHDIR to the path where the patch files can
3168: be found, e.g.:
1.1 dsieger 3169:
1.184 rillig 3170: PATCHDIR= ../../editors/xemacs/patches
1.1 dsieger 3171:
1.184 rillig 3172: Patch files that are distributed by the author or other maintainers can be
3173: listed in PATCHFILES.
1.1 dsieger 3174:
1.184 rillig 3175: If it is desired to store any patches that should not be committed into pkgsrc,
3176: they can be kept outside the pkgsrc tree in the $LOCALPATCHES directory. The
3177: directory tree there is expected to have the same "category/package" structure
3178: as pkgsrc, and patches are expected to be stored inside these dirs (also known
3179: as $LOCALPATCHES/$PKGPATH). For example, if you want to keep a private patch
3180: for pkgsrc/graphics/png, keep it in $LOCALPATCHES/graphics/png/mypatch. All
3181: files in the named directory are expected to be patch files, and they are
3182: applied after pkgsrc patches are applied.
1.1 dsieger 3183:
1.184 rillig 3184: 12.3.4. Patching guidelines
1.1 dsieger 3185:
1.184 rillig 3186: When fixing a portability issue in the code do not use preprocessor magic to
3187: check for the current operating system nor platform. Doing so hurts portability
3188: to other platforms because the OS-specific details are not abstracted
3189: appropriately.
1.1 dsieger 3190:
1.184 rillig 3191: The general rule to follow is: instead of checking for the operating system the
3192: application is being built on, check for the specific features you need. For
3193: example, instead of assuming that kqueue is available under NetBSD and using
3194: the __NetBSD__ macro to conditionalize kqueue support, add a check that detects
1.198 leot 3195: kqueue itself -- yes, this generally involves patching the configure script.
1.184 rillig 3196: There is absolutely nothing that prevents some OSes from adopting interfaces
3197: from other OSes (e.g. Linux implementing kqueue), something that the above
3198: checks cannot take into account.
1.1 dsieger 3199:
1.184 rillig 3200: Of course, checking for features generally involves more work on the
3201: developer's side, but the resulting changes are cleaner and there are chances
3202: they will work on many other platforms. Not to mention that there are higher
3203: chances of being later integrated into the mainstream sources. Remember: It
3204: doesn't work unless it is right!
1.1 dsieger 3205:
1.184 rillig 3206: Some typical examples:
1.121 sevan 3207:
1.184 rillig 3208: Table 12.1. Patching examples
1.1 dsieger 3209:
1.184 rillig 3210: +-------------------------------------------------------------------------------------------+
3211: | Where | Incorrect | Correct |
3212: |---------+--------------------------+------------------------------------------------------|
3213: | |case ${target_os} in | |
3214: |configure|netbsd*) have_kvm=yes ;; |AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)|
3215: |script |*) have_kvm=no ;; | |
3216: | |esac | |
3217: |---------+--------------------------+------------------------------------------------------|
3218: |C source |#if defined(__NetBSD__) |#if defined(HAVE_SYS_EVENT_H) |
3219: |file |# include <sys/event.h> |# include <sys/event.h> |
3220: | |#endif |#endif |
3221: |---------+--------------------------+------------------------------------------------------|
3222: | |int |int |
3223: | |monitor_file(...) |monitor_file(...) |
3224: | |{ |{ |
3225: | |#if defined(__NetBSD__) |#if defined(HAVE_KQUEUE) |
3226: |C source | int fd = kqueue();| int fd = kqueue(); |
3227: |file | ... | ... |
3228: | |#else |#else |
3229: | | ... | ... |
3230: | |#endif |#endif |
3231: | |} |} |
3232: +-------------------------------------------------------------------------------------------+
1.1 dsieger 3233:
3234:
1.184 rillig 3235: 12.3.5. Feedback to the author
1.1 dsieger 3236:
1.184 rillig 3237: Always, always, always feed back any portability fixes or improvements you do
3238: to a package to the mainstream developers. This is the only way to get their
3239: attention on portability issues and to ensure that future versions can be built
3240: out-of-the box on NetBSD. Furthermore, any user that gets newer distfiles will
3241: get the fixes straight from the packaged code.
1.1 dsieger 3242:
1.184 rillig 3243: This generally involves cleaning up the patches (because sometimes the patches
3244: that are added to pkgsrc are quick hacks), filing bug reports in the
3245: appropriate trackers for the projects and working with the mainstream authors
3246: to accept your changes. It is extremely important that you do it so that the
3247: packages in pkgsrc are kept simple and thus further changes can be done without
3248: much hassle.
1.1 dsieger 3249:
1.184 rillig 3250: When you have done this, please add a URL to the upstream bug report to the
3251: patch comment.
1.1 dsieger 3252:
1.184 rillig 3253: Support the idea of free software!
1.1 dsieger 3254:
1.184 rillig 3255: 12.4. Other mandatory files
1.1 dsieger 3256:
1.184 rillig 3257: DESCR
1.1 dsieger 3258:
1.184 rillig 3259: A multi-line description of the piece of software. This should include any
3260: credits where they are due. Please bear in mind that others do not share
3261: your sense of humour (or spelling idiosyncrasies), and that others will
3262: read everything that you write here.
1.1 dsieger 3263:
1.184 rillig 3264: PLIST
1.1 dsieger 3265:
1.184 rillig 3266: This file governs the files that are installed on your system: all the
3267: binaries, manual pages, etc. There are other directives which may be
3268: entered in this file, to control the creation and deletion of directories,
3269: and the location of inserted files. See Chapter 19, PLIST issues for more
3270: information.
1.1 dsieger 3271:
1.184 rillig 3272: 12.5. Optional files
1.1 dsieger 3273:
1.184 rillig 3274: 12.5.1. Files affecting the binary package
1.1 dsieger 3275:
1.184 rillig 3276: INSTALL
1.1 dsieger 3277:
1.184 rillig 3278: This shell script is invoked twice by pkg_add(1). First time after package
3279: extraction and before files are moved in place, the second time after the
3280: files to install are moved in place. This can be used to do any custom
3281: procedures not possible with @exec commands in PLIST. See pkg_add(1) and
3282: pkg_create(1) for more information. See also Section 20.1, "Files and
3283: directories outside the installation prefix". Please note that you can
3284: modify variables in it easily by using FILES_SUBST in the package's
3285: Makefile:
1.1 dsieger 3286:
1.184 rillig 3287: FILES_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 3288:
1.184 rillig 3289: replaces "@SOMEVAR@" with "somevalue" in the INSTALL. By default,
3290: substitution is performed for PREFIX, LOCALBASE, X11BASE, VARBASE, and a
3291: few others, type make help topic=FILES_SUBST for a complete list.
1.1 dsieger 3292:
1.184 rillig 3293: DEINSTALL
1.1 dsieger 3294:
1.184 rillig 3295: This script is executed before and after any files are removed. It is this
3296: script's responsibility to clean up any additional messy details around the
3297: package's installation, since all pkg_delete knows is how to delete the
3298: files created in the original distribution. See pkg_delete(1) and
3299: pkg_create(1) for more information. The same methods to replace variables
3300: can be used as for the INSTALL file.
1.1 dsieger 3301:
1.184 rillig 3302: MESSAGE
1.1 dsieger 3303:
1.198 leot 3304: This file is displayed after installation of the package. While this was
3305: used often in the past, it has two problems: the display will be missed if
3306: many packages are intalled at once, and the person installing the package
3307: and the one using or configuring it may be different. It should therefore
3308: be used only in exceptional circumstances where lasting negative
3309: consequences would result from someone not reading it.
3310:
3311: MESSAGE should not be used for:
3312:
3313: + exhortations to read the documentation
3314:
3315: + reminders to install rc.d files and set variables
3316:
3317: + anything that should be explained in the installation/configuration
3318: documentation that should come with the package
3319:
3320: If the documentation provided by upstream needs enhancing, create e.g.
3321: files/README.pkgsrc and install it in the package's documentation
3322: directory.
3323:
3324: Note that MESSAGE is shown for all operating systems and all init systems.
3325: If a MESSAGE is necessary, it should be narrowed to only those operating
3326: systems and init systems to which it applies.
3327:
3328: Note that you can modify variables in it easily by using MESSAGE_SUBST in
3329: the package's Makefile:
1.1 dsieger 3330:
1.184 rillig 3331: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 3332:
1.184 rillig 3333: replaces "${SOMEVAR}" with "somevalue" in MESSAGE. By default, substitution
3334: is performed for PKGNAME, PKGBASE, PREFIX, LOCALBASE, X11BASE,
3335: PKG_SYSCONFDIR, ROOT_GROUP, and ROOT_USER.
1.1 dsieger 3336:
1.184 rillig 3337: You can display a different or additional files by setting the MESSAGE_SRC
3338: variable. Its default is MESSAGE, if the file exists.
1.1 dsieger 3339:
1.184 rillig 3340: ALTERNATIVES
1.1 dsieger 3341:
1.184 rillig 3342: This file is used by the alternatives framework. It creates, configures,
3343: and destroys generic wrappers used to run programs with similar interfaces.
3344: See pkg_alternatives(8) from pkgtools/pkg_alternatives for more
3345: information.
1.1 dsieger 3346:
1.184 rillig 3347: Each line of the file contains two filenames, first the wrapper and then
3348: the alternative provided by the package. Both paths are relative to PREFIX.
1.1 dsieger 3349:
1.184 rillig 3350: 12.5.2. Files affecting the build process
1.1 dsieger 3351:
1.184 rillig 3352: Makefile.common
1.1 dsieger 3353:
1.184 rillig 3354: This file contains arbitrary things that could also go into a Makefile, but
3355: its purpose is to be used by more than one package. This file should only
3356: be used when the packages that will use the file are known in advance. For
3357: other purposes it is often better to write a *.mk file and give it a good
3358: name that describes what it does.
1.1 dsieger 3359:
1.184 rillig 3360: buildlink3.mk
1.1 dsieger 3361:
1.184 rillig 3362: This file contains the dependency information for the buildlink3 framework
3363: (see Chapter 18, Buildlink methodology).
1.1 dsieger 3364:
1.184 rillig 3365: hacks.mk
1.1 dsieger 3366:
1.184 rillig 3367: This file contains workarounds for compiler bugs and similar things. It is
3368: included automatically by the pkgsrc infrastructure, so you don't need an
3369: extra .include line for it.
1.1 dsieger 3370:
1.184 rillig 3371: options.mk
1.1 dsieger 3372:
1.184 rillig 3373: This file contains the code for the package-specific options (see
3374: Chapter 16, Options handling) that can be selected by the user. If a
3375: package has only one or two options, it is equally acceptable to put the
3376: code directly into the Makefile.
1.1 dsieger 3377:
1.184 rillig 3378: 12.5.3. Files affecting nothing at all
1.1 dsieger 3379:
1.184 rillig 3380: README*
1.1 dsieger 3381:
1.184 rillig 3382: These files do not take place in the creation of a package and thus are
3383: purely informative to the package developer.
1.1 dsieger 3384:
1.184 rillig 3385: TODO
1.1 dsieger 3386:
1.184 rillig 3387: This file contains things that need to be done to make the package even
3388: better.
1.1 dsieger 3389:
1.184 rillig 3390: 12.6. work*
1.1 dsieger 3391:
1.184 rillig 3392: When you type make, the distribution files are unpacked into the directory
3393: denoted by WRKDIR. It can be removed by running make clean. Besides the
3394: sources, this directory is also used to keep various timestamp files. The
3395: directory gets removed completely on clean. The default is ${.CURDIR}/work or $
3396: {.CURDIR}/work.${MACHINE_ARCH} if OBJMACHINE is set.
1.1 dsieger 3397:
1.184 rillig 3398: 12.7. files/*
1.80 wiz 3399:
1.184 rillig 3400: If you have any files that you wish to be placed in the package prior to
3401: configuration or building, you can place these files here and use a ${CP}
3402: command in the "post-extract" target to achieve this.
1.1 dsieger 3403:
1.184 rillig 3404: If you want to share files in this way with other packages, set the FILESDIR
3405: variable to point to the other package's files directory, e.g.:
1.1 dsieger 3406:
1.184 rillig 3407: FILESDIR= ../../editors/xemacs/files
1.14 jmcneill 3408:
1.184 rillig 3409: Chapter 13. The build process
1.1 dsieger 3410:
1.184 rillig 3411: Table of Contents
1.1 dsieger 3412:
1.184 rillig 3413: 13.1. Introduction
3414: 13.2. Program location
3415: 13.3. Directories used during the build process
3416: 13.4. Running a phase
3417: 13.5. The fetch phase
3418:
3419: 13.5.1. What to fetch and where to get it from
3420: 13.5.2. How are the files fetched?
3421:
3422: 13.6. The checksum phase
3423: 13.7. The extract phase
3424: 13.8. The patch phase
3425: 13.9. The tools phase
3426: 13.10. The wrapper phase
3427: 13.11. The configure phase
3428: 13.12. The build phase
3429: 13.13. The test phase
3430: 13.14. The install phase
3431: 13.15. The package phase
3432: 13.16. Cleaning up
3433: 13.17. Other helpful targets
1.1 dsieger 3434:
1.184 rillig 3435: 13.1. Introduction
1.122 leot 3436:
1.184 rillig 3437: This chapter gives a detailed description on how a package is built. Building a
3438: package is separated into different phases (for example fetch, build, install),
3439: all of which are described in the following sections. Each phase is split into
3440: so-called stages, which take the name of the containing phase, prefixed by one
3441: of pre-, do- or post-. (Examples are pre-configure, post-build.) Most of the
3442: actual work is done in the do-* stages.
1.1 dsieger 3443:
1.184 rillig 3444: Never override the regular targets (like fetch), if you have to, override the
3445: do-* ones instead.
1.1 dsieger 3446:
1.184 rillig 3447: The basic steps for building a program are always the same. First the program's
3448: source (distfile) must be brought to the local system and then extracted. After
3449: any pkgsrc-specific patches to compile properly are applied, the software can
3450: be configured, then built (usually by compiling), and finally the generated
3451: binaries, etc. can be put into place on the system.
1.1 dsieger 3452:
1.184 rillig 3453: To get more details about what is happening at each step, you can set the
3454: PKG_VERBOSE variable, or the PATCH_DEBUG variable if you are just interested in
3455: more details about the patch step.
1.1 dsieger 3456:
1.184 rillig 3457: 13.2. Program location
1.1 dsieger 3458:
1.184 rillig 3459: Before outlining the process performed by the NetBSD package system in the next
3460: section, here's a brief discussion on where programs are installed, and which
3461: variables influence this.
1.1 dsieger 3462:
1.184 rillig 3463: The automatic variable PREFIX indicates where all files of the final program
3464: shall be installed. It is usually set to LOCALBASE (/usr/pkg), or CROSSBASE for
3465: pkgs in the cross category. The value of PREFIX needs to be put into the
3466: various places in the program's source where paths to these files are encoded.
3467: See Section 12.3, "patches/*" and Section 21.3.1, "Shared libraries - libtool"
3468: for more details.
1.1 dsieger 3469:
1.184 rillig 3470: When choosing which of these variables to use, follow the following rules:
1.1 dsieger 3471:
1.184 rillig 3472: * PREFIX always points to the location where the current pkg will be
3473: installed. When referring to a pkg's own installation path, use "${PREFIX}"
3474: .
1.1 dsieger 3475:
1.184 rillig 3476: * LOCALBASE is where all non-X11 pkgs are installed. If you need to construct
3477: a -I or -L argument to the compiler to find includes and libraries
3478: installed by another non-X11 pkg, use "${LOCALBASE}". The name LOCALBASE
3479: stems from FreeBSD, which installed all packages in /usr/local. As pkgsrc
3480: leaves /usr/local for the system administrator, this variable is a
3481: misnomer.
1.1 dsieger 3482:
1.184 rillig 3483: * X11BASE is where the actual X11 distribution (from xsrc, etc.) is
3484: installed. When looking for standard X11 includes (not those installed by a
3485: package), use "${X11BASE}".
1.1 dsieger 3486:
1.184 rillig 3487: * X11-based packages using imake must set USE_IMAKE to be installed correctly
3488: under LOCALBASE.
1.1 dsieger 3489:
1.184 rillig 3490: * Within ${PREFIX}, packages should install files according to hier(7), with
3491: the exception that manual pages go into ${PREFIX}/man, not ${PREFIX}/share/
3492: man.
1.1 dsieger 3493:
1.184 rillig 3494: 13.3. Directories used during the build process
1.2 rillig 3495:
1.184 rillig 3496: When building a package, various directories are used to store source files,
3497: temporary files, pkgsrc-internal files, and so on. These directories are
3498: explained here.
1.1 dsieger 3499:
1.184 rillig 3500: Some of the directory variables contain relative pathnames. There are two
3501: common base directories for these relative directories: PKGSRCDIR/PKGPATH is
3502: used for directories that are pkgsrc-specific. WRKSRC is used for directories
3503: inside the package itself.
1.1 dsieger 3504:
1.184 rillig 3505: PKGSRCDIR
1.1 dsieger 3506:
1.184 rillig 3507: This is an absolute pathname that points to the pkgsrc root directory.
3508: Generally, you don't need it.
1.1 dsieger 3509:
1.184 rillig 3510: PKGDIR
1.1 dsieger 3511:
1.184 rillig 3512: This is an absolute pathname that points to the current package.
1.1 dsieger 3513:
1.184 rillig 3514: PKGPATH
1.1 dsieger 3515:
1.184 rillig 3516: This is a pathname relative to PKGSRCDIR that points to the current
3517: package.
1.1 dsieger 3518:
1.184 rillig 3519: WRKDIR
1.1 dsieger 3520:
1.184 rillig 3521: This is an absolute pathname pointing to the directory where all work takes
3522: place. The distfiles are extracted to this directory. It also contains
3523: temporary directories and log files used by the various pkgsrc frameworks,
3524: like buildlink or the wrappers.
1.1 dsieger 3525:
1.184 rillig 3526: WRKSRC
1.1 dsieger 3527:
1.184 rillig 3528: This is an absolute pathname pointing to the directory where the distfiles
3529: are extracted. It is usually a direct subdirectory of WRKDIR, and often
3530: it's the only directory entry that isn't hidden. This variable may be
3531: changed by a package Makefile.
1.1 dsieger 3532:
1.184 rillig 3533: The CREATE_WRKDIR_SYMLINK definition takes either the value yes or no and
3534: defaults to no. It indicates whether a symbolic link to the WRKDIR is to be
3535: created in the pkgsrc entry's directory. If users would like to have their
3536: pkgsrc trees behave in a read-only manner, then the value of
3537: CREATE_WRKDIR_SYMLINK should be set to no.
1.1 dsieger 3538:
1.184 rillig 3539: 13.4. Running a phase
1.1 dsieger 3540:
1.184 rillig 3541: You can run a particular phase by typing make phase, where phase is the name of
3542: the phase. This will automatically run all phases that are required for this
3543: phase. The default phase is build, that is, when you run make without
3544: parameters in a package directory, the package will be built, but not
3545: installed.
1.1 dsieger 3546:
1.184 rillig 3547: 13.5. The fetch phase
1.1 dsieger 3548:
1.184 rillig 3549: The first step in building a package is to fetch the distribution files
3550: (distfiles) from the sites that are providing them. This is the task of the
3551: fetch phase.
1.25 wiz 3552:
1.184 rillig 3553: 13.5.1. What to fetch and where to get it from
1.1 dsieger 3554:
1.184 rillig 3555: In simple cases, MASTER_SITES defines all URLs from where the distfile, whose
3556: name is derived from the DISTNAME variable, is fetched. The more complicated
3557: cases are described below.
1.1 dsieger 3558:
1.184 rillig 3559: The variable DISTFILES specifies the list of distfiles that have to be fetched.
3560: Its value defaults to ${DEFAULT_DISTFILES} and its value is ${DISTNAME}$
3561: {EXTRACT_SUFX}, so that most packages don't need to define it at all.
3562: EXTRACT_SUFX is .tar.gz by default, but can be changed freely. Note that if
3563: your package requires additional distfiles to the default one, you cannot just
3564: append the additional filenames using the += operator, but you have write for
3565: example:
1.1 dsieger 3566:
1.184 rillig 3567: DISTFILES= ${DEFAULT_DISTFILES} additional-files.tar.gz
1.1 dsieger 3568:
1.184 rillig 3569: Each distfile is fetched from a list of sites, usually MASTER_SITES. If the
3570: package has multiple DISTFILES or multiple PATCHFILES from different sites, you
3571: can set SITES.distfile to the list of URLs where the file distfile (including
3572: the suffix) can be found.
1.1 dsieger 3573:
1.184 rillig 3574: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
3575: DISTFILES+= foo-file.tar.gz
3576: SITES.foo-file.tar.gz= \
3577: https://www.somewhere.com/somehow/ \
3578: https://www.somewhereelse.com/mirror/somehow/
1.1 dsieger 3579:
1.184 rillig 3580: When actually fetching the distfiles, each item from MASTER_SITES or SITES.*
3581: gets the name of each distfile appended to it, without an intermediate slash.
3582: Therefore, all site values have to end with a slash or other separator
3583: character. This allows for example to set MASTER_SITES to a URL of a CGI script
3584: that gets the name of the distfile as a parameter. In this case, the definition
3585: would look like:
1.1 dsieger 3586:
1.184 rillig 3587: MASTER_SITES= https://www.example.com/download.cgi?file=
1.1 dsieger 3588:
1.184 rillig 3589: The exception to this rule are URLs starting with a dash. In that case the URL
3590: is taken as is, fetched and the result stored under the name of the distfile.
3591: You can use this style for the case when the download URL style does not match
3592: the above common case. For example, if permanent download URL is a redirector
3593: to the real download URL, or the download file name is offered by an HTTP
3594: Content-Disposition header. In the following example, foo-1.0.0.tar.gz will be
3595: created instead of the default v1.0.0.tar.gz.
1.1 dsieger 3596:
1.184 rillig 3597: DISTNAME= foo-1.0.0
3598: MASTER_SITES= -https://www.example.com/archive/v1.0.0.tar.gz
1.29 wiz 3599:
1.184 rillig 3600: There are some predefined values for MASTER_SITES, which can be used in
3601: packages. The names of the variables should speak for themselves.
1.29 wiz 3602:
1.184 rillig 3603: MASTER_SITE_APACHE MASTER_SITE_BACKUP
3604: MASTER_SITE_CRATESIO MASTER_SITE_CYGWIN
3605: MASTER_SITE_DEBIAN MASTER_SITE_FREEBSD
3606: MASTER_SITE_FREEBSD_LOCAL MASTER_SITE_GENTOO
3607: MASTER_SITE_GITHUB MASTER_SITE_GNOME
3608: MASTER_SITE_GNU MASTER_SITE_GNUSTEP
3609: MASTER_SITE_HASKELL_HACKAGE MASTER_SITE_IFARCHIVE
3610: MASTER_SITE_KDE MASTER_SITE_MOZILLA
3611: MASTER_SITE_MOZILLA_ALL MASTER_SITE_MYSQL
3612: MASTER_SITE_NETLIB MASTER_SITE_OPENBSD
3613: MASTER_SITE_OPENOFFICE MASTER_SITE_OSDN
3614: MASTER_SITE_PERL_CPAN MASTER_SITE_PGSQL
3615: MASTER_SITE_PYPI MASTER_SITE_RUBYGEMS
3616: MASTER_SITE_R_CRAN MASTER_SITE_SOURCEFORGE
3617: MASTER_SITE_SUNSITE MASTER_SITE_SUSE
3618: MASTER_SITE_TEX_CTAN MASTER_SITE_XCONTRIB
3619: MASTER_SITE_XEMACS MASTER_SITE_XORG
1.1 dsieger 3620:
1.184 rillig 3621: Some explanations for the less self-explaining ones: MASTER_SITE_BACKUP
3622: contains backup sites for packages that are maintained in ftp://ftp.NetBSD.org/
3623: pub/pkgsrc/distfiles/${DIST_SUBDIR}. MASTER_SITE_LOCAL contains local package
3624: source distributions that are maintained in ftp://ftp.NetBSD.org/pub/pkgsrc/
3625: distfiles/LOCAL_PORTS/.
1.1 dsieger 3626:
1.184 rillig 3627: If you choose one of these predefined sites, you may want to specify a
3628: subdirectory of that site. Since these macros may expand to more than one
3629: actual site, you must use the following construct to specify a subdirectory:
1.1 dsieger 3630:
1.184 rillig 3631: MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/}
3632: MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.1 dsieger 3633:
1.184 rillig 3634: Note the trailing slash after the subdirectory name.
1.1 dsieger 3635:
1.184 rillig 3636: 13.5.2. How are the files fetched?
1.1 dsieger 3637:
1.184 rillig 3638: The fetch phase makes sure that all the distfiles exist in a local directory
3639: (DISTDIR, which can be set by the pkgsrc user). If the files do not exist, they
3640: are fetched using commands of the form
1.1 dsieger 3641:
1.184 rillig 3642: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 dsieger 3643:
1.184 rillig 3644: where ${site} varies through several possibilities in turn: first,
3645: MASTER_SITE_OVERRIDE is tried, then the sites specified in either SITES.file if
3646: defined, else MASTER_SITES or PATCH_SITES, as applies, then finally the value
3647: of MASTER_SITE_BACKUP. The order of all except the first and the last can be
3648: optionally sorted by the user, via setting either MASTER_SORT_RANDOM, and
3649: MASTER_SORT_AWK or MASTER_SORT_REGEX.
1.1 dsieger 3650:
1.184 rillig 3651: The specific command and arguments used depend on the FETCH_USING parameter.
3652: The example above is for FETCH_USING=custom.
1.66 asau 3653:
1.184 rillig 3654: The distfiles mirror run by the NetBSD Foundation uses the mirror-distfiles
3655: target to mirror the distfiles, if they are freely distributable. Packages
3656: setting NO_SRC_ON_FTP (usually to "${RESTRICTED}") will not have their
3657: distfiles mirrored.
1.1 dsieger 3658:
1.184 rillig 3659: 13.6. The checksum phase
1.1 dsieger 3660:
1.184 rillig 3661: After the distfile(s) are fetched, their checksum is generated and compared
3662: with the checksums stored in the distinfo file. If the checksums don't match,
3663: the build is aborted. This is to ensure the same distfile is used for building,
3664: and that the distfile wasn't changed, e.g. by some malign force, deliberately
3665: changed distfiles on the master distribution site or network lossage.
1.1 dsieger 3666:
1.184 rillig 3667: 13.7. The extract phase
1.1 dsieger 3668:
1.184 rillig 3669: When the distfiles are present on the local system, they need to be extracted,
3670: as they usually come in the form of some compressed archive format.
1.1 dsieger 3671:
1.184 rillig 3672: By default, all DISTFILES are extracted. If you only need some of them, you can
3673: set the EXTRACT_ONLY variable to the list of those files.
1.1 dsieger 3674:
1.184 rillig 3675: Extracting the files is usually done by a little program, mk/extract/extract,
3676: which already knows how to extract various archive formats, so most likely you
3677: will not need to change anything here. But if you need, the following variables
3678: may help you:
1.1 dsieger 3679:
1.184 rillig 3680: EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}
1.1 dsieger 3681:
1.184 rillig 3682: Use these variables to override the default options for an extract command,
3683: which are defined in mk/extract/extract.
1.1 dsieger 3684:
1.184 rillig 3685: EXTRACT_USING
1.1 dsieger 3686:
1.184 rillig 3687: This variable can be set to bsdtar, gtar, nbtar (which is the default
3688: value), pax, or an absolute pathname pointing to the command with which tar
3689: archives should be extracted. It is preferred to choose bsdtar over gtar if
3690: NetBSD's pax-as-tar is not good enough.
1.1 dsieger 3691:
1.184 rillig 3692: If the extract program doesn't serve your needs, you can also override the
3693: EXTRACT_CMD variable, which holds the command used for extracting the files.
3694: This command is executed in the ${WRKSRC} directory. During execution of this
3695: command, the shell variable extract_file holds the absolute pathname of the
3696: file that is going to be extracted.
1.1 dsieger 3697:
1.184 rillig 3698: And if that still does not suffice, you can override the do-extract target in
3699: the package Makefile.
1.1 dsieger 3700:
1.184 rillig 3701: 13.8. The patch phase
1.1 dsieger 3702:
1.184 rillig 3703: After extraction, all the patches named by the PATCHFILES, those present in the
3704: patches subdirectory of the package as well as in $LOCALPATCHES/$PKGPATH (e.g.
3705: /usr/local/patches/graphics/png) are applied. Patchfiles ending in .Z or .gz
3706: are uncompressed before they are applied, files ending in .orig or .rej are
3707: ignored. Any special options to patch(1) can be handed in PATCH_DIST_ARGS. See
3708: Section 12.3, "patches/*" for more details.
1.1 dsieger 3709:
1.184 rillig 3710: By default patch(1) is given special arguments to make it fail if the expected
3711: text from the patch context is not found in the patched file. If that happens,
3712: fix the patch file by comparing it with the actual text in the file to be
3713: patched.
1.1 dsieger 3714:
1.184 rillig 3715: 13.9. The tools phase
1.1 dsieger 3716:
1.184 rillig 3717: This is covered in Chapter 17, Tools needed for building or running.
1.1 dsieger 3718:
1.184 rillig 3719: 13.10. The wrapper phase
1.1 dsieger 3720:
1.184 rillig 3721: This phase creates wrapper programs for the compilers and linkers. The
3722: following variables can be used to tweak the wrappers.
1.1 dsieger 3723:
1.184 rillig 3724: ECHO_WRAPPER_MSG
1.1 dsieger 3725:
1.184 rillig 3726: The command used to print progress messages. Does nothing by default. Set
3727: to ${ECHO} to see the progress messages.
1.1 dsieger 3728:
1.184 rillig 3729: WRAPPER_DEBUG
1.1 dsieger 3730:
1.184 rillig 3731: This variable can be set to yes (default) or no, depending on whether you
3732: want additional information in the wrapper log file.
1.1 dsieger 3733:
1.184 rillig 3734: WRAPPER_UPDATE_CACHE
1.1 dsieger 3735:
1.184 rillig 3736: This variable can be set to yes or no, depending on whether the wrapper
3737: should use its cache, which will improve the speed. The default value is
3738: yes, but is forced to no if the platform does not support it.
1.1 dsieger 3739:
1.184 rillig 3740: WRAPPER_REORDER_CMDS
1.1 dsieger 3741:
1.184 rillig 3742: A list of reordering commands. A reordering command has the form reorder:l:
3743: lib1:lib2. It ensures that that -llib1 occurs before -llib2.
1.1 dsieger 3744:
1.184 rillig 3745: 13.11. The configure phase
1.1 dsieger 3746:
1.184 rillig 3747: Most pieces of software need information on the header files, system calls, and
3748: library routines which are available on the platform they run on. The process
3749: of determining this information is known as configuration, and is usually
3750: automated. In most cases, a script is supplied with the distfiles, and its
3751: invocation results in generation of header files, Makefiles, etc.
1.1 dsieger 3752:
1.184 rillig 3753: If the package contains a configure script, this can be invoked by setting
3754: HAS_CONFIGURE to "yes". If the configure script is a GNU autoconf script, you
1.187 rillig 3755: should set GNU_CONFIGURE to "yes" instead.
1.1 dsieger 3756:
1.187 rillig 3757: In the do-configure stage, a rough equivalent of the following command is run.
3758: See mk/configure/configure.mk, target do-configure-script for the exact
3759: definition.
3760:
3761: .for dir in ${CONFIGURE_DIRS}
3762: cd ${WRKSRC} && cd ${dir} \
3763: && env ${CONFIGURE_ENV} \
3764: ${CONFIG_SHELL} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
1.184 rillig 3765: .endfor
1.1 dsieger 3766:
1.184 rillig 3767: CONFIGURE_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In
3768: each of these directories, the configure script is run with the environment
3769: CONFIGURE_ENV and arguments CONFIGURE_ARGS. The variables CONFIGURE_ENV,
3770: CONFIGURE_SCRIPT (default: "./configure") and CONFIGURE_ARGS may all be changed
3771: by the package.
1.1 dsieger 3772:
1.184 rillig 3773: If the program uses the Perl way of configuration (mainly Perl modules, but not
3774: only), i.e. a file called Makefile.PL, it should include ../../lang/perl5/
3775: module.mk. To set any parameter for Makefile.PL use the MAKE_PARAMS variable
3776: (e.g., MAKE_PARAMS+=foo=bar
1.1 dsieger 3777:
1.184 rillig 3778: If the program uses an Imakefile for configuration, the appropriate steps can
3779: be invoked by setting USE_IMAKE to "yes". If you only need xmkmf, add it to
3780: USE_TOOLS. You can add variables to xmkmf's environment by adding them to the
3781: SCRIPTS_ENV variable.
1.1 dsieger 3782:
1.184 rillig 3783: If the program uses cmake for configuration, the appropriate steps can be
3784: invoked by setting USE_CMAKE to "yes". You can add variables to cmake's
3785: environment by adding them to the CONFIGURE_ENV variable and arguments to cmake
3786: by adding them to the CMAKE_ARGS variable. The top directory argument is given
3787: by the CMAKE_ARG_PATH variable, that defaults to "." (relative to
3788: CONFIGURE_DIRS)
1.1 dsieger 3789:
1.184 rillig 3790: If there is no configure step at all, set NO_CONFIGURE to "yes".
1.1 dsieger 3791:
1.184 rillig 3792: 13.12. The build phase
1.1 dsieger 3793:
1.187 rillig 3794: For building a package, a rough equivalent of the following code is executed;
3795: see mk/build/build.mk, target do-build for the exact definition.
1.154 rillig 3796:
1.187 rillig 3797: .for dir in ${BUILD_DIRS}
3798: cd ${WRKSRC} && cd ${dir} \
1.184 rillig 3799: && env ${MAKE_ENV} \
1.187 rillig 3800: ${MAKE_PROGRAM} ${MAKE_FLAGS} ${BUILD_MAKE_FLAGS} \
1.184 rillig 3801: -f ${MAKE_FILE} \
3802: ${BUILD_TARGET}
3803: .endfor
1.1 dsieger 3804:
1.184 rillig 3805: BUILD_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In each of
3806: these directories, MAKE_PROGRAM is run with the environment MAKE_ENV and
3807: arguments BUILD_MAKE_FLAGS. The variables MAKE_ENV, BUILD_MAKE_FLAGS, MAKE_FILE
3808: and BUILD_TARGET may all be changed by the package.
1.1 dsieger 3809:
1.184 rillig 3810: The default value of MAKE_PROGRAM is "gmake" if USE_TOOLS contains "gmake", "
3811: make" otherwise. The default value of MAKE_FILE is "Makefile", and BUILD_TARGET
3812: defaults to "all".
1.1 dsieger 3813:
1.184 rillig 3814: If there is no build step at all, set NO_BUILD to "yes".
1.1 dsieger 3815:
1.184 rillig 3816: 13.13. The test phase
1.1 dsieger 3817:
1.184 rillig 3818: [TODO]
1.1 dsieger 3819:
1.184 rillig 3820: 13.14. The install phase
1.1 dsieger 3821:
1.184 rillig 3822: Once the build stage has completed, the final step is to install the software
3823: in public directories, so users can access the programs and files.
1.1 dsieger 3824:
1.187 rillig 3825: In the install phase, a rough equivalent of the following code is executed; see
3826: mk/install/install.mk, target do-install for the exact definition.
3827: Additionally, before and after this code, several consistency checks are run
3828: against the files-to-be-installed, see mk/check/*.mk for details.
3829:
3830: .for dir in ${INSTALL_DIRS}
3831: cd ${WRKSRC} && cd ${dir} \
3832: && env ${INSTALL_ENV} ${MAKE_ENV} \
3833: ${MAKE_PROGRAM} ${MAKE_FLAGS} ${INSTALL_MAKE_FLAGS} \
3834: -f ${MAKE_FILE} ${INSTALL_TARGET}
1.184 rillig 3835: .endfor
1.1 dsieger 3836:
1.184 rillig 3837: The variable's meanings are analogous to the ones in the build phase.
3838: INSTALL_DIRS defaults to BUILD_DIRS. INSTALL_TARGET is "install" by default,
3839: plus "install.man" if USE_IMAKE is defined and NO_INSTALL_MANPAGES is not
3840: defined.
1.1 dsieger 3841:
1.184 rillig 3842: In the install phase, the following variables are useful. They are all
3843: variations of the install(1) command that have the owner, group and permissions
3844: preset. INSTALL is the plain install command. The specialized variants,
3845: together with their intended use, are:
1.1 dsieger 3846:
1.184 rillig 3847: INSTALL_PROGRAM_DIR
1.1 dsieger 3848:
1.184 rillig 3849: directories that contain binaries
1.1 dsieger 3850:
1.184 rillig 3851: INSTALL_SCRIPT_DIR
1.1 dsieger 3852:
1.184 rillig 3853: directories that contain scripts
1.1 dsieger 3854:
1.184 rillig 3855: INSTALL_LIB_DIR
1.1 dsieger 3856:
1.184 rillig 3857: directories that contain shared and static libraries
1.1 dsieger 3858:
1.184 rillig 3859: INSTALL_DATA_DIR
1.108 rillig 3860:
1.184 rillig 3861: directories that contain data files
1.108 rillig 3862:
1.184 rillig 3863: INSTALL_MAN_DIR
1.108 rillig 3864:
1.184 rillig 3865: directories that contain man pages
1.108 rillig 3866:
1.184 rillig 3867: INSTALL_GAME_DIR
1.108 rillig 3868:
1.184 rillig 3869: directories that contain data files for games
1.108 rillig 3870:
1.184 rillig 3871: INSTALL_PROGRAM
1.108 rillig 3872:
1.184 rillig 3873: binaries that can be stripped from debugging symbols
1.108 rillig 3874:
1.184 rillig 3875: INSTALL_SCRIPT
1.108 rillig 3876:
1.184 rillig 3877: binaries that cannot be stripped
1.108 rillig 3878:
1.184 rillig 3879: INSTALL_GAME
1.108 rillig 3880:
1.184 rillig 3881: game binaries
1.108 rillig 3882:
1.184 rillig 3883: INSTALL_LIB
1.108 rillig 3884:
1.184 rillig 3885: shared and static libraries
1.108 rillig 3886:
1.184 rillig 3887: INSTALL_DATA
1.108 rillig 3888:
1.184 rillig 3889: data files
1.1 dsieger 3890:
1.184 rillig 3891: INSTALL_GAME_DATA
1.1 dsieger 3892:
1.184 rillig 3893: data files for games
1.108 rillig 3894:
1.184 rillig 3895: INSTALL_MAN
1.108 rillig 3896:
1.184 rillig 3897: man pages
1.1 dsieger 3898:
1.184 rillig 3899: Some other variables are:
1.1 dsieger 3900:
1.184 rillig 3901: INSTALL_UNSTRIPPED
1.1 dsieger 3902:
1.184 rillig 3903: If set to yes, do not run strip(1) when installing binaries. Any debugging
3904: sections and symbols present in binaries will be preserved.
1.1 dsieger 3905:
1.184 rillig 3906: INSTALLATION_DIRS
1.1 dsieger 3907:
1.184 rillig 3908: A list of directories relative to PREFIX that are created by pkgsrc at the
3909: beginning of the install phase. The package is supposed to create all
3910: needed directories itself before installing files to it and list all other
3911: directories here.
1.1 dsieger 3912:
1.184 rillig 3913: In the rare cases that a package shouldn't install anything, set NO_INSTALL to
3914: "yes". This is mostly relevant for packages in the regress category.
1.1 dsieger 3915:
1.184 rillig 3916: 13.15. The package phase
1.121 sevan 3917:
1.184 rillig 3918: Once the install stage has completed, a binary package of the installed files
3919: can be built. These binary packages can be used for quick installation without
3920: previous compilation, e.g. by the make bin-install or by using pkg_add.
1.1 dsieger 3921:
1.184 rillig 3922: By default, the binary packages are created in ${PACKAGES}/All and symlinks are
3923: created in ${PACKAGES}/category, one for each category in the CATEGORIES
3924: variable. PACKAGES defaults to pkgsrc/packages.
1.1 dsieger 3925:
1.184 rillig 3926: 13.16. Cleaning up
1.1 dsieger 3927:
1.184 rillig 3928: Once you're finished with a package, you can clean the work directory by
3929: running make clean. If you want to clean the work directories of all
3930: dependencies too, use make clean-depends.
1.1 dsieger 3931:
1.184 rillig 3932: 13.17. Other helpful targets
1.1 dsieger 3933:
1.184 rillig 3934: pre/post-*
1.1 dsieger 3935:
1.184 rillig 3936: For any of the main targets described in the previous section (configure,
3937: build, install, etc.), two auxiliary targets exist with "pre-" and "post-"
3938: used as a prefix for the main target's name. These targets are invoked
3939: before and after the main target is called, allowing extra configuration or
3940: installation steps be performed from a package's Makefile, for example,
3941: which a program's configure script or install target omitted.
3942:
3943: About 5% of the pkgsrc packages define their custom post-extract target,
3944: another 5% define pre-configure, and 10% define post-install. The other pre
3945: /post-* targets are defined even less often.
1.1 dsieger 3946:
1.184 rillig 3947: do-*
1.182 leot 3948:
1.184 rillig 3949: Should one of the main targets do the wrong thing, and should there be no
3950: variable to fix this, you can redefine it with the do-* target. (Note that
3951: redefining the target itself instead of the do-* target is a bad idea, as
3952: the pre-* and post-* targets won't be called anymore, etc.)
1.1 dsieger 3953:
1.184 rillig 3954: About 15% of the pkgsrc packages override the default do-install, the other
3955: do-* targets are overridden even less often.
1.1 dsieger 3956:
1.184 rillig 3957: reinstall
1.1 dsieger 3958:
1.184 rillig 3959: If you did a make install and you noticed some file was not installed
3960: properly, you can repeat the installation with this target, which will
3961: ignore the "already installed" flag.
1.1 dsieger 3962:
1.184 rillig 3963: This is the default value of DEPENDS_TARGET except in the case of make
3964: update and make package, where the defaults are "package" and "update",
3965: respectively.
1.1 dsieger 3966:
1.184 rillig 3967: deinstall
1.1 dsieger 3968:
1.184 rillig 3969: This target does a pkg_delete(1) in the current directory, effectively
3970: de-installing the package. The following variables can be used to tune the
3971: behaviour:
1.1 dsieger 3972:
1.184 rillig 3973: PKG_VERBOSE
1.1 dsieger 3974:
1.184 rillig 3975: Add a "-v" to the pkg_delete(1) command.
1.1 dsieger 3976:
1.184 rillig 3977: DEINSTALLDEPENDS
1.1 dsieger 3978:
1.184 rillig 3979: Remove all packages that require (depend on) the given package. This
3980: can be used to remove any packages that may have been pulled in by a
3981: given package, e.g. if make deinstall DEINSTALLDEPENDS=1 is done in
3982: pkgsrc/x11/kde, this is likely to remove whole KDE. Works by adding "-R
3983: " to the pkg_delete(1) command line.
1.1 dsieger 3984:
1.184 rillig 3985: bin-install
1.1 dsieger 3986:
1.184 rillig 3987: Install a binary package from local disk and via FTP from a list of sites
3988: (see the BINPKG_SITES variable), and do a make package if no binary package
3989: is available anywhere. The arguments given to pkg_add can be set via
3990: BIN_INSTALL_FLAGS e.g., to do verbose operation, etc.
1.1 dsieger 3991:
1.184 rillig 3992: install-clean
1.1 dsieger 3993:
1.184 rillig 3994: This target removes the state files for the "install" and later phases so
3995: that the "install" target may be re-invoked. This can be used after editing
3996: the PLIST to install the package without rebuilding it.
1.1 dsieger 3997:
1.184 rillig 3998: build-clean
1.18 mishka 3999:
1.184 rillig 4000: This target removes the state files for the "build" and later phases so
4001: that the "build" target may be re-invoked.
1.18 mishka 4002:
1.184 rillig 4003: update
1.18 mishka 4004:
1.184 rillig 4005: This target causes the current package to be updated to the latest version.
4006: The package and all depending packages first get de-installed, then current
4007: versions of the corresponding packages get compiled and installed. This is
4008: similar to manually noting which packages are currently installed, then
4009: performing a series of make deinstall and make install (or whatever
4010: UPDATE_TARGET is set to) for these packages.
1.18 mishka 4011:
1.184 rillig 4012: You can use the "update" target to resume package updating in case a
4013: previous make update was interrupted for some reason. However, in this
4014: case, make sure you don't call make clean or otherwise remove the list of
4015: dependent packages in WRKDIR. Otherwise, you lose the ability to
4016: automatically update the current package along with the dependent packages
4017: you have installed.
1.121 sevan 4018:
1.184 rillig 4019: Resuming an interrupted make update will only work as long as the package
4020: tree remains unchanged. If the source code for one of the packages to be
4021: updated has been changed, resuming make update will most certainly fail!
1.1 dsieger 4022:
1.184 rillig 4023: The following variables can be used either on the command line or in
4024: mk.conf to alter the behaviour of make update:
1.1 dsieger 4025:
1.184 rillig 4026: UPDATE_TARGET
1.1 dsieger 4027:
1.184 rillig 4028: Install target to recursively use for the updated package and the
4029: dependent packages. Defaults to DEPENDS_TARGET if set, "install"
4030: otherwise for make update. Other good targets are "package" or "
4031: bin-install". Do not set this to "update" or you will get stuck in an
4032: endless loop!
1.1 dsieger 4033:
1.184 rillig 4034: NOCLEAN
1.1 dsieger 4035:
1.184 rillig 4036: Don't clean up after updating. Useful if you want to leave the work
4037: sources of the updated packages around for inspection or other
4038: purposes. Be sure you eventually clean up the source tree (see the "
4039: clean-update" target below) or you may run into troubles with old
4040: source code still lying around on your next make or make update.
1.1 dsieger 4041:
1.184 rillig 4042: REINSTALL
1.1 dsieger 4043:
1.184 rillig 4044: Deinstall each package before installing (making DEPENDS_TARGET). This
4045: may be necessary if the "clean-update" target (see below) was called
4046: after interrupting a running make update.
1.1 dsieger 4047:
1.184 rillig 4048: DEPENDS_TARGET
1.1 dsieger 4049:
1.184 rillig 4050: Allows you to disable recursion and hardcode the target for packages.
4051: The default is "update" for the update target, facilitating a recursive
4052: update of prerequisite packages. Only set DEPENDS_TARGET if you want to
4053: disable recursive updates. Use UPDATE_TARGET instead to just set a
4054: specific target for each package to be installed during make update
4055: (see above).
1.1 dsieger 4056:
1.184 rillig 4057: clean-update
1.1 dsieger 4058:
1.184 rillig 4059: Clean the source tree for all packages that would get updated if make
4060: update was called from the current directory. This target should not be
4061: used if the current package (or any of its depending packages) have already
4062: been de-installed (e.g., after calling make update) or you may lose some
4063: packages you intended to update. As a rule of thumb: only use this target
4064: before the first time you run make update and only if you have a dirty
4065: package tree (e.g., if you used NOCLEAN).
1.86 wiz 4066:
1.184 rillig 4067: If you are unsure about whether your tree is clean, you can either perform
4068: a make clean at the top of the tree, or use the following sequence of
4069: commands from the directory of the package you want to update (before
4070: running make update for the first time, otherwise you lose all the packages
4071: you wanted to update!):
1.86 wiz 4072:
1.184 rillig 4073: # make clean-update
4074: # make clean CLEANDEPENDS=YES
4075: # make update
1.86 wiz 4076:
4077:
1.184 rillig 4078: The following variables can be used either on the command line or in
4079: mk.conf to alter the behaviour of make clean-update:
1.86 wiz 4080:
1.184 rillig 4081: CLEAR_DIRLIST
1.86 wiz 4082:
1.184 rillig 4083: After make clean, do not reconstruct the list of directories to update
4084: for this package. Only use this if make update successfully installed
4085: all packages you wanted to update. Normally, this is done automatically
4086: on make update, but may have been suppressed by the NOCLEAN variable
4087: (see above).
1.1 dsieger 4088:
1.184 rillig 4089: replace
1.1 dsieger 4090:
1.184 rillig 4091: Update the installation of the current package. This differs from update in
4092: that it does not replace dependent packages. You will need to install
4093: pkgtools/pkg_tarup for this target to work.
1.1 dsieger 4094:
1.184 rillig 4095: Be careful when using this target! There are no guarantees that dependent
4096: packages will still work, in particular they will most certainly break if
4097: you make replace a library package whose shared library major version
4098: changed between your installed version and the new one. For this reason,
4099: this target is not officially supported and only recommended for advanced
4100: users.
1.1 dsieger 4101:
1.184 rillig 4102: info
1.1 dsieger 4103:
1.184 rillig 4104: This target invokes pkg_info(1) for the current package. You can use this
4105: to check which version of a package is installed.
1.86 wiz 4106:
1.184 rillig 4107: index
1.1 dsieger 4108:
1.184 rillig 4109: This is a top-level command, i.e. it should be used in the pkgsrc
4110: directory. It creates a database of all packages in the local pkgsrc tree,
4111: including dependencies, comment, maintainer, and some other useful
4112: information. Individual entries are created by running make describe in the
4113: packages' directories. This index file is saved as pkgsrc/INDEX. It can be
4114: displayed in verbose format by running make print-index. You can search in
4115: it with make search key=something. You can extract a list of all packages
4116: that depend on a particular one by running make show-deps PKG=somepackage.
1.1 dsieger 4117:
1.184 rillig 4118: Running this command takes a very long time, some hours even on fast
4119: machines!
1.1 dsieger 4120:
1.184 rillig 4121: readme
1.1 dsieger 4122:
1.199 nia 4123: This target generates a index.html file, which can be viewed using a
1.184 rillig 4124: browser such as www/firefox or www/links. The generated files contain
4125: references to any packages which are in the PACKAGES directory on the local
4126: host. The generated files can be made to refer to URLs based on
4127: FTP_PKG_URL_HOST and FTP_PKG_URL_DIR. For example, if I wanted to generate
1.199 nia 4128: index.html files which pointed to binary packages on the local machine, in
1.184 rillig 4129: the directory /usr/packages, set FTP_PKG_URL_HOST=file://localhost and
4130: FTP_PKG_URL_DIR=/usr/packages. The ${PACKAGES} directory and its
4131: subdirectories will be searched for all the binary packages.
1.1 dsieger 4132:
1.184 rillig 4133: The target can be run at the toplevel or in category directories, in which
4134: case it descends recursively.
1.1 dsieger 4135:
1.184 rillig 4136: readme-all
1.1 dsieger 4137:
1.184 rillig 4138: This is a top-level command, run it in pkgsrc. Use this target to create a
4139: file README-all.html which contains a list of all packages currently
4140: available in the NetBSD Packages Collection, together with the category
4141: they belong to and a short description. This file is compiled from the
1.199 nia 4142: pkgsrc/*/index.html files, so be sure to run this after a make readme.
1.1 dsieger 4143:
1.184 rillig 4144: cdrom-readme
1.1 dsieger 4145:
1.184 rillig 4146: This is very much the same as the "readme" target (see above), but is to be
4147: used when generating a pkgsrc tree to be written to a CD-ROM. This target
1.199 nia 4148: also produces index.html files, and can be made to refer to URLs based on
1.184 rillig 4149: CDROM_PKG_URL_HOST and CDROM_PKG_URL_DIR.
1.1 dsieger 4150:
1.184 rillig 4151: show-distfiles
1.1 dsieger 4152:
1.184 rillig 4153: This target shows which distfiles and patchfiles are needed to build the
4154: package (ALLFILES, which contains all DISTFILES and PATCHFILES, but not
4155: patches/*).
1.1 dsieger 4156:
1.184 rillig 4157: show-downlevel
1.1 dsieger 4158:
1.184 rillig 4159: This target shows nothing if the package is not installed. If a version of
4160: this package is installed, but is not the version provided in this version
4161: of pkgsrc, then a warning message is displayed. This target can be used to
4162: show which of your installed packages are downlevel, and so the old
4163: versions can be deleted, and the current ones added.
1.1 dsieger 4164:
1.184 rillig 4165: show-pkgsrc-dir
1.1 dsieger 4166:
1.184 rillig 4167: This target shows the directory in the pkgsrc hierarchy from which the
4168: package can be built and installed. This may not be the same directory as
4169: the one from which the package was installed. This target is intended to be
4170: used by people who may wish to upgrade many packages on a single host, and
4171: can be invoked from the top-level pkgsrc Makefile by using the "
4172: show-host-specific-pkgs" target.
1.1 dsieger 4173:
1.184 rillig 4174: show-installed-depends
1.1 dsieger 4175:
1.184 rillig 4176: This target shows which installed packages match the current package's
4177: DEPENDS. Useful if out of date dependencies are causing build problems.
1.1 dsieger 4178:
1.184 rillig 4179: print-build-depends-list
1.1 dsieger 4180:
1.184 rillig 4181: This target shows the list of packages that the current package depends on
4182: for building.
1.1 dsieger 4183:
1.184 rillig 4184: print-run-depends-list
1.1 dsieger 4185:
1.184 rillig 4186: This target shows the list of packages that the current package depends on
4187: for running.
1.1 dsieger 4188:
1.184 rillig 4189: check-shlibs
1.1 dsieger 4190:
1.184 rillig 4191: After a package is installed, check all its binaries and (on ELF platforms)
4192: shared libraries to see if they find the shared libs they need. Run by
4193: default if PKG_DEVELOPER is set in mk.conf.
1.1 dsieger 4194:
1.184 rillig 4195: print-PLIST
1.1 dsieger 4196:
1.184 rillig 4197: After a "make install" from a new or upgraded pkg, this prints out an
4198: attempt to generate a new PLIST from a find -newer work/.extract_done. An
4199: attempt is made to care for shared libs etc., but it is strongly
4200: recommended to review the result before putting it into PLIST. On upgrades,
4201: it's useful to diff the output of this command against an already existing
4202: PLIST file.
1.1 dsieger 4203:
1.184 rillig 4204: If the package installs files via tar(1) or other methods that don't update
4205: file access times, be sure to add these files manually to your PLIST, as
4206: the "find -newer" command used by this target won't catch them!
1.56 ryoon 4207:
1.184 rillig 4208: See Section 19.3, "Tweaking output of make print-PLIST" for more
4209: information on this target.
1.1 dsieger 4210:
1.184 rillig 4211: Chapter 14. Creating a new pkgsrc package from scratch
1.1 dsieger 4212:
1.184 rillig 4213: Table of Contents
1.1 dsieger 4214:
1.184 rillig 4215: 14.1. Common types of packages
1.1 dsieger 4216:
1.219 nia 4217: 14.1.1. Python modules and programs
4218: 14.1.2. R packages
4219: 14.1.3. TeXlive packages
1.1 dsieger 4220:
1.184 rillig 4221: 14.2. Examples
1.1 dsieger 4222:
1.184 rillig 4223: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 4224:
1.184 rillig 4225: When you find a package that is not yet in pkgsrc, you most likely have a URL
4226: from where you can download the source code. Starting with this URL, creating a
4227: package involves only a few steps.
1.1 dsieger 4228:
1.184 rillig 4229: 1. In your mk.conf, set PKG_DEVELOPER=yes to enable the basic quality checks.
1.1 dsieger 4230:
1.184 rillig 4231: 2. Install the package meta-pkgs/pkg_developer, which among others will
4232: install the utilities url2pkg, pkglint, pkgvi and mkpatches:
1.1 dsieger 4233:
1.184 rillig 4234: $ cd /usr/pkgsrc
4235: $ (cd meta-pkgs/pkg_developer && bmake update)
1.1 dsieger 4236:
1.184 rillig 4237: 3. Choose one of the top-level directories as the category in which you want
4238: to place your package. You can also create a directory of your own (maybe
1.219 nia 4239: called local). Change into that category directory:
1.1 dsieger 4240:
1.219 nia 4241: $ cd category
1.1 dsieger 4242:
1.219 nia 4243: 4. Run the program url2pkg, passing as argument the URL of the distribution
4244: file (in most cases a .tar.gz file). This will download the distribution
4245: file and create the necessary files of the package, based on what's in the
4246: distribution file:
1.1 dsieger 4247:
1.184 rillig 4248: $ url2pkg https://www.example.org/packages/package-1.0.tar.gz
1.1 dsieger 4249:
1.184 rillig 4250: 5. Examine the extracted files to determine the dependencies of your package.
4251: Ideally, this is mentioned in some README file, but things may differ. For
4252: each of these dependencies, look where it exists in pkgsrc, and if there is
4253: a file called buildlink3.mk in that directory, add a line to your package
4254: Makefile which includes that file just before the last line. If the
4255: buildlink3.mk file does not exist, it must be created first. The
4256: buildlink3.mk file makes sure that the package's include files and
4257: libraries are provided.
1.1 dsieger 4258:
1.219 nia 4259: If you just need binaries from a dependent package, add a DEPENDS line to
4260: the Makefile, which specifies the version of the dependency and where it
4261: can be found in pkgsrc. This line should be placed in the third paragraph.
4262: If the dependency is only needed for building the package, but not when
4263: using it, use TOOL_DEPENDS or BUILD_DEPENDS instead of DEPENDS. The
4264: difference between TOOL_DEPENDS and BUILD_DEPENDS occurs when
4265: cross-compiling: TOOL_DEPENDS are native packages, i.e. packages for the
4266: platform where the package is built; BUILD_DEPENDS are target packages,
4267: i.e. packages for the platform for which the package is built. There is
4268: also TEST_DEPENDS, which specifies a dependency used only for testing the
4269: resulting package built, using the upstream project's included test suite,
4270: on the native platform. Your package may then look like this:
1.1 dsieger 4271:
1.184 rillig 4272: [...]
1.1 dsieger 4273:
1.184 rillig 4274: TOOL_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt
4275: DEPENDS+= screen-[0-9]*:../../misc/screen
4276: DEPENDS+= screen>=4.0:../../misc/screen
1.1 dsieger 4277:
1.184 rillig 4278: [...]
1.1 dsieger 4279:
1.184 rillig 4280: .include "../../category/package/buildlink3.mk"
4281: .include "../../devel/glib2/buildlink3.mk"
4282: .include "../../mk/bsd.pkg.mk"
1.1 dsieger 4283:
1.184 rillig 4284: 6. Run pkglint to see what things still need to be done to make your package a
4285: "good" one. If you don't know what pkglint's warnings want to tell you, try
4286: pkglint --explain or pkglint -e, which outputs additional explanations.
1.1 dsieger 4287:
1.184 rillig 4288: 7. In many cases the package is not yet ready to build. You can find
4289: instructions for the most common cases in the next section, Section 14.1,
4290: "Common types of packages". After you have followed the instructions over
4291: there, you can hopefully continue here.
1.1 dsieger 4292:
1.184 rillig 4293: 8. Run bmake clean to clean the working directory from the extracted files.
1.219 nia 4294: Besides these files, a lot of cache files and other system information have
4295: been saved in the working directory, which may have become outdated after
4296: you edited the Makefile.
1.1 dsieger 4297:
1.184 rillig 4298: 9. Now, run bmake to build the package. For the various things that can go
4299: wrong in this phase, consult Chapter 21, Making your package work.
1.1 dsieger 4300:
1.184 rillig 4301: If the extracted files from the package need to be fixed, run multiple
4302: rounds of these commands:
1.1 dsieger 4303:
1.219 nia 4304: $ bmake
1.184 rillig 4305: $ pkgvi ${WRKSRC}/some/file/that/does/not/compile
4306: $ mkpatches
1.219 nia 4307: $ bmake mps
4308: $ bmake clean
1.1 dsieger 4309:
1.184 rillig 4310: 10. When the package builds fine, the next step is to install the package. Run
4311: bmake install and hope that everything works.
1.1 dsieger 4312:
1.184 rillig 4313: 11. Up to now, the file PLIST, which contains a list of the files that are
4314: installed by the package, is nearly empty. Run bmake print-PLIST >PLIST to
4315: generate a probably correct list. Check the file using your preferred text
4316: editor to see if the list of files looks plausible.
1.1 dsieger 4317:
1.184 rillig 4318: 12. Run pkglint again to see if the generated PLIST contains garbage or not.
1.1 dsieger 4319:
1.184 rillig 4320: 13. When you ran bmake install, the package had been registered in the database
4321: of installed files, but with an empty list of files. To fix this, run bmake
4322: deinstall and bmake install again. Now the package is registered with the
4323: list of files from PLIST.
1.48 wiz 4324:
1.219 nia 4325: 14. Run bmake clean update to run everything from above again in a single step,
1.184 rillig 4326: making sure that the PLIST is correct and the whole package is created as
4327: intended.
1.48 wiz 4328:
1.219 nia 4329: 15. Run pkglint to see if there's anything left to do.
1.48 wiz 4330:
1.219 nia 4331: 16. Commit the package to pkgsrc-wip or main pkgsrc; see Chapter 23, Submitting
1.184 rillig 4332: and Committing.
1.50 wiz 4333:
1.184 rillig 4334: 14.1. Common types of packages
1.1 dsieger 4335:
1.219 nia 4336: 14.1.1. Python modules and programs
1.1 dsieger 4337:
1.184 rillig 4338: Python modules and programs packages are easily created using a set of
4339: predefined variables.
1.1 dsieger 4340:
1.184 rillig 4341: If some Python versions are not supported by the software, set the
4342: PYTHON_VERSIONS_INCOMPATIBLE variable to the Python versions that are not
4343: supported, e.g.
1.1 dsieger 4344:
1.184 rillig 4345: PYTHON_VERSIONS_INCOMPATIBLE= 27
1.1 dsieger 4346:
1.184 rillig 4347: If the packaged software is a Python module, include one of ../../lang/python/
1.215 wiz 4348: egg.mk or ../../lang/python/extension.mk.
1.1 dsieger 4349:
1.215 wiz 4350: Most Python packages use setuptools ("eggs"). If the packaged software is using
4351: setuptools, you only need to include "../../lang/python/egg.mk".
1.1 dsieger 4352:
1.184 rillig 4353: Either way, the package directory should be called "py-software" and PKGNAME
4354: should be set to "${PYPKGPREFIX}-${DISTNAME}", e.g.
1.1 dsieger 4355:
1.184 rillig 4356: DISTNAME= foopymodule-1.2.10
4357: PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
1.1 dsieger 4358:
1.184 rillig 4359: If it is an application, include "../../lang/python/application.mk". In order
4360: to correctly set the path to the Python interpreter, use the REPLACE_PYTHON
4361: variable and set it to the list of files (paths relative to WRKSRC) that must
4362: be corrected. For example:
1.1 dsieger 4363:
1.184 rillig 4364: REPLACE_PYTHON= *.py
1.1 dsieger 4365:
1.184 rillig 4366: Some Python modules have separate distributions for Python-2.x and Python-3.x
4367: support. In pkgsrc this is handled by the versioned_dependencies.mk file. Set
4368: PYTHON_VERSIONED_DEPENDENCIES to the list of packages that should be depended
4369: upon and include "../../lang/python/versioned_dependencies.mk", then the pkgsrc
4370: infrastructure will depend on the appropriate package version. For example:
1.1 dsieger 4371:
1.184 rillig 4372: PYTHON_VERSIONED_DEPENDENCIES=dialog
1.1 dsieger 4373:
1.184 rillig 4374: Look inside versioned_dependencies.mk for a list of supported packages.
1.1 dsieger 4375:
1.219 nia 4376: 14.1.2. R packages
1.1 dsieger 4377:
1.184 rillig 4378: Simple R packages from CRAN are handled automatically by R2pkg, which is
4379: available in pkgtools/R2pkg. Individual packages (and optionally their
4380: dependencies) may be created and updated. R packages generally follow the same
4381: form, and most of the relevant information needed is contained in a DESCRIPTION
4382: file as part of each R package on CRAN. Consequently, R2pkg downloads that
4383: information and creates or updates a package in the canonical form. The
4384: resulting package should be reviewed for correctness.
1.1 dsieger 4385:
1.219 nia 4386: 14.1.3. TeXlive packages
1.1 dsieger 4387:
1.184 rillig 4388: TeXlive packages from CTAN are handled automatically by texlive2pkg, which is
4389: available in pkgtools/texlive2pkg.
1.1 dsieger 4390:
1.184 rillig 4391: If the TeXlive package name is not known, it may be useful to search CTAN. A "
4392: Contained in" field on the package page typically identifies the basename of
4393: the package file in the TeXlive archive.
1.1 dsieger 4394:
1.184 rillig 4395: If the TeXlive package name is known, download the files from the TeXlive
4396: archive. For package foo, you will need to download foo.tar.xz. Most TeXlive
4397: packages also have associated documentation packages, so download
4398: foo.doc.tar.xz at the same time. These files should be placed in the
4399: appropriate category directory, which is often but not always print. Then run
4400: the following command in the category directory.
1.1 dsieger 4401:
1.184 rillig 4402: texlive2pkg foo.tar.xz foo.doc.tar.xz
1.1 dsieger 4403:
1.184 rillig 4404: This will create two packages, tex-foo and tex-foo-doc. Be sure to check that
4405: both packages are correct.
1.1 dsieger 4406:
1.184 rillig 4407: Finally, CTAN currently does not include version information in package
4408: filenames and changes their contents periodically when updates occur.
4409: Consequently, pkgsrc avoids downloading distfiles directly from CTAN and
4410: instead relies on the pkgsrc archives. For each new or updated TeXlive package,
4411: e.g., the main one and the corresponding documentation, upload the distfiles
4412: with the following command in each package directory.
1.1 dsieger 4413:
1.184 rillig 4414: make upload-distfiles
1.117 sevan 4415:
1.184 rillig 4416: 14.2. Examples
1.117 sevan 4417:
1.184 rillig 4418: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 4419:
1.184 rillig 4420: 14.2.1.1. The initial package
1.1 dsieger 4421:
1.184 rillig 4422: Looking at the file pkgsrc/doc/TODO, I saw that the "nvu" package has not yet
4423: been imported into pkgsrc. As the description says it has to do with the web,
4424: the obvious choice for the category is "www".
1.1 dsieger 4425:
1.184 rillig 4426: $ mkdir www/nvu
4427: $ cd www/nvu
1.1 dsieger 4428:
1.184 rillig 4429: The web site says that the sources are available as a tar file, so I fed that
4430: URL to the url2pkg program:
1.1 dsieger 4431:
1.184 rillig 4432: $ url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
1.1 dsieger 4433:
1.184 rillig 4434: My editor popped up, and I added a PKGNAME line below the DISTNAME line, as the
4435: package name should not have the word "sources" in it. I also filled in the
4436: MAINTAINER, HOMEPAGE and COMMENT fields. Then the package Makefile looked like
4437: that:
1.1 dsieger 4438:
1.184 rillig 4439: # $NetBSD $
4440: #
1.1 dsieger 4441:
1.184 rillig 4442: DISTNAME= nvu-1.0-sources
4443: PKGNAME= nvu-1.0
4444: CATEGORIES= www
4445: MASTER_SITES= http://cvs.nvu.com/download/
4446: EXTRACT_SUFX= .tar.bz2
1.1 dsieger 4447:
1.184 rillig 4448: MAINTAINER= rillig@NetBSD.org
4449: HOMEPAGE= http://cvs.nvu.com/
4450: COMMENT= Web Authoring System
1.1 dsieger 4451:
1.184 rillig 4452: # url2pkg-marker (please do not remove this line.)
4453: .include "../../mk/bsd.pkg.mk"
1.1 dsieger 4454:
1.184 rillig 4455: On the first line of output above, an artificial space has been added between
4456: NetBSD and $, this is a workaround to prevent CVS expanding to the filename of
4457: the guide.
1.1 dsieger 4458:
1.184 rillig 4459: Then, I quit the editor and watched pkgsrc downloading a large source archive:
1.1 dsieger 4460:
1.184 rillig 4461: url2pkg> Running "make makesum" ...
4462: => Required installed package digest>=20010302: digest-20060826 found
4463: => Fetching nvu-1.0-sources.tar.bz2
4464: Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
4465: 100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA
4466: 29687976 bytes retrieved in 03:12 (150.77 KB/s)
4467: url2pkg> Running "make extract" ...
4468: => Required installed package digest>=20010302: digest-20060826 found
4469: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
4470: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
4471: work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc
4472: ===> Installing dependencies for nvu-1.0
4473: ===> Overriding tools for nvu-1.0
4474: ===> Extracting for nvu-1.0
4475: url2pkg> Adjusting the Makefile.
1.1 dsieger 4476:
1.184 rillig 4477: Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
1.1 dsieger 4478:
1.184 rillig 4479: Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
1.1 dsieger 4480:
1.184 rillig 4481: 14.2.1.2. Fixing all kinds of problems to make the package work
1.1 dsieger 4482:
1.184 rillig 4483: Now that the package has been extracted, let's see what's inside it. The
4484: package has a README.txt, but that only says something about mozilla, so it's
4485: probably useless for seeing what dependencies this package has. But since there
4486: is a GNU configure script in the package, let's hope that it will complain
4487: about everything it needs.
1.1 dsieger 4488:
1.184 rillig 4489: $ bmake
4490: => Required installed package digest>=20010302: digest-20060826 found
4491: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
4492: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
4493: ===> Patching for nvu-1.0
4494: ===> Creating toolchain wrappers for nvu-1.0
4495: ===> Configuring for nvu-1.0
4496: [...]
4497: configure: error: Perl 5.004 or higher is required.
4498: [...]
4499: WARNING: Please add USE_TOOLS+=perl to the package Makefile.
4500: [...]
1.1 dsieger 4501:
1.184 rillig 4502: That worked quite well. So I opened the package Makefile in my editor, and
4503: since it already has a USE_TOOLS line, I just appended "perl" to it. Since the
4504: dependencies of the package have changed now, and since a perl wrapper is
4505: automatically installed in the "tools" phase, I need to build the package from
4506: scratch.
1.1 dsieger 4507:
1.184 rillig 4508: $ bmake clean
4509: ===> Cleaning for nvu-1.0
4510: $ bmake
4511: [...]
4512: *** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
4513: GNU Make. You will not be able to build Mozilla without GNU Make.
4514: [...]
1.1 dsieger 4515:
1.184 rillig 4516: So I added "gmake" to the USE_TOOLS line and tried again (from scratch).
1.1 dsieger 4517:
1.184 rillig 4518: [...]
4519: checking for GTK - version >= 1.2.0... no
4520: *** Could not run GTK test program, checking why...
4521: [...]
1.1 dsieger 4522:
1.184 rillig 4523: Now to the other dependencies. The first question is: Where is the GTK package
4524: hidden in pkgsrc?
1.1 dsieger 4525:
1.184 rillig 4526: $ echo ../../*/gtk*
4527: [many packages ...]
4528: $ echo ../../*/gtk
4529: ../../x11/gtk
4530: $ echo ../../*/gtk2
4531: ../../x11/gtk2
4532: $ echo ../../*/gtk2/bui*
4533: ../../x11/gtk2/buildlink3.mk
1.1 dsieger 4534:
1.184 rillig 4535: The first try was definitely too broad. The second one had exactly one result,
4536: which is very good. But there is one pitfall with GNOME packages. Before GNOME
4537: 2 had been released, there were already many GNOME 1 packages in pkgsrc. To be
4538: able to continue to use these packages, the GNOME 2 packages were imported as
4539: separate packages, and their names usually have a "2" appended. So I checked
4540: whether this was the case here, and indeed it was.
1.1 dsieger 4541:
1.184 rillig 4542: Since the GTK2 package has a buildlink3.mk file, adding the dependency is very
4543: easy. I just inserted an .include line before the last line of the package
4544: Makefile, so that it now looks like this:
1.1 dsieger 4545:
1.184 rillig 4546: [...]
4547: .include "../../x11/gtk2/buildlink3.mk"
4548: .include "../../mk/bsd.pkg.mk
1.1 dsieger 4549:
1.184 rillig 4550: After another bmake clean && bmake, the answer was:
1.108 rillig 4551:
1.184 rillig 4552: [...]
4553: checking for gtk-config... /home/roland/pkg/bin/gtk-config
4554: checking for GTK - version >= 1.2.0... no
4555: *** Could not run GTK test program, checking why...
4556: *** The test program failed to compile or link. See the file config.log for the
4557: *** exact error that occured. This usually means GTK was incorrectly installed
4558: *** or that you have moved GTK since it was installed. In the latter case, you
4559: *** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
4560: configure: error: Test for GTK failed.
4561: [...]
1.1 dsieger 4562:
1.184 rillig 4563: In this particular case, the assumption that "every package prefers GNOME 2"
4564: had been wrong. The first of the lines above told me that this package really
4565: wanted to have the GNOME 1 version of GTK. If the package had looked for GTK2,
4566: it would have looked for pkg-config instead of gtk-config. So I changed the x11
4567: /gtk2 to x11/gtk in the package Makefile, and tried again.
1.1 dsieger 4568:
1.184 rillig 4569: [...]
4570: cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...]
4571: In file included from xpidl.c:42:
4572: xpidl.h:53:24: libIDL/IDL.h: No such file or directory
4573: In file included from xpidl.c:42:
4574: xpidl.h:132: error: parse error before "IDL_ns"
4575: [...]
1.1 dsieger 4576:
1.184 rillig 4577: The package still does not find all of its dependencies. Now the question is:
4578: Which package provides the libIDL/IDL.h header file?
1.1 dsieger 4579:
1.184 rillig 4580: $ echo ../../*/*idl*
4581: ../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
4582: $ echo ../../*/*IDL*
4583: ../../net/libIDL
1.1 dsieger 4584:
1.184 rillig 4585: Let's take the one from the second try. So I included the ../../net/libIDL/
4586: buildlink3.mk file and tried again. But the error didn't change. After digging
4587: through some of the code, I concluded that the build process of the package was
4588: broken and couldn't have ever worked, but since the Mozilla source tree is
4589: quite large, I didn't want to fix it. So I added the following to the package
4590: Makefile and tried again:
1.1 dsieger 4591:
1.184 rillig 4592: CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
4593: BUILDLINK_TRANSFORM+= l:IDL:IDL-2
1.1 dsieger 4594:
1.184 rillig 4595: The latter line is needed because the package expects the library libIDL.so,
4596: but only libIDL-2.so is available. So I told the compiler wrapper to rewrite
4597: that on the fly.
1.1 dsieger 4598:
1.184 rillig 4599: The next problem was related to a recent change of the FreeType interface. I
4600: looked up in www/seamonkey which patch files were relevant for this issue and
4601: copied them to the patches directory. Then I retried, fixed the patches so that
4602: they applied cleanly and retried again. This time, everything worked.
1.1 dsieger 4603:
1.184 rillig 4604: 14.2.1.3. Installing the package
1.1 dsieger 4605:
1.184 rillig 4606: $ bmake CHECK_FILES=no install
4607: [...]
4608: $ bmake print-PLIST >PLIST
4609: $ bmake deinstall
4610: $ bmake install
1.1 dsieger 4611:
1.184 rillig 4612: Chapter 15. Programming in Makefiles
1.1 dsieger 4613:
1.184 rillig 4614: Table of Contents
1.1 dsieger 4615:
1.184 rillig 4616: 15.1. Caveats
4617: 15.2. Makefile variables
1.1 dsieger 4618:
1.184 rillig 4619: 15.2.1. Naming conventions
1.1 dsieger 4620:
1.184 rillig 4621: 15.3. Code snippets
1.1 dsieger 4622:
1.184 rillig 4623: 15.3.1. Adding things to a list
4624: 15.3.2. Echoing a string exactly as-is
4625: 15.3.3. Passing CFLAGS to GNU configure scripts
4626: 15.3.4. Handling possibly empty variables
1.1 dsieger 4627:
1.184 rillig 4628: Pkgsrc consists of many Makefile fragments, each of which forms a well-defined
4629: part of the pkgsrc system. Using the make(1) system as a programming language
4630: for a big system like pkgsrc requires some discipline to keep the code correct
4631: and understandable.
1.1 dsieger 4632:
1.184 rillig 4633: The basic ingredients for Makefile programming are variables and shell
4634: commands. Among these shell commands may even be more complex ones like awk(1)
4635: programs. To make sure that every shell command runs as intended it is
4636: necessary to quote all variables correctly when they are used.
1.1 dsieger 4637:
1.184 rillig 4638: This chapter describes some patterns that appear quite often in Makefiles,
4639: including the pitfalls that come along with them.
1.1 dsieger 4640:
1.184 rillig 4641: 15.1. Caveats
1.1 dsieger 4642:
1.184 rillig 4643: * When you are creating a file as a target of a rule, always write the data
4644: to a temporary file first and finally rename that file. Otherwise there
4645: might occur an error in the middle of generating the file, and when the
4646: user runs make(1) for the second time, the file exists and will not be
4647: regenerated properly. Example:
1.1 dsieger 4648:
1.184 rillig 4649: wrong:
4650: @echo "line 1" > ${.TARGET}
4651: @echo "line 2" >> ${.TARGET}
4652: @false
1.1 dsieger 4653:
1.184 rillig 4654: correct:
4655: @echo "line 1" > ${.TARGET}.tmp
4656: @echo "line 2" >> ${.TARGET}.tmp
4657: @false
4658: @mv ${.TARGET}.tmp ${.TARGET}
1.1 dsieger 4659:
1.184 rillig 4660: When you run make wrong twice, the file wrong will exist, although there
4661: was an error message in the first run. On the other hand, running make
4662: correct gives an error message twice, as expected.
1.1 dsieger 4663:
1.184 rillig 4664: You might remember that make(1) sometimes removes ${.TARGET} in case of
4665: error, but this only happens when it is interrupted, for example by
4666: pressing Ctrl+C. This does not happen when one of the commands fails (like
4667: false(1) above).
1.1 dsieger 4668:
1.184 rillig 4669: 15.2. Makefile variables
1.1 dsieger 4670:
1.184 rillig 4671: Makefile variables contain strings that can be processed using the five
4672: operators =, +=, ?=, := and !=, which are described in the make(1) man page.
1.1 dsieger 4673:
1.184 rillig 4674: When a variable's value is parsed from a Makefile, the hash character # and the
4675: backslash character \ are handled specially. If a backslash is the last
4676: character in a line, that backslash is removed from the line and the line
4677: continues with the next line of the file.
1.1 dsieger 4678:
1.184 rillig 4679: The # character starts a comment that reaches until the end of the line. To get
4680: an actual # character, such as in a URL, write \# instead.
1.1 dsieger 4681:
1.184 rillig 4682: The evaluation of variables either happens immediately or lazy. It happens
4683: immediately when the variable occurs on the right-hand side of the := or the !=
4684: operator, in a .if condition or a .for loop. In the other cases, it is
4685: evaluated lazily.
1.1 dsieger 4686:
1.184 rillig 4687: Some of the modifiers split the string into words and then operate on the
4688: words, others operate on the string as a whole. When a string is split into
4689: words, double quotes and single quotes are interpreted as delimiters, just like
4690: in sh(1).
1.1 dsieger 4691:
1.184 rillig 4692: 15.2.1. Naming conventions
1.1 dsieger 4693:
1.184 rillig 4694: * All variable names starting with an underscore are reserved for use by the
4695: pkgsrc infrastructure. They shall not be used by packages.
1.1 dsieger 4696:
1.184 rillig 4697: * In .for loops you should use lowercase variable names for the iteration
4698: variables.
1.1 dsieger 4699:
1.184 rillig 4700: * All list variables should have a plural name, such as PKG_OPTIONS or
4701: DISTFILES.
1.1 dsieger 4702:
1.184 rillig 4703: 15.3. Code snippets
1.1 dsieger 4704:
1.184 rillig 4705: 15.3.1. Adding things to a list
1.1 dsieger 4706:
1.184 rillig 4707: When adding a string that possibly contains whitespace or quotes to a list
4708: (example 1), it must be quoted using the :Q modifier.
1.1 dsieger 4709:
1.184 rillig 4710: When adding another list to a list (example 2), it must not be quoted, since
4711: its elements are already quoted.
1.1 dsieger 4712:
1.184 rillig 4713: STRING= foo * bar `date`
4714: LIST= # empty
4715: ANOTHER_LIST= a=b c=d
1.1 dsieger 4716:
1.184 rillig 4717: LIST+= ${STRING:Q} # 1
4718: LIST+= ${ANOTHER_LIST} # 2
1.1 dsieger 4719:
1.184 rillig 4720: 15.3.2. Echoing a string exactly as-is
1.1 dsieger 4721:
1.184 rillig 4722: Echoing a string containing special characters needs special work.
1.1 dsieger 4723:
1.184 rillig 4724: STRING= foo bar < > * `date` $$HOME ' "
4725: EXAMPLE_ENV= string=${STRING:Q} x=multiple\ quoted\ words
1.1 dsieger 4726:
1.184 rillig 4727: all:
4728: echo ${STRING} # 1
4729: echo ${STRING:Q} # 2
4730: printf '%s\n' ${STRING:Q}'' # 3
4731: env ${EXAMPLE_ENV} sh -c 'echo "$$string"; echo "$$x"' # 4
1.1 dsieger 4732:
1.184 rillig 4733: Example 1 leads to a syntax error in the shell, as the characters are just
4734: copied.
1.1 dsieger 4735:
1.184 rillig 4736: Example 2 quotes the string so that the shell interprets it correctly. But the
4737: echo command may additionally interpret strings with a leading dash or those
4738: containing backslashes.
1.1 dsieger 4739:
1.184 rillig 4740: Example 3 can handle arbitrary strings, since printf(1) only interprets the
4741: format string, but not the next argument. The trailing single quotes handle the
4742: case when the string is empty. In that case, the :Q modifier would result in an
4743: empty string too, which would then be skipped by the shell. For printf(1) this
4744: doesn't make a difference, but other programs may care.
1.1 dsieger 4745:
1.184 rillig 4746: In example 4, the EXAMPLE_ENV does not need to be quoted because the quoting
4747: has already been done when adding elements to the list.
1.1 dsieger 4748:
1.184 rillig 4749: 15.3.3. Passing CFLAGS to GNU configure scripts
1.1 dsieger 4750:
1.184 rillig 4751: When passing CFLAGS or similar variables to a GNU-style configure script
4752: (especially those that call other configure scripts), it must not have leading
4753: or trailing whitespace, since otherwise the configure script gets confused. To
4754: trim leading and trailing whitespace, use the :M modifier, as in the following
4755: example:
1.1 dsieger 4756:
1.184 rillig 4757: CPPFLAGS= # empty
4758: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX}\"
4759: CPPFLAGS+= ${MY_CPPFLAGS}
1.1 dsieger 4760:
1.184 rillig 4761: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
1.1 dsieger 4762:
1.184 rillig 4763: all:
4764: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
4765: echo x${CONFIGURE_ARGS:Q}x # properly trimmed
1.1 dsieger 4766:
1.184 rillig 4767: In this example, CPPFLAGS has both leading and trailing whitespace because the
4768: += operator always adds a space.
1.1 dsieger 4769:
1.184 rillig 4770: 15.3.4. Handling possibly empty variables
1.1 dsieger 4771:
1.184 rillig 4772: When a possibly empty variable is used in a shell program, it may lead to a
4773: syntax error.
1.1 dsieger 4774:
1.184 rillig 4775: EGFILES= # empty
1.1 dsieger 4776:
1.184 rillig 4777: install-examples: # produces a syntax error in the shell
4778: for egfile in ${EGFILES}; do \
4779: echo "Installing $$egfile"; \
4780: done
1.1 dsieger 4781:
1.184 rillig 4782: The shell only sees the text for egfile in ; do, since ${EGFILES} is replaced
4783: with an empty string by make(1). To fix this syntax error, use one of the
4784: snippets below.
1.1 dsieger 4785:
1.184 rillig 4786: EMPTY= # empty
1.1 dsieger 4787:
1.184 rillig 4788: install-examples:
4789: for egfile in ${EGFILES} ""; do \
4790: [ -n "$$egfile" ] || continue; \
4791: echo "Installing $$egfile"; \
4792: done
1.1 dsieger 4793:
1.184 rillig 4794: In this case, an empty string is appended to the iteration list (to prevent the
4795: syntax error) and filtered out later.
1.1 dsieger 4796:
1.184 rillig 4797: EGFILES= # empty
1.1 dsieger 4798:
1.184 rillig 4799: install-examples:
4800: .for egfile in ${EGFILES}
4801: echo "Installing ${egfile}"
4802: .endfor
1.1 dsieger 4803:
1.184 rillig 4804: If one of the filenames contains special characters, it should be enclosed in
4805: single or double quotes.
1.1 dsieger 4806:
1.184 rillig 4807: To have a shell command test whether a make variable is empty, use the
4808: following code: ${TEST} -z ${POSSIBLY_EMPTY:Q}"".
1.1 dsieger 4809:
1.184 rillig 4810: Chapter 16. Options handling
1.1 dsieger 4811:
4812: Table of Contents
4813:
1.184 rillig 4814: 16.1. Global default options
4815: 16.2. Converting packages to use bsd.options.mk
4816: 16.3. Option Names
4817: 16.4. Determining the options of dependencies
1.1 dsieger 4818:
4819: Many packages have the ability to be built to support different sets of
4820: features. bsd.options.mk is a framework in pkgsrc that provides generic
4821: handling of those options that determine different ways in which the packages
4822: can be built. It's possible for the user to specify exactly which sets of
4823: options will be built into a package or to allow a set of global default
4824: options apply.
4825:
1.7 rillig 4826: There are two broad classes of behaviors that one might want to control via
4827: options. One is whether some particular feature is enabled in a program that
4828: will be built anyway, often by including or not including a dependency on some
4829: other package. The other is whether or not an additional program will be built
4830: as part of the package. Generally, it is better to make a split package for
4831: such additional programs instead of using options, because it enables binary
4832: packages to be built which can then be added separately. For example, the foo
4833: package might have minimal dependencies (those packages without which foo
4834: doesn't make sense), and then the foo-gfoo package might include the GTK
4835: frontend program gfoo. This is better than including a gtk option to foo that
4836: adds gfoo, because either that option is default, in which case binary users
4837: can't get foo without gfoo, or not default, in which case they can't get gfoo.
4838: With split packages, they can install foo without having GTK, and later decide
4839: to install gfoo (pulling in GTK at that time). This is an advantage to source
4840: users too, avoiding the need for rebuilds.
4841:
4842: Plugins with widely varying dependencies should usually be split instead of
4843: options.
4844:
4845: It is often more work to maintain split packages, especially if the upstream
4846: package does not support this. The decision of split vs. option should be made
4847: based on the likelihood that users will want or object to the various pieces,
4848: the size of the dependencies that are included, and the amount of work.
4849:
4850: A further consideration is licensing. Non-free parts, or parts that depend on
4851: non-free dependencies (especially plugins) should almost always be split if
4852: feasible.
4853:
1.184 rillig 4854: 16.1. Global default options
1.1 dsieger 4855:
4856: Global default options are listed in PKG_DEFAULT_OPTIONS, which is a list of
4857: the options that should be built into every package if that option is
1.4 rillig 4858: supported. This variable should be set in mk.conf.
1.1 dsieger 4859:
1.184 rillig 4860: 16.2. Converting packages to use bsd.options.mk
1.1 dsieger 4861:
4862: The following example shows how bsd.options.mk should be used by the
4863: hypothetical ``wibble'' package, either in the package Makefile, or in a file,
4864: e.g. options.mk, that is included by the main package Makefile.
4865:
4866: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
4867: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
4868: PKG_OPTIONS_OPTIONAL_GROUPS= database
4869: PKG_OPTIONS_GROUP.database= mysql pgsql
4870: PKG_SUGGESTED_OPTIONS= wibble-foo
4871: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
4872: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
4873:
4874: .include "../../mk/bsd.prefs.mk"
4875:
4876: # this package was previously named wibble2
4877: .if defined(PKG_OPTIONS.wibble2)
4878: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
4879: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
4880: "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead."
4881: .endif
4882:
4883: .include "../../mk/bsd.options.mk"
4884:
4885: # Package-specific option-handling
4886:
4887: ###
4888: ### FOO support
4889: ###
4890: .if !empty(PKG_OPTIONS:Mwibble-foo)
4891: CONFIGURE_ARGS+= --enable-foo
4892: .endif
4893:
4894: ###
4895: ### LDAP support
4896: ###
4897: .if !empty(PKG_OPTIONS:Mldap)
4898: . include "../../databases/openldap-client/buildlink3.mk"
4899: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client}
4900: .endif
4901:
4902: ###
4903: ### database support
4904: ###
4905: .if !empty(PKG_OPTIONS:Mmysql)
4906: . include "../../mk/mysql.buildlink3.mk"
4907: .endif
4908: .if !empty(PKG_OPTIONS:Mpgsql)
4909: . include "../../mk/pgsql.buildlink3.mk"
4910: .endif
4911:
4912: The first section contains the information about which build options are
4913: supported by the package, and any default options settings if needed.
4914:
4915: 1. PKG_OPTIONS_VAR is the name of the make(1) variable that the user can set
4916: to override the default options. It should be set to PKG_OPTIONS.pkgbase.
4917: Do not set it to PKG_OPTIONS.${PKGBASE}, since PKGBASE is not defined at
4918: the point where the options are processed.
4919:
4920: 2. PKG_SUPPORTED_OPTIONS is a list of build options supported by the package.
4921:
4922: 3. PKG_OPTIONS_OPTIONAL_GROUPS is a list of names of groups of mutually
4923: exclusive options. The options in each group are listed in
4924: PKG_OPTIONS_GROUP.groupname. The most specific setting of any option from
4925: the group takes precedence over all other options in the group. Options
4926: from the groups will be automatically added to PKG_SUPPORTED_OPTIONS.
4927:
4928: 4. PKG_OPTIONS_REQUIRED_GROUPS is like PKG_OPTIONS_OPTIONAL_GROUPS, but
4929: building the packages will fail if no option from the group is selected.
4930:
4931: 5. PKG_OPTIONS_NONEMPTY_SETS is a list of names of sets of options. At least
4932: one option from each set must be selected. The options in each set are
4933: listed in PKG_OPTIONS_SET.setname. Options from the sets will be
4934: automatically added to PKG_SUPPORTED_OPTIONS. Building the package will
4935: fail if no option from the set is selected.
4936:
4937: 6. PKG_SUGGESTED_OPTIONS is a list of build options which are enabled by
4938: default.
4939:
4940: 7. PKG_OPTIONS_LEGACY_VARS is a list of "USE_VARIABLE:option" pairs that map
1.4 rillig 4941: legacy mk.conf variables to their option counterparts. Pairs should be
1.1 dsieger 4942: added with "+=" to keep the listing of global legacy variables. A warning
4943: will be issued if the user uses a legacy variable.
4944:
4945: 8. PKG_OPTIONS_LEGACY_OPTS is a list of "old-option:new-option" pairs that map
4946: options that have been renamed to their new counterparts. Pairs should be
4947: added with "+=" to keep the listing of global legacy options. A warning
4948: will be issued if the user uses a legacy option.
4949:
4950: 9. PKG_LEGACY_OPTIONS is a list of options implied by deprecated variables
4951: used. This can be used for cases that neither PKG_OPTIONS_LEGACY_VARS nor
4952: PKG_OPTIONS_LEGACY_OPTS can handle, e. g. when PKG_OPTIONS_VAR is renamed.
4953:
4954: 10. PKG_OPTIONS_DEPRECATED_WARNINGS is a list of warnings about deprecated
4955: variables or options used, and what to use instead.
4956:
4957: A package should never modify PKG_DEFAULT_OPTIONS or the variable named in
4958: PKG_OPTIONS_VAR. These are strictly user-settable. To suggest a default set of
4959: options, use PKG_SUGGESTED_OPTIONS.
4960:
4961: PKG_OPTIONS_VAR must be defined before including bsd.options.mk. If none of
4962: PKG_SUPPORTED_OPTIONS, PKG_OPTIONS_OPTIONAL_GROUPS, and
4963: PKG_OPTIONS_REQUIRED_GROUPS are defined (as can happen with platform-specific
4964: options if none of them is supported on the current platform), PKG_OPTIONS is
4965: set to the empty list and the package is otherwise treated as not using the
4966: options framework.
4967:
4968: After the inclusion of bsd.options.mk, the variable PKG_OPTIONS contains the
4969: list of selected build options, properly filtered to remove unsupported and
4970: duplicate options.
4971:
4972: The remaining sections contain the logic that is specific to each option. The
4973: correct way to check for an option is to check whether it is listed in
4974: PKG_OPTIONS:
4975:
4976: .if !empty(PKG_OPTIONS:Moption)
4977:
1.184 rillig 4978: 16.3. Option Names
1.1 dsieger 4979:
4980: Options that enable similar features in different packages (like optional
4981: support for a library) should use a common name in all packages that support it
4982: (like the name of the library). If another package already has an option with
4983: the same meaning, use the same name.
4984:
4985: Options that enable features specific to one package, where it's unlikely that
4986: another (unrelated) package has the same (or a similar) optional feature,
4987: should use a name prefixed with pkgname-.
4988:
4989: If a group of related packages share an optional feature specific to that
4990: group, prefix it with the name of the "main" package (e. g.
4991: djbware-errno-hack).
4992:
4993: For new options, add a line to mk/defaults/options.description. Lines have two
4994: fields, separated by tab. The first field is the option name, the second its
4995: description. The description should be a whole sentence (starting with an
4996: uppercase letter and ending with a period) that describes what enabling the
4997: option does. E. g. "Enable ispell support." The file is sorted by option names.
4998:
1.184 rillig 4999: 16.4. Determining the options of dependencies
1.7 rillig 5000:
5001: When writing buildlink3.mk files, it is often necessary to list different
5002: dependencies based on the options with which the package was built. For
5003: querying these options, the file pkgsrc/mk/pkg-build-options.mk should be used.
5004: A typical example looks like this:
5005:
5006: pkgbase := libpurple
5007: .include "../../mk/pkg-build-options.mk"
5008:
5009: .if !empty(PKG_BUILD_OPTIONS.libpurple:Mdbus)
5010: ...
5011: .endif
5012:
5013: Including pkg-build-options.mk here will set the variable
5014: PKG_BUILD_OPTIONS.libpurple to the build options of the libpurple package,
5015: which can then be queried like PKG_OPTIONS in the options.mk file. See the file
5016: pkg-build-options.mk for more details.
5017:
1.184 rillig 5018: Chapter 17. Tools needed for building or running
5019:
5020: Table of Contents
5021:
5022: 17.1. Tools for pkgsrc builds
5023: 17.2. Tools needed by packages
5024: 17.3. Tools provided by platforms
5025:
5026: The USE_TOOLS definition is used both internally by pkgsrc and also for
5027: individual packages to define what commands are needed for building a package
5028: (like TOOL_DEPENDS) or for later run-time of an installed packaged (such as
5029: DEPENDS). If the native system provides an adequate tool, then in many cases, a
5030: pkgsrc package will not be used.
5031:
5032: When building a package, the replacement tools are made available in a
5033: directory (as symlinks or wrapper scripts) that is early in the executable
5034: search path. Just like the buildlink system, this helps with consistent builds.
5035:
5036: A tool may be needed to help build a specific package. For example, perl, GNU
5037: make (gmake) or yacc may be needed.
5038:
5039: Also a tool may be needed, for example, because the native system's supplied
5040: tool may be inefficient for building a package with pkgsrc. For example, a
5041: package may need GNU awk, bison (instead of yacc) or a better sed.
5042:
5043: The tools used by a package can be listed by running make show-tools.
5044:
5045: 17.1. Tools for pkgsrc builds
5046:
5047: The default set of tools used by pkgsrc is defined in bsd.pkg.mk. This includes
5048: standard Unix tools, such as: cat, awk, chmod, test, and so on. These can be
5049: seen by running: make show-var VARNAME=USE_TOOLS.
5050:
5051: If a package needs a specific program to build then the USE_TOOLS variable can
5052: be used to define the tools needed.
5053:
5054: 17.2. Tools needed by packages
5055:
5056: In the following examples, the :run means that it is needed at run-time (and
5057: becomes a DEPENDS). The default is a build dependency which can be set with
5058: :build. (So in this example, it is the same as gmake:build and
5059: pkg-config:build.)
5060:
5061: USE_TOOLS+= gmake perl:run pkg-config
5062:
5063: When using the tools framework, a TOOLS_PATH.foo variable is defined which
5064: contains the full path to the appropriate tool. For example, TOOLS_PATH.bash
5065: could be "/bin/bash" on Linux systems.
5066:
5067: If you always need a pkgsrc version of the tool at run-time, then just use
5068: DEPENDS instead.
5069:
5070: 17.3. Tools provided by platforms
5071:
5072: When improving or porting pkgsrc to a new platform, have a look at (or create)
5073: the corresponding platform specific make file fragment under pkgsrc/mk/tools/
5074: tools.${OPSYS}.mk which defines the name of the common tools. For example:
5075:
5076: .if exists(/usr/bin/bzcat)
5077: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
5078: .elif exists(/usr/bin/bzip2)
5079: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
5080: .endif
5081:
5082: TOOLS_PLATFORM.true?= true # shell builtin
5083:
5084: Chapter 18. Buildlink methodology
1.1 dsieger 5085:
5086: Table of Contents
5087:
1.184 rillig 5088: 18.1. Converting packages to use buildlink3
5089: 18.2. Writing buildlink3.mk files
5090:
5091: 18.2.1. Anatomy of a buildlink3.mk file
5092: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
5093: buildlink3.mk files
5094:
5095: 18.3. Writing builtin.mk files
5096:
5097: 18.3.1. Anatomy of a builtin.mk file
5098: 18.3.2. Global preferences for native or pkgsrc software
5099:
5100: Buildlink is a framework in pkgsrc that controls what headers and libraries are
5101: seen by a package's configure and build processes. This is implemented in a two
5102: step process:
5103:
5104: 1. Symlink headers and libraries for dependencies into BUILDLINK_DIR, which by
5105: default is a subdirectory of WRKDIR.
5106:
5107: 2. Create wrapper scripts that are used in place of the normal compiler tools
5108: that translate -I${LOCALBASE}/include and -L${LOCALBASE}/lib into
5109: references to BUILDLINK_DIR. The wrapper scripts also make native compiler
5110: on some operating systems look like GCC, so that packages that expect GCC
5111: won't require modifications to build with those native compilers.
5112:
5113: This normalizes the environment in which a package is built so that the package
5114: may be built consistently despite what other software may be installed. Please
5115: note that the normal system header and library paths, e.g. /usr/include, /usr/
5116: lib, etc., are always searched -- buildlink3 is designed to insulate the
5117: package build from non-system-supplied software.
5118:
5119: 18.1. Converting packages to use buildlink3
1.1 dsieger 5120:
1.184 rillig 5121: The process of converting packages to use the buildlink3 framework ("bl3ifying"
5122: ) is fairly straightforward. The things to keep in mind are:
1.1 dsieger 5123:
1.184 rillig 5124: 1. Ensure that the build always calls the wrapper scripts instead of the
5125: actual toolchain. Some packages are tricky, and the only way to know for
5126: sure is the check ${WRKDIR}/.work.log to see if the wrappers are being
5127: invoked.
1.1 dsieger 5128:
1.184 rillig 5129: 2. Don't override PREFIX from within the package Makefile, e.g. Java VMs,
5130: standalone shells, etc., because the code to symlink files into $
5131: {BUILDLINK_DIR} looks for files relative to "pkg_info -qp pkgname".
1.1 dsieger 5132:
1.184 rillig 5133: 3. Remember that only the buildlink3.mk files that you list in a package's
5134: Makefile are added as dependencies for that package.
1.1 dsieger 5135:
1.184 rillig 5136: If a dependency on a particular package is required for its libraries and
5137: headers, then we replace:
1.1 dsieger 5138:
1.184 rillig 5139: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 dsieger 5140:
1.184 rillig 5141: with
1.1 dsieger 5142:
1.184 rillig 5143: .include "../../category/foo/buildlink3.mk"
1.1 dsieger 5144:
1.184 rillig 5145: The buildlink3.mk files usually define the required dependencies. If you need a
5146: newer version of the dependency when using buildlink3.mk files, then you can
5147: define it in your Makefile; for example:
1.1 dsieger 5148:
1.184 rillig 5149: BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0
5150: .include "../../category/foo/buildlink3.mk"
1.1 dsieger 5151:
1.184 rillig 5152: There are several buildlink3.mk files in pkgsrc/mk that handle special package
5153: issues:
1.1 dsieger 5154:
1.184 rillig 5155: * bdb.buildlink3.mk chooses either the native or a pkgsrc Berkeley DB
5156: implementation based on the values of BDB_ACCEPTED and BDB_DEFAULT.
1.1 dsieger 5157:
1.184 rillig 5158: * curses.buildlink3.mk: If the system comes with neither Curses nor NCurses,
5159: this will take care to install the devel/ncurses package.
1.1 dsieger 5160:
1.184 rillig 5161: * krb5.buildlink3.mk uses the value of KRB5_ACCEPTED to choose between adding
5162: a dependency on Heimdal or MIT-krb5 for packages that require a Kerberos 5
5163: implementation.
1.1 dsieger 5164:
1.184 rillig 5165: * motif.buildlink3.mk checks for a system-provided Motif installation or adds
5166: a dependency on x11/lesstif or x11/motif. The user can set MOTIF_TYPE to "
5167: dt", "lesstif" or "motif" to choose which Motif version will be used.
1.1 dsieger 5168:
1.184 rillig 5169: * readline.buildlink3.mk checks for a system-provided GNU readline or
5170: editline (libedit) installation, or adds a dependency on devel/readline,
5171: devel/editline. The user can set READLINE_DEFAULT to choose readline
5172: implementation. If your package really needs GNU readline library, its
5173: Makefile should include devel/readline/buildlink3.mk instead of
5174: readline.buildlink3.mk.
1.1 dsieger 5175:
1.184 rillig 5176: * oss.buildlink3.mk defines several variables that may be used by packages
5177: that use the Open Sound System (OSS) API.
1.1 dsieger 5178:
1.184 rillig 5179: * pgsql.buildlink3.mk will accept any of the Postgres versions in the
5180: variable PGSQL_VERSIONS_ACCEPTED and default to the version
5181: PGSQL_VERSION_DEFAULT. See the file for more information.
1.1 dsieger 5182:
1.184 rillig 5183: * pthread.buildlink3.mk uses the value of PTHREAD_OPTS and checks for native
5184: pthreads or adds a dependency on devel/pth as needed.
1.1 dsieger 5185:
1.184 rillig 5186: * xaw.buildlink3.mk uses the value of XAW_TYPE to choose a particular Athena
5187: widgets library.
1.1 dsieger 5188:
1.184 rillig 5189: The comments in those buildlink3.mk files provide a more complete description
5190: of how to use them properly.
1.1 dsieger 5191:
1.184 rillig 5192: 18.2. Writing buildlink3.mk files
1.1 dsieger 5193:
1.184 rillig 5194: A package's buildlink3.mk file is included by Makefiles to indicate the need to
5195: compile and link against header files and libraries provided by the package. A
5196: buildlink3.mk file should always provide enough information to add the correct
5197: type of dependency relationship and include any other buildlink3.mk files that
5198: it needs to find headers and libraries that it needs in turn.
1.1 dsieger 5199:
1.184 rillig 5200: To generate an initial buildlink3.mk file for further editing, Rene Hexel's
5201: pkgtools/createbuildlink package is highly recommended. For most packages, the
5202: following command will generate a good starting point for buildlink3.mk files:
1.1 dsieger 5203:
1.184 rillig 5204: % cd pkgsrc/category/pkgdir
5205: % createbuildlink >buildlink3.mk
1.1 dsieger 5206:
5207:
1.184 rillig 5208: 18.2.1. Anatomy of a buildlink3.mk file
1.1 dsieger 5209:
1.184 rillig 5210: The following real-life example buildlink3.mk is taken from pkgsrc/graphics/
5211: tiff:
1.14 jmcneill 5212:
1.184 rillig 5213: # $NetBSD: buildlink3.mk,v 1.16 2009/03/20 19:24:45 joerg Exp $
1.1 dsieger 5214:
1.184 rillig 5215: BUILDLINK_TREE+= tiff
1.1 dsieger 5216:
1.184 rillig 5217: .if !defined(TIFF_BUILDLINK3_MK)
5218: TIFF_BUILDLINK3_MK:=
1.1 dsieger 5219:
1.184 rillig 5220: BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1
5221: BUILDLINK_ABI_DEPENDS.tiff+= tiff>=3.7.2nb1
5222: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
1.1 dsieger 5223:
1.184 rillig 5224: .include "../../devel/zlib/buildlink3.mk"
5225: .include "../../graphics/jpeg/buildlink3.mk"
5226: .endif # TIFF_BUILDLINK3_MK
1.1 dsieger 5227:
1.184 rillig 5228: BUILDLINK_TREE+= -tiff
1.1 dsieger 5229:
1.184 rillig 5230: The header and footer manipulate BUILDLINK_TREE, which is common across all
5231: buildlink3.mk files and is used to track the dependency tree.
1.1 dsieger 5232:
1.184 rillig 5233: The main section is protected from multiple inclusion and controls how the
5234: dependency on pkg is added. Several important variables are set in the section:
1.1 dsieger 5235:
1.185 wiz 5236: * BUILDLINK_API_DEPENDS.pkg is the dependency version recorded in the
1.184 rillig 5237: installed package; this should always be set using += to ensure that we're
5238: appending to any pre-existing list of values. This variable should be set
1.185 wiz 5239: to the last version of the package that had an backwards-incompatible API
1.184 rillig 5240: change.
1.1 dsieger 5241:
1.184 rillig 5242: * BUILDLINK_PKGSRCDIR.pkg is the location of the pkg pkgsrc directory.
1.1 dsieger 5243:
1.184 rillig 5244: * BUILDLINK_DEPMETHOD.pkg (not shown above) controls whether we use
5245: BUILD_DEPENDS or DEPENDS to add the dependency on pkg. The build dependency
5246: is selected by setting BUILDLINK_DEPMETHOD.pkg to "build". By default, the
5247: full dependency is used.
1.1 dsieger 5248:
1.184 rillig 5249: * BUILDLINK_INCDIRS.pkg and BUILDLINK_LIBDIRS.pkg (not shown above) are lists
5250: of subdirectories of ${BUILDLINK_PREFIX.pkg} to add to the header and
5251: library search paths. These default to "include" and "lib" respectively.
1.1 dsieger 5252:
1.184 rillig 5253: * BUILDLINK_CPPFLAGS.pkg (not shown above) is the list of preprocessor flags
5254: to add to CPPFLAGS, which are passed on to the configure and build phases.
5255: The "-I" option should be avoided and instead be handled using
5256: BUILDLINK_INCDIRS.pkg as above.
1.66 asau 5257:
1.184 rillig 5258: The following variables are all optionally defined within this second section
5259: (protected against multiple inclusion) and control which package files are
5260: symlinked into ${BUILDLINK_DIR} and how their names are transformed during the
5261: symlinking:
1.23 jakllsch 5262:
1.184 rillig 5263: * BUILDLINK_FILES.pkg (not shown above) is a shell glob pattern relative to $
5264: {BUILDLINK_PREFIX.pkg} to be symlinked into ${BUILDLINK_DIR}, e.g. include/
5265: *.h.
1.1 dsieger 5266:
1.184 rillig 5267: * BUILDLINK_FILES_CMD.pkg (not shown above) is a shell pipeline that outputs
5268: to stdout a list of files relative to ${BUILDLINK_PREFIX.pkg}. The
5269: resulting files are to be symlinked into ${BUILDLINK_DIR}. By default, this
5270: takes the +CONTENTS of a pkg and filters it through $
5271: {BUILDLINK_CONTENTS_FILTER.pkg}.
1.1 dsieger 5272:
1.184 rillig 5273: * BUILDLINK_CONTENTS_FILTER.pkg (not shown above) is a filter command that
5274: filters +CONTENTS input into a list of files relative to $
5275: {BUILDLINK_PREFIX.pkg} on stdout. By default, BUILDLINK_CONTENTS_FILTER.pkg
5276: outputs the contents of the include and lib directories in the package
5277: +CONTENTS.
1.1 dsieger 5278:
1.184 rillig 5279: * BUILDLINK_FNAME_TRANSFORM.pkg (not shown above) is a list of sed arguments
5280: used to transform the name of the source filename into a destination
5281: filename, e.g. -e "s|/curses.h|/ncurses.h|g".
1.1 dsieger 5282:
1.184 rillig 5283: This section can additionally include any buildlink3.mk needed for pkg's
5284: library dependencies. Including these buildlink3.mk files means that the
5285: headers and libraries for these dependencies are also symlinked into $
5286: {BUILDLINK_DIR} whenever the pkg buildlink3.mk file is included. Dependencies
5287: are only added for directly include buildlink3.mk files.
1.1 dsieger 5288:
1.184 rillig 5289: When providing a buildlink3.mk and including other buildlink3.mk files in it,
5290: please only add necessary ones, i.e., those whose libraries or header files are
5291: automatically exposed when the package is use.
1.1 dsieger 5292:
1.184 rillig 5293: In particular, if only an executable (bin/foo) is linked against a library,
5294: that library does not need to be propagated in the buildlink3.mk file.
1.1 dsieger 5295:
1.184 rillig 5296: The following steps should help you decide if a buildlink3.mk file needs to be
5297: included:
1.1 dsieger 5298:
1.184 rillig 5299: * Look at the installed header files: What headers do they include? The
5300: packages providing these files must be buildlinked.
1.1 dsieger 5301:
1.184 rillig 5302: * Run ldd on all installed libraries and look against what other libraries
5303: they link. Some of the packages providing these probably need to be
5304: buildlinked; however, it's not automatic, since e.g. GTK on some systems
5305: pulls in the X libraries, so they will show up in the ldd output, while on
5306: others (like OS X) it won't. ldd output can thus only be used as a hint.
1.1 dsieger 5307:
1.184 rillig 5308: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
5309: buildlink3.mk files
1.16 jnemeth 5310:
1.185 wiz 5311: Both variables set lower bounds for a version of this package. The two
5312: variables differ in that one describes source compatibility (API) and the other
5313: binary compatibility (ABI). The difference is that a change in the API breaks
5314: compilation of programs while changes in the ABI stop compiled programs from
5315: running.
5316:
5317: The BUILDLINK_API_DEPENDS.pkg variable in a buildlink3.mk should be changed
5318: very rarely. (One possible scenario: If all packages using this package need a
5319: higher version than defined in the buildlink3.mk, BUILDLINK_API_DEPENDS.pkg
5320: could be updated to that higher version.)
5321:
5322: On the other hand, changes to BUILDLINK_ABI_DEPENDS.pkg are more common. The
5323: variable will need to be updated every time the major version of one of its
5324: shared libraries is changed, or any other change where a binary built against
5325: the previous version of the package will not run against the new version any
5326: longer.
5327:
5328: In such a case, the package's BUILDLINK_ABI_DEPENDS.pkg must be increased to
5329: require the new package version. Then the PKGREVISION of all packages foo that
5330: depend on this package need to be increased, and if they have buildlink3.mk
5331: files, BUILDLINK_ABI_DEPENDS.foo in their buildlink3.mk files must be increased
5332: to the new version as well. This is required so that a package will pull in the
5333: versions of the packages that use the new ABI and that the packages'
5334: PKGREVISIONs uniquely identify the packages built against the new ABI. The
5335: pkgtools/revbump package can help with these updates.
1.1 dsieger 5336:
1.184 rillig 5337: See Section 21.1.5, "Handling dependencies" for more information about
1.185 wiz 5338: dependencies on other packages, including the BUILDLINK_API_DEPENDS
5339: definitions.
1.1 dsieger 5340:
1.184 rillig 5341: Please take careful consideration before adjusting BUILDLINK_API_DEPENDS.pkg or
1.185 wiz 5342: BUILDLINK_ABI_DEPENDS.pkg in a buildlink3.mk file as we don't want to cause
5343: unneeded package deletions and rebuilds. In many cases, new versions of
5344: packages work just fine with older dependencies.
1.1 dsieger 5345:
1.211 gutterid 5346: Also, it is not needed to set BUILDLINK_ABI_DEPENDS.pkg when it is identical to
1.184 rillig 5347: BUILDLINK_API_DEPENDS.pkg.
1.1 dsieger 5348:
1.211 gutterid 5349: Note there is also the distinction that users are able to disable enforcement
5350: of ABI dependencies using the USE_ABI_DEPENDS variable, but there is no
5351: equivalent option for API dependencies.
5352:
1.184 rillig 5353: 18.3. Writing builtin.mk files
1.1 dsieger 5354:
1.184 rillig 5355: Some packages in pkgsrc install headers and libraries that coincide with
5356: headers and libraries present in the base system. Aside from a buildlink3.mk
5357: file, these packages should also include a builtin.mk file that includes the
5358: necessary checks to decide whether using the built-in software or the pkgsrc
5359: software is appropriate.
1.1 dsieger 5360:
1.184 rillig 5361: The only requirements of a builtin.mk file for pkg are:
1.1 dsieger 5362:
1.184 rillig 5363: 1. It should set USE_BUILTIN.pkg to either "yes" or "no" after it is included.
1.1 dsieger 5364:
1.184 rillig 5365: 2. It should not override any USE_BUILTIN.pkg which is already set before the
5366: builtin.mk file is included.
1.1 dsieger 5367:
1.184 rillig 5368: 3. It should be written to allow multiple inclusion. This is very important
5369: and takes careful attention to Makefile coding.
1.1 dsieger 5370:
1.184 rillig 5371: 18.3.1. Anatomy of a builtin.mk file
1.1 dsieger 5372:
1.184 rillig 5373: The following is the recommended template for builtin.mk files:
1.1 dsieger 5374:
1.184 rillig 5375: .if !defined(IS_BUILTIN.foo)
5376: #
5377: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
5378: # genuinely exists in the system or not.
5379: #
5380: IS_BUILTIN.foo?= no
1.1 dsieger 5381:
1.184 rillig 5382: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
5383: # version can be determined.
5384: #
5385: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
5386: BUILTIN_PKG.foo?= foo-1.0
5387: . endif
5388: .endif # IS_BUILTIN.foo
1.1 dsieger 5389:
1.184 rillig 5390: .if !defined(USE_BUILTIN.foo)
5391: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
5392: . if defined(BUILTIN_PKG.foo)
5393: . for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
5394: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
5395: USE_BUILTIN.foo!= \
5396: ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \
5397: && ${ECHO} "yes" || ${ECHO} "no"
5398: . endif
5399: . endfor
5400: . endif
5401: .endif # USE_BUILTIN.foo
1.1 dsieger 5402:
1.184 rillig 5403: CHECK_BUILTIN.foo?= no
5404: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
5405: #
5406: # Here we place code that depends on whether USE_BUILTIN.foo is set to
5407: # "yes" or "no".
5408: #
5409: .endif # CHECK_BUILTIN.foo
1.1 dsieger 5410:
1.184 rillig 5411: The first section sets IS_BUILTIN.pkg depending on if pkg really exists in the
5412: base system. This should not be a base system software with similar
5413: functionality to pkg; it should only be "yes" if the actual package is included
5414: as part of the base system. This variable is only used internally within the
5415: builtin.mk file.
1.1 dsieger 5416:
1.184 rillig 5417: The second section sets BUILTIN_PKG.pkg to the version of pkg in the base
5418: system if it exists (if IS_BUILTIN.pkg is "yes"). This variable is only used
5419: internally within the builtin.mk file.
1.1 dsieger 5420:
1.184 rillig 5421: The third section sets USE_BUILTIN.pkg and is required in all builtin.mk files.
5422: The code in this section must make the determination whether the built-in
5423: software is adequate to satisfy the dependencies listed in
5424: BUILDLINK_API_DEPENDS.pkg. This is typically done by comparing BUILTIN_PKG.pkg
5425: against each of the dependencies in BUILDLINK_API_DEPENDS.pkg. USE_BUILTIN.pkg
5426: must be set to the correct value by the end of the builtin.mk file. Note that
5427: USE_BUILTIN.pkg may be "yes" even if IS_BUILTIN.pkg is "no" because we may make
5428: the determination that the built-in version of the software is similar enough
5429: to be used as a replacement.
1.1 dsieger 5430:
1.184 rillig 5431: The last section is guarded by CHECK_BUILTIN.pkg, and includes code that uses
5432: the value of USE_BUILTIN.pkg set in the previous section. This typically
5433: includes, e.g., adding additional dependency restrictions and listing
5434: additional files to symlink into ${BUILDLINK_DIR} (via BUILDLINK_FILES.pkg).
1.1 dsieger 5435:
1.184 rillig 5436: 18.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 5437:
1.184 rillig 5438: When building packages, it's possible to choose whether to set a global
5439: preference for using either the built-in (native) version or the pkgsrc version
5440: of software to satisfy a dependency. This is controlled by setting
5441: PREFER_PKGSRC and PREFER_NATIVE. These variables take values of either "yes", "
5442: no", or a list of packages. PREFER_PKGSRC tells pkgsrc to use the pkgsrc
5443: versions of software, while PREFER_NATIVE tells pkgsrc to use the built-in
5444: versions. Preferences are determined by the most specific instance of the
5445: package in either PREFER_PKGSRC or PREFER_NATIVE. If a package is specified in
5446: neither or in both variables, then PREFER_PKGSRC has precedence over
5447: PREFER_NATIVE. For example, to require using pkgsrc versions of software for
5448: all but the most basic bits on a NetBSD system, you can set:
1.1 dsieger 5449:
1.184 rillig 5450: PREFER_PKGSRC= yes
5451: PREFER_NATIVE= getopt skey tcp_wrappers
1.1 dsieger 5452:
1.184 rillig 5453: A package must have a builtin.mk file to be listed in PREFER_NATIVE, otherwise
5454: it is simply ignored in that list.
1.1 dsieger 5455:
1.191 bacon 5456: PREFER_PKGSRC and PREFER_NATIVE should be set during bootstrap to ensure that
5457: the bootstrap process does not use inapropriate native tools as dependencies
5458: for core packages.
5459:
5460: # ./bootstrap --prefer-pkgsrc yes --prefer-native openssl
5461:
5462: Switching between settings globally at a later date can introduce complications
5463: with dependency resolution. This is caused by packages built with the opposite
5464: preference being installed alongside each other. Hence, any changes to these
5465: variables after bootstrap will necessitate rebuilding all packages depending on
5466: one whose preference has been changed. This is not trivial and should be
5467: avoided.
5468:
5469: When using pkgsrc on Linux systems, there is high risk of "leakage", where
5470: programs installed by pkgsrc may inadvertently use a command or library not
5471: installed by pkgsrc, e.g. those installed by yum or apt. Such foreign
5472: dependencies may be installed, removed, or upgraded to a version incompatible
5473: with the pkgsrc package at any time, causing pkgsrc packages to subsequently
5474: malfunction. Pkgsrc cannot prevent this, as it has no control over other
5475: package managers. Another potential problem is that under Redhat Enterprise and
5476: related Linux systems, yum packages are only patched and never upgraded, so
5477: eventually they may become too outdated for use by pkgsrc. Even intentionally
5478: using foreign dependencies, not considered leakage, can lead to these problems,
5479: so it is generally discouraged. In order to minimize such problems,
5480: PREFER_PKGSRC defaults to "yes" on Linux systems. This ensures that pkgsrc is
5481: aware of any changes to dependency packages and can rebuild or upgrade the
5482: entire dependency tree as needed. This default can be overridden by setting
5483: --prefer-pkgsrc to "no" or a list of packages, or by setting --prefer-native to
5484: "yes".
1.1 dsieger 5485:
1.184 rillig 5486: Chapter 19. PLIST issues
1.1 dsieger 5487:
1.184 rillig 5488: Table of Contents
1.1 dsieger 5489:
1.184 rillig 5490: 19.1. RCS ID
5491: 19.2. Semi-automatic PLIST generation
5492: 19.3. Tweaking output of make print-PLIST
5493: 19.4. Variable substitution in PLIST
5494: 19.5. Man page compression
5495: 19.6. Changing PLIST source with PLIST_SRC
5496: 19.7. Platform-specific and differing PLISTs
5497: 19.8. Build-specific PLISTs
5498: 19.9. Sharing directories between packages
1.1 dsieger 5499:
1.184 rillig 5500: The PLIST file contains a package's "packing list", i.e. a list of files that
5501: belong to the package (relative to the ${PREFIX} directory it's been installed
5502: in) plus some additional statements - see the pkg_create(1) man page for a full
5503: list. This chapter addresses some issues that need attention when dealing with
5504: the PLIST file (or files, see below!).
1.1 dsieger 5505:
1.184 rillig 5506: 19.1. RCS ID
1.1 dsieger 5507:
1.184 rillig 5508: Be sure to add a RCS ID line as the first thing in any PLIST file you write:
1.1 dsieger 5509:
1.184 rillig 5510: @comment $NetBSD $
1.1 dsieger 5511:
1.184 rillig 5512: An artificial space has been added between NetBSD and $, this is a workaround
5513: here to prevent CVS expanding to the filename of the guide. When adding the RCS
5514: ID the space should be omitted.
1.38 wiz 5515:
1.184 rillig 5516: 19.2. Semi-automatic PLIST generation
1.1 dsieger 5517:
1.184 rillig 5518: You can use the make print-PLIST command to output a PLIST that matches any new
5519: files since the package was extracted. See Section 13.17, "Other helpful
5520: targets" for more information on this target.
1.11 rillig 5521:
1.184 rillig 5522: 19.3. Tweaking output of make print-PLIST
1.1 dsieger 5523:
1.184 rillig 5524: The PRINT_PLIST_AWK variable takes a set of AWK patterns and actions that are
5525: used to filter the output of print-PLIST. You can append any chunk of AWK
5526: scripting you like to it, but be careful with quoting.
1.1 dsieger 5527:
1.184 rillig 5528: For example, to get all files inside the libdata/foo directory removed from the
5529: resulting PLIST:
1.1 dsieger 5530:
1.184 rillig 5531: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 dsieger 5532:
1.185 wiz 5533: The PRINT_PLIST_AWK transformations are evaluated after the file list and
5534: directory list are sorted. EARLY_PRINT_PLIST_AWK is like PRINT_PLIST_AWK except
5535: it operates before the file list and directory list are sorted.
5536:
1.184 rillig 5537: 19.4. Variable substitution in PLIST
1.1 dsieger 5538:
1.184 rillig 5539: A number of variables are substituted automatically in PLISTs when a package is
5540: installed on a system. This includes the following variables:
1.1 dsieger 5541:
1.184 rillig 5542: ${MACHINE_ARCH}, ${MACHINE_GNU_ARCH}
1.1 dsieger 5543:
1.184 rillig 5544: Some packages like emacs and perl embed information about which
5545: architecture they were built on into the pathnames where they install their
5546: files. To handle this case, PLIST will be preprocessed before actually
5547: used, and the symbol "${MACHINE_ARCH}" will be replaced by what uname -p
5548: gives. The same is done if the string ${MACHINE_GNU_ARCH} is embedded in
5549: PLIST somewhere - use this on packages that have GNU autoconf-created
5550: configure scripts.
1.1 dsieger 5551:
1.184 rillig 5552: Legacy note
1.1 dsieger 5553:
1.184 rillig 5554: There used to be a symbol "$ARCH" that was replaced by the output of uname
5555: -m, but that's no longer supported and has been removed.
1.1 dsieger 5556:
1.184 rillig 5557: ${OPSYS}, ${LOWER_OPSYS}, ${OS_VERSION}
1.1 dsieger 5558:
1.184 rillig 5559: Some packages want to embed the OS name and version into some paths. To do
5560: this, use these variables in the PLIST:
1.1 dsieger 5561:
1.184 rillig 5562: + ${OPSYS} - output of "uname -s"
1.1 dsieger 5563:
1.184 rillig 5564: + ${LOWER_OPSYS} - lowercase common name (eg. "solaris")
1.1 dsieger 5565:
1.184 rillig 5566: + ${OS_VERSION} - "uname -r"
1.1 dsieger 5567:
1.184 rillig 5568: For a list of values which are replaced by default, the output of make help
5569: topic=PLIST_SUBST as well as searching the pkgsrc/mk directory with grep for
5570: PLIST_SUBST should help.
1.1 dsieger 5571:
1.184 rillig 5572: If you want to change other variables not listed above, you can add variables
5573: and their expansions to this variable in the following way, similar to
5574: MESSAGE_SUBST (see Section 12.5, "Optional files"):
1.1 dsieger 5575:
1.184 rillig 5576: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 5577:
1.184 rillig 5578: This replaces all occurrences of "${SOMEVAR}" in the PLIST with "somevalue".
1.1 dsieger 5579:
1.184 rillig 5580: The PLIST_VARS variable can be used to simplify the common case of
5581: conditionally including some PLIST entries. It can be done by adding
5582: PLIST_VARS+=foo and setting the corresponding PLIST.foo variable to yes if the
5583: entry should be included. This will substitute "${PLIST.foo}" in the PLIST with
5584: either """" or ""@comment "". For example, in Makefile:
1.1 dsieger 5585:
1.184 rillig 5586: PLIST_VARS+= foo
5587: .if condition
5588: PLIST.foo= yes
5589: .else
1.1 dsieger 5590:
1.184 rillig 5591: And then in PLIST:
1.1 dsieger 5592:
1.184 rillig 5593: @comment $NetBSD $
5594: bin/bar
5595: man/man1/bar.1
5596: ${PLIST.foo}bin/foo
5597: ${PLIST.foo}man/man1/foo.1
5598: ${PLIST.foo}share/bar/foo.data
1.1 dsieger 5599:
1.184 rillig 5600: An artificial space has been added between NetBSD and $, this is a workaround
5601: here to prevent CVS expanding to the filename of the guide. When adding the RCS
1.195 gutterid 5602: ID the space should be omitted.
1.1 dsieger 5603:
1.184 rillig 5604: 19.5. Man page compression
1.1 dsieger 5605:
1.184 rillig 5606: Man pages should be installed in compressed form if MANZ is set (in
5607: bsd.own.mk), and uncompressed otherwise. To handle this in the PLIST file, the
5608: suffix ".gz" is appended/removed automatically for man pages according to MANZ
5609: and MANCOMPRESSED being set or not, see above for details. This modification of
5610: the PLIST file is done on a copy of it, not PLIST itself.
1.100 leot 5611:
1.184 rillig 5612: 19.6. Changing PLIST source with PLIST_SRC
1.100 leot 5613:
1.184 rillig 5614: To use one or more files as source for the PLIST used in generating the binary
5615: package, set the variable PLIST_SRC to the names of that file(s). The files are
5616: later concatenated using cat(1), and the order of things is important. The
5617: default for PLIST_SRC is ${PKGDIR}/PLIST.
1.1 dsieger 5618:
1.184 rillig 5619: 19.7. Platform-specific and differing PLISTs
1.1 dsieger 5620:
1.184 rillig 5621: Some packages decide to install a different set of files based on the operating
5622: system being used. These differences can be automatically handled by using the
5623: following files:
1.1 dsieger 5624:
1.184 rillig 5625: * PLIST.common
1.1 dsieger 5626:
1.184 rillig 5627: * PLIST.${OPSYS}
1.1 dsieger 5628:
1.184 rillig 5629: * PLIST.${MACHINE_ARCH}
1.1 dsieger 5630:
1.184 rillig 5631: * PLIST.${OPSYS}-${MACHINE_ARCH}
1.1 dsieger 5632:
1.184 rillig 5633: * PLIST.common_end
1.1 dsieger 5634:
1.184 rillig 5635: 19.8. Build-specific PLISTs
1.1 dsieger 5636:
1.184 rillig 5637: Some packages decide to generate hard-to-guess file names during installation
5638: that are hard to wire down.
1.1 dsieger 5639:
1.184 rillig 5640: In such cases, you can set the GENERATE_PLIST variable to shell code terminated
5641: (with a semicolon) that will output PLIST entries which will be appended to the
5642: PLIST
1.1 dsieger 5643:
1.184 rillig 5644: You can find one example in editors/xemacs:
1.1 dsieger 5645:
1.184 rillig 5646: GENERATE_PLIST+= ${ECHO} bin/${DISTNAME}-`${WRKSRC}/src/xemacs -sd`.dmp ;
1.1 dsieger 5647:
1.184 rillig 5648: which will append something like bin/xemacs-21.4.23-54e8ea71.dmp to the PLIST.
1.1 dsieger 5649:
1.184 rillig 5650: 19.9. Sharing directories between packages
1.1 dsieger 5651:
1.184 rillig 5652: A "shared directory" is a directory where multiple (and unrelated) packages
5653: install files. These directories were problematic because you had to add
5654: special tricks in the PLIST to conditionally remove them, or have some
5655: centralized package handle them.
1.106 tnn 5656:
1.184 rillig 5657: In pkgsrc, it is now easy: Each package should create directories and install
5658: files as needed; pkg_delete will remove any directories left empty after
5659: uninstalling a package.
1.106 tnn 5660:
1.184 rillig 5661: If a package needs an empty directory to work, create the directory during
5662: installation as usual, and also add an entry to the PLIST:
1.1 dsieger 5663:
1.184 rillig 5664: @pkgdir path/to/empty/directory
1.1 dsieger 5665:
1.184 rillig 5666: or take a look at MAKE_DIRS and OWN_DIRS.
1.1 dsieger 5667:
1.184 rillig 5668: Chapter 20. The pkginstall framework
1.1 dsieger 5669:
1.184 rillig 5670: Table of Contents
1.1 dsieger 5671:
1.184 rillig 5672: 20.1. Files and directories outside the installation prefix
1.1 dsieger 5673:
1.184 rillig 5674: 20.1.1. Directory manipulation
5675: 20.1.2. File manipulation
1.1 dsieger 5676:
1.184 rillig 5677: 20.2. Configuration files
1.1 dsieger 5678:
1.184 rillig 5679: 20.2.1. How PKG_SYSCONFDIR is set
5680: 20.2.2. Telling the software where configuration files are
5681: 20.2.3. Patching installations
5682: 20.2.4. Disabling handling of configuration files
1.1 dsieger 5683:
1.184 rillig 5684: 20.3. System startup scripts
1.1 dsieger 5685:
1.184 rillig 5686: 20.3.1. Disabling handling of system startup scripts
1.1 dsieger 5687:
1.184 rillig 5688: 20.4. System users and groups
5689: 20.5. System shells
1.1 dsieger 5690:
1.184 rillig 5691: 20.5.1. Disabling shell registration
1.1 dsieger 5692:
1.184 rillig 5693: 20.6. Fonts
1.1 dsieger 5694:
1.184 rillig 5695: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 5696:
1.184 rillig 5697: This chapter describes the framework known as pkginstall, whose key features
5698: are:
1.1 dsieger 5699:
1.184 rillig 5700: * Generic installation and manipulation of directories and files outside the
5701: pkgsrc-handled tree, LOCALBASE.
1.1 dsieger 5702:
1.184 rillig 5703: * Automatic handling of configuration files during installation, provided
5704: that packages are correctly designed.
1.1 dsieger 5705:
1.184 rillig 5706: * Generation and installation of system startup scripts.
1.1 dsieger 5707:
1.184 rillig 5708: * Registration of system users and groups.
1.1 dsieger 5709:
1.184 rillig 5710: * Registration of system shells.
1.1 dsieger 5711:
1.184 rillig 5712: * Automatic updating of fonts databases.
1.1 dsieger 5713:
1.184 rillig 5714: The following sections inspect each of the above points in detail.
1.1 dsieger 5715:
1.184 rillig 5716: You may be thinking that many of the things described here could be easily done
5717: with simple code in the package's post-installation target (post-install). This
5718: is incorrect, as the code in them is only executed when building from source.
5719: Machines using binary packages could not benefit from it at all (as the code
5720: itself could be unavailable). Therefore, the only way to achieve any of the
5721: items described above is by means of the installation scripts, which are
5722: automatically generated by pkginstall.
1.1 dsieger 5723:
1.184 rillig 5724: 20.1. Files and directories outside the installation prefix
1.95 wiz 5725:
1.184 rillig 5726: As you already know, the PLIST file holds a list of files and directories that
5727: belong to a package. The names used in it are relative to the installation
5728: prefix (${PREFIX}), which means that it cannot register files outside this
5729: directory (absolute path names are not allowed). Despite this restriction, some
5730: packages need to install files outside this location; e.g., under ${VARBASE} or
5731: ${PKG_SYSCONFDIR}. The only way to achieve this is to create such files during
5732: installation time by using installation scripts.
1.95 wiz 5733:
1.184 rillig 5734: The generic installation scripts are shell scripts that can contain arbitrary
5735: code. The list of scripts to execute is taken from the INSTALL_FILE variable,
5736: which defaults to INSTALL. A similar variable exists for package removal
5737: (DEINSTALL_FILE, whose default is DEINSTALL). These scripts can run arbitrary
5738: commands, so they have the potential to create and manage files anywhere in the
5739: file system.
1.95 wiz 5740:
1.184 rillig 5741: Using these general installation files is not recommended, but may be needed in
5742: some special cases. One reason for avoiding them is that the user has to trust
5743: the packager that there is no unwanted or simply erroneous code included in the
5744: installation script. Also, previously there were many similar scripts for the
5745: same functionality, and fixing a common error involved finding and changing all
5746: of them.
1.95 wiz 5747:
1.184 rillig 5748: The pkginstall framework offers another, standardized way. It provides generic
5749: scripts to abstract the manipulation of such files and directories based on
5750: variables set in the package's Makefile. The rest of this section describes
5751: these variables.
1.1 dsieger 5752:
1.184 rillig 5753: 20.1.1. Directory manipulation
1.1 dsieger 5754:
1.184 rillig 5755: The following variables can be set to request the creation of directories
5756: anywhere in the file system:
1.1 dsieger 5757:
1.184 rillig 5758: * MAKE_DIRS and OWN_DIRS contain a list of directories that should be created
5759: and should attempt to be destroyed by the installation scripts. The
5760: difference between the two is that the latter prompts the administrator to
5761: remove any directories that may be left after deinstallation (because they
5762: were not empty), while the former does not. Example:
1.1 dsieger 5763:
1.184 rillig 5764: MAKE_DIRS+= ${VARBASE}/foo/private
1.1 dsieger 5765:
1.184 rillig 5766: * MAKE_DIRS_PERMS and OWN_DIRS_PERMS contain a list of tuples describing
5767: which directories should be created and should attempt to be destroyed by
5768: the installation scripts. Each tuple holds the following values, separated
5769: by spaces: the directory name, its owner, its group and its numerical mode.
5770: For example:
1.1 dsieger 5771:
1.184 rillig 5772: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private \
5773: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 5774:
1.184 rillig 5775: The difference between the two is exactly the same as their non-PERMS
5776: counterparts.
1.1 dsieger 5777:
1.184 rillig 5778: 20.1.2. File manipulation
1.1 dsieger 5779:
1.184 rillig 5780: Creating non-empty files outside the installation prefix is tricky because the
5781: PLIST forces all files to be inside it. To overcome this problem, the only
5782: solution is to extract the file in the known place (i.e., inside the
5783: installation prefix) and copy it to the appropriate location during
5784: installation (done by the installation scripts generated by pkginstall). We
5785: will call the former the master file in the following paragraphs, which
5786: describe the variables that can be used to automatically and consistently
5787: handle files outside the installation prefix:
1.1 dsieger 5788:
1.184 rillig 5789: * CONF_FILES and REQD_FILES are pairs of master and target files. During
5790: installation time, the master file is copied to the target one if and only
5791: if the latter does not exist. Upon deinstallation, the target file is
5792: removed provided that it was not modified by the installation.
1.1 dsieger 5793:
1.184 rillig 5794: The difference between the two is that the latter prompts the administrator
5795: to remove any files that may be left after deinstallation (because they
5796: were not empty), while the former does not.
1.1 dsieger 5797:
1.184 rillig 5798: * CONF_FILES_PERMS and REQD_FILES_PERMS contain tuples describing master
5799: files as well as their target locations. For each of them, it also
5800: specifies their owner, their group and their numeric permissions, in this
5801: order. For example:
1.1 dsieger 5802:
1.184 rillig 5803: REQD_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile \
5804: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 5805:
1.184 rillig 5806: The difference between the two is exactly the same as their non-PERMS
5807: counterparts.
1.1 dsieger 5808:
1.184 rillig 5809: 20.2. Configuration files
1.1 dsieger 5810:
1.184 rillig 5811: Configuration files are special in the sense that they are installed in their
5812: own specific directory, PKG_SYSCONFDIR, and need special treatment during
5813: installation (most of which is automated by pkginstall). The main concept you
5814: must bear in mind is that files marked as configuration files are automatically
5815: copied to the right place (somewhere inside PKG_SYSCONFDIR) during installation
5816: if and only if they didn't exist before. Similarly, they will not be removed if
5817: they have local modifications. This ensures that administrators never lose any
5818: custom changes they may have made.
1.1 dsieger 5819:
1.184 rillig 5820: 20.2.1. How PKG_SYSCONFDIR is set
1.1 dsieger 5821:
1.184 rillig 5822: As said before, the PKG_SYSCONFDIR variable specifies where configuration files
5823: shall be installed. Its contents are set based upon the following variables:
1.1 dsieger 5824:
1.184 rillig 5825: * PKG_SYSCONFBASE: The configuration's root directory. Defaults to ${PREFIX}/
5826: etc although it may be overridden by the user to point to his preferred
5827: location (e.g., /etc, /etc/pkg, etc.). Packages must not use it directly.
1.1 dsieger 5828:
1.184 rillig 5829: * PKG_SYSCONFSUBDIR: A subdirectory of PKG_SYSCONFBASE under which the
5830: configuration files for the package being built shall be installed. The
5831: definition of this variable only makes sense in the package's Makefile
5832: (i.e., it is not user-customizable).
1.1 dsieger 5833:
1.184 rillig 5834: As an example, consider the Apache package, www/apache24, which places its
5835: configuration files under the httpd/ subdirectory of PKG_SYSCONFBASE. This
5836: should be set in the package Makefile.
1.1 dsieger 5837:
1.184 rillig 5838: * PKG_SYSCONFVAR: Specifies the name of the variable that holds this
5839: package's configuration directory (if different from PKG_SYSCONFBASE). It
5840: defaults to PKGBASE's value, and is always prefixed with PKG_SYSCONFDIR.
1.1 dsieger 5841:
1.184 rillig 5842: * PKG_SYSCONFDIR.${PKG_SYSCONFVAR}: Holds the directory where the
5843: configuration files for the package identified by PKG_SYSCONFVAR's shall be
5844: placed.
1.1 dsieger 5845:
1.184 rillig 5846: Based on the above variables, pkginstall determines the value of
5847: PKG_SYSCONFDIR, which is the only variable that can be used within a package to
5848: refer to its configuration directory. The algorithm used to set its value is
5849: basically the following:
1.1 dsieger 5850:
1.184 rillig 5851: 1. If PKG_SYSCONFDIR.${PKG_SYSCONFVAR} is set, its value is used.
1.1 dsieger 5852:
1.184 rillig 5853: 2. If the previous variable is not defined but PKG_SYSCONFSUBDIR is set in the
5854: package's Makefile, the resulting value is ${PKG_SYSCONFBASE}/$
5855: {PKG_SYSCONFSUBDIR}.
1.1 dsieger 5856:
1.184 rillig 5857: 3. Otherwise, it is set to ${PKG_SYSCONFBASE}.
1.1 dsieger 5858:
1.184 rillig 5859: It is worth mentioning that ${PKG_SYSCONFDIR} is automatically added to
5860: OWN_DIRS. See Section 20.1.1, "Directory manipulation" what this means. This
5861: does not apply to subdirectories of ${PKG_SYSCONFDIR}, they still have to be
5862: created with OWN_DIRS or MAKE_DIRS.
1.1 dsieger 5863:
1.184 rillig 5864: 20.2.2. Telling the software where configuration files are
1.1 dsieger 5865:
1.184 rillig 5866: Given that pkgsrc (and users!) expect configuration files to be in a known
5867: place, you need to teach each package where it shall install its files. In some
5868: cases you will have to patch the package Makefiles to achieve it. If you are
5869: lucky, though, it may be as easy as passing an extra flag to the configuration
5870: script; this is the case of GNU Autoconf- generated files:
1.1 dsieger 5871:
1.184 rillig 5872: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.1 dsieger 5873:
1.184 rillig 5874: Note that this specifies where the package has to look for its configuration
5875: files, not where they will be originally installed (although the difference is
5876: never explicit, unfortunately).
1.1 dsieger 5877:
1.184 rillig 5878: 20.2.3. Patching installations
1.1 dsieger 5879:
1.184 rillig 5880: As said before, pkginstall automatically handles configuration files. This
5881: means that the packages themselves must not touch the contents of $
5882: {PKG_SYSCONFDIR} directly. Bad news is that many software installation scripts
5883: will, out of the box, mess with the contents of that directory. So what is the
5884: correct procedure to fix this issue?
1.1 dsieger 5885:
1.184 rillig 5886: You must teach the package (usually by manually patching it) to install any
5887: configuration files under the examples hierarchy, share/examples/${PKGBASE}/.
5888: This way, the PLIST registers them and the administrator always has the
5889: original copies available.
1.1 dsieger 5890:
1.184 rillig 5891: Once the required configuration files are in place (i.e., under the examples
5892: hierarchy), the pkginstall framework can use them as master copies during the
5893: package installation to update what is in ${PKG_SYSCONFDIR}. To achieve this,
5894: the variables CONF_FILES and CONF_FILES_PERMS are used. Check out
5895: Section 20.1.2, "File manipulation" for information about their syntax and
5896: their purpose. Here is an example, taken from the mail/mutt package:
1.1 dsieger 5897:
1.184 rillig 5898: EGDIR= ${PREFIX}/share/doc/mutt/samples
5899: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.1 dsieger 5900:
1.184 rillig 5901: Note that the EGDIR variable is specific to that package and has no meaning
5902: outside it.
1.1 dsieger 5903:
1.184 rillig 5904: 20.2.4. Disabling handling of configuration files
1.1 dsieger 5905:
1.184 rillig 5906: The automatic copying of config files can be toggled by setting the environment
5907: variable PKG_CONFIG prior to package installation.
1.1 dsieger 5908:
1.184 rillig 5909: 20.3. System startup scripts
1.1 dsieger 5910:
1.184 rillig 5911: System startup scripts are special files because they must be installed in a
5912: place known by the underlying OS, usually outside the installation prefix.
5913: Therefore, the same rules described in Section 20.1, "Files and directories
5914: outside the installation prefix" apply, and the same solutions can be used.
5915: However, pkginstall provides a special mechanism to handle these files.
1.1 dsieger 5916:
1.184 rillig 5917: In order to provide system startup scripts, the package has to:
1.1 dsieger 5918:
1.184 rillig 5919: 1. Store the script inside ${FILESDIR}, with the .sh suffix appended.
5920: Considering the print/cups package as an example, it has a cupsd.sh in its
5921: files directory.
1.95 wiz 5922:
1.184 rillig 5923: 2. Tell pkginstall to handle it, appending the name of the script, without its
5924: extension, to the RCD_SCRIPTS variable. Continuing the previous example:
1.95 wiz 5925:
1.184 rillig 5926: RCD_SCRIPTS+= cupsd
1.95 wiz 5927:
1.184 rillig 5928: Once this is done, pkginstall will do the following steps for each script in an
5929: automated fashion:
1.95 wiz 5930:
1.184 rillig 5931: 1. Process the file found in the files directory applying all the
5932: substitutions described in the FILES_SUBST variable.
1.1 dsieger 5933:
1.184 rillig 5934: 2. Copy the script from the files directory to the examples hierarchy, $
5935: {PREFIX}/share/examples/rc.d/. Note that this master file must be
5936: explicitly registered in the PLIST.
1.1 dsieger 5937:
1.184 rillig 5938: 3. Add code to the installation scripts to copy the startup script from the
5939: examples hierarchy into the system-wide startup scripts directory.
1.1 dsieger 5940:
1.184 rillig 5941: 20.3.1. Disabling handling of system startup scripts
1.1 dsieger 5942:
1.184 rillig 5943: The automatic copying of config files can be toggled by setting the environment
5944: variable PKG_RCD_SCRIPTS prior to package installation. Note that the scripts
5945: will be always copied inside the examples hierarchy, ${PREFIX}/share/examples/
5946: rc.d/, no matter what the value of this variable is.
1.1 dsieger 5947:
1.184 rillig 5948: 20.4. System users and groups
1.1 dsieger 5949:
1.184 rillig 5950: If a package needs to create special users and/or groups during installation,
5951: it can do so by using the pkginstall framework.
1.1 dsieger 5952:
1.184 rillig 5953: Users can be created by adding entries to the PKG_USERS variable. Each entry
5954: has the following syntax:
1.1 dsieger 5955:
1.184 rillig 5956: user:group
1.1 dsieger 5957:
1.184 rillig 5958: Further specification of user details may be done by setting per-user
5959: variables. PKG_UID.user is the numeric UID for the user. PKG_GECOS.user is the
5960: user's description or comment. PKG_HOME.user is the user's home directory, and
5961: defaults to /nonexistent if not specified. PKG_SHELL.user is the user's shell,
5962: and defaults to /sbin/nologin if not specified.
1.1 dsieger 5963:
1.184 rillig 5964: Similarly, groups can be created by adding entries to the PKG_GROUPS variable,
5965: whose syntax is:
1.1 dsieger 5966:
1.184 rillig 5967: group
1.1 dsieger 5968:
1.184 rillig 5969: The numeric GID of the group may be set by defining PKG_GID.group.
1.1 dsieger 5970:
1.184 rillig 5971: If a package needs to create the users and groups at an earlier stage, then it
5972: can set USERGROUP_PHASE to either configure,build, or pre-install to indicate
5973: the phase before which the users and groups are created. In this case, the
5974: numeric UIDs and GIDs of the created users and groups are automatically
5975: hardcoded into the final installation scripts.
1.1 dsieger 5976:
1.184 rillig 5977: 20.5. System shells
1.1 dsieger 5978:
1.184 rillig 5979: Packages that install system shells should register them in the shell database,
5980: /etc/shells, to make things easier to the administrator. This must be done from
5981: the installation scripts to keep binary packages working on any system.
5982: pkginstall provides an easy way to accomplish this task.
1.1 dsieger 5983:
1.184 rillig 5984: When a package provides a shell interpreter, it has to set the PKG_SHELL
5985: variable to its absolute file name. This will add some hooks to the
5986: installation scripts to handle it. Consider the following example, taken from
5987: shells/zsh:
1.1 dsieger 5988:
1.184 rillig 5989: PKG_SHELL= ${PREFIX}/bin/zsh
1.1 dsieger 5990:
1.184 rillig 5991: 20.5.1. Disabling shell registration
1.1 dsieger 5992:
1.184 rillig 5993: The automatic registration of shell interpreters can be disabled by the
5994: administrator by setting the PKG_REGISTER_SHELLS environment variable to NO.
1.1 dsieger 5995:
1.184 rillig 5996: 20.6. Fonts
1.1 dsieger 5997:
1.184 rillig 5998: Packages that install X11 fonts should update the database files that index the
5999: fonts within each fonts directory. This can easily be accomplished within the
6000: pkginstall framework.
1.1 dsieger 6001:
1.184 rillig 6002: When a package installs X11 fonts, it must list the directories in which fonts
6003: are installed in the FONTS_DIRS.type variables, where type can be one of "ttf",
6004: "type1" or "x11". This will add hooks to the installation scripts to run the
6005: appropriate commands to update the fonts database files within each of those
6006: directories. For convenience, if the directory path is relative, it is taken to
6007: be relative to the package's installation prefix. Consider the following
6008: example, taken from fonts/dbz-ttf:
1.1 dsieger 6009:
1.184 rillig 6010: FONTS_DIRS.ttf= ${PREFIX}/share/fonts/X11/TTF
1.1 dsieger 6011:
1.184 rillig 6012: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 6013:
1.184 rillig 6014: The automatic update of fonts databases can be disabled by the administrator by
6015: setting the PKG_UPDATE_FONTS_DB environment variable to NO.
1.1 dsieger 6016:
1.154 rillig 6017: Chapter 21. Making your package work
1.1 dsieger 6018:
6019: Table of Contents
6020:
1.154 rillig 6021: 21.1. General operation
1.1 dsieger 6022:
1.154 rillig 6023: 21.1.1. How to pull in user-settable variables from mk.conf
6024: 21.1.2. User interaction
6025: 21.1.3. Handling licenses
6026: 21.1.4. Restricted packages
6027: 21.1.5. Handling dependencies
6028: 21.1.6. Handling conflicts with other packages
6029: 21.1.7. Packages that cannot or should not be built
6030: 21.1.8. Packages which should not be deleted, once installed
6031: 21.1.9. Handling packages with security problems
6032: 21.1.10. How to handle incrementing versions when fixing an existing
1.1 dsieger 6033: package
1.154 rillig 6034: 21.1.11. Substituting variable text in the package files (the SUBST
1.1 dsieger 6035: framework)
6036:
1.154 rillig 6037: 21.2. The fetch phase
1.1 dsieger 6038:
1.154 rillig 6039: 21.2.1. Packages whose distfiles aren't available for plain downloading
6040: 21.2.2. How to handle modified distfiles with the 'old' name
6041: 21.2.3. Packages hosted on github.com
6042:
6043: 21.3. The configure phase
6044:
6045: 21.3.1. Shared libraries - libtool
6046: 21.3.2. Using libtool on GNU packages that already support libtool
6047: 21.3.3. GNU Autoconf/Automake
6048:
6049: 21.4. Programming languages
6050:
6051: 21.4.1. C, C++, and Fortran
6052: 21.4.2. Java
1.205 wiz 6053: 21.4.3. Go
6054: 21.4.4. Packages containing Perl scripts
6055: 21.4.5. Packages containing shell scripts
6056: 21.4.6. Other programming languages
1.154 rillig 6057:
6058: 21.5. The build phase
6059:
6060: 21.5.1. Compiling C and C++ code conditionally
6061: 21.5.2. How to handle compiler bugs
1.172 rillig 6062: 21.5.3. No such file or directory
6063: 21.5.4. Undefined reference to "..."
6064: 21.5.5. Running out of memory
1.154 rillig 6065:
6066: 21.6. The install phase
6067:
6068: 21.6.1. Creating needed directories
6069: 21.6.2. Where to install documentation
6070: 21.6.3. Installing highscore files
6071: 21.6.4. Adding DESTDIR support to packages
6072: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 6073: 21.6.6. Packages installing Perl modules
1.154 rillig 6074: 21.6.7. Packages installing info files
6075: 21.6.8. Packages installing man pages
1.203 nia 6076: 21.6.9. Packages installing X11 fonts
6077: 21.6.10. Packages installing SGML or XML data
6078: 21.6.11. Packages installing extensions to the MIME database
6079: 21.6.12. Packages using intltool
6080: 21.6.13. Packages installing startup scripts
6081: 21.6.14. Packages installing TeX modules
6082: 21.6.15. Packages supporting running binaries in emulation
6083: 21.6.16. Packages installing hicolor icons
6084: 21.6.17. Packages installing desktop files
1.1 dsieger 6085:
1.154 rillig 6086: 21.7. Marking packages as having problems
1.1 dsieger 6087:
1.154 rillig 6088: 21.1. General operation
1.1 dsieger 6089:
6090: One appealing feature of pkgsrc is that it runs on many different platforms. As
6091: a result, it is important to ensure, where possible, that packages in pkgsrc
6092: are portable. This chapter mentions some particular details you should pay
6093: attention to while working on pkgsrc.
6094:
1.154 rillig 6095: 21.1.1. How to pull in user-settable variables from mk.conf
1.1 dsieger 6096:
6097: The pkgsrc user can configure pkgsrc by overriding several variables in the
1.4 rillig 6098: file pointed to by MAKECONF, which is mk.conf by default. When you want to use
6099: those variables in the preprocessor directives of make(1) (for example .if or
6100: .for), you need to include the file ../../mk/bsd.prefs.mk before, which in turn
6101: loads the user preferences.
1.1 dsieger 6102:
6103: But note that some variables may not be completely defined after ../../mk/
6104: bsd.prefs.mk has been included, as they may contain references to variables
1.108 rillig 6105: that are not yet defined. In shell commands (the lines in Makefile that are
6106: indented with a tab) this is no problem, since variables are only expanded when
6107: they are used. But in the preprocessor directives mentioned above and in
6108: dependency lines (of the form target: dependencies) the variables are expanded
6109: at load time.
1.1 dsieger 6110:
6111: Note
6112:
1.108 rillig 6113: To check whether a variable can be used at load time, run pkglint -Wall on your
6114: package.
1.1 dsieger 6115:
1.154 rillig 6116: 21.1.2. User interaction
1.1 dsieger 6117:
6118: Occasionally, packages require interaction from the user, and this can be in a
6119: number of ways:
6120:
6121: * When fetching the distfiles, some packages require user interaction such as
6122: entering username/password or accepting a license on a web page.
6123:
6124: * When extracting the distfiles, some packages may ask for passwords.
6125:
6126: * help to configure the package before it is built
6127:
6128: * help during the build process
6129:
6130: * help during the installation of a package
6131:
1.108 rillig 6132: A package can set the INTERACTIVE_STAGE variable to define which stages need
6133: interaction. This should be done in the package's Makefile, e.g.:
1.1 dsieger 6134:
6135: INTERACTIVE_STAGE= configure install
6136:
6137: The user can then decide to skip this package by setting the BATCH variable.
1.108 rillig 6138: Packages that require interaction are also excluded from bulk builds.
1.1 dsieger 6139:
1.154 rillig 6140: 21.1.3. Handling licenses
1.1 dsieger 6141:
6142: Authors of software can choose the licence under which software can be copied.
1.111 sevan 6143: The Free Software Foundation has declared some licenses "Free", and the Open
6144: Source Initiative has a definition of "Open Source".
6145:
6146: By default, pkgsrc allows packages with Free or Open Source licenses to be
6147: built. To allow packages with other licenses to be built as well, the pkgsrc
6148: user needs to add these licenses to the ACCEPTABLE_LICENSES variable in mk.conf
6149: . Note that this variable only affects which packages may be built, while the
6150: license terms often also restrict the actual use of the package and its
6151: redistribution.
1.1 dsieger 6152:
6153: One might want to only install packages with a BSD license, or the GPL, and not
1.20 jnemeth 6154: the other. The free licenses are added to the default ACCEPTABLE_LICENSES
1.111 sevan 6155: variable. The pkgsrc user can override the default by setting the
6156: ACCEPTABLE_LICENSES variable with "=" instead of "+=". The licenses accepted by
6157: default are defined in the DEFAULT_ACCEPTABLE_LICENSES variable in the file
6158: pkgsrc/mk/license.mk.
1.1 dsieger 6159:
6160: The license tag mechanism is intended to address copyright-related issues
6161: surrounding building, installing and using a package, and not to address
1.20 jnemeth 6162: redistribution issues (see RESTRICTED and NO_SRC_ON_FTP, etc.). Packages with
6163: redistribution restrictions should set these tags.
1.1 dsieger 6164:
6165: Denoting that a package may be copied according to a particular license is done
6166: by placing the license in pkgsrc/licenses and setting the LICENSE variable to a
6167: string identifying the license, e.g. in graphics/xv:
6168:
6169: LICENSE= xv-license
6170:
6171: When trying to build, the user will get a notice that the package is covered by
6172: a license which has not been placed in the ACCEPTABLE_LICENSES variable:
6173:
6174: % make
6175: ===> xv-3.10anb9 has an unacceptable license: xv-license.
6176: ===> To view the license, enter "/usr/bin/make show-license".
6177: ===> To indicate acceptance, add this line to your /etc/mk.conf:
6178: ===> ACCEPTABLE_LICENSES+=xv-license
6179: *** Error code 1
6180:
6181: The license can be viewed with make show-license, and if the user so chooses,
1.4 rillig 6182: the line printed above can be added to mk.conf to convey to pkgsrc that it
1.1 dsieger 6183: should not in the future fail because of that license:
6184:
6185: ACCEPTABLE_LICENSES+=xv-license
6186:
1.111 sevan 6187: The use of LICENSE=shareware, LICENSE=no-commercial-use, and similar language
6188: is deprecated because it does not crisply refer to a particular license text.
6189: Another problem with such usage is that it does not enable a user to tell
6190: pkgsrc to proceed for a single package without also telling pkgsrc to proceed
6191: for all packages with that tag.
6192:
1.154 rillig 6193: 21.1.3.1. Adding a package with a new license
1.1 dsieger 6194:
1.49 rodent 6195: When adding a package with a new license, the following steps are required:
6196:
1.111 sevan 6197: 1. Check whether the license qualifies as Free or Open Source by referencing
6198: Various Licenses and Comments about Them and Licenses by Name | Open Source
6199: Initiative. If this is the case, the filename in pkgsrc/licenses/ does not
6200: need the -license suffix, and the license name should be added to:
1.49 rodent 6201:
6202: + DEFAULT_ACCEPTABLE_LICENSES in pkgsrc/mk/license.mk
6203:
6204: + default_acceptable_licenses in pkgsrc/pkgtools/pkg_install/files/lib/
6205: license.c
6206:
6207: 2. The license text should be added to pkgsrc/licenses for displaying. A list
6208: of known licenses can be seen in this directory.
1.1 dsieger 6209:
1.154 rillig 6210: 21.1.3.2. Change to the license
1.1 dsieger 6211:
1.111 sevan 6212: When the license changes (in a way other than formatting), make sure that the
6213: new license has a different name (e.g., append the version number if it exists,
6214: or the date). Just because a user told pkgsrc to build programs under a
6215: previous version of a license does not mean that pkgsrc should build programs
6216: under the new licenses. The higher-level point is that pkgsrc does not evaluate
6217: licenses for reasonableness; the only test is a mechanistic test of whether a
6218: particular text has been approved by either of two bodies (FSF or OSI).
1.1 dsieger 6219:
1.154 rillig 6220: 21.1.4. Restricted packages
1.1 dsieger 6221:
1.111 sevan 6222: Some licenses restrict how software may be re-distributed. By declaring the
6223: restrictions, package tools can automatically refrain from e.g. placing binary
6224: packages on FTP sites.
6225:
6226: There are four possible restrictions, which are the cross product of sources
6227: (distfiles) and binaries not being placed on FTP sites and CD-ROMs. Because
6228: this is rarely the exact language in any license, and because non-Free licenses
6229: tend to be different from each other, pkgsrc adopts a definition of FTP and
6230: CD-ROM. "FTP" means making the source or binary file available over the
6231: Internet at no charge. "CD-ROM" means making the source or binary available on
6232: some kind of media, together with other source and binary packages, which is
6233: sold for a distribution charge.
1.1 dsieger 6234:
6235: In order to encode these restrictions, the package system defines five make
6236: variables that can be set to note these restrictions:
6237:
6238: * RESTRICTED
6239:
6240: This variable should be set whenever a restriction exists (regardless of
6241: its kind). Set this variable to a string containing the reason for the
6242: restriction. It should be understood that those wanting to understand the
6243: restriction will have to read the license, and perhaps seek advice of
6244: counsel.
6245:
6246: * NO_BIN_ON_CDROM
6247:
6248: Binaries may not be placed on CD-ROM containing other binary packages, for
6249: which a distribution charge may be made. In this case, set this variable to
6250: ${RESTRICTED}.
6251:
6252: * NO_BIN_ON_FTP
6253:
6254: Binaries may not made available on the Internet without charge. In this
6255: case, set this variable to ${RESTRICTED}. If this variable is set, binary
6256: packages will not be included on ftp.NetBSD.org.
6257:
6258: * NO_SRC_ON_CDROM
6259:
6260: Distfiles may not be placed on CD-ROM, together with other distfiles, for
6261: which a fee may be charged. In this case, set this variable to $
6262: {RESTRICTED}.
6263:
6264: * NO_SRC_ON_FTP
6265:
6266: Distfiles may not made available via FTP at no charge. In this case, set
6267: this variable to ${RESTRICTED}. If this variable is set, the distfile(s)
6268: will not be mirrored on ftp.NetBSD.org.
6269:
1.111 sevan 6270: Please note that packages will be removed from pkgsrc when the distfiles are
1.33 wiz 6271: not distributable and cannot be obtained for a period of one full quarter
1.111 sevan 6272: branch. Packages with manual/interactive fetch must have a maintainer and it is
6273: his/her responsibility to ensure this.
1.33 wiz 6274:
1.154 rillig 6275: 21.1.5. Handling dependencies
1.1 dsieger 6276:
1.175 gutterid 6277: Your package may depend on some other package being present, and there are
6278: various ways of expressing this dependency. pkgsrc supports the DEPENDS,
6279: BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS definitions, the USE_TOOLS
6280: definition, as well as dependencies via buildlink3.mk, which is the preferred
6281: way to handle dependencies, and which uses the variables named above. See
1.184 rillig 6282: Chapter 18, Buildlink methodology for more information.
1.175 gutterid 6283:
6284: The basic difference is that the DEPENDS definition registers that
6285: pre-requisite in the binary package so it will be pulled in when the binary
6286: package is later installed, whilst the BUILD_DEPENDS, TOOL_DEPENDS, and
6287: TEST_DEPENDS definitions do not, marking a dependency that is only needed for
1.184 rillig 6288: building or testing the resulting package. See also Chapter 14, Creating a new
1.175 gutterid 6289: pkgsrc package from scratch for more information.
6290:
6291: This means that if you only need a package present whilst you are building or
6292: testing, it should be noted as a TOOL_DEPENDS, BUILD_DEPENDS, or TEST_DEPENDS.
6293: When cross-compiling, TOOL_DEPENDS are native packages, i.e. packages for the
6294: architecture where the package is built; BUILD_DEPENDS are target packages,
6295: i.e., packages for the architecture for which the package is built.
1.1 dsieger 6296:
1.175 gutterid 6297: The format for a DEPENDS, BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS
6298: definition is:
1.1 dsieger 6299:
6300: <pre-req-package-name>:../../<category>/<pre-req-package>
6301:
6302: Please note that the "pre-req-package-name" may include any of the wildcard
6303: version numbers recognized by pkg_info(1).
6304:
1.55 wiz 6305: 1. If your package needs another package's binaries or libraries to build and
1.1 dsieger 6306: run, and if that package has a buildlink3.mk file available, use it:
6307:
6308: .include "../../graphics/jpeg/buildlink3.mk"
6309:
1.55 wiz 6310: 2. If your package needs another package's binaries or libraries only for
6311: building, and if that package has a buildlink3.mk file available, use it:
6312:
6313: .include "../../graphics/jpeg/buildlink3.mk"
6314:
6315: but set BUILDLINK_DEPMETHOD.jpeg?=build to make it a build dependency only.
6316: This case is rather rare.
6317:
6318: 3. If your package needs binaries from another package to build, use the
1.156 leot 6319: TOOL_DEPENDS definition:
6320:
6321: TOOL_DEPENDS+= itstool-[0-9]*:../../textproc/itstool
1.1 dsieger 6322:
1.156 leot 6323: 4. If your package needs static libraries to link against, header files to
6324: include, etc. from another package to build, use the BUILD_DEPENDS
6325: definition.
1.1 dsieger 6326:
1.156 leot 6327: 5. If your package needs a library with which to link and there is no
1.26 spz 6328: buildlink3.mk file available, create one. Using DEPENDS won't be sufficient
6329: because the include files and libraries will be hidden from the compiler.
1.1 dsieger 6330:
1.156 leot 6331: 6. If your package needs some executable to be able to run correctly and if
1.26 spz 6332: there's no buildlink3.mk file, this is specified using the DEPENDS
6333: variable. The print/lyx package needs to be able to execute the latex
1.129 wiz 6334: binary from the tex-latex-bin package when it runs, and that is specified:
1.1 dsieger 6335:
1.129 wiz 6336: DEPENDS+= tex-latex-bin-[0-9]*:../../print/tex-latex-bin
1.1 dsieger 6337:
1.175 gutterid 6338: 7. If your package includes a test suite that has extra dependencies only
6339: required for this purpose (frequently this can be run as a "make test"
6340: target), use the TEST_DEPENDS variable.
6341:
6342: 8. You can use wildcards in package dependencies. Note that such wildcard
1.26 spz 6343: dependencies are retained when creating binary packages. The dependency is
6344: checked when installing the binary package and any package which matches
6345: the pattern will be used. Wildcard dependencies should be used with care.
1.1 dsieger 6346:
6347: The "-[0-9]*" should be used instead of "-*" to avoid potentially ambiguous
6348: matches such as "tk-postgresql" matching a "tk-*" DEPENDS.
6349:
6350: Wildcards can also be used to specify that a package will only build
6351: against a certain minimum version of a pre-requisite:
6352:
1.26 spz 6353: DEPENDS+= ImageMagick>=6.0:../../graphics/ImageMagick
1.1 dsieger 6354:
1.26 spz 6355: This means that the package will build using version 6.0 of ImageMagick or
6356: newer. Such a dependency may be warranted if, for example, the command line
6357: options of an executable have changed.
6358:
1.183 wiz 6359: If you need to depend on minimum versions of libraries, set
6360: BUILDLINK_API_DEPENDS.pkg to the appropriate pattern before including its
6361: buildlink3.mk file, e.g.
6362:
6363: BUILDLINK_API_DEPENDS.jpeg+= jpeg>=9.0
6364: .include "../../graphics/jpeg/buildlink3.mk"
1.1 dsieger 6365:
6366: For security fixes, please update the package vulnerabilities file. See
1.154 rillig 6367: Section 21.1.9, "Handling packages with security problems" for more
1.1 dsieger 6368: information.
6369:
6370: If your package needs files from another package to build, add the relevant
6371: distribution files to DISTFILES, so they will be extracted automatically. See
6372: the print/ghostscript package for an example. (It relies on the jpeg sources
6373: being present in source form during the build.)
6374:
1.154 rillig 6375: 21.1.6. Handling conflicts with other packages
1.1 dsieger 6376:
6377: Your package may conflict with other packages a user might already have
6378: installed on his system, e.g. if your package installs the same set of files as
1.80 wiz 6379: another package in the pkgsrc tree or has the same PKGNAME.
1.1 dsieger 6380:
1.142 leot 6381: For example, x11/libXaw3d and x11/Xaw-Xpm install the same shared library, thus
6382: you set in pkgsrc/x11/libXaw3d/Makefile:
1.1 dsieger 6383:
1.142 leot 6384: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 dsieger 6385:
6386:
1.142 leot 6387: and in pkgsrc/x11/Xaw-Xpm/Makefile:
1.1 dsieger 6388:
1.142 leot 6389: CONFLICTS= libXaw3d-[0-9]*
1.1 dsieger 6390:
1.142 leot 6391:
6392: pkg_add(1) is able to detect attempts to install packages that conflict with
6393: existing packages and abort. However, in many situations this is too late in
6394: the process. Binary package managers will not know about the conflict until
6395: they attempt to install the package after already downloading it and all its
6396: dependencies. Users may also waste time building a package and its dependencies
6397: only to find out at the end that it conflicts with another package they have
6398: installed.
6399:
6400: To avoid these issues CONFLICTS entries should be added in all cases where it
6401: is known that packages conflict with each other. These CONFLICTS entries are
6402: exported in pkg_summary(5) files and consumed by binary package managers to
6403: inform users that packages cannot be installed onto the target system.
1.1 dsieger 6404:
1.154 rillig 6405: 21.1.7. Packages that cannot or should not be built
1.1 dsieger 6406:
6407: There are several reasons why a package might be instructed to not build under
6408: certain circumstances. If the package builds and runs on most platforms, the
1.83 dholland 6409: exceptions should be noted with BROKEN_ON_PLATFORM. If the package builds and
6410: runs on a small handful of platforms, set BROKEN_EXCEPT_ON_PLATFORM instead.
6411: Both BROKEN_ON_PLATFORM and BROKEN_EXCEPT_ON_PLATFORM are OS triples
6412: (OS-version-platform) that can use glob-style wildcards.
6413:
1.114 maya 6414: If a package is not appropriate for some platforms (as opposed to merely
1.83 dholland 6415: broken), a different set of variables should be used as this affects failure
6416: reporting and statistics. If the package is appropriate for most platforms, the
6417: exceptions should be noted with NOT_FOR_PLATFORM. If the package is appropriate
6418: for only a small handful of platforms (often exactly one), set
6419: ONLY_FOR_PLATFORM instead. Both ONLY_FOR_PLATFORM and NOT_FOR_PLATFORM are OS
6420: triples (OS-version-platform) that can use glob-style wildcards.
1.1 dsieger 6421:
6422: Some packages are tightly bound to a specific version of an operating system,
6423: e.g. LKMs or sysutils/lsof. Such binary packages are not backwards compatible
6424: with other versions of the OS, and should be uploaded to a version specific
6425: directory on the FTP server. Mark these packages by setting OSVERSION_SPECIFIC
6426: to "yes". This variable is not currently used by any of the package system
6427: internals, but may be used in the future.
6428:
6429: If the package should be skipped (for example, because it provides
6430: functionality already provided by the system), set PKG_SKIP_REASON to a
6431: descriptive message. If the package should fail because some preconditions are
6432: not met, set PKG_FAIL_REASON to a descriptive message.
6433:
1.154 rillig 6434: 21.1.8. Packages which should not be deleted, once installed
1.1 dsieger 6435:
6436: To ensure that a package may not be deleted, once it has been installed, the
6437: PKG_PRESERVE definition should be set in the package Makefile. This will be
1.25 wiz 6438: carried into any binary package that is made from this pkgsrc entry. A "
6439: preserved" package will not be deleted using pkg_delete(1) unless the "-f"
1.1 dsieger 6440: option is used.
6441:
1.154 rillig 6442: 21.1.9. Handling packages with security problems
1.1 dsieger 6443:
6444: When a vulnerability is found, this should be noted in localsrc/security/
1.205 wiz 6445: advisories/pkg-vulnerabilities. Entries in that file consist of three parts:
6446:
6447: * package version pattern
6448:
6449: * type of vulnerability (please cut'n'paste an existing one where possible)
6450:
6451: * URL providing additional information about the issue
6452:
6453: For the package version pattern please always use `<' to mark an upper bound
6454: (not `<='!). This will avoid possible problems due unrelated PKGREVISION bumps
6455: not related to security fixes. Lower bounds can be added too, using '>' or '>=
1.206 wiz 6456: '. For example, "foo>=1<1.2" would mark versions 1.0 (included) to 1.2
1.205 wiz 6457: (excluded) of "foo" as affected by the security issue.
6458:
6459: Entries should always be added at the bottom of the file.
6460:
6461: When fixing packages, please modify the upper bound of the corresponding entry.
6462: To continue the previous example, if a fix was backported to version 1.1nb2,
1.206 wiz 6463: change the previous pattern to "foo>=1<1.1nb2".
1.205 wiz 6464:
6465: To locally test a package version pattern against a PKGNAME you can use the
6466: pkg_admin pmatch command.
6467:
6468: The URL should be as permanent as possible and provide as much information
6469: about the issue as possible. CVE entries are preferred.
6470:
6471: After committing that file, ask pkgsrc-security@NetBSD.org to update the file
6472: on ftp.NetBSD.org.
1.1 dsieger 6473:
6474: After fixing the vulnerability by a patch, its PKGREVISION should be increased
6475: (this is of course not necessary if the problem is fixed by using a newer
1.32 wiz 6476: release of the software), and the pattern in the pkg-vulnerabilities file must
6477: be updated.
1.1 dsieger 6478:
6479: Also, if the fix should be applied to the stable pkgsrc branch, be sure to
6480: submit a pullup request!
6481:
6482: Binary packages already on ftp.NetBSD.org will be handled semi-automatically by
6483: a weekly cron job.
6484:
1.205 wiz 6485: In case a security issue is disputed, please contact
6486: pkgsrc-security@NetBSD.org.
6487:
1.154 rillig 6488: 21.1.10. How to handle incrementing versions when fixing an existing package
1.1 dsieger 6489:
6490: When making fixes to an existing package it can be useful to change the version
6491: number in PKGNAME. To avoid conflicting with future versions by the original
6492: author, a "nb1", "nb2", ... suffix can be used on package versions by setting
6493: PKGREVISION=1 (2, ...). The "nb" is treated like a "." by the package tools.
6494: e.g.
6495:
6496: DISTNAME= foo-17.42
6497: PKGREVISION= 9
6498:
6499: will result in a PKGNAME of "foo-17.42nb9". If you want to use the original
6500: value of PKGNAME without the "nbX" suffix, e.g. for setting DIST_SUBDIR, use
6501: PKGNAME_NOREV.
6502:
6503: When a new release of the package is released, the PKGREVISION should be
6504: removed, e.g. on a new minor release of the above package, things should be
6505: like:
6506:
6507: DISTNAME= foo-17.43
6508:
6509: PKGREVISION should be incremented for any non-trivial change in the resulting
6510: binary package. Without a PKGREVISION bump, someone with the previous version
6511: installed has no way of knowing that their package is out of date. Thus,
6512: changes without increasing PKGREVISION are essentially labeled "this is so
6513: trivial that no reasonable person would want to upgrade", and this is the rough
6514: test for when increasing PKGREVISION is appropriate. Examples of changes that
6515: do not merit increasing PKGREVISION are:
6516:
1.14 jmcneill 6517: * Changing HOMEPAGE, MAINTAINER, OWNER, or comments in Makefile.
1.1 dsieger 6518:
6519: * Changing build variables if the resulting binary package is the same.
6520:
6521: * Changing DESCR.
6522:
6523: * Adding PKG_OPTIONS if the default options don't change.
6524:
6525: Examples of changes that do merit an increase to PKGREVISION include:
6526:
6527: * Security fixes
6528:
6529: * Changes or additions to a patch file
6530:
6531: * Changes to the PLIST
6532:
1.12 weinem 6533: * A dependency is changed or renamed.
6534:
1.1 dsieger 6535: PKGREVISION must also be incremented when dependencies have ABI changes.
6536:
1.154 rillig 6537: 21.1.11. Substituting variable text in the package files (the SUBST framework)
1.1 dsieger 6538:
1.180 rillig 6539: When you want to replace the same text in multiple files, or multiple times in
6540: the same file, it is cumbersome to maintain a patch file for this. This is
6541: where the SUBST framework steps in. It provides an easy-to-use interface for
6542: replacing text in files. It just needs the following information:
1.172 rillig 6543:
1.180 rillig 6544: * In which phase of the package build cycle should the replacement happen?
1.172 rillig 6545:
1.180 rillig 6546: * In which files should the replacement happen?
1.172 rillig 6547:
6548: * Which text should be replaced with what?
6549:
1.180 rillig 6550: This information is encoded in a block of SUBST variables. A minimal example
6551: is:
6552:
6553: SUBST_CLASSES+= paths
6554: SUBST_STAGE.paths= pre-configure
6555: SUBST_FILES.paths= src/*.c
6556: SUBST_SED.paths= -e 's,/usr/local,${PREFIX},g'
6557:
6558: Translated into English, it means: In the pre-configure stage (that is, after
6559: applying the patches from the patches/ directory and before running the
6560: configure script and the portability check), replace the text /usr/local with
6561: the content of the variable PREFIX.
6562:
6563: Each SUBST block starts by appending an identifier to SUBST_CLASSES (note the +
6564: =). This identifier can be chosen freely by the package. If there should ever
6565: be duplicate identifiers, the pkgsrc infrastructure will catch this and fail
6566: early, so don't worry about name collisions.
6567:
6568: Except for SUBST_CLASSES, all variables in a SUBST block are parameterized
6569: using this identifier. In the remainder of this section, these parameterized
6570: variables are written as SUBST_STAGE.*.
6571:
6572: SUBST_CLASSES+= paths
6573: SUBST_STAGE.paths= pre-configure
6574: SUBST_MESSAGE.paths= Fixing absolute paths.
6575: SUBST_FILES.paths= src/*.c
6576: SUBST_FILES.paths+= scripts/*.sh
6577: SUBST_SED.paths= -e 's,"/usr/local,"${PREFIX},g'
6578: SUBST_SED.paths+= -e 's,"/var/log,"${VARBASE}/log,g'
6579: SUBST_VARS.paths= LOCALBASE PREFIX PKGVERSION
6580:
6581: To get a complete picture about the SUBST substitutions, run bmake
6582: show-all-subst. If something doesn't work as expected, run pkglint on the
6583: package, which detects several typical mistakes surrounding the SUBST blocks.
6584: For any questions that might remain after this, have a look at mk/subst.mk.
6585:
6586: 21.1.11.1. Choosing the time where the substitutions happen
6587:
6588: The SUBST_STAGE.* is one of {pre,do,post}-
6589: {extract,patch,configure,build,test,install}. Of these, pre-configure is used
6590: most often, by far. The most popular stages are, in chronological order:
6591:
6592: post-extract
6593:
6594: The substitutions are applied immediately after the distfiles are
6595: extracted. Running bmake extract on the package will leave no traces of the
6596: original files.
6597:
6598: When the substitution applies to files for which there is also a patch in
6599: the patches/ directory, this means that the patches will be computed based
6600: on the result of the substitution. When these patches are sent to the
6601: upstream maintainer later, to be fixed in the upstream package, these
6602: patches may no longer match what the upstream author is used to. Because of
6603: this, pre-configure is often a better choice.
6604:
6605: pre-configure
6606:
6607: The substitutions are applied after the patches from the patches/
6608: directory. This makes it possible to run bmake patch on the package, after
6609: which the patches can be edited using the tools pkgvi and mkpatches from
6610: the pkgtools/pkgdiff package.
6611:
6612: When updating the patches, it is helpful to explicitly separate the bmake
6613: patch from the bmake configure, and to only edit the patches between these
6614: commands. Otherwise the substitutions from the SUBST block will end up in
6615: the patch file. When this happens in really obvious ways, pkglint will
6616: complain about patches that contain a hard-coded /usr/pkg instead of the
6617: correct and intended @PREFIX@, but it can only detect these really obvious
6618: cases.
6619:
6620: do-configure
6621:
6622: This stage should only be used if the package defines a pre-configure
6623: action itself, and the substitution must happen after that. Typical
6624: examples are packages that use the pre-configure stage to regenerate the
6625: GNU configure script from configure.ac.
6626:
6627: post-configure
6628:
6629: This stage is used to fix up any mistakes by the configure stage.
6630:
6631: pre-build
6632:
6633: This stage should only be used for substitutions that are clearly related
6634: to building the package, not for fixing the configuration. Substitutions
6635: for pathnames (such as replacing /usr/local with ${PREFIX}) or user names
6636: (such as replacing @MY_USER@ with the actual username) belong in
6637: pre-configure or post-configure instead.
6638:
6639: post-build
6640:
6641: Just as with pre-build, this stage should only be used for substitutions
6642: that are clearly related to building the package, not for fixing the
6643: configuration. Substitutions for pathnames (such as replacing /usr/local
6644: with ${PREFIX}) or user names (such as replacing @MY_USER@ with the actual
6645: username) belong in pre-configure or post-configure instead.
6646:
6647: A typical use is to update pkg-config files to include the rpath compiler
6648: options.
6649:
6650: pre-install
6651:
6652: In general, the install phase should be as simple as possible. As with the
6653: pre-build and post-build stages, it should not be used to fix pathnames or
6654: user names, these belong in pre-configure instead. There are only few
6655: legitimate use cases for applying substitutions in this stage.
6656:
1.181 rillig 6657: 21.1.11.2. Choosing the files where the substitutions happen
1.180 rillig 6658:
6659: The SUBST_FILES.* variable contains a list of filename patterns. These patterns
6660: are relative to WRKSRC since that is where most substitutions happen. A typical
6661: example is:
6662:
6663: SUBST_FILES.path= Makefile */Makefile */*/Makefile *.[ch]
6664:
6665: The above patterns, especially the last, are quite broad. The SUBST
6666: implementation checks that each filename pattern that is mentioned here has an
6667: effect. For example, if none of the */*/Makefile files contains the patterns to
6668: be found and substituted, that filename pattern is redundant and should be left
1.181 rillig 6669: out. By default, the SUBST framework will complain with an error message. If
6670: the text to be substituted occurs in some of the files from a single pattern,
6671: but not in all of them, that is totally ok, and the SUBST framework will only
6672: print an INFO message for those files.
1.180 rillig 6673:
6674: If there is a good reason for having redundant filename patterns, set
1.181 rillig 6675: SUBST_NOOP_OK.* to yes.
1.180 rillig 6676:
6677: Another popular way of choosing the files for the substitutions is via a shell
6678: command, like this:
6679:
1.181 rillig 6680: C_FILES_CMD= cd ${WRKSRC} && ${FIND} . -name '*.c'
1.180 rillig 6681: SUBST_FILES.path= ${C_FILES_CMD:sh}
6682:
6683: The variable name C_FILES_CMD in this example is freely chosen and independent
6684: of the SUBST framework.
6685:
6686: In this variant, the SUBST_FILES.* variable lists each file individually.
6687: Thereby chances are higher that there are filename patterns in which no
6688: substitution happens. Since the SUBST framework cannot know whether the
6689: filename patterns in SUBST_FILES.* have been explicitly listed in the Makefile
6690: (where any redundant filename pattern would be suspicious) or been generated by
6691: a shell command (in which redundant filename patterns are more likely and to be
6692: expected), it will complain about these redundant filename patterns. Therefore,
6693: SUBST blocks that use a shell command to generate the list of filename patterns
6694: often need to set SUBST_NOOP_OK.* to yes.
6695:
6696: 21.1.11.3. Choosing what to substitute
6697:
6698: In most cases, the substitutions are given using one or more sed(1) commands,
6699: like this:
6700:
6701: SUBST_SED.path= -e 's|/usr/local|${PREFIX}|g'
6702:
6703: Each of the sed commands needs to be preceded by the -e option and should be
6704: specified on a line of its own, to avoid hiding short sed commands at the end
6705: of a line.
6706:
6707: Since the sed commands often contain shell metacharacters as the separator (the
6708: | in the above example), it is common to enclose them in single quotes.
6709:
6710: A common substitution is to replace placeholders of the form @VARNAME@ with
6711: their pkgsrc counterpart variable ${VARNAME}. A typical example is:
6712:
6713: SUBST_VARS.path= PREFIX
6714:
1.181 rillig 6715: This type of substitutions is typically done by the GNU configure scripts
6716: during the do-configure stage, but in some cases these need to be overridden.
6717: The same pattern is also used when a package defines patches that replace
6718: previously hard-coded paths like /usr/local with a @PREFIX@ placeholder first,
6719: which then gets substituted by the actual ${PREFIX} in the pre-configure stage.
6720: In many of these cases, it works equally well to just use the SUBST framework
6721: to directly replace /usr/local with ${PREFIX}, thereby omitting the
6722: intermediate patch file.
1.180 rillig 6723:
6724: If the above is not flexible enough, it is possible to not use sed at all for
6725: the substitution but to specify an entirely different command, like this:
6726:
6727: SUBST_FILTER_CMD.path= LC_ALL=C ${TR} -d '\r'
1.1 dsieger 6728:
1.180 rillig 6729: This is used for the few remaining packages in which the distributed files use
6730: Windows-style line endings that need to be converted to UNIX-style line
6731: endings.
1.1 dsieger 6732:
1.180 rillig 6733: 21.1.11.4. Other SUBST variables
1.172 rillig 6734:
1.180 rillig 6735: When a SUBST block is applied during a package build, a message is logged. The
6736: default message is fine for most purposes but can be overridden by setting
6737: SUBST_MESSAGE.* to an individual message.
1.1 dsieger 6738:
1.154 rillig 6739: 21.2. The fetch phase
1.1 dsieger 6740:
1.154 rillig 6741: 21.2.1. Packages whose distfiles aren't available for plain downloading
1.1 dsieger 6742:
6743: If you need to download from a dynamic URL you can set DYNAMIC_MASTER_SITES and
6744: a make fetch will call files/getsite.sh with the name of each file to download
6745: as an argument, expecting it to output the URL of the directory from which to
6746: download it. graphics/ns-cult3d is an example of this usage.
6747:
6748: If the download can't be automated, because the user must submit personal
6749: information to apply for a password, or must pay for the source, or whatever,
6750: you can set FETCH_MESSAGE to a list of lines that are displayed to the user
6751: before aborting the build. Example:
6752:
6753: FETCH_MESSAGE= "Please download the files"
6754: FETCH_MESSAGE+= " "${DISTFILES:Q}
6755: FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"."
6756:
1.154 rillig 6757: 21.2.2. How to handle modified distfiles with the 'old' name
1.1 dsieger 6758:
6759: Sometimes authors of a software package make some modifications after the
6760: software was released, and they put up a new distfile without changing the
6761: package's version number. If a package is already in pkgsrc at that time, the
6762: checksum will no longer match. The contents of the new distfile should be
6763: compared against the old one before changing anything, to make sure the
6764: distfile was really updated on purpose, and that no trojan horse or so crept
6765: in. Please mention that the distfiles were compared and what was found in your
1.54 rodent 6766: commit message.
6767:
6768: Then, the correct way to work around this is to set DIST_SUBDIR to a unique
1.109 wiz 6769: directory name, usually based on PKGNAME_NOREV (but take care with python or
6770: ruby packages, where PKGNAME includes a variable prefix). All DISTFILES and
6771: PATCHFILES for this package will be put in that subdirectory of the local
1.154 rillig 6772: distfiles directory. (See Section 21.1.10, "How to handle incrementing versions
1.109 wiz 6773: when fixing an existing package" for more details.) In case this happens more
6774: often, PKGNAME can be used (thus including the nbX suffix) or a date stamp can
6775: be appended, like ${PKGNAME_NOREV}-YYYYMMDD.
1.54 rodent 6776:
6777: DIST_SUBDIR is also used when a distfile's name does not contain a version and
6778: the distfile is apt to change. In cases where the likelihood of this is very
6779: small, DIST_SUBDIR might not be required. Additionally, DIST_SUBDIR must not be
6780: removed unless the distfile name changes, even if a package is being moved or
6781: renamed.
6782:
6783: Do not forget regenerating the distinfo file after that, since it contains the
6784: DIST_SUBDIR path in the filenames. Also, increase the PKGREVISION if the
6785: installed package is different. Furthermore, a mail to the package's authors
6786: seems appropriate telling them that changing distfiles after releases without
6787: changing the file names is not good practice.
1.1 dsieger 6788:
1.154 rillig 6789: 21.2.3. Packages hosted on github.com
1.88 tnn 6790:
1.90 tnn 6791: Helper methods exist for packages hosted on github.com which will often have
6792: distfile names that clash with other packages, for example 1.0.tar.gz. Use one
6793: of the three recipes from below:
1.88 tnn 6794:
1.154 rillig 6795: 21.2.3.1. Fetch based on a tagged release
1.88 tnn 6796:
1.189 bacon 6797: If your distfile URL looks similar to https://github.com/username/example/
6798: archive/v1.0.zip, then you are packaging a tagged release.
1.88 tnn 6799:
1.189 bacon 6800: DISTNAME= example-1.0
1.90 tnn 6801: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
1.189 bacon 6802: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
1.90 tnn 6803: GITHUB_TAG= v${PKGVERSION_NOREV}
1.88 tnn 6804: EXTRACT_SUFX= .zip
6805:
1.189 bacon 6806: 21.2.3.2. Fetch based on a specific commit before the first release
6807:
6808: If your distfile looks similar to https://github.com/username/example/archive/
6809: 988881adc9fc3655077dc2d4d757d480b5ea0e11 and is from a commit before the first
6810: release, then set the package version to 0.0.0.N, where N is the number of
6811: commits to the repository, and set GITHUB_TAG to the commit hash. This will
6812: (almost) ensure that the first tagged release will have a version greater than
6813: this one so that package upgrades will function properly.
6814:
6815: DISTNAME= example-0.0.0.347
6816: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6817: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
6818: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
6819:
6820: 21.2.3.3. Fetch based on a specific commit after a release
1.88 tnn 6821:
1.189 bacon 6822: If your distfile looks similar to https://github.com/username/example/archive/
6823: 988881adc9fc3655077dc2d4d757d480b5ea0e11 and is from a commit after a release,
6824: then include the last release version and the commit count since that release
6825: in the package version and set GITHUB_TAG to the commit hash. The latest
6826: release and commit count are shown in the output of "git describe --tags":
6827:
6828: # git clone https://github.com/username/example
6829: # cd example
6830: # git describe --tags
6831: 1.2.3-5-g988881a
1.88 tnn 6832:
1.189 bacon 6833: DISTNAME= example-1.2.3.5
6834: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6835: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
1.90 tnn 6836: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
1.88 tnn 6837:
1.189 bacon 6838: 21.2.3.4. Fetch based on release
1.88 tnn 6839:
1.189 bacon 6840: If your distfile URL looks similar to https://github.com/username/example/
6841: releases/download/rel-1.6/offensive-1.6.zip, then you are packaging a release.
1.88 tnn 6842:
1.90 tnn 6843: DISTNAME= offensive-1.6
1.88 tnn 6844: PKGNAME= ${DISTNAME:S/offensive/proper/}
1.90 tnn 6845: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
1.189 bacon 6846: GITHUB_PROJECT= example
1.90 tnn 6847: GITHUB_RELEASE= rel-${PKGVERSION_NOREV} # usually just set this to ${DISTNAME}
6848: EXTRACT_SUFX= .zip
1.88 tnn 6849:
1.154 rillig 6850: 21.3. The configure phase
1.1 dsieger 6851:
1.154 rillig 6852: 21.3.1. Shared libraries - libtool
1.1 dsieger 6853:
6854: pkgsrc supports many different machines, with different object formats like
6855: a.out and ELF, and varying abilities to do shared library and dynamic loading
6856: at all. To accompany this, varying commands and options have to be passed to
6857: the compiler, linker, etc. to get the Right Thing, which can be pretty annoying
6858: especially if you don't have all the machines at your hand to test things. The
6859: devel/libtool pkg can help here, as it just "knows" how to build both static
6860: and dynamic libraries from a set of source files, thus being
6861: platform-independent.
6862:
6863: Here's how to use libtool in a package in seven simple steps:
6864:
6865: 1. Add USE_LIBTOOL=yes to the package Makefile.
6866:
6867: 2. For library objects, use "${LIBTOOL} --mode=compile ${CC}" in place of "$
6868: {CC}". You could even add it to the definition of CC, if only libraries are
6869: being built in a given Makefile. This one command will build both PIC and
6870: non-PIC library objects, so you need not have separate shared and
6871: non-shared library rules.
6872:
6873: 3. For the linking of the library, remove any "ar", "ranlib", and "ld
6874: -Bshareable" commands, and instead use:
6875:
6876: ${LIBTOOL} --mode=link \
6877: ${CC} -o ${.TARGET:.a=.la} \
6878: ${OBJS:.o=.lo} \
6879: -rpath ${PREFIX}/lib \
6880: -version-info major:minor
6881:
6882: Note that the library is changed to have a .la extension, and the objects
6883: are changed to have a .lo extension. Change OBJS as necessary. This
6884: automatically creates all of the .a, .so.major.minor, and ELF symlinks (if
6885: necessary) in the build directory. Be sure to include "-version-info",
6886: especially when major and minor are zero, as libtool will otherwise strip
6887: off the shared library version.
6888:
6889: From the libtool manual:
6890:
6891: So, libtool library versions are described by three integers:
6892:
6893: CURRENT
6894: The most recent interface number that this library implements.
6895:
6896: REVISION
6897: The implementation number of the CURRENT interface.
6898:
6899: AGE
6900: The difference between the newest and oldest interfaces that
6901: this library implements. In other words, the library implements
6902: all the interface numbers in the range from number `CURRENT -
6903: AGE' to `CURRENT'.
6904:
6905: If two libraries have identical CURRENT and AGE numbers, then the
6906: dynamic linker chooses the library with the greater REVISION number.
6907:
6908: The "-release" option will produce different results for a.out and ELF
1.25 wiz 6909: (excluding symlinks) in only one case. An ELF library of the form "
6910: libfoo-release.so.x.y" will have a symlink of "libfoo.so.x.y" on an a.out
1.1 dsieger 6911: platform. This is handled automatically.
6912:
6913: The "-rpath argument" is the install directory of the library being built.
6914:
6915: In the PLIST, include only the .la file, the other files will be added
6916: automatically.
6917:
6918: 4. When linking shared object (.so) files, i.e. files that are loaded via
6919: dlopen(3), NOT shared libraries, use "-module -avoid-version" to prevent
6920: them getting version tacked on.
6921:
6922: The PLIST file gets the foo.so entry.
6923:
6924: 5. When linking programs that depend on these libraries before they are
6925: installed, preface the cc(1) or ld(1) line with "${LIBTOOL} --mode=link",
6926: and it will find the correct libraries (static or shared), but please be
6927: aware that libtool will not allow you to specify a relative path in -L
6928: (such as "-L../somelib"), because it expects you to change that argument to
6929: be the .la file. e.g.
6930:
6931: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
6932:
6933: should be changed to:
6934:
6935: ${LIBTOOL} --mode=link ${CC} -o someprog ../somelib/somelib.la
6936:
6937: and it will do the right thing with the libraries.
6938:
6939: 6. When installing libraries, preface the install(1) or cp(1) command with "$
6940: {LIBTOOL} --mode=install", and change the library name to .la. e.g.
6941:
1.23 jakllsch 6942: ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 dsieger 6943:
6944: This will install the static .a, shared library, any needed symlinks, and
6945: run ldconfig(8).
6946:
6947: 7. In your PLIST, include only the .la file (this is a change from previous
6948: behaviour).
6949:
1.154 rillig 6950: 21.3.2. Using libtool on GNU packages that already support libtool
1.1 dsieger 6951:
6952: Add USE_LIBTOOL=yes to the package Makefile. This will override the package's
6953: own libtool in most cases. For older libtool using packages, libtool is made by
6954: ltconfig script during the do-configure step; you can check the libtool script
6955: location by doing make configure; find work*/ -name libtool.
6956:
6957: LIBTOOL_OVERRIDE specifies which libtool scripts, relative to WRKSRC, to
6958: override. By default, it is set to "libtool */libtool */*/libtool". If this
6959: does not match the location of the package's libtool script(s), set it as
6960: appropriate.
6961:
6962: If you do not need *.a static libraries built and installed, then use
6963: SHLIBTOOL_OVERRIDE instead.
6964:
6965: If your package makes use of the platform-independent library for loading
6966: dynamic shared objects, that comes with libtool (libltdl), you should include
6967: devel/libltdl/buildlink3.mk.
6968:
6969: Some packages use libtool incorrectly so that the package may not work or build
6970: in some circumstances. Some of the more common errors are:
6971:
6972: * The inclusion of a shared object (-module) as a dependent library in an
6973: executable or library. This in itself isn't a problem if one of two things
6974: has been done:
6975:
6976: 1. The shared object is named correctly, i.e. libfoo.la, not foo.la
6977:
6978: 2. The -dlopen option is used when linking an executable.
6979:
6980: * The use of libltdl without the correct calls to initialisation routines.
6981: The function lt_dlinit() should be called and the macro
6982: LTDL_SET_PRELOADED_SYMBOLS included in executables.
6983:
1.154 rillig 6984: 21.3.3. GNU Autoconf/Automake
1.1 dsieger 6985:
6986: If a package needs GNU autoconf or automake to be executed to regenerate the
6987: configure script and Makefile.in makefile templates, then they should be
6988: executed in a pre-configure target.
6989:
6990: For packages that need only autoconf:
6991:
6992: AUTOCONF_REQD= 2.50 # if default version is not good enough
6993: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
6994: ...
6995:
6996: pre-configure:
6997: cd ${WRKSRC} && autoconf
6998:
6999: ...
7000:
7001: and for packages that need automake and autoconf:
7002:
7003: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
7004: USE_TOOLS+= automake # use "automake14" for automake-1.4
7005: ...
7006:
7007: pre-configure:
7008: set -e; cd ${WRKSRC}; \
7009: aclocal; autoheader; automake -a --foreign -i; autoconf
7010:
7011: ...
7012:
7013: Packages which use GNU Automake will almost certainly require GNU Make.
7014:
7015: There are times when the configure process makes additional changes to the
7016: generated files, which then causes the build process to try to re-execute the
7017: automake sequence. This is prevented by touching various files in the configure
7018: stage. If this causes problems with your package you can set AUTOMAKE_OVERRIDE=
7019: NO in the package Makefile.
7020:
1.154 rillig 7021: 21.4. Programming languages
1.1 dsieger 7022:
1.154 rillig 7023: 21.4.1. C, C++, and Fortran
1.1 dsieger 7024:
7025: Compilers for the C, C++, and Fortran languages comes with the NetBSD base
7026: system. By default, pkgsrc assumes that a package is written in C and will hide
1.184 rillig 7027: all other compilers (via the wrapper framework, see Chapter 18, Buildlink
1.1 dsieger 7028: methodology).
7029:
7030: To declare which language's compiler a package needs, set the USE_LANGUAGES
1.212 wiz 7031: variable. Allowed values currently are:
7032:
7033: c99, c++, c++03, gnu++03, c++0x, gnu++0x, c++11, gnu++11,
7034: c++14, gnu++14, c++17, gnu++17, c++20, gnu++20, fortran,
7035: fortran77, java, objc, obj-c++, and ada.
7036:
7037:
7038: (and any combination). The default is "c". Packages using GNU configure
7039: scripts, even if written in C++, usually need a C compiler for the configure
7040: phase.
1.1 dsieger 7041:
1.154 rillig 7042: 21.4.2. Java
1.1 dsieger 7043:
7044: If a program is written in Java, use the Java framework in pkgsrc. The package
7045: must include ../../mk/java-vm.mk. This Makefile fragment provides the following
7046: variables:
7047:
7048: * USE_JAVA defines if a build dependency on the JDK is added. If USE_JAVA is
7049: set to "run", then there is only a runtime dependency on the JDK. The
7050: default is "yes", which also adds a build dependency on the JDK.
7051:
7052: * Set USE_JAVA2 to declare that a package needs a Java2 implementation. The
7053: supported values are "yes", "1.4", and "1.5". "yes" accepts any Java2
7054: implementation, "1.4" insists on versions 1.4 or above, and "1.5" only
7055: accepts versions 1.5 or above. This variable is not set by default.
7056:
1.25 wiz 7057: * PKG_JAVA_HOME is automatically set to the runtime location of the used Java
7058: implementation dependency. It may be used to set JAVA_HOME to a good value
7059: if the program needs this variable to be defined.
7060:
1.205 wiz 7061: 21.4.3. Go
7062:
7063: If a program is written in Go and has any dependencies on other Go modules,
7064: have the package include ../../lang/go/go-module.mk.
7065:
7066: 1. Generate a list of those dependencies with make clean && make patch && make
7067: show-go-modules > go-modules.mk.
7068:
7069: 2. Prepend
7070:
7071: .include
7072: "go-modules.mk"
7073:
7074: to any other
7075:
7076: .include
7077:
7078: s.
7079:
7080: 3. Incorporate these modules in distinfo with make makesum.
7081:
7082: 21.4.4. Packages containing Perl scripts
1.1 dsieger 7083:
1.203 nia 7084: If your package contains interpreted Perl scripts, add "perl" to the USE_TOOLS
1.1 dsieger 7085: variable and set REPLACE_PERL to ensure that the proper interpreter path is
7086: set. REPLACE_PERL should contain a list of scripts, relative to WRKSRC, that
1.74 wiz 7087: you want adjusted. Every occurrence of */bin/perl in a she-bang line will be
1.210 gutterid 7088: replaced with the full path to the Perl executable.
1.1 dsieger 7089:
1.210 gutterid 7090: If a particular version of Perl is needed, set the PERL5_REQD variable to the
1.1 dsieger 7091: version number. The default is "5.0".
7092:
1.203 nia 7093: See Section 21.6.6, "Packages installing Perl modules" for information about
1.210 gutterid 7094: handling Perl modules.
7095:
7096: There is also the REPLACE_PERL6 variable for the language now known as Raku.
1.1 dsieger 7097:
1.205 wiz 7098: 21.4.5. Packages containing shell scripts
1.41 wiz 7099:
7100: REPLACE_SH, REPLACE_BASH, REPLACE_CSH, and REPLACE_KSH can be used to replace
1.195 gutterid 7101: shell hash bangs in files. Please use the appropriate one, preferring
7102: REPLACE_SH in case this shell is sufficient. Each should contain a list of
7103: scripts, relative to WRKSRC, that you want adjusted. Every occurrence of the
7104: matching shell in a she-bang line will be replaced with the full path to the
7105: shell executable. When using REPLACE_BASH, don't forget to add bash to
7106: USE_TOOLS.
1.41 wiz 7107:
1.205 wiz 7108: 21.4.6. Other programming languages
1.1 dsieger 7109:
1.210 gutterid 7110: There are further similar REPLACE variables available, e.g., REPLACE_AWK for
7111: packages containing awk scripts, and REPLACE_R for R. These two, like the
1.211 gutterid 7112: others noted above, have their actions defined centrally in mk/configure/
7113: replace-interpreter.mk. Other languages define the actions of these variables
7114: within their own dedicated part of the tree, e.g., REPLACE_PHP is actioned in
7115: lang/php/phpversion.mk, and REPLACE_PYTHON is actioned in lang/python/
7116: application.mk. For other languages, consult the mk files found within their
1.216 gutterid 7117: specific directories (the naming convention varies), or check the list found in
7118: Appendix E, Help topics.
1.210 gutterid 7119:
7120: Currently, special handling for other languages varies in pkgsrc. If a compiler
7121: package provides a buildlink3.mk file, include that, otherwise just add a
7122: (build) dependency on the appropriate compiler package.
1.1 dsieger 7123:
1.154 rillig 7124: 21.5. The build phase
1.1 dsieger 7125:
7126: The most common failures when building a package are that some platforms do not
7127: provide certain header files, functions or libraries, or they provide the
7128: functions in a library that the original package author didn't know. To work
7129: around this, you can rewrite the source code in most cases so that it does not
7130: use the missing functions or provides a replacement function.
7131:
1.154 rillig 7132: 21.5.1. Compiling C and C++ code conditionally
1.1 dsieger 7133:
7134: If a package already comes with a GNU configure script, the preferred way to
7135: fix the build failure is to change the configure script, not the code. In the
7136: other cases, you can utilize the C preprocessor, which defines certain macros
7137: depending on the operating system and hardware architecture it compiles for.
7138: These macros can be queried using for example #if defined(__i386). Almost every
7139: operating system, hardware architecture and compiler has its own macro. For
7140: example, if the macros __GNUC__, __i386__ and __NetBSD__ are all defined, you
7141: know that you are using NetBSD on an i386 compatible CPU, and your compiler is
7142: GCC.
7143:
7144: The list of the following macros for hardware and operating system depends on
7145: the compiler that is used. For example, if you want to conditionally compile
7146: code on Solaris, don't use __sun__, as the SunPro compiler does not define it.
7147: Use __sun instead.
7148:
1.154 rillig 7149: 21.5.1.1. C preprocessor macros to identify the operating system
1.1 dsieger 7150:
7151: To distinguish between 4.4 BSD-derived systems and the rest of the world, you
7152: should use the following code.
7153:
7154: #include <sys/param.h>
7155: #if (defined(BSD) && BSD >= 199306)
7156: /* BSD-specific code goes here */
7157: #else
7158: /* non-BSD-specific code goes here */
7159: #endif
7160:
7161: If this distinction is not fine enough, you can also test for the following
7162: macros.
7163:
1.46 obache 7164: Cygwin __CYGWIN__
7165: DragonFly __DragonFly__
1.1 dsieger 7166: FreeBSD __FreeBSD__
1.46 obache 7167: Haiku __HAIKU__
1.1 dsieger 7168: Interix __INTERIX
7169: IRIX __sgi (TODO: get a definite source for this)
7170: Linux linux, __linux, __linux__
1.83 dholland 7171: Mac OS X __APPLE__
1.46 obache 7172: MirBSD __MirBSD__ (__OpenBSD__ is also defined)
7173: Minix3 __minix
1.1 dsieger 7174: NetBSD __NetBSD__
7175: OpenBSD __OpenBSD__
7176: Solaris sun, __sun
7177:
1.154 rillig 7178: 21.5.1.2. C preprocessor macros to identify the hardware architecture
1.1 dsieger 7179:
7180: i386 i386, __i386, __i386__
7181: MIPS __mips
7182: SPARC sparc, __sparc
7183:
1.154 rillig 7184: 21.5.1.3. C preprocessor macros to identify the compiler
1.1 dsieger 7185:
7186: GCC __GNUC__ (major version), __GNUC_MINOR__
7187: MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41)
7188: SunPro __SUNPRO_C (0x570 for Sun C 5.7)
7189: SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8)
7190:
1.154 rillig 7191: 21.5.2. How to handle compiler bugs
1.1 dsieger 7192:
7193: Some source files trigger bugs in the compiler, based on combinations of
7194: compiler version and architecture and almost always relation to optimisation
7195: being enabled. Common symptoms are gcc internal errors or never finishing
7196: compiling a file.
7197:
7198: Typically, a workaround involves testing the MACHINE_ARCH and compiler version,
1.87 tnn 7199: disabling optimisation for that combination of file, MACHINE_ARCH and compiler.
7200:
7201: This used to be a big problem in the past, but is rarely needed now as compiler
7202: technology has matured. If you still need to add a compiler specific
7203: workaround, please do so in the file hacks.mk and describe the symptom and
7204: compiler version as detailed as possible.
1.1 dsieger 7205:
1.172 rillig 7206: 21.5.3. No such file or directory
7207:
7208: Compilation sometimes fails with an error message like this:
7209:
7210: .../x11/gtk3/work/gtk+-3.24.12/gdk/gdktypes.h:35:10:
7211: fatal error: pango/pango.h: No such file or directory
7212:
7213: The proper way to fix this problem depends on the type of the header, which is
7214: described in the following sections.
7215:
7216: 21.5.3.1. Headers from other packages
7217:
7218: If the header name looks like it comes from a different package, that other
7219: package should be included via the buildlink3 framework.
7220:
7221: First, look whether the header is somewhere in the buildlink3 directory below
7222: WRKDIR. In the above case of the missing Pango header:
7223:
7224: $ find work/.buildlink/ -print | grep -F pango/pango.h
7225:
7226: In the case of Pango, the output is:
7227:
7228: work/.buildlink/include/pango-1.0/pango/pango.h
7229:
7230: If the pango/pango.h file were placed directly in the .buildlink directory, it
7231: would have been found automatically. There is an extra pango-1.0 path component
7232: though, which means that the compiler command line must contain an option of
7233: the form -I${BUILDLINK3_PREFIX.pango}/include/pango-1.0. In most cases this
7234: option is generated by the configure script, which can be examined using:
7235:
7236: $ $ grep -o '[-]I[^[:space:]]*/pango[^[:space:]]*' work/*/Makefile
7237: -I/usr/pkg/include/pango-1.0
7238: -I/usr/pkg/include/pango-1.0
7239: -I/usr/pkg/include/pango-1.0
7240: -I/usr/pkg/include/pango-1.0
7241: -I/usr/pkg/include/pango-1.0
7242:
7243: This looks good. These options are transformed by the buildlink wrapper to
7244: refer to the correct path inside work/.buildlink.
7245:
7246: Since the compilation fails though, examine the compiler command lines in work
7247: /.work.log to see whether the -I option is included in the particular command
7248: line.
7249:
7250: To further analyze the situation, run bmake build-env, which sets up an
7251: interactive, realistic environment including all the pkgsrc wrapper commands
7252: and environment variables. From there, try to compile some simple example
7253: programs that use the header.
7254:
7255: 21.5.3.2. Headers generated during the build
7256:
7257: If the name of the header seems to come from the package itself, and if the
7258: build is run with parallel jobs, the package may have some undeclared
7259: dependencies between the .c and the .h files, and a C file is compiled before
7260: its required header is generated.
7261:
7262: To see whether the build runs with parallel jobs, run bmake show-all-build |
7263: grep JOBS. Its output looks like this:
7264:
7265: usr MAKE_JOBS= 7
7266: pkg MAKE_JOBS_SAFE # undefined
7267: def _MAKE_JOBS_N= 7
7268:
7269: In this case the pkgsrc user has asked pkgsrc to build packages with 7 jobs in
7270: parallel (MAKE_JOBS). The package could have disabled parallel builds by
7271: setting MAKE_JOBS_SAFE to no, but in this case it hasn't.
7272:
7273: To see whether the build failure is caused by parallel builds, first save the
7274: exact error message and a bit of context, maybe you need it later for reporting
7275: a bug. Next, run:
7276:
7277: MAKE_JOBS_SAFE=no bmake clean build
7278:
7279: If that succeeds, file a bug report against the pkgsrc package, including the
7280: exact error message and the contents of your mk.conf file.
7281:
1.173 rillig 7282: 21.5.3.3. Symlinks
7283:
7284: Pkgsrc does not work reliably if any of LOCALBASE, VARBASE or WRKDIR contains a
7285: symlink. Since 2019Q2, the pkgsrc bootstrap program prevents installing pkgsrc
7286: in symlink-based directories. Existing pkgsrc installations are not checked for
7287: symlinks though.
7288:
7289: The "No such file or directory" error messages are a typical symptom of
7290: symlinks, and it's quite difficult to find out that this is the actual cause.
7291:
7292: 21.5.3.4. Stale working directories
7293:
7294: When building a hierarchy of packages, it may happen that one package is built
7295: and then pkgsrc is updated. This situation can provoke various hard to diagnose
7296: build errors. To clean up the situation:
7297:
7298: $ (cd ../../ && test -f mk/bsd.pkg.mk && rm -rf */*/work)
7299:
7300: (The test for bsd.pkg.mk just prevents running this command in the wrong
7301: directory.)
7302:
7303: If you have set WRKOBJDIR in mk.conf, remove that directory as well.
7304:
7305: 21.5.3.5. Other possible reasons
7306:
7307: On platforms other than BSD, third-party packages are installed in /usr/
7308: include, together with the base system. This means that pkgsrc cannot
7309: distinguish between headers provided by the base system (which it needs) and
7310: headers from third-party packages (which are often included in pkgsrc as well).
7311: This can lead to subtle version mismatches.
7312:
7313: In pkgsrc installations that have been active for several years, it may happen
7314: that some files are manually deleted. To exclude this unlikely reason, run
7315: pkg_admin check.
7316:
7317: It may help to run pkg_admin rebuild-tree to check/fix dependencies.
7318:
7319: If all of the above doesn't help, see Chapter 2, Getting help for contact
7320: information. Be prepared to describe what you have tried so far and what any
7321: error messages were.
7322:
1.172 rillig 7323: 21.5.4. Undefined reference to "..."
1.1 dsieger 7324:
7325: This error message often means that a package did not link to a shared library
7326: it needs. The following functions are known to cause this error message over
7327: and over.
7328:
7329: +-----------------------------------------------------+
7330: | Function |Library |Affected platforms|
7331: |-------------------------+--------+------------------|
7332: |accept, bind, connect |-lsocket|Solaris |
7333: |-------------------------+--------+------------------|
7334: |crypt |-lcrypt |DragonFly, NetBSD |
7335: |-------------------------+--------+------------------|
7336: |dlopen, dlsym |-ldl |Linux |
7337: |-------------------------+--------+------------------|
7338: |gethost* |-lnsl |Solaris |
7339: |-------------------------+--------+------------------|
7340: |inet_aton |-lresolv|Solaris |
7341: |-------------------------+--------+------------------|
7342: |nanosleep, sem_*, timer_*|-lrt |Solaris |
7343: |-------------------------+--------+------------------|
7344: |openpty |-lutil |Linux |
7345: +-----------------------------------------------------+
7346:
7347: To fix these linker errors, it is often sufficient to say LIBS.OperatingSystem+
7348: = -lfoo to the package Makefile and then say bmake clean; bmake.
7349:
1.172 rillig 7350: 21.5.4.1. Special issue: The SunPro compiler
1.1 dsieger 7351:
7352: When you are using the SunPro compiler, there is another possibility. That
7353: compiler cannot handle the following code:
7354:
7355: extern int extern_func(int);
7356:
7357: static inline int
7358: inline_func(int x)
7359: {
7360: return extern_func(x);
7361: }
7362:
7363: int main(void)
7364: {
7365: return 0;
7366: }
7367:
7368: It generates the code for inline_func even if that function is never used. This
7369: code then refers to extern_func, which can usually not be resolved. To solve
7370: this problem you can try to tell the package to disable inlining of functions.
7371:
1.172 rillig 7372: 21.5.5. Running out of memory
1.1 dsieger 7373:
7374: Sometimes packages fail to build because the compiler runs into an operating
7375: system specific soft limit. With the UNLIMIT_RESOURCES variable pkgsrc can be
1.94 wiz 7376: told to unlimit the resources. Currently, the allowed values are any
7377: combination of "cputime", "datasize", "memorysize", and "stacksize". Setting
7378: this variable is similar to running the shell builtin ulimit command to raise
7379: the maximum data segment size or maximum stack size of a process, respectively,
7380: to their hard limits.
1.1 dsieger 7381:
1.154 rillig 7382: 21.6. The install phase
1.1 dsieger 7383:
1.154 rillig 7384: 21.6.1. Creating needed directories
1.1 dsieger 7385:
7386: The BSD-compatible install supplied with some operating systems cannot create
7387: more than one directory at a time. As such, you should call ${INSTALL_*_DIR}
7388: like this:
7389:
7390: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
7391: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
7392:
7393: You can also just append "dir1 dir2" to the INSTALLATION_DIRS variable, which
7394: will automatically do the right thing.
7395:
1.154 rillig 7396: 21.6.2. Where to install documentation
1.1 dsieger 7397:
7398: In general, documentation should be installed into ${PREFIX}/share/doc/$
7399: {PKGBASE} or ${PREFIX}/share/doc/${PKGNAME} (the latter includes the version
7400: number of the package).
7401:
7402: Many modern packages using GNU autoconf allow to set the directory where HTML
7403: documentation is installed with the "--with-html-dir" option. Sometimes using
7404: this flag is needed because otherwise the documentation ends up in ${PREFIX}/
7405: share/doc/html or other places.
7406:
7407: An exception to the above is that library API documentation generated with the
7408: textproc/gtk-doc tools, for use by special browsers (devhelp) should be left at
7409: their default location, which is ${PREFIX}/share/gtk-doc. Such documentation
7410: can be recognized from files ending in .devhelp or .devhelp2. (It is also
7411: acceptable to install such files in ${PREFIX}/share/doc/${PKGBASE} or ${PREFIX}
7412: /share/doc/${PKGNAME}; the .devhelp* file must be directly in that directory
7413: then, no additional subdirectory level is allowed in this case. This is usually
7414: achieved by using "--with-html-dir=${PREFIX}/share/doc". ${PREFIX}/share/
7415: gtk-doc is preferred though.)
7416:
1.154 rillig 7417: 21.6.3. Installing highscore files
1.1 dsieger 7418:
7419: Certain packages, most of them in the games category, install a score file that
7420: allows all users on the system to record their highscores. In order for this to
7421: work, the binaries need to be installed setgid and the score files owned by the
1.36 wiz 7422: appropriate group and/or owner (traditionally the "games" user/group). Set
7423: USE_GAMESGROUP to yes to support this. The following variables, documented in
7424: more detail in mk/defaults/mk.conf, control this behaviour: GAMEDATAMODE,
1.100 leot 7425: GAMEDIRMODE, GAMES_GROUP, GAMEMODE, GAME_USER. Other useful variables are:
7426: GAMEDIR_PERMS, GAMEDATA_PERMS and SETGID_GAMES_PERMS.
7427:
7428: An example that illustrates some of the variables described above is games/
7429: moon-buggy. OWN_DIRS_PERMS is used to properly set directory permissions of the
7430: directory where the scorefile is saved, REQD_FILES_PERMS is used to create a
7431: dummy scorefile (mbscore) with the proper permissions and SPECIAL_PERMS is used
7432: to install setgid the game binary:
7433:
7434: USE_GAMESGROUP= yes
7435:
7436: BUILD_DEFS+= VARBASE
7437:
7438: OWN_DIRS_PERMS+= ${VARBASE}/games/moon-buggy ${GAMEDIR_PERMS}
7439: REQD_FILES_PERMS+= /dev/null ${VARBASE}/games/moon-buggy/mbscore ${GAMEDATA_PERMS}
7440: SPECIAL_PERMS+= ${PREFIX}/bin/moon-buggy ${SETGID_GAMES_PERMS}
7441:
7442: Various INSTALL_* variables are also available: INSTALL_GAME to install setgid
7443: game binaries, INSTALL_GAME_DIR to install game directories that are needed to
7444: be accessed by setgid games and INSTALL_GAME_DATA to install scorefiles.
1.1 dsieger 7445:
1.14 jmcneill 7446: A package should therefore never hard code file ownership or access permissions
1.100 leot 7447: but rely on *_PERMS as described above or alternatively on INSTALL_GAME,
7448: INSTALL_GAME_DATA and INSTALL_GAME_DIR to set these correctly.
1.1 dsieger 7449:
1.154 rillig 7450: 21.6.4. Adding DESTDIR support to packages
1.4 rillig 7451:
1.14 jmcneill 7452: DESTDIR support means that a package installs into a staging directory, not the
7453: final location of the files. Then a binary package is created which can be used
7454: for installation as usual. There are two ways: Either the package must install
1.25 wiz 7455: as root ("destdir") or the package can install as non-root user ("user-destdir"
7456: ).
1.14 jmcneill 7457:
1.113 leot 7458: * PKG_DESTDIR_SUPPORT has to be set to "destdir" or "user-destdir". By
7459: default PKG_DESTDIR_SUPPORT is set to "user-destdir" to help catching more
7460: potential packaging problems. If bsd.prefs.mk is included in the Makefile,
7461: PKG_DESTDIR_SUPPORT needs to be set before the inclusion.
1.14 jmcneill 7462:
1.4 rillig 7463: * All installation operations have to be prefixed with ${DESTDIR}.
7464:
7465: * automake gets this DESTDIR mostly right automatically. Many manual rules
7466: and pre/post-install often are incorrect; fix them.
7467:
1.17 imil 7468: * If files are installed with special owner/group use SPECIAL_PERMS.
1.4 rillig 7469:
7470: * In general, packages should support UNPRIVILEGED to be able to use DESTDIR.
7471:
1.154 rillig 7472: 21.6.5. Packages with hardcoded paths to other interpreters
1.1 dsieger 7473:
7474: Your package may also contain scripts with hardcoded paths to other
1.203 nia 7475: interpreters besides (or as well as) Perl. To correct the full pathname to the
1.1 dsieger 7476: script interpreter, you need to set the following definitions in your Makefile
7477: (we shall use tclsh in this example):
7478:
7479: REPLACE_INTERPRETER+= tcl
7480: REPLACE.tcl.old= .*/bin/tclsh
7481: REPLACE.tcl.new= ${PREFIX}/bin/tclsh
7482: REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
7483: # relative to ${WRKSRC}, just as in REPLACE_PERL
7484:
7485: Note
7486:
7487: Before March 2006, these variables were called _REPLACE.* and _REPLACE_FILES.*.
7488:
1.203 nia 7489: 21.6.6. Packages installing Perl modules
1.1 dsieger 7490:
7491: Makefiles of packages providing perl5 modules should include the Makefile
7492: fragment ../../lang/perl5/module.mk. It provides a do-configure target for the
7493: standard perl configuration for such modules as well as various hooks to tune
7494: this configuration. See comments in this file for details.
7495:
7496: Perl5 modules will install into different places depending on the version of
7497: perl used during the build process. To address this, pkgsrc will append lines
7498: to the PLIST corresponding to the files listed in the installed .packlist file
7499: generated by most perl5 modules. This is invoked by defining PERL5_PACKLIST to
1.48 wiz 7500: a space-separated list of packlist files relative to PERL5_PACKLIST_DIR
7501: (PERL5_INSTALLVENDORARCH by default), e.g.:
1.1 dsieger 7502:
1.48 wiz 7503: PERL5_PACKLIST= auto/Pg/.packlist
1.1 dsieger 7504:
1.48 wiz 7505: The perl5 config variables installarchlib, installscript, installvendorbin,
7506: installvendorscript, installvendorarch, installvendorlib, installvendorman1dir,
7507: and installvendorman3dir represent those locations in which components of perl5
7508: modules may be installed, provided as variable with uppercase and prefixed with
7509: PERL5_, e.g. PERL5_INSTALLARCHLIB and may be used by perl5 packages that don't
7510: have a packlist. These variables are also substituted for in the PLIST as
7511: uppercase prefixed with PERL5_SUB_.
1.1 dsieger 7512:
1.154 rillig 7513: 21.6.7. Packages installing info files
1.1 dsieger 7514:
7515: Some packages install info files or use the "makeinfo" or "install-info"
7516: commands. INFO_FILES should be defined in the package Makefile so that INSTALL
7517: and DEINSTALL scripts will be generated to handle registration of the info
7518: files in the Info directory file. The "install-info" command used for the info
7519: files registration is either provided by the system, or by a special purpose
7520: package automatically added as dependency if needed.
7521:
7522: PKGINFODIR is the directory under ${PREFIX} where info files are primarily
7523: located. PKGINFODIR defaults to "info" and can be overridden by the user.
7524:
7525: The info files for the package should be listed in the package PLIST; however
7526: any split info files need not be listed.
7527:
7528: A package which needs the "makeinfo" command at build time must add "makeinfo"
7529: to USE_TOOLS in its Makefile. If a minimum version of the "makeinfo" command is
7530: needed it should be noted with the TEXINFO_REQD variable in the package
7531: Makefile. By default, a minimum version of 3.12 is required. If the system does
7532: not provide a makeinfo command or if it does not match the required minimum, a
7533: build dependency on the devel/gtexinfo package will be added automatically.
7534:
7535: The build and installation process of the software provided by the package
7536: should not use the install-info command as the registration of info files is
1.25 wiz 7537: the task of the package INSTALL script, and it must use the appropriate
1.1 dsieger 7538: makeinfo command.
7539:
7540: To achieve this goal, the pkgsrc infrastructure creates overriding scripts for
7541: the install-info and makeinfo commands in a directory listed early in PATH.
7542:
7543: The script overriding install-info has no effect except the logging of a
7544: message. The script overriding makeinfo logs a message and according to the
7545: value of TEXINFO_REQD either runs the appropriate makeinfo command or exit on
7546: error.
7547:
1.154 rillig 7548: 21.6.8. Packages installing man pages
1.1 dsieger 7549:
7550: All packages that install manual pages should install them into the same
7551: directory, so that there is one common place to look for them. In pkgsrc, this
7552: place is ${PREFIX}/${PKGMANDIR}, and this expression should be used in
1.25 wiz 7553: packages. The default for PKGMANDIR is "man". Another often-used value is "
7554: share/man".
1.1 dsieger 7555:
7556: Note
7557:
7558: The support for a custom PKGMANDIR is far from complete.
7559:
7560: The PLIST files can just use man/ as the top level directory for the man page
7561: file entries, and the pkgsrc framework will convert as needed. In all other
7562: places, the correct PKGMANDIR must be used.
7563:
7564: Packages that are configured with GNU_CONFIGURE set as "yes", by default will
7565: use the ./configure --mandir switch to set where the man pages should be
7566: installed. The path is GNU_CONFIGURE_MANDIR which defaults to ${PREFIX}/$
7567: {PKGMANDIR}.
7568:
7569: Packages that use GNU_CONFIGURE but do not use --mandir, can set
7570: CONFIGURE_HAS_MANDIR to "no". Or if the ./configure script uses a non-standard
7571: use of --mandir, you can set GNU_CONFIGURE_MANDIR as needed.
7572:
1.184 rillig 7573: See Section 19.5, "Man page compression" for information on installation of
1.1 dsieger 7574: compressed manual pages.
7575:
1.203 nia 7576: 21.6.9. Packages installing X11 fonts
1.1 dsieger 7577:
7578: If a package installs font files, you will need to rebuild the fonts database
7579: in the directory where they get installed at installation and deinstallation
7580: time. This can be automatically done by using the pkginstall framework.
7581:
7582: You can list the directories where fonts are installed in the FONTS_DIRS.type
7583: variables, where type can be one of "ttf", "type1" or "x11". Also make sure
7584: that the database file fonts.dir is not listed in the PLIST.
7585:
7586: Note that you should not create new directories for fonts; instead use the
7587: standard ones to avoid that the user needs to manually configure his X server
7588: to find them.
7589:
1.203 nia 7590: 21.6.10. Packages installing SGML or XML data
1.1 dsieger 7591:
7592: If a package installs SGML or XML data files that need to be registered in
7593: system-wide catalogs (like DTDs, sub-catalogs, etc.), you need to take some
7594: extra steps:
7595:
7596: 1. Include ../../textproc/xmlcatmgr/catalogs.mk in your Makefile, which takes
7597: care of registering those files in system-wide catalogs at installation and
7598: deinstallation time.
7599:
7600: 2. Set SGML_CATALOGS to the full path of any SGML catalogs installed by the
7601: package.
7602:
7603: 3. Set XML_CATALOGS to the full path of any XML catalogs installed by the
7604: package.
7605:
7606: 4. Set SGML_ENTRIES to individual entries to be added to the SGML catalog.
7607: These come in groups of three strings; see xmlcatmgr(1) for more
7608: information (specifically, arguments recognized by the 'add' action). Note
7609: that you will normally not use this variable.
7610:
7611: 5. Set XML_ENTRIES to individual entries to be added to the XML catalog. These
7612: come in groups of three strings; see xmlcatmgr(1) for more information
7613: (specifically, arguments recognized by the 'add' action). Note that you
7614: will normally not use this variable.
7615:
1.203 nia 7616: 21.6.11. Packages installing extensions to the MIME database
1.1 dsieger 7617:
7618: If a package provides extensions to the MIME database by installing .xml files
7619: inside ${PREFIX}/share/mime/packages, you need to take some extra steps to
7620: ensure that the database is kept consistent with respect to these new files:
7621:
7622: 1. Include ../../databases/shared-mime-info/mimedb.mk (avoid using the
7623: buildlink3.mk file from this same directory, which is reserved for
7624: inclusion from other buildlink3.mk files). It takes care of rebuilding the
7625: MIME database at installation and deinstallation time, and disallows any
7626: access to it directly from the package.
7627:
1.25 wiz 7628: 2. Check the PLIST and remove any entries under the share/mime directory,
1.1 dsieger 7629: except for files saved under share/mime/packages. The former are handled
7630: automatically by the update-mime-database program, but the latter are
7631: package-dependent and must be removed by the package that installed them in
7632: the first place.
7633:
7634: 3. Remove any share/mime/* directories from the PLIST. They will be handled by
7635: the shared-mime-info package.
7636:
1.203 nia 7637: 21.6.12. Packages using intltool
1.1 dsieger 7638:
7639: If a package uses intltool during its build, add intltool to the USE_TOOLS,
7640: which forces it to use the intltool package provided by pkgsrc, instead of the
7641: one bundled with the distribution file.
7642:
7643: This tracks intltool's build-time dependencies and uses the latest available
7644: version; this way, the package benefits of any bug fixes that may have appeared
7645: since it was released.
7646:
1.203 nia 7647: 21.6.13. Packages installing startup scripts
1.1 dsieger 7648:
7649: If a package contains a rc.d script, it won't be copied into the startup
7650: directory by default, but you can enable it, by adding the option
1.4 rillig 7651: PKG_RCD_SCRIPTS=YES in mk.conf. This option will copy the scripts into /etc/
7652: rc.d when a package is installed, and it will automatically remove the scripts
7653: when the package is deinstalled.
1.1 dsieger 7654:
1.203 nia 7655: 21.6.14. Packages installing TeX modules
1.1 dsieger 7656:
7657: If a package installs TeX packages into the texmf tree, the ls-R database of
7658: the tree needs to be updated.
7659:
7660: Note
7661:
1.23 jakllsch 7662: Except the main TeX packages such as kpathsea, packages should install files
7663: into ${PREFIX}/share/texmf-dist, not ${PREFIX}/share/texmf.
1.1 dsieger 7664:
1.23 jakllsch 7665: 1. Include ../../print/kpathsea/texmf.mk. This takes care of rebuilding the
7666: ls-R database at installation and deinstallation time.
1.1 dsieger 7667:
1.23 jakllsch 7668: 2. If your package installs files into a texmf tree other than the one at $
7669: {PREFIX}/share/texmf-dist, set TEX_TEXMF_DIRS to the list of all texmf
7670: trees that need database update.
1.1 dsieger 7671:
7672: If your package also installs font map files that need to be registered
1.30 dholland 7673: using updmap, include ../../print/tex-tetex/map.mk and set TEX_MAP_FILES
7674: and/or TEX_MIXEDMAP_FILES to the list of all such font map files. Then
7675: updmap will be run automatically at installation/deinstallation to enable/
7676: disable font map files for TeX output drivers.
1.1 dsieger 7677:
7678: 3. Make sure that none of ls-R databases are included in PLIST, as they will
1.30 dholland 7679: be removed only by the kpathsea package.
1.1 dsieger 7680:
1.203 nia 7681: 21.6.15. Packages supporting running binaries in emulation
1.1 dsieger 7682:
7683: There are some packages that provide libraries and executables for running
7684: binaries from a one operating system on a different one (if the latter supports
7685: it). One example is running Linux binaries on NetBSD.
7686:
7687: The pkgtools/rpm2pkg helps in extracting and packaging Linux rpm packages.
7688:
7689: The CHECK_SHLIBS can be set to no to avoid the check-shlibs target, which tests
7690: if all libraries for each installed executable can be found by the dynamic
7691: linker. Since the standard dynamic linker is run, this fails for emulation
7692: packages, because the libraries used by the emulation are not in the standard
7693: directories.
7694:
1.203 nia 7695: 21.6.16. Packages installing hicolor icons
1.1 dsieger 7696:
7697: If a package installs images under the share/icons/hicolor and/or updates the
7698: share/icons/hicolor/icon-theme.cache database, you need to take some extra
7699: steps to make sure that the shared theme directory is handled appropriately and
7700: that the cache database is rebuilt:
7701:
7702: 1. Include ../../graphics/hicolor-icon-theme/buildlink3.mk.
7703:
7704: 2. Check the PLIST and remove the entry that refers to the theme cache.
7705:
7706: 3. Ensure that the PLIST does not remove the shared icon directories from the
7707: share/icons/hicolor hierarchy because they will be handled automatically.
7708:
7709: The best way to verify that the PLIST is correct with respect to the last two
7710: points is to regenerate it using make print-PLIST.
7711:
1.203 nia 7712: 21.6.17. Packages installing desktop files
1.1 dsieger 7713:
7714: If a package installs .desktop files under share/applications and these include
1.54 rodent 7715: MIME information (MimeType key), you need to take extra steps to ensure that
7716: they are registered into the MIME database:
1.1 dsieger 7717:
7718: 1. Include ../../sysutils/desktop-file-utils/desktopdb.mk.
7719:
7720: 2. Check the PLIST and remove the entry that refers to the share/applications/
7721: mimeinfo.cache file. It will be handled automatically.
7722:
7723: The best way to verify that the PLIST is correct with respect to the last point
7724: is to regenerate it using make print-PLIST.
7725:
1.154 rillig 7726: 21.7. Marking packages as having problems
1.1 dsieger 7727:
1.23 jakllsch 7728: In some cases one does not have the time to solve a problem immediately. In
7729: this case, one can plainly mark a package as broken. For this, one just sets
7730: the variable BROKEN to the reason why the package is broken (similar to the
1.162 rillig 7731: PKG_FAIL_REASON variable). A user trying to build the package will immediately
7732: be shown this message, and the build will not be even tried.
1.1 dsieger 7733:
1.23 jakllsch 7734: BROKEN packages are removed from pkgsrc in irregular intervals.
1.1 dsieger 7735:
1.184 rillig 7736: Chapter 22. GNOME packaging and porting
7737:
7738: Table of Contents
7739:
7740: 22.1. Meta packages
7741: 22.2. Packaging a GNOME application
7742: 22.3. Updating GNOME to a newer version
7743: 22.4. Patching guidelines
7744:
7745: Quoting GNOME's web site:
7746:
7747: The GNOME project provides two things: The GNOME desktop environment, an
7748: intuitive and attractive desktop for users, and the GNOME development
7749: platform, an extensive framework for building applications that integrate
7750: into the rest of the desktop.
7751:
7752: pkgsrc provides a seamless way to automatically build and install a complete
7753: GNOME environment under many different platforms. We can say with confidence
7754: that pkgsrc is one of the most advanced build and packaging systems for GNOME
7755: due to its included technologies buildlink3, the wrappers and tools framework
7756: and automatic configuration file management. Lots of efforts are put into
7757: achieving a completely clean deinstallation of installed software components.
7758:
7759: Given that pkgsrc is NetBSD's official packaging system, the above also means
7760: that great efforts are put into making GNOME work under this operating system.
7761:
7762: This chapter is aimed at pkgsrc developers and other people interested in
7763: helping our GNOME porting and packaging efforts. It provides instructions on
7764: how to manage the existing packages and some important information regarding
7765: their internals.
7766:
7767: We need your help!
7768:
7769: Should you have some spare cycles to devote to NetBSD, pkgsrc and GNOME and are
7770: willing to learn new exciting stuff, please jump straight to the pending work
7771: list! There is still a long way to go to get a fully-functional GNOME desktop
7772: under NetBSD and we need your help to achieve it!
7773:
7774: 22.1. Meta packages
7775:
7776: pkgsrc includes three GNOME-related meta packages:
7777:
7778: * meta-pkgs/gnome-base: Provides the core GNOME desktop environment. It only
7779: includes the necessary bits to get it to boot correctly, although it may
7780: lack important functionality for daily operation. The idea behind this
7781: package is to let end users build their own configurations on top of this
7782: one, first installing this meta package to achieve a functional setup and
7783: then adding individual applications.
7784:
7785: * meta-pkgs/gnome: Provides a complete installation of the GNOME platform and
7786: desktop as defined by the GNOME project; this is based on the components
7787: distributed in the platform/x.y/x.y.z/sources and desktop/x.y/x.y.z/sources
7788: directories of the official FTP server. Developer-only tools found in those
7789: directories are not installed unless required by some other component to
7790: work properly. Similarly, packages from the bindings set (bindings/x.y/
7791: x.y.z/sources) are not pulled in unless required as a dependency for an
7792: end-user component. This package "extends" meta-pkgs/gnome-base.
7793:
7794: * meta-pkgs/gnome-devel: Installs all the tools required to build a GNOME
7795: component when fetched from the CVS repository. These are required to let
7796: the autogen.sh scripts work appropriately.
7797:
7798: In all these packages, the DEPENDS lines are sorted in a way that eases
7799: updates: a package may depend on other packages listed before it but not on any
7800: listed after it. It is very important to keep this order to ease updates so...
7801: do not change it to alphabetical sorting!
7802:
7803: 22.2. Packaging a GNOME application
7804:
7805: Almost all GNOME applications are written in C and use a common set of tools as
7806: their build system. Things get different with the new bindings to other
7807: languages (such as Python), but the following will give you a general idea on
7808: the minimum required tools:
7809:
7810: * Almost all GNOME applications use the GNU Autotools as their build system.
7811: As a general rule you will need to tell this to your package:
7812:
7813: GNU_CONFIGURE=yes
7814: USE_LIBTOOL=yes
7815: USE_TOOLS+=gmake
7816:
7817: * If the package uses pkg-config to detect dependencies, add this tool to the
7818: list of required utilities:
7819:
7820: USE_TOOLS+=pkg-config
7821:
7822: Also use pkgtools/verifypc at the end of the build process to ensure that
7823: you did not miss to specify any dependency in your package and that the
7824: version requirements are all correct.
7825:
7826: * If the package uses intltool, be sure to add intltool to the USE_TOOLS to
7827: handle dependencies and to force the package to use the latest available
7828: version.
7829:
7830: * If the package uses gtk-doc (a documentation generation utility), do not
7831: add a dependency on it. The tool is rather big and the distfile should come
7832: with pregenerated documentation anyway; if it does not, it is a bug that
7833: you ought to report. For such packages you should disable gtk-doc (unless
7834: it is the default):
7835:
7836: CONFIGURE_ARGS+=--disable-gtk-doc
7837:
7838: The default location of installed HTML files (share/gtk-doc/<package-name>)
7839: is correct and should not be changed unless the package insists on
7840: installing them somewhere else. Otherwise programs as devhelp will not be
7841: able to open them. You can do that with an entry similar to:
1.1 dsieger 7842:
1.184 rillig 7843: CONFIGURE_ARGS+=--with-html-dir=${PREFIX}/share/gtk-doc/...
1.1 dsieger 7844:
1.184 rillig 7845: GNOME uses multiple shared directories and files under the installation prefix
7846: to maintain databases. In this context, shared means that those exact same
7847: directories and files are used among several different packages, leading to
7848: conflicts in the PLIST. pkgsrc currently includes functionality to handle the
7849: most common cases, so you have to forget about using @unexec ${RMDIR} lines in
7850: your file lists and omitting shared files from them. If you find yourself doing
7851: those, your package is most likely incorrect.
1.1 dsieger 7852:
1.184 rillig 7853: The following table lists the common situations that result in using shared
7854: directories or files. For each of them, the appropriate solution is given.
7855: After applying the solution be sure to regenerate the package's file list with
7856: make print-PLIST and ensure it is correct.
1.1 dsieger 7857:
1.184 rillig 7858: Table 22.1. PLIST handling for GNOME packages
1.1 dsieger 7859:
1.184 rillig 7860: +-----------------------------------------------------------------------------+
7861: | If the package... | Then... |
7862: |-------------------------------------------+---------------------------------|
1.203 nia 7863: |Installs icons under the share/icons/ |See Section 21.6.16, "Packages |
7864: |hicolor hierarchy or updates share/icons/ |installing hicolor icons". |
1.184 rillig 7865: |hicolor/icon-theme.cache. | |
7866: |-------------------------------------------+---------------------------------|
1.203 nia 7867: | |See Section 21.6.11, "Packages |
1.184 rillig 7868: |Installs files under share/mime/packages. |installing extensions to the MIME|
7869: | |database". |
7870: |-------------------------------------------+---------------------------------|
1.203 nia 7871: |Installs .desktop files under share/ |See Section 21.6.17, "Packages |
1.184 rillig 7872: |applications and these include MIME |installing desktop files". |
7873: |information. | |
7874: +-----------------------------------------------------------------------------+
1.1 dsieger 7875:
7876:
1.184 rillig 7877: 22.3. Updating GNOME to a newer version
1.1 dsieger 7878:
1.184 rillig 7879: When seeing GNOME as a whole, there are two kinds of updates:
1.1 dsieger 7880:
1.184 rillig 7881: Major update
1.1 dsieger 7882:
1.184 rillig 7883: Given that there is still a very long way for GNOME 3 (if it ever appears),
7884: we consider a major update one that goes from a 2.X version to a 2.Y one,
7885: where Y is even and greater than X. These are hard to achieve because they
7886: introduce lots of changes in the components' code and almost all GNOME
7887: distfiles are updated to newer versions. Some of them can even break API
7888: and ABI compatibility with the previous major version series. As a result,
7889: the update needs to be done all at once to minimize breakage.
1.1 dsieger 7890:
1.184 rillig 7891: A major update typically consists of around 80 package updates and the
7892: addition of some new ones.
1.1 dsieger 7893:
1.184 rillig 7894: Minor update
1.1 dsieger 7895:
1.184 rillig 7896: We consider a minor update one that goes from a 2.A.X version to a 2.A.Y
7897: one where Y is greater than X. These are easy to achieve because they do
7898: not update all GNOME components, can be done in an incremental way and do
7899: not break API nor ABI compatibility.
1.1 dsieger 7900:
1.184 rillig 7901: A minor update typically consists of around 50 package updates, although
7902: the numbers here may vary a lot.
1.1 dsieger 7903:
1.184 rillig 7904: In order to update the GNOME components in pkgsrc to a new stable release
7905: (either major or minor), the following steps should be followed:
1.1 dsieger 7906:
1.184 rillig 7907: 1. Get a list of all the tarballs that form the new release by using the
7908: following commands. These will leave the full list of the components'
7909: distfiles into the list.txt file:
1.1 dsieger 7910:
1.184 rillig 7911: % echo ls "*.tar.bz2" | \
7912: ftp -V ftp://ftp.gnome.org/pub/gnome/platform/x.y/x.y.z/sources/ | \
7913: awk '{ print $9 }' >list.txt
7914: % echo ls "*.tar.bz2" | \
7915: ftp -V ftp://ftp.gnome.org/pub/gnome/desktop/x.y/x.y.z/sources/ | \
7916: awk '{ print $9 }' >>list.txt
1.1 dsieger 7917:
1.184 rillig 7918: 2. Open each meta package's Makefile and bump their version to the release you
7919: are updating them to. The three meta packages should be always consistent
7920: with versioning. Obviously remove any PKGREVISIONs that might be in them.
1.1 dsieger 7921:
1.184 rillig 7922: 3. For each meta package, update all its DEPENDS lines to match the latest
7923: versions as shown by the above commands. Do not list any newer version
7924: (even if found in the FTP) because the meta packages are supposed to list
7925: the exact versions that form a specific GNOME release. Exceptions are
7926: permitted here if a newer version solves a serious issue in the overall
7927: desktop experience; these typically come in the form of a revision bump in
7928: pkgsrc, not in newer versions from the developers.
1.1 dsieger 7929:
1.184 rillig 7930: Packages not listed in the list.txt file should be updated to the latest
7931: version available (if found in pkgsrc). This is the case, for example, of
7932: the dependencies on the GNU Autotools in the meta-pkgs/gnome-devel meta
7933: package.
1.1 dsieger 7934:
1.184 rillig 7935: 4. Generate a patch from the modified meta packages and extract the list of
7936: "new" lines. This will provide you an outline on what packages need to be
7937: updated in pkgsrc and in what order:
1.1 dsieger 7938:
1.184 rillig 7939: % cvs diff -u gnome-devel gnome-base gnome | grep '^+D' >todo.txt
1.1 dsieger 7940:
1.184 rillig 7941: 5. For major desktop updates it is recommended to zap all your installed
7942: packages and start over from scratch at this point.
1.1 dsieger 7943:
1.184 rillig 7944: 6. Now comes the longest step by far: iterate over the contents of todo.txt
7945: and update the packages listed in it in order. For major desktop updates
7946: none of these should be committed until the entire set is completed because
7947: there are chances of breaking not-yet-updated packages.
1.1 dsieger 7948:
1.184 rillig 7949: 7. Once the packages are up to date and working, commit them to the tree one
7950: by one with appropriate log messages. At the end, commit the three meta
7951: package updates and all the corresponding changes to the doc/CHANGES-<YEAR>
7952: and pkgsrc/doc/TODO files.
1.1 dsieger 7953:
1.184 rillig 7954: 22.4. Patching guidelines
1.1 dsieger 7955:
1.184 rillig 7956: GNOME is a very big component in pkgsrc which approaches 100 packages. Please,
7957: it is very important that you always, always, always feed back any portability
7958: fixes you do to a GNOME package to the mainstream developers (see
7959: Section 12.3.5, "Feedback to the author"). This is the only way to get their
7960: attention on portability issues and to ensure that future versions can be built
7961: out-of-the box on NetBSD. The less custom patches in pkgsrc, the easier further
7962: updates are. Those developers in charge of issuing major GNOME updates will be
7963: grateful if you do that.
1.1 dsieger 7964:
1.200 cirnatda 7965: The most common places to report bugs are the GNOME's GitLab and the
7966: freedesktop.org's GitLab. Not all components use these to track bugs, but most
7967: of them do. Do not be short on your reports: always provide detailed
1.184 rillig 7968: explanations of the current failure, how it can be improved to achieve maximum
1.200 cirnatda 7969: portability and, if at all possible, provide a patch against the main Git
7970: branch. The more verbose you are, the higher chances of your patch being
7971: accepted.
1.1 dsieger 7972:
1.184 rillig 7973: Also, please avoid using preprocessor magic to fix portability issues. While
7974: the FreeBSD GNOME people are doing a great job in porting GNOME to their
7975: operating system, the official GNOME sources are now plagued by conditionals
7976: that check for __FreeBSD__ and similar macros. This hurts portability. Please
7977: see our patching guidelines (Section 12.3.4, "Patching guidelines") for more
7978: details.
1.1 dsieger 7979:
1.154 rillig 7980: Chapter 23. Submitting and Committing
1.1 dsieger 7981:
7982: Table of Contents
7983:
1.154 rillig 7984: 23.1. Submitting binary packages
7985: 23.2. Submitting source packages (for non-NetBSD-developers)
7986: 23.3. General notes when adding, updating, or removing packages
7987: 23.4. Commit Messages
7988: 23.5. Committing: Adding a package to CVS
7989: 23.6. Updating a package to a newer version
7990: 23.7. Renaming a package in pkgsrc
7991: 23.8. Moving a package in pkgsrc
1.1 dsieger 7992:
1.154 rillig 7993: 23.1. Submitting binary packages
1.1 dsieger 7994:
7995: Our policy is that we accept binaries only from pkgsrc developers to guarantee
7996: that the packages don't contain any trojan horses etc. This is not to annoy
7997: anyone but rather to protect our users! You're still free to put up your
7998: home-made binary packages and tell the world where to get them. NetBSD
1.154 rillig 7999: developers doing bulk builds and wanting to upload them please see Chapter 8,
1.66 asau 8000: Creating binary packages for everything in pkgsrc (bulk builds).
1.1 dsieger 8001:
1.154 rillig 8002: 23.2. Submitting source packages (for non-NetBSD-developers)
1.1 dsieger 8003:
1.218 nia 8004: Firstly, you can import new packages into pkgsrc-wip ("pkgsrc work-in-progress"
8005: ); see the homepage at https://pkgsrc.org/wip/ for details.
8006:
8007: Next, check that your package is complete, compiles and runs well; see
1.184 rillig 8008: Chapter 14, Creating a new pkgsrc package from scratch and the rest of this
1.218 nia 8009: document. Run the pkgtools/pkglint tool and fix any errors that appear.
8010:
8011: Finally, send a report to the pkgsrc bug tracking system, either with the
8012: send-pr(1) command, or if you don't have that, go to the web page https://
8013: www.NetBSD.org/support/send-pr.html, which contains some instructions and a
8014: link to a form where you can submit packages. The sysutils/gtk-send-pr package
8015: is also available as a substitute for either of the above two tools.
1.1 dsieger 8016:
8017: In the form of the problem report, the category should be "pkg", the synopsis
8018: should include the package name and version number, and the description field
8019: should contain a short description of your package (contents of the COMMENT
1.218 nia 8020: variable or DESCR file are OK).
1.1 dsieger 8021:
1.154 rillig 8022: 23.3. General notes when adding, updating, or removing packages
1.1 dsieger 8023:
8024: Please note all package additions, updates, moves, and removals in pkgsrc/doc/
8025: CHANGES-YYYY. It's very important to keep this file up to date and conforming
8026: to the existing format, because it will be used by scripts to automatically
8027: update pages on www.NetBSD.org and other sites. Additionally, check the pkgsrc/
8028: doc/TODO file and remove the entry for the package you updated or removed, in
8029: case it was mentioned there.
8030:
8031: When the PKGREVISION of a package is bumped, the change should appear in pkgsrc
8032: /doc/CHANGES-YYYY if it is security related or otherwise relevant. Mass bumps
8033: that result from a dependency being updated should not be mentioned. In all
8034: other cases it's the developer's decision.
8035:
8036: There is a make target that helps in creating proper CHANGES-YYYY entries: make
8037: changes-entry. It uses the optional CTYPE and NETBSD_LOGIN_NAME variables. The
8038: general usage is to first make sure that your CHANGES-YYYY file is up-to-date
8039: (to avoid having to resolve conflicts later-on) and then to cd to the package
8040: directory. For package updates, make changes-entry is enough. For new packages,
8041: or package moves or removals, set the CTYPE variable on the command line to
1.4 rillig 8042: "Added", "Moved", or "Removed". You can set NETBSD_LOGIN_NAME in mk.conf if
1.23 jakllsch 8043: your local login name is not the same as your NetBSD login name. The target
8044: also automatically removes possibly existing entries for the package in the
8045: TODO file. Don't forget to commit the changes, e.g. by using make
1.66 asau 8046: commit-changes-entry! If you are not using a checkout directly from
1.23 jakllsch 8047: cvs.NetBSD.org, but e.g. a local copy of the repository, you can set
8048: USE_NETBSD_REPO=yes. This makes the cvs commands use the main repository.
1.1 dsieger 8049:
1.154 rillig 8050: 23.4. Commit Messages
1.130 wiz 8051:
8052: For several years, there have been mirrors of pkgsrc in fossil, git, and hg.
8053: Standard practise when using these tools is to make the first line of a commit
8054: message function as a summary that can be read without the rest, such as is
8055: commonly done with "git log --oneline". For this reason, we have the following
8056: guidelines for pkgsrc commit messages:
8057:
1.131 wiz 8058: * Start the commit message with a line that explains the big picture in 65
1.130 wiz 8059: characters or less. When a commit is for one package, include the name of
8060: the package. For updates, include the version to which it is updated.
8061:
8062: * Leave the next line empty.
8063:
8064: * Then come the details for the commit (changes in that package, reason for a
8065: change) and any relevant PRs. Wrap this section.
8066:
8067: Here is an example:
8068:
8069: libxslt: update to 1.0.30
8070:
8071: Changes since 1.0.29:
8072: ...
8073:
8074:
8075: Here is another example:
8076:
8077: mk/bsd.pkg.mk: enable SSP by default on NetBSD
8078:
8079: (rationale)
8080:
8081:
8082: Commit messages are final: no "cvs admin" is allowed on the pkgsrc repository
8083: to change commit messages.
8084:
1.154 rillig 8085: 23.5. Committing: Adding a package to CVS
1.1 dsieger 8086:
8087: This section is only of interest for pkgsrc developers with write access to the
1.34 wiz 8088: pkgsrc repository.
8089:
8090: When the package is finished, "cvs add" the files. Start by adding the
8091: directory and then files in the directory. Don't forget to add the new package
8092: to the category's Makefile. Make sure you don't forget any files; you can check
8093: by running "cvs status". An example:
8094:
8095: $ cd .../pkgsrc/category
8096: $ cvs add pkgname
8097: $ cd pkgname
8098: $ cvs add DESCR Makefile PLIST distinfo buildlink3.mk patches
8099: $ cvs add patches/p*
8100: $ cvs status | less
1.35 wiz 8101: $ cvs commit
1.34 wiz 8102: $ cd ..
8103: $ vi Makefile # add SUBDIRS+=pkgname line
1.35 wiz 8104: $ cvs commit Makefile
1.66 asau 8105: $ cd pkgname
1.73 jnemeth 8106: $ make CTYPE=Added commit-changes-entry
1.1 dsieger 8107:
8108: The commit message of the initial import should include part of the DESCR file,
8109: so people reading the mailing lists know what the package is/does.
8110:
1.34 wiz 8111: Also mention the new package in pkgsrc/doc/CHANGES-20xx.
8112:
8113: Previously, "cvs import" was suggested, but it was much easier to get wrong
8114: than "cvs add".
1.1 dsieger 8115:
1.154 rillig 8116: 23.6. Updating a package to a newer version
1.1 dsieger 8117:
8118: Please always put a concise, appropriate and relevant summary of the changes
8119: between old and new versions into the commit log when updating a package. There
8120: are various reasons for this:
8121:
8122: * A URL is volatile, and can change over time. It may go away completely or
8123: its information may be overwritten by newer information.
8124:
8125: * Having the change information between old and new versions in our CVS
8126: repository is very useful for people who use either cvs or anoncvs.
8127:
8128: * Having the change information between old and new versions in our CVS
8129: repository is very useful for people who read the pkgsrc-changes mailing
8130: list, so that they can make tactical decisions about when to upgrade the
8131: package.
8132:
8133: Please also recognize that, just because a new version of a package has been
8134: released, it should not automatically be upgraded in the CVS repository. We
8135: prefer to be conservative in the packages that are included in pkgsrc -
8136: development or beta packages are not really the best thing for most places in
8137: which pkgsrc is used. Please use your judgement about what should go into
8138: pkgsrc, and bear in mind that stability is to be preferred above new and
8139: possibly untested features.
8140:
1.154 rillig 8141: 23.7. Renaming a package in pkgsrc
1.21 snj 8142:
8143: Renaming packages is not recommended.
8144:
1.175 gutterid 8145: When renaming packages, be sure to fix any references to the old name in other
1.21 snj 8146: Makefiles, options, buildlink files, etc.
8147:
1.175 gutterid 8148: Also, when renaming a package, please add the package name and version pattern
1.167 leot 8149: (s) of the previous package to SUPERSEDES. This may be repeated for multiple
8150: renames. The new package would be an exact replacement. Example:
8151:
8152: SUPERSEDES+= p5-IO-Compress-Zlib<2.017
8153: SUPERSEDES+= optcomp-[0-9]*
1.21 snj 8154:
8155: Note that "successor" in the CHANGES-YYYY file doesn't necessarily mean that it
8156: supersedes, as that successor may not be an exact replacement but is a
8157: suggestion for the replaced functionality.
8158:
1.154 rillig 8159: 23.8. Moving a package in pkgsrc
1.21 snj 8160:
8161: It is preferred that packages are not renamed or moved, but if needed please
8162: follow these steps.
1.1 dsieger 8163:
8164: 1. Make a copy of the directory somewhere else.
8165:
8166: 2. Remove all CVS dirs.
8167:
8168: Alternatively to the first two steps you can also do:
8169:
8170: % cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package
8171:
8172: and use that for further work.
8173:
1.25 wiz 8174: 3. Fix CATEGORIES and any DEPENDS paths that just did "../package" instead of
1.1 dsieger 8175: "../../category/package".
8176:
1.21 snj 8177: 4. In the modified package's Makefile, consider setting PREV_PKGPATH to the
8178: previous category/package pathname. The PREV_PKGPATH can be used by tools
8179: for doing an update using pkgsrc building; for example, it can search the
8180: pkg_summary(5) database for PREV_PKGPATH (if no SUPERSEDES) and then use
8181: the corresponding new PKGPATH for that moved package. Note that it may have
8182: multiple matches, so the tool should also check on the PKGBASE too. The
8183: PREV_PKGPATH probably has no value unless SUPERSEDES is not set, i.e.
8184: PKGBASE stays the same.
8185:
8186: 5. cvs import the modified package in the new place.
1.1 dsieger 8187:
1.21 snj 8188: 6. Check if any package depends on it:
1.1 dsieger 8189:
8190: % cd /usr/pkgsrc
8191: % grep /package */*/Makefile* */*/buildlink*
8192:
1.21 snj 8193: 7. Fix paths in packages from step 5 to point to new location.
1.1 dsieger 8194:
1.21 snj 8195: 8. cvs rm (-f) the package at the old location.
1.1 dsieger 8196:
1.21 snj 8197: 9. Remove from oldcategory/Makefile.
1.1 dsieger 8198:
1.21 snj 8199: 10. Add to newcategory/Makefile.
1.1 dsieger 8200:
1.21 snj 8201: 11. Commit the changed and removed files:
1.1 dsieger 8202:
8203: % cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile
8204:
8205: (and any packages from step 5, of course).
8206:
1.154 rillig 8207: Chapter 24. Frequently Asked Questions
1.1 dsieger 8208:
8209: This section contains the answers to questions that may arise when you are
8210: writing a package. If you don't find your question answered here, first have a
8211: look in the other chapters, and if you still don't have the answer, ask on the
8212: pkgsrc-users mailing list.
8213:
1.154 rillig 8214: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
8215: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
8216: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
8217: 24.4. What is the difference between BUILDLINK_LDFLAGS, BUILDLINK_LDADD and
1.1 dsieger 8218: BUILDLINK_LIBS?
1.154 rillig 8219: 24.5. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
8220: 24.6. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.1 dsieger 8221: the := inside it.
1.154 rillig 8222: 24.7. Which mailing lists are there for package developers?
8223: 24.8. Where is the pkgsrc documentation?
8224: 24.9. I have a little time to kill. What shall I do?
1.1 dsieger 8225:
1.154 rillig 8226: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
1.1 dsieger 8227:
8228: MAKEFLAGS are the flags passed to the pkgsrc-internal invocations of make
8229: (1), while MAKE_FLAGS are the flags that are passed to the MAKE_PROGRAM
8230: when building the package. [FIXME: What is .MAKEFLAGS for?]
8231:
1.154 rillig 8232: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
1.1 dsieger 8233:
8234: MAKE is the path to the make(1) program that is used in the pkgsrc
8235: infrastructure. GMAKE is the path to GNU Make, but you need to say
8236: USE_TOOLS+=gmake to use that. MAKE_PROGRAM is the path to the Make
8237: program that is used for building the package.
8238:
1.154 rillig 8239: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
1.1 dsieger 8240:
8241: CC is the path to the real C compiler, which can be configured by the
8242: pkgsrc user. PKG_CC is the path to the compiler wrapper. PKGSRC_COMPILER
8243: is not a path to a compiler, but the type of compiler that should be
8244: used. See mk/compiler.mk for more information about the latter variable.
8245:
1.154 rillig 8246: 24.4. What is the difference between BUILDLINK_LDFLAGS, BUILDLINK_LDADD and
1.1 dsieger 8247: BUILDLINK_LIBS?
8248:
8249: [FIXME]
8250:
1.154 rillig 8251: 24.5. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
1.1 dsieger 8252:
1.25 wiz 8253: For optimization reasons, some variables are only available in the "
8254: wrapper" phase and later. To "simulate" the wrapper phase, append
1.1 dsieger 8255: PKG_PHASE=wrapper to the above command.
8256:
1.154 rillig 8257: 24.6. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.1 dsieger 8258: the := inside it.
8259:
1.108 rillig 8260: The := is not really an assignment operator, although it looks like it.
8261: Instead, it is a degenerate form of ${LIST:old_string=new_string}, which
8262: is documented in the make(1) man page and which is commonly used in the
8263: form ${SRCS:.c=.o}. In the case of MASTER_SITE_*, old_string is the empty
8264: string and new_string is package/. That's where the : and the = fall
8265: together.
1.1 dsieger 8266:
1.154 rillig 8267: 24.7. Which mailing lists are there for package developers?
1.1 dsieger 8268:
8269: tech-pkg
8270:
8271: This is a list for technical discussions related to pkgsrc
8272: development, e.g. soliciting feedback for changes to pkgsrc
8273: infrastructure, proposed new features, questions related to porting
8274: pkgsrc to a new platform, advice for maintaining a package, patches
8275: that affect many packages, help requests moved from pkgsrc-users when
8276: an infrastructure bug is found, etc.
8277:
8278: pkgsrc-bugs
8279:
8280: All bug reports in category "pkg" sent with send-pr(1) appear here.
8281: Please do not report your bugs here directly; use one of the other
8282: mailing lists.
8283:
1.154 rillig 8284: 24.8. Where is the pkgsrc documentation?
1.1 dsieger 8285:
8286: There are many places where you can find documentation about pkgsrc:
8287:
8288: * The pkgsrc guide (this document) is a collection of chapters that
8289: explain large parts of pkgsrc, but some chapters tend to be outdated.
8290: Which ones they are is hard to say.
8291:
1.174 leot 8292: * On the mailing list archives (see https://mail-index.NetBSD.org/),
8293: you can find discussions about certain features, announcements of new
1.1 dsieger 8294: parts of the pkgsrc infrastructure and sometimes even announcements
8295: that a certain feature has been marked as obsolete. The benefit here
8296: is that each message has a date appended to it.
8297:
8298: * Many of the files in the mk/ directory start with a comment that
8299: describes the purpose of the file and how it can be used by the
8300: pkgsrc user and package authors. An easy way to find this
8301: documentation is to run bmake help.
8302:
8303: * The CVS log messages are a rich source of information, but they tend
8304: to be highly abbreviated, especially for actions that occur often.
8305: Some contain a detailed description of what has changed, but they are
8306: geared towards the other pkgsrc developers, not towards an average
8307: pkgsrc user. They also only document changes, so if you don't know
8308: what has been before, these messages may not be worth too much to
8309: you.
8310:
8311: * Some parts of pkgsrc are only "implicitly documented", that is the
8312: documentation exists only in the mind of the developer who wrote the
8313: code. To get this information, use the cvs annotate command to see
8314: who has written it and ask on the tech-pkg mailing list, so that
8315: others can find your questions later (see above). To be sure that the
8316: developer in charge reads the mail, you may CC him or her.
8317:
1.154 rillig 8318: 24.9. I have a little time to kill. What shall I do?
1.1 dsieger 8319:
8320: This is not really an FAQ yet, but here's the answer anyway.
8321:
8322: * Run pkg_chk -N (from the pkgtools/pkg_chk package). It will tell you
8323: about newer versions of installed packages that are available, but
8324: not yet updated in pkgsrc.
8325:
1.198 leot 8326: * Browse pkgsrc/doc/TODO -- it contains a list of suggested new
8327: packages and a list of cleanups and enhancements for pkgsrc that
8328: would be nice to have.
1.1 dsieger 8329:
1.71 wiz 8330: * Review packages for which review was requested on the tech-pkg
8331: mailing list.
1.1 dsieger 8332:
8333: Part III. The pkgsrc infrastructure internals
8334:
8335: This part of the guide deals with everything from the infrastructure that is
8336: behind the interfaces described in the developer's guide. A casual package
8337: maintainer should not need anything from this part.
8338:
8339: Table of Contents
8340:
1.184 rillig 8341: 25. Design of the pkgsrc infrastructure
1.1 dsieger 8342:
1.184 rillig 8343: 25.1. The meaning of variable definitions
8344: 25.2. Avoiding problems before they arise
8345: 25.3. Variable evaluation
1.1 dsieger 8346:
1.184 rillig 8347: 25.3.1. At load time
8348: 25.3.2. At runtime
1.1 dsieger 8349:
1.184 rillig 8350: 25.4. How can variables be specified?
8351: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8352:
1.184 rillig 8353: 25.5.1. Procedures with parameters
8354: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8355:
1.184 rillig 8356: 25.6. The order in which files are loaded
1.1 dsieger 8357:
1.184 rillig 8358: 25.6.1. The order in bsd.prefs.mk
8359: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8360:
1.184 rillig 8361: 26. Regression tests
1.1 dsieger 8362:
1.184 rillig 8363: 26.1. Running the regression tests
8364: 26.2. Adding a new regression test
1.1 dsieger 8365:
1.184 rillig 8366: 26.2.1. Overridable functions
8367: 26.2.2. Helper functions
1.1 dsieger 8368:
1.184 rillig 8369: 27. Porting pkgsrc
1.1 dsieger 8370:
1.184 rillig 8371: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8372:
1.184 rillig 8373: Chapter 25. Design of the pkgsrc infrastructure
1.1 dsieger 8374:
8375: Table of Contents
8376:
1.184 rillig 8377: 25.1. The meaning of variable definitions
8378: 25.2. Avoiding problems before they arise
8379: 25.3. Variable evaluation
1.1 dsieger 8380:
1.184 rillig 8381: 25.3.1. At load time
8382: 25.3.2. At runtime
1.1 dsieger 8383:
1.184 rillig 8384: 25.4. How can variables be specified?
8385: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8386:
1.184 rillig 8387: 25.5.1. Procedures with parameters
8388: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8389:
1.184 rillig 8390: 25.6. The order in which files are loaded
1.1 dsieger 8391:
1.184 rillig 8392: 25.6.1. The order in bsd.prefs.mk
8393: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8394:
8395: The pkgsrc infrastructure consists of many small Makefile fragments. Each such
8396: fragment needs a properly specified interface. This chapter explains how such
8397: an interface looks like.
8398:
1.184 rillig 8399: 25.1. The meaning of variable definitions
1.1 dsieger 8400:
8401: Whenever a variable is defined in the pkgsrc infrastructure, the location and
8402: the way of definition provide much information about the intended use of that
8403: variable. Additionally, more documentation may be found in a header comment or
8404: in this pkgsrc guide.
8405:
8406: A special file is mk/defaults/mk.conf, which lists all variables that are
8407: intended to be user-defined. They are either defined using the ?= operator or
8408: they are left undefined because defining them to anything would effectively
8409: mean "yes". All these variables may be overridden by the pkgsrc user in the
8410: MAKECONF file.
8411:
8412: Outside this file, the following conventions apply: Variables that are defined
8413: using the ?= operator may be overridden by a package.
8414:
8415: Variables that are defined using the = operator may be used read-only at
8416: run-time.
8417:
8418: Variables whose name starts with an underscore must not be accessed outside the
8419: pkgsrc infrastructure at all. They may change without further notice.
8420:
8421: Note
8422:
8423: These conventions are currently not applied consistently to the complete pkgsrc
8424: infrastructure.
8425:
1.184 rillig 8426: 25.2. Avoiding problems before they arise
1.1 dsieger 8427:
8428: All variables that contain lists of things should default to being empty. Two
8429: examples that do not follow this rule are USE_LANGUAGES and DISTFILES. These
8430: variables cannot simply be modified using the += operator in package Makefiles
8431: (or other files included by them), since there is no guarantee whether the
8432: variable is already set or not, and what its value is. In the case of
8433: DISTFILES, the packages "know" the default value and just define it as in the
8434: following example.
8435:
8436: DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
8437:
8438: Because of the selection of this default value, the same value appears in many
8439: package Makefiles. Similarly for USE_LANGUAGES, but in this case the default
8440: value ("c") is so short that it doesn't stand out. Nevertheless it is mentioned
8441: in many files.
8442:
1.184 rillig 8443: 25.3. Variable evaluation
1.1 dsieger 8444:
1.184 rillig 8445: 25.3.1. At load time
1.1 dsieger 8446:
8447: Variable evaluation takes place either at load time or at runtime, depending on
8448: the context in which they occur. The contexts where variables are evaluated at
8449: load time are:
8450:
8451: * The right hand side of the := and != operators,
8452:
8453: * Make directives like .if or .for,
8454:
8455: * Dependency lines.
8456:
8457: A special exception are references to the iteration variables of .for loops,
8458: which are expanded inline, no matter in which context they appear.
8459:
8460: As the values of variables may change during load time, care must be taken not
8461: to evaluate them by accident. Typical examples for variables that should not be
8462: evaluated at load time are DEPENDS and CONFIGURE_ARGS. To make the effect more
8463: clear, here is an example:
8464:
8465: CONFIGURE_ARGS= # none
8466: CFLAGS= -O
8467: CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
8468:
8469: CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
8470:
8471: CFLAGS+= -Wall
8472:
8473: This code shows how the use of the := operator can quickly lead to unexpected
8474: results. The first paragraph is fairly common code. The second paragraph
8475: evaluates the CONFIGURE_ARGS variable, which results in CFLAGS=-O. In the third
8476: paragraph, the -Wall is appended to the CFLAGS, but this addition will not
8477: appear in CONFIGURE_ARGS. In actual code, the three paragraphs from above
8478: typically occur in completely unrelated files.
8479:
1.184 rillig 8480: 25.3.2. At runtime
1.1 dsieger 8481:
8482: After all the files have been loaded, the values of the variables cannot be
8483: changed anymore. Variables that are used in the shell commands are expanded at
8484: this point.
8485:
1.184 rillig 8486: 25.4. How can variables be specified?
1.1 dsieger 8487:
8488: There are many ways in which the definition and use of a variable can be
8489: restricted in order to detect bugs and violations of the (mostly unwritten)
1.108 rillig 8490: policies. A package can be checked with pkglint -Wall to see whether it meets
8491: these rules.
1.1 dsieger 8492:
1.184 rillig 8493: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8494:
8495: Most of the .mk files fall into one of the following classes. Cases where a
8496: file falls into more than one class should be avoided as it often leads to
8497: subtle bugs.
8498:
1.184 rillig 8499: 25.5.1. Procedures with parameters
1.1 dsieger 8500:
8501: In a traditional imperative programming language some of the .mk files could be
1.198 leot 8502: described as procedures. They take some input parameters and--after
8503: inclusion--provide a result in output parameters. Since all variables in
1.23 jakllsch 8504: Makefiles have global scope care must be taken not to use parameter names that
8505: have already another meaning. For example, PKGNAME is a bad choice for a
8506: parameter name.
1.1 dsieger 8507:
8508: Procedures are completely evaluated at preprocessing time. That is, when
8509: calling a procedure all input parameters must be completely resolvable. For
8510: example, CONFIGURE_ARGS should never be an input parameter since it is very
8511: likely that further text will be added after calling the procedure, which would
8512: effectively apply the procedure to only a part of the variable. Also,
1.108 rillig 8513: references to other variables will be modified after calling the procedure.
1.1 dsieger 8514:
8515: A procedure can declare its output parameters either as suitable for use in
8516: preprocessing directives or as only available at runtime. The latter
8517: alternative is for variables that contain references to other runtime
8518: variables.
8519:
8520: Procedures shall be written such that it is possible to call the procedure more
8521: than once. That is, the file must not contain multiple-inclusion guards.
8522:
8523: Examples for procedures are mk/bsd.options.mk and mk/buildlink3/bsd.builtin.mk.
8524: To express that the parameters are evaluated at load time, they should be
8525: assigned using the := operator, which should be used only for this purpose.
8526:
1.184 rillig 8527: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8528:
8529: Action files take some input parameters and may define runtime variables. They
8530: shall not define loadtime variables. There are action files that are included
8531: implicitly by the pkgsrc infrastructure, while other must be included
8532: explicitly.
8533:
8534: An example for action files is mk/subst.mk.
8535:
1.184 rillig 8536: 25.6. The order in which files are loaded
1.1 dsieger 8537:
8538: Package Makefiles usually consist of a set of variable definitions, and include
8539: the file ../../mk/bsd.pkg.mk in the very last line. Before that, they may also
8540: include various other *.mk files if they need to query the availability of
8541: certain features like the type of compiler or the X11 implementation. Due to
8542: the heavy use of preprocessor directives like .if and .for, the order in which
8543: the files are loaded matters.
8544:
8545: This section describes at which point the various files are loaded and gives
8546: reasons for that order.
8547:
1.184 rillig 8548: 25.6.1. The order in bsd.prefs.mk
1.1 dsieger 8549:
8550: The very first action in bsd.prefs.mk is to define some essential variables
8551: like OPSYS, OS_VERSION and MACHINE_ARCH.
8552:
1.4 rillig 8553: Then, the user settings are loaded from the file specified in MAKECONF, which
8554: is usually mk.conf. After that, those variables that have not been overridden
8555: by the user are loaded from mk/defaults/mk.conf.
1.1 dsieger 8556:
8557: After the user settings, the system settings and platform settings are loaded,
8558: which may override the user settings.
8559:
8560: Then, the tool definitions are loaded. The tool wrappers are not yet in effect.
8561: This only happens when building a package, so the proper variables must be used
8562: instead of the direct tool names.
8563:
8564: As the last steps, some essential variables from the wrapper and the package
8565: system flavor are loaded, as well as the variables that have been cached in
8566: earlier phases of a package build.
8567:
1.184 rillig 8568: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8569:
8570: First, bsd.prefs.mk is loaded.
8571:
8572: Then, the various *-vars.mk files are loaded, which fill default values for
8573: those variables that have not been defined by the package. These variables may
8574: later be used even in unrelated files.
8575:
8576: Then, the file bsd.pkg.error.mk provides the target error-check that is added
8577: as a special dependency to all other targets that use DELAYED_ERROR_MSG or
8578: DELAYED_WARNING_MSG.
8579:
8580: Then, the package-specific hacks from hacks.mk are included.
8581:
8582: Then, various other files follow. Most of them don't have any dependencies on
8583: what they need to have included before or after them, though some do.
8584:
8585: The code to check PKG_FAIL_REASON and PKG_SKIP_REASON is then executed, which
8586: restricts the use of these variables to all the files that have been included
8587: before. Appearances in later files will be silently ignored.
8588:
8589: Then, the files for the main targets are included, in the order of later
8590: execution, though the actual order should not matter.
8591:
8592: At last, some more files are included that don't set any interesting variables
8593: but rather just define make targets to be executed.
8594:
1.184 rillig 8595: Chapter 26. Regression tests
1.1 dsieger 8596:
8597: Table of Contents
8598:
1.184 rillig 8599: 26.1. Running the regression tests
8600: 26.2. Adding a new regression test
1.1 dsieger 8601:
1.184 rillig 8602: 26.2.1. Overridable functions
8603: 26.2.2. Helper functions
1.1 dsieger 8604:
8605: The pkgsrc infrastructure consists of a large codebase, and there are many
8606: corners where every little bit of a file is well thought out, making pkgsrc
8607: likely to fail as soon as anything is changed near those parts. To prevent most
8608: changes from breaking anything, a suite of regression tests should go along
8609: with every important part of the pkgsrc infrastructure. This chapter describes
8610: how regression tests work in pkgsrc and how you can add new tests.
8611:
1.184 rillig 8612: 26.1. Running the regression tests
1.1 dsieger 8613:
1.25 wiz 8614: You first need to install the pkgtools/pkg_regress package, which provides the
1.1 dsieger 8615: pkg_regress command. Then you can simply run that command, which will run all
1.168 rillig 8616: tests in the regress/ directory.
1.1 dsieger 8617:
1.184 rillig 8618: 26.2. Adding a new regression test
1.1 dsieger 8619:
1.168 rillig 8620: Every directory in the regress/ directory that contains a file called spec is
1.1 dsieger 8621: considered a regression test. This file is a shell program that is included by
8622: the pkg_regress command. The following functions can be overridden to suit your
8623: needs.
8624:
1.184 rillig 8625: 26.2.1. Overridable functions
1.1 dsieger 8626:
1.108 rillig 8627: These functions do not take any parameters. Although they are called in "set -e
1.168 rillig 8628: " mode, they don't stop at the first failing command. See this Stack Overflow
1.108 rillig 8629: question for details.
1.1 dsieger 8630:
1.108 rillig 8631: do_setup
1.1 dsieger 8632:
8633: This function prepares the environment for the test. By default it does
8634: nothing.
8635:
1.108 rillig 8636: do_test
1.1 dsieger 8637:
8638: This function runs the actual test. By default, it calls TEST_MAKE with the
8639: arguments MAKEARGS_TEST and writes its output including error messages into
8640: the file TEST_OUTFILE.
8641:
1.108 rillig 8642: When defining this function, make sure that all output that needs to be
8643: checked is written to the correct output file. Example:
8644:
8645: do_test() {
8646: echo "Example output"
8647: } 1>$TEST_OUTFILE 2>&1
8648:
8649: check_result
1.1 dsieger 8650:
8651: This function is run after the test and is typically used to compare the
8652: actual output from the one that is expected. It can make use of the various
1.108 rillig 8653: helper functions from the next section. Example:
8654:
8655: check_result() {
8656: exit_status 0
8657: output_require "Example"
8658: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
8659: output_prohibit "no such file or directory"
1.169 rillig 8660: regress_fail "expected $expected but got $actual for input $input"
1.108 rillig 8661: }
1.1 dsieger 8662:
1.108 rillig 8663: do_cleanup
1.1 dsieger 8664:
8665: This function cleans everything up after the test has been run. By default
8666: it does nothing.
8667:
1.184 rillig 8668: 26.2.2. Helper functions
1.1 dsieger 8669:
1.168 rillig 8670: regress_fail message...
8671:
8672: This function makes the test fail with the given error message.
8673:
1.108 rillig 8674: exit_status expected
1.1 dsieger 8675:
1.108 rillig 8676: This function compares the exitcode of the do_test function with its first
8677: parameter. If they differ, the test will fail.
1.1 dsieger 8678:
1.108 rillig 8679: output_require regex...
1.1 dsieger 8680:
8681: This function checks for each of its parameters if the output from do_test
1.108 rillig 8682: matches the extended regular expression. If it does not, the test will
8683: fail. Example:
8684:
8685: output_require "looks fine"
8686: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
1.1 dsieger 8687:
1.177 leot 8688: output_prohibit regex...
1.1 dsieger 8689:
8690: This function checks for each of its parameters if the output from do_test
8691: () does not match the extended regular expression. If any of the regular
8692: expressions matches, the test will fail.
8693:
1.184 rillig 8694: Chapter 27. Porting pkgsrc
1.1 dsieger 8695:
8696: Table of Contents
8697:
1.184 rillig 8698: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8699:
8700: The pkgsrc system has already been ported to many operating systems, hardware
8701: architectures and compilers. This chapter explains the necessary steps to make
8702: pkgsrc even more portable.
8703:
1.184 rillig 8704: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8705:
8706: To port pkgsrc to a new operating system (called MyOS in this example), you
8707: need to touch the following files:
8708:
8709: pkgtools/bootstrap-mk-files/files/mods/MyOS.sys.mk
8710:
8711: This file contains some basic definitions, for example the name of the C
8712: compiler.
8713:
8714: mk/bsd.prefs.mk
8715:
1.212 wiz 8716: Insert code that defines the variables OPSYS, OS_VERSION, OPSYS_VERSION,
1.1 dsieger 8717: LOWER_VENDOR, MACHINE_ARCH, OBJECT_FMT, APPEND_ELF, and the other variables
8718: that appear in this file.
8719:
8720: mk/platform/MyOS.mk
8721:
8722: This file contains the platform-specific definitions that are used by
8723: pkgsrc. Start by copying one of the other files and edit it to your needs.
8724:
8725: mk/tools/tools.MyOS.mk
8726:
8727: This file defines the paths to all the tools that are needed by one or the
8728: other package in pkgsrc, as well as by pkgsrc itself. Find out where these
8729: tools are on your platform and add them.
8730:
8731: Now, you should be able to build some basic packages, like lang/perl5, shells/
8732: bash.
8733:
8734: Appendix A. A simple example package: bison
8735:
8736: Table of Contents
8737:
8738: A.1. files
8739:
8740: A.1.1. Makefile
8741: A.1.2. DESCR
8742: A.1.3. PLIST
8743: A.1.4. Checking a package with pkglint
8744:
8745: A.2. Steps for building, installing, packaging
8746:
8747: We checked to find a piece of software that wasn't in the packages collection,
1.25 wiz 8748: and picked GNU bison. Quite why someone would want to have bison when Berkeley
1.1 dsieger 8749: yacc is already present in the tree is beyond us, but it's useful for the
8750: purposes of this exercise.
8751:
8752: A.1. files
8753:
8754: A.1.1. Makefile
8755:
1.2 rillig 8756: # $NetBSD$
1.1 dsieger 8757: #
8758:
8759: DISTNAME= bison-1.25
8760: CATEGORIES= devel
1.171 rillig 8761: MASTER_SITES= ${MASTER_SITE_GNU:=bison/}
1.1 dsieger 8762:
1.30 dholland 8763: MAINTAINER= pkgsrc-users@NetBSD.org
1.174 leot 8764: HOMEPAGE= https://www.gnu.org/software/bison/bison.html
1.1 dsieger 8765: COMMENT= GNU yacc clone
8766:
8767: GNU_CONFIGURE= yes
1.47 wiz 8768: INFO_FILES= yes
1.1 dsieger 8769:
8770: .include "../../mk/bsd.pkg.mk"
8771:
8772: A.1.2. DESCR
8773:
8774: GNU version of yacc. Can make re-entrant parsers, and numerous other
8775: improvements. Why you would want this when Berkeley yacc(1) is part
8776: of the NetBSD source tree is beyond me.
8777:
8778: A.1.3. PLIST
8779:
1.2 rillig 8780: @comment $NetBSD$
1.1 dsieger 8781: bin/bison
8782: man/man1/bison.1.gz
8783: share/bison.simple
8784: share/bison.hairy
8785:
8786: A.1.4. Checking a package with pkglint
8787:
8788: The NetBSD package system comes with pkgtools/pkglint which helps to check the
8789: contents of these files. After installation it is quite easy to use, just
1.171 rillig 8790: change to the directory of the package you wish to examine and run pkglint:
1.1 dsieger 8791:
8792: $ pkglint
1.171 rillig 8793: ERROR: Makefile: Each package must define its LICENSE.
8794: WARN: Makefile:9: HOMEPAGE should migrate from http to https.
8795: NOTE: PLIST:3: The .gz extension is unnecessary for manual pages.
8796: WARN: PLIST:5: "share/bison.hairy" should be sorted before "share/bison.simple".
8797: 1 error, 2 warnings and 1 note found.
8798: (Run "pkglint -e" to show explanations.)
8799: (Run "pkglint -fs" to show what can be fixed automatically.)
1.172 rillig 8800: (Run "pkglint -F" to automatically fix some issues.)
1.1 dsieger 8801:
8802: Depending on the supplied command line arguments (see pkglint(1)), more checks
1.170 rillig 8803: will be performed. Use e.g. pkglint -Wall for a very thorough check.
1.1 dsieger 8804:
8805: A.2. Steps for building, installing, packaging
8806:
8807: Create the directory where the package lives, plus any auxiliary directories:
8808:
8809: # cd /usr/pkgsrc/lang
8810: # mkdir bison
8811: # cd bison
8812: # mkdir patches
8813:
1.184 rillig 8814: Create Makefile, DESCR and PLIST (see Chapter 12, Package components - files,
1.1 dsieger 8815: directories and contents) then continue with fetching the distfile:
8816:
8817: # make fetch
8818: >> bison-1.25.tar.gz doesn't seem to exist on this system.
8819: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
8820: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8821: ftp: Error retrieving file: 500 Internal error
8822:
8823: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
8824: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8825: ftp: Error retrieving file: 500 Internal error
8826:
8827: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
8828: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8829: Successfully retrieved file.
8830:
8831: Generate the checksum of the distfile into distinfo:
8832:
8833: # make makedistinfo
8834:
8835: Now compile:
8836:
8837: # make
8838: >> Checksum OK for bison-1.25.tar.gz.
8839: ===> Extracting for bison-1.25
8840: ===> Patching for bison-1.25
8841: ===> Ignoring empty patch directory
8842: ===> Configuring for bison-1.25
8843: creating cache ./config.cache
8844: checking for gcc... cc
8845: checking whether we are using GNU C... yes
8846: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
8847: checking how to run the C preprocessor... cc -E
8848: checking for minix/config.h... no
8849: checking for POSIXized ISC... no
8850: checking whether cross-compiling... no
8851: checking for ANSI C header files... yes
8852: checking for string.h... yes
8853: checking for stdlib.h... yes
8854: checking for memory.h... yes
8855: checking for working const... yes
8856: checking for working alloca.h... no
8857: checking for alloca... yes
8858: checking for strerror... yes
8859: updating cache ./config.cache
8860: creating ./config.status
8861: creating Makefile
8862: ===> Building for bison-1.25
8863: 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
8864: 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
8865: 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
8866: 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
8867: 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
8868: 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
8869: 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
8870: 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
8871: 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
8872: 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
8873: 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
8874: 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
8875: 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
8876: 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
8877: 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
8878: 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
8879: 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
8880: 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
8881: 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
8882: 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
8883: 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
8884: 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
8885: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
8886: rm -f bison.s1
8887: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
8888:
8889: Everything seems OK, so install the files:
8890:
8891: # make install
8892: >> Checksum OK for bison-1.25.tar.gz.
8893: ===> Installing for bison-1.25
8894: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
8895: rm -f /usr/pkg/bin/bison
8896: cd /usr/pkg/share; rm -f bison.simple bison.hairy
8897: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
8898: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
8899: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
8900: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
8901: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
8902: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
8903: ===> Registering installation for bison-1.25
8904:
8905: You can now use bison, and also - if you decide so - remove it with pkg_delete
8906: bison. Should you decide that you want a binary package, do this now:
8907:
8908: # make package
8909: >> Checksum OK for bison-1.25.tar.gz.
8910: ===> Building package for bison-1.25
8911: Creating package bison-1.25.tgz
8912: Registering depends:.
8913: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
8914:
8915: Now that you don't need the source and object files any more, clean up:
8916:
8917: # make clean
8918: ===> Cleaning for bison-1.25
8919:
1.207 leot 8920: Appendix B. Security hardening
8921:
8922: Table of Contents
8923:
8924: B.1. Mechanisms
8925:
8926: B.1.1. Enabled by default
8927: B.1.2. Not enabled by default
8928:
8929: B.2. Caveats
8930:
8931: B.2.1. Problems with PKGSRC_MKPIE
8932: B.2.2. Problems with PKGSRC_USE_FORTIFY
8933: B.2.3. Problems with PKGSRC_USE_RELRO
8934: B.2.4. Problems with PKGSRC_USE_SSP
8935:
8936: B.3. Auditing the system
8937:
8938: B.3.1. Checking for PIE
8939: B.3.2. Checking for partial RELRO
8940: B.3.3. Checking for full RELRO
8941: B.3.4. Checking for SSP
8942:
8943: A number of mechanisms are available in pkgsrc to improve the security of the
8944: resulting system. This page describes the mechanisms, and gives hints about
8945: detecting and fixing problems.
8946:
8947: Mechanisms can be enabled individually in mk.conf, and are individually
8948: described below.
8949:
8950: Typically, a feature will cause some programs to fail to build or work when
8951: first enabled. This can be due to latent problems in the program, and can be
8952: due to other reasons. After enough testing to have confidence that user
8953: problems will be quite rare, individual mechanisms will be enabled by default.
8954:
8955: For each mechanism, see the Caveats section below for an explanation of what
8956: might go wrong at compile time and at run time, and how to notice and address
8957: these problems.
8958:
8959: B.1. Mechanisms
8960:
8961: B.1.1. Enabled by default
8962:
8963: B.1.1.1. PKGSRC_USE_FORTIFY
8964:
8965: This allows substitute wrappers to be used for some commonly used library
8966: functions that do not have built-in bounds checking - but could in some cases.
8967:
8968: Two mitigation levels are available:
8969:
8970: * "weak" only enables checks at compile-time.
8971:
8972: * "strong" enables checks at compile-time and runtime.
8973:
8974: "strong" has been enabled by default since pkgsrc-2017Q3.
8975:
8976: B.1.1.2. PKGSRC_USE_SSP
8977:
8978: This enables a stack-smashing protection mitigation. It is done by adding a
8979: guard variable to functions with vulnerable objects. The guards are initialized
8980: when a function is entered and then checked when the function exits. The guard
8981: check will fail and the program forcibly exited if the variable was modified in
8982: the meantime. This can happen in case of buffer overflows or memory corruption,
8983: and therefore exposing these bugs.
8984:
8985: Different mitigation levels are available:
8986:
8987: * "yes", which will only protect functions considered vulnerable by the
8988: compiler;
8989:
8990: * "all", which will protect every function;
8991:
8992: * "strong", the default, which will apply a better balance between the two
8993: settings above.
8994:
8995: This mitigation is supported by both GCC and clang. It may be supported in
8996: additional compilers, possibly under a different name. It is particularly
8997: useful for unsafe programming languages, such as C/C++.
8998:
8999: * "yes" is enabled by default where known supported since pkgsrc-2017Q3.
9000:
9001: * "strong" is enabled by default where known supported since pkgsrc-2021Q4.
9002:
9003: More details can be found here:
9004:
9005: * Buffer overflow protection on Wikipedia
9006:
9007: B.1.1.3. PKGSRC_MKPIE
9008:
9009: This requests the creation of PIE (Position Independent Executables) for all
9010: executables. The PIE mechanism is normally used for shared libraries, so that
9011: they can be loaded at differing addresses at runtime. PIE itself does not have
9012: useful security properties; however, it is necessary to fully leverage some,
9013: such as ASLR. Some operating systems support Address Space Layout Randomization
9014: (ASLR), which causes different addresses to be used each time a program is run.
9015: This makes it more difficult for an attacker to guess addresses and thus makes
9016: exploits harder to construct. With PIE, ASLR can really be applied to the
9017: entire program, instead of the stack and heap only.
9018:
9019: PIE executables will only be built for toolchains that are known to support
9020: PIE. Currently, this means NetBSD on x86, ARM, SPARC64, m68k, and MIPS.
9021:
9022: PKGSRC_MKPIE was enabled by default after the pkgsrc-2021Q3 branch.
9023:
1.219 nia 9024: B.1.1.4. PKGSRC_USE_RELRO
1.207 leot 9025:
9026: This also makes the exploitation of some security vulnerabilities more
9027: difficult in some cases.
9028:
9029: Two different mitigation levels are available:
9030:
1.219 nia 9031: * partial (the default): the ELF sections are reordered so that internal data
9032: sections precede the program's own data sections, and non-PLT GOT is
9033: read-only;
1.207 leot 9034:
9035: * full: in addition to partial RELRO, every relocation is performed
1.218 nia 9036: immediately when starting the program, allowing the entire GOT to be
9037: read-only. This can greatly slow down startup of large programs.
1.207 leot 9038:
9039: This is currently supported by GCC. Many software distributions now enable this
1.220 nia 9040: feature by default, at the "partial" level.
1.207 leot 9041:
9042: More details can be found here:
9043:
9044: * Hardening ELF binaries using Relocation Read-Only (RELRO)
9045:
1.219 nia 9046: B.1.2. Not enabled by default
9047:
9048: B.1.2.1. PKGSRC_MKREPRO
9049:
9050: With this option, pkgsrc will try to build packages reproducibly. This allows
9051: packages built from the same tree and with the same options, to produce
9052: identical results bit by bit. This option should be combined with ASLR and
9053: PKGSRC_MKPIE to avoid predictable address offsets for attackers attempting to
9054: exploit security vulnerabilities.
9055:
9056: More details can be found here:
9057:
9058: * Reproducible Builds - a set of software development practices that create
9059: an independently-verifiable path from source to binary code
9060:
9061: More work likely needs to be done before pkgsrc is fully reproducible.
9062:
9063: B.1.2.2. PKGSRC_USE_STACK_CHECK
1.207 leot 9064:
9065: This uses -fstack-check with GCC for another stack protection mitigation.
9066:
9067: It asks the compiler to generate code verifying that it does not corrupt the
9068: stack. According to GCC's manual page, this is really only useful for
9069: multi-threaded programs.
9070:
9071: B.2. Caveats
9072:
9073: B.2.1. Problems with PKGSRC_MKPIE
9074:
9075: B.2.1.1. Packages failing to build
9076:
9077: A number of packages may fail to build with this option enabled. The failures
9078: are often related to the absence of the -fPIC compilation flag when building
9079: libraries or executables (or ideally -fPIE in the latter case). This flag is
9080: added to the CFLAGS already, but requires the package to actually support it.
9081:
9082: B.2.1.1.1. How to fix
9083:
9084: These instructions are meant as a reference only; they likely need to be
9085: adapted for many packages individually.
9086:
9087: For packages using Makefiles:
9088:
9089: MAKE_FLAGS+= CFLAGS=${CFLAGS:Q}
9090: MAKE_FLAGS+= LDFLAGS=${LDFLAGS:Q}
9091:
9092: For packages using Imakefiles:
9093:
9094: MAKE_FLAGS+= CCOPTIONS=${CFLAGS:Q}
9095: MAKE_FLAGS+= LOCAL_LDFLAGS=${LDFLAGS:Q}
9096:
9097: B.2.1.2. Run-time crashes
9098:
9099: Some programs may fail to run, or crash at random times once built as PIE. Two
9100: scenarios are essentially possible. This is nearly always due to a bug in the
9101: program being exposed due to ASLR.
9102:
9103: B.2.1.3. Disabling PKGSRC_MKPIE on a per-package basis
9104:
9105: Ideally, packages should be fixed for compatibility with MKPIE. However, in
9106: some cases this is very difficult, due to complex build systems, packages using
9107: non-standard toolchains, or programming languages with odd bootstrapping
9108: mechanisms.
9109:
9110: To disable PKGSRC_MKPIE on a per-package basis, set MKPIE_SUPPORTED= no in the
9111: package's Makefile before bsd.prefs.mk is included.
9112:
9113: B.2.2. Problems with PKGSRC_USE_FORTIFY
9114:
9115: B.2.2.1. Packages failing to build
9116:
9117: This feature makes use of pre-processing directives to look for hardened,
9118: alternative implementations of essential library calls. Some programs may fail
9119: to build as a result; this usually happens for those trying too hard to be
9120: portable, or otherwise abusing definitions in the standard library.
9121:
9122: B.2.2.2. Run-time crashes
9123:
9124: This feature may cause some programs to crash, usually indicating an actual bug
9125: in the program. The fix will typically involve patching the original program's
9126: source code.
9127:
9128: B.2.2.3. Optimization is required
9129:
9130: At least in the case of GCC, FORTIFY will only be applied if optimization is
9131: applied while compiling. This means that the CFLAGS should also contain -O, -O2
9132: or another optimization level. This cannot easily be applied globally, as some
9133: packages may require specific optimization levels.
9134:
9135: B.2.2.4. Disabling FORTIFY on a per-package basis
9136:
9137: Note
9138:
9139: FORTIFY should not be disabled to work around runtime crashes in the program!
9140: This is a very bad idea and will expose you to security vulnerabilities.
9141:
9142: To disable FORTIFY on a per-package basis, set the following in the package's
9143: Makefile before bsd.prefs.mk is included:
9144:
9145: FORTIFY_SUPPORTED= no
9146:
9147: B.2.3. Problems with PKGSRC_USE_RELRO
9148:
9149: B.2.3.1. Performance impact
9150:
9151: For better protection, full RELRO requires every symbol to be resolved when the
9152: program starts, rather than simply when required at run-time. This will have
9153: more impact on programs using a lot of symbols, or linked to libraries exposing
9154: a lot of symbols. Therefore, daemons or programs otherwise running in
9155: background are affected only when started. Programs loading plug-ins at
9156: run-time are affected when loading the plug-ins.
9157:
9158: The impact is not expected to be noticeable on modern hardware, except in some
9159: cases for big programs.
9160:
9161: B.2.3.2. Run-time crashes
9162:
9163: Some programs handle plug-ins and dependencies in a way that conflicts with
9164: RELRO: for instance, with an initialization routine listing any other plug-in
9165: required. With full RELRO, the missing symbols are resolved before the
9166: initialization routine can run, and the dynamic loader will not be able to find
9167: them directly and abort as a result. Unfortunately, this is how Xorg loads its
9168: drivers. Partial RELRO can be applied instead in this case.
9169:
9170: B.2.3.3. Disabling RELRO on a per-package basis
9171:
9172: To disable RELRO on a per-package basis, set the following in the package's
9173: Makefile before bsd.prefs.mk is included:
9174:
9175: RELRO_SUPPORTED= no
9176:
1.209 nia 9177: It is also possible to at most enable partial RELRO, by setting RELRO_SUPPORTED
9178: to partial.
9179:
1.207 leot 9180: B.2.4. Problems with PKGSRC_USE_SSP
9181:
9182: B.2.4.1. Packages failing to build
9183:
9184: The stack-smashing protection provided by this option does not work for some
9185: programs. The most common situation in which this happens is when the program
9186: allocates variables on the stack, with the size determined at run-time.
9187:
9188: B.2.4.2. Run-time crashes
9189:
9190: Again, this feature may cause some programs to crash via a SIGABRT, usually
9191: indicating an actual bug in the program.
9192:
9193: On NetBSD LOG_CRIT level syslog messages are sent and - by default - appended
9194: to /var/log/messages, e.g.:
9195:
9196: Jan 6 15:42:51 hostname -: hostname program - - - buffer overflow detected; terminated
9197:
9198: (where hostname is the hostname(1) and program is the basename(1) of the
9199: program crashed).
9200:
9201: Patching the original program is then required.
9202:
9203: Rebuilding the package via:
9204:
9205: % env CFLAGS=-g INSTALL_UNSTRIPPED=yes make replace
9206:
9207: and inspecting the backtrace of the coredump via the debugger should point out
9208: the problematic call by inspecting the frame calling the _chk() (SSP) function.
9209:
9210: B.2.4.3. Performance impact
9211:
9212: The compiler emits extra code when using this feature: a check for buffer
9213: overflows is performed when entering and exiting functions, requiring an extra
9214: variable on the stack. The level of protection can otherwise be adjusted to
9215: affect only those functions considered more sensitive by the compiler (with
9216: -fstack-protector instead of -fstack-protector-all).
9217:
9218: The impact is not expected to be noticeable on modern hardware. However,
9219: programs with a hard requirement to run at the fastest possible speed should
9220: avoid using this feature, or using libraries built with this feature.
9221:
9222: B.2.4.4. Disabling SSP on a per-package basis
9223:
9224: Note
9225:
9226: SSP should not be disabled to work around runtime crashes in the program! This
9227: is a very bad idea and will expose you to security vulnerabilities.
9228:
9229: To disable SSP on a per-package basis, set the following in the package's
9230: Makefile before bsd.prefs.mk is included:
9231:
9232: SSP_SUPPORTED= no
9233:
9234: B.3. Auditing the system
9235:
9236: The illusion of security is worse than having no security at all. This section
9237: lists a number of ways to ensure the security features requested are actually
9238: effective.
9239:
9240: These instructions were obtained and tested on a system derived from NetBSD 7
9241: (amd64). YMMV.
9242:
9243: B.3.1. Checking for PIE
9244:
9245: The ELF executable type in use changes for binaries built as PIE; without:
9246:
9247: $ file /path/to/bin/ary
9248: /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
9249:
9250: as opposed to the following binary, built as PIE:
9251:
9252: $ file /path/to/pie/bin/ary
9253: /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
9254:
9255: The latter result is then what is expected.
9256:
9257: B.3.2. Checking for partial RELRO
9258:
9259: The following command should list a section called RELRO:
9260:
9261: $ objdump -p /path/to/bin/ary
9262:
9263: /path/to/bin/ary: file format elf64-x86-64
9264:
9265: Program Header:
9266: [...]
9267: RELRO off 0x0000000000000d78 vaddr 0x0000000000600d78 paddr 0x0000000000600d78 align 2**0
9268:
9269: This check is now performed automatically if PKG_DEVELOPER is set and RELRO is
9270: enabled.
9271:
9272: B.3.3. Checking for full RELRO
9273:
9274: The dynamic loader will apply RELRO immediately when detecting the presence of
9275: the BIND_NOW flag:
9276:
9277: $ objdump -x /path/to/bin/ary
9278:
9279: /path/to/bin/ary: file format elf64-x86-64
9280:
9281: Dynamic Section:
9282: [...]
9283: BIND_NOW 0x0000000000000000
9284:
9285: This has to be combined with partial RELRO (see above) to be fully efficient.
9286:
9287: This check is now performed automatically (where supported) if PKG_DEVELOPER is
9288: set.
9289:
9290: B.3.4. Checking for SSP
9291:
1.208 nia 9292: Note
9293:
9294: Checking for SSP using this method only works where the operating system uses
9295: libssp. libssp is not used on recent NetBSD/FreeBSD/Linux versions.
9296:
1.207 leot 9297: Building objects, binaries and libraries with SSP will affect the presence of
9298: additional symbols in the resulting file:
9299:
9300: $ nm /path/to/bin/ary
9301: [...]
9302: U __stack_chk_fail
9303: 0000000000600ea0 B __stack_chk_guard
9304:
9305: This is an indicator that the program was indeed built with support for SSP.
9306:
9307: This check is now performed automatically (where supported) if PKG_DEVELOPER is
9308: set and SSP is enabled.
9309:
9310: Appendix C. Build logs
1.1 dsieger 9311:
9312: Table of Contents
9313:
1.207 leot 9314: C.1. Building figlet
9315: C.2. Packaging figlet
1.1 dsieger 9316:
1.207 leot 9317: C.1. Building figlet
1.1 dsieger 9318:
9319: # make
9320: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9321: => figlet221.tar.gz doesn't seem to exist on this system.
9322: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
9323: => [172219 bytes]
9324: Connected to ftp.plig.net.
9325: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
9326: 331 Guest login ok, send your complete e-mail address as password.
9327: 230-You are user #5 of 500 simultaneous users allowed.
9328: 230-
9329: 230- ___ _ _ _
9330: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
9331: 230- | _| _| . |_| . | | | . |_| . | _| . |
9332: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
9333: 230- |_| |_| |___| |___|
9334: 230-
9335: 230-** Welcome to ftp.plig.org **
9336: 230-
9337: 230-Please note that all transfers from this FTP site are logged. If you
9338: 230-do not like this, please disconnect now.
9339: 230-
1.19 snj 9340: 230-This archive is available via
1.1 dsieger 9341: 230-
9342: 230-HTTP: http://ftp.plig.org/
9343: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
9344: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
9345: 230-
9346: 230-Please email comments, bug reports and requests for packages to be
9347: 230-mirrored to ftp-admin@plig.org.
9348: 230-
9349: 230-
9350: 230 Logged in anonymously.
9351: Remote system type is UNIX.
9352: Using binary mode to transfer files.
9353: 200 Type okay.
9354: 250 "/pub" is new cwd.
9355: 250-"/pub/figlet" is new cwd.
9356: 250-
9357: 250-Welcome to the figlet archive at ftp.figlet.org
9358: 250-
9359: 250- ftp://ftp.figlet.org/pub/figlet/
9360: 250-
9361: 250-The official FIGlet web page is:
9362: 250- http://www.figlet.org/
9363: 250-
9364: 250-If you have questions, please mailto:info@figlet.org. If you want to
9365: 250-contribute a font or something else, you can email us.
9366: 250
9367: 250 "/pub/figlet/program" is new cwd.
9368: 250 "/pub/figlet/program/unix" is new cwd.
9369: local: figlet221.tar.gz remote: figlet221.tar.gz
9370: 502 Unimplemented command.
9371: 227 Entering Passive Mode (195,40,6,41,246,104)
9372: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
9373: 38% |************** | 65800 64.16 KB/s 00:01 ETA
9374: 226 Transfer completed.
9375: 172219 bytes received in 00:02 (75.99 KB/s)
9376: 221 Goodbye.
9377: => Checksum OK for figlet221.tar.gz.
9378: ===> Extracting for figlet-2.2.1nb2
9379: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
9380: ===> Patching for figlet-2.2.1nb2
9381: ===> Applying pkgsrc patches for figlet-2.2.1nb2
9382: ===> Overriding tools for figlet-2.2.1nb2
9383: ===> Creating toolchain wrappers for figlet-2.2.1nb2
9384: ===> Configuring for figlet-2.2.1nb2
9385: ===> Building for figlet-2.2.1nb2
9386: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
9387: chmod a+x figlet
9388: gcc -O2 -o chkfont chkfont.c
9389: => Unwrapping files-to-be-installed.
9390: #
9391: # make install
9392: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9393: ===> Installing for figlet-2.2.1nb2
9394: install -d -o root -g wheel -m 755 /usr/pkg/bin
9395: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
9396: mkdir -p /usr/pkg/share/figlet
9397: cp figlet /usr/pkg/bin
9398: cp chkfont /usr/pkg/bin
9399: chmod 555 figlist showfigfonts
9400: cp figlist /usr/pkg/bin
9401: cp showfigfonts /usr/pkg/bin
9402: cp fonts/*.flf /usr/pkg/share/figlet
9403: cp fonts/*.flc /usr/pkg/share/figlet
9404: cp figlet.6 /usr/pkg/man/man6
9405: ===> Registering installation for figlet-2.2.1nb2
9406: #
9407:
1.207 leot 9408: C.2. Packaging figlet
1.1 dsieger 9409:
9410: # make package
9411: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9412: ===> Packaging figlet-2.2.1nb2
9413: ===> Building binary package for figlet-2.2.1nb2
9414: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
9415: Using SrcDir value of /usr/pkg
9416: Registering depends:.
9417: #
9418:
1.207 leot 9419: Appendix D. Directory layout of the pkgsrc FTP server
1.1 dsieger 9420:
9421: Table of Contents
9422:
1.207 leot 9423: D.1. distfiles: The distributed source files
9424: D.2. misc: Miscellaneous things
9425: D.3. packages: Binary packages
9426: D.4. reports: Bulk build reports
9427: D.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 9428:
9429: As in other big projects, the directory layout of pkgsrc is quite complex for
9430: newbies. This chapter explains where you find things on the FTP server. The
9431: base directory on ftp.NetBSD.org is /pub/pkgsrc/. On other servers it may be
9432: different, but inside this directory, everything should look the same, no
9433: matter on which server you are. This directory contains some subdirectories,
9434: which are explained below.
9435:
1.207 leot 9436: D.1. distfiles: The distributed source files
1.1 dsieger 9437:
9438: The directory distfiles contains lots of archive files from all pkgsrc
9439: packages, which are mirrored here. The subdirectories are called after their
9440: package names and are used when the distributed files have names that don't
9441: explicitly contain a version number or are otherwise too generic (for example
9442: release.tar.gz).
9443:
1.207 leot 9444: D.2. misc: Miscellaneous things
1.1 dsieger 9445:
9446: This directory contains things that individual pkgsrc developers find worth
9447: publishing.
9448:
1.207 leot 9449: D.3. packages: Binary packages
1.1 dsieger 9450:
1.3 rillig 9451: This directory contains binary packages for the various platforms that are
9452: supported by pkgsrc. Each subdirectory is of the form OPSYS/ARCH/OSVERSION_TAG.
9453: The meaning of these variables is:
9454:
9455: * OPSYS is the name of the operating system for which the packages have been
1.9 rillig 9456: built. The name is taken from the output of the uname command, so it may
9457: differ from the one you are used to hear.
1.3 rillig 9458:
1.8 rillig 9459: * ARCH is the hardware architecture of the platform for which the packages
1.10 hubertf 9460: have been built. It also includes the ABI (Application Binary Interface)
9461: for platforms that have several of them.
1.3 rillig 9462:
1.8 rillig 9463: * OSVERSION is the version of the operating system. For version numbers that
9464: change often (for example NetBSD-current), the often-changing part should
9465: be replaced with an x, for example 4.99.x.
1.3 rillig 9466:
1.23 jakllsch 9467: * TAG is either 20xxQy for a stable branch, or head for packages built from
1.8 rillig 9468: the HEAD branch. The latter should only be used when the packages are
9469: updated on a regular basis. Otherwise the date from checking out pkgsrc
9470: should be appended, for example head_20071015.
1.3 rillig 9471:
9472: The rationale for exactly this scheme is that the pkgsrc users looking for
9473: binary packages can quickly click through the directories on the server and
9474: find the best binary packages for their machines. Since they usually know the
9475: operating system and the hardware architecture, OPSYS and ARCH are placed
9476: first. After these choices, they can select the best combination of OSVERSION
9477: and TAG together, since it is usually the case that packages stay compatible
9478: between different version of the operating system.
9479:
9480: In each of these directories, there is a whole binary packages collection for a
9481: specific platform. It has a directory called All which contains all binary
9482: packages. Besides that, there are various category directories that contain
9483: symbolic links to the real binary packages.
1.1 dsieger 9484:
1.207 leot 9485: D.4. reports: Bulk build reports
1.8 rillig 9486:
9487: Here are the reports from bulk builds, for those who want to fix packages that
9488: didn't build on some of the platforms. The structure of subdirectories should
1.207 leot 9489: look like the one in Section D.3, "packages: Binary packages".
1.8 rillig 9490:
1.207 leot 9491: D.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 9492:
9493: These directories contain the "real" pkgsrc, that is the files that define how
9494: to create binary packages from source archives.
9495:
1.149 leot 9496: Each of the current, stable and pkgsrc-20xxQy directories share the same
9497: structure. They each contain a pkgsrc directory and pkgsrc.tar.{bz,gz,xz} file.
9498:
1.1 dsieger 9499: The directory pkgsrc contains a snapshot of the CVS repository, which is
1.149 leot 9500: updated regularly. The file pkgsrc.tar.{bz,gz,xz} contains the same as the
9501: directory, ready to be downloaded as a whole.
1.1 dsieger 9502:
1.149 leot 9503: The current directory contains files related to the HEAD branch of the CVS
9504: repository. In this directory there is an additional file called
9505: pkgsrc-readmes.tar.{bz,gz,xz} that contains all pkgsrc READMEs with information
9506: about categories and packages.
9507:
9508: The stable directory is a symlink to the latest pkgsrc-20xxQy.
9509:
9510: The pkgsrc-20xxQy. directories contain files related to the -20xxQy stable
9511: branch of the CVS repository. In these directories there is an additional file
9512: called pkgsrc-20xxQy.tar.{bz,gz,xz}, which contains the state of pkgsrc when it
9513: was branched.
1.148 leot 9514:
1.207 leot 9515: Appendix E. Help topics
1.154 rillig 9516:
9517: The following list contains all help topics that are available when running
9518: bmake help topic=:index.
9519:
1.220 nia 9520: #! -lintl
9521: 32bit 64bit
9522: ABI ACCEPTABLE_LICENSES
9523: ACROREAD_FONTPATH ADDITIONAL
9524: AFAIK AIX
9525: ALLOW_VULNERABLE_PACKAGES ALL_ENV
9526: ALSA_PC ALTERNATIVES_SRC
9527: AMANDA_TMP AMANDA_USER
9528: AMANDA_VAR APACHE_GROUP
9529: APACHE_MODULE_NAME APACHE_MODULE_SRC
9530: APACHE_MODULE_SRCDIR APACHE_PKG_PREFIX
9531: APACHE_SUEXEC_CONFIGURE_ARGS APACHE_SUEXEC_DOCROOT
9532: APACHE_USER APPEND_ABI
9533: APPEND_ELF ARLA_CACHE
9534: AUDIT_PACKAGES_FLAGS AUTOCONF_REQD
9535: AUTOMAKE_OVERRIDE AUTOMAKE_REQD
9536: AUTO_MKDIRS BDB185_DEFAULT
9537: BDBBASE BDB_ACCEPTED
9538: BDB_DEFAULT BDB_LIBS
9539: BDB_TYPE BINCIMAP_GROUP
9540: BINCIMAP_USER BIND_DIR
9541: BIND_GROUP BIND_USER
9542: BINOWN BINPKG_SITES
9543: BIN_INSTALL_FLAGS BISON_PKGDATADIR
9544: BLAS BLAS_ACCEPTED
9545: BLAS_C_INTERFACE BLAS_INCLUDES
9546: BLAS_INDEX64 BLAS_LIBS
9547: BLAS_TYPE BOOTSTRAP_DEPENDS
9548: BROKEN BROKEN_EXCEPT_ON_PLATFORM
9549: BROKEN_ON_PLATFORM BSDSRCDIR
9550: BSDXSRCDIR BSD_MAKE_ENV
9551: BUILDLINK_AUTO_DIRS BUILDLINK_AUTO_VARS
9552: BUILDLINK_CFLAGS BUILDLINK_CONTENTS_FILTER
9553: BUILDLINK_CPPFLAGS BUILDLINK_DEPMETHOD
9554: BUILDLINK_FILES BUILDLINK_FILES_CMD
9555: BUILDLINK_FNAME_TRANSFORM BUILDLINK_LDFLAGS
9556: BUILDLINK_LIBS BUILDLINK_OPSYS_SUPPORT_PTHREAD
9557: BUILDLINK_PKGNAME BUILDLINK_PREFIX
9558: BUILDLINK_RPATHDIRS BUILDLINK_TREE
9559: BUILD_DEFS BUILD_DEFS_EFFECTS
9560: BUILD_DEPENDS BUILD_DIRS
9561: BUILD_ENV_SHELL BUILD_MAKE_CMD
9562: BUILD_MAKE_FLAGS BUILD_TARGET
9563: BUILTIN_FIND_FILES BUILTIN_FIND_FILES_VAR
9564: BUILTIN_FIND_GREP BUILTIN_FIND_HEADERS
9565: BUILTIN_FIND_HEADERS_VAR BUILTIN_FIND_PKGCONFIG
9566: BUILTIN_FIND_PKGCONFIG_VAR BUILTIN_PKG
9567: BUILTIN_TEST_CURSES_DEFINES BUILTIN_TEST_CURSES_FUNCS
9568: BUILTIN_VERSION_SCRIPT BUILTIN_X11_TYPE
9569: BUILTIN_X11_VERSION CACTI_GROUP
9570: CACTI_USER CANNA_GROUP
9571: CANNA_USER CAT
9572: CBLAS_LIBS CCACHE_BASE
9573: CCACHE_DIR CCACHE_LOGFILE
9574: CC_VERSION CC_VERSION_STRING
9575: CDRECORD_CONF CDROM_PKG_URL_DIR
9576: CDROM_PKG_URL_HOST CHECKOUT_DATE
9577: CHECK_COMPILER CHECK_FAKEHOME
9578: CHECK_FILES CHECK_FILES_SKIP
9579: CHECK_FILES_STRICT CHECK_HEADERS
9580: CHECK_HEADERS_SKIP CHECK_INTERPRETER
9581: CHECK_INTERPRETER_SKIP CHECK_PERMS
9582: CHECK_PERMS_AUTOFIX CHECK_PERMS_SKIP
9583: CHECK_PIE CHECK_PIE_SKIP
9584: CHECK_PIE_SUPPORTED CHECK_PORTABILITY
9585: CHECK_PORTABILITY_EXPERIMENTAL CHECK_PORTABILITY_SKIP
9586: CHECK_RELRO CHECK_RELRO_SKIP
9587: CHECK_RELRO_SUPPORTED CHECK_SHLIBS
9588: CHECK_SHLIBS_SKIP CHECK_SHLIBS_SUPPORTED
9589: CHECK_SHLIBS_TOXIC CHECK_SSP
9590: CHECK_SSP_SKIP CHECK_SSP_SUPPORTED
9591: CHECK_STRIPPED CHECK_STRIPPED_SKIP
9592: CHECK_WRKREF CHECK_WRKREF_EXTRA_DIRS
9593: CHECK_WRKREF_SKIP CLAMAV_DBDIR
9594: CLAMAV_GROUP CLAMAV_USER
9595: CLANGBASE CLEANDEPENDS
9596: CMAKE_DEPENDENCIES_REWRITE CMAKE_INSTALL_NAME_DIR
9597: CMAKE_INSTALL_PREFIX CMAKE_MODULE_PATH_OVERRIDE
9598: CMAKE_PKGSRC_BUILD_FLAGS CMAKE_PREFIX_PATH
9599: CMAKE_USE_GNU_INSTALL_DIRS COMMON_LISP_DOCFILES
9600: COMMON_LISP_EXAMPLES COMMON_LISP_EXTRAFILES
9601: COMMON_LISP_PACKAGES COMMON_LISP_SYSTEM
9602: COMPILER_RPATH_FLAG COMPILER_USE_SYMLINKS
9603: CONFIGURE_ARGS CONFIGURE_DIRS
9604: CONFIGURE_ENV CONFIGURE_ENV_SHELL
9605: CONFIGURE_HAS_INFODIR CONFIGURE_HAS_MANDIR
9606: CONFIGURE_SCRIPT CONFIG_SHELL
9607: CONFIG_SHELL_FLAGS CONF_FILES
9608: CONF_FILES_MODE CONF_FILES_PERMS
9609: CONSERVER_DEFAULTHOST CONSERVER_DEFAULTPORT
9610: CP CPP
9611: CPP_PRECOMP_FLAGS CREATE_WRKDIR_SYMLINK
9612: CROSSBASE CTFCONVERT
9613: CTF_FILES_SKIP CTF_SUPPORTED
9614: CTYPE CUPS_GROUP
9615: CUPS_SYSTEM_GROUPS CUPS_USER
9616: CURSES_DEFAULT CURSES_TYPE
9617: CVS_EXTRACTDIR CVS_MODULE
9618: CVS_PROJECT CVS_REPOSITORIES
9619: CVS_ROOT CVS_ROOT_GNU
9620: CVS_ROOT_NONGNU CVS_ROOT_SOURCEFORGE
9621: CVS_TAG CXX
9622: CYRUS_GROUP CYRUS_IDLE
9623: CYRUS_USER DAEMONTOOLS_GROUP
9624: DAEMONTOOLS_LOG_USER DARWIN_NO_SYSTEM_LIBS
9625: DARWIN_REQUIRES_FILTER DBUS_GROUP
9626: DBUS_USER DEFANG_GROUP
9627: DEFANG_USER DEFAULT_ACCEPTABLE_LICENSES
9628: DEFAULT_DISTFILES DEFAULT_IRC_SERVER
9629: DEFAULT_SERIAL_DEVICE DEF_UMASK
9630: DEINSTALLDEPENDS DEINSTALL_SRC
9631: DEINSTALL_TEMPLATES DELAYED_ERROR_MSG
9632: DELAYED_WARNING_MSG DEPENDS
9633: DEPENDS_TARGET DEPENDS_TYPE
9634: DESTDIR DESTDIR_VARNAME
9635: DIALER_GROUP DIGEST_REQD
9636: DISTDIR DISTFILES
9637: DISTINFO_FILE DISTNAME
9638: DIST_PATH DIST_SUBDIR
9639: DJBDNS_AXFR_USER DJBDNS_CACHE_USER
9640: DJBDNS_DJBDNS_GROUP DJBDNS_LOG_USER
9641: DJBDNS_RBL_USER DJBDNS_TINY_USER
9642: DLOPEN_REQUIRE_PTHREADS DL_AUTO_VARS
9643: DL_CFLAGS DL_LDFLAGS
9644: DL_LIBS DNS
9645: DOCOWN DOWNLOADED_DISTFILE
9646: DQCACHE_GROUP DQCACHE_USER
9647: DT_LAYOUT DYNAMIC_SITES_CMD
9648: DYNAMIC_SITES_SCRIPT ECHO
9649: ECHO_N ELK_GUI
9650: EMACS_TYPE EMULDIR
9651: EMULSUBDIR EMULSUBDIRSLASH
9652: EMUL_ARCH EMUL_DISTRO
9653: EMUL_EXEC_FMT EMUL_IS_NATIVE
9654: EMUL_MODULES EMUL_OPSYS
9655: EMUL_PKG_FMT EMUL_PLATFORM
9656: EMUL_PLATFORMS EMUL_PREFER
9657: EMUL_REQD EMUL_TYPE
9658: ERROR_MSG EXIM_GROUP
9659: EXIM_USER EXPORT_SYMBOLS_LDFLAGS
9660: EXTRACTOR EXTRACT_CMD
9661: EXTRACT_CMD_DEFAULT EXTRACT_DIR
9662: EXTRACT_ELEMENTS EXTRACT_ENV
9663: EXTRACT_ONLY EXTRACT_OPTS
9664: EXTRACT_SUFX EXTRACT_USING
9665: FAIL FAILOVER_FETCH
9666: FAIL_MSG FAKE_NCURSES
9667: FAM FAM_ACCEPTED
9668: FAM_DEFAULT FAM_SERVER
9669: FCPATH FEATURE_CPPFLAGS
9670: FEATURE_LDFLAGS FEATURE_LIBS
9671: FETCH_AFTER_ARGS FETCH_BEFORE_ARGS
9672: FETCH_CMD FETCH_OUTPUT_ARGS
9673: FETCH_PROXY FETCH_RESUME_ARGS
9674: FETCH_TIMEOUT FETCH_USE_IPV4_ONLY
9675: FETCH_USING FILES_SUBST
9676: FILES_SUBST_SED FIX_SYSTEM_HEADERS
9677: FONTDIR FONTS_DIRS
9678: FONTS_VERBOSE FOO_HACKS_MK
9679: FOSSIL_EXTRACTDIR FOSSIL_REPO
9680: FOSSIL_REPOSITORIES FOSSIL_VERSION
9681: FOX_USE_XUNICODE FREEWNN_GROUP
9682: FREEWNN_USER FTP_PKG_URL_DIR
9683: FTP_PKG_URL_HOST GAMEDATAMODE
9684: GAMEDATA_PERMS GAMEDIRMODE
9685: GAMEDIR_PERMS GAMEGRP
9686: GAMEMODE GAMEOWN
9687: GAMES_GROUP GAMES_USER
9688: GCC GCCBASE
9689: GCC_REQD GCC_VERSION_SUFFIX
9690: GEM_BUILD GEM_CLEANBUILD
9691: GEM_CLEANBUILD_EXTENSIONS GEM_DOCDIR
9692: GEM_EXTSDIR GEM_HOME
9693: GEM_KEEPBUILD GEM_LIBDIR
9694: GEM_NAME GEM_PATH
9695: GEM_PLUGINSDIR GEM_SPECFILE
9696: GENERATE_PLIST GHC
9697: GHOSTSCRIPT_REQD GITHUB_PROJECT
9698: GITHUB_RELEASE GITHUB_SUBMODULES
9699: GITHUB_TAG GITHUB_TYPE
9700: GITLAB_PROJECT GITLAB_TAG
9701: GITLAB_TYPE GIT_BRANCH
9702: GIT_ENV GIT_EXTRACTDIR
9703: GIT_REPO GIT_REPOSITORIES
9704: GIT_REVISION GIT_TAG
9705: GNU GNU_CONFIGURE
9706: GNU_CONFIGURE_INFODIR GNU_CONFIGURE_MANDIR
9707: GNU_CONFIGURE_QUIET GNU_CONFIGURE_STRICT
9708: GODEP_REDIRECTS GO_BUILD_PATTERN
9709: GO_DEPS GO_DIST_BASE
9710: GO_EXTRA_MOD_DIRS GO_MODULE_FILES
9711: GO_SRCPATH GO_VERSION_DEFAULT
9712: GROUP_SPECIFIC_PKGS GRUB_NETWORK_CARDS
9713: GRUB_PRESET_COMMAND GRUB_SCAN_ARGS
9714: GZIP HASKELL_COMPILER
9715: HASKELL_ENABLE_DYNAMIC_EXECUTABLE HASKELL_ENABLE_HADDOCK_DOCUMENTATION
9716: HASKELL_ENABLE_LIBRARY_PROFILING HASKELL_ENABLE_SHARED_LIBRARY
9717: HASKELL_OPTIMIZATION_LEVEL HAS_CONFIGURE
9718: HEADER_TEMPLATES HG_REPO
9719: HG_REPOSITORIES HG_TAG
9720: HOMEPAGE HOST_PKGTOOLS_ARGS
9721: HOST_SPECIFIC_PKGS HOWL_GROUP
9722: HOWL_USER ICCBASE
9723: ICECAST_CHROOTDIR ICON_THEMES
9724: IDOBASE IGNORE_CCACHE
9725: IGNORE_INFO_DIRS IGNORE_INTERACTIVE_FETCH
9726: IMAKE IMAKEOPTS
9727: IMAKE_MAKE IMAKE_MANINSTALL
9728: IMAP_UW_CCLIENT_MBOX_FMT IMDICTDIR
9729: INCOMPAT_CURSES INFO_DIR
9730: INFO_FILES INFO_FILES_VERBOSE
9731: INFO_MSG INIT_SYSTEM
9732: INN_DATA_DIR INN_GROUP
9733: INN_USER INSTALLATION_DIRS
9734: INSTALLATION_DIRS_FROM_PLIST INSTALL_ENV
9735: INSTALL_SH_OVERRIDE INSTALL_SRC
9736: INSTALL_TEMPLATES INSTALL_UNSTRIPPED
9737: IRCD_HYBRID_IRC_GROUP IRCD_HYBRID_IRC_USER
9738: IRCD_HYBRID_MAXCONN IRCD_HYBRID_NICLEN
9739: IRCD_HYBRID_SYSLOG_EVENTS IRCD_HYBRID_SYSLOG_FACILITY
9740: IRCD_HYBRID_TOPICLEN IRIX
9741: IRRD_USE_PGP JABBERD_GROUP
9742: JABBERD_LOGDIR JABBERD_PIDDIR
9743: JABBERD_SPOOLDIR JABBERD_USER
9744: JAVA_APP_PATH JAVA_APP_TARGETS
9745: JAVA_BINPREFIX JAVA_CLASSPATH
9746: JAVA_HOME JAVA_LD_LIBRARY_PATH
9747: JAVA_NAME JAVA_UNLIMIT
9748: JAVA_WRAPPERS JPEG_ACCEPTED
9749: JPEG_DEFAULT KERBEROS
9750: KERMIT_SUID_UUCP KJS_USE_PCRE
9751: KNEWS_DOMAIN_FILE KNEWS_DOMAIN_NAME
9752: KRB5_ACCEPTED KRB5_DEFAULT
9753: LANGUAGES LAPACKE_LIBS
9754: LAPACK_LIBS LATEX2HTML_ICONPATH
9755: LDCONFIG_ADD_CMD LDCONFIG_REMOVE_CMD
9756: LDD LEAFNODE_DATA_DIR
9757: LEAFNODE_GROUP LEAFNODE_USER
9758: LIBDVDCSS_HOMEPAGE LIBDVDCSS_MASTER_SITES
9759: LIBRSVG_TYPE LIBTOOL
9760: LIBTOOLIZE_PLIST LIBTOOL_M4_OVERRIDE
9761: LIBUSB_TYPE LICENSE
9762: LINKER_RPATH_FLAG LINK_RPATH_FLAG
9763: LINUX_BASE_NODEPS LINUX_BASE_PREFERRED
9764: LINUX_BASE_REQUIRED LINUX_LOCALES
9765: LOCALBASE LOCALBASE_LOCKTYPE
9766: LOCALPATCHES LOVE_DATA
9767: LOVE_GAME LOVE_VERSION
9768: LP32PLATFORMS LP64PLATFORMS
1.221 ! nia 9769: LUA_BUSTED_ARGS LUA_CDIR
! 9770: LUA_COMPILER LUA_DOCDIR
! 9771: LUA_EXAMPLESDIR LUA_INCDIR
! 9772: LUA_INTERPRETER LUA_LDIR
! 9773: LUA_LINKER_MAGIC LUA_PKGPREFIX
! 9774: LUA_SELF_CONFLICT LUA_USE_BUSTED
! 9775: LUA_VERSIONS_ACCEPTED LUA_VERSIONS_INCOMPATIBLE
! 9776: LUA_VERSION_DEFAULT LUA_VERSION_REQD
! 9777: Lua MACHINE_PLATFORM
! 9778: MAILAGENT_DOMAIN MAILAGENT_EMAIL
! 9779: MAILAGENT_FQDN MAILAGENT_ORGANIZATION
! 9780: MAJORDOMO_HOMEDIR MAJOR_OS_VERSION
! 9781: MAKEINFO_ARGS MAKE_DIRS
! 9782: MAKE_DIRS_PERMS MAKE_ENV
! 9783: MAKE_FILE MAKE_FLAGS
! 9784: MAKE_JOBS MAKE_JOBS_SAFE
! 9785: MAKE_PROGRAM MANCOMPRESSED_IF_MANZ
! 9786: MANINSTALL MANZ
! 9787: MASTER_SITES MASTER_SITE_BACKUP
! 9788: MASTER_SITE_LOCAL MASTER_SITE_MOZILLA
! 9789: MASTER_SITE_OVERRIDE MASTER_SITE_PERL_CPAN
! 9790: MASTER_SORT MASTER_SORT_RANDOM
! 9791: MASTER_SORT_REGEX MECAB_CHARSET
! 9792: MEDIATOMB_GROUP MEDIATOMB_USER
! 9793: MIPSPROBASE MIREDO_GROUP
! 9794: MIREDO_USER MISSING_FEATURES
! 9795: MKDIR MKPIE_SUPPORTED
! 9796: MLDONKEY_GROUP MLDONKEY_HOME
! 9797: MLDONKEY_USER MONOTONE_GROUP
! 9798: MONOTONE_USER MOTIFBASE
! 9799: MOTIF_TYPE MOTIF_TYPE_DEFAULT
! 9800: MPI_TYPE MSGFMT_STRIP_MSGCTXT
! 9801: MSGFMT_STRIP_MSGID_PLURAL MTOOLS_ENABLE_FLOPPYD
! 9802: MUST MV
! 9803: MYSQL_CHARSET MYSQL_DATADIR
! 9804: MYSQL_EXTRA_CHARSET MYSQL_GROUP
! 9805: MYSQL_USER MYSQL_VERSION
! 9806: MYSQL_VERSIONS_ACCEPTED MYSQL_VERSIONS_ALL
! 9807: MYSQL_VERSION_DEFAULT NAGIOSCMD_GROUP
! 9808: NAGIOSDIR NAGIOS_GROUP
! 9809: NAGIOS_USER NATIVE_APPEND_ABI
! 9810: NATIVE_APPEND_ELF NATIVE_EXEC_FMT
! 9811: NATIVE_MACHINE_PLATFORM NATIVE_OBJECT_FMT
! 9812: NBPAX_PROGRAM_PREFIX NETBSD_LOGIN_NAME
! 9813: NMH_EDITOR NMH_MTA
! 9814: NMH_PAGER NODE_VERSIONS_ACCEPTED
! 9815: NODE_VERSIONS_INCOMPATIBLE NODE_VERSION_DEFAULT
! 9816: NODE_VERSION_REQD NOLOGIN
! 9817: NOTE NOT_FOR_PLATFORM
! 9818: NOT_PAX_ASLR_SAFE NOT_PAX_MPROTECT_SAFE
! 9819: NO_BUILD NO_CHECKSUM
! 9820: NO_CONFIGURE NO_SKIP
! 9821: NS_PREFERRED NULLMAILER_GROUP
! 9822: NULLMAILER_USER OASIS
! 9823: OASIS_BUILD_ARGS OBJHOSTNAME
! 9824: OBJMACHINE OCAML_FINDLIB_DIRS
! 9825: OCAML_FINDLIB_REGISTER OCAML_FINDLIB_REGISTER_VERBOSE
! 9826: OCAML_SITELIBDIR OCAML_TOPKG_DOCDIR
! 9827: OCAML_USE_DUNE OCAML_USE_FINDLIB
! 9828: OCAML_USE_OASIS OCAML_USE_OASIS_DYNRUN
! 9829: OCAML_USE_OPAM OCAML_USE_OPT_COMPILER
! 9830: OCAML_USE_TOPKG OMF
! 9831: ONLY_FOR_COMPILER ONLY_FOR_PLATFORM
! 9832: OPENSSH_CHROOT OPENSSH_GROUP
! 9833: OPENSSH_USER OPSYS
! 9834: OPSYS_EMULDIR OPSYS_VERSION
! 9835: OS OSS_TYPE
! 9836: OSX OSX_TOLERATE_SDK_SKEW
! 9837: OS_HAVE_ALSA OS_HAVE_RCD
! 9838: OS_VARIANT OS_VERSION
! 9839: OTF_FONTS_DIR OVERRIDE_DIRDEPTH
! 9840: OVERRIDE_GEMSPEC OVERRIDE_GNU_CONFIG_SCRIPTS
! 9841: OVERRIDE_ROCKSPEC OWN_DIRS
! 9842: OWN_DIRS_PERMS P4GROUP
! 9843: P4PORT P4ROOT
! 9844: P4USER PACKAGES
! 9845: PALMOS_DEFAULT_SDK PAMBASE
! 9846: PAM_DEFAULT PAPERSIZE
! 9847: PASSIVE_FETCH PATCHDIR
! 9848: PATCHFILES PATCH_ARGS
! 9849: PATCH_DEBUG PATCH_DIST_ARGS
! 9850: PATCH_DIST_CAT PATCH_DIST_STRIP
! 9851: PATCH_FUZZ_FACTOR PATCH_STRIP
! 9852: PATH PCCBASE
! 9853: PEAR PEAR_CHANNEL
! 9854: PEAR_CHANNEL_ALIAS PEAR_CHANNEL_VERSION
! 9855: PEAR_CMD PEAR_LIB
! 9856: PEAR_PACKAGE_XML PERL5
! 9857: PERL5_CONFIGURE PERL5_CONFIGURE_DIRS
! 9858: PERL5_LDFLAGS PERL5_LICENSE
! 9859: PERL5_MODULE_TYPE PERL5_PACKLIST
! 9860: PERL5_PACKLIST_DIR PERL5_PERLBASE
! 9861: PERL5_SITEBASE PERL5_USE_PACKLIST
! 9862: PERL5_VENDORBASE PFCTL
! 9863: PFVAR_H PF_VERSION
! 9864: PGGROUP PGHOME
! 9865: PGPKGSRCDIR PGSQL_TYPE
! 9866: PGSQL_VERSION PGSQL_VERSIONS_ACCEPTED
! 9867: PGSQL_VERSION_DEFAULT PGUSER
! 9868: PG_LIB_EXT PHP
! 9869: PHPCOMMON_MK PHPPKGSRCDIR
! 9870: PHP_BASE_VERS PHP_CHECK_INSTALLED
! 9871: PHP_EXTENSION_DIR PHP_INITIAL_TEENY
! 9872: PHP_PKG_PREFIX PHP_VERSION
! 9873: PHP_VERSIONS_ACCEPTED PHP_VERSIONS_INCOMPATIBLE
! 9874: PHP_VERSION_DEFAULT PHP_VERSION_REQD
! 9875: PILRC_USE_GTK PKGCONFIG_BASE
! 9876: PKGCONFIG_FILE PKGCONFIG_OVERRIDE
! 9877: PKGCONFIG_OVERRIDE_STAGE PKGDIR
! 9878: PKGGNUDIR PKGINFODIR
! 9879: PKGLOCALEDIR PKGMANDIR
! 9880: PKGNAME PKGNAME_REQD
! 9881: PKGPATH PKGREVISION
! 9882: PKGSRC_BLAS_TYPES PKGSRC_CHANGES
! 9883: PKGSRC_COMPILER PKGSRC_KEEP_BIN_PKGS
! 9884: PKGSRC_LOCKTYPE PKGSRC_MAKE_ENV
! 9885: PKGSRC_MESSAGE_RECIPIENTS PKGSRC_MKPIE
! 9886: PKGSRC_MKREPRO PKGSRC_OVERRIDE_MKPIE
! 9887: PKGSRC_RUN_TEST PKGSRC_SETENV
! 9888: PKGSRC_SLEEPSECS PKGSRC_TODO
! 9889: PKGSRC_USE_CTF PKGSRC_USE_FORTIFY
! 9890: PKGSRC_USE_RELRO PKGSRC_USE_SSP
! 9891: PKGSRC_USE_STACK_CHECK PKGTASKS_DATAFILE
! 9892: PKGTOOLS_ARGS PKGTOOLS_ENV
! 9893: PKG_ALTERNATIVES PKG_APACHE
! 9894: PKG_APACHE_ACCEPTED PKG_APACHE_DEFAULT
! 9895: PKG_BEST_EXISTS PKG_BUILD_OPTIONS
! 9896: PKG_COMPRESSION PKG_CONFIG
! 9897: PKG_CONFIG_PERMS PKG_CREATE_USERGROUP
! 9898: PKG_DB_TMPDIR PKG_DEBUG_LEVEL
! 9899: PKG_DEFAULT_OPTIONS PKG_DESTDIR_SUPPORT
! 9900: PKG_DEVELOPER PKG_DISABLED_OPTIONS
! 9901: PKG_FATAL_ERRORS PKG_FC
! 9902: PKG_FILELIST_CMD PKG_GECOS
! 9903: PKG_GID PKG_GROUPS
! 9904: PKG_GROUPS_VARS PKG_HOME
! 9905: PKG_INIT_SCRIPTS PKG_JAVA_HOME
! 9906: PKG_JVM PKG_JVMS_ACCEPTED
! 9907: PKG_JVM_DEFAULT PKG_LEGACY_OPTIONS
! 9908: PKG_LIBTOOL PKG_OPTIONS
! 9909: PKG_OPTIONS_DEPRECATED_WARNINGS PKG_OPTIONS_LEGACY_OPTS
! 9910: PKG_OPTIONS_LEGACY_VARS PKG_OPTIONS_NONEMPTY_SETS
! 9911: PKG_OPTIONS_OPTIONAL_GROUPS PKG_OPTIONS_REQUIRED_GROUPS
! 9912: PKG_OPTIONS_VAR PKG_PHP
! 9913: PKG_PHP_MAJOR_VERS PKG_PHP_VERSION
! 9914: PKG_RCD_SCRIPTS PKG_REFCOUNT_DBDIR
! 9915: PKG_REGISTER_SHELLS PKG_RESUME_TRANSFERS
! 9916: PKG_SHELL PKG_SUGGESTED_OPTIONS
! 9917: PKG_SUPPORTED_OPTIONS PKG_SYSCONFBASE
! 9918: PKG_SYSCONFBASEDIR PKG_SYSCONFDIR
! 9919: PKG_SYSCONFDIR_PERMS PKG_SYSCONFSUBDIR
! 9920: PKG_SYSCONFVAR PKG_TOOLS_BIN
! 9921: PKG_UID PKG_UPDATE_FONTS_DB
! 9922: PKG_USERS PKG_USERS_VARS
! 9923: PKG_VERBOSE PLEASE
! 9924: PLIST PLIST_AWK
! 9925: PLIST_AWK_ENV PLIST_SRC
! 9926: PLIST_SUBST PLIST_TYPE
! 9927: PLIST_VARS POPTOP_USE_MPPE
! 9928: POSSIBLE_GFORTRAN_VERSION POST_FETCH_HOOK
! 9929: PREFER PREFER_NATIVE
! 9930: PREFER_NATIVE_PTHREADS PREFER_PKGSRC
! 9931: PREFIX PREPEND_PATH
! 9932: PRE_ROOT_CMD PRIVILEGED_STAGES
! 9933: PS PTHREAD_AUTO_VARS
! 9934: PTHREAD_CFLAGS PTHREAD_LDFLAGS
! 9935: PTHREAD_LIBS PTHREAD_OPTS
! 9936: PTHREAD_TYPE PVM_SSH
! 9937: PYPKGPREFIX PYTHON_FOR_BUILD_ONLY
! 9938: PYTHON_SELF_CONFLICT PYTHON_VERSIONED_DEPENDENCIES
! 9939: PYTHON_VERSIONS_ACCEPTED PYTHON_VERSIONS_INCOMPATIBLE
! 9940: PYTHON_VERSION_DEFAULT PYTHON_VERSION_REQD
! 9941: PYVERSSUFFIX QMAILDIR
! 9942: QMAIL_ALIAS_USER QMAIL_DAEMON_USER
! 9943: QMAIL_LOG_USER QMAIL_NOFILES_GROUP
! 9944: QMAIL_PASSWD_USER QMAIL_QMAIL_GROUP
! 9945: QMAIL_QUEUE_DIR QMAIL_QUEUE_EXTRA
! 9946: QMAIL_QUEUE_USER QMAIL_REMOTE_USER
! 9947: QMAIL_ROOT_USER QMAIL_SEND_USER
! 9948: QORE_LATEST_MODULE_API QORE_MODULE_API
! 9949: QORE_MODULE_DIR QORE_USER_MODULE_DIR
! 9950: QORE_VERSION QPOPPER_FAC
! 9951: QPOPPER_SPOOL_DIR QPOPPER_USER
! 9952: RAKE_NAME RASMOL_DEPTH
! 9953: RCD_DIR RCD_ORDER
! 9954: RCD_SCRIPTS RCD_SCRIPTS_DIR
! 9955: RCD_SCRIPTS_EXAMPLEDIR RCD_SCRIPTS_MODE
! 9956: RCD_SCRIPTS_SHELL RCD_SCRIPT_SRC
! 9957: RCD_SUBR RDOC
! 9958: READLINE_DEFAULT READLINE_TYPE
! 9959: REAL_ROOT_GROUP REAL_ROOT_USER
! 9960: RECURSIVE_MAKE RELAY_CTRL_DIR
! 9961: RELRO_SUPPORTED REPLACE_AWK
! 9962: REPLACE_BASH REPLACE_CSH
! 9963: REPLACE_KSH REPLACE_LUA
! 9964: REPLACE_NODEJS REPLACE_OCTAVE
! 9965: REPLACE_PERL REPLACE_PERL6
! 9966: REPLACE_PHP REPLACE_PYTHON
! 9967: REPLACE_QORE REPLACE_R
! 9968: REPLACE_RUBY REPLACE_RUBY_DIRS
! 9969: REPLACE_RUBY_PAT REPLACE_SH
! 9970: REPLACE_TEXLUA REPLACE_WISH
! 9971: REQD_DIRS REQD_DIRS_PERMS
! 9972: REQD_FILES REQD_FILES_MODE
! 9973: REQD_FILES_PERMS RESOLV_AUTO_VARS
! 9974: RESOLV_LDFLAGS RESOLV_LIBS
! 9975: RM ROCKSPEC_NAME
! 9976: ROCKSPEC_SPECFILE ROOT_CMD
! 9977: ROOT_GROUP ROOT_USER
! 9978: RPCGEN RPM
! 9979: RPM2PKG_PLIST RPM2PKG_PREFIX
! 9980: RPM2PKG_STAGE RPM2PKG_STRIP
! 9981: RPM2PKG_SUBPREFIX RPMFILES
! 9982: RPMIGNOREPATH RPM_DB_PREFIX
! 9983: RSSH_CVS_PATH RSSH_RDIST_PATH
! 9984: RSSH_RSYNC_PATH RSSH_SCP_PATH
! 9985: RSSH_SFTP_SERVER_PATH RUBY
! 9986: RUBYGEM RUBYGEM_NAME
! 9987: RUBYGEM_OPTIONS RUBYGEM_VERBOSE
! 9988: RUBY_ABI_VERSION RUBY_ARCH
! 9989: RUBY_ARCHINC RUBY_ARCHLIB
! 9990: RUBY_BASE RUBY_BASERIDIR
! 9991: RUBY_BUILD_DOCUMENT RUBY_DLEXT
! 9992: RUBY_DOC RUBY_DYNAMIC_DIRS
! 9993: RUBY_EG RUBY_ENCODING_ARG
! 9994: RUBY_EXTCONF RUBY_EXTCONF_CHECK
! 9995: RUBY_EXTCONF_DEBUG RUBY_EXTCONF_MAKEFILE
! 9996: RUBY_GEM_ARCH RUBY_GEM_BASE
! 9997: RUBY_INC RUBY_LIB
! 9998: RUBY_LIB_BASE RUBY_NAME
! 9999: RUBY_NOVERSION RUBY_PKGPREFIX
! 10000: RUBY_RAILS RUBY_RAILS52_VERSION
! 10001: RUBY_RAILS60_VERSION RUBY_RAILS61_VERSION
! 10002: RUBY_RAILS70_VERSION RUBY_RAILS_ACCEPTED
! 10003: RUBY_RAILS_DEFAULT RUBY_RAILS_REQD
! 10004: RUBY_RAILS_STRICT_DEP RUBY_RIDIR
! 10005: RUBY_SETUP RUBY_SHLIB
! 10006: RUBY_SHLIBALIAS RUBY_SHLIBVER
! 10007: RUBY_SIMPLE_INSTALL RUBY_SITEARCHLIB
! 10008: RUBY_SITELIB RUBY_SITELIB_BASE
! 10009: RUBY_SITERIDIR RUBY_SLEXT
! 10010: RUBY_SRCDIR RUBY_STATICLIB
! 10011: RUBY_SUFFIX RUBY_SYSRIDIR
! 10012: RUBY_USE_PTHREAD RUBY_VENDORARCHLIB
! 10013: RUBY_VENDORLIB RUBY_VENDORLIB_BASE
! 10014: RUBY_VER RUBY_VERSION
! 10015: RUBY_VERSIONS_ACCEPTED RUBY_VERSIONS_INCOMPATIBLE
! 10016: RUBY_VERSION_DEFAULT RUBY_VERSION_REQD
! 10017: RUBY_VER_DIR RUN
! 10018: RUN_LDCONFIG RUST_TYPE
1.220 nia 10019: SCO SCREWS_GROUP
10020: SCREWS_USER SCRIPTS_ENV
10021: SCROLLKEEPER_DATADIR SCROLLKEEPER_REBUILDDB
10022: SCROLLKEEPER_UPDATEDB SDIST_PAWD
1.221 ! nia 10023: SDL12_TYPE SERIAL_DEVICES
! 10024: SETGIDGAME SETGID_GAMES_PERMS
! 10025: SETUID_ROOT_PERMS SH
! 10026: SHLIB SHORTNAME
! 10027: SIGN_PACKAGES SILC_CLIENT_WITH_PERL
! 10028: SITE_SPECIFIC_PKGS SKIP_DEPENDS
! 10029: SMF_INSTANCES SMF_MANIFEST
! 10030: SMF_METHODS SMF_METHOD_SHELL
! 10031: SMF_METHOD_SRC SMF_NAME
! 10032: SMF_PREFIX SMF_SRCDIR
! 10033: SNIPROXY_GROUP SNIPROXY_USER
! 10034: SOURCE_BUFFSIZE SPECIAL_PERMS
! 10035: SPECIFIC_PKGS SSH_SUID
! 10036: SSP_SUPPORTED SSYNC_PAWD
! 10037: STEP_MSG STRIP
! 10038: STRIP_DBG STRIP_DEBUG
! 10039: STRIP_DEBUG_SUPPORTED STRIP_FILES_SKIP
! 10040: SU SUBDIR
! 10041: SUBST SUBST_CLASSES
! 10042: SUBST_FILES SUBST_FILTER_CMD
! 10043: SUBST_MESSAGE SUBST_NOOP_OK
! 10044: SUBST_SED SUBST_SHOW_DIFF
! 10045: SUBST_SKIP_TEXT_CHECK SUBST_STAGE
! 10046: SUBST_VARS SUNWSPROBASE
! 10047: SUSE_PREFER SU_CMD
! 10048: SVN_EXTRACTDIR SVN_REPO
! 10049: SVN_REPOSITORIES SVN_REVISION
! 10050: SYSCONFBASE TBL
! 10051: TERMCAP_TYPE TERMINFO_DEFAULT
! 10052: TERMINFO_TYPE TEST
! 10053: TEST_DEPENDS TEST_DIRS
! 10054: TEST_ENV TEST_ENV_SHELL
! 10055: TEST_MAKE_CMD TEST_MAKE_FLAGS
! 10056: TEST_TARGET TEXLIVE_IGNORE_PATTERNS
! 10057: TEXLIVE_REV TEXLIVE_UNVERSIONED
! 10058: TEXMFSITE TEX_FORMATS
! 10059: TEX_HYPHEN_DAT TEX_HYPHEN_DEF
! 10060: TEX_TEXMF_DIRS THTTPD_LOG_FACILITY
! 10061: TINYDYN_USER TLSWRAPPER_CHROOT
! 10062: TO TOOLS_ALIASES
! 10063: TOOLS_ALWAYS_WRAP TOOLS_ARGS
! 10064: TOOLS_BROKEN TOOLS_CMD
! 10065: TOOLS_CMDLINE_SED TOOLS_CREATE
! 10066: TOOLS_DIR TOOLS_FAIL
! 10067: TOOLS_GNU_MISSING TOOLS_LDCONFIG
! 10068: TOOLS_NOOP TOOLS_PATH
! 10069: TOOLS_SCRIPT TOOL_DEPENDS
! 10070: TTF_FONTDIR TTF_FONTS_DIR
! 10071: TYPE UAC_REQD_EXECS
! 10072: UCSPI_SSL_GROUP UCSPI_SSL_USER
! 10073: UNLIMIT_RESOURCES UNPRIVILEGED
! 10074: UNPRIVILEGED_GROUP UNPRIVILEGED_GROUPS
! 10075: UNPRIVILEGED_USER UNWRAP_FILES
! 10076: UNWRAP_PATTERNS UPDATE_GEMSPEC
! 10077: UPDATE_TARGET URI
! 10078: USERGROUP_PHASE USERPPP_GROUP
! 10079: USER_SPECIFIC_PKGS USE_ABI_DEPENDS
! 10080: USE_APR USE_BSD_MAKEFILE
! 10081: USE_BUILTIN USE_CROSS_COMPILE
! 10082: USE_CURSES USE_CWRAPPERS
! 10083: USE_DB185 USE_FEATURES
! 10084: USE_GAMESGROUP USE_GCC_RUNTIME
! 10085: USE_IMAKE USE_JAVA
! 10086: USE_JAVA2 USE_LANGUAGES
! 10087: USE_LIBTOOL USE_NATIVE_GCC
! 10088: USE_NETBSD_REPO USE_PKGSRC_GCC
! 10089: USE_PKGSRC_GCC_RUNTIME USE_PKGTASKS
! 10090: USE_PKG_ADMIN_DIGEST USE_RUBY_EXTCONF
! 10091: USE_RUBY_INSTALL USE_RUBY_SETUP
! 10092: USE_RUBY_SETUP_PKG USE_TOOLS
! 10093: UUCP_GROUP UUCP_USER
! 10094: VARBASE VARNAME
! 10095: VIM_EXTRA_OPTS WARNING_MSG
! 10096: WCALC_CGIDIR WCALC_CGIPATH
! 10097: WCALC_HTMLDIR WCALC_HTMLPATH
! 10098: WDM_MANAGERS WRAPPER_CC
! 10099: WRAPPER_REORDER_CMDS WRKDIR
! 10100: WRKDIR_BASENAME WRKDIR_LOCKTYPE
! 10101: WRKLOG WRKOBJDIR
! 10102: WRKSRC X10_PORT
! 10103: X11 X11BASE
! 10104: X11_PKGSRCDIR X11_TYPE
! 10105: X509_CERTIFICATE X509_KEY
! 10106: XAW_TYPE XLOCK_DEFAULT_MODE
! 10107: XMKMF XMKMF_FLAGS
! 10108: XXX XXXX
! 10109: YES ZSH_STATIC
! 10110: __stdc__ _vargroups
! 10111: accept acquire-localbase-lock
! 10112: acquire-lock add
! 10113: administrator alloca
! 10114: alternatives aslr
! 10115: asprintf atlas
! 10116: autoconf automake
! 10117: autoreconf awk
! 10118: bash big-endian
! 10119: bin-install bind
! 10120: binpkg-list blas
! 10121: bootstrap-depends broken
! 10122: broken_on_platform bsd
! 10123: bsd.prog.mk build
! 10124: build-env buildlink-directories
! 10125: buildlink-oss-soundcard-h c
! 10126: c++ ccache
! 10127: cce cdefs
! 10128: ceil changes
! 10129: changes-entry changes-entry-noupdate
! 10130: check check-clean
! 10131: check-files check-files-clean
! 10132: check-vulnerable checksum
! 10133: checksum-phase clean
! 10134: clean-depends cleandir
! 10135: commit commit-changes-entry
! 10136: compact compiler
! 10137: conf config.guess
! 10138: config.sub configuration
! 10139: configure configure-env
! 10140: configure-help configure_args
! 10141: connect cos
! 10142: cputime create-usergroup
! 10143: csh ctf
! 10144: cvs debug
! 10145: declaration declare
! 10146: defined depend
! 10147: dependencies depends
! 10148: depends-checksum depends-fetch
! 10149: deps describe
! 10150: destdir disable
! 10151: distclean distinfo
! 10152: dl dlopen
! 10153: do-buildlink do-clean
! 10154: do-configure do-configure-post-hook
! 10155: do-extract do-fetch
! 10156: do-install emul
! 10157: emul-distinfo emul-fetch
! 10158: emulation emulator
! 10159: enable endian
! 10160: endif enomem
! 10161: ensurepip err
1.220 nia 10162: errx etc
10163: exp extract-rpm
10164: fabs feature
10165: features fetch
10166: fetch-list follows
10167: forbids form
10168: format fortify
10169: fortify_source fossil
10170: friend fts
10171: fts_close fts_open
10172: fts_read fts_set
10173: gcc gethostbyaddr
10174: gethostbyname gethostbyname2
10175: getopt_long getprogname
10176: getservbyname getservbyport
10177: getservent gettext
10178: git github
10179: gitlab glob
10180: gnu gnu_configure_strict
10181: go go-deps
10182: golang guess-license
10183: hashbang heimdal
10184: help hg
10185: imake increment
10186: inet_aton interp
10187: interpreter intl
10188: ip4 ip6
10189: ipv4 ipv6
10190: iso kerberos
10191: krb krb5
10192: ksh lapack
10193: latex libintl_bindtextdomain
10194: libintl_gettext libintl_textdomain
10195: libnbcompat libs
10196: libtool licence
10197: license lintl
10198: little-endian lock
10199: locking lua
10200: lvalue make
10201: makesum memory
10202: mercurial meta
10203: meta-package meta_package
10204: mit-krb5 mk.conf
10205: mkl mount
10206: mprotect mremap
10207: nb nbcompat
10208: netlib node
10209: node.js nodejs
10210: obstack obstack_ptr_grow
10211: occurs only
10212: openblas options
10213: options.mk order
10214: override override-intltool
10215: override-message-intltool package
10216: parallel path
10217: pax paxctl
10218: pbulk-index pc
10219: perl perl5
10220: perms php
10221: pkg-build-options pkg-config
10222: pkg_build_options platform
10223: plist post-extract
10224: post-fetch post-wrapper
10225: pre-build-checks-hook pre-configure
10226: pre-configure-checks-hook pre-extract
10227: pre-fetch print-go-deps
10228: print-plist print-summary-data
10229: privileged-install-hook pypi
10230: python r
10231: readme-all recv
10232: recvfrom regcomp
10233: release-localbase-lock release-lock
10234: relro rename
10235: reorder replace
10236: replace_interpreter reproducible
10237: resolv root
10238: ruby send
10239: sendfile sendto
10240: setenv setgid
10241: setprogname setuid
10242: sh shebang
10243: show show-all
10244: show-build-defs show-depends
10245: show-deps show-distfiles
10246: show-downlevel show-subdir-var
10247: show-tools show-var
10248: show-vars snprintf
10249: socket ssp
10250: st_mode stage-install
10251: strcasestr strict
10252: strip strndup
10253: strnlen strsep
10254: subst substitutions
10255: subversion sun
10256: sunpro sunwspro
10257: svn symlink
10258: test test-env
10259: tex texlive
10260: tmp tool
10261: tools tools-libtool-m4-override
10262: type ulimit
10263: undefined undo-replace
10264: unlimit unprivileged
10265: unprivileged-install-hook unstripped
10266: update upload
10267: upload-distfiles use_tools
10268: user utimes
10269: vasprintf verbose
10270: vsnprintf warn
10271: warning warnings
10272: warnx wattr_off
10273: wattr_on work
10274: wrapper wrkdir
1.154 rillig 10275:
1.207 leot 10276: Appendix F. Editing guidelines for the pkgsrc guide
1.1 dsieger 10277:
10278: Table of Contents
10279:
1.207 leot 10280: F.1. Make targets
10281: F.2. Procedure
1.1 dsieger 10282:
10283: This section contains information on editing the pkgsrc guide itself.
10284:
1.207 leot 10285: F.1. Make targets
1.1 dsieger 10286:
10287: The pkgsrc guide's source code is stored in pkgsrc/doc/guide/files, and several
10288: files are created from it:
10289:
10290: * pkgsrc/doc/pkgsrc.txt
10291:
10292: * pkgsrc/doc/pkgsrc.html
10293:
1.174 leot 10294: * https://www.NetBSD.org/docs/pkgsrc/
1.1 dsieger 10295:
1.174 leot 10296: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.pdf: The PDF version of the
10297: pkgsrc guide.
1.1 dsieger 10298:
1.174 leot 10299: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.ps: PostScript version of the
1.2 rillig 10300: pkgsrc guide.
1.1 dsieger 10301:
1.207 leot 10302: F.2. Procedure
1.1 dsieger 10303:
10304: The procedure to edit the pkgsrc guide is:
10305:
1.190 bacon 10306: 1. Make sure you have checked out the htdocs repository into a sibling
10307: directory of your pkgsrc directory. You will need the ability to commit
10308: from both pkgsrc and htdocs.
10309:
10310: 2. Make sure you have the packages needed to regenerate the pkgsrc guide (and
1.46 obache 10311: other XML-based NetBSD documentation) installed. These are automatically
10312: installed when you install the meta-pkgs/pkgsrc-guide-tools package.
1.1 dsieger 10313:
1.190 bacon 10314: 3. Run cd doc/guide to get to the right directory. All further steps will take
1.1 dsieger 10315: place here.
10316:
1.190 bacon 10317: 4. Edit the XML file(s) in files/.
1.1 dsieger 10318:
1.190 bacon 10319: 5. Run bmake to check the pkgsrc guide for valid XML and to build the final
1.1 dsieger 10320: output files. If you get any errors at this stage, you can just edit the
10321: files, as there are only symbolic links in the working directory, pointing
10322: to the files in files/.
10323:
1.190 bacon 10324: 6. (cd files && cvs commit)
1.1 dsieger 10325:
1.190 bacon 10326: 7. Run bmake clean && bmake to regenerate the output files with the proper RCS
1.1 dsieger 10327: Ids.
10328:
1.190 bacon 10329: 8. Run bmake regen to install and commit the files in both pkgsrc/doc and
1.1 dsieger 10330: htdocs.
10331:
10332: Note
10333:
10334: If you have added, removed or renamed some chapters, you need to
10335: synchronize them using cvs add or cvs delete in the htdocs directory.
10336:
CVSweb <webmaster@jp.NetBSD.org>