Annotation of htdocs/docs/pkgsrc/pkgsrc.txt, revision 1.182
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.166 leot 15: Copyright 1994-2020 The NetBSD Foundation, Inc
1.1 dsieger 16:
1.166 leot 17: $NetBSD: pkgsrc.xml,v 1.36 2020/01/03 15:55:24 leot 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
70: 5.1.3. Deinstalling packages
71: 5.1.4. Getting information about installed packages
72: 5.1.5. Checking for security vulnerabilities in installed packages
73: 5.1.6. Finding if newer versions of your installed packages are in
1.1 dsieger 74: pkgsrc
1.154 rillig 75: 5.1.7. Other administrative functions
1.1 dsieger 76:
1.154 rillig 77: 5.2. Building packages from source
1.1 dsieger 78:
1.154 rillig 79: 5.2.1. Requirements
80: 5.2.2. Fetching distfiles
81: 5.2.3. How to build and install
1.1 dsieger 82:
1.154 rillig 83: 6. Configuring pkgsrc
1.1 dsieger 84:
1.154 rillig 85: 6.1. General configuration
86: 6.2. Variables affecting the build process
87: 6.3. Variables affecting the installation process
88: 6.4. Selecting and configuring the compiler
1.1 dsieger 89:
1.154 rillig 90: 6.4.1. Selecting the compiler
91: 6.4.2. Additional flags to the compiler (CFLAGS)
92: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 93:
1.154 rillig 94: 6.5. Developer/advanced settings
95: 6.6. Selecting Build Options
1.1 dsieger 96:
1.154 rillig 97: 7. Creating binary packages
1.1 dsieger 98:
1.154 rillig 99: 7.1. Building a single binary package
100: 7.2. Settings for creation of binary packages
1.1 dsieger 101:
1.154 rillig 102: 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 103:
1.154 rillig 104: 8.1. Preparations
1.180 rillig 105: 8.2. Running a bulk build
1.6 rillig 106:
1.154 rillig 107: 8.2.1. Configuration
1.6 rillig 108:
1.154 rillig 109: 8.3. Requirements of a full bulk build
1.178 rillig 110: 8.4. Bulk build variants
1.6 rillig 111:
1.179 rillig 112: 8.4.1. Detect unknown configure options
113: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 114: 8.4.3. Force compiler options only in the build phase
115: 8.4.4. Use custom directories
116: 8.4.5. Turn warnings into errors
117: 8.4.6. Reject packages for which pkglint reports errors
118: 8.4.7. Reject packages that contain forbidden strings
119: 8.4.8. Reject packages whose self-test fails
120: 8.4.9. Reject packages that use undefined shell variables
121: 8.4.10. Turn off verbose logging
1.178 rillig 122:
123: 8.5. Creating a multiple CD-ROM packages collection
124:
125: 8.5.1. Example of cdpack
1.6 rillig 126:
1.154 rillig 127: 9. Directory layout of the installed files
1.6 rillig 128:
1.154 rillig 129: 9.1. File system layout in ${LOCALBASE}
130: 9.2. File system layout in ${VARBASE}
1.6 rillig 131:
1.154 rillig 132: 10. Frequently Asked Questions
1.6 rillig 133:
1.154 rillig 134: 10.1. Are there any mailing lists for pkg-related discussion?
135: 10.2. Utilities for package management (pkgtools)
136: 10.3. How to use pkgsrc as non-root
137: 10.4. How to resume transfers when fetching distfiles?
138: 10.5. How can I install/use modular X.org from pkgsrc?
139: 10.6. How to fetch files from behind a firewall
140: 10.7. How to fetch files from HTTPS sites
141: 10.8. How do I tell make fetch to do passive FTP?
142: 10.9. How to fetch all distfiles at once
143: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc"
1.24 wiz 144: mean?
1.154 rillig 145: 10.11. What does "Could not find bsd.own.mk" mean?
146: 10.12. Using 'sudo' with pkgsrc
147: 10.13. How do I change the location of configuration files?
148: 10.14. Automated security checks
149: 10.15. Why do some packages ignore my CFLAGS?
150: 10.16. A package does not build. What shall I do?
151: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/???
1.24 wiz 152: merge conflicts" mean?
1.1 dsieger 153:
154: II. The pkgsrc developer's guide
155:
1.154 rillig 156: 11. Getting help
157: 12. Creating a new pkgsrc package from scratch
1.1 dsieger 158:
1.154 rillig 159: 12.1. Common types of packages
1.1 dsieger 160:
1.154 rillig 161: 12.1.1. Perl modules
162: 12.1.2. Python modules and programs
1.160 brook 163: 12.1.3. R packages
164: 12.1.4. TeXlive packages
1.1 dsieger 165:
1.154 rillig 166: 12.2. Examples
1.1 dsieger 167:
1.154 rillig 168: 12.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 169:
1.154 rillig 170: 13. Package components - files, directories and contents
1.1 dsieger 171:
1.154 rillig 172: 13.1. Makefile
173: 13.2. distinfo
174: 13.3. patches/*
1.1 dsieger 175:
1.154 rillig 176: 13.3.1. Structure of a single patch file
177: 13.3.2. Creating patch files
178: 13.3.3. Sources where the patch files come from
179: 13.3.4. Patching guidelines
180: 13.3.5. Feedback to the author
1.1 dsieger 181:
1.154 rillig 182: 13.4. Other mandatory files
183: 13.5. Optional files
1.1 dsieger 184:
1.154 rillig 185: 13.5.1. Files affecting the binary package
186: 13.5.2. Files affecting the build process
187: 13.5.3. Files affecting nothing at all
1.1 dsieger 188:
1.154 rillig 189: 13.6. work*
190: 13.7. files/*
1.1 dsieger 191:
1.154 rillig 192: 14. Programming in Makefiles
1.1 dsieger 193:
1.154 rillig 194: 14.1. Caveats
195: 14.2. Makefile variables
1.1 dsieger 196:
1.154 rillig 197: 14.2.1. Naming conventions
1.1 dsieger 198:
1.154 rillig 199: 14.3. Code snippets
1.1 dsieger 200:
1.154 rillig 201: 14.3.1. Adding things to a list
202: 14.3.2. Echoing a string exactly as-is
203: 14.3.3. Passing CFLAGS to GNU configure scripts
204: 14.3.4. Handling possibly empty variables
1.1 dsieger 205:
1.154 rillig 206: 15. PLIST issues
1.1 dsieger 207:
1.154 rillig 208: 15.1. RCS ID
209: 15.2. Semi-automatic PLIST generation
210: 15.3. Tweaking output of make print-PLIST
211: 15.4. Variable substitution in PLIST
212: 15.5. Man page compression
213: 15.6. Changing PLIST source with PLIST_SRC
214: 15.7. Platform-specific and differing PLISTs
215: 15.8. Build-specific PLISTs
216: 15.9. Sharing directories between packages
1.1 dsieger 217:
1.154 rillig 218: 16. Buildlink methodology
1.1 dsieger 219:
1.154 rillig 220: 16.1. Converting packages to use buildlink3
221: 16.2. Writing buildlink3.mk files
1.1 dsieger 222:
1.154 rillig 223: 16.2.1. Anatomy of a buildlink3.mk file
224: 16.2.2. Updating BUILDLINK_API_DEPENDS.pkg and
1.27 wiz 225: BUILDLINK_ABI_DEPENDS.pkg in buildlink3.mk files
1.1 dsieger 226:
1.154 rillig 227: 16.3. Writing builtin.mk files
1.1 dsieger 228:
1.154 rillig 229: 16.3.1. Anatomy of a builtin.mk file
230: 16.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 231:
1.154 rillig 232: 17. The pkginstall framework
1.1 dsieger 233:
1.154 rillig 234: 17.1. Files and directories outside the installation prefix
1.1 dsieger 235:
1.154 rillig 236: 17.1.1. Directory manipulation
237: 17.1.2. File manipulation
1.1 dsieger 238:
1.154 rillig 239: 17.2. Configuration files
1.1 dsieger 240:
1.154 rillig 241: 17.2.1. How PKG_SYSCONFDIR is set
242: 17.2.2. Telling the software where configuration files are
243: 17.2.3. Patching installations
244: 17.2.4. Disabling handling of configuration files
1.1 dsieger 245:
1.154 rillig 246: 17.3. System startup scripts
1.1 dsieger 247:
1.154 rillig 248: 17.3.1. Disabling handling of system startup scripts
1.1 dsieger 249:
1.154 rillig 250: 17.4. System users and groups
251: 17.5. System shells
1.1 dsieger 252:
1.154 rillig 253: 17.5.1. Disabling shell registration
1.1 dsieger 254:
1.154 rillig 255: 17.6. Fonts
1.1 dsieger 256:
1.154 rillig 257: 17.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 258:
1.154 rillig 259: 18. Options handling
1.1 dsieger 260:
1.154 rillig 261: 18.1. Global default options
262: 18.2. Converting packages to use bsd.options.mk
263: 18.3. Option Names
264: 18.4. Determining the options of dependencies
1.1 dsieger 265:
1.154 rillig 266: 19. The build process
1.1 dsieger 267:
1.154 rillig 268: 19.1. Introduction
269: 19.2. Program location
270: 19.3. Directories used during the build process
271: 19.4. Running a phase
272: 19.5. The fetch phase
1.1 dsieger 273:
1.154 rillig 274: 19.5.1. What to fetch and where to get it from
275: 19.5.2. How are the files fetched?
1.1 dsieger 276:
1.154 rillig 277: 19.6. The checksum phase
278: 19.7. The extract phase
279: 19.8. The patch phase
280: 19.9. The tools phase
281: 19.10. The wrapper phase
282: 19.11. The configure phase
283: 19.12. The build phase
284: 19.13. The test phase
285: 19.14. The install phase
286: 19.15. The package phase
287: 19.16. Cleaning up
288: 19.17. Other helpful targets
1.1 dsieger 289:
1.154 rillig 290: 20. Tools needed for building or running
1.1 dsieger 291:
1.154 rillig 292: 20.1. Tools for pkgsrc builds
293: 20.2. Tools needed by packages
294: 20.3. Tools provided by platforms
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
331: 21.4.3. Packages containing perl scripts
332: 21.4.4. Packages containing shell scripts
333: 21.4.5. Other programming languages
334:
335: 21.5. The build phase
336:
337: 21.5.1. Compiling C and C++ code conditionally
338: 21.5.2. How to handle compiler bugs
1.172 rillig 339: 21.5.3. No such file or directory
340: 21.5.4. Undefined reference to "..."
341: 21.5.5. Running out of memory
1.154 rillig 342:
343: 21.6. The install phase
344:
345: 21.6.1. Creating needed directories
346: 21.6.2. Where to install documentation
347: 21.6.3. Installing highscore files
348: 21.6.4. Adding DESTDIR support to packages
349: 21.6.5. Packages with hardcoded paths to other interpreters
350: 21.6.6. Packages installing perl modules
351: 21.6.7. Packages installing info files
352: 21.6.8. Packages installing man pages
353: 21.6.9. Packages installing GConf data files
354: 21.6.10. Packages installing scrollkeeper/rarian data files
355: 21.6.11. Packages installing X11 fonts
356: 21.6.12. Packages installing GTK2 modules
357: 21.6.13. Packages installing SGML or XML data
358: 21.6.14. Packages installing extensions to the MIME database
359: 21.6.15. Packages using intltool
360: 21.6.16. Packages installing startup scripts
361: 21.6.17. Packages installing TeX modules
362: 21.6.18. Packages supporting running binaries in emulation
363: 21.6.19. Packages installing hicolor theme icons
364: 21.6.20. Packages installing desktop files
365:
366: 21.7. Marking packages as having problems
367:
368: 22. Debugging
369: 23. Submitting and Committing
370:
371: 23.1. Submitting binary packages
372: 23.2. Submitting source packages (for non-NetBSD-developers)
373: 23.3. General notes when adding, updating, or removing packages
374: 23.4. Commit Messages
375: 23.5. Committing: Adding a package to CVS
376: 23.6. Updating a package to a newer version
377: 23.7. Renaming a package in pkgsrc
378: 23.8. Moving a package in pkgsrc
379:
380: 24. Frequently Asked Questions
381: 25. GNOME packaging and porting
382:
383: 25.1. Meta packages
384: 25.2. Packaging a GNOME application
385: 25.3. Updating GNOME to a newer version
386: 25.4. Patching guidelines
1.1 dsieger 387:
388: III. The pkgsrc infrastructure internals
389:
1.154 rillig 390: 26. Design of the pkgsrc infrastructure
1.1 dsieger 391:
1.154 rillig 392: 26.1. The meaning of variable definitions
393: 26.2. Avoiding problems before they arise
394: 26.3. Variable evaluation
1.1 dsieger 395:
1.154 rillig 396: 26.3.1. At load time
397: 26.3.2. At runtime
1.1 dsieger 398:
1.154 rillig 399: 26.4. How can variables be specified?
400: 26.5. Designing interfaces for Makefile fragments
1.1 dsieger 401:
1.154 rillig 402: 26.5.1. Procedures with parameters
403: 26.5.2. Actions taken on behalf of parameters
1.1 dsieger 404:
1.154 rillig 405: 26.6. The order in which files are loaded
1.1 dsieger 406:
1.154 rillig 407: 26.6.1. The order in bsd.prefs.mk
408: 26.6.2. The order in bsd.pkg.mk
1.1 dsieger 409:
1.154 rillig 410: 27. Regression tests
1.1 dsieger 411:
1.154 rillig 412: 27.1. Running the regression tests
413: 27.2. Adding a new regression test
1.1 dsieger 414:
1.154 rillig 415: 27.2.1. Overridable functions
416: 27.2.2. Helper functions
1.1 dsieger 417:
1.154 rillig 418: 28. Porting pkgsrc
1.1 dsieger 419:
1.154 rillig 420: 28.1. Porting pkgsrc to a new operating system
1.1 dsieger 421:
422: A. A simple example package: bison
423:
424: A.1. files
425:
426: A.1.1. Makefile
427: A.1.2. DESCR
428: A.1.3. PLIST
429: A.1.4. Checking a package with pkglint
430:
431: A.2. Steps for building, installing, packaging
432:
433: B. Build logs
434:
435: B.1. Building figlet
436: B.2. Packaging figlet
437:
438: C. Directory layout of the pkgsrc FTP server
439:
1.23 jakllsch 440: C.1. distfiles: The distributed source files
441: C.2. misc: Miscellaneous things
442: C.3. packages: Binary packages
443: C.4. reports: Bulk build reports
1.148 leot 444: C.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 445:
1.154 rillig 446: D. Help topics
447: E. Editing guidelines for the pkgsrc guide
1.1 dsieger 448:
1.154 rillig 449: E.1. Make targets
450: E.2. Procedure
1.1 dsieger 451:
452: List of Tables
453:
454: 1.1. Platforms supported by pkgsrc
1.154 rillig 455: 13.1. Patching examples
456: 25.1. PLIST handling for GNOME packages
1.1 dsieger 457:
458: Chapter 1. What is pkgsrc?
459:
460: Table of Contents
461:
462: 1.1. Introduction
463:
464: 1.1.1. Why pkgsrc?
465: 1.1.2. Supported platforms
466:
467: 1.2. Overview
468: 1.3. Terminology
469:
470: 1.3.1. Roles involved in pkgsrc
471:
472: 1.4. Typography
473:
474: 1.1. Introduction
475:
476: There is a lot of software freely available for Unix-based systems, which is
477: usually available in form of the source code. Before such software can be used,
478: it needs to be configured to the local system, compiled and installed, and this
479: is exactly what The NetBSD Packages Collection (pkgsrc) does. pkgsrc also has
480: some basic commands to handle binary packages, so that not every user has to
481: build the packages for himself, which is a time-costly task.
482:
483: pkgsrc currently contains several thousand packages, including:
484:
1.104 sevan 485: * www/apache24 - The Apache web server
1.1 dsieger 486:
487: * www/firefox - The Firefox web browser
488:
489: * meta-pkgs/gnome - The GNOME Desktop Environment
490:
1.102 ryoon 491: * meta-pkgs/kde4 - The K Desktop Environment
1.1 dsieger 492:
1.108 rillig 493: ? just to name a few.
1.1 dsieger 494:
495: pkgsrc has built-in support for handling varying dependencies, such as pthreads
496: and X11, and extended features such as IPv6 support on a range of platforms.
497:
498: 1.1.1. Why pkgsrc?
499:
500: pkgsrc provides the following key features:
501:
502: * Easy building of software from source as well as the creation and
503: installation of binary packages. The source and latest patches are
504: retrieved from a master or mirror download site, checksum verified, then
505: built on your system. Support for binary-only distributions is available
506: for both native platforms and NetBSD emulated platforms.
507:
508: * All packages are installed in a consistent directory tree, including
509: binaries, libraries, man pages and other documentation.
510:
1.104 sevan 511: * Tracking of package dependencies automatically, including when performing
512: updates, to ensure required packages are installed. The configuration files
513: of various packages are handled automatically during updates, so local
514: changes are preserved.
1.1 dsieger 515:
516: * Like NetBSD, pkgsrc is designed with portability in mind and consists of
517: highly portable code. This allows the greatest speed of development when
1.26 spz 518: porting to a new platform. This portability also ensures that pkgsrc is
1.1 dsieger 519: consistent across all platforms.
520:
521: * The installation prefix, acceptable software licenses, international
522: encryption requirements and build-time options for a large number of
523: packages are all set in a simple, central configuration file.
524:
525: * The entire source (not including the distribution files) is freely
526: available under a BSD license, so you may extend and adapt pkgsrc to your
527: needs. Support for local packages and patches is available right out of the
528: box, so you can configure it specifically for your environment.
529:
530: The following principles are basic to pkgsrc:
531:
532: * "It should only work if it's right." ? That means, if a package contains
533: bugs, it's better to find them and to complain about them rather than to
534: just install the package and hope that it works. There are numerous checks
1.175 gutterid 535: in pkgsrc that try to find such bugs: static analysis tools (pkgtools/
1.1 dsieger 536: pkglint), build-time checks (portability of shell scripts), and
537: post-installation checks (installed files, references to shared libraries,
538: script interpreters).
539:
540: * "If it works, it should work everywhere" ? Like NetBSD has been ported to
541: many hardware architectures, pkgsrc has been ported to many operating
542: systems. Care is taken that packages behave the same on all platforms.
543:
544: 1.1.2. Supported platforms
545:
546: pkgsrc consists of both a source distribution and a binary distribution for
547: these operating systems. After retrieving the required source or binaries, you
548: can be up and running with pkgsrc in just minutes!
549:
550: pkgsrc was derived from FreeBSD's ports system, and initially developed for
551: NetBSD only. Since then, pkgsrc has grown a lot, and now supports the following
552: platforms:
553:
554: Table 1.1. Platforms supported by pkgsrc
555:
1.92 sevan 556: +-----------------------------------------------------------------------------+
557: | Platform | Date Support | Notes |
558: | | Added | |
559: |--------------------------------------+---------------+----------------------|
560: |NetBSD | Aug 1997 | |
561: |--------------------------------------+---------------+----------------------|
562: |Solaris | Mar 1999 |README.Solaris |
563: |--------------------------------------+---------------+----------------------|
564: |Linux | Jun 1999 |README.Linux |
565: |--------------------------------------+---------------+----------------------|
1.118 sevan 566: |Darwin / Mac OS X / OS X / macOS | Oct 2001 |README.MacOSX |
1.92 sevan 567: |--------------------------------------+---------------+----------------------|
568: |FreeBSD | Nov 2002 |README.FreeBSD |
569: |--------------------------------------+---------------+----------------------|
570: |OpenBSD | Nov 2002 |README.OpenBSD |
571: |--------------------------------------+---------------+----------------------|
572: |IRIX | Dec 2002 |README.IRIX |
573: | | |README.IRIX5.3 |
574: |--------------------------------------+---------------+----------------------|
575: |BSD/OS | Dec 2003 | |
576: |--------------------------------------+---------------+----------------------|
577: |AIX | Dec 2003 |README.AIX |
578: |--------------------------------------+---------------+----------------------|
579: |Interix (Microsoft Windows Services | Mar 2004 |README.Interix |
580: |for Unix) | | |
581: |--------------------------------------+---------------+----------------------|
582: |DragonFlyBSD | Oct 2004 | |
583: |--------------------------------------+---------------+----------------------|
584: |OSF/1 | Nov 2004 |README.OSF1 |
585: |--------------------------------------+---------------+----------------------|
586: |HP-UX | Apr 2007 |README.HPUX |
587: |--------------------------------------+---------------+----------------------|
588: |Haiku | Sep 2010 |README.Haiku |
589: |--------------------------------------+---------------+----------------------|
590: |MirBSD | Jan 2011 | |
591: |--------------------------------------+---------------+----------------------|
592: |Minix3 | Nov 2011 |README.Minix3 |
593: |--------------------------------------+---------------+----------------------|
594: |Cygwin | Mar 2013 |README.Cygwin |
595: |--------------------------------------+---------------+----------------------|
596: |GNU/kFreeBSD | Jul 2013 |README.GNUkFreeBSD |
1.104 sevan 597: |--------------------------------------+---------------+----------------------|
598: |Bitrig | Jun 2014 |README.Bitrig |
1.92 sevan 599: +-----------------------------------------------------------------------------+
1.1 dsieger 600:
601:
602: 1.2. Overview
603:
604: This document is divided into three parts. The first, The pkgsrc user's guide,
605: describes how one can use one of the packages in the Package Collection, either
606: by installing a precompiled binary package, or by building one's own copy using
607: the NetBSD package system. The second part, The pkgsrc developer's guide,
608: explains how to prepare a package so it can be easily built by other NetBSD
609: users without knowing about the package's building details. The third part, The
610: pkgsrc infrastructure internals is intended for those who want to understand
611: how pkgsrc is implemented.
612:
613: This document is available in various formats: HTML, PDF, PS, TXT.
614:
615: 1.3. Terminology
616:
617: There has been a lot of talk about "ports", "packages", etc. so far. Here is a
618: description of all the terminology used within this document.
619:
620: Package
621:
622: A set of files and building instructions that describe what's necessary to
623: build a certain piece of software using pkgsrc. Packages are traditionally
1.123 wiz 624: stored under /usr/pkgsrc, but may be stored in any location, referred to as
625: PKGSRCDIR.
1.1 dsieger 626:
627: The NetBSD package system
628:
629: This is the former name of "pkgsrc". It is part of the NetBSD operating
630: system and can be bootstrapped to run on non-NetBSD operating systems as
631: well. It handles building (compiling), installing, and removing of
632: packages.
633:
634: Distfile
635:
636: This term describes the file or files that are provided by the author of
637: the piece of software to distribute his work. All the changes necessary to
638: build on NetBSD are reflected in the corresponding package. Usually the
639: distfile is in the form of a compressed tar-archive, but other types are
640: possible, too. Distfiles are usually stored below /usr/pkgsrc/distfiles.
641:
642: Port
643:
644: This is the term used by FreeBSD and OpenBSD people for what we call a
645: package. In NetBSD terminology, "port" refers to a different architecture.
646:
647: Precompiled/binary package
648:
649: A set of binaries built with pkgsrc from a distfile and stuffed together in
650: a single .tgz file so it can be installed on machines of the same machine
651: architecture without the need to recompile. Packages are usually generated
652: in /usr/pkgsrc/packages; there is also an archive on ftp.NetBSD.org.
653:
654: Sometimes, this is referred to by the term "package" too, especially in the
655: context of precompiled packages.
656:
657: Program
658:
659: The piece of software to be installed which will be constructed from all
660: the files in the distfile by the actions defined in the corresponding
661: package.
662:
663: 1.3.1. Roles involved in pkgsrc
664:
665: pkgsrc users
666:
667: The pkgsrc users are people who use the packages provided by pkgsrc.
668: Typically they are system administrators. The people using the software
669: that is inside the packages (maybe called "end users") are not covered by
670: the pkgsrc guide.
671:
672: There are two kinds of pkgsrc users: Some only want to install pre-built
673: binary packages. Others build the pkgsrc packages from source, either for
674: installing them directly or for building binary packages themselves. For
675: pkgsrc users Part I, "The pkgsrc user's guide" should provide all necessary
676: documentation.
677:
678: package maintainers
679:
680: A package maintainer creates packages as described in Part II, "The pkgsrc
681: developer's guide".
682:
683: infrastructure developers
684:
685: These people are involved in all those files that live in the mk/ directory
686: and below. Only these people should need to read through Part III, "The
687: pkgsrc infrastructure internals", though others might be curious, too.
688:
689: 1.4. Typography
690:
691: When giving examples for commands, shell prompts are used to show if the
692: command should/can be issued as root, or if "normal" user privileges are
1.115 sevan 693: sufficient. We use a # for root's shell prompt, a % for users' shell prompt,
694: assuming they use the C-shell or tcsh and a $ for bourne shell and derivatives.
1.1 dsieger 695:
696: Part I. The pkgsrc user's guide
697:
698: Table of Contents
699:
1.154 rillig 700: 2. Getting help
701: 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 702:
1.154 rillig 703: 3.1. Getting pkgsrc for the first time
1.1 dsieger 704:
1.154 rillig 705: 3.1.1. As tar archive
706: 3.1.2. Via anonymous CVS
1.1 dsieger 707:
1.154 rillig 708: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 709:
1.154 rillig 710: 3.2.1. Via tar files
711: 3.2.2. Via CVS
1.1 dsieger 712:
1.154 rillig 713: 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 714:
1.154 rillig 715: 4.1. Binary distribution
716: 4.2. Bootstrapping pkgsrc
1.1 dsieger 717:
1.154 rillig 718: 5. Using pkgsrc
1.1 dsieger 719:
1.154 rillig 720: 5.1. Using binary packages
1.1 dsieger 721:
1.154 rillig 722: 5.1.1. Finding binary packages
723: 5.1.2. Installing binary packages
724: 5.1.3. Deinstalling packages
725: 5.1.4. Getting information about installed packages
726: 5.1.5. Checking for security vulnerabilities in installed packages
727: 5.1.6. Finding if newer versions of your installed packages are in
1.1 dsieger 728: pkgsrc
1.154 rillig 729: 5.1.7. Other administrative functions
1.1 dsieger 730:
1.154 rillig 731: 5.2. Building packages from source
1.1 dsieger 732:
1.154 rillig 733: 5.2.1. Requirements
734: 5.2.2. Fetching distfiles
735: 5.2.3. How to build and install
1.1 dsieger 736:
1.154 rillig 737: 6. Configuring pkgsrc
1.1 dsieger 738:
1.154 rillig 739: 6.1. General configuration
740: 6.2. Variables affecting the build process
741: 6.3. Variables affecting the installation process
742: 6.4. Selecting and configuring the compiler
1.1 dsieger 743:
1.154 rillig 744: 6.4.1. Selecting the compiler
745: 6.4.2. Additional flags to the compiler (CFLAGS)
746: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 747:
1.154 rillig 748: 6.5. Developer/advanced settings
749: 6.6. Selecting Build Options
1.1 dsieger 750:
1.154 rillig 751: 7. Creating binary packages
1.1 dsieger 752:
1.154 rillig 753: 7.1. Building a single binary package
754: 7.2. Settings for creation of binary packages
1.1 dsieger 755:
1.154 rillig 756: 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 757:
1.154 rillig 758: 8.1. Preparations
1.180 rillig 759: 8.2. Running a bulk build
1.6 rillig 760:
1.154 rillig 761: 8.2.1. Configuration
1.6 rillig 762:
1.154 rillig 763: 8.3. Requirements of a full bulk build
1.178 rillig 764: 8.4. Bulk build variants
765:
1.179 rillig 766: 8.4.1. Detect unknown configure options
767: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 768: 8.4.3. Force compiler options only in the build phase
769: 8.4.4. Use custom directories
770: 8.4.5. Turn warnings into errors
771: 8.4.6. Reject packages for which pkglint reports errors
772: 8.4.7. Reject packages that contain forbidden strings
773: 8.4.8. Reject packages whose self-test fails
774: 8.4.9. Reject packages that use undefined shell variables
775: 8.4.10. Turn off verbose logging
1.6 rillig 776:
1.178 rillig 777: 8.5. Creating a multiple CD-ROM packages collection
778:
779: 8.5.1. Example of cdpack
1.6 rillig 780:
1.154 rillig 781: 9. Directory layout of the installed files
1.6 rillig 782:
1.154 rillig 783: 9.1. File system layout in ${LOCALBASE}
784: 9.2. File system layout in ${VARBASE}
1.6 rillig 785:
1.154 rillig 786: 10. Frequently Asked Questions
1.6 rillig 787:
1.154 rillig 788: 10.1. Are there any mailing lists for pkg-related discussion?
789: 10.2. Utilities for package management (pkgtools)
790: 10.3. How to use pkgsrc as non-root
791: 10.4. How to resume transfers when fetching distfiles?
792: 10.5. How can I install/use modular X.org from pkgsrc?
793: 10.6. How to fetch files from behind a firewall
794: 10.7. How to fetch files from HTTPS sites
795: 10.8. How do I tell make fetch to do passive FTP?
796: 10.9. How to fetch all distfiles at once
797: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
798: 10.11. What does "Could not find bsd.own.mk" mean?
799: 10.12. Using 'sudo' with pkgsrc
800: 10.13. How do I change the location of configuration files?
801: 10.14. Automated security checks
802: 10.15. Why do some packages ignore my CFLAGS?
803: 10.16. A package does not build. What shall I do?
804: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.24 wiz 805: conflicts" mean?
1.1 dsieger 806:
1.154 rillig 807: Chapter 2. Getting help
808:
809: To get help when using pkgsrc, the definitive source is this document, the
810: pkgsrc guide. If you don't find anything here, there are alternatives:
811:
812: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
813: Run bmake help topic=? to get help for any topic, such as a variable name
814: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
815: like strcasecmp or any other topic.
816:
817: The available help topics are listed in Appendix D, Help topics.
818:
1.163 rillig 819: * To see the value of a single variable, run bmake show-var VARNAME=X.
820:
821: * To see the values of the most common variables, run bmake show-all. These
822: variables are grouped by topic. To see the variables for a single topic,
823: run bmake show-all-topic, for example bmake show-all-fetch.
824:
1.154 rillig 825: * The pkgsrc-users mailing list, to which you can subscribe and then ask your
826: questions.
827:
828: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
829: a specialized chat program such as XChat. Pick any user name and join the
830: channel #pkgsrc.
831:
832: Chapter 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 833:
834: Table of Contents
835:
1.154 rillig 836: 3.1. Getting pkgsrc for the first time
1.1 dsieger 837:
1.154 rillig 838: 3.1.1. As tar archive
839: 3.1.2. Via anonymous CVS
1.1 dsieger 840:
1.154 rillig 841: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 842:
1.154 rillig 843: 3.2.1. Via tar files
844: 3.2.2. Via CVS
1.1 dsieger 845:
846: Before you download and extract the files, you need to decide where you want to
847: extract them. When using pkgsrc as root user, pkgsrc is usually installed in /
848: usr/pkgsrc. You are though free to install the sources and binary packages
849: wherever you want in your filesystem, provided that the pathname does not
850: contain white-space or other characters that are interpreted specially by the
851: shell and some other programs. A safe bet is to use only letters, digits,
852: underscores and dashes.
853:
1.154 rillig 854: 3.1. Getting pkgsrc for the first time
1.1 dsieger 855:
1.25 wiz 856: Before you download any pkgsrc files, you should decide whether you want the
1.1 dsieger 857: current branch or the stable branch. The latter is forked on a quarterly basis
858: from the current branch and only gets modified for security updates. The names
859: of the stable branches are built from the year and the quarter, for example
1.174 leot 860: 2020Q1.
1.1 dsieger 861:
862: The second step is to decide how you want to download pkgsrc. You can get it as
1.24 wiz 863: a tar file or via CVS. Both ways are described here.
1.1 dsieger 864:
1.52 asau 865: Note that tar archive contains CVS working copy. Thus you can switch to using
866: CVS at any later time.
1.1 dsieger 867:
1.154 rillig 868: 3.1.1. As tar archive
1.52 asau 869:
1.151 sevan 870: The primary download location for all pkgsrc files is https://cdn.NetBSD.org/
871: pub/pkgsrc/ or ftp://ftp.NetBSD.org/pub/pkgsrc/ (it points to the same
872: location). There are a number of subdirectories for different purposes, which
873: are described in detail in Appendix C, Directory layout of the pkgsrc FTP
874: server.
1.1 dsieger 875:
1.52 asau 876: The tar archive for the current branch is in the directory current and is
1.118 sevan 877: called pkgsrc.tar.gz. It is autogenerated weekly.
1.52 asau 878:
879: To save download time we provide bzip2- and xz-compressed archives which are
880: published at pkgsrc.tar.bz2 and pkgsrc.tar.xz respectively.
881:
882: You can fetch the same files using FTP.
1.1 dsieger 883:
1.174 leot 884: The tar file for the stable branch 2020Q1 is in the directory pkgsrc-2020Q1 and
1.59 jnemeth 885: is also called pkgsrc.tar.gz.
1.1 dsieger 886:
1.136 leot 887: To download the latest pkgsrc stable tarball, run:
1.12 weinem 888:
1.174 leot 889: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2020Q1/pkgsrc.tar.gz
1.12 weinem 890:
1.78 snj 891: If you prefer, you can also fetch it using "wget", "curl", or your web browser.
1.52 asau 892:
1.12 weinem 893: Then, extract it with:
894:
1.78 snj 895: $ tar -xzf pkgsrc.tar.gz -C /usr
1.12 weinem 896:
897: This will create the directory pkgsrc/ in /usr/ and all the package source will
898: be stored under /usr/pkgsrc/.
899:
900: To download pkgsrc-current, run:
901:
902: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz
1.1 dsieger 903:
1.154 rillig 904: 3.1.2. Via anonymous CVS
1.1 dsieger 905:
1.24 wiz 906: To fetch a specific pkgsrc stable branch, run:
1.1 dsieger 907:
1.174 leot 908: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2020Q1 -P pkgsrc
1.13 weinem 909:
1.24 wiz 910: This will create the directory pkgsrc/ in your /usr/ directory and all the
911: package source will be stored under /usr/pkgsrc/.
912:
913: To fetch the pkgsrc current branch, run:
1.1 dsieger 914:
1.40 wiz 915: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 916:
1.30 dholland 917: Refer to the list of available mirrors to choose a faster CVS mirror, if
918: needed.
1.1 dsieger 919:
1.24 wiz 920: If you get error messages from rsh, you need to set CVS_RSH variable. E.g.:
1.1 dsieger 921:
1.40 wiz 922: $ cd /usr && env CVS_RSH=ssh cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 923:
1.24 wiz 924: Refer to documentation on your command shell how to set CVS_RSH=ssh
925: permanently. For Bourne shells, you can set it in your .profile or better
926: globally in /etc/profile:
927:
928: # set CVS remote shell command
929: CVS_RSH=ssh
930: export CVS_RSH
1.12 weinem 931:
1.13 weinem 932: By default, CVS doesn't do things like most people would expect it to do. But
933: there is a way to convince CVS, by creating a file called .cvsrc in your home
1.12 weinem 934: directory and saving the following lines to it. This file will save you lots of
935: headache and some bug reports, so we strongly recommend it. You can find an
936: explanation of this file in the CVS documentation.
1.2 rillig 937:
938: # recommended CVS configuration file from the pkgsrc guide
1.155 sevan 939: cvs -q
1.2 rillig 940: checkout -P
1.4 rillig 941: update -dP
942: diff -upN
1.2 rillig 943: rdiff -u
1.24 wiz 944: release -d
1.1 dsieger 945:
1.154 rillig 946: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 947:
948: The preferred way to keep pkgsrc up-to-date is via CVS (which also works if you
949: have first installed it via a tar file). It saves bandwidth and hard disk
950: activity, compared to downloading the tar file again.
951:
1.154 rillig 952: 3.2.1. Via tar files
1.1 dsieger 953:
954: Warning
955:
956: When updating from a tar file, you first need to completely remove the old
957: pkgsrc directory. Otherwise those files that have been removed from pkgsrc in
958: the mean time will not be removed on your local disk, resulting in
959: inconsistencies. When removing the old files, any changes that you have done to
960: the pkgsrc files will be lost after updating. Therefore updating via CVS is
961: strongly recommended.
962:
963: Note that by default the distfiles and the binary packages are saved in the
964: pkgsrc tree, so don't forget to rescue them before updating. You can also
1.78 snj 965: configure pkgsrc to store distfiles and packages in directories outside the
1.154 rillig 966: pkgsrc tree by setting the DISTDIR and PACKAGES variables. See Chapter 6,
1.78 snj 967: Configuring pkgsrc for the details.
1.1 dsieger 968:
969: To update pkgsrc from a tar file, download the tar file as explained above.
970: Then, make sure that you have not made any changes to the files in the pkgsrc
971: directory. Remove the pkgsrc directory and extract the new tar file. Done.
972:
1.154 rillig 973: 3.2.2. Via CVS
1.1 dsieger 974:
1.26 spz 975: To update pkgsrc via CVS, change to the pkgsrc directory and run cvs:
1.12 weinem 976:
1.26 spz 977: $ cd /usr/pkgsrc && cvs update -dP
978:
979: If you get error messages from rsh, you need to set CVS_RSH variable as
980: described above. E.g.:
981:
982: $ cd /usr/pkgsrc && env CVS_RSH=ssh cvs up -dP
1.1 dsieger 983:
1.154 rillig 984: 3.2.2.1. Switching between different pkgsrc branches
1.1 dsieger 985:
986: When updating pkgsrc, the CVS program keeps track of the branch you selected.
987: But if you, for whatever reason, want to switch from the stable branch to the
988: current one, you can do it by adding the option "-A" after the "update"
1.25 wiz 989: keyword. To switch from the current branch back to the stable branch, add the "
1.174 leot 990: -rpkgsrc-2020Q1" option.
1.1 dsieger 991:
1.154 rillig 992: 3.2.2.2. What happens to my changes when updating?
1.1 dsieger 993:
994: When you update pkgsrc, the CVS program will only touch those files that are
995: registered in the CVS repository. That means that any packages that you created
996: on your own will stay unmodified. If you change files that are managed by CVS,
997: later updates will try to merge your changes with those that have been done by
998: others. See the CVS manual, chapter "update" for details.
999:
1.154 rillig 1000: Chapter 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 1001:
1002: Table of Contents
1003:
1.154 rillig 1004: 4.1. Binary distribution
1005: 4.2. Bootstrapping pkgsrc
1.1 dsieger 1006:
1.154 rillig 1007: 4.1. Binary distribution
1.1 dsieger 1008:
1.154 rillig 1009: See Section 5.1, "Using binary packages".
1.1 dsieger 1010:
1.154 rillig 1011: 4.2. Bootstrapping pkgsrc
1.1 dsieger 1012:
1.44 asau 1013: pkgsrc can be bootstrapped for use in two different modes: privileged and
1014: unprivileged one. In unprivileged mode in contrast to privileged one all
1.45 asau 1015: programs are installed under one particular user and cannot utilise privileged
1.44 asau 1016: operations (packages don't create special users and all special file
1017: permissions like setuid are ignored).
1018:
1.1 dsieger 1019: Installing the bootstrap kit from source should be as simple as:
1020:
1.60 asau 1021: # env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 1022: # cd pkgsrc/bootstrap
1023: # ./bootstrap
1024:
1025:
1.44 asau 1026: To bootstrap in unprivileged mode pass "--unprivileged" flag to bootstrap
1027:
1028: By default, in privileged mode pkgsrc uses /usr/pkg for prefix where programs
1.118 sevan 1029: will be installed in, and /usr/pkg/pkgdb for the package database directory
1030: where pkgsrc will do its internal bookkeeping, /var is used as varbase, where
1.44 asau 1031: packages install their persistent data. In unprivileged mode pkgsrc uses ~/pkg
1.118 sevan 1032: for prefix, ~/pkg/pkgdb for the package database, and ~/pkg/var for varbase.
1.44 asau 1033:
1034: You can change default layout using command-line arguments. Run "./bootstrap
1035: --help" to get details.
1.1 dsieger 1036:
1037: Note
1038:
1039: The bootstrap installs a bmake tool. Use this bmake when building via pkgsrc.
1040: For examples in this guide, use bmake instead of "make".
1041:
1.44 asau 1042: Note
1043:
1044: It is possible to bootstrap multiple instances of pkgsrc using non-intersecting
1045: directories. Use bmake corresponding to the installation you're working with to
1046: build and install packages.
1047:
1.154 rillig 1048: Chapter 5. Using pkgsrc
1.1 dsieger 1049:
1050: Table of Contents
1051:
1.154 rillig 1052: 5.1. Using binary packages
1.1 dsieger 1053:
1.154 rillig 1054: 5.1.1. Finding binary packages
1055: 5.1.2. Installing binary packages
1056: 5.1.3. Deinstalling packages
1057: 5.1.4. Getting information about installed packages
1058: 5.1.5. Checking for security vulnerabilities in installed packages
1059: 5.1.6. Finding if newer versions of your installed packages are in pkgsrc
1060: 5.1.7. Other administrative functions
1061:
1062: 5.2. Building packages from source
1063:
1064: 5.2.1. Requirements
1065: 5.2.2. Fetching distfiles
1066: 5.2.3. How to build and install
1.1 dsieger 1067:
1068: Basically, there are two ways of using pkgsrc. The first is to only install the
1069: package tools and to use binary packages that someone else has prepared. This
1070: is the "pkg" in pkgsrc. The second way is to install the "src" of pkgsrc, too.
1071: Then you are able to build your own packages, and you can still use binary
1072: packages from someone else.
1073:
1.154 rillig 1074: 5.1. Using binary packages
1.1 dsieger 1075:
1.151 sevan 1076: On the cdn.NetBSD.org site and mirrors, there are collections of binary
1.9 rillig 1077: packages, ready to be installed. These binary packages have been built using
1078: the default settings for the directories, that is:
1079:
1080: * /usr/pkg for LOCALBASE, where most of the files are installed,
1081:
1082: * /usr/pkg/etc for configuration files,
1083:
1084: * /var for VARBASE, where those files are installed that may change after
1085: installation.
1086:
1087: If you cannot use these directories for whatever reasons (maybe because you're
1088: not root), you cannot use these binary packages, but have to build the packages
1.154 rillig 1089: yourself, which is explained in Section 4.2, "Bootstrapping pkgsrc".
1.1 dsieger 1090:
1.154 rillig 1091: 5.1.1. Finding binary packages
1.1 dsieger 1092:
1.5 weinem 1093: To install binary packages, you first need to know from where to get them. The
1094: first place where you should look is on the main pkgsrc FTP server in the
1095: directory /pub/pkgsrc/packages.
1096:
1097: This directory contains binary packages for multiple platforms. First, select
1098: your operating system. (Ignore the directories with version numbers attached to
1099: it, they just exist for legacy reasons.) Then, select your hardware
1100: architecture, and in the third step, the OS version and the "version" of
1.9 rillig 1101: pkgsrc.
1102:
1103: In this directory, you often find a file called bootstrap.tar.gz which contains
1104: the package management tools. If the file is missing, it is likely that your
1105: operating system already provides those tools. Download the file and extract it
1106: in the / directory. It will create the directories /usr/pkg (containing the
1.118 sevan 1107: tools for managing binary packages and the database of installed packages).
1.1 dsieger 1108:
1.154 rillig 1109: 5.1.2. Installing binary packages
1.1 dsieger 1110:
1.85 wiz 1111: In the directory from the last section, there is a subdirectory called All/,
1.9 rillig 1112: which contains all the binary packages that are available for the platform,
1113: excluding those that may not be distributed via FTP or CDROM (depending on
1.24 wiz 1114: which medium you are using).
1.9 rillig 1115:
1116: To install packages directly from an FTP or HTTP server, run the following
1117: commands in a Bourne-compatible shell (be sure to su to root first):
1118:
1119: # PATH="/usr/pkg/sbin:$PATH"
1.179 rillig 1120:
1121: # PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages"
1.169 rillig 1122: # PKG_PATH="$PKG_PATH/OPSYS/ARCH/VERSIONS/All/"
1.9 rillig 1123: # export PATH PKG_PATH
1124:
1125: Instead of URLs, you can also use local paths, for example if you are
1126: installing from a set of CDROMs, DVDs or an NFS-mounted repository. If you want
1127: to install packages from multiple sources, you can separate them by a semicolon
1128: in PKG_PATH.
1129:
1130: After these preparations, installing a package is very easy:
1131:
1.118 sevan 1132: # pkg_add libreoffice
1133: # pkg_add ap24-php71-*
1.1 dsieger 1134:
1135: Note that any prerequisite packages needed to run the package in question will
1136: be installed, too, assuming they are present where you install from.
1137:
1.25 wiz 1138: Adding packages might install vulnerable packages. Thus you should run
1.24 wiz 1139: pkg_admin audit regularly, especially after installing new packages, and verify
1140: that the vulnerabilities are acceptable for your configuration.
1.1 dsieger 1141:
1142: After you've installed packages, be sure to have /usr/pkg/bin and /usr/pkg/sbin
1143: in your PATH so you can actually start the just installed program.
1144:
1.154 rillig 1145: 5.1.3. Deinstalling packages
1.1 dsieger 1146:
1147: To deinstall a package, it does not matter whether it was installed from source
1148: code or from a binary package. The pkg_delete command does not know it anyway.
1149: To delete a package, you can just run pkg_delete package-name. The package name
1150: can be given with or without version number. Wildcards can also be used to
1151: deinstall a set of packages, for example *emacs*. Be sure to include them in
1152: quotes, so that the shell does not expand them before pkg_delete sees them.
1153:
1154: The -r option is very powerful: it removes all the packages that require the
1155: package in question and then removes the package itself. For example:
1156:
1157: # pkg_delete -r jpeg
1158:
1159:
1160: will remove jpeg and all the packages that used it; this allows upgrading the
1161: jpeg package.
1162:
1.154 rillig 1163: 5.1.4. Getting information about installed packages
1.1 dsieger 1164:
1165: The pkg_info shows information about installed packages or binary package
1166: files.
1167:
1.154 rillig 1168: 5.1.5. Checking for security vulnerabilities in installed packages
1.1 dsieger 1169:
1.164 leot 1170: The pkgsrc Security Team and Packages Groups maintain a list of known security
1171: vulnerabilities to packages which are (or have been) included in pkgsrc. The
1.179 rillig 1172: list is available from the NetBSD FTP site at http://ftp.NetBSD.org/pub/NetBSD/
1173: packages/vulns/pkg-vulnerabilities.
1.1 dsieger 1174:
1.23 jakllsch 1175: Through pkg_admin fetch-pkg-vulnerabilities, this list can be downloaded
1176: automatically, and a security audit of all packages installed on a system can
1177: take place.
1178:
1179: There are two components to auditing. The first step, pkg_admin
1180: fetch-pkg-vulnerabilities, is for downloading the list of vulnerabilities from
1181: the NetBSD FTP site. The second step, pkg_admin audit, checks to see if any of
1182: your installed packages are vulnerable. If a package is vulnerable, you will
1183: see output similar to the following:
1.1 dsieger 1184:
1185: Package samba-2.0.9 has a local-root-shell vulnerability, see
1.174 leot 1186: https://www.samba.org/samba/whatsnew/macroexploit.html
1.1 dsieger 1187:
1.23 jakllsch 1188: You may wish to have the vulnerabilities file downloaded daily so that it
1189: remains current. This may be done by adding an appropriate entry to the root
1190: users crontab(5) entry. For example the entry
1191:
1.121 sevan 1192: # Download vulnerabilities file
1.118 sevan 1193: 0 3 * * * /usr/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities >/dev/null 2>&1
1.121 sevan 1194: # Audit the installed packages and email results to root
1195: 9 3 * * * /usr/pkg/sbin/pkg_admin audit |mail -s "Installed package audit result" \
1196: root >/dev/null 2>&1
1.118 sevan 1197:
1198:
1199: will update the vulnerability list every day at 3AM, followed by an audit at
1200: 3:09AM. The result of the audit are then emailed to root. On NetBSD this may be
1201: accomplished instead by adding the following line to /etc/daily.conf:
1202:
1203: fetch_pkg_vulnerabilities=YES
1204:
1.23 jakllsch 1205:
1.118 sevan 1206: to fetch the vulnerability list from the daily security script. The system is
1207: set to audit the packages by default but can be set explicitly, if desired (not
1.123 wiz 1208: required), by adding the following line to /etc/security.conf:
1.23 jakllsch 1209:
1.118 sevan 1210: check_pkg_vulnerabilities=YES
1.23 jakllsch 1211:
1212:
1.118 sevan 1213: see daily.conf(5) and security.conf(5) for more details.
1.1 dsieger 1214:
1.154 rillig 1215: 5.1.6. Finding if newer versions of your installed packages are in pkgsrc
1.1 dsieger 1216:
1.12 weinem 1217: Install pkgtools/lintpkgsrc and run lintpkgsrc with the "-i" argument to check
1218: if your packages are up-to-date, e.g.
1.1 dsieger 1219:
1220: % lintpkgsrc -i
1221: ...
1222: Version mismatch: 'tcsh' 6.09.00 vs 6.10.00
1223:
1224:
1225: You can then use make update to update the package on your system and rebuild
1226: any dependencies.
1227:
1.154 rillig 1228: 5.1.7. Other administrative functions
1.1 dsieger 1229:
1230: The pkg_admin executes various administrative functions on the package system.
1231:
1.154 rillig 1232: 5.2. Building packages from source
1.1 dsieger 1233:
1234: After obtaining pkgsrc, the pkgsrc directory now contains a set of packages,
1.25 wiz 1235: organized into categories. You can browse the online index of packages, or run
1.1 dsieger 1236: make readme from the pkgsrc directory to build local README.html files for all
1237: packages, viewable with any web browser such as www/lynx or www/firefox.
1238:
1239: The default prefix for installed packages is /usr/pkg. If you wish to change
1240: this, you should do so by setting LOCALBASE in mk.conf. You should not try to
1241: use multiple different LOCALBASE definitions on the same system (inside a
1242: chroot is an exception).
1243:
1244: The rest of this chapter assumes that the package is already in pkgsrc. If it
1245: is not, see Part II, "The pkgsrc developer's guide" for instructions how to
1246: create your own packages.
1247:
1.154 rillig 1248: 5.2.1. Requirements
1.1 dsieger 1249:
1250: To build packages from source, you need a working C compiler. On NetBSD, you
1251: need to install the "comp" and the "text" distribution sets. If you want to
1252: build X11-related packages, the "xbase" and "xcomp" distribution sets are
1253: required, too.
1254:
1.154 rillig 1255: 5.2.2. Fetching distfiles
1.1 dsieger 1256:
1257: The first step for building a package is downloading the distfiles (i.e. the
1258: unmodified source). If they have not yet been downloaded, pkgsrc will fetch
1259: them automatically.
1260:
1261: If you have all files that you need in the distfiles directory, you don't need
1262: to connect. If the distfiles are on CD-ROM, you can mount the CD-ROM on /cdrom
1263: and add:
1264:
1265: DISTDIR=/cdrom/pkgsrc/distfiles
1266:
1267: to your mk.conf.
1268:
1269: By default a list of distribution sites will be randomly intermixed to prevent
1270: huge load on servers which holding popular packages (for example,
1271: SourceForge.net mirrors). Thus, every time when you need to fetch yet another
1272: distfile all the mirrors will be tried in new (random) order. You can turn this
1273: feature off by setting MASTER_SORT_RANDOM=NO (for PKG_DEVELOPERs it's already
1274: disabled).
1275:
1276: You can overwrite some of the major distribution sites to fit to sites that are
1277: close to your own. By setting one or two variables you can modify the order in
1278: which the master sites are accessed. MASTER_SORT contains a whitespace
1279: delimited list of domain suffixes. MASTER_SORT_REGEX is even more flexible, it
1280: contains a whitespace delimited list of regular expressions. It has higher
1281: priority than MASTER_SORT. Have a look at pkgsrc/mk/defaults/mk.conf to find
1282: some examples. This may save some of your bandwidth and time.
1283:
1284: You can change these settings either in your shell's environment, or, if you
1.4 rillig 1285: want to keep the settings, by editing the mk.conf file, and adding the
1.1 dsieger 1286: definitions there.
1287:
1.132 wiz 1288: If a package depends on many other packages (such as meta-pkgs/kde4), the build
1.1 dsieger 1289: process may alternate between periods of downloading source, and compiling. To
1290: ensure you have all the source downloaded initially you can run the command:
1291:
1292: % make fetch-list | sh
1293:
1294: which will output and run a set of shell commands to fetch the necessary files
1295: into the distfiles directory. You can also choose to download the files
1296: manually.
1297:
1.154 rillig 1298: 5.2.3. How to build and install
1.1 dsieger 1299:
1300: Once the software has downloaded, any patches will be applied, then it will be
1301: compiled for you. This may take some time depending on your computer, and how
1302: many other packages the software depends on and their compile time.
1303:
1304: Note
1305:
1306: If using bootstrap or pkgsrc on a non-NetBSD system, use the pkgsrc bmake
1307: command instead of "make" in the examples in this guide.
1308:
1309: For example, type
1310:
1311: % cd misc/figlet
1312: % make
1313:
1314:
1315: at the shell prompt to build the various components of the package.
1316:
1317: The next stage is to actually install the newly compiled program onto your
1318: system. Do this by entering:
1319:
1320: % make install
1321:
1322:
1323: while you are still in the directory for whatever package you are installing.
1324:
1325: Installing the package on your system may require you to be root. However,
1326: pkgsrc has a just-in-time-su feature, which allows you to only become root for
1327: the actual installation step.
1328:
1329: That's it, the software should now be installed and setup for use. You can now
1330: enter:
1331:
1332: % make clean
1333:
1334:
1335: to remove the compiled files in the work directory, as you shouldn't need them
1336: any more. If other packages were also added to your system (dependencies) to
1337: allow your program to compile, you can tidy these up also with the command:
1338:
1339: % make clean-depends
1340:
1341:
1342: Taking the figlet utility as an example, we can install it on our system by
1343: building as shown in Appendix B, Build logs.
1344:
1345: The program is installed under the default root of the packages tree - /usr/
1346: pkg. Should this not conform to your tastes, set the LOCALBASE variable in your
1347: environment, and it will use that value as the root of your packages tree. So,
1348: to use /usr/local, set LOCALBASE=/usr/local in your environment. Please note
1349: that you should use a directory which is dedicated to packages and not shared
1350: with other programs (i.e., do not try and use LOCALBASE=/usr). Also, you should
1351: not try to add any of your own files or directories (such as src/, obj/, or
1352: pkgsrc/) below the LOCALBASE tree. This is to prevent possible conflicts
1353: between programs and other files installed by the package system and whatever
1354: else may have been installed there.
1355:
1.4 rillig 1356: Some packages look in mk.conf to alter some configuration options at build
1.1 dsieger 1357: time. Have a look at pkgsrc/mk/defaults/mk.conf to get an overview of what will
1358: be set there by default. Environment variables such as LOCALBASE can be set in
1.4 rillig 1359: mk.conf to save having to remember to set them each time you want to use
1.1 dsieger 1360: pkgsrc.
1361:
1362: Occasionally, people want to "look under the covers" to see what is going on
1363: when a package is building or being installed. This may be for debugging
1364: purposes, or out of simple curiosity. A number of utility values have been
1365: added to help with this.
1366:
1367: 1. If you invoke the make(1) command with PKG_DEBUG_LEVEL=2, then a huge
1368: amount of information will be displayed. For example,
1369:
1370: make patch PKG_DEBUG_LEVEL=2
1371:
1.25 wiz 1372: will show all the commands that are invoked, up to and including the "patch
1373: " stage.
1.1 dsieger 1374:
1375: 2. If you want to know the value of a certain make(1) definition, then the
1376: VARNAME definition should be used, in conjunction with the show-var target.
1377: e.g. to show the expansion of the make(1) variable LOCALBASE:
1378:
1379: % make show-var VARNAME=LOCALBASE
1380: /usr/pkg
1381: %
1382:
1383:
1384: If you want to install a binary package that you've either created yourself
1385: (see next section), that you put into pkgsrc/packages manually or that is
1386: located on a remote FTP server, you can use the "bin-install" target. This
1387: target will install a binary package - if available - via pkg_add(1), else do a
1388: make package. The list of remote FTP sites searched is kept in the variable
1389: BINPKG_SITES, which defaults to ftp.NetBSD.org. Any flags that should be added
1390: to pkg_add(1) can be put into BIN_INSTALL_FLAGS. See pkgsrc/mk/defaults/mk.conf
1391: for more details.
1392:
1393: A final word of warning: If you set up a system that has a non-standard setting
1394: for LOCALBASE, be sure to set that before any packages are installed, as you
1395: cannot use several directories for the same purpose. Doing so will result in
1396: pkgsrc not being able to properly detect your installed packages, and fail
1397: miserably. Note also that precompiled binary packages are usually built with
1398: the default LOCALBASE of /usr/pkg, and that you should not install any if you
1399: use a non-standard LOCALBASE.
1400:
1.154 rillig 1401: Chapter 6. Configuring pkgsrc
1.1 dsieger 1402:
1403: Table of Contents
1404:
1.154 rillig 1405: 6.1. General configuration
1406: 6.2. Variables affecting the build process
1407: 6.3. Variables affecting the installation process
1408: 6.4. Selecting and configuring the compiler
1409:
1410: 6.4.1. Selecting the compiler
1411: 6.4.2. Additional flags to the compiler (CFLAGS)
1412: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 1413:
1.154 rillig 1414: 6.5. Developer/advanced settings
1415: 6.6. Selecting Build Options
1.1 dsieger 1416:
1417: The whole pkgsrc system is configured in a single file, usually called mk.conf.
1418: In which directory pkgsrc looks for that file depends on the installation. On
1419: NetBSD, when you use make(1) from the base system, it is in the directory /etc
1420: /. In all other cases the default location is ${PREFIX}/etc/, depending on
1421: where you told the bootstrap program to install the binary packages.
1422:
1423: The format of the configuration file is that of the usual BSD-style Makefiles.
1424: The whole pkgsrc configuration is done by setting variables in this file. Note
1425: that you can define all kinds of variables, and no special error checking (for
1.112 rillig 1426: example for spelling mistakes) takes place.
1.1 dsieger 1427:
1.154 rillig 1428: 6.1. General configuration
1.1 dsieger 1429:
1.112 rillig 1430: The following variables apply to all pkgsrc packages. A complete list of the
1431: variables that can be configured by the user is available in mk/defaults/
1432: mk.conf, together with some comments that describe each variable's intent.
1.1 dsieger 1433:
1434: * LOCALBASE: Where packages will be installed. The default is /usr/pkg. Do
1435: not mix binary packages with different LOCALBASEs!
1436:
1437: * CROSSBASE: Where "cross" category packages will be installed. The default
1438: is ${LOCALBASE}/cross.
1439:
1.84 wiz 1440: * X11BASE: Where X11 is installed on the system. The default is /usr/X11R7.
1.1 dsieger 1441:
1442: * DISTDIR: Where to store the downloaded copies of the original source
1443: distributions used for building pkgsrc packages. The default is $
1444: {PKGSRCDIR}/distfiles.
1445:
1446: * PKG_DBDIR: Where the database about installed packages is stored. The
1.118 sevan 1447: default is /usr/pkg/pkgdb.
1.1 dsieger 1448:
1449: * MASTER_SITE_OVERRIDE: If set, override the packages' MASTER_SITES with this
1450: value.
1451:
1452: * MASTER_SITE_BACKUP: Backup location(s) for distribution files and patch
1453: files if not found locally or in ${MASTER_SITES} or ${PATCH_SITES}
1.118 sevan 1454: respectively. The defaults is ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/$
1.1 dsieger 1455: {DIST_SUBDIR}/.
1456:
1457: * BINPKG_SITES: List of sites carrying binary pkgs. rel and arch are replaced
1458: with OS release ("2.0", etc.) and architecture ("mipsel", etc.).
1459:
1.23 jakllsch 1460: * ACCEPTABLE_LICENSES: List of acceptable licenses. License names are
1461: case-sensitive. Whenever you try to build a package whose license is not in
1462: this list, you will get an error message. If the license condition is
1463: simple enough, the error message will include specific instructions on how
1464: to change this variable.
1.1 dsieger 1465:
1.154 rillig 1466: 6.2. Variables affecting the build process
1.1 dsieger 1467:
1468: * PACKAGES: The top level directory for the binary packages. The default is $
1469: {PKGSRCDIR}/packages.
1470:
1471: * WRKOBJDIR: The top level directory where, if defined, the separate working
1472: directories will get created, and symbolically linked to from ${WRKDIR}
1473: (see below). This is useful for building packages on several architectures,
1474: then ${PKGSRCDIR} can be NFS-mounted while ${WRKOBJDIR} is local to every
1475: architecture. (It should be noted that PKGSRCDIR should not be set by the
1476: user ? it is an internal definition which refers to the root of the pkgsrc
1477: tree. It is possible to have many pkgsrc tree instances.)
1478:
1479: * LOCALPATCHES: Directory for local patches that aren't part of pkgsrc. See
1.154 rillig 1480: Section 13.3, "patches/*" for more information.
1.1 dsieger 1481:
1482: * PKGMAKECONF: Location of the mk.conf file used by a package's BSD-style
1483: Makefile. If this is not set, MAKECONF is set to /dev/null to avoid picking
1484: up settings used by builds in /usr/src.
1485:
1.154 rillig 1486: 6.3. Variables affecting the installation process
1.1 dsieger 1487:
1.143 maya 1488: * PKGSRC_KEEP_BIN_PKGSRC: By default, binary packages of built packages are
1.150 leot 1489: preserved in ${PACKAGES}/All. Setting this variable to "no" prevents this.
1.1 dsieger 1490:
1.107 jnemeth 1491: Packages have to support installation into a subdirectory of WRKDIR. This
1492: allows a package to be built, before the actual filesystem is touched. DESTDIR
1493: support exists in two variations:
1.4 rillig 1494:
1495: * Basic DESTDIR support means that the package installation and packaging is
1496: still run as root.
1497:
1498: * Full DESTDIR support can run the complete build, installation and packaging
1499: as normal user. Root privileges are only needed to add packages.
1500:
1501: With basic DESTDIR support, make clean needs to be run as root.
1502:
1.17 imil 1503: Considering the foo/bar package, DESTDIR full support can be tested using the
1504: following commands
1505:
1506: $ id
1507: uid=1000(myusername) gid=100(users) groups=100(users),0(wheel)
1508: $ mkdir $HOME/packages
1509: $ cd $PKGSRCDIR/foo/bar
1510:
1511: Verify DESTDIR full support, no root privileges should be needed
1512:
1.66 asau 1513: $ make stage-install
1.17 imil 1514:
1515: Create a package without root privileges
1516:
1.66 asau 1517: $ make PACKAGES=$HOME/packages package
1.17 imil 1518:
1519: For the following command, you must be able to gain root privileges using su(1)
1520:
1.66 asau 1521: $ make PACKAGES=$HOME/packages install
1.17 imil 1522:
1523: Then, as a simple user
1524:
1525: $ make clean
1526:
1.154 rillig 1527: 6.4. Selecting and configuring the compiler
1.4 rillig 1528:
1.154 rillig 1529: 6.4.1. Selecting the compiler
1.1 dsieger 1530:
1531: By default, pkgsrc will use GCC to build packages. This may be overridden by
1532: setting the following variables in /etc/mk.conf:
1533:
1534: PKGSRC_COMPILER:
1535:
1536: This is a list of values specifying the chain of compilers to invoke when
1537: building packages. Valid values are:
1538:
1.66 asau 1539: + ccc: Compaq C Compilers (Tru64)
1540:
1541: + ccache: compiler cache (chainable)
1542:
1543: + clang: Clang C and Objective-C compiler
1544:
1.42 asau 1545: + distcc: distributed C/C++ (chainable)
1.1 dsieger 1546:
1.66 asau 1547: + f2c: Fortran 77 to C compiler (chainable)
1548:
1549: + icc: Intel C++ Compiler (Linux)
1550:
1551: + ido: SGI IRIS Development Option cc (IRIX 5)
1.1 dsieger 1552:
1.42 asau 1553: + gcc: GNU C/C++ Compiler
1.1 dsieger 1554:
1.66 asau 1555: + hp: HP-UX C/aC++ compilers
1556:
1.42 asau 1557: + mipspro: Silicon Graphics, Inc. MIPSpro (n32/n64)
1.1 dsieger 1558:
1.66 asau 1559: + mipspro-ucode: Silicon Graphics, Inc. MIPSpro (o32)
1.1 dsieger 1560:
1.42 asau 1561: + sunpro: Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio
1.1 dsieger 1562:
1.118 sevan 1563: + xlc: IBM's XL C/C++ compiler suite
1.66 asau 1564:
1.1 dsieger 1565: The default is "gcc". You can use ccache and/or distcc with an appropriate
1566: PKGSRC_COMPILER setting, e.g. "ccache gcc". This variable should always be
1567: terminated with a value for a real compiler. Note that only one real
1568: compiler should be listed (e.g. "sunpro gcc" is not allowed).
1569:
1570: GCC_REQD:
1571:
1572: This specifies the minimum version of GCC to use when building packages. If
1573: the system GCC doesn't satisfy this requirement, then pkgsrc will build and
1574: install one of the GCC packages to use instead.
1575:
1.153 leot 1576: PYTHON_VERSION_DEFAULT:
1.114 maya 1577:
1578: Specifies which version of python to use when several options are
1579: available.
1580:
1581: PKGSRC_FORTRAN:
1582:
1.176 gutterid 1583: Specifies the Fortran compiler to use. The default is gfortran.
1.114 maya 1584:
1585: GFORTRAN_VERSION:
1586:
1587: If PKGSRC_FORTRAN= gfortran is used, this option specifies which version to
1588: use.
1589:
1.154 rillig 1590: 6.4.2. Additional flags to the compiler (CFLAGS)
1.1 dsieger 1591:
1592: If you wish to set the CFLAGS variable, please make sure to use the += operator
1593: instead of the = operator:
1594:
1595: CFLAGS+= -your -flags
1596:
1597: Using CFLAGS= (i.e. without the "+") may lead to problems with packages that
1.16 jnemeth 1598: need to add their own flags. You may want to take a look at the devel/cpuflags
1.24 wiz 1599: package if you're interested in optimization specifically for the current CPU.
1.1 dsieger 1600:
1.154 rillig 1601: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 1602:
1603: If you want to pass flags to the linker, both in the configure step and the
1604: build step, you can do this in two ways. Either set LDFLAGS or LIBS. The
1605: difference between the two is that LIBS will be appended to the command line,
1606: while LDFLAGS come earlier. LDFLAGS is pre-loaded with rpath settings for ELF
1607: machines depending on the setting of USE_IMAKE or the inclusion of mk/
1608: x11.buildlink3.mk. As with CFLAGS, if you do not wish to override these
1609: settings, use the += operator:
1610:
1611: LDFLAGS+= -your -linkerflags
1612:
1.154 rillig 1613: 6.5. Developer/advanced settings
1.1 dsieger 1614:
1615: * PKG_DEVELOPER: Run some sanity checks that package developers want:
1616:
1.42 asau 1617: + make sure patches apply with zero fuzz
1.1 dsieger 1618:
1.42 asau 1619: + run check-shlibs to see that all binaries will find their shared libs.
1.1 dsieger 1620:
1621: * PKG_DEBUG_LEVEL: The level of debugging output which is displayed whilst
1622: making and installing the package. The default value for this is 0, which
1623: will not display the commands as they are executed (normal, default, quiet
1624: operation); the value 1 will display all shell commands before their
1625: invocation, and the value 2 will display both the shell commands before
1.112 rillig 1626: their invocation, as well as their actual execution progress with set -x.
1.1 dsieger 1627:
1.154 rillig 1628: 6.6. Selecting Build Options
1.1 dsieger 1629:
1630: Some packages have build time options, usually to select between different
1631: dependencies, enable optional support for big dependencies or enable
1632: experimental features.
1633:
1634: To see which options, if any, a package supports, and which options are
1635: mutually exclusive, run make show-options, for example:
1636:
1637: The following options are supported by this package:
1638: ssl Enable SSL support.
1639: Exactly one of the following gecko options is required:
1640: firefox Use firefox as gecko rendering engine.
1641: mozilla Use mozilla as gecko rendering engine.
1642: At most one of the following database options may be selected:
1643: mysql Enable support for MySQL database.
1644: pgsql Enable support for PostgreSQL database.
1645:
1646: These options are enabled by default: firefox
1647: These options are currently enabled: mozilla ssl
1648:
1.4 rillig 1649: The following variables can be defined in mk.conf to select which options to
1650: enable for a package: PKG_DEFAULT_OPTIONS, which can be used to select or
1.1 dsieger 1651: disable options for all packages that support them, and PKG_OPTIONS.pkgbase,
1652: which can be used to select or disable options specifically for package pkgbase
1653: . Options listed in these variables are selected, options preceded by "-" are
1654: disabled. A few examples:
1655:
1.4 rillig 1656: $ grep "PKG.*OPTION" mk.conf
1.1 dsieger 1657: PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
1658: PKG_OPTIONS.kdebase= debug -sasl
1659: PKG_OPTIONS.apache= suexec
1660:
1.11 rillig 1661: It is important to note that options that were specifically suggested by the
1.19 snj 1662: package maintainer must be explicitly removed if you do not wish to include the
1663: option. If you are unsure you can view the current state with make show-options
1664: .
1.11 rillig 1665:
1.1 dsieger 1666: The following settings are consulted in the order given, and the last setting
1667: that selects or disables an option is used:
1668:
1669: 1. the default options as suggested by the package maintainer
1670:
1671: 2. the options implied by the settings of legacy variables (see below)
1672:
1673: 3. PKG_DEFAULT_OPTIONS
1674:
1675: 4. PKG_OPTIONS.pkgbase
1676:
1677: For groups of mutually exclusive options, the last option selected is used, all
1678: others are automatically disabled. If an option of the group is explicitly
1679: disabled, the previously selected option, if any, is used. It is an error if no
1680: option from a required group of options is selected, and building the package
1681: will fail.
1682:
1683: Before the options framework was introduced, build options were selected by
1.4 rillig 1684: setting a variable (often named USE_FOO) in mk.conf for each option. To ease
1685: transition to the options framework for the user, these legacy variables are
1686: converted to the appropriate options setting (PKG_OPTIONS.pkgbase)
1687: automatically. A warning is issued to prompt the user to update mk.conf to use
1688: the options framework directly. Support for the legacy variables will be
1.1 dsieger 1689: removed eventually.
1690:
1.154 rillig 1691: Chapter 7. Creating binary packages
1.1 dsieger 1692:
1693: Table of Contents
1694:
1.154 rillig 1695: 7.1. Building a single binary package
1696: 7.2. Settings for creation of binary packages
1.1 dsieger 1697:
1.154 rillig 1698: 7.1. Building a single binary package
1.1 dsieger 1699:
1700: Once you have built and installed a package, you can create a binary package
1701: which can be installed on another system with pkg_add(1). This saves having to
1702: build the same package on a group of hosts and wasting CPU time. It also
1703: provides a simple means for others to install your package, should you
1704: distribute it.
1705:
1706: To create a binary package, change into the appropriate directory in pkgsrc,
1707: and run make package:
1708:
1.112 rillig 1709: $ cd misc/figlet
1710: $ make package
1.1 dsieger 1711:
1712: This will build and install your package (if not already done), and then build
1713: a binary package from what was installed. You can then use the pkg_* tools to
1714: manipulate it. Binary packages are created by default in /usr/pkgsrc/packages,
1715: in the form of a gzipped tar file. See Section B.2, "Packaging figlet" for a
1716: continuation of the above misc/figlet example.
1717:
1.154 rillig 1718: See Chapter 23, Submitting and Committing for information on how to submit such
1.1 dsieger 1719: a binary package.
1720:
1.154 rillig 1721: 7.2. Settings for creation of binary packages
1.1 dsieger 1722:
1.154 rillig 1723: See Section 19.17, "Other helpful targets".
1.6 rillig 1724:
1.154 rillig 1725: Chapter 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 1726:
1727: Table of Contents
1728:
1.154 rillig 1729: 8.1. Preparations
1.180 rillig 1730: 8.2. Running a bulk build
1.6 rillig 1731:
1.154 rillig 1732: 8.2.1. Configuration
1.6 rillig 1733:
1.154 rillig 1734: 8.3. Requirements of a full bulk build
1.178 rillig 1735: 8.4. Bulk build variants
1736:
1.179 rillig 1737: 8.4.1. Detect unknown configure options
1738: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 1739: 8.4.3. Force compiler options only in the build phase
1740: 8.4.4. Use custom directories
1741: 8.4.5. Turn warnings into errors
1742: 8.4.6. Reject packages for which pkglint reports errors
1743: 8.4.7. Reject packages that contain forbidden strings
1744: 8.4.8. Reject packages whose self-test fails
1745: 8.4.9. Reject packages that use undefined shell variables
1746: 8.4.10. Turn off verbose logging
1.6 rillig 1747:
1.178 rillig 1748: 8.5. Creating a multiple CD-ROM packages collection
1749:
1750: 8.5.1. Example of cdpack
1.6 rillig 1751:
1.175 gutterid 1752: For a number of reasons, you may want to build binary packages for a large
1753: selected set of packages in pkgsrc, or even for all pkgsrc packages. For
1.71 wiz 1754: instance, when you have multiple machines that should run the same software, it
1755: is wasted time if they all build their packages themselves from source. Or you
1756: may want to build a list of packages you want and check them before deploying
1.175 gutterid 1757: onto production systems. There is a way of getting a set of binary packages:
1758: the bulk build system, or pbulk ("p" stands for "parallel"). This chapter
1759: describes how to set it up.
1.71 wiz 1760:
1.154 rillig 1761: 8.1. Preparations
1.71 wiz 1762:
1763: First of all, you have to decide whether you build all packages or a limited
1764: set of them. Full bulk builds usually consume a lot more resources, both space
1.175 gutterid 1765: and time, than builds for some practical sets of packages. A number of
1766: particularly heavy packages exist that are not actually interesting to a wide
1767: audience. (The approximate resource consumption for a full bulk build is given
1768: in section Section 8.3, "Requirements of a full bulk build".) For limited bulk
1769: builds you need to make a list of packages you want to build. Note that all
1770: their dependencies will be built, so you don't need to track them manually.
1.71 wiz 1771:
1772: During bulk builds various packages are installed and deinstalled in /usr/pkg
1773: (or whatever LOCALBASE is), so make sure that you don't need any package during
1.112 rillig 1774: the builds. Essentially, you should provide a fresh system, either a chroot
1.71 wiz 1775: environment or something even more restrictive, depending on what the operating
1776: system provides, or dedicate the whole physical machine. As a useful side
1777: effect this makes sure that bulk builds cannot break anything in your system.
1778: There have been numerous cases where certain packages tried to install files
1779: outside the LOCALBASE or wanted to edit some files in /etc.
1.6 rillig 1780:
1.180 rillig 1781: 8.2. Running a bulk build
1.6 rillig 1782:
1.180 rillig 1783: Running a bulk build works roughly as follows:
1.15 rillig 1784:
1785: * First, build the pbulk infrastructure in a fresh pkgsrc location.
1786:
1787: * Then, build each of the packages from a clean installation directory using
1788: the infrastructure.
1789:
1.154 rillig 1790: 8.2.1. Configuration
1.6 rillig 1791:
1.112 rillig 1792: To simplify configuration, we provide the helper script mk/pbulk/pbulk.sh.
1.6 rillig 1793:
1.68 asau 1794: In order to use it, prepare a clear system (real one, chroot environment, jail,
1795: zone, virtual machine). Configure network access to fetch distribution files.
1.112 rillig 1796: Create a user with name "pbulk".
1.68 asau 1797:
1798: Fetch and extract pkgsrc. Use a command like one of these:
1799:
1.151 sevan 1800: # (cd /usr && ftp -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1801: # (cd /usr && fetch -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1.72 wiz 1802: # (cd /usr && cvs -Q -z3 -d anoncvs@anoncvs.NetBSD.org:/cvsroot get -P pkgsrc)
1.68 asau 1803:
1804: Or any other way that fits (e.g., curl, wget).
1805:
1806: Deploy and configure pbulk tools, e.g.:
1807:
1.118 sevan 1808: # sh pbulk.sh -n # use native make, no bootstrap kit needed (for use on NetBSD)
1.68 asau 1809: # sh pbulk.sh -n -c mk.conf.frag # native, apply settings from given mk.conf fragment
1810: # sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build
1811:
1812: Note
1813:
1814: mk.conf.frag is a fragment of mk.conf that contains settings you want to apply
1815: to packages you build. For instance,
1816:
1.112 rillig 1817: PKG_DEVELOPER= yes # perform more checks
1818: X11_TYPE= modular # use pkgsrc X11
1819: SKIP_LICENSE_CHECK= yes # accept all licences (useful
1820: # when building all packages)
1.68 asau 1821:
1822: If configured for limited list, replace the list in /usr/pbulk/etc/pbulk.list
1.112 rillig 1823: with your list of packages, one per line without empty lines or comments. E.g.:
1.68 asau 1824:
1825: www/firefox
1826: mail/thunderbird
1827: misc/libreoffice4
1828:
1.69 asau 1829: At this point you can also review configuration in /usr/pbulk/etc and make
1830: final amendments, if wanted.
1831:
1.68 asau 1832: Start it:
1833:
1834: # /usr/pbulk/bin/bulkbuild
1835:
1836: After it finishes, you'll have /mnt filled with distribution files, binary
1837: packages, and reports, plain text summary in /mnt/bulklog/meta/report.txt
1838:
1839: Note
1840:
1841: The pbulk.sh script does not cover all possible use cases. While being ready to
1842: run, it serves as a good starting point to understand and build more complex
1843: setups. The script is kept small enough for better understanding.
1844:
1845: Note
1846:
1847: The pbulk.sh script supports running unprivileged bulk build and helps
1848: configuring distributed bulk builds.
1.15 rillig 1849:
1.154 rillig 1850: 8.3. Requirements of a full bulk build
1.71 wiz 1851:
1852: A complete bulk build requires lots of disk space. Some of the disk space can
1853: be read-only, some other must be writable. Some can be on remote filesystems
1854: (such as NFS) and some should be local. Some can be temporary filesystems,
1855: others must survive a sudden reboot.
1856:
1857: * 40 GB for the distfiles (read-write, remote, temporary)
1858:
1859: * 30 GB for the binary packages (read-write, remote, permanent)
1860:
1861: * 1 GB for the pkgsrc tree (read-only, remote, permanent)
1862:
1863: * 5 GB for LOCALBASE (read-write, local, temporary)
1864:
1865: * 10 GB for the log files (read-write, remote, permanent)
1866:
1867: * 5 GB for temporary files (read-write, local, temporary)
1868:
1.178 rillig 1869: 8.4. Bulk build variants
1870:
1871: To ensure that pkgsrc packages work in different configurations, it makes sense
1872: to run non-default bulk builds from time to time. This section lists some ideas
1873: for bulk builds that intentionally let packages fail if they don't follow the
1874: pkgsrc style.
1875:
1.179 rillig 1876: 8.4.1. Detect unknown configure options
1.178 rillig 1877:
1878: Add the following line to mk.conf.
1879:
1880: GNU_CONFIGURE_STRICT= yes
1881:
1882: When a package fails this additional check, the most common cause is that the
1883: configure option was valid for an older version of the package but does not
1884: apply anymore. In that case, just remove it.
1885:
1.179 rillig 1886: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.178 rillig 1887:
1888: The job of a compiler is not restricted to producing executable code, most
1.179 rillig 1889: compilers also detect typical programming mistakes. The pkgsrc compiler
1890: wrappers make it easy to force compiler options when the package is built. This
1891: can be used to find typical bugs across all packages that are in pkgsrc. By
1892: reporting these bugs upstream, the packages will be more reliable with the next
1893: updates.
1.178 rillig 1894:
1.179 rillig 1895: Add some of the following lines to mk.conf:
1.178 rillig 1896:
1897: CFLAGS+= -Werror=char-subscripts
1.179 rillig 1898: CFLAGS+= -Werror=implicit-function-declaration
1.178 rillig 1899:
1.179 rillig 1900: When a package fails to build using these stricter compiler options, document
1901: the circumstances in which the compiler produced the error message. This
1902: includes:
1.178 rillig 1903:
1904: * The platform (MACHINE_PLATFORM)
1905:
1906: * The source file
1907:
1908: * An excerpt of the code. GCC and Clang already do this as part of the
1909: diagnostic.
1910:
1.179 rillig 1911: * The exact error message from the compiler.
1.178 rillig 1912:
1.179 rillig 1913: If a package produces these error messages, but the package is fine, record
1914: this in your local mk.conf, like this, to skip this check in the next builds:
1.178 rillig 1915:
1.179 rillig 1916: .if ${PKGPATH} == category/package
1.178 rillig 1917: # Version ${VERSION} failed on ${MACHINE_PLATFORM}:
1918: # error message
1919: # code
1.179 rillig 1920: # Reason why the code does not need to be fixed.
1.178 rillig 1921: BUILDLINK_TRANSFORM+= rm:-Werror=char-subscripts
1.179 rillig 1922: .endif
1.178 rillig 1923:
1924: If the error messages from the compiler are valid and the code needs to be
1.179 rillig 1925: fixed, prepare a local patch (see LOCALPATCHES) and report the bug to the
1926: upstream authors of the package, providing them with the information you
1927: collected above.
1.178 rillig 1928:
1.179 rillig 1929: Patches that are not essential for the package to work should only be reported
1930: upstream but not committed to pkgsrc, to make future updates easier.
1931:
1.181 rillig 1932: 8.4.3. Force compiler options only in the build phase
1933:
1934: When adding custom compiler flags via CFLAGS, these apply to all phases of the
1935: package build process. Especially in the configure phase, adding -Werror leads
1936: to wrong decisions. The GNU configure scripts feed many small test programs to
1937: the C compiler to see whether certain headers are available, functions are
1938: defined in a library and programs can be run. In many cases these programs
1939: would not survive a strict compiler run with -Wall -Wextra -Werror.
1940:
1941: The pkgsrc infrastructure is flexible enough to support compiler options being
1942: added between the configure and build phases. It's a little more complicated
1943: than the other examples in this section but still easy enough.
1944:
1945: The basic idea is to use the pkgsrc compiler wrapper to inject the desired
1946: compiler options. The compiler wrapper's original task is to hide unwanted
1947: directories of include files and to normalize compiler options. It does this by
1948: wrapping the compiler command and rewriting the command line. To see this in
1949: action, run bmake patch in a package directory and examine the work/.cwrappers/
1950: config directory. It contains individual configurations for the C compiler and
1951: the related tools. The plan is to find a hook between the configure and build
1952: phases, and to modify these configuration files at that point.
1953:
1954: To find this hook, have a look at mk/build/build.mk, which contains among
1955: others the pre-build-checks-hook. The word checks doesn't quite fit, but the
1956: pre-build-hook sounds good enough.
1957:
1958: The code to be included in mk.conf is:
1959:
1960: # Just a few example options.
1961: BUILD_ONLY_CFLAGS= -Wall -Werror -O2 -DTEMPDIR='"/tmp"'
1962:
1963: .if ${BUILD_ONLY_CFLAGS:U:M*}
1964: pre-build-checks-hook: add-build-only-cflags
1965:
1966: add-build-only-cflags: .PHONY
1967: ${RUN} cd ${CWRAPPERS_CONFIG_DIR}; \
1968: ${TEST} ! -f ${.TARGET} || exit 0; \
1969: for flag in ${BUILD_ONLY_CFLAGS}; do \
1970: ${ECHO} "append=$$flag" >> cc; \
1971: done; \
1972: > ${.TARGET}
1973: .endif
1974:
1975: (When editing the mk.conf, make sure that the commands of the
1976: add-build-only-cflags target are indented with a tab, not with spaces.)
1977:
1978: The condition in the .if statement contains the :U modifier to prevent parse
1979: errors if the variable should be undefined, possibly because it is only defined
1980: for a subset of the packages. The :M* modifier ensures that there is at least
1981: one compiler option, to prevent a syntax error in the shell parser.
1982:
1983: The code around the ${.TARGET} variable ensures that the additional compiler
1984: options are only appended once, even if bmake build is run multiple times. To
1985: do this, it creates a marker file.
1986:
1987: To verify that this setup works, run bmake configure in a package directory. Up
1988: to now, everything works as usual. Examine the directory work/.cwrappers/config
1989: to see that the compiler options from BUILD_ONLY_CFLAGS are not yet added to
1990: the file cc. Examine the tail of the work/.work.log file to see that the normal
1991: compiler options are used.
1992:
1993: Now run bmake build. This will append the options to the file cc and will
1994: create the marker file in the same directory. After that, the build starts as
1995: usual, but with the added compiler options. Examine the tail of the file work
1996: /.work.log to see that the lines starting with [*] don't contain the compiler
1997: options, but the corresponding lines starting with <.> do end with these
1998: options.
1999:
2000: Building packages using this setup variant and fixing the resulting bugs is the
2001: same as in Section 8.4.2, "Detect classes of bugs by forcing compiler warnings"
2002: .
2003:
2004: 8.4.4. Use custom directories
1.178 rillig 2005:
2006: Some directories like PREFIX, VARBASE, PKG_SYSCONFDIR, PKGMANDIR, PKG_INFODIR
2007: can be configured in pkgsrc. Set these to arbitrary paths during bootstrap or
2008: afterwards in mk.conf.
2009:
2010: PREFIX= /a-random-uuid
2011: PKG_SYSCONFDIR= /a-random-uuid
2012: VARBASE= /a-random-uuid
2013: PKGMANDIR= a-random-uuid
2014: PKG_INFODIR= a-random-uuid
2015:
1.181 rillig 2016: 8.4.5. Turn warnings into errors
1.178 rillig 2017:
2018: When building a package, warnings are typically ignored since they just flow by
2019: and do not cause the build to fail immediately. To find these warnings,
2020: redefine them to errors in mk.conf.
2021:
2022: DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)"
2023: WARNING_MSG= ${FAIL_MSG} "(was warning)"
2024:
2025: (There are many more classes of warnings in pkgsrc, and most of them can be
2026: redefined with a simple definition like above.
2027:
1.179 rillig 2028: If a package suggests to add USE_TOOLS+=perl to the package Makefile, research
1.178 rillig 2029: whether the package actually needs Perl. If it does, add USE_TOOLS+=perl to the
2030: package Makefile, and if it doesn't, add TOOLS_BROKEN+=perl.
2031:
1.181 rillig 2032: 8.4.6. Reject packages for which pkglint reports errors
1.178 rillig 2033:
2034: Using pkglint as part of the regular build process is mostly a waste of time.
2035: If you want to fix some of the warnings, just run pkglint recursively on the
2036: whole pkgsrc tree. This will take a few minutes (up to 10), which is much
2037: faster than a complete bulk build.
2038:
1.181 rillig 2039: 8.4.7. Reject packages that contain forbidden strings
1.178 rillig 2040:
2041: To ensure that the binary packages don't contain references to the build
2042: directory, there is already CHECK_WRKREF. If that variable includes the item
2043: extra, it is possible to define additional patterns that must not appear in any
2044: installed file. This is specified in mk.conf.
2045:
2046: CHECK_WRKREF= extra
2047: CHECK_WRKREF_EXTRA_DIRS+= /usr/local
2048: CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg
2049: CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@
2050:
2051: The above patterns will probably generate many false positives, therefore the
2052: results need to be taken with a grain of salt.
2053:
1.181 rillig 2054: 8.4.8. Reject packages whose self-test fails
1.178 rillig 2055:
2056: To run the test suites that come with each package, add this line to mk.conf.
2057:
2058: PKGSRC_RUN_TEST= yes
2059:
2060: Be prepared that even the most basic packages fail this test. When doing a bulk
2061: build with this, it will often abort in the early phase where the packages are
2062: scanned for their dependencies since there are cyclic dependencies. There is
2063: still a lot to do in this area.
2064:
1.181 rillig 2065: 8.4.9. Reject packages that use undefined shell variables
1.178 rillig 2066:
2067: To catch typos in the shell snippets from the Makefile fragments, add the -u
2068: flag to most of the commands by adding this line to mk.conf.
2069:
2070: RUN= @set -eu;
2071:
1.181 rillig 2072: After that, ensure that none of the bulk build log files (even those for
2073: successfully built packages) contains the string parameter not set or whatever
2074: error message the command sh -ceu '$undefined' outputs.
2075:
1.178 rillig 2076: See mk/misc/common.mk for the existing definition.
2077:
1.181 rillig 2078: 8.4.10. Turn off verbose logging
1.178 rillig 2079:
2080: The build logs of a package are often quite long. This allows error messages or
2081: other interesting details to hide between the noise. To make the actual error
2082: message stand out more, add these lines to mk.conf.
2083:
2084: GNU_CONFIGURE_QUIET= yes
2085: MAKE_FLAGS+= -s
2086:
2087: The -s option works for both GNU Make and BSD Make. On exotic platforms with
2088: their own make, it may be a little different.
2089:
2090: 8.5. Creating a multiple CD-ROM packages collection
1.1 dsieger 2091:
2092: After your pkgsrc bulk-build has completed, you may wish to create a CD-ROM set
2093: of the resulting binary packages to assist in installing packages on other
2094: machines. The pkgtools/cdpack package provides a simple tool for creating the
2095: ISO 9660 images. cdpack arranges the packages on the CD-ROMs in a way that
2096: keeps all the dependencies for a given package on the same CD as that package.
2097:
1.178 rillig 2098: 8.5.1. Example of cdpack
1.1 dsieger 2099:
2100: Complete documentation for cdpack is found in the cdpack(1) man page. The
2101: following short example assumes that the binary packages are left in /usr/
2102: pkgsrc/packages/All and that sufficient disk space exists in /u2 to hold the
2103: ISO 9660 images.
2104:
2105: # mkdir /u2/images
2106: # pkg_add /usr/pkgsrc/packages/All/cdpack
2107: # cdpack /usr/pkgsrc/packages/All /u2/images
2108:
2109:
2110: If you wish to include a common set of files (COPYRIGHT, README, etc.) on each
2111: CD in the collection, then you need to create a directory which contains these
1.175 gutterid 2112: files, e.g.:
1.1 dsieger 2113:
2114: # mkdir /tmp/common
2115: # echo "This is a README" > /tmp/common/README
2116: # echo "Another file" > /tmp/common/COPYING
2117: # mkdir /tmp/common/bin
2118: # echo "#!/bin/sh" > /tmp/common/bin/myscript
2119: # echo "echo Hello world" >> /tmp/common/bin/myscript
2120: # chmod 755 /tmp/common/bin/myscript
2121:
2122:
2123: Now create the images:
2124:
2125: # cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images
2126:
2127: Each image will contain README, COPYING, and bin/myscript in their root
2128: directories.
2129:
1.154 rillig 2130: Chapter 9. Directory layout of the installed files
1.1 dsieger 2131:
2132: Table of Contents
2133:
1.154 rillig 2134: 9.1. File system layout in ${LOCALBASE}
2135: 9.2. File system layout in ${VARBASE}
1.1 dsieger 2136:
2137: The files that are installed by pkgsrc are organized in a way that is similar
2138: to what you find in the /usr directory of the base system. But some details are
2139: different. This is because pkgsrc initially came from FreeBSD and had adopted
2140: its file system hierarchy. Later it was largely influenced by NetBSD. But no
2141: matter which operating system you are using pkgsrc with, you can expect the
2142: same layout for pkgsrc.
2143:
2144: There are mainly four root directories for pkgsrc, which are all configurable
2145: in the bootstrap/bootstrap script. When pkgsrc has been installed as root, the
2146: default locations are:
2147:
2148: LOCALBASE= /usr/pkg
2149: PKG_SYSCONFBASE= /usr/pkg/etc
2150: VARBASE= /var
1.119 sevan 2151: PKG_DBDIR= /usr/pkg/pkgdb
1.1 dsieger 2152:
2153: In unprivileged mode (when pkgsrc has been installed as any other user), the
2154: default locations are:
2155:
2156: LOCALBASE= ${HOME}/pkg
2157: PKG_SYSCONFBASE= ${HOME}/pkg/etc
2158: VARBASE= ${HOME}/pkg/var
1.119 sevan 2159: PKG_DBDIR= ${HOME}/pkg/pkgdb
1.1 dsieger 2160:
2161: What these four directories are for, and what they look like is explained
2162: below.
2163:
1.25 wiz 2164: * LOCALBASE corresponds to the /usr directory in the base system. It is the "
2165: main" directory where the files are installed and contains the well-known
1.1 dsieger 2166: subdirectories like bin, include, lib, share and sbin.
2167:
2168: * VARBASE corresponds to /var in the base system. Some programs (especially
2169: games, network daemons) need write access to it during normal operation.
2170:
2171: * PKG_SYSCONFDIR corresponds to /etc in the base system. It contains
2172: configuration files of the packages, as well as pkgsrc's mk.conf itself.
2173:
1.154 rillig 2174: 9.1. File system layout in ${LOCALBASE}
1.1 dsieger 2175:
2176: The following directories exist in a typical pkgsrc installation in $
2177: {LOCALBASE}.
2178:
2179: bin
2180:
2181: Contains executable programs that are intended to be directly used by the
2182: end user.
2183:
2184: emul
2185:
2186: Contains files for the emulation layers of various other operating systems,
2187: especially for NetBSD.
2188:
2189: etc (the usual location of ${PKG_SYSCONFDIR})
2190:
2191: Contains the configuration files.
2192:
2193: include
2194:
2195: Contains headers for the C and C++ programming languages.
2196:
2197: info
2198:
2199: Contains GNU info files of various packages.
2200:
2201: lib
2202:
2203: Contains shared and static libraries.
2204:
2205: libdata
2206:
2207: Contains data files that don't change after installation. Other data files
2208: belong into ${VARBASE}.
2209:
2210: libexec
2211:
2212: Contains programs that are not intended to be used by end users, such as
2213: helper programs or network daemons.
2214:
2215: libexec/cgi-bin
2216:
2217: Contains programs that are intended to be executed as CGI scripts by a web
2218: server.
2219:
2220: man (the usual value of ${PKGMANDIR})
2221:
2222: Contains brief documentation in form of manual pages.
2223:
2224: sbin
2225:
2226: Contains programs that are intended to be used only by the super-user.
2227:
2228: share
2229:
2230: Contains platform-independent data files that don't change after
2231: installation.
2232:
2233: share/doc
2234:
2235: Contains documentation files provided by the packages.
2236:
2237: share/examples
2238:
2239: Contains example files provided by the packages. Among others, the original
2240: configuration files are saved here and copied to ${PKG_SYSCONFDIR} during
2241: installation.
2242:
2243: share/examples/rc.d
2244:
2245: Contains the original files for rc.d scripts.
2246:
2247: var (the usual location of ${VARBASE})
2248:
2249: Contains files that may be modified after installation.
2250:
1.154 rillig 2251: 9.2. File system layout in ${VARBASE}
1.1 dsieger 2252:
2253: db/pkg (the usual location of ${PKG_DBDIR})
2254:
2255: Contains information about the currently installed packages.
2256:
2257: games
2258:
2259: Contains highscore files.
2260:
2261: log
2262:
2263: Contains log files.
2264:
2265: run
2266:
2267: Contains informational files about daemons that are currently running.
2268:
1.154 rillig 2269: Chapter 10. Frequently Asked Questions
1.1 dsieger 2270:
2271: Table of Contents
2272:
1.154 rillig 2273: 10.1. Are there any mailing lists for pkg-related discussion?
2274: 10.2. Utilities for package management (pkgtools)
2275: 10.3. How to use pkgsrc as non-root
2276: 10.4. How to resume transfers when fetching distfiles?
2277: 10.5. How can I install/use modular X.org from pkgsrc?
2278: 10.6. How to fetch files from behind a firewall
2279: 10.7. How to fetch files from HTTPS sites
2280: 10.8. How do I tell make fetch to do passive FTP?
2281: 10.9. How to fetch all distfiles at once
2282: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
2283: 10.11. What does "Could not find bsd.own.mk" mean?
2284: 10.12. Using 'sudo' with pkgsrc
2285: 10.13. How do I change the location of configuration files?
2286: 10.14. Automated security checks
2287: 10.15. Why do some packages ignore my CFLAGS?
2288: 10.16. A package does not build. What shall I do?
2289: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.24 wiz 2290: conflicts" mean?
1.1 dsieger 2291:
2292: This section contains hints, tips & tricks on special things in pkgsrc that we
2293: didn't find a better place for in the previous chapters, and it contains items
2294: for both pkgsrc users and developers.
2295:
1.154 rillig 2296: 10.1. Are there any mailing lists for pkg-related discussion?
1.1 dsieger 2297:
2298: The following mailing lists may be of interest to pkgsrc users:
2299:
2300: * pkgsrc-users: This is a general purpose list for most issues regarding
2301: pkgsrc, regardless of platform, e.g. soliciting user help for pkgsrc
2302: configuration, unexpected build failures, using particular packages,
2303: upgrading pkgsrc installations, questions regarding the pkgsrc release
2304: branches, etc. General announcements or proposals for changes that impact
2305: the pkgsrc user community, e.g. major infrastructure changes, new features,
2306: package removals, etc., may also be posted.
2307:
2308: * pkgsrc-bulk: A list where the results of pkgsrc bulk builds are sent and
2309: discussed.
2310:
2311: * pkgsrc-changes: This list is for those who are interested in getting a
2312: commit message for every change committed to pkgsrc. It is also available
2313: in digest form, meaning one daily message containing all commit messages
2314: for changes to the package source tree in that 24 hour period.
2315:
2316: To subscribe, do:
2317:
2318: % echo subscribe listname | mail majordomo@NetBSD.org
2319:
1.174 leot 2320: Archives for all these mailing lists are available from https://
1.1 dsieger 2321: mail-index.NetBSD.org/.
2322:
1.154 rillig 2323: 10.2. Utilities for package management (pkgtools)
1.1 dsieger 2324:
2325: The directory pkgsrc/pkgtools contains a number of useful utilities for both
2326: users and developers of pkgsrc. This section attempts only to make the reader
1.121 sevan 2327: aware of some of the utilities and when they might be useful, and not to
2328: duplicate the documentation that comes with each package.
1.1 dsieger 2329:
2330: Utilities used by pkgsrc (automatically installed when needed):
2331:
2332: * pkgtools/x11-links: Symlinks for use by buildlink.
2333:
2334: OS tool augmentation (automatically installed when needed):
2335:
1.121 sevan 2336: * pkgtools/digest: Calculates various kinds of checksums (including SHA3).
1.1 dsieger 2337:
2338: * pkgtools/libnbcompat: Compatibility library for pkgsrc tools.
2339:
2340: * pkgtools/mtree: Installed on non-BSD systems due to lack of native mtree.
2341:
2342: * pkgtools/pkg_install: Up-to-date replacement for /usr/sbin/pkg_install, or
2343: for use on operating systems where pkg_install is not present.
2344:
2345: Utilities used by pkgsrc (not automatically installed):
2346:
2347: * pkgtools/pkg_tarup: Create a binary package from an already-installed
2348: package. Used by make replace to save the old package.
2349:
2350: * pkgtools/dfdisk: Adds extra functionality to pkgsrc, allowing it to fetch
2351: distfiles from multiple locations. It currently supports the following
2352: methods: multiple CD-ROMs and network FTP/HTTP connections.
2353:
2354: * devel/cpuflags: Determine the best compiler flags to optimise code for your
1.24 wiz 2355: current CPU and compiler.
1.1 dsieger 2356:
2357: Utilities for keeping track of installed packages, being up to date, etc:
2358:
1.65 wiz 2359: * pkgtools/pkgin: A package update tool similar to apt(1). Download, install,
2360: and upgrade binary packages easily.
2361:
1.1 dsieger 2362: * pkgtools/pkg_chk: Reports on packages whose installed versions do not match
2363: the latest pkgsrc entries.
2364:
2365: * pkgtools/pkgdep: Makes dependency graphs of packages, to aid in choosing a
2366: strategy for updating.
2367:
2368: * pkgtools/pkgdepgraph: Makes graphs from the output of pkgtools/pkgdep (uses
2369: graphviz).
2370:
1.12 weinem 2371: * pkgtools/pkglint: The pkglint(1) program checks a pkgsrc entry for errors.
2372:
2373: * pkgtools/lintpkgsrc: The lintpkgsrc(1) program does various checks on the
2374: complete pkgsrc system.
1.1 dsieger 2375:
2376: * pkgtools/pkgsurvey: Report what packages you have installed.
2377:
2378: Utilities for people maintaining or creating individual packages:
2379:
2380: * pkgtools/pkgdiff: Automate making and maintaining patches for a package
2381: (includes pkgdiff, pkgvi, mkpatches, etc.).
2382:
1.65 wiz 2383: * pkgtools/url2pkg: Aids in converting to pkgsrc.
1.1 dsieger 2384:
2385: Utilities for people maintaining pkgsrc (or: more obscure pkg utilities)
2386:
2387: * pkgtools/pkg_comp: Build packages in a chrooted area.
2388:
2389: * pkgtools/libkver: Spoof kernel version for chrooted cross builds.
2390:
1.154 rillig 2391: 10.3. How to use pkgsrc as non-root
1.1 dsieger 2392:
1.108 rillig 2393: To install packages from source as a non-root user, download pkgsrc as
1.154 rillig 2394: described in Chapter 3, Where to get pkgsrc and how to keep it up-to-date, cd
1.108 rillig 2395: into that directory and run the command ./bootstrap/bootstrap --unprivileged.
2396:
2397: This will install the binary part of pkgsrc to ~/pkg and put the pkgsrc
2398: configuration mk.conf into ~/pkg/etc.
2399:
2400: For more details, see mk/unprivileged.mk.
1.1 dsieger 2401:
1.154 rillig 2402: 10.4. How to resume transfers when fetching distfiles?
1.1 dsieger 2403:
2404: By default, resuming transfers in pkgsrc is disabled, but you can enable this
1.4 rillig 2405: feature by adding the option PKG_RESUME_TRANSFERS=YES into mk.conf. If, during
2406: a fetch step, an incomplete distfile is found, pkgsrc will try to resume it.
1.1 dsieger 2407:
1.61 wiz 2408: You can also use a different program than the platform default program by
2409: changing the FETCH_USING variable. You can specify the program by using of ftp,
2410: fetch, wget or curl. Alternatively, fetching can be disabled by using the value
2411: manual. A value of custom disables the system defaults and dependency tracking
2412: for the fetch program. In that case you have to provide FETCH_CMD,
2413: FETCH_BEFORE_ARGS, FETCH_RESUME_ARGS, FETCH_OUTPUT_ARGS, FETCH_AFTER_ARGS.
1.1 dsieger 2414:
1.16 jnemeth 2415: For example, if you want to use wget to download, you'll have to use something
2416: like:
1.1 dsieger 2417:
1.16 jnemeth 2418: FETCH_USING= wget
1.1 dsieger 2419:
1.154 rillig 2420: 10.5. How can I install/use modular X.org from pkgsrc?
1.1 dsieger 2421:
1.4 rillig 2422: If you want to use modular X.org from pkgsrc instead of your system's own X11
2423: (/usr/X11R6, /usr/openwin, ...) you will have to add the following line into
1.1 dsieger 2424: mk.conf:
2425:
1.4 rillig 2426: X11_TYPE=modular
1.1 dsieger 2427:
1.154 rillig 2428: 10.6. How to fetch files from behind a firewall
1.1 dsieger 2429:
2430: If you are sitting behind a firewall which does not allow direct connections to
2431: Internet hosts (i.e. non-NAT), you may specify the relevant proxy hosts. This
2432: is done using an environment variable in the form of a URL, e.g. in Amdahl, the
2433: machine "orpheus.amdahl.com" is one of the firewalls, and it uses port 80 as
2434: the proxy port number. So the proxy environment variables are:
2435:
2436: ftp_proxy=ftp://orpheus.amdahl.com:80/
2437: http_proxy=http://orpheus.amdahl.com:80/
2438:
1.154 rillig 2439: 10.7. How to fetch files from HTTPS sites
1.65 wiz 2440:
2441: Some fetch tools are not prepared to support HTTPS by default (for example, the
2442: one in NetBSD 6.0), or the one installed by the pkgsrc bootstrap (to avoid an
2443: openssl dependency that low in the dependency graph).
2444:
2445: Usually you won't notice, because distribution files are mirrored weekly to "
2446: ftp.NetBSD.org", but that might not be often enough if you are following
2447: pkgsrc-current. In that case, set FETCH_USING in your mk.conf file to "curl" or
2448: "wget", which are both compiled with HTTPS support by default. Of course, these
2449: tools need to be installed before you can use them this way.
2450:
1.154 rillig 2451: 10.8. How do I tell make fetch to do passive FTP?
1.1 dsieger 2452:
2453: This depends on which utility is used to retrieve distfiles. From bsd.pkg.mk,
2454: FETCH_CMD is assigned the first available command from the following list:
2455:
2456: * ${LOCALBASE}/bin/ftp
2457:
2458: * /usr/bin/ftp
2459:
2460: On a default NetBSD installation, this will be /usr/bin/ftp, which
2461: automatically tries passive connections first, and falls back to active
2462: connections if the server refuses to do passive. For the other tools, add the
1.4 rillig 2463: following to your mk.conf file: PASSIVE_FETCH=1.
1.1 dsieger 2464:
2465: Having that option present will prevent /usr/bin/ftp from falling back to
2466: active transfers.
2467:
1.154 rillig 2468: 10.9. How to fetch all distfiles at once
1.1 dsieger 2469:
2470: You would like to download all the distfiles in a single batch from work or
2471: university, where you can't run a make fetch. There is an archive of distfiles
2472: on ftp.NetBSD.org, but downloading the entire directory may not be appropriate.
2473:
2474: The answer here is to do a make fetch-list in /usr/pkgsrc or one of its
2475: subdirectories, carry the resulting list to your machine at work/school and use
2476: it there. If you don't have a NetBSD-compatible ftp(1) (like tnftp) at work,
2477: don't forget to set FETCH_CMD to something that fetches a URL:
2478:
2479: At home:
2480:
2481: % cd /usr/pkgsrc
2482: % make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh
2483: % scp /tmp/fetch.sh work:/tmp
2484:
2485: At work:
2486:
2487: % sh /tmp/fetch.sh
2488:
2489: then tar up /tmp/distfiles and take it home.
2490:
2491: If you have a machine running NetBSD, and you want to get all distfiles (even
2492: ones that aren't for your machine architecture), you can do so by using the
2493: above-mentioned make fetch-list approach, or fetch the distfiles directly by
2494: running:
2495:
2496: % make mirror-distfiles
2497:
2498: If you even decide to ignore NO_{SRC,BIN}_ON_{FTP,CDROM}, then you can get
2499: everything by running:
2500:
2501: % make fetch NO_SKIP=yes
2502:
1.154 rillig 2503: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
1.1 dsieger 2504:
2505: When compiling the pkgtools/pkg_install package, you get the error from make
2506: that it doesn't know how to make /usr/share/tmac/tmac.andoc? This indicates
2507: that you don't have installed the "text" set (nroff, ...) from the NetBSD base
2508: distribution on your machine. It is recommended to do that to format man pages.
2509:
2510: In the case of the pkgtools/pkg_install package, you can get away with setting
1.4 rillig 2511: NOMAN=YES either in the environment or in mk.conf.
1.1 dsieger 2512:
1.154 rillig 2513: 10.11. What does "Could not find bsd.own.mk" mean?
1.1 dsieger 2514:
2515: You didn't install the compiler set, comp.tgz, when you installed your NetBSD
2516: machine. Please get and install it, by extracting it in /:
2517:
2518: # cd /
2519: # tar --unlink -zxvpf .../comp.tgz
2520:
2521: comp.tgz is part of every NetBSD release. Get the one that corresponds to your
2522: release (determine via uname -r).
2523:
1.154 rillig 2524: 10.12. Using 'sudo' with pkgsrc
1.1 dsieger 2525:
2526: When installing packages as non-root user and using the just-in-time su(1)
2527: feature of pkgsrc, it can become annoying to type in the root password for each
2528: required package installed. To avoid this, the sudo package can be used, which
2529: does password caching over a limited time. To use it, install sudo (either as
1.4 rillig 2530: binary package or from security/sudo) and then put the following into your
2531: mk.conf, somewhere after the definition of the LOCALBASE variable:
1.1 dsieger 2532:
2533: .if exists(${LOCALBASE}/bin/sudo)
2534: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
2535: .endif
2536:
1.154 rillig 2537: 10.13. How do I change the location of configuration files?
1.1 dsieger 2538:
2539: As the system administrator, you can choose where configuration files are
2540: installed. The default settings make all these files go into ${PREFIX}/etc or
2541: some of its subdirectories; this may be suboptimal depending on your
2542: expectations (e.g., a read-only, NFS-exported PREFIX with a need of per-machine
2543: configuration of the provided packages).
2544:
2545: In order to change the defaults, you can modify the PKG_SYSCONFBASE variable
1.4 rillig 2546: (in mk.conf) to point to your preferred configuration directory; some common
2547: examples include /etc or /etc/pkg.
1.1 dsieger 2548:
2549: Furthermore, you can change this value on a per-package basis by setting the
2550: PKG_SYSCONFDIR.${PKG_SYSCONFVAR} variable. PKG_SYSCONFVAR's value usually
2551: matches the name of the package you would like to modify, that is, the contents
2552: of PKGBASE.
2553:
2554: Note that after changing these settings, you must rebuild and reinstall any
2555: affected packages.
2556:
1.154 rillig 2557: 10.14. Automated security checks
1.1 dsieger 2558:
2559: Please be aware that there can often be bugs in third-party software, and some
2560: of these bugs can leave a machine vulnerable to exploitation by attackers. In
2561: an effort to lessen the exposure, the NetBSD packages team maintains a database
2562: of known-exploits to packages which have at one time been included in pkgsrc.
2563: The database can be downloaded automatically, and a security audit of all
1.14 jmcneill 2564: packages installed on a system can take place. To do this, refer to the
2565: following two tools (installed as part of the pkgtools/pkg_install package):
1.1 dsieger 2566:
1.21 snj 2567: 1. pkg_admin fetch-pkg-vulnerabilities, an easy way to download a list of the
2568: security vulnerabilities information. This list is kept up to date by the
1.26 spz 2569: pkgsrc security team, and is distributed from the NetBSD ftp server:
1.1 dsieger 2570:
1.177 leot 2571: https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities
1.1 dsieger 2572:
1.21 snj 2573: 2. pkg_admin audit, an easy way to audit the current machine, checking each
1.24 wiz 2574: known vulnerability. If a vulnerable package is installed, it will be shown
2575: by output to stdout, including a description of the type of vulnerability,
2576: and a URL containing more information.
1.1 dsieger 2577:
1.154 rillig 2578: Use of these tools is strongly recommended! See Section 5.1.5, "Checking for
1.121 sevan 2579: security vulnerabilities in installed packages" for instructions on how to
2580: automate checking and reporting.
2581:
2582: If this database is installed, pkgsrc builds will use it to perform a security
2583: check before building any package.
1.1 dsieger 2584:
1.154 rillig 2585: 10.15. Why do some packages ignore my CFLAGS?
1.1 dsieger 2586:
2587: When you add your own preferences to the CFLAGS variable in your mk.conf, these
2588: flags are passed in environment variables to the ./configure scripts and to
2589: make(1). Some package authors ignore the CFLAGS from the environment variable
2590: by overriding them in the Makefiles of their package.
2591:
2592: Currently there is no solution to this problem. If you really need the package
2593: to use your CFLAGS you should run make patch in the package directory and then
2594: inspect any Makefile and Makefile.in for whether they define CFLAGS explicitly.
2595: Usually you can remove these lines. But be aware that some "smart" programmers
2596: write so bad code that it only works for the specific combination of CFLAGS
2597: they have chosen.
2598:
1.172 rillig 2599: To find out where the CFLAGS are ignored, add the following lines to mk.conf:
2600:
2601: CPPFLAGS+= -Dpkgsrc___CPPFLAGS
2602: CFLAGS+= -Dpkgsrc___CFLAGS
2603: CXXFLAGS+= -Dpkgsrc___CXXFLAGS
2604:
2605: Then run bmake show-all-configure show-all-build to see whether the above flags
2606: are passed to the actual build commands in general.
2607:
2608: To find out whether the flags are passed to individual compiler commands, have
2609: a look at the file work/.work.log. In most cases, the flags from the original
2610: command lines (the lines starting with [*]) are passed unmodified to the actual
2611: compiler (the lines starting with <.>). If the flag is missing from the actual
2612: compiler command, it must have been removed by the pkgsrc compiler wrappers.
2613:
1.154 rillig 2614: 10.16. A package does not build. What shall I do?
1.1 dsieger 2615:
2616: 1. Make sure that your copy of pkgsrc is consistent. A case that occurs often
2617: is that people only update pkgsrc in parts, because of performance reasons.
2618: Since pkgsrc is one large system, not a collection of many small systems,
2619: there are sometimes changes that only work when the whole pkgsrc tree is
2620: updated.
2621:
1.25 wiz 2622: 2. Make sure that you don't have any CVS conflicts. Search for "<<<<<<" or "
2623: >>>>>>" in all your pkgsrc files.
1.1 dsieger 2624:
1.25 wiz 2625: 3. Make sure that you don't have old copies of the packages extracted. Run
1.1 dsieger 2626: make clean clean-depends to verify this.
2627:
1.108 rillig 2628: 4. If you are a package developer who wants to invest some work, have a look
1.154 rillig 2629: at Chapter 21, Making your package work.
1.108 rillig 2630:
2631: 5. If the problem still exists, write a mail to the pkgsrc-users mailing list.
1.1 dsieger 2632:
1.154 rillig 2633: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.1 dsieger 2634: conflicts" mean?
2635:
2636: You have modified a file from pkgsrc, and someone else has modified that same
2637: file afterwards in the CVS repository. Both changes are in the same region of
2638: the file, so when you updated pkgsrc, the cvs command marked the conflicting
2639: changes in the file. Because of these markers, the file is no longer a valid
2640: Makefile.
2641:
2642: Have a look at that file, and if you don't need your local changes anymore, you
2643: can remove that file and run cvs -q update -dP in that directory to download
2644: the current version.
2645:
2646: Part II. The pkgsrc developer's guide
2647:
2648: This part of the book deals with creating and modifying packages. It starts
2649: with a "HOWTO"-like guide on creating a new package. The remaining chapters are
2650: more like a reference manual for pkgsrc.
2651:
2652: Table of Contents
2653:
1.154 rillig 2654: 11. Getting help
2655: 12. Creating a new pkgsrc package from scratch
1.1 dsieger 2656:
1.154 rillig 2657: 12.1. Common types of packages
1.1 dsieger 2658:
1.154 rillig 2659: 12.1.1. Perl modules
2660: 12.1.2. Python modules and programs
1.160 brook 2661: 12.1.3. R packages
2662: 12.1.4. TeXlive packages
1.1 dsieger 2663:
1.154 rillig 2664: 12.2. Examples
1.1 dsieger 2665:
1.154 rillig 2666: 12.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 2667:
1.154 rillig 2668: 13. Package components - files, directories and contents
1.1 dsieger 2669:
1.154 rillig 2670: 13.1. Makefile
2671: 13.2. distinfo
2672: 13.3. patches/*
1.1 dsieger 2673:
1.154 rillig 2674: 13.3.1. Structure of a single patch file
2675: 13.3.2. Creating patch files
2676: 13.3.3. Sources where the patch files come from
2677: 13.3.4. Patching guidelines
2678: 13.3.5. Feedback to the author
1.1 dsieger 2679:
1.154 rillig 2680: 13.4. Other mandatory files
2681: 13.5. Optional files
1.1 dsieger 2682:
1.154 rillig 2683: 13.5.1. Files affecting the binary package
2684: 13.5.2. Files affecting the build process
2685: 13.5.3. Files affecting nothing at all
1.1 dsieger 2686:
1.154 rillig 2687: 13.6. work*
2688: 13.7. files/*
1.1 dsieger 2689:
1.154 rillig 2690: 14. Programming in Makefiles
1.1 dsieger 2691:
1.154 rillig 2692: 14.1. Caveats
2693: 14.2. Makefile variables
1.1 dsieger 2694:
1.154 rillig 2695: 14.2.1. Naming conventions
1.1 dsieger 2696:
1.154 rillig 2697: 14.3. Code snippets
1.1 dsieger 2698:
1.154 rillig 2699: 14.3.1. Adding things to a list
2700: 14.3.2. Echoing a string exactly as-is
2701: 14.3.3. Passing CFLAGS to GNU configure scripts
2702: 14.3.4. Handling possibly empty variables
1.1 dsieger 2703:
1.154 rillig 2704: 15. PLIST issues
1.1 dsieger 2705:
1.154 rillig 2706: 15.1. RCS ID
2707: 15.2. Semi-automatic PLIST generation
2708: 15.3. Tweaking output of make print-PLIST
2709: 15.4. Variable substitution in PLIST
2710: 15.5. Man page compression
2711: 15.6. Changing PLIST source with PLIST_SRC
2712: 15.7. Platform-specific and differing PLISTs
2713: 15.8. Build-specific PLISTs
2714: 15.9. Sharing directories between packages
1.1 dsieger 2715:
1.154 rillig 2716: 16. Buildlink methodology
1.1 dsieger 2717:
1.154 rillig 2718: 16.1. Converting packages to use buildlink3
2719: 16.2. Writing buildlink3.mk files
1.1 dsieger 2720:
1.154 rillig 2721: 16.2.1. Anatomy of a buildlink3.mk file
2722: 16.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.
1.27 wiz 2723: pkg in buildlink3.mk files
1.1 dsieger 2724:
1.154 rillig 2725: 16.3. Writing builtin.mk files
1.1 dsieger 2726:
1.154 rillig 2727: 16.3.1. Anatomy of a builtin.mk file
2728: 16.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 2729:
1.154 rillig 2730: 17. The pkginstall framework
1.1 dsieger 2731:
1.154 rillig 2732: 17.1. Files and directories outside the installation prefix
1.1 dsieger 2733:
1.154 rillig 2734: 17.1.1. Directory manipulation
2735: 17.1.2. File manipulation
1.1 dsieger 2736:
1.154 rillig 2737: 17.2. Configuration files
1.1 dsieger 2738:
1.154 rillig 2739: 17.2.1. How PKG_SYSCONFDIR is set
2740: 17.2.2. Telling the software where configuration files are
2741: 17.2.3. Patching installations
2742: 17.2.4. Disabling handling of configuration files
1.1 dsieger 2743:
1.154 rillig 2744: 17.3. System startup scripts
1.1 dsieger 2745:
1.154 rillig 2746: 17.3.1. Disabling handling of system startup scripts
1.1 dsieger 2747:
1.154 rillig 2748: 17.4. System users and groups
2749: 17.5. System shells
1.1 dsieger 2750:
1.154 rillig 2751: 17.5.1. Disabling shell registration
1.1 dsieger 2752:
1.154 rillig 2753: 17.6. Fonts
1.1 dsieger 2754:
1.154 rillig 2755: 17.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 2756:
1.154 rillig 2757: 18. Options handling
1.1 dsieger 2758:
1.154 rillig 2759: 18.1. Global default options
2760: 18.2. Converting packages to use bsd.options.mk
2761: 18.3. Option Names
2762: 18.4. Determining the options of dependencies
1.1 dsieger 2763:
1.154 rillig 2764: 19. The build process
1.1 dsieger 2765:
1.154 rillig 2766: 19.1. Introduction
2767: 19.2. Program location
2768: 19.3. Directories used during the build process
2769: 19.4. Running a phase
2770: 19.5. The fetch phase
1.1 dsieger 2771:
1.154 rillig 2772: 19.5.1. What to fetch and where to get it from
2773: 19.5.2. How are the files fetched?
1.1 dsieger 2774:
1.154 rillig 2775: 19.6. The checksum phase
2776: 19.7. The extract phase
2777: 19.8. The patch phase
2778: 19.9. The tools phase
2779: 19.10. The wrapper phase
2780: 19.11. The configure phase
2781: 19.12. The build phase
2782: 19.13. The test phase
2783: 19.14. The install phase
2784: 19.15. The package phase
2785: 19.16. Cleaning up
2786: 19.17. Other helpful targets
1.1 dsieger 2787:
1.154 rillig 2788: 20. Tools needed for building or running
1.1 dsieger 2789:
1.154 rillig 2790: 20.1. Tools for pkgsrc builds
2791: 20.2. Tools needed by packages
2792: 20.3. Tools provided by platforms
1.1 dsieger 2793:
1.154 rillig 2794: 21. Making your package work
1.1 dsieger 2795:
1.154 rillig 2796: 21.1. General operation
1.1 dsieger 2797:
1.154 rillig 2798: 21.1.1. How to pull in user-settable variables from mk.conf
2799: 21.1.2. User interaction
2800: 21.1.3. Handling licenses
2801: 21.1.4. Restricted packages
2802: 21.1.5. Handling dependencies
2803: 21.1.6. Handling conflicts with other packages
2804: 21.1.7. Packages that cannot or should not be built
2805: 21.1.8. Packages which should not be deleted, once installed
2806: 21.1.9. Handling packages with security problems
2807: 21.1.10. How to handle incrementing versions when fixing an existing
1.1 dsieger 2808: package
1.154 rillig 2809: 21.1.11. Substituting variable text in the package files (the SUBST
1.1 dsieger 2810: framework)
2811:
1.154 rillig 2812: 21.2. The fetch phase
1.1 dsieger 2813:
1.154 rillig 2814: 21.2.1. Packages whose distfiles aren't available for plain downloading
2815: 21.2.2. How to handle modified distfiles with the 'old' name
2816: 21.2.3. Packages hosted on github.com
2817:
2818: 21.3. The configure phase
2819:
2820: 21.3.1. Shared libraries - libtool
2821: 21.3.2. Using libtool on GNU packages that already support libtool
2822: 21.3.3. GNU Autoconf/Automake
2823:
2824: 21.4. Programming languages
2825:
2826: 21.4.1. C, C++, and Fortran
2827: 21.4.2. Java
2828: 21.4.3. Packages containing perl scripts
2829: 21.4.4. Packages containing shell scripts
2830: 21.4.5. Other programming languages
2831:
2832: 21.5. The build phase
2833:
2834: 21.5.1. Compiling C and C++ code conditionally
2835: 21.5.2. How to handle compiler bugs
1.172 rillig 2836: 21.5.3. No such file or directory
2837: 21.5.4. Undefined reference to "..."
2838: 21.5.5. Running out of memory
1.154 rillig 2839:
2840: 21.6. The install phase
2841:
2842: 21.6.1. Creating needed directories
2843: 21.6.2. Where to install documentation
2844: 21.6.3. Installing highscore files
2845: 21.6.4. Adding DESTDIR support to packages
2846: 21.6.5. Packages with hardcoded paths to other interpreters
2847: 21.6.6. Packages installing perl modules
2848: 21.6.7. Packages installing info files
2849: 21.6.8. Packages installing man pages
2850: 21.6.9. Packages installing GConf data files
2851: 21.6.10. Packages installing scrollkeeper/rarian data files
2852: 21.6.11. Packages installing X11 fonts
2853: 21.6.12. Packages installing GTK2 modules
2854: 21.6.13. Packages installing SGML or XML data
2855: 21.6.14. Packages installing extensions to the MIME database
2856: 21.6.15. Packages using intltool
2857: 21.6.16. Packages installing startup scripts
2858: 21.6.17. Packages installing TeX modules
2859: 21.6.18. Packages supporting running binaries in emulation
2860: 21.6.19. Packages installing hicolor theme icons
2861: 21.6.20. Packages installing desktop files
2862:
2863: 21.7. Marking packages as having problems
2864:
2865: 22. Debugging
2866: 23. Submitting and Committing
2867:
2868: 23.1. Submitting binary packages
2869: 23.2. Submitting source packages (for non-NetBSD-developers)
2870: 23.3. General notes when adding, updating, or removing packages
2871: 23.4. Commit Messages
2872: 23.5. Committing: Adding a package to CVS
2873: 23.6. Updating a package to a newer version
2874: 23.7. Renaming a package in pkgsrc
2875: 23.8. Moving a package in pkgsrc
2876:
2877: 24. Frequently Asked Questions
2878: 25. GNOME packaging and porting
2879:
2880: 25.1. Meta packages
2881: 25.2. Packaging a GNOME application
2882: 25.3. Updating GNOME to a newer version
2883: 25.4. Patching guidelines
2884:
2885: Chapter 11. Getting help
2886:
2887: To get help when developing pkgsrc, the definitive source is this document, the
2888: pkgsrc guide. If you don't find anything here, there are alternatives:
2889:
2890: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
2891: Run bmake help topic=? to get help for any topic, such as a variable name
2892: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
2893: like strcasecmp or any other topic.
2894:
2895: The available help topics are listed in Appendix D, Help topics.
2896:
1.163 rillig 2897: * To see the value of a single variable, run bmake show-var VARNAME=X.
2898:
2899: * To see the values of the most common variables, run bmake show-all. These
2900: variables are grouped by topic. To see the variables for a single topic,
2901: run bmake show-all-topic, for example bmake show-all-fetch.
2902:
1.154 rillig 2903: * The tech-pkg mailing list, to which you can subscribe and then ask your
2904: questions.
2905:
2906: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
2907: a specialized chat program such as XChat. Pick any user name and join the
2908: channel #pkgsrc.
1.1 dsieger 2909:
1.154 rillig 2910: Chapter 12. Creating a new pkgsrc package from scratch
1.1 dsieger 2911:
2912: Table of Contents
2913:
1.154 rillig 2914: 12.1. Common types of packages
1.1 dsieger 2915:
1.154 rillig 2916: 12.1.1. Perl modules
2917: 12.1.2. Python modules and programs
1.160 brook 2918: 12.1.3. R packages
2919: 12.1.4. TeXlive packages
1.1 dsieger 2920:
1.154 rillig 2921: 12.2. Examples
1.1 dsieger 2922:
1.154 rillig 2923: 12.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 2924:
2925: When you find a package that is not yet in pkgsrc, you most likely have a URL
2926: from where you can download the source code. Starting with this URL, creating a
2927: package involves only a few steps.
2928:
2929: 1. First, install the packages pkgtools/url2pkg and pkgtools/pkglint.
2930:
2931: 2. Then, choose one of the top-level directories as the category in which you
2932: want to place your package. You can also create a directory of your own
2933: (maybe called local). In that category directory, create another directory
2934: for your package and change into it.
2935:
2936: 3. Run the program url2pkg, which will ask you for a URL. Enter the URL of the
2937: distribution file (in most cases a .tar.gz file) and watch how the basic
2938: ingredients of your package are created automatically. The distribution
2939: file is extracted automatically to fill in some details in the Makefile
2940: that would otherwise have to be done manually.
2941:
2942: 4. Examine the extracted files to determine the dependencies of your package.
2943: Ideally, this is mentioned in some README file, but things may differ. For
2944: each of these dependencies, look where it exists in pkgsrc, and if there is
2945: a file called buildlink3.mk in that directory, add a line to your package
2946: Makefile which includes that file just before the last line. If the
1.26 spz 2947: buildlink3.mk file does not exist, it must be created first. The
2948: buildlink3.mk file makes sure that the package's include files and
2949: libraries are provided.
2950:
2951: If you just need binaries from a package, add a DEPENDS line to the
2952: Makefile, which specifies the version of the dependency and where it can be
2953: found in pkgsrc. This line should be placed in the third paragraph. If the
1.1 dsieger 2954: dependency is only needed for building the package, but not when using it,
1.156 leot 2955: use TOOL_DEPENDS or BUILD_DEPENDS instead of DEPENDS. The difference
2956: between TOOL_DEPENDS and BUILD_DEPENDS occurs when cross-compiling:
2957: TOOL_DEPENDS are native packages, i.e. packages for the architecture where
2958: the package is built; BUILD_DEPENDS are target packages, i.e. packages for
1.175 gutterid 2959: the architecture for which the package is built. There is also
2960: TEST_DEPENDS, which is used to specify a dependency used only for testing
2961: the resulting package built, using the upstream project's included test
2962: suite. Your package may then look like this:
1.1 dsieger 2963:
2964: [...]
2965:
1.156 leot 2966: TOOL_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt
1.1 dsieger 2967: DEPENDS+= screen-[0-9]*:../../misc/screen
2968: DEPENDS+= screen>=4.0:../../misc/screen
2969:
2970: [...]
2971:
2972: .include "../../category/package/buildlink3.mk"
2973: .include "../../devel/glib2/buildlink3.mk"
2974: .include "../../mk/bsd.pkg.mk"
2975:
2976: 5. Run pkglint to see what things still need to be done to make your package a
2977: "good" one. If you don't know what pkglint's warnings want to tell you, try
2978: pkglint --explain or pkglint -e, which outputs additional explanations.
2979:
2980: 6. In many cases the package is not yet ready to build. You can find
1.154 rillig 2981: instructions for the most common cases in the next section, Section 12.1,
1.1 dsieger 2982: "Common types of packages". After you have followed the instructions over
2983: there, you can hopefully continue here.
2984:
2985: 7. Run bmake clean to clean the working directory from the extracted files.
2986: Besides these files, a lot of cache files and other system information has
2987: been saved in the working directory, which may become wrong after you
2988: edited the Makefile.
2989:
2990: 8. Now, run bmake to build the package. For the various things that can go
1.154 rillig 2991: wrong in this phase, consult Chapter 21, Making your package work.
1.1 dsieger 2992:
1.25 wiz 2993: 9. When the package builds fine, the next step is to install the package. Run
1.1 dsieger 2994: bmake install and hope that everything works.
2995:
2996: 10. Up to now, the file PLIST, which contains a list of the files that are
2997: installed by the package, is nearly empty. Run bmake print-PLIST >PLIST to
2998: generate a probably correct list. Check the file using your preferred text
2999: editor to see if the list of files looks plausible.
3000:
3001: 11. Run pkglint again to see if the generated PLIST contains garbage or not.
3002:
3003: 12. When you ran bmake install, the package has been registered in the database
3004: of installed files, but with an empty list of files. To fix this, run bmake
3005: deinstall and bmake install again. Now the package is registered with the
3006: list of files from PLIST.
3007:
3008: 13. Run bmake package to create a binary package from the set of installed
3009: files.
3010:
1.154 rillig 3011: 12.1. Common types of packages
1.1 dsieger 3012:
1.154 rillig 3013: 12.1.1. Perl modules
1.1 dsieger 3014:
3015: Simple Perl modules are handled automatically by url2pkg, including
3016: dependencies.
3017:
1.154 rillig 3018: 12.1.2. Python modules and programs
1.17 imil 3019:
3020: Python modules and programs packages are easily created using a set of
3021: predefined variables.
3022:
1.63 wiz 3023: If some Python versions are not supported by the software, set the
3024: PYTHON_VERSIONS_INCOMPATIBLE variable to the Python versions that are not
3025: supported, e.g.
1.17 imil 3026:
1.93 sevan 3027: PYTHON_VERSIONS_INCOMPATIBLE= 27
1.17 imil 3028:
1.103 wiz 3029: If the packaged software is a Python module, include one of ../../lang/python/
3030: egg.mk, ../../lang/python/distutils.mk, or ../../lang/python/extension.mk.
3031:
3032: Most Python packages use either "distutils" or easy-setup/setuptools ("eggs").
1.175 gutterid 3033: If the packaged software is using setuptools, you only need to include "../../
1.103 wiz 3034: lang/python/egg.mk". Otherwise, if the software uses "distutils", include "..
1.175 gutterid 3035: /../lang/python/distutils.mk", so pkgsrc will use this framework. "distutils"
3036: uses a script called setup.py; if the "distutils" driver is not called
1.103 wiz 3037: setup.py, set the PYSETUP variable to the name of the script.
3038:
3039: Either way, the package directory should be called "py-software" and PKGNAME
3040: should be set to "${PYPKGPREFIX}-${DISTNAME}", e.g.
1.17 imil 3041:
3042: DISTNAME= foopymodule-1.2.10
3043: PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
3044:
1.63 wiz 3045: If it is an application, include "../../lang/python/application.mk". In order
3046: to correctly set the path to the Python interpreter, use the REPLACE_PYTHON
3047: variable and set it to the list of files (paths relative to WRKSRC) that must
3048: be corrected. For example:
1.17 imil 3049:
1.63 wiz 3050: REPLACE_PYTHON= *.py
1.17 imil 3051:
1.63 wiz 3052: Some Python modules have separate distributions for Python-2.x and Python-3.x
3053: support. In pkgsrc this is handled by the versioned_dependencies.mk file. Set
3054: PYTHON_VERSIONED_DEPENDENCIES to the list of packages that should be depended
3055: upon and include "../../lang/python/versioned_dependencies.mk", then the pkgsrc
3056: infrastructure will depend on the appropriate package version. For example:
1.17 imil 3057:
1.135 wiz 3058: PYTHON_VERSIONED_DEPENDENCIES=dialog
1.63 wiz 3059:
3060: Look inside versioned_dependencies.mk for a list of supported packages.
1.17 imil 3061:
1.160 brook 3062: 12.1.3. R packages
3063:
3064: Simple R packages from CRAN are handled automatically by R2pkg, which is
3065: available in pkgtools/R2pkg. Individual packages (and optionally their
3066: dependencies) may be created and updated. R packages generally follow the same
3067: form, and most of the relevant information needed is contained in a DESCRIPTION
3068: file as part of each R package on CRAN. Consequently, R2pkg downloads that
3069: information and creates or updates a package in the canonical form. The
3070: resulting package should be reviewed for correctness.
3071:
3072: 12.1.4. TeXlive packages
3073:
3074: TeXlive packages from CTAN are handled automatically by texlive2pkg, which is
3075: available in pkgtools/texlive2pkg.
3076:
3077: If the TeXlive package name is not known, it may be useful to search CTAN. A "
3078: Contained in" field on the package page typically identifies the basename of
3079: the package file in the TeXlive archive.
3080:
3081: If the TeXlive package name is known, download the files from the TeXlive
3082: archive. For package foo, you will need to download foo.tar.xz. Most TeXlive
3083: packages also have associated documentation packages, so download
3084: foo.doc.tar.xz at the same time. These files should be placed in the
3085: appropriate category directory, which is often but not always print. Then run
3086: the following command in the category directory.
3087:
3088: texlive2pkg foo.tar.xz foo.doc.tar.xz
3089:
3090: This will create two packages, tex-foo and tex-foo-doc. Be sure to check that
3091: both packages are correct.
3092:
3093: Finally, CTAN currently does not include version information in package
3094: filenames and changes their contents periodically when updates occur.
3095: Consequently, pkgsrc avoids downloading distfiles directly from CTAN and
3096: instead relies on the pkgsrc archives. For each new or updated TeXlive package,
3097: e.g., the main one and the corresponding documentation, upload the distfiles
3098: with the following command in each package directory.
3099:
3100: make upload-distfiles
3101:
1.154 rillig 3102: 12.2. Examples
1.1 dsieger 3103:
1.154 rillig 3104: 12.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 3105:
1.154 rillig 3106: 12.2.1.1. The initial package
1.1 dsieger 3107:
3108: Looking at the file pkgsrc/doc/TODO, I saw that the "nvu" package has not yet
3109: been imported into pkgsrc. As the description says it has to do with the web,
3110: the obvious choice for the category is "www".
3111:
3112: $ mkdir www/nvu
3113: $ cd www/nvu
3114:
3115: The web site says that the sources are available as a tar file, so I fed that
3116: URL to the url2pkg program:
3117:
3118: $ url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
3119:
3120: My editor popped up, and I added a PKGNAME line below the DISTNAME line, as the
3121: package name should not have the word "sources" in it. I also filled in the
3122: MAINTAINER, HOMEPAGE and COMMENT fields. Then the package Makefile looked like
3123: that:
3124:
1.121 sevan 3125: # $NetBSD $
1.1 dsieger 3126: #
3127:
3128: DISTNAME= nvu-1.0-sources
3129: PKGNAME= nvu-1.0
3130: CATEGORIES= www
3131: MASTER_SITES= http://cvs.nvu.com/download/
3132: EXTRACT_SUFX= .tar.bz2
3133:
3134: MAINTAINER= rillig@NetBSD.org
3135: HOMEPAGE= http://cvs.nvu.com/
3136: COMMENT= Web Authoring System
3137:
3138: # url2pkg-marker (please do not remove this line.)
3139: .include "../../mk/bsd.pkg.mk"
3140:
1.124 wiz 3141: On the first line of output above, an artificial space has been added between
1.121 sevan 3142: NetBSD and $, this is a workaround to prevent CVS expanding to the filename of
3143: the guide.
3144:
1.1 dsieger 3145: Then, I quit the editor and watched pkgsrc downloading a large source archive:
3146:
3147: url2pkg> Running "make makesum" ...
3148: => Required installed package digest>=20010302: digest-20060826 found
3149: => Fetching nvu-1.0-sources.tar.bz2
3150: Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
3151: 100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA
3152: 29687976 bytes retrieved in 03:12 (150.77 KB/s)
3153: url2pkg> Running "make extract" ...
3154: => Required installed package digest>=20010302: digest-20060826 found
3155: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
3156: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
3157: work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc
3158: ===> Installing dependencies for nvu-1.0
3159: ===> Overriding tools for nvu-1.0
3160: ===> Extracting for nvu-1.0
3161: url2pkg> Adjusting the Makefile.
3162:
3163: Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
3164:
3165: Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
3166:
1.154 rillig 3167: 12.2.1.2. Fixing all kinds of problems to make the package work
1.1 dsieger 3168:
3169: Now that the package has been extracted, let's see what's inside it. The
3170: package has a README.txt, but that only says something about mozilla, so it's
3171: probably useless for seeing what dependencies this package has. But since there
3172: is a GNU configure script in the package, let's hope that it will complain
3173: about everything it needs.
3174:
3175: $ bmake
3176: => Required installed package digest>=20010302: digest-20060826 found
3177: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
3178: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
3179: ===> Patching for nvu-1.0
3180: ===> Creating toolchain wrappers for nvu-1.0
3181: ===> Configuring for nvu-1.0
3182: [...]
3183: configure: error: Perl 5.004 or higher is required.
3184: [...]
3185: WARNING: Please add USE_TOOLS+=perl to the package Makefile.
3186: [...]
3187:
3188: That worked quite well. So I opened the package Makefile in my editor, and
3189: since it already has a USE_TOOLS line, I just appended "perl" to it. Since the
3190: dependencies of the package have changed now, and since a perl wrapper is
3191: automatically installed in the "tools" phase, I need to build the package from
3192: scratch.
3193:
3194: $ bmake clean
3195: ===> Cleaning for nvu-1.0
3196: $ bmake
3197: [...]
3198: *** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
3199: GNU Make. You will not be able to build Mozilla without GNU Make.
3200: [...]
3201:
3202: So I added "gmake" to the USE_TOOLS line and tried again (from scratch).
3203:
3204: [...]
3205: checking for GTK - version >= 1.2.0... no
3206: *** Could not run GTK test program, checking why...
3207: [...]
3208:
3209: Now to the other dependencies. The first question is: Where is the GTK package
3210: hidden in pkgsrc?
3211:
3212: $ echo ../../*/gtk*
3213: [many packages ...]
3214: $ echo ../../*/gtk
3215: ../../x11/gtk
3216: $ echo ../../*/gtk2
3217: ../../x11/gtk2
3218: $ echo ../../*/gtk2/bui*
3219: ../../x11/gtk2/buildlink3.mk
3220:
3221: The first try was definitely too broad. The second one had exactly one result,
3222: which is very good. But there is one pitfall with GNOME packages. Before GNOME
3223: 2 had been released, there were already many GNOME 1 packages in pkgsrc. To be
3224: able to continue to use these packages, the GNOME 2 packages were imported as
3225: separate packages, and their names usually have a "2" appended. So I checked
3226: whether this was the case here, and indeed it was.
3227:
3228: Since the GTK2 package has a buildlink3.mk file, adding the dependency is very
3229: easy. I just inserted an .include line before the last line of the package
3230: Makefile, so that it now looks like this:
3231:
3232: [...]
3233: .include "../../x11/gtk2/buildlink3.mk"
3234: .include "../../mk/bsd.pkg.mk
3235:
3236: After another bmake clean && bmake, the answer was:
3237:
3238: [...]
3239: checking for gtk-config... /home/roland/pkg/bin/gtk-config
3240: checking for GTK - version >= 1.2.0... no
3241: *** Could not run GTK test program, checking why...
3242: *** The test program failed to compile or link. See the file config.log for the
3243: *** exact error that occured. This usually means GTK was incorrectly installed
3244: *** or that you have moved GTK since it was installed. In the latter case, you
3245: *** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
3246: configure: error: Test for GTK failed.
3247: [...]
3248:
3249: In this particular case, the assumption that "every package prefers GNOME 2"
3250: had been wrong. The first of the lines above told me that this package really
3251: wanted to have the GNOME 1 version of GTK. If the package had looked for GTK2,
3252: it would have looked for pkg-config instead of gtk-config. So I changed the x11
3253: /gtk2 to x11/gtk in the package Makefile, and tried again.
3254:
3255: [...]
1.59 jnemeth 3256: cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...]
1.1 dsieger 3257: In file included from xpidl.c:42:
3258: xpidl.h:53:24: libIDL/IDL.h: No such file or directory
3259: In file included from xpidl.c:42:
3260: xpidl.h:132: error: parse error before "IDL_ns"
3261: [...]
3262:
3263: The package still does not find all of its dependencies. Now the question is:
3264: Which package provides the libIDL/IDL.h header file?
3265:
3266: $ echo ../../*/*idl*
3267: ../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
3268: $ echo ../../*/*IDL*
3269: ../../net/libIDL
3270:
3271: Let's take the one from the second try. So I included the ../../net/libIDL/
3272: buildlink3.mk file and tried again. But the error didn't change. After digging
3273: through some of the code, I concluded that the build process of the package was
3274: broken and couldn't have ever worked, but since the Mozilla source tree is
3275: quite large, I didn't want to fix it. So I added the following to the package
3276: Makefile and tried again:
3277:
3278: CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
1.139 leot 3279: BUILDLINK_TRANSFORM+= l:IDL:IDL-2
1.1 dsieger 3280:
3281: The latter line is needed because the package expects the library libIDL.so,
3282: but only libIDL-2.so is available. So I told the compiler wrapper to rewrite
3283: that on the fly.
3284:
3285: The next problem was related to a recent change of the FreeType interface. I
3286: looked up in www/seamonkey which patch files were relevant for this issue and
3287: copied them to the patches directory. Then I retried, fixed the patches so that
3288: they applied cleanly and retried again. This time, everything worked.
3289:
1.154 rillig 3290: 12.2.1.3. Installing the package
1.1 dsieger 3291:
3292: $ bmake CHECK_FILES=no install
3293: [...]
3294: $ bmake print-PLIST >PLIST
3295: $ bmake deinstall
3296: $ bmake install
3297:
1.154 rillig 3298: Chapter 13. Package components - files, directories and contents
1.1 dsieger 3299:
3300: Table of Contents
3301:
1.154 rillig 3302: 13.1. Makefile
3303: 13.2. distinfo
3304: 13.3. patches/*
3305:
3306: 13.3.1. Structure of a single patch file
3307: 13.3.2. Creating patch files
3308: 13.3.3. Sources where the patch files come from
3309: 13.3.4. Patching guidelines
3310: 13.3.5. Feedback to the author
3311:
3312: 13.4. Other mandatory files
3313: 13.5. Optional files
3314:
3315: 13.5.1. Files affecting the binary package
3316: 13.5.2. Files affecting the build process
3317: 13.5.3. Files affecting nothing at all
1.1 dsieger 3318:
1.154 rillig 3319: 13.6. work*
3320: 13.7. files/*
1.1 dsieger 3321:
3322: Whenever you're preparing a package, there are a number of files involved which
3323: are described in the following sections.
3324:
1.154 rillig 3325: 13.1. Makefile
1.1 dsieger 3326:
3327: Building, installation and creation of a binary package are all controlled by
3328: the package's Makefile. The Makefile describes various things about a package,
3329: for example from where to get it, how to configure, build, and install it.
3330:
3331: A package Makefile contains several sections that describe the package.
3332:
3333: In the first section there are the following variables, which should appear
3334: exactly in the order given here. The order and grouping of the variables is
3335: mostly historical and has no further meaning.
3336:
3337: * DISTNAME is the basename of the distribution file to be downloaded from the
3338: package's website.
3339:
1.66 asau 3340: * PKGNAME is the name of the package, as used by pkgsrc. You need to provide
3341: it if DISTNAME (which is the default) is not a good name for the package in
3342: pkgsrc or DISTNAME is not provided (no distribution file is required).
3343: Usually it is the pkgsrc directory name together with the version number.
3344: It must match the regular expression ^[A-Za-z0-9][A-Za-z0-9-_.+]*$, that
3345: is, it starts with a letter or digit, and contains only letters, digits,
3346: dashes, underscores, dots and plus signs.
1.1 dsieger 3347:
3348: * CATEGORIES is a list of categories which the package fits in. You can
3349: choose any of the top-level directories of pkgsrc for it.
3350:
3351: Currently the following values are available for CATEGORIES. If more than
3352: one is used, they need to be separated by spaces:
3353:
3354: archivers cross geography meta-pkgs security
3355: audio databases graphics misc shells
3356: benchmarks devel ham multimedia sysutils
3357: biology editors inputmethod net textproc
3358: cad emulators lang news time
3359: chat finance mail parallel wm
3360: comms fonts math pkgtools www
3361: converters games mbone print x11
3362:
3363: * MASTER_SITES, DYNAMIC_MASTER_SITES, DIST_SUBDIR, EXTRACT_SUFX and DISTFILES
1.154 rillig 3364: are discussed in detail in Section 19.5, "The fetch phase".
1.1 dsieger 3365:
3366: The second section contains information about separately downloaded patches, if
3367: any.
3368:
3369: * PATCHFILES: Name(s) of additional files that contain distribution patches.
3370: There is no default. pkgsrc will look for them at PATCH_SITES. They will
3371: automatically be uncompressed before patching if the names end with .gz or
3372: .Z.
3373:
3374: * PATCH_SITES: Primary location(s) for distribution patch files (see
1.80 wiz 3375: PATCHFILES above) if not found locally.
3376:
3377: * PATCH_DIST_STRIP: an argument to patch(1) that sets the pathname strip
3378: count to help find the correct files to patch. It defaults to -p0.
1.1 dsieger 3379:
3380: The third section contains the following variables.
3381:
3382: * MAINTAINER is the email address of the person who feels responsible for
3383: this package, and who is most likely to look at problems or questions
3384: regarding this package which have been reported with send-pr(1). Other
1.14 jmcneill 3385: developers may contact the MAINTAINER before making changes to the package,
3386: but are not required to do so. When packaging a new program, set MAINTAINER
3387: to yourself. If you really can't maintain the package for future updates,
3388: set it to <pkgsrc-users@NetBSD.org>.
3389:
3390: * OWNER should be used instead of MAINTAINER when you do not want other
3391: developers to update or change the package without contacting you first. A
3392: package Makefile should contain one of MAINTAINER or OWNER, but not both.
1.1 dsieger 3393:
3394: * HOMEPAGE is a URL where users can find more information about the package.
3395:
3396: * COMMENT is a one-line description of the package (should not include the
3397: package name).
3398:
1.122 leot 3399: * LICENSE indicates the license(s) applicable for the package. See
1.154 rillig 3400: Section 21.1.3, "Handling licenses" for further details.
1.122 leot 3401:
1.1 dsieger 3402: Other variables that affect the build:
3403:
3404: * WRKSRC: The directory where the interesting distribution files of the
3405: package are found. The default is ${WRKDIR}/${DISTNAME}, which works for
3406: most packages.
3407:
3408: If a package doesn't create a subdirectory for itself (most GNU software
3409: does, for instance), but extracts itself in the current directory, you
3410: should set WRKSRC=${WRKDIR}.
3411:
3412: If a package doesn't create a subdirectory with the name of DISTNAME but
3413: some different name, set WRKSRC to point to the proper name in ${WRKDIR},
3414: for example WRKSRC=${WRKDIR}/${DISTNAME}/unix. See lang/tcl and x11/tk for
3415: other examples.
3416:
3417: The name of the working directory created by pkgsrc is taken from the
3418: WRKDIR_BASENAME variable. By default, its value is work. If you want to use
3419: the same pkgsrc tree for building different kinds of binary packages, you
3420: can change the variable according to your needs. Two other variables handle
3421: common cases of setting WRKDIR_BASENAME individually. If OBJHOSTNAME is
1.4 rillig 3422: defined in mk.conf, the first component of the host's name is attached to
3423: the directory name. If OBJMACHINE is defined, the platform name is
1.1 dsieger 3424: attached, which might look like work.i386 or work.sparc.
3425:
3426: Please pay attention to the following gotchas:
3427:
3428: * Add MANCOMPRESSED if man pages are installed in compressed form by the
3429: package. For packages using BSD-style makefiles which honor MANZ, there is
3430: MANCOMPRESSED_IF_MANZ.
3431:
3432: * Replace /usr/local with "${PREFIX}" in all files (see patches, below).
3433:
1.154 rillig 3434: * If the package installs any info files, see Section 21.6.7, "Packages
1.1 dsieger 3435: installing info files".
3436:
1.154 rillig 3437: 13.2. distinfo
1.1 dsieger 3438:
3439: The distinfo file contains the message digest, or checksum, of each distfile
3440: needed for the package. This ensures that the distfiles retrieved from the
3441: Internet have not been corrupted during transfer or altered by a malign force
1.108 rillig 3442: to introduce a security hole. To provide maximum security, all distfiles are
3443: protected using three different message digest algorithms (SHA1, RMD160,
3444: SHA512), as well as the file size.
1.1 dsieger 3445:
3446: The distinfo file also contains the checksums for all the patches found in the
1.154 rillig 3447: patches directory (see Section 13.3, "patches/*"). These checksums ensure that
1.145 leot 3448: patches are only applied intentionally and that they don't accidentally change,
3449: e.g. when merging different changes together. They also make sure that new
3450: patches are actually added to CVS and old ones are removed. Too see whether the
3451: patches and the distinfo file match, run pkglint after changing the patches.
1.1 dsieger 3452:
1.108 rillig 3453: To regenerate the distinfo file, use the make distinfo command.
1.1 dsieger 3454:
3455: Some packages have different sets of distfiles depending on the platform, for
1.178 rillig 3456: example lang/openjdk8. These are kept in the same distinfo file and care should
1.24 wiz 3457: be taken when upgrading such a package to ensure distfile information is not
3458: lost.
1.1 dsieger 3459:
1.154 rillig 3460: 13.3. patches/*
1.1 dsieger 3461:
1.108 rillig 3462: Some packages don't work out-of-the box on the various platforms that are
3463: supported by pkgsrc. These packages need to be patched to make them work. The
3464: patch files can be found in the patches/ directory.
1.1 dsieger 3465:
3466: In the patch phase, these patches are applied to the files in WRKSRC directory
1.25 wiz 3467: after extracting them, in alphabetic order.
1.1 dsieger 3468:
1.154 rillig 3469: 13.3.1. Structure of a single patch file
1.1 dsieger 3470:
3471: The patch-* files should be in diff -bu format, and apply without a fuzz to
3472: avoid problems. (To force patches to apply with fuzz you can set
3473: PATCH_FUZZ_FACTOR=-F2). Furthermore, each patch should contain only changes for
3474: a single file, and no file should be patched by more than one patch file. This
3475: helps to keep future modifications simple.
3476:
3477: Each patch file is structured as follows: In the first line, there is the RCS
3478: Id of the patch itself. The second line should be empty for aesthetic reasons.
3479: After that, there should be a comment for each change that the patch does.
3480: There are a number of standard cases:
3481:
3482: * Patches for commonly known vulnerabilities should mention the vulnerability
3483: ID (CAN, CVE).
3484:
3485: * Patches that change source code should mention the platform and other
3486: environment (for example, the compiler) that the patch is needed for.
3487:
1.108 rillig 3488: The patch should be commented so that any developer who knows the code of the
3489: application can make some use of the patch. Special care should be taken for
3490: the upstream developers, since we generally want that they accept our patches,
3491: so we have less work in the future.
1.1 dsieger 3492:
1.154 rillig 3493: 13.3.2. Creating patch files
1.1 dsieger 3494:
3495: One important thing to mention is to pay attention that no RCS IDs get stored
3496: in the patch files, as these will cause problems when later checked into the
3497: NetBSD CVS tree. Use the pkgdiff command from the pkgtools/pkgdiff package to
3498: avoid these problems.
3499:
3500: For even more automation, we recommend using mkpatches from the same package to
3501: make a whole set of patches. You just have to backup files before you edit them
1.25 wiz 3502: to filename.orig, e.g. with cp -p filename filename.orig or, easier, by using
1.1 dsieger 3503: pkgvi again from the same package. If you upgrade a package this way, you can
1.25 wiz 3504: easily compare the new set of patches with the previously existing one with
3505: patchdiff. The files in patches are replaced by new files, so carefully check
3506: if you want to take all the changes.
1.1 dsieger 3507:
3508: When you have finished a package, remember to generate the checksums for the
1.154 rillig 3509: patch files by using the make makepatchsum command, see Section 13.2,
1.1 dsieger 3510: "distinfo".
3511:
3512: When adding a patch that corrects a problem in the distfile (rather than e.g.
3513: enforcing pkgsrc's view of where man pages should go), send the patch as a bug
3514: report to the maintainer. This benefits non-pkgsrc users of the package, and
3515: usually makes it possible to remove the patch in future version.
3516:
1.25 wiz 3517: The file names of the patch files are usually of the form patch-
3518: path_to_file__with__underscores.c. Many packages still use the previous
3519: convention patch-[a-z][a-z], but new patches should be of the form containing
3520: the filename. mkpatches included in pkgtools/pkgdiff takes care of the name
3521: automatically.
1.2 rillig 3522:
1.154 rillig 3523: 13.3.3. Sources where the patch files come from
1.1 dsieger 3524:
3525: If you want to share patches between multiple packages in pkgsrc, e.g. because
3526: they use the same distfiles, set PATCHDIR to the path where the patch files can
3527: be found, e.g.:
3528:
1.159 rillig 3529: PATCHDIR= ../../editors/xemacs/patches
1.1 dsieger 3530:
3531: Patch files that are distributed by the author or other maintainers can be
3532: listed in PATCHFILES.
3533:
3534: If it is desired to store any patches that should not be committed into pkgsrc,
3535: they can be kept outside the pkgsrc tree in the $LOCALPATCHES directory. The
3536: directory tree there is expected to have the same "category/package" structure
3537: as pkgsrc, and patches are expected to be stored inside these dirs (also known
3538: as $LOCALPATCHES/$PKGPATH). For example, if you want to keep a private patch
3539: for pkgsrc/graphics/png, keep it in $LOCALPATCHES/graphics/png/mypatch. All
3540: files in the named directory are expected to be patch files, and they are
3541: applied after pkgsrc patches are applied.
3542:
1.154 rillig 3543: 13.3.4. Patching guidelines
1.1 dsieger 3544:
3545: When fixing a portability issue in the code do not use preprocessor magic to
3546: check for the current operating system nor platform. Doing so hurts portability
3547: to other platforms because the OS-specific details are not abstracted
3548: appropriately.
3549:
3550: The general rule to follow is: instead of checking for the operating system the
3551: application is being built on, check for the specific features you need. For
3552: example, instead of assuming that kqueue is available under NetBSD and using
3553: the __NetBSD__ macro to conditionalize kqueue support, add a check that detects
3554: kqueue itself ? yes, this generally involves patching the configure script.
3555: There is absolutely nothing that prevents some OSes from adopting interfaces
3556: from other OSes (e.g. Linux implementing kqueue), something that the above
3557: checks cannot take into account.
3558:
3559: Of course, checking for features generally involves more work on the
3560: developer's side, but the resulting changes are cleaner and there are chances
3561: they will work on many other platforms. Not to mention that there are higher
3562: chances of being later integrated into the mainstream sources. Remember: It
3563: doesn't work unless it is right!
3564:
3565: Some typical examples:
3566:
1.154 rillig 3567: Table 13.1. Patching examples
1.1 dsieger 3568:
3569: +-------------------------------------------------------------------------------------------+
3570: | Where | Incorrect | Correct |
3571: |---------+--------------------------+------------------------------------------------------|
3572: | |case ${target_os} in | |
3573: |configure|netbsd*) have_kvm=yes ;; |AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)|
3574: |script |*) have_kvm=no ;; | |
3575: | |esac | |
3576: |---------+--------------------------+------------------------------------------------------|
1.2 rillig 3577: |C source |#if defined(__NetBSD__) |#if defined(HAVE_SYS_EVENT_H) |
3578: |file |# include <sys/event.h> |# include <sys/event.h> |
3579: | |#endif |#endif |
1.1 dsieger 3580: |---------+--------------------------+------------------------------------------------------|
3581: | |int |int |
3582: | |monitor_file(...) |monitor_file(...) |
3583: | |{ |{ |
3584: | |#if defined(__NetBSD__) |#if defined(HAVE_KQUEUE) |
3585: |C source | int fd = kqueue();| int fd = kqueue(); |
3586: |file | ... | ... |
3587: | |#else |#else |
3588: | | ... | ... |
3589: | |#endif |#endif |
3590: | |} |} |
3591: +-------------------------------------------------------------------------------------------+
3592:
3593:
1.154 rillig 3594: 13.3.5. Feedback to the author
1.1 dsieger 3595:
3596: Always, always, always feed back any portability fixes or improvements you do
3597: to a package to the mainstream developers. This is the only way to get their
3598: attention on portability issues and to ensure that future versions can be built
3599: out-of-the box on NetBSD. Furthermore, any user that gets newer distfiles will
3600: get the fixes straight from the packaged code.
3601:
3602: This generally involves cleaning up the patches (because sometimes the patches
1.41 wiz 3603: that are added to pkgsrc are quick hacks), filing bug reports in the
1.1 dsieger 3604: appropriate trackers for the projects and working with the mainstream authors
3605: to accept your changes. It is extremely important that you do it so that the
3606: packages in pkgsrc are kept simple and thus further changes can be done without
3607: much hassle.
3608:
1.25 wiz 3609: When you have done this, please add a URL to the upstream bug report to the
3610: patch comment.
3611:
1.1 dsieger 3612: Support the idea of free software!
3613:
1.154 rillig 3614: 13.4. Other mandatory files
1.1 dsieger 3615:
3616: DESCR
3617:
3618: A multi-line description of the piece of software. This should include any
3619: credits where they are due. Please bear in mind that others do not share
3620: your sense of humour (or spelling idiosyncrasies), and that others will
3621: read everything that you write here.
3622:
3623: PLIST
3624:
3625: This file governs the files that are installed on your system: all the
3626: binaries, manual pages, etc. There are other directives which may be
3627: entered in this file, to control the creation and deletion of directories,
1.154 rillig 3628: and the location of inserted files. See Chapter 15, PLIST issues for more
1.1 dsieger 3629: information.
3630:
1.154 rillig 3631: 13.5. Optional files
1.1 dsieger 3632:
1.154 rillig 3633: 13.5.1. Files affecting the binary package
1.1 dsieger 3634:
3635: INSTALL
3636:
3637: This shell script is invoked twice by pkg_add(1). First time after package
3638: extraction and before files are moved in place, the second time after the
3639: files to install are moved in place. This can be used to do any custom
3640: procedures not possible with @exec commands in PLIST. See pkg_add(1) and
1.154 rillig 3641: pkg_create(1) for more information. See also Section 17.1, "Files and
1.29 wiz 3642: directories outside the installation prefix". Please note that you can
3643: modify variables in it easily by using FILES_SUBST in the package's
3644: Makefile:
3645:
3646: FILES_SUBST+= SOMEVAR="somevalue"
3647:
3648: replaces "@SOMEVAR@" with "somevalue" in the INSTALL. By default,
3649: substitution is performed for PREFIX, LOCALBASE, X11BASE, VARBASE, and a
3650: few others, type make help topic=FILES_SUBST for a complete list.
1.1 dsieger 3651:
3652: DEINSTALL
3653:
3654: This script is executed before and after any files are removed. It is this
3655: script's responsibility to clean up any additional messy details around the
3656: package's installation, since all pkg_delete knows is how to delete the
3657: files created in the original distribution. See pkg_delete(1) and
1.29 wiz 3658: pkg_create(1) for more information. The same methods to replace variables
3659: can be used as for the INSTALL file.
1.1 dsieger 3660:
3661: MESSAGE
3662:
3663: This file is displayed after installation of the package. Useful for things
3664: like legal notices on almost-free software and hints for updating config
3665: files after installing modules for apache, PHP etc. Please note that you
3666: can modify variables in it easily by using MESSAGE_SUBST in the package's
3667: Makefile:
3668:
3669: MESSAGE_SUBST+= SOMEVAR="somevalue"
3670:
3671: replaces "${SOMEVAR}" with "somevalue" in MESSAGE. By default, substitution
1.99 sevan 3672: is performed for PKGNAME, PKGBASE, PREFIX, LOCALBASE, X11BASE,
1.16 jnemeth 3673: PKG_SYSCONFDIR, ROOT_GROUP, and ROOT_USER.
1.1 dsieger 3674:
3675: You can display a different or additional files by setting the MESSAGE_SRC
3676: variable. Its default is MESSAGE, if the file exists.
3677:
3678: ALTERNATIVES
3679:
1.66 asau 3680: This file is used by the alternatives framework. It creates, configures,
3681: and destroys generic wrappers used to run programs with similar interfaces.
3682: See pkg_alternatives(8) from pkgtools/pkg_alternatives for more
3683: information.
3684:
3685: Each line of the file contains two filenames, first the wrapper and then
3686: the alternative provided by the package. Both paths are relative to PREFIX.
1.1 dsieger 3687:
1.154 rillig 3688: 13.5.2. Files affecting the build process
1.1 dsieger 3689:
3690: Makefile.common
3691:
3692: This file contains arbitrary things that could also go into a Makefile, but
3693: its purpose is to be used by more than one package. This file should only
3694: be used when the packages that will use the file are known in advance. For
3695: other purposes it is often better to write a *.mk file and give it a good
3696: name that describes what it does.
3697:
3698: buildlink3.mk
3699:
3700: This file contains the dependency information for the buildlink3 framework
1.154 rillig 3701: (see Chapter 16, Buildlink methodology).
1.1 dsieger 3702:
3703: hacks.mk
3704:
3705: This file contains workarounds for compiler bugs and similar things. It is
3706: included automatically by the pkgsrc infrastructure, so you don't need an
3707: extra .include line for it.
3708:
3709: options.mk
3710:
3711: This file contains the code for the package-specific options (see
1.154 rillig 3712: Chapter 18, Options handling) that can be selected by the user. If a
1.1 dsieger 3713: package has only one or two options, it is equally acceptable to put the
3714: code directly into the Makefile.
3715:
1.154 rillig 3716: 13.5.3. Files affecting nothing at all
1.1 dsieger 3717:
3718: README*
3719:
3720: These files do not take place in the creation of a package and thus are
3721: purely informative to the package developer.
3722:
3723: TODO
3724:
3725: This file contains things that need to be done to make the package even
3726: better.
3727:
1.154 rillig 3728: 13.6. work*
1.1 dsieger 3729:
3730: When you type make, the distribution files are unpacked into the directory
3731: denoted by WRKDIR. It can be removed by running make clean. Besides the
3732: sources, this directory is also used to keep various timestamp files. The
3733: directory gets removed completely on clean. The default is ${.CURDIR}/work or $
3734: {.CURDIR}/work.${MACHINE_ARCH} if OBJMACHINE is set.
3735:
1.154 rillig 3736: 13.7. files/*
1.1 dsieger 3737:
3738: If you have any files that you wish to be placed in the package prior to
1.172 rillig 3739: configuration or building, you can place these files here and use a ${CP}
3740: command in the "post-extract" target to achieve this.
1.1 dsieger 3741:
3742: If you want to share files in this way with other packages, set the FILESDIR
3743: variable to point to the other package's files directory, e.g.:
3744:
1.159 rillig 3745: FILESDIR= ../../editors/xemacs/files
1.1 dsieger 3746:
1.154 rillig 3747: Chapter 14. Programming in Makefiles
1.1 dsieger 3748:
3749: Table of Contents
3750:
1.154 rillig 3751: 14.1. Caveats
3752: 14.2. Makefile variables
1.1 dsieger 3753:
1.154 rillig 3754: 14.2.1. Naming conventions
1.1 dsieger 3755:
1.154 rillig 3756: 14.3. Code snippets
1.1 dsieger 3757:
1.154 rillig 3758: 14.3.1. Adding things to a list
3759: 14.3.2. Echoing a string exactly as-is
3760: 14.3.3. Passing CFLAGS to GNU configure scripts
3761: 14.3.4. Handling possibly empty variables
1.1 dsieger 3762:
3763: Pkgsrc consists of many Makefile fragments, each of which forms a well-defined
3764: part of the pkgsrc system. Using the make(1) system as a programming language
3765: for a big system like pkgsrc requires some discipline to keep the code correct
3766: and understandable.
3767:
1.154 rillig 3768: The basic ingredients for Makefile programming are variables and shell
3769: commands. Among these shell commands may even be more complex ones like awk(1)
3770: programs. To make sure that every shell command runs as intended it is
3771: necessary to quote all variables correctly when they are used.
1.1 dsieger 3772:
1.154 rillig 3773: This chapter describes some patterns that appear quite often in Makefiles,
1.1 dsieger 3774: including the pitfalls that come along with them.
3775:
1.154 rillig 3776: 14.1. Caveats
1.1 dsieger 3777:
3778: * When you are creating a file as a target of a rule, always write the data
3779: to a temporary file first and finally rename that file. Otherwise there
3780: might occur an error in the middle of generating the file, and when the
3781: user runs make(1) for the second time, the file exists and will not be
3782: regenerated properly. Example:
3783:
3784: wrong:
3785: @echo "line 1" > ${.TARGET}
3786: @echo "line 2" >> ${.TARGET}
3787: @false
3788:
3789: correct:
3790: @echo "line 1" > ${.TARGET}.tmp
3791: @echo "line 2" >> ${.TARGET}.tmp
3792: @false
3793: @mv ${.TARGET}.tmp ${.TARGET}
3794:
3795: When you run make wrong twice, the file wrong will exist, although there
3796: was an error message in the first run. On the other hand, running make
3797: correct gives an error message twice, as expected.
3798:
3799: You might remember that make(1) sometimes removes ${.TARGET} in case of
3800: error, but this only happens when it is interrupted, for example by
1.154 rillig 3801: pressing Ctrl+C. This does not happen when one of the commands fails (like
1.1 dsieger 3802: false(1) above).
3803:
1.154 rillig 3804: 14.2. Makefile variables
1.1 dsieger 3805:
3806: Makefile variables contain strings that can be processed using the five
1.154 rillig 3807: operators =, +=, ?=, := and !=, which are described in the make(1) man page.
1.1 dsieger 3808:
1.154 rillig 3809: When a variable's value is parsed from a Makefile, the hash character # and the
3810: backslash character \ are handled specially. If a backslash is the last
3811: character in a line, that backslash is removed from the line and the line
3812: continues with the next line of the file.
3813:
3814: The # character starts a comment that reaches until the end of the line. To get
3815: an actual # character, such as in a URL, write \# instead.
1.1 dsieger 3816:
1.108 rillig 3817: The evaluation of variables either happens immediately or lazy. It happens
1.154 rillig 3818: immediately when the variable occurs on the right-hand side of the := or the !=
3819: operator, in a .if condition or a .for loop. In the other cases, it is
3820: evaluated lazily.
1.1 dsieger 3821:
3822: Some of the modifiers split the string into words and then operate on the
3823: words, others operate on the string as a whole. When a string is split into
1.154 rillig 3824: words, double quotes and single quotes are interpreted as delimiters, just like
3825: in sh(1).
1.1 dsieger 3826:
1.154 rillig 3827: 14.2.1. Naming conventions
1.1 dsieger 3828:
3829: * All variable names starting with an underscore are reserved for use by the
1.154 rillig 3830: pkgsrc infrastructure. They shall not be used by packages.
1.1 dsieger 3831:
3832: * In .for loops you should use lowercase variable names for the iteration
3833: variables.
3834:
1.154 rillig 3835: * All list variables should have a plural name, such as PKG_OPTIONS or
1.1 dsieger 3836: DISTFILES.
3837:
1.154 rillig 3838: 14.3. Code snippets
1.1 dsieger 3839:
1.154 rillig 3840: 14.3.1. Adding things to a list
1.108 rillig 3841:
3842: When adding a string that possibly contains whitespace or quotes to a list
3843: (example 1), it must be quoted using the :Q modifier.
1.1 dsieger 3844:
1.108 rillig 3845: When adding another list to a list (example 2), it must not be quoted, since
3846: its elements are already quoted.
1.1 dsieger 3847:
1.108 rillig 3848: STRING= foo * bar `date`
3849: LIST= # empty
3850: ANOTHER_LIST= a=b c=d
1.1 dsieger 3851:
1.108 rillig 3852: LIST+= ${STRING:Q} # 1
3853: LIST+= ${ANOTHER_LIST} # 2
1.1 dsieger 3854:
1.154 rillig 3855: 14.3.2. Echoing a string exactly as-is
1.1 dsieger 3856:
1.108 rillig 3857: Echoing a string containing special characters needs special work.
1.1 dsieger 3858:
3859: STRING= foo bar < > * `date` $$HOME ' "
1.108 rillig 3860: EXAMPLE_ENV= string=${STRING:Q} x=multiple\ quoted\ words
1.1 dsieger 3861:
3862: all:
3863: echo ${STRING} # 1
1.108 rillig 3864: echo ${STRING:Q} # 2
3865: printf '%s\n' ${STRING:Q}'' # 3
3866: env ${EXAMPLE_ENV} sh -c 'echo "$$string"; echo "$$x"' # 4
1.1 dsieger 3867:
3868: Example 1 leads to a syntax error in the shell, as the characters are just
3869: copied.
3870:
1.108 rillig 3871: Example 2 quotes the string so that the shell interprets it correctly. But the
3872: echo command may additionally interpret strings with a leading dash or those
3873: containing backslashes.
3874:
3875: Example 3 can handle arbitrary strings, since printf(1) only interprets the
1.139 leot 3876: format string, but not the next argument. The trailing single quotes handle the
3877: case when the string is empty. In that case, the :Q modifier would result in an
3878: empty string too, which would then be skipped by the shell. For printf(1) this
3879: doesn't make a difference, but other programs may care.
1.108 rillig 3880:
3881: In example 4, the EXAMPLE_ENV does not need to be quoted because the quoting
3882: has already been done when adding elements to the list.
3883:
1.154 rillig 3884: 14.3.3. Passing CFLAGS to GNU configure scripts
1.108 rillig 3885:
3886: When passing CFLAGS or similar variables to a GNU-style configure script
3887: (especially those that call other configure scripts), it must not have leading
3888: or trailing whitespace, since otherwise the configure script gets confused. To
3889: trim leading and trailing whitespace, use the :M modifier, as in the following
3890: example:
3891:
3892: CPPFLAGS= # empty
3893: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX}\"
3894: CPPFLAGS+= ${MY_CPPFLAGS}
3895:
3896: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
3897:
3898: all:
3899: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
3900: echo x${CONFIGURE_ARGS:Q}x # properly trimmed
3901:
3902: In this example, CPPFLAGS has both leading and trailing whitespace because the
3903: += operator always adds a space.
3904:
1.154 rillig 3905: 14.3.4. Handling possibly empty variables
1.108 rillig 3906:
3907: When a possibly empty variable is used in a shell program, it may lead to a
3908: syntax error.
3909:
3910: EGFILES= # empty
3911:
3912: install-examples: # produces a syntax error in the shell
3913: for egfile in ${EGFILES}; do \
3914: echo "Installing $$egfile"; \
3915: done
3916:
3917: The shell only sees the text for egfile in ; do, since ${EGFILES} is replaced
3918: with an empty string by make(1). To fix this syntax error, use one of the
3919: snippets below.
3920:
3921: EMPTY= # empty
3922:
3923: install-examples:
3924: for egfile in ${EGFILES} ""; do \
3925: [ -n "$$egfile" ] || continue; \
3926: echo "Installing $$egfile"; \
3927: done
3928:
3929: In this case, an empty string is appended to the iteration list (to prevent the
3930: syntax error) and filtered out later.
1.1 dsieger 3931:
1.108 rillig 3932: EGFILES= # empty
1.1 dsieger 3933:
1.108 rillig 3934: install-examples:
3935: .for egfile in ${EGFILES}
3936: echo "Installing ${egfile}"
3937: .endfor
3938:
1.154 rillig 3939: If one of the filenames contains special characters, it should be enclosed in
3940: single or double quotes.
1.108 rillig 3941:
3942: To have a shell command test whether a make variable is empty, use the
3943: following code: ${TEST} -z ${POSSIBLY_EMPTY:Q}"".
1.1 dsieger 3944:
1.154 rillig 3945: Chapter 15. PLIST issues
1.1 dsieger 3946:
3947: Table of Contents
3948:
1.154 rillig 3949: 15.1. RCS ID
3950: 15.2. Semi-automatic PLIST generation
3951: 15.3. Tweaking output of make print-PLIST
3952: 15.4. Variable substitution in PLIST
3953: 15.5. Man page compression
3954: 15.6. Changing PLIST source with PLIST_SRC
3955: 15.7. Platform-specific and differing PLISTs
3956: 15.8. Build-specific PLISTs
3957: 15.9. Sharing directories between packages
1.1 dsieger 3958:
3959: The PLIST file contains a package's "packing list", i.e. a list of files that
3960: belong to the package (relative to the ${PREFIX} directory it's been installed
3961: in) plus some additional statements - see the pkg_create(1) man page for a full
3962: list. This chapter addresses some issues that need attention when dealing with
3963: the PLIST file (or files, see below!).
3964:
1.154 rillig 3965: 15.1. RCS ID
1.1 dsieger 3966:
3967: Be sure to add a RCS ID line as the first thing in any PLIST file you write:
3968:
1.121 sevan 3969: @comment $NetBSD $
3970:
1.123 wiz 3971: An artificial space has been added between NetBSD and $, this is a workaround
1.121 sevan 3972: here to prevent CVS expanding to the filename of the guide. When adding the RCS
1.125 leot 3973: ID the space should be omitted.
1.1 dsieger 3974:
1.154 rillig 3975: 15.2. Semi-automatic PLIST generation
1.1 dsieger 3976:
3977: You can use the make print-PLIST command to output a PLIST that matches any new
1.154 rillig 3978: files since the package was extracted. See Section 19.17, "Other helpful
1.1 dsieger 3979: targets" for more information on this target.
3980:
1.154 rillig 3981: 15.3. Tweaking output of make print-PLIST
1.1 dsieger 3982:
3983: The PRINT_PLIST_AWK variable takes a set of AWK patterns and actions that are
3984: used to filter the output of print-PLIST. You can append any chunk of AWK
3985: scripting you like to it, but be careful with quoting.
3986:
3987: For example, to get all files inside the libdata/foo directory removed from the
3988: resulting PLIST:
3989:
3990: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
3991:
1.182 ! leot 3992: The PRINT_PLIST_AWK transformations are evaluated after the file list and
! 3993: directory list are sorted. EARLY_PRINT_PLIST_AWK is like PRINT_PLIST_AWK except
! 3994: it operates before the file list and directory list are sorted.
! 3995:
1.154 rillig 3996: 15.4. Variable substitution in PLIST
1.1 dsieger 3997:
3998: A number of variables are substituted automatically in PLISTs when a package is
3999: installed on a system. This includes the following variables:
4000:
4001: ${MACHINE_ARCH}, ${MACHINE_GNU_ARCH}
4002:
4003: Some packages like emacs and perl embed information about which
4004: architecture they were built on into the pathnames where they install their
4005: files. To handle this case, PLIST will be preprocessed before actually
4006: used, and the symbol "${MACHINE_ARCH}" will be replaced by what uname -p
4007: gives. The same is done if the string ${MACHINE_GNU_ARCH} is embedded in
4008: PLIST somewhere - use this on packages that have GNU autoconf-created
4009: configure scripts.
4010:
4011: Legacy note
4012:
4013: There used to be a symbol "$ARCH" that was replaced by the output of uname
4014: -m, but that's no longer supported and has been removed.
4015:
4016: ${OPSYS}, ${LOWER_OPSYS}, ${OS_VERSION}
4017:
4018: Some packages want to embed the OS name and version into some paths. To do
4019: this, use these variables in the PLIST:
4020:
1.42 asau 4021: + ${OPSYS} - output of "uname -s"
1.1 dsieger 4022:
1.42 asau 4023: + ${LOWER_OPSYS} - lowercase common name (eg. "solaris")
1.1 dsieger 4024:
1.42 asau 4025: + ${OS_VERSION} - "uname -r"
1.1 dsieger 4026:
1.88 tnn 4027: For a list of values which are replaced by default, the output of make help
4028: topic=PLIST_SUBST as well as searching the pkgsrc/mk directory with grep for
4029: PLIST_SUBST should help.
1.1 dsieger 4030:
4031: If you want to change other variables not listed above, you can add variables
4032: and their expansions to this variable in the following way, similar to
1.154 rillig 4033: MESSAGE_SUBST (see Section 13.5, "Optional files"):
1.1 dsieger 4034:
4035: PLIST_SUBST+= SOMEVAR="somevalue"
4036:
4037: This replaces all occurrences of "${SOMEVAR}" in the PLIST with "somevalue".
4038:
1.19 snj 4039: The PLIST_VARS variable can be used to simplify the common case of
4040: conditionally including some PLIST entries. It can be done by adding
4041: PLIST_VARS+=foo and setting the corresponding PLIST.foo variable to yes if the
4042: entry should be included. This will substitute "${PLIST.foo}" in the PLIST with
4043: either """" or ""@comment "". For example, in Makefile:
1.18 mishka 4044:
4045: PLIST_VARS+= foo
4046: .if condition
4047: PLIST.foo= yes
4048: .else
4049:
4050: And then in PLIST:
4051:
1.121 sevan 4052: @comment $NetBSD $
1.18 mishka 4053: bin/bar
4054: man/man1/bar.1
4055: ${PLIST.foo}bin/foo
4056: ${PLIST.foo}man/man1/foo.1
4057: ${PLIST.foo}share/bar/foo.data
4058:
1.123 wiz 4059: An artificial space has been added between NetBSD and $, this is a workaround
1.121 sevan 4060: here to prevent CVS expanding to the filename of the guide. When adding the RCS
4061: ID the space should be ommited.
4062:
1.154 rillig 4063: 15.5. Man page compression
1.1 dsieger 4064:
4065: Man pages should be installed in compressed form if MANZ is set (in
4066: bsd.own.mk), and uncompressed otherwise. To handle this in the PLIST file, the
4067: suffix ".gz" is appended/removed automatically for man pages according to MANZ
4068: and MANCOMPRESSED being set or not, see above for details. This modification of
4069: the PLIST file is done on a copy of it, not PLIST itself.
4070:
1.154 rillig 4071: 15.6. Changing PLIST source with PLIST_SRC
1.1 dsieger 4072:
4073: To use one or more files as source for the PLIST used in generating the binary
4074: package, set the variable PLIST_SRC to the names of that file(s). The files are
4075: later concatenated using cat(1), and the order of things is important. The
4076: default for PLIST_SRC is ${PKGDIR}/PLIST.
4077:
1.154 rillig 4078: 15.7. Platform-specific and differing PLISTs
1.1 dsieger 4079:
4080: Some packages decide to install a different set of files based on the operating
4081: system being used. These differences can be automatically handled by using the
4082: following files:
4083:
4084: * PLIST.common
4085:
4086: * PLIST.${OPSYS}
4087:
4088: * PLIST.${MACHINE_ARCH}
4089:
4090: * PLIST.${OPSYS}-${MACHINE_ARCH}
4091:
4092: * PLIST.common_end
4093:
1.154 rillig 4094: 15.8. Build-specific PLISTs
1.86 wiz 4095:
4096: Some packages decide to generate hard-to-guess file names during installation
4097: that are hard to wire down.
4098:
4099: In such cases, you can set the GENERATE_PLIST variable to shell code terminated
4100: (with a semicolon) that will output PLIST entries which will be appended to the
4101: PLIST
4102:
4103: You can find one example in editors/xemacs:
4104:
1.111 sevan 4105: GENERATE_PLIST+= ${ECHO} bin/${DISTNAME}-`${WRKSRC}/src/xemacs -sd`.dmp ;
1.86 wiz 4106:
4107: which will append something like bin/xemacs-21.4.23-54e8ea71.dmp to the PLIST.
4108:
1.154 rillig 4109: 15.9. Sharing directories between packages
1.1 dsieger 4110:
4111: A "shared directory" is a directory where multiple (and unrelated) packages
1.23 jakllsch 4112: install files. These directories were problematic because you had to add
1.1 dsieger 4113: special tricks in the PLIST to conditionally remove them, or have some
4114: centralized package handle them.
4115:
1.23 jakllsch 4116: In pkgsrc, it is now easy: Each package should create directories and install
4117: files as needed; pkg_delete will remove any directories left empty after
4118: uninstalling a package.
1.1 dsieger 4119:
1.23 jakllsch 4120: If a package needs an empty directory to work, create the directory during
4121: installation as usual, and also add an entry to the PLIST:
1.1 dsieger 4122:
1.23 jakllsch 4123: @pkgdir path/to/empty/directory
1.1 dsieger 4124:
1.86 wiz 4125: or take a look at MAKE_DIRS and OWN_DIRS.
4126:
1.154 rillig 4127: Chapter 16. Buildlink methodology
1.1 dsieger 4128:
4129: Table of Contents
4130:
1.154 rillig 4131: 16.1. Converting packages to use buildlink3
4132: 16.2. Writing buildlink3.mk files
1.1 dsieger 4133:
1.154 rillig 4134: 16.2.1. Anatomy of a buildlink3.mk file
4135: 16.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
1.27 wiz 4136: buildlink3.mk files
1.1 dsieger 4137:
1.154 rillig 4138: 16.3. Writing builtin.mk files
1.1 dsieger 4139:
1.154 rillig 4140: 16.3.1. Anatomy of a builtin.mk file
4141: 16.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 4142:
4143: Buildlink is a framework in pkgsrc that controls what headers and libraries are
4144: seen by a package's configure and build processes. This is implemented in a two
4145: step process:
4146:
4147: 1. Symlink headers and libraries for dependencies into BUILDLINK_DIR, which by
4148: default is a subdirectory of WRKDIR.
4149:
4150: 2. Create wrapper scripts that are used in place of the normal compiler tools
4151: that translate -I${LOCALBASE}/include and -L${LOCALBASE}/lib into
4152: references to BUILDLINK_DIR. The wrapper scripts also make native compiler
4153: on some operating systems look like GCC, so that packages that expect GCC
4154: won't require modifications to build with those native compilers.
4155:
4156: This normalizes the environment in which a package is built so that the package
4157: may be built consistently despite what other software may be installed. Please
4158: note that the normal system header and library paths, e.g. /usr/include, /usr/
4159: lib, etc., are always searched -- buildlink3 is designed to insulate the
4160: package build from non-system-supplied software.
4161:
1.154 rillig 4162: 16.1. Converting packages to use buildlink3
1.1 dsieger 4163:
1.25 wiz 4164: The process of converting packages to use the buildlink3 framework ("bl3ifying"
4165: ) is fairly straightforward. The things to keep in mind are:
1.1 dsieger 4166:
4167: 1. Ensure that the build always calls the wrapper scripts instead of the
4168: actual toolchain. Some packages are tricky, and the only way to know for
4169: sure is the check ${WRKDIR}/.work.log to see if the wrappers are being
4170: invoked.
4171:
4172: 2. Don't override PREFIX from within the package Makefile, e.g. Java VMs,
4173: standalone shells, etc., because the code to symlink files into $
4174: {BUILDLINK_DIR} looks for files relative to "pkg_info -qp pkgname".
4175:
4176: 3. Remember that only the buildlink3.mk files that you list in a package's
4177: Makefile are added as dependencies for that package.
4178:
4179: If a dependency on a particular package is required for its libraries and
4180: headers, then we replace:
4181:
4182: DEPENDS+= foo>=1.1.0:../../category/foo
4183:
4184: with
4185:
4186: .include "../../category/foo/buildlink3.mk"
4187:
4188: The buildlink3.mk files usually define the required dependencies. If you need a
4189: newer version of the dependency when using buildlink3.mk files, then you can
4190: define it in your Makefile; for example:
4191:
4192: BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0
4193: .include "../../category/foo/buildlink3.mk"
4194:
4195: There are several buildlink3.mk files in pkgsrc/mk that handle special package
4196: issues:
4197:
4198: * bdb.buildlink3.mk chooses either the native or a pkgsrc Berkeley DB
4199: implementation based on the values of BDB_ACCEPTED and BDB_DEFAULT.
4200:
4201: * curses.buildlink3.mk: If the system comes with neither Curses nor NCurses,
4202: this will take care to install the devel/ncurses package.
4203:
4204: * krb5.buildlink3.mk uses the value of KRB5_ACCEPTED to choose between adding
4205: a dependency on Heimdal or MIT-krb5 for packages that require a Kerberos 5
4206: implementation.
4207:
4208: * motif.buildlink3.mk checks for a system-provided Motif installation or adds
1.126 leot 4209: a dependency on x11/lesstif or x11/motif. The user can set MOTIF_TYPE to "
4210: dt", "lesstif" or "motif" to choose which Motif version will be used.
1.1 dsieger 4211:
1.57 wiz 4212: * readline.buildlink3.mk checks for a system-provided GNU readline or
4213: editline (libedit) installation, or adds a dependency on devel/readline,
4214: devel/editline. The user can set READLINE_DEFAULT to choose readline
1.56 ryoon 4215: implementation. If your package really needs GNU readline library, its
4216: Makefile should include devel/readline/buildlink3.mk instead of
4217: readline.buildlink3.mk.
4218:
1.1 dsieger 4219: * oss.buildlink3.mk defines several variables that may be used by packages
4220: that use the Open Sound System (OSS) API.
4221:
1.36 wiz 4222: * pgsql.buildlink3.mk will accept any of the Postgres versions in the
4223: variable PGSQL_VERSIONS_ACCEPTED and default to the version
4224: PGSQL_VERSION_DEFAULT. See the file for more information.
1.1 dsieger 4225:
4226: * pthread.buildlink3.mk uses the value of PTHREAD_OPTS and checks for native
4227: pthreads or adds a dependency on devel/pth as needed.
4228:
4229: * xaw.buildlink3.mk uses the value of XAW_TYPE to choose a particular Athena
4230: widgets library.
4231:
4232: The comments in those buildlink3.mk files provide a more complete description
4233: of how to use them properly.
4234:
1.154 rillig 4235: 16.2. Writing buildlink3.mk files
1.1 dsieger 4236:
4237: A package's buildlink3.mk file is included by Makefiles to indicate the need to
4238: compile and link against header files and libraries provided by the package. A
4239: buildlink3.mk file should always provide enough information to add the correct
4240: type of dependency relationship and include any other buildlink3.mk files that
4241: it needs to find headers and libraries that it needs in turn.
4242:
4243: To generate an initial buildlink3.mk file for further editing, Rene Hexel's
4244: pkgtools/createbuildlink package is highly recommended. For most packages, the
4245: following command will generate a good starting point for buildlink3.mk files:
4246:
4247: % cd pkgsrc/category/pkgdir
4248: % createbuildlink >buildlink3.mk
4249:
4250:
1.154 rillig 4251: 16.2.1. Anatomy of a buildlink3.mk file
1.1 dsieger 4252:
4253: The following real-life example buildlink3.mk is taken from pkgsrc/graphics/
4254: tiff:
4255:
1.19 snj 4256: # $NetBSD: buildlink3.mk,v 1.16 2009/03/20 19:24:45 joerg Exp $
1.1 dsieger 4257:
1.19 snj 4258: BUILDLINK_TREE+= tiff
1.1 dsieger 4259:
1.19 snj 4260: .if !defined(TIFF_BUILDLINK3_MK)
4261: TIFF_BUILDLINK3_MK:=
1.1 dsieger 4262:
1.19 snj 4263: BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1
4264: BUILDLINK_ABI_DEPENDS.tiff+= tiff>=3.7.2nb1
1.1 dsieger 4265: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
4266:
4267: .include "../../devel/zlib/buildlink3.mk"
4268: .include "../../graphics/jpeg/buildlink3.mk"
1.19 snj 4269: .endif # TIFF_BUILDLINK3_MK
1.1 dsieger 4270:
1.19 snj 4271: BUILDLINK_TREE+= -tiff
1.1 dsieger 4272:
1.19 snj 4273: The header and footer manipulate BUILDLINK_TREE, which is common across all
4274: buildlink3.mk files and is used to track the dependency tree.
1.1 dsieger 4275:
1.19 snj 4276: The main section is protected from multiple inclusion and controls how the
1.1 dsieger 4277: dependency on pkg is added. Several important variables are set in the section:
4278:
4279: * BUILDLINK_API_DEPENDS.pkg is the actual dependency recorded in the
4280: installed package; this should always be set using += to ensure that we're
4281: appending to any pre-existing list of values. This variable should be set
1.27 wiz 4282: to the first version of the package that had an backwards-incompatible API
4283: change.
1.1 dsieger 4284:
4285: * BUILDLINK_PKGSRCDIR.pkg is the location of the pkg pkgsrc directory.
4286:
4287: * BUILDLINK_DEPMETHOD.pkg (not shown above) controls whether we use
4288: BUILD_DEPENDS or DEPENDS to add the dependency on pkg. The build dependency
4289: is selected by setting BUILDLINK_DEPMETHOD.pkg to "build". By default, the
4290: full dependency is used.
4291:
4292: * BUILDLINK_INCDIRS.pkg and BUILDLINK_LIBDIRS.pkg (not shown above) are lists
4293: of subdirectories of ${BUILDLINK_PREFIX.pkg} to add to the header and
4294: library search paths. These default to "include" and "lib" respectively.
4295:
4296: * BUILDLINK_CPPFLAGS.pkg (not shown above) is the list of preprocessor flags
4297: to add to CPPFLAGS, which are passed on to the configure and build phases.
4298: The "-I" option should be avoided and instead be handled using
4299: BUILDLINK_INCDIRS.pkg as above.
4300:
4301: The following variables are all optionally defined within this second section
4302: (protected against multiple inclusion) and control which package files are
4303: symlinked into ${BUILDLINK_DIR} and how their names are transformed during the
4304: symlinking:
4305:
4306: * BUILDLINK_FILES.pkg (not shown above) is a shell glob pattern relative to $
4307: {BUILDLINK_PREFIX.pkg} to be symlinked into ${BUILDLINK_DIR}, e.g. include/
4308: *.h.
4309:
4310: * BUILDLINK_FILES_CMD.pkg (not shown above) is a shell pipeline that outputs
4311: to stdout a list of files relative to ${BUILDLINK_PREFIX.pkg}. The
4312: resulting files are to be symlinked into ${BUILDLINK_DIR}. By default, this
4313: takes the +CONTENTS of a pkg and filters it through $
4314: {BUILDLINK_CONTENTS_FILTER.pkg}.
4315:
4316: * BUILDLINK_CONTENTS_FILTER.pkg (not shown above) is a filter command that
4317: filters +CONTENTS input into a list of files relative to $
1.84 wiz 4318: {BUILDLINK_PREFIX.pkg} on stdout. By default, BUILDLINK_CONTENTS_FILTER.pkg
4319: outputs the contents of the include and lib directories in the package
4320: +CONTENTS.
1.1 dsieger 4321:
4322: * BUILDLINK_FNAME_TRANSFORM.pkg (not shown above) is a list of sed arguments
4323: used to transform the name of the source filename into a destination
4324: filename, e.g. -e "s|/curses.h|/ncurses.h|g".
4325:
1.19 snj 4326: This section can additionally include any buildlink3.mk needed for pkg's
4327: library dependencies. Including these buildlink3.mk files means that the
4328: headers and libraries for these dependencies are also symlinked into $
4329: {BUILDLINK_DIR} whenever the pkg buildlink3.mk file is included. Dependencies
4330: are only added for directly include buildlink3.mk files.
1.1 dsieger 4331:
1.48 wiz 4332: When providing a buildlink3.mk and including other buildlink3.mk files in it,
1.51 wiz 4333: please only add necessary ones, i.e., those whose libraries or header files are
1.48 wiz 4334: automatically exposed when the package is use.
4335:
4336: In particular, if only an executable (bin/foo) is linked against a library,
4337: that library does not need to be propagated in the buildlink3.mk file.
4338:
4339: The following steps should help you decide if a buildlink3.mk file needs to be
4340: included:
4341:
4342: * Look at the installed header files: What headers do they include? The
4343: packages providing these files must be buildlinked.
4344:
1.50 wiz 4345: * Run ldd on all installed libraries and look against what other libraries
4346: they link. Some of the packages providing these probably need to be
4347: buildlinked; however, it's not automatic, since e.g. GTK on some systems
4348: pulls in the X libraries, so they will show up in the ldd output, while on
1.51 wiz 4349: others (like OS X) it won't. ldd output can thus only be used as a hint.
1.50 wiz 4350:
1.154 rillig 4351: 16.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
1.27 wiz 4352: buildlink3.mk files
1.1 dsieger 4353:
1.27 wiz 4354: These two variables differ in that one describes source compatibility (API) and
4355: the other binary compatibility (ABI). The difference is that a change in the
4356: API breaks compilation of programs while changes in the ABI stop compiled
4357: programs from running.
4358:
1.28 wiz 4359: Changes to the BUILDLINK_API_DEPENDS.pkg variable in a buildlink3.mk file
4360: happen very rarely. One possible reason is that all packages depending on this
4361: already need a newer version. In case it is bumped see the description below.
1.27 wiz 4362:
4363: The most common example of an ABI change is that the major version of a shared
4364: library is increased. In this case, BUILDLINK_ABI_DEPENDS.pkg should be
4365: adjusted to require at least the new package version. Then the packages that
4366: depend on this package need their PKGREVISIONs increased and, if they have
4367: buildlink3.mk files, their BUILDLINK_ABI_DEPENDS.pkg adjusted, too. This is
4368: needed so pkgsrc will require the correct package dependency and not settle for
4369: an older one when building the source.
1.1 dsieger 4370:
1.154 rillig 4371: See Section 21.1.5, "Handling dependencies" for more information about
1.1 dsieger 4372: dependencies on other packages, including the BUILDLINK_ABI_DEPENDS and
4373: ABI_DEPENDS definitions.
4374:
4375: Please take careful consideration before adjusting BUILDLINK_API_DEPENDS.pkg or
4376: BUILDLINK_ABI_DEPENDS.pkg as we don't want to cause unneeded package deletions
4377: and rebuilds. In many cases, new versions of packages work just fine with older
4378: dependencies.
4379:
4380: Also it is not needed to set BUILDLINK_ABI_DEPENDS.pkg when it is identical to
4381: BUILDLINK_API_DEPENDS.pkg.
4382:
1.154 rillig 4383: 16.3. Writing builtin.mk files
1.1 dsieger 4384:
4385: Some packages in pkgsrc install headers and libraries that coincide with
4386: headers and libraries present in the base system. Aside from a buildlink3.mk
4387: file, these packages should also include a builtin.mk file that includes the
4388: necessary checks to decide whether using the built-in software or the pkgsrc
4389: software is appropriate.
4390:
4391: The only requirements of a builtin.mk file for pkg are:
4392:
4393: 1. It should set USE_BUILTIN.pkg to either "yes" or "no" after it is included.
4394:
4395: 2. It should not override any USE_BUILTIN.pkg which is already set before the
4396: builtin.mk file is included.
4397:
4398: 3. It should be written to allow multiple inclusion. This is very important
4399: and takes careful attention to Makefile coding.
4400:
1.154 rillig 4401: 16.3.1. Anatomy of a builtin.mk file
1.1 dsieger 4402:
4403: The following is the recommended template for builtin.mk files:
4404:
4405: .if !defined(IS_BUILTIN.foo)
4406: #
4407: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
4408: # genuinely exists in the system or not.
4409: #
4410: IS_BUILTIN.foo?= no
4411:
4412: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
4413: # version can be determined.
4414: #
4415: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
4416: BUILTIN_PKG.foo?= foo-1.0
4417: . endif
4418: .endif # IS_BUILTIN.foo
4419:
4420: .if !defined(USE_BUILTIN.foo)
4421: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
4422: . if defined(BUILTIN_PKG.foo)
4423: . for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
4424: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
4425: USE_BUILTIN.foo!= \
4426: ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \
4427: && ${ECHO} "yes" || ${ECHO} "no"
4428: . endif
4429: . endfor
4430: . endif
4431: .endif # USE_BUILTIN.foo
4432:
4433: CHECK_BUILTIN.foo?= no
4434: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
4435: #
4436: # Here we place code that depends on whether USE_BUILTIN.foo is set to
4437: # "yes" or "no".
4438: #
4439: .endif # CHECK_BUILTIN.foo
4440:
4441: The first section sets IS_BUILTIN.pkg depending on if pkg really exists in the
4442: base system. This should not be a base system software with similar
4443: functionality to pkg; it should only be "yes" if the actual package is included
4444: as part of the base system. This variable is only used internally within the
4445: builtin.mk file.
4446:
4447: The second section sets BUILTIN_PKG.pkg to the version of pkg in the base
4448: system if it exists (if IS_BUILTIN.pkg is "yes"). This variable is only used
4449: internally within the builtin.mk file.
4450:
4451: The third section sets USE_BUILTIN.pkg and is required in all builtin.mk files.
4452: The code in this section must make the determination whether the built-in
4453: software is adequate to satisfy the dependencies listed in
4454: BUILDLINK_API_DEPENDS.pkg. This is typically done by comparing BUILTIN_PKG.pkg
1.25 wiz 4455: against each of the dependencies in BUILDLINK_API_DEPENDS.pkg. USE_BUILTIN.pkg
1.1 dsieger 4456: must be set to the correct value by the end of the builtin.mk file. Note that
4457: USE_BUILTIN.pkg may be "yes" even if IS_BUILTIN.pkg is "no" because we may make
4458: the determination that the built-in version of the software is similar enough
4459: to be used as a replacement.
4460:
4461: The last section is guarded by CHECK_BUILTIN.pkg, and includes code that uses
4462: the value of USE_BUILTIN.pkg set in the previous section. This typically
4463: includes, e.g., adding additional dependency restrictions and listing
4464: additional files to symlink into ${BUILDLINK_DIR} (via BUILDLINK_FILES.pkg).
4465:
1.154 rillig 4466: 16.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 4467:
4468: When building packages, it's possible to choose whether to set a global
4469: preference for using either the built-in (native) version or the pkgsrc version
4470: of software to satisfy a dependency. This is controlled by setting
1.25 wiz 4471: PREFER_PKGSRC and PREFER_NATIVE. These variables take values of either "yes", "
4472: no", or a list of packages. PREFER_PKGSRC tells pkgsrc to use the pkgsrc
1.1 dsieger 4473: versions of software, while PREFER_NATIVE tells pkgsrc to use the built-in
4474: versions. Preferences are determined by the most specific instance of the
4475: package in either PREFER_PKGSRC or PREFER_NATIVE. If a package is specified in
4476: neither or in both variables, then PREFER_PKGSRC has precedence over
4477: PREFER_NATIVE. For example, to require using pkgsrc versions of software for
4478: all but the most basic bits on a NetBSD system, you can set:
4479:
4480: PREFER_PKGSRC= yes
4481: PREFER_NATIVE= getopt skey tcp_wrappers
4482:
4483: A package must have a builtin.mk file to be listed in PREFER_NATIVE, otherwise
4484: it is simply ignored in that list.
4485:
1.117 sevan 4486: Setting PREFER_NATIVE should be performed straight after bootstrap and
4487: PREFER_PKGSRC during bootstrap. Switching between settings globally at a later
4488: date can introduce complications with dependency resolution. This is caused by
4489: packages built with the opposite preference being installed alongside each
4490: other.
4491:
4492: # ./bootstrap --prefer-pkgsrc yes
4493:
1.154 rillig 4494: Chapter 17. The pkginstall framework
1.1 dsieger 4495:
4496: Table of Contents
4497:
1.154 rillig 4498: 17.1. Files and directories outside the installation prefix
1.1 dsieger 4499:
1.154 rillig 4500: 17.1.1. Directory manipulation
4501: 17.1.2. File manipulation
1.1 dsieger 4502:
1.154 rillig 4503: 17.2. Configuration files
1.1 dsieger 4504:
1.154 rillig 4505: 17.2.1. How PKG_SYSCONFDIR is set
4506: 17.2.2. Telling the software where configuration files are
4507: 17.2.3. Patching installations
4508: 17.2.4. Disabling handling of configuration files
1.1 dsieger 4509:
1.154 rillig 4510: 17.3. System startup scripts
1.1 dsieger 4511:
1.154 rillig 4512: 17.3.1. Disabling handling of system startup scripts
1.1 dsieger 4513:
1.154 rillig 4514: 17.4. System users and groups
4515: 17.5. System shells
1.1 dsieger 4516:
1.154 rillig 4517: 17.5.1. Disabling shell registration
1.1 dsieger 4518:
1.154 rillig 4519: 17.6. Fonts
1.1 dsieger 4520:
1.154 rillig 4521: 17.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 4522:
4523: This chapter describes the framework known as pkginstall, whose key features
4524: are:
4525:
4526: * Generic installation and manipulation of directories and files outside the
4527: pkgsrc-handled tree, LOCALBASE.
4528:
4529: * Automatic handling of configuration files during installation, provided
4530: that packages are correctly designed.
4531:
4532: * Generation and installation of system startup scripts.
4533:
4534: * Registration of system users and groups.
4535:
4536: * Registration of system shells.
4537:
4538: * Automatic updating of fonts databases.
4539:
4540: The following sections inspect each of the above points in detail.
4541:
4542: You may be thinking that many of the things described here could be easily done
4543: with simple code in the package's post-installation target (post-install). This
4544: is incorrect, as the code in them is only executed when building from source.
4545: Machines using binary packages could not benefit from it at all (as the code
4546: itself could be unavailable). Therefore, the only way to achieve any of the
4547: items described above is by means of the installation scripts, which are
4548: automatically generated by pkginstall.
4549:
1.154 rillig 4550: 17.1. Files and directories outside the installation prefix
1.1 dsieger 4551:
4552: As you already know, the PLIST file holds a list of files and directories that
4553: belong to a package. The names used in it are relative to the installation
4554: prefix (${PREFIX}), which means that it cannot register files outside this
4555: directory (absolute path names are not allowed). Despite this restriction, some
4556: packages need to install files outside this location; e.g., under ${VARBASE} or
4557: ${PKG_SYSCONFDIR}. The only way to achieve this is to create such files during
4558: installation time by using installation scripts.
4559:
4560: The generic installation scripts are shell scripts that can contain arbitrary
4561: code. The list of scripts to execute is taken from the INSTALL_FILE variable,
4562: which defaults to INSTALL. A similar variable exists for package removal
4563: (DEINSTALL_FILE, whose default is DEINSTALL). These scripts can run arbitrary
4564: commands, so they have the potential to create and manage files anywhere in the
4565: file system.
4566:
4567: Using these general installation files is not recommended, but may be needed in
4568: some special cases. One reason for avoiding them is that the user has to trust
4569: the packager that there is no unwanted or simply erroneous code included in the
4570: installation script. Also, previously there were many similar scripts for the
4571: same functionality, and fixing a common error involved finding and changing all
4572: of them.
4573:
4574: The pkginstall framework offers another, standardized way. It provides generic
4575: scripts to abstract the manipulation of such files and directories based on
4576: variables set in the package's Makefile. The rest of this section describes
4577: these variables.
4578:
1.154 rillig 4579: 17.1.1. Directory manipulation
1.1 dsieger 4580:
4581: The following variables can be set to request the creation of directories
4582: anywhere in the file system:
4583:
4584: * MAKE_DIRS and OWN_DIRS contain a list of directories that should be created
4585: and should attempt to be destroyed by the installation scripts. The
4586: difference between the two is that the latter prompts the administrator to
4587: remove any directories that may be left after deinstallation (because they
1.108 rillig 4588: were not empty), while the former does not. Example:
4589:
4590: MAKE_DIRS+= ${VARBASE}/foo/private
1.1 dsieger 4591:
4592: * MAKE_DIRS_PERMS and OWN_DIRS_PERMS contain a list of tuples describing
4593: which directories should be created and should attempt to be destroyed by
4594: the installation scripts. Each tuple holds the following values, separated
4595: by spaces: the directory name, its owner, its group and its numerical mode.
4596: For example:
4597:
1.108 rillig 4598: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private \
4599: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 4600:
4601: The difference between the two is exactly the same as their non-PERMS
4602: counterparts.
4603:
1.154 rillig 4604: 17.1.2. File manipulation
1.1 dsieger 4605:
4606: Creating non-empty files outside the installation prefix is tricky because the
4607: PLIST forces all files to be inside it. To overcome this problem, the only
4608: solution is to extract the file in the known place (i.e., inside the
4609: installation prefix) and copy it to the appropriate location during
4610: installation (done by the installation scripts generated by pkginstall). We
4611: will call the former the master file in the following paragraphs, which
4612: describe the variables that can be used to automatically and consistently
4613: handle files outside the installation prefix:
4614:
1.31 wiz 4615: * CONF_FILES and REQD_FILES are pairs of master and target files. During
1.1 dsieger 4616: installation time, the master file is copied to the target one if and only
4617: if the latter does not exist. Upon deinstallation, the target file is
4618: removed provided that it was not modified by the installation.
4619:
4620: The difference between the two is that the latter prompts the administrator
4621: to remove any files that may be left after deinstallation (because they
4622: were not empty), while the former does not.
4623:
1.31 wiz 4624: * CONF_FILES_PERMS and REQD_FILES_PERMS contain tuples describing master
1.1 dsieger 4625: files as well as their target locations. For each of them, it also
4626: specifies their owner, their group and their numeric permissions, in this
4627: order. For example:
4628:
1.108 rillig 4629: REQD_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile \
4630: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 4631:
4632: The difference between the two is exactly the same as their non-PERMS
4633: counterparts.
4634:
1.154 rillig 4635: 17.2. Configuration files
1.1 dsieger 4636:
4637: Configuration files are special in the sense that they are installed in their
4638: own specific directory, PKG_SYSCONFDIR, and need special treatment during
4639: installation (most of which is automated by pkginstall). The main concept you
4640: must bear in mind is that files marked as configuration files are automatically
4641: copied to the right place (somewhere inside PKG_SYSCONFDIR) during installation
4642: if and only if they didn't exist before. Similarly, they will not be removed if
4643: they have local modifications. This ensures that administrators never lose any
4644: custom changes they may have made.
4645:
1.154 rillig 4646: 17.2.1. How PKG_SYSCONFDIR is set
1.1 dsieger 4647:
4648: As said before, the PKG_SYSCONFDIR variable specifies where configuration files
4649: shall be installed. Its contents are set based upon the following variables:
4650:
4651: * PKG_SYSCONFBASE: The configuration's root directory. Defaults to ${PREFIX}/
4652: etc although it may be overridden by the user to point to his preferred
4653: location (e.g., /etc, /etc/pkg, etc.). Packages must not use it directly.
4654:
4655: * PKG_SYSCONFSUBDIR: A subdirectory of PKG_SYSCONFBASE under which the
4656: configuration files for the package being built shall be installed. The
4657: definition of this variable only makes sense in the package's Makefile
4658: (i.e., it is not user-customizable).
4659:
1.68 asau 4660: As an example, consider the Apache package, www/apache24, which places its
1.1 dsieger 4661: configuration files under the httpd/ subdirectory of PKG_SYSCONFBASE. This
4662: should be set in the package Makefile.
4663:
4664: * PKG_SYSCONFVAR: Specifies the name of the variable that holds this
4665: package's configuration directory (if different from PKG_SYSCONFBASE). It
4666: defaults to PKGBASE's value, and is always prefixed with PKG_SYSCONFDIR.
4667:
4668: * PKG_SYSCONFDIR.${PKG_SYSCONFVAR}: Holds the directory where the
4669: configuration files for the package identified by PKG_SYSCONFVAR's shall be
4670: placed.
4671:
4672: Based on the above variables, pkginstall determines the value of
4673: PKG_SYSCONFDIR, which is the only variable that can be used within a package to
4674: refer to its configuration directory. The algorithm used to set its value is
4675: basically the following:
4676:
4677: 1. If PKG_SYSCONFDIR.${PKG_SYSCONFVAR} is set, its value is used.
4678:
4679: 2. If the previous variable is not defined but PKG_SYSCONFSUBDIR is set in the
4680: package's Makefile, the resulting value is ${PKG_SYSCONFBASE}/$
4681: {PKG_SYSCONFSUBDIR}.
4682:
4683: 3. Otherwise, it is set to ${PKG_SYSCONFBASE}.
4684:
4685: It is worth mentioning that ${PKG_SYSCONFDIR} is automatically added to
1.154 rillig 4686: OWN_DIRS. See Section 17.1.1, "Directory manipulation" what this means. This
1.16 jnemeth 4687: does not apply to subdirectories of ${PKG_SYSCONFDIR}, they still have to be
4688: created with OWN_DIRS or MAKE_DIRS.
1.1 dsieger 4689:
1.154 rillig 4690: 17.2.2. Telling the software where configuration files are
1.1 dsieger 4691:
4692: Given that pkgsrc (and users!) expect configuration files to be in a known
4693: place, you need to teach each package where it shall install its files. In some
4694: cases you will have to patch the package Makefiles to achieve it. If you are
4695: lucky, though, it may be as easy as passing an extra flag to the configuration
4696: script; this is the case of GNU Autoconf- generated files:
4697:
4698: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
4699:
4700: Note that this specifies where the package has to look for its configuration
4701: files, not where they will be originally installed (although the difference is
4702: never explicit, unfortunately).
4703:
1.154 rillig 4704: 17.2.3. Patching installations
1.1 dsieger 4705:
4706: As said before, pkginstall automatically handles configuration files. This
4707: means that the packages themselves must not touch the contents of $
4708: {PKG_SYSCONFDIR} directly. Bad news is that many software installation scripts
4709: will, out of the box, mess with the contents of that directory. So what is the
4710: correct procedure to fix this issue?
4711:
4712: You must teach the package (usually by manually patching it) to install any
4713: configuration files under the examples hierarchy, share/examples/${PKGBASE}/.
4714: This way, the PLIST registers them and the administrator always has the
4715: original copies available.
4716:
4717: Once the required configuration files are in place (i.e., under the examples
4718: hierarchy), the pkginstall framework can use them as master copies during the
4719: package installation to update what is in ${PKG_SYSCONFDIR}. To achieve this,
4720: the variables CONF_FILES and CONF_FILES_PERMS are used. Check out
1.154 rillig 4721: Section 17.1.2, "File manipulation" for information about their syntax and
1.1 dsieger 4722: their purpose. Here is an example, taken from the mail/mutt package:
4723:
4724: EGDIR= ${PREFIX}/share/doc/mutt/samples
4725: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
4726:
4727: Note that the EGDIR variable is specific to that package and has no meaning
4728: outside it.
4729:
1.154 rillig 4730: 17.2.4. Disabling handling of configuration files
1.1 dsieger 4731:
4732: The automatic copying of config files can be toggled by setting the environment
4733: variable PKG_CONFIG prior to package installation.
4734:
1.154 rillig 4735: 17.3. System startup scripts
1.1 dsieger 4736:
4737: System startup scripts are special files because they must be installed in a
4738: place known by the underlying OS, usually outside the installation prefix.
1.154 rillig 4739: Therefore, the same rules described in Section 17.1, "Files and directories
1.1 dsieger 4740: outside the installation prefix" apply, and the same solutions can be used.
4741: However, pkginstall provides a special mechanism to handle these files.
4742:
4743: In order to provide system startup scripts, the package has to:
4744:
4745: 1. Store the script inside ${FILESDIR}, with the .sh suffix appended.
4746: Considering the print/cups package as an example, it has a cupsd.sh in its
4747: files directory.
4748:
4749: 2. Tell pkginstall to handle it, appending the name of the script, without its
4750: extension, to the RCD_SCRIPTS variable. Continuing the previous example:
4751:
4752: RCD_SCRIPTS+= cupsd
4753:
4754: Once this is done, pkginstall will do the following steps for each script in an
4755: automated fashion:
4756:
4757: 1. Process the file found in the files directory applying all the
4758: substitutions described in the FILES_SUBST variable.
4759:
4760: 2. Copy the script from the files directory to the examples hierarchy, $
4761: {PREFIX}/share/examples/rc.d/. Note that this master file must be
4762: explicitly registered in the PLIST.
4763:
4764: 3. Add code to the installation scripts to copy the startup script from the
4765: examples hierarchy into the system-wide startup scripts directory.
4766:
1.154 rillig 4767: 17.3.1. Disabling handling of system startup scripts
1.1 dsieger 4768:
4769: The automatic copying of config files can be toggled by setting the environment
4770: variable PKG_RCD_SCRIPTS prior to package installation. Note that the scripts
4771: will be always copied inside the examples hierarchy, ${PREFIX}/share/examples/
4772: rc.d/, no matter what the value of this variable is.
4773:
1.154 rillig 4774: 17.4. System users and groups
1.1 dsieger 4775:
4776: If a package needs to create special users and/or groups during installation,
4777: it can do so by using the pkginstall framework.
4778:
4779: Users can be created by adding entries to the PKG_USERS variable. Each entry
4780: has the following syntax:
4781:
4782: user:group
4783:
4784: Further specification of user details may be done by setting per-user
4785: variables. PKG_UID.user is the numeric UID for the user. PKG_GECOS.user is the
4786: user's description or comment. PKG_HOME.user is the user's home directory, and
4787: defaults to /nonexistent if not specified. PKG_SHELL.user is the user's shell,
4788: and defaults to /sbin/nologin if not specified.
4789:
4790: Similarly, groups can be created by adding entries to the PKG_GROUPS variable,
4791: whose syntax is:
4792:
4793: group
4794:
4795: The numeric GID of the group may be set by defining PKG_GID.group.
4796:
4797: If a package needs to create the users and groups at an earlier stage, then it
1.116 wiz 4798: can set USERGROUP_PHASE to either configure,build, or pre-install to indicate
4799: the phase before which the users and groups are created. In this case, the
4800: numeric UIDs and GIDs of the created users and groups are automatically
4801: hardcoded into the final installation scripts.
1.1 dsieger 4802:
1.154 rillig 4803: 17.5. System shells
1.1 dsieger 4804:
4805: Packages that install system shells should register them in the shell database,
4806: /etc/shells, to make things easier to the administrator. This must be done from
4807: the installation scripts to keep binary packages working on any system.
4808: pkginstall provides an easy way to accomplish this task.
4809:
4810: When a package provides a shell interpreter, it has to set the PKG_SHELL
4811: variable to its absolute file name. This will add some hooks to the
4812: installation scripts to handle it. Consider the following example, taken from
4813: shells/zsh:
4814:
4815: PKG_SHELL= ${PREFIX}/bin/zsh
4816:
1.154 rillig 4817: 17.5.1. Disabling shell registration
1.1 dsieger 4818:
4819: The automatic registration of shell interpreters can be disabled by the
4820: administrator by setting the PKG_REGISTER_SHELLS environment variable to NO.
4821:
1.154 rillig 4822: 17.6. Fonts
1.1 dsieger 4823:
4824: Packages that install X11 fonts should update the database files that index the
4825: fonts within each fonts directory. This can easily be accomplished within the
4826: pkginstall framework.
4827:
4828: When a package installs X11 fonts, it must list the directories in which fonts
4829: are installed in the FONTS_DIRS.type variables, where type can be one of "ttf",
4830: "type1" or "x11". This will add hooks to the installation scripts to run the
4831: appropriate commands to update the fonts database files within each of those
4832: directories. For convenience, if the directory path is relative, it is taken to
4833: be relative to the package's installation prefix. Consider the following
4834: example, taken from fonts/dbz-ttf:
4835:
1.67 wiz 4836: FONTS_DIRS.ttf= ${PREFIX}/share/fonts/X11/TTF
1.1 dsieger 4837:
1.154 rillig 4838: 17.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 4839:
4840: The automatic update of fonts databases can be disabled by the administrator by
4841: setting the PKG_UPDATE_FONTS_DB environment variable to NO.
4842:
1.154 rillig 4843: Chapter 18. Options handling
1.1 dsieger 4844:
4845: Table of Contents
4846:
1.154 rillig 4847: 18.1. Global default options
4848: 18.2. Converting packages to use bsd.options.mk
4849: 18.3. Option Names
4850: 18.4. Determining the options of dependencies
1.1 dsieger 4851:
4852: Many packages have the ability to be built to support different sets of
4853: features. bsd.options.mk is a framework in pkgsrc that provides generic
4854: handling of those options that determine different ways in which the packages
4855: can be built. It's possible for the user to specify exactly which sets of
4856: options will be built into a package or to allow a set of global default
4857: options apply.
4858:
1.7 rillig 4859: There are two broad classes of behaviors that one might want to control via
4860: options. One is whether some particular feature is enabled in a program that
4861: will be built anyway, often by including or not including a dependency on some
4862: other package. The other is whether or not an additional program will be built
4863: as part of the package. Generally, it is better to make a split package for
4864: such additional programs instead of using options, because it enables binary
4865: packages to be built which can then be added separately. For example, the foo
4866: package might have minimal dependencies (those packages without which foo
4867: doesn't make sense), and then the foo-gfoo package might include the GTK
4868: frontend program gfoo. This is better than including a gtk option to foo that
4869: adds gfoo, because either that option is default, in which case binary users
4870: can't get foo without gfoo, or not default, in which case they can't get gfoo.
4871: With split packages, they can install foo without having GTK, and later decide
4872: to install gfoo (pulling in GTK at that time). This is an advantage to source
4873: users too, avoiding the need for rebuilds.
4874:
4875: Plugins with widely varying dependencies should usually be split instead of
4876: options.
4877:
4878: It is often more work to maintain split packages, especially if the upstream
4879: package does not support this. The decision of split vs. option should be made
4880: based on the likelihood that users will want or object to the various pieces,
4881: the size of the dependencies that are included, and the amount of work.
4882:
4883: A further consideration is licensing. Non-free parts, or parts that depend on
4884: non-free dependencies (especially plugins) should almost always be split if
4885: feasible.
4886:
1.154 rillig 4887: 18.1. Global default options
1.1 dsieger 4888:
4889: Global default options are listed in PKG_DEFAULT_OPTIONS, which is a list of
4890: the options that should be built into every package if that option is
1.4 rillig 4891: supported. This variable should be set in mk.conf.
1.1 dsieger 4892:
1.154 rillig 4893: 18.2. Converting packages to use bsd.options.mk
1.1 dsieger 4894:
4895: The following example shows how bsd.options.mk should be used by the
4896: hypothetical ``wibble'' package, either in the package Makefile, or in a file,
4897: e.g. options.mk, that is included by the main package Makefile.
4898:
4899: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
4900: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
4901: PKG_OPTIONS_OPTIONAL_GROUPS= database
4902: PKG_OPTIONS_GROUP.database= mysql pgsql
4903: PKG_SUGGESTED_OPTIONS= wibble-foo
4904: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
4905: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
4906:
4907: .include "../../mk/bsd.prefs.mk"
4908:
4909: # this package was previously named wibble2
4910: .if defined(PKG_OPTIONS.wibble2)
4911: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
4912: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
4913: "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead."
4914: .endif
4915:
4916: .include "../../mk/bsd.options.mk"
4917:
4918: # Package-specific option-handling
4919:
4920: ###
4921: ### FOO support
4922: ###
4923: .if !empty(PKG_OPTIONS:Mwibble-foo)
4924: CONFIGURE_ARGS+= --enable-foo
4925: .endif
4926:
4927: ###
4928: ### LDAP support
4929: ###
4930: .if !empty(PKG_OPTIONS:Mldap)
4931: . include "../../databases/openldap-client/buildlink3.mk"
4932: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client}
4933: .endif
4934:
4935: ###
4936: ### database support
4937: ###
4938: .if !empty(PKG_OPTIONS:Mmysql)
4939: . include "../../mk/mysql.buildlink3.mk"
4940: .endif
4941: .if !empty(PKG_OPTIONS:Mpgsql)
4942: . include "../../mk/pgsql.buildlink3.mk"
4943: .endif
4944:
4945: The first section contains the information about which build options are
4946: supported by the package, and any default options settings if needed.
4947:
4948: 1. PKG_OPTIONS_VAR is the name of the make(1) variable that the user can set
4949: to override the default options. It should be set to PKG_OPTIONS.pkgbase.
4950: Do not set it to PKG_OPTIONS.${PKGBASE}, since PKGBASE is not defined at
4951: the point where the options are processed.
4952:
4953: 2. PKG_SUPPORTED_OPTIONS is a list of build options supported by the package.
4954:
4955: 3. PKG_OPTIONS_OPTIONAL_GROUPS is a list of names of groups of mutually
4956: exclusive options. The options in each group are listed in
4957: PKG_OPTIONS_GROUP.groupname. The most specific setting of any option from
4958: the group takes precedence over all other options in the group. Options
4959: from the groups will be automatically added to PKG_SUPPORTED_OPTIONS.
4960:
4961: 4. PKG_OPTIONS_REQUIRED_GROUPS is like PKG_OPTIONS_OPTIONAL_GROUPS, but
4962: building the packages will fail if no option from the group is selected.
4963:
4964: 5. PKG_OPTIONS_NONEMPTY_SETS is a list of names of sets of options. At least
4965: one option from each set must be selected. The options in each set are
4966: listed in PKG_OPTIONS_SET.setname. Options from the sets will be
4967: automatically added to PKG_SUPPORTED_OPTIONS. Building the package will
4968: fail if no option from the set is selected.
4969:
4970: 6. PKG_SUGGESTED_OPTIONS is a list of build options which are enabled by
4971: default.
4972:
4973: 7. PKG_OPTIONS_LEGACY_VARS is a list of "USE_VARIABLE:option" pairs that map
1.4 rillig 4974: legacy mk.conf variables to their option counterparts. Pairs should be
1.1 dsieger 4975: added with "+=" to keep the listing of global legacy variables. A warning
4976: will be issued if the user uses a legacy variable.
4977:
4978: 8. PKG_OPTIONS_LEGACY_OPTS is a list of "old-option:new-option" pairs that map
4979: options that have been renamed to their new counterparts. Pairs should be
4980: added with "+=" to keep the listing of global legacy options. A warning
4981: will be issued if the user uses a legacy option.
4982:
4983: 9. PKG_LEGACY_OPTIONS is a list of options implied by deprecated variables
4984: used. This can be used for cases that neither PKG_OPTIONS_LEGACY_VARS nor
4985: PKG_OPTIONS_LEGACY_OPTS can handle, e. g. when PKG_OPTIONS_VAR is renamed.
4986:
4987: 10. PKG_OPTIONS_DEPRECATED_WARNINGS is a list of warnings about deprecated
4988: variables or options used, and what to use instead.
4989:
4990: A package should never modify PKG_DEFAULT_OPTIONS or the variable named in
4991: PKG_OPTIONS_VAR. These are strictly user-settable. To suggest a default set of
4992: options, use PKG_SUGGESTED_OPTIONS.
4993:
4994: PKG_OPTIONS_VAR must be defined before including bsd.options.mk. If none of
4995: PKG_SUPPORTED_OPTIONS, PKG_OPTIONS_OPTIONAL_GROUPS, and
4996: PKG_OPTIONS_REQUIRED_GROUPS are defined (as can happen with platform-specific
4997: options if none of them is supported on the current platform), PKG_OPTIONS is
4998: set to the empty list and the package is otherwise treated as not using the
4999: options framework.
5000:
5001: After the inclusion of bsd.options.mk, the variable PKG_OPTIONS contains the
5002: list of selected build options, properly filtered to remove unsupported and
5003: duplicate options.
5004:
5005: The remaining sections contain the logic that is specific to each option. The
5006: correct way to check for an option is to check whether it is listed in
5007: PKG_OPTIONS:
5008:
5009: .if !empty(PKG_OPTIONS:Moption)
5010:
1.154 rillig 5011: 18.3. Option Names
1.1 dsieger 5012:
5013: Options that enable similar features in different packages (like optional
5014: support for a library) should use a common name in all packages that support it
5015: (like the name of the library). If another package already has an option with
5016: the same meaning, use the same name.
5017:
5018: Options that enable features specific to one package, where it's unlikely that
5019: another (unrelated) package has the same (or a similar) optional feature,
5020: should use a name prefixed with pkgname-.
5021:
5022: If a group of related packages share an optional feature specific to that
5023: group, prefix it with the name of the "main" package (e. g.
5024: djbware-errno-hack).
5025:
5026: For new options, add a line to mk/defaults/options.description. Lines have two
5027: fields, separated by tab. The first field is the option name, the second its
5028: description. The description should be a whole sentence (starting with an
5029: uppercase letter and ending with a period) that describes what enabling the
5030: option does. E. g. "Enable ispell support." The file is sorted by option names.
5031:
1.154 rillig 5032: 18.4. Determining the options of dependencies
1.7 rillig 5033:
5034: When writing buildlink3.mk files, it is often necessary to list different
5035: dependencies based on the options with which the package was built. For
5036: querying these options, the file pkgsrc/mk/pkg-build-options.mk should be used.
5037: A typical example looks like this:
5038:
5039: pkgbase := libpurple
5040: .include "../../mk/pkg-build-options.mk"
5041:
5042: .if !empty(PKG_BUILD_OPTIONS.libpurple:Mdbus)
5043: ...
5044: .endif
5045:
5046: Including pkg-build-options.mk here will set the variable
5047: PKG_BUILD_OPTIONS.libpurple to the build options of the libpurple package,
5048: which can then be queried like PKG_OPTIONS in the options.mk file. See the file
5049: pkg-build-options.mk for more details.
5050:
1.154 rillig 5051: Chapter 19. The build process
1.1 dsieger 5052:
5053: Table of Contents
5054:
1.154 rillig 5055: 19.1. Introduction
5056: 19.2. Program location
5057: 19.3. Directories used during the build process
5058: 19.4. Running a phase
5059: 19.5. The fetch phase
5060:
5061: 19.5.1. What to fetch and where to get it from
5062: 19.5.2. How are the files fetched?
5063:
5064: 19.6. The checksum phase
5065: 19.7. The extract phase
5066: 19.8. The patch phase
5067: 19.9. The tools phase
5068: 19.10. The wrapper phase
5069: 19.11. The configure phase
5070: 19.12. The build phase
5071: 19.13. The test phase
5072: 19.14. The install phase
5073: 19.15. The package phase
5074: 19.16. Cleaning up
5075: 19.17. Other helpful targets
1.1 dsieger 5076:
1.154 rillig 5077: 19.1. Introduction
1.1 dsieger 5078:
5079: This chapter gives a detailed description on how a package is built. Building a
5080: package is separated into different phases (for example fetch, build, install),
1.19 snj 5081: all of which are described in the following sections. Each phase is split into
5082: so-called stages, which take the name of the containing phase, prefixed by one
5083: of pre-, do- or post-. (Examples are pre-configure, post-build.) Most of the
5084: actual work is done in the do-* stages.
1.1 dsieger 5085:
5086: Never override the regular targets (like fetch), if you have to, override the
5087: do-* ones instead.
5088:
5089: The basic steps for building a program are always the same. First the program's
5090: source (distfile) must be brought to the local system and then extracted. After
5091: any pkgsrc-specific patches to compile properly are applied, the software can
5092: be configured, then built (usually by compiling), and finally the generated
5093: binaries, etc. can be put into place on the system.
5094:
5095: To get more details about what is happening at each step, you can set the
5096: PKG_VERBOSE variable, or the PATCH_DEBUG variable if you are just interested in
5097: more details about the patch step.
5098:
1.154 rillig 5099: 19.2. Program location
1.1 dsieger 5100:
5101: Before outlining the process performed by the NetBSD package system in the next
5102: section, here's a brief discussion on where programs are installed, and which
5103: variables influence this.
5104:
5105: The automatic variable PREFIX indicates where all files of the final program
5106: shall be installed. It is usually set to LOCALBASE (/usr/pkg), or CROSSBASE for
5107: pkgs in the cross category. The value of PREFIX needs to be put into the
5108: various places in the program's source where paths to these files are encoded.
1.154 rillig 5109: See Section 13.3, "patches/*" and Section 21.3.1, "Shared libraries - libtool"
1.1 dsieger 5110: for more details.
5111:
5112: When choosing which of these variables to use, follow the following rules:
5113:
5114: * PREFIX always points to the location where the current pkg will be
1.25 wiz 5115: installed. When referring to a pkg's own installation path, use "${PREFIX}"
5116: .
1.1 dsieger 5117:
5118: * LOCALBASE is where all non-X11 pkgs are installed. If you need to construct
5119: a -I or -L argument to the compiler to find includes and libraries
5120: installed by another non-X11 pkg, use "${LOCALBASE}". The name LOCALBASE
5121: stems from FreeBSD, which installed all packages in /usr/local. As pkgsrc
5122: leaves /usr/local for the system administrator, this variable is a
5123: misnomer.
5124:
5125: * X11BASE is where the actual X11 distribution (from xsrc, etc.) is
5126: installed. When looking for standard X11 includes (not those installed by a
5127: package), use "${X11BASE}".
5128:
1.99 sevan 5129: * X11-based packages using imake must set USE_IMAKE to be installed correctly
5130: under LOCALBASE.
1.1 dsieger 5131:
5132: * Within ${PREFIX}, packages should install files according to hier(7), with
5133: the exception that manual pages go into ${PREFIX}/man, not ${PREFIX}/share/
5134: man.
5135:
1.154 rillig 5136: 19.3. Directories used during the build process
1.1 dsieger 5137:
1.14 jmcneill 5138: When building a package, various directories are used to store source files,
1.1 dsieger 5139: temporary files, pkgsrc-internal files, and so on. These directories are
5140: explained here.
5141:
5142: Some of the directory variables contain relative pathnames. There are two
5143: common base directories for these relative directories: PKGSRCDIR/PKGPATH is
5144: used for directories that are pkgsrc-specific. WRKSRC is used for directories
5145: inside the package itself.
5146:
5147: PKGSRCDIR
5148:
5149: This is an absolute pathname that points to the pkgsrc root directory.
5150: Generally, you don't need it.
5151:
5152: PKGDIR
5153:
5154: This is an absolute pathname that points to the current package.
5155:
5156: PKGPATH
5157:
5158: This is a pathname relative to PKGSRCDIR that points to the current
5159: package.
5160:
5161: WRKDIR
5162:
5163: This is an absolute pathname pointing to the directory where all work takes
5164: place. The distfiles are extracted to this directory. It also contains
5165: temporary directories and log files used by the various pkgsrc frameworks,
5166: like buildlink or the wrappers.
5167:
5168: WRKSRC
5169:
5170: This is an absolute pathname pointing to the directory where the distfiles
5171: are extracted. It is usually a direct subdirectory of WRKDIR, and often
5172: it's the only directory entry that isn't hidden. This variable may be
5173: changed by a package Makefile.
5174:
1.14 jmcneill 5175: The CREATE_WRKDIR_SYMLINK definition takes either the value yes or no and
1.15 rillig 5176: defaults to no. It indicates whether a symbolic link to the WRKDIR is to be
1.14 jmcneill 5177: created in the pkgsrc entry's directory. If users would like to have their
5178: pkgsrc trees behave in a read-only manner, then the value of
5179: CREATE_WRKDIR_SYMLINK should be set to no.
5180:
1.154 rillig 5181: 19.4. Running a phase
1.1 dsieger 5182:
5183: You can run a particular phase by typing make phase, where phase is the name of
5184: the phase. This will automatically run all phases that are required for this
5185: phase. The default phase is build, that is, when you run make without
5186: parameters in a package directory, the package will be built, but not
5187: installed.
5188:
1.154 rillig 5189: 19.5. The fetch phase
1.1 dsieger 5190:
5191: The first step in building a package is to fetch the distribution files
1.25 wiz 5192: (distfiles) from the sites that are providing them. This is the task of the
1.1 dsieger 5193: fetch phase.
5194:
1.154 rillig 5195: 19.5.1. What to fetch and where to get it from
1.1 dsieger 5196:
5197: In simple cases, MASTER_SITES defines all URLs from where the distfile, whose
5198: name is derived from the DISTNAME variable, is fetched. The more complicated
5199: cases are described below.
5200:
5201: The variable DISTFILES specifies the list of distfiles that have to be fetched.
1.66 asau 5202: Its value defaults to ${DEFAULT_DISTFILES} and its value is ${DISTNAME}$
5203: {EXTRACT_SUFX}, so that most packages don't need to define it at all.
5204: EXTRACT_SUFX is .tar.gz by default, but can be changed freely. Note that if
5205: your package requires additional distfiles to the default one, you cannot just
5206: append the additional filenames using the += operator, but you have write for
5207: example:
1.1 dsieger 5208:
1.66 asau 5209: DISTFILES= ${DEFAULT_DISTFILES} additional-files.tar.gz
1.1 dsieger 5210:
5211: Each distfile is fetched from a list of sites, usually MASTER_SITES. If the
5212: package has multiple DISTFILES or multiple PATCHFILES from different sites, you
5213: can set SITES.distfile to the list of URLs where the file distfile (including
5214: the suffix) can be found.
5215:
5216: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
5217: DISTFILES+= foo-file.tar.gz
5218: SITES.foo-file.tar.gz= \
1.174 leot 5219: https://www.somewhere.com/somehow/ \
5220: https://www.somewhereelse.com/mirror/somehow/
1.1 dsieger 5221:
5222: When actually fetching the distfiles, each item from MASTER_SITES or SITES.*
5223: gets the name of each distfile appended to it, without an intermediate slash.
5224: Therefore, all site values have to end with a slash or other separator
5225: character. This allows for example to set MASTER_SITES to a URL of a CGI script
5226: that gets the name of the distfile as a parameter. In this case, the definition
5227: would look like:
5228:
1.174 leot 5229: MASTER_SITES= https://www.example.com/download.cgi?file=
1.1 dsieger 5230:
1.23 jakllsch 5231: The exception to this rule are URLs starting with a dash. In that case the URL
5232: is taken as is, fetched and the result stored under the name of the distfile.
1.66 asau 5233: You can use this style for the case when the download URL style does not match
5234: the above common case. For example, if permanent download URL is a redirector
5235: to the real download URL, or the download file name is offered by an HTTP
5236: Content-Disposition header. In the following example, foo-1.0.0.tar.gz will be
5237: created instead of the default v1.0.0.tar.gz.
5238:
5239: DISTNAME= foo-1.0.0
1.174 leot 5240: MASTER_SITES= -https://www.example.com/archive/v1.0.0.tar.gz
1.23 jakllsch 5241:
1.1 dsieger 5242: There are some predefined values for MASTER_SITES, which can be used in
5243: packages. The names of the variables should speak for themselves.
5244:
1.156 leot 5245: MASTER_SITE_APACHE MASTER_SITE_BACKUP
5246: MASTER_SITE_CRATESIO MASTER_SITE_CYGWIN
5247: MASTER_SITE_DEBIAN MASTER_SITE_FREEBSD
5248: MASTER_SITE_FREEBSD_LOCAL MASTER_SITE_GENTOO
5249: MASTER_SITE_GITHUB MASTER_SITE_GNOME
5250: MASTER_SITE_GNU MASTER_SITE_GNUSTEP
5251: MASTER_SITE_HASKELL_HACKAGE MASTER_SITE_IFARCHIVE
5252: MASTER_SITE_KDE MASTER_SITE_MOZILLA
5253: MASTER_SITE_MOZILLA_ALL MASTER_SITE_MYSQL
5254: MASTER_SITE_NETLIB MASTER_SITE_OPENBSD
5255: MASTER_SITE_OPENOFFICE MASTER_SITE_OSDN
5256: MASTER_SITE_PERL_CPAN MASTER_SITE_PGSQL
5257: MASTER_SITE_PYPI MASTER_SITE_RUBYGEMS
5258: MASTER_SITE_R_CRAN MASTER_SITE_SOURCEFORGE
5259: MASTER_SITE_SUNSITE MASTER_SITE_SUSE
5260: MASTER_SITE_TEX_CTAN MASTER_SITE_XCONTRIB
5261: MASTER_SITE_XEMACS MASTER_SITE_XORG
1.1 dsieger 5262:
5263: Some explanations for the less self-explaining ones: MASTER_SITE_BACKUP
5264: contains backup sites for packages that are maintained in ftp://ftp.NetBSD.org/
1.27 wiz 5265: pub/pkgsrc/distfiles/${DIST_SUBDIR}. MASTER_SITE_LOCAL contains local package
1.26 spz 5266: source distributions that are maintained in ftp://ftp.NetBSD.org/pub/pkgsrc/
5267: distfiles/LOCAL_PORTS/.
1.1 dsieger 5268:
5269: If you choose one of these predefined sites, you may want to specify a
5270: subdirectory of that site. Since these macros may expand to more than one
5271: actual site, you must use the following construct to specify a subdirectory:
5272:
5273: MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/}
5274: MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=project_name/}
5275:
5276: Note the trailing slash after the subdirectory name.
5277:
1.154 rillig 5278: 19.5.2. How are the files fetched?
1.1 dsieger 5279:
5280: The fetch phase makes sure that all the distfiles exist in a local directory
5281: (DISTDIR, which can be set by the pkgsrc user). If the files do not exist, they
5282: are fetched using commands of the form
5283:
5284: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
5285:
5286: where ${site} varies through several possibilities in turn: first,
5287: MASTER_SITE_OVERRIDE is tried, then the sites specified in either SITES.file if
5288: defined, else MASTER_SITES or PATCH_SITES, as applies, then finally the value
5289: of MASTER_SITE_BACKUP. The order of all except the first and the last can be
5290: optionally sorted by the user, via setting either MASTER_SORT_RANDOM, and
5291: MASTER_SORT_AWK or MASTER_SORT_REGEX.
5292:
1.16 jnemeth 5293: The specific command and arguments used depend on the FETCH_USING parameter.
5294: The example above is for FETCH_USING=custom.
5295:
1.1 dsieger 5296: The distfiles mirror run by the NetBSD Foundation uses the mirror-distfiles
5297: target to mirror the distfiles, if they are freely distributable. Packages
5298: setting NO_SRC_ON_FTP (usually to "${RESTRICTED}") will not have their
5299: distfiles mirrored.
5300:
1.154 rillig 5301: 19.6. The checksum phase
1.1 dsieger 5302:
5303: After the distfile(s) are fetched, their checksum is generated and compared
5304: with the checksums stored in the distinfo file. If the checksums don't match,
5305: the build is aborted. This is to ensure the same distfile is used for building,
5306: and that the distfile wasn't changed, e.g. by some malign force, deliberately
5307: changed distfiles on the master distribution site or network lossage.
5308:
1.154 rillig 5309: 19.7. The extract phase
1.1 dsieger 5310:
5311: When the distfiles are present on the local system, they need to be extracted,
5312: as they usually come in the form of some compressed archive format.
5313:
5314: By default, all DISTFILES are extracted. If you only need some of them, you can
5315: set the EXTRACT_ONLY variable to the list of those files.
5316:
5317: Extracting the files is usually done by a little program, mk/extract/extract,
5318: which already knows how to extract various archive formats, so most likely you
5319: will not need to change anything here. But if you need, the following variables
5320: may help you:
5321:
5322: EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}
5323:
5324: Use these variables to override the default options for an extract command,
5325: which are defined in mk/extract/extract.
5326:
5327: EXTRACT_USING
5328:
1.14 jmcneill 5329: This variable can be set to bsdtar, gtar, nbtar (which is the default
5330: value), pax, or an absolute pathname pointing to the command with which tar
5331: archives should be extracted. It is preferred to choose bsdtar over gtar if
5332: NetBSD's pax-as-tar is not good enough.
1.1 dsieger 5333:
5334: If the extract program doesn't serve your needs, you can also override the
5335: EXTRACT_CMD variable, which holds the command used for extracting the files.
5336: This command is executed in the ${WRKSRC} directory. During execution of this
5337: command, the shell variable extract_file holds the absolute pathname of the
5338: file that is going to be extracted.
5339:
5340: And if that still does not suffice, you can override the do-extract target in
5341: the package Makefile.
5342:
1.154 rillig 5343: 19.8. The patch phase
1.1 dsieger 5344:
5345: After extraction, all the patches named by the PATCHFILES, those present in the
5346: patches subdirectory of the package as well as in $LOCALPATCHES/$PKGPATH (e.g.
5347: /usr/local/patches/graphics/png) are applied. Patchfiles ending in .Z or .gz
5348: are uncompressed before they are applied, files ending in .orig or .rej are
5349: ignored. Any special options to patch(1) can be handed in PATCH_DIST_ARGS. See
1.154 rillig 5350: Section 13.3, "patches/*" for more details.
1.1 dsieger 5351:
1.180 rillig 5352: By default patch(1) is given special arguments to make it fail if the expected
5353: text from the patch context is not found in the patched file. If that happens,
5354: fix the patch file by comparing it with the actual text in the file to be
5355: patched.
1.1 dsieger 5356:
1.154 rillig 5357: 19.9. The tools phase
1.1 dsieger 5358:
1.154 rillig 5359: This is covered in Chapter 20, Tools needed for building or running.
1.1 dsieger 5360:
1.154 rillig 5361: 19.10. The wrapper phase
1.1 dsieger 5362:
5363: This phase creates wrapper programs for the compilers and linkers. The
5364: following variables can be used to tweak the wrappers.
5365:
5366: ECHO_WRAPPER_MSG
5367:
5368: The command used to print progress messages. Does nothing by default. Set
5369: to ${ECHO} to see the progress messages.
5370:
5371: WRAPPER_DEBUG
5372:
5373: This variable can be set to yes (default) or no, depending on whether you
5374: want additional information in the wrapper log file.
5375:
5376: WRAPPER_UPDATE_CACHE
5377:
5378: This variable can be set to yes or no, depending on whether the wrapper
5379: should use its cache, which will improve the speed. The default value is
5380: yes, but is forced to no if the platform does not support it.
5381:
5382: WRAPPER_REORDER_CMDS
5383:
5384: A list of reordering commands. A reordering command has the form reorder:l:
5385: lib1:lib2. It ensures that that -llib1 occurs before -llib2.
5386:
1.154 rillig 5387: 19.11. The configure phase
1.1 dsieger 5388:
5389: Most pieces of software need information on the header files, system calls, and
5390: library routines which are available on the platform they run on. The process
5391: of determining this information is known as configuration, and is usually
5392: automated. In most cases, a script is supplied with the distfiles, and its
5393: invocation results in generation of header files, Makefiles, etc.
5394:
5395: If the package contains a configure script, this can be invoked by setting
5396: HAS_CONFIGURE to "yes". If the configure script is a GNU autoconf script, you
5397: should set GNU_CONFIGURE to "yes" instead. What happens in the configure phase
5398: is roughly:
5399:
5400: .for d in ${CONFIGURE_DIRS}
5401: cd ${WRKSRC} \
5402: && cd ${d} \
5403: && env ${CONFIGURE_ENV} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
5404: .endfor
5405:
5406: CONFIGURE_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In
5407: each of these directories, the configure script is run with the environment
5408: CONFIGURE_ENV and arguments CONFIGURE_ARGS. The variables CONFIGURE_ENV,
5409: CONFIGURE_SCRIPT (default: "./configure") and CONFIGURE_ARGS may all be changed
5410: by the package.
5411:
1.38 wiz 5412: If the program uses the Perl way of configuration (mainly Perl modules, but not
5413: only), i.e. a file called Makefile.PL, it should include ../../lang/perl5/
5414: module.mk. To set any parameter for Makefile.PL use the MAKE_PARAMS variable
5415: (e.g., MAKE_PARAMS+=foo=bar
5416:
1.1 dsieger 5417: If the program uses an Imakefile for configuration, the appropriate steps can
1.99 sevan 5418: be invoked by setting USE_IMAKE to "yes". If you only need xmkmf, add it to
5419: USE_TOOLS. You can add variables to xmkmf's environment by adding them to the
5420: SCRIPTS_ENV variable.
1.1 dsieger 5421:
1.11 rillig 5422: If the program uses cmake for configuration, the appropriate steps can be
5423: invoked by setting USE_CMAKE to "yes". You can add variables to cmake's
5424: environment by adding them to the CONFIGURE_ENV variable and arguments to cmake
5425: by adding them to the CMAKE_ARGS variable. The top directory argument is given
5426: by the CMAKE_ARG_PATH variable, that defaults to "." (relative to
5427: CONFIGURE_DIRS)
5428:
1.1 dsieger 5429: If there is no configure step at all, set NO_CONFIGURE to "yes".
5430:
1.154 rillig 5431: 19.12. The build phase
1.1 dsieger 5432:
5433: For building a package, a rough equivalent of the following code is executed.
5434:
5435: .for d in ${BUILD_DIRS}
5436: cd ${WRKSRC} \
5437: && cd ${d} \
5438: && env ${MAKE_ENV} \
5439: ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
5440: -f ${MAKE_FILE} \
5441: ${BUILD_TARGET}
5442: .endfor
5443:
5444: BUILD_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In each of
5445: these directories, MAKE_PROGRAM is run with the environment MAKE_ENV and
5446: arguments BUILD_MAKE_FLAGS. The variables MAKE_ENV, BUILD_MAKE_FLAGS, MAKE_FILE
5447: and BUILD_TARGET may all be changed by the package.
5448:
1.25 wiz 5449: The default value of MAKE_PROGRAM is "gmake" if USE_TOOLS contains "gmake", "
5450: make" otherwise. The default value of MAKE_FILE is "Makefile", and BUILD_TARGET
5451: defaults to "all".
1.1 dsieger 5452:
5453: If there is no build step at all, set NO_BUILD to "yes".
5454:
1.154 rillig 5455: 19.13. The test phase
1.1 dsieger 5456:
5457: [TODO]
5458:
1.154 rillig 5459: 19.14. The install phase
1.1 dsieger 5460:
5461: Once the build stage has completed, the final step is to install the software
5462: in public directories, so users can access the programs and files.
5463:
5464: In the install phase, a rough equivalent of the following code is executed.
5465: Additionally, before and after this code, much magic is performed to do
5466: consistency checks, registering the package, and so on.
5467:
5468: .for d in ${INSTALL_DIRS}
5469: cd ${WRKSRC} \
5470: && cd ${d} \
5471: && env ${MAKE_ENV} \
5472: ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \
5473: -f ${MAKE_FILE} \
5474: ${INSTALL_TARGET}
5475: .endfor
5476:
5477: The variable's meanings are analogous to the ones in the build phase.
5478: INSTALL_DIRS defaults to BUILD_DIRS. INSTALL_TARGET is "install" by default,
5479: plus "install.man" if USE_IMAKE is defined and NO_INSTALL_MANPAGES is not
5480: defined.
5481:
5482: In the install phase, the following variables are useful. They are all
5483: variations of the install(1) command that have the owner, group and permissions
5484: preset. INSTALL is the plain install command. The specialized variants,
5485: together with their intended use, are:
5486:
5487: INSTALL_PROGRAM_DIR
5488:
5489: directories that contain binaries
5490:
5491: INSTALL_SCRIPT_DIR
5492:
5493: directories that contain scripts
5494:
5495: INSTALL_LIB_DIR
5496:
5497: directories that contain shared and static libraries
5498:
5499: INSTALL_DATA_DIR
5500:
5501: directories that contain data files
5502:
5503: INSTALL_MAN_DIR
5504:
5505: directories that contain man pages
5506:
1.100 leot 5507: INSTALL_GAME_DIR
5508:
5509: directories that contain data files for games
5510:
1.1 dsieger 5511: INSTALL_PROGRAM
5512:
5513: binaries that can be stripped from debugging symbols
5514:
5515: INSTALL_SCRIPT
5516:
5517: binaries that cannot be stripped
5518:
5519: INSTALL_GAME
5520:
5521: game binaries
5522:
5523: INSTALL_LIB
5524:
5525: shared and static libraries
5526:
5527: INSTALL_DATA
5528:
5529: data files
5530:
5531: INSTALL_GAME_DATA
5532:
5533: data files for games
5534:
5535: INSTALL_MAN
5536:
5537: man pages
5538:
5539: Some other variables are:
5540:
1.106 tnn 5541: INSTALL_UNSTRIPPED
5542:
5543: If set to yes, do not run strip(1) when installing binaries. Any debugging
5544: sections and symbols present in binaries will be preserved.
5545:
1.1 dsieger 5546: INSTALLATION_DIRS
5547:
5548: A list of directories relative to PREFIX that are created by pkgsrc at the
5549: beginning of the install phase. The package is supposed to create all
5550: needed directories itself before installing files to it and list all other
5551: directories here.
5552:
1.25 wiz 5553: In the rare cases that a package shouldn't install anything, set NO_INSTALL to
1.1 dsieger 5554: "yes". This is mostly relevant for packages in the regress category.
5555:
1.154 rillig 5556: 19.15. The package phase
1.1 dsieger 5557:
5558: Once the install stage has completed, a binary package of the installed files
5559: can be built. These binary packages can be used for quick installation without
5560: previous compilation, e.g. by the make bin-install or by using pkg_add.
5561:
5562: By default, the binary packages are created in ${PACKAGES}/All and symlinks are
5563: created in ${PACKAGES}/category, one for each category in the CATEGORIES
5564: variable. PACKAGES defaults to pkgsrc/packages.
5565:
1.154 rillig 5566: 19.16. Cleaning up
1.1 dsieger 5567:
5568: Once you're finished with a package, you can clean the work directory by
5569: running make clean. If you want to clean the work directories of all
5570: dependencies too, use make clean-depends.
5571:
1.154 rillig 5572: 19.17. Other helpful targets
1.1 dsieger 5573:
5574: pre/post-*
5575:
5576: For any of the main targets described in the previous section, two
5577: auxiliary targets exist with "pre-" and "post-" used as a prefix for the
5578: main target's name. These targets are invoked before and after the main
5579: target is called, allowing extra configuration or installation steps be
5580: performed from a package's Makefile, for example, which a program's
5581: configure script or install target omitted.
5582:
5583: do-*
5584:
5585: Should one of the main targets do the wrong thing, and should there be no
5586: variable to fix this, you can redefine it with the do-* target. (Note that
5587: redefining the target itself instead of the do-* target is a bad idea, as
5588: the pre-* and post-* targets won't be called anymore, etc.) You will not
5589: usually need to do this.
5590:
5591: reinstall
5592:
5593: If you did a make install and you noticed some file was not installed
5594: properly, you can repeat the installation with this target, which will
5595: ignore the "already installed" flag.
5596:
5597: This is the default value of DEPENDS_TARGET except in the case of make
5598: update and make package, where the defaults are "package" and "update",
5599: respectively.
5600:
5601: deinstall
5602:
5603: This target does a pkg_delete(1) in the current directory, effectively
5604: de-installing the package. The following variables can be used to tune the
5605: behaviour:
5606:
5607: PKG_VERBOSE
5608:
5609: Add a "-v" to the pkg_delete(1) command.
5610:
5611: DEINSTALLDEPENDS
5612:
5613: Remove all packages that require (depend on) the given package. This
5614: can be used to remove any packages that may have been pulled in by a
5615: given package, e.g. if make deinstall DEINSTALLDEPENDS=1 is done in
1.25 wiz 5616: pkgsrc/x11/kde, this is likely to remove whole KDE. Works by adding "-R
5617: " to the pkg_delete(1) command line.
1.1 dsieger 5618:
5619: bin-install
5620:
5621: Install a binary package from local disk and via FTP from a list of sites
5622: (see the BINPKG_SITES variable), and do a make package if no binary package
5623: is available anywhere. The arguments given to pkg_add can be set via
5624: BIN_INSTALL_FLAGS e.g., to do verbose operation, etc.
5625:
1.95 wiz 5626: install-clean
5627:
5628: This target removes the state files for the "install" and later phases so
5629: that the "install" target may be re-invoked. This can be used after editing
5630: the PLIST to install the package without rebuilding it.
5631:
5632: build-clean
5633:
5634: This target removes the state files for the "build" and later phases so
5635: that the "build" target may be re-invoked.
5636:
1.1 dsieger 5637: update
5638:
5639: This target causes the current package to be updated to the latest version.
5640: The package and all depending packages first get de-installed, then current
5641: versions of the corresponding packages get compiled and installed. This is
5642: similar to manually noting which packages are currently installed, then
5643: performing a series of make deinstall and make install (or whatever
5644: UPDATE_TARGET is set to) for these packages.
5645:
5646: You can use the "update" target to resume package updating in case a
5647: previous make update was interrupted for some reason. However, in this
5648: case, make sure you don't call make clean or otherwise remove the list of
5649: dependent packages in WRKDIR. Otherwise, you lose the ability to
5650: automatically update the current package along with the dependent packages
5651: you have installed.
5652:
5653: Resuming an interrupted make update will only work as long as the package
5654: tree remains unchanged. If the source code for one of the packages to be
5655: updated has been changed, resuming make update will most certainly fail!
5656:
1.4 rillig 5657: The following variables can be used either on the command line or in
1.1 dsieger 5658: mk.conf to alter the behaviour of make update:
5659:
5660: UPDATE_TARGET
5661:
5662: Install target to recursively use for the updated package and the
5663: dependent packages. Defaults to DEPENDS_TARGET if set, "install"
1.25 wiz 5664: otherwise for make update. Other good targets are "package" or "
5665: bin-install". Do not set this to "update" or you will get stuck in an
1.1 dsieger 5666: endless loop!
5667:
5668: NOCLEAN
5669:
5670: Don't clean up after updating. Useful if you want to leave the work
5671: sources of the updated packages around for inspection or other
1.25 wiz 5672: purposes. Be sure you eventually clean up the source tree (see the "
5673: clean-update" target below) or you may run into troubles with old
1.1 dsieger 5674: source code still lying around on your next make or make update.
5675:
5676: REINSTALL
5677:
5678: Deinstall each package before installing (making DEPENDS_TARGET). This
5679: may be necessary if the "clean-update" target (see below) was called
5680: after interrupting a running make update.
5681:
5682: DEPENDS_TARGET
5683:
5684: Allows you to disable recursion and hardcode the target for packages.
5685: The default is "update" for the update target, facilitating a recursive
5686: update of prerequisite packages. Only set DEPENDS_TARGET if you want to
5687: disable recursive updates. Use UPDATE_TARGET instead to just set a
5688: specific target for each package to be installed during make update
5689: (see above).
5690:
5691: clean-update
5692:
5693: Clean the source tree for all packages that would get updated if make
5694: update was called from the current directory. This target should not be
5695: used if the current package (or any of its depending packages) have already
5696: been de-installed (e.g., after calling make update) or you may lose some
1.25 wiz 5697: packages you intended to update. As a rule of thumb: only use this target
1.1 dsieger 5698: before the first time you run make update and only if you have a dirty
5699: package tree (e.g., if you used NOCLEAN).
5700:
5701: If you are unsure about whether your tree is clean, you can either perform
5702: a make clean at the top of the tree, or use the following sequence of
5703: commands from the directory of the package you want to update (before
5704: running make update for the first time, otherwise you lose all the packages
5705: you wanted to update!):
5706:
5707: # make clean-update
5708: # make clean CLEANDEPENDS=YES
5709: # make update
5710:
5711:
1.4 rillig 5712: The following variables can be used either on the command line or in
1.1 dsieger 5713: mk.conf to alter the behaviour of make clean-update:
5714:
5715: CLEAR_DIRLIST
5716:
5717: After make clean, do not reconstruct the list of directories to update
5718: for this package. Only use this if make update successfully installed
5719: all packages you wanted to update. Normally, this is done automatically
5720: on make update, but may have been suppressed by the NOCLEAN variable
5721: (see above).
5722:
5723: replace
5724:
5725: Update the installation of the current package. This differs from update in
5726: that it does not replace dependent packages. You will need to install
5727: pkgtools/pkg_tarup for this target to work.
5728:
5729: Be careful when using this target! There are no guarantees that dependent
5730: packages will still work, in particular they will most certainly break if
5731: you make replace a library package whose shared library major version
5732: changed between your installed version and the new one. For this reason,
5733: this target is not officially supported and only recommended for advanced
5734: users.
5735:
5736: info
5737:
5738: This target invokes pkg_info(1) for the current package. You can use this
5739: to check which version of a package is installed.
5740:
5741: index
5742:
5743: This is a top-level command, i.e. it should be used in the pkgsrc
5744: directory. It creates a database of all packages in the local pkgsrc tree,
5745: including dependencies, comment, maintainer, and some other useful
5746: information. Individual entries are created by running make describe in the
5747: packages' directories. This index file is saved as pkgsrc/INDEX. It can be
5748: displayed in verbose format by running make print-index. You can search in
5749: it with make search key=something. You can extract a list of all packages
5750: that depend on a particular one by running make show-deps PKG=somepackage.
5751:
5752: Running this command takes a very long time, some hours even on fast
5753: machines!
5754:
5755: readme
5756:
5757: This target generates a README.html file, which can be viewed using a
5758: browser such as www/firefox or www/links. The generated files contain
5759: references to any packages which are in the PACKAGES directory on the local
5760: host. The generated files can be made to refer to URLs based on
5761: FTP_PKG_URL_HOST and FTP_PKG_URL_DIR. For example, if I wanted to generate
5762: README.html files which pointed to binary packages on the local machine, in
5763: the directory /usr/packages, set FTP_PKG_URL_HOST=file://localhost and
5764: FTP_PKG_URL_DIR=/usr/packages. The ${PACKAGES} directory and its
5765: subdirectories will be searched for all the binary packages.
5766:
5767: The target can be run at the toplevel or in category directories, in which
5768: case it descends recursively.
5769:
5770: readme-all
5771:
5772: This is a top-level command, run it in pkgsrc. Use this target to create a
5773: file README-all.html which contains a list of all packages currently
5774: available in the NetBSD Packages Collection, together with the category
5775: they belong to and a short description. This file is compiled from the
5776: pkgsrc/*/README.html files, so be sure to run this after a make readme.
5777:
5778: cdrom-readme
5779:
5780: This is very much the same as the "readme" target (see above), but is to be
5781: used when generating a pkgsrc tree to be written to a CD-ROM. This target
5782: also produces README.html files, and can be made to refer to URLs based on
5783: CDROM_PKG_URL_HOST and CDROM_PKG_URL_DIR.
5784:
5785: show-distfiles
5786:
5787: This target shows which distfiles and patchfiles are needed to build the
5788: package (ALLFILES, which contains all DISTFILES and PATCHFILES, but not
5789: patches/*).
5790:
5791: show-downlevel
5792:
5793: This target shows nothing if the package is not installed. If a version of
5794: this package is installed, but is not the version provided in this version
5795: of pkgsrc, then a warning message is displayed. This target can be used to
5796: show which of your installed packages are downlevel, and so the old
5797: versions can be deleted, and the current ones added.
5798:
5799: show-pkgsrc-dir
5800:
5801: This target shows the directory in the pkgsrc hierarchy from which the
5802: package can be built and installed. This may not be the same directory as
5803: the one from which the package was installed. This target is intended to be
5804: used by people who may wish to upgrade many packages on a single host, and
1.25 wiz 5805: can be invoked from the top-level pkgsrc Makefile by using the "
5806: show-host-specific-pkgs" target.
1.1 dsieger 5807:
5808: show-installed-depends
5809:
5810: This target shows which installed packages match the current package's
5811: DEPENDS. Useful if out of date dependencies are causing build problems.
5812:
1.95 wiz 5813: print-build-depends-list
5814:
5815: This target shows the list of packages that the current package depends on
5816: for building.
5817:
5818: print-run-depends-list
5819:
5820: This target shows the list of packages that the current package depends on
5821: for running.
5822:
1.1 dsieger 5823: check-shlibs
5824:
5825: After a package is installed, check all its binaries and (on ELF platforms)
5826: shared libraries to see if they find the shared libs they need. Run by
1.4 rillig 5827: default if PKG_DEVELOPER is set in mk.conf.
1.1 dsieger 5828:
5829: print-PLIST
5830:
5831: After a "make install" from a new or upgraded pkg, this prints out an
5832: attempt to generate a new PLIST from a find -newer work/.extract_done. An
5833: attempt is made to care for shared libs etc., but it is strongly
5834: recommended to review the result before putting it into PLIST. On upgrades,
5835: it's useful to diff the output of this command against an already existing
5836: PLIST file.
5837:
5838: If the package installs files via tar(1) or other methods that don't update
5839: file access times, be sure to add these files manually to your PLIST, as
5840: the "find -newer" command used by this target won't catch them!
5841:
1.154 rillig 5842: See Section 15.3, "Tweaking output of make print-PLIST" for more
1.1 dsieger 5843: information on this target.
5844:
1.154 rillig 5845: Chapter 20. Tools needed for building or running
1.1 dsieger 5846:
5847: Table of Contents
5848:
1.154 rillig 5849: 20.1. Tools for pkgsrc builds
5850: 20.2. Tools needed by packages
5851: 20.3. Tools provided by platforms
1.1 dsieger 5852:
5853: The USE_TOOLS definition is used both internally by pkgsrc and also for
5854: individual packages to define what commands are needed for building a package
1.156 leot 5855: (like TOOL_DEPENDS) or for later run-time of an installed packaged (such as
1.1 dsieger 5856: DEPENDS). If the native system provides an adequate tool, then in many cases, a
5857: pkgsrc package will not be used.
5858:
5859: When building a package, the replacement tools are made available in a
5860: directory (as symlinks or wrapper scripts) that is early in the executable
5861: search path. Just like the buildlink system, this helps with consistent builds.
5862:
5863: A tool may be needed to help build a specific package. For example, perl, GNU
5864: make (gmake) or yacc may be needed.
5865:
5866: Also a tool may be needed, for example, because the native system's supplied
5867: tool may be inefficient for building a package with pkgsrc. For example, a
5868: package may need GNU awk, bison (instead of yacc) or a better sed.
5869:
5870: The tools used by a package can be listed by running make show-tools.
5871:
1.154 rillig 5872: 20.1. Tools for pkgsrc builds
1.1 dsieger 5873:
5874: The default set of tools used by pkgsrc is defined in bsd.pkg.mk. This includes
5875: standard Unix tools, such as: cat, awk, chmod, test, and so on. These can be
5876: seen by running: make show-var VARNAME=USE_TOOLS.
5877:
5878: If a package needs a specific program to build then the USE_TOOLS variable can
5879: be used to define the tools needed.
5880:
1.154 rillig 5881: 20.2. Tools needed by packages
1.1 dsieger 5882:
1.29 wiz 5883: In the following examples, the :run means that it is needed at run-time (and
5884: becomes a DEPENDS). The default is a build dependency which can be set with
5885: :build. (So in this example, it is the same as gmake:build and
5886: pkg-config:build.)
1.1 dsieger 5887:
5888: USE_TOOLS+= gmake perl:run pkg-config
5889:
5890: When using the tools framework, a TOOLS_PATH.foo variable is defined which
5891: contains the full path to the appropriate tool. For example, TOOLS_PATH.bash
5892: could be "/bin/bash" on Linux systems.
5893:
5894: If you always need a pkgsrc version of the tool at run-time, then just use
5895: DEPENDS instead.
5896:
1.154 rillig 5897: 20.3. Tools provided by platforms
1.1 dsieger 5898:
5899: When improving or porting pkgsrc to a new platform, have a look at (or create)
5900: the corresponding platform specific make file fragment under pkgsrc/mk/tools/
5901: tools.${OPSYS}.mk which defines the name of the common tools. For example:
5902:
5903: .if exists(/usr/bin/bzcat)
5904: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
5905: .elif exists(/usr/bin/bzip2)
5906: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
5907: .endif
5908:
5909: TOOLS_PLATFORM.true?= true # shell builtin
5910:
1.154 rillig 5911: Chapter 21. Making your package work
1.1 dsieger 5912:
5913: Table of Contents
5914:
1.154 rillig 5915: 21.1. General operation
1.1 dsieger 5916:
1.154 rillig 5917: 21.1.1. How to pull in user-settable variables from mk.conf
5918: 21.1.2. User interaction
5919: 21.1.3. Handling licenses
5920: 21.1.4. Restricted packages
5921: 21.1.5. Handling dependencies
5922: 21.1.6. Handling conflicts with other packages
5923: 21.1.7. Packages that cannot or should not be built
5924: 21.1.8. Packages which should not be deleted, once installed
5925: 21.1.9. Handling packages with security problems
5926: 21.1.10. How to handle incrementing versions when fixing an existing
1.1 dsieger 5927: package
1.154 rillig 5928: 21.1.11. Substituting variable text in the package files (the SUBST
1.1 dsieger 5929: framework)
5930:
1.154 rillig 5931: 21.2. The fetch phase
1.1 dsieger 5932:
1.154 rillig 5933: 21.2.1. Packages whose distfiles aren't available for plain downloading
5934: 21.2.2. How to handle modified distfiles with the 'old' name
5935: 21.2.3. Packages hosted on github.com
5936:
5937: 21.3. The configure phase
5938:
5939: 21.3.1. Shared libraries - libtool
5940: 21.3.2. Using libtool on GNU packages that already support libtool
5941: 21.3.3. GNU Autoconf/Automake
5942:
5943: 21.4. Programming languages
5944:
5945: 21.4.1. C, C++, and Fortran
5946: 21.4.2. Java
5947: 21.4.3. Packages containing perl scripts
5948: 21.4.4. Packages containing shell scripts
5949: 21.4.5. Other programming languages
5950:
5951: 21.5. The build phase
5952:
5953: 21.5.1. Compiling C and C++ code conditionally
5954: 21.5.2. How to handle compiler bugs
1.172 rillig 5955: 21.5.3. No such file or directory
5956: 21.5.4. Undefined reference to "..."
5957: 21.5.5. Running out of memory
1.154 rillig 5958:
5959: 21.6. The install phase
5960:
5961: 21.6.1. Creating needed directories
5962: 21.6.2. Where to install documentation
5963: 21.6.3. Installing highscore files
5964: 21.6.4. Adding DESTDIR support to packages
5965: 21.6.5. Packages with hardcoded paths to other interpreters
5966: 21.6.6. Packages installing perl modules
5967: 21.6.7. Packages installing info files
5968: 21.6.8. Packages installing man pages
5969: 21.6.9. Packages installing GConf data files
5970: 21.6.10. Packages installing scrollkeeper/rarian data files
5971: 21.6.11. Packages installing X11 fonts
5972: 21.6.12. Packages installing GTK2 modules
5973: 21.6.13. Packages installing SGML or XML data
5974: 21.6.14. Packages installing extensions to the MIME database
5975: 21.6.15. Packages using intltool
5976: 21.6.16. Packages installing startup scripts
5977: 21.6.17. Packages installing TeX modules
5978: 21.6.18. Packages supporting running binaries in emulation
5979: 21.6.19. Packages installing hicolor theme icons
5980: 21.6.20. Packages installing desktop files
1.1 dsieger 5981:
1.154 rillig 5982: 21.7. Marking packages as having problems
1.1 dsieger 5983:
1.154 rillig 5984: 21.1. General operation
1.1 dsieger 5985:
5986: One appealing feature of pkgsrc is that it runs on many different platforms. As
5987: a result, it is important to ensure, where possible, that packages in pkgsrc
5988: are portable. This chapter mentions some particular details you should pay
5989: attention to while working on pkgsrc.
5990:
1.154 rillig 5991: 21.1.1. How to pull in user-settable variables from mk.conf
1.1 dsieger 5992:
5993: The pkgsrc user can configure pkgsrc by overriding several variables in the
1.4 rillig 5994: file pointed to by MAKECONF, which is mk.conf by default. When you want to use
5995: those variables in the preprocessor directives of make(1) (for example .if or
5996: .for), you need to include the file ../../mk/bsd.prefs.mk before, which in turn
5997: loads the user preferences.
1.1 dsieger 5998:
5999: But note that some variables may not be completely defined after ../../mk/
6000: bsd.prefs.mk has been included, as they may contain references to variables
1.108 rillig 6001: that are not yet defined. In shell commands (the lines in Makefile that are
6002: indented with a tab) this is no problem, since variables are only expanded when
6003: they are used. But in the preprocessor directives mentioned above and in
6004: dependency lines (of the form target: dependencies) the variables are expanded
6005: at load time.
1.1 dsieger 6006:
6007: Note
6008:
1.108 rillig 6009: To check whether a variable can be used at load time, run pkglint -Wall on your
6010: package.
1.1 dsieger 6011:
1.154 rillig 6012: 21.1.2. User interaction
1.1 dsieger 6013:
6014: Occasionally, packages require interaction from the user, and this can be in a
6015: number of ways:
6016:
6017: * When fetching the distfiles, some packages require user interaction such as
6018: entering username/password or accepting a license on a web page.
6019:
6020: * When extracting the distfiles, some packages may ask for passwords.
6021:
6022: * help to configure the package before it is built
6023:
6024: * help during the build process
6025:
6026: * help during the installation of a package
6027:
1.108 rillig 6028: A package can set the INTERACTIVE_STAGE variable to define which stages need
6029: interaction. This should be done in the package's Makefile, e.g.:
1.1 dsieger 6030:
6031: INTERACTIVE_STAGE= configure install
6032:
6033: The user can then decide to skip this package by setting the BATCH variable.
1.108 rillig 6034: Packages that require interaction are also excluded from bulk builds.
1.1 dsieger 6035:
1.154 rillig 6036: 21.1.3. Handling licenses
1.1 dsieger 6037:
6038: Authors of software can choose the licence under which software can be copied.
1.111 sevan 6039: The Free Software Foundation has declared some licenses "Free", and the Open
6040: Source Initiative has a definition of "Open Source".
6041:
6042: By default, pkgsrc allows packages with Free or Open Source licenses to be
6043: built. To allow packages with other licenses to be built as well, the pkgsrc
6044: user needs to add these licenses to the ACCEPTABLE_LICENSES variable in mk.conf
6045: . Note that this variable only affects which packages may be built, while the
6046: license terms often also restrict the actual use of the package and its
6047: redistribution.
1.1 dsieger 6048:
6049: One might want to only install packages with a BSD license, or the GPL, and not
1.20 jnemeth 6050: the other. The free licenses are added to the default ACCEPTABLE_LICENSES
1.111 sevan 6051: variable. The pkgsrc user can override the default by setting the
6052: ACCEPTABLE_LICENSES variable with "=" instead of "+=". The licenses accepted by
6053: default are defined in the DEFAULT_ACCEPTABLE_LICENSES variable in the file
6054: pkgsrc/mk/license.mk.
1.1 dsieger 6055:
6056: The license tag mechanism is intended to address copyright-related issues
6057: surrounding building, installing and using a package, and not to address
1.20 jnemeth 6058: redistribution issues (see RESTRICTED and NO_SRC_ON_FTP, etc.). Packages with
6059: redistribution restrictions should set these tags.
1.1 dsieger 6060:
6061: Denoting that a package may be copied according to a particular license is done
6062: by placing the license in pkgsrc/licenses and setting the LICENSE variable to a
6063: string identifying the license, e.g. in graphics/xv:
6064:
6065: LICENSE= xv-license
6066:
6067: When trying to build, the user will get a notice that the package is covered by
6068: a license which has not been placed in the ACCEPTABLE_LICENSES variable:
6069:
6070: % make
6071: ===> xv-3.10anb9 has an unacceptable license: xv-license.
6072: ===> To view the license, enter "/usr/bin/make show-license".
6073: ===> To indicate acceptance, add this line to your /etc/mk.conf:
6074: ===> ACCEPTABLE_LICENSES+=xv-license
6075: *** Error code 1
6076:
6077: The license can be viewed with make show-license, and if the user so chooses,
1.4 rillig 6078: the line printed above can be added to mk.conf to convey to pkgsrc that it
1.1 dsieger 6079: should not in the future fail because of that license:
6080:
6081: ACCEPTABLE_LICENSES+=xv-license
6082:
1.111 sevan 6083: The use of LICENSE=shareware, LICENSE=no-commercial-use, and similar language
6084: is deprecated because it does not crisply refer to a particular license text.
6085: Another problem with such usage is that it does not enable a user to tell
6086: pkgsrc to proceed for a single package without also telling pkgsrc to proceed
6087: for all packages with that tag.
6088:
1.154 rillig 6089: 21.1.3.1. Adding a package with a new license
1.1 dsieger 6090:
1.49 rodent 6091: When adding a package with a new license, the following steps are required:
6092:
1.111 sevan 6093: 1. Check whether the license qualifies as Free or Open Source by referencing
6094: Various Licenses and Comments about Them and Licenses by Name | Open Source
6095: Initiative. If this is the case, the filename in pkgsrc/licenses/ does not
6096: need the -license suffix, and the license name should be added to:
1.49 rodent 6097:
6098: + DEFAULT_ACCEPTABLE_LICENSES in pkgsrc/mk/license.mk
6099:
6100: + default_acceptable_licenses in pkgsrc/pkgtools/pkg_install/files/lib/
6101: license.c
6102:
6103: 2. The license text should be added to pkgsrc/licenses for displaying. A list
6104: of known licenses can be seen in this directory.
1.1 dsieger 6105:
1.154 rillig 6106: 21.1.3.2. Change to the license
1.1 dsieger 6107:
1.111 sevan 6108: When the license changes (in a way other than formatting), make sure that the
6109: new license has a different name (e.g., append the version number if it exists,
6110: or the date). Just because a user told pkgsrc to build programs under a
6111: previous version of a license does not mean that pkgsrc should build programs
6112: under the new licenses. The higher-level point is that pkgsrc does not evaluate
6113: licenses for reasonableness; the only test is a mechanistic test of whether a
6114: particular text has been approved by either of two bodies (FSF or OSI).
1.1 dsieger 6115:
1.154 rillig 6116: 21.1.4. Restricted packages
1.1 dsieger 6117:
1.111 sevan 6118: Some licenses restrict how software may be re-distributed. By declaring the
6119: restrictions, package tools can automatically refrain from e.g. placing binary
6120: packages on FTP sites.
6121:
6122: There are four possible restrictions, which are the cross product of sources
6123: (distfiles) and binaries not being placed on FTP sites and CD-ROMs. Because
6124: this is rarely the exact language in any license, and because non-Free licenses
6125: tend to be different from each other, pkgsrc adopts a definition of FTP and
6126: CD-ROM. "FTP" means making the source or binary file available over the
6127: Internet at no charge. "CD-ROM" means making the source or binary available on
6128: some kind of media, together with other source and binary packages, which is
6129: sold for a distribution charge.
1.1 dsieger 6130:
6131: In order to encode these restrictions, the package system defines five make
6132: variables that can be set to note these restrictions:
6133:
6134: * RESTRICTED
6135:
6136: This variable should be set whenever a restriction exists (regardless of
6137: its kind). Set this variable to a string containing the reason for the
6138: restriction. It should be understood that those wanting to understand the
6139: restriction will have to read the license, and perhaps seek advice of
6140: counsel.
6141:
6142: * NO_BIN_ON_CDROM
6143:
6144: Binaries may not be placed on CD-ROM containing other binary packages, for
6145: which a distribution charge may be made. In this case, set this variable to
6146: ${RESTRICTED}.
6147:
6148: * NO_BIN_ON_FTP
6149:
6150: Binaries may not made available on the Internet without charge. In this
6151: case, set this variable to ${RESTRICTED}. If this variable is set, binary
6152: packages will not be included on ftp.NetBSD.org.
6153:
6154: * NO_SRC_ON_CDROM
6155:
6156: Distfiles may not be placed on CD-ROM, together with other distfiles, for
6157: which a fee may be charged. In this case, set this variable to $
6158: {RESTRICTED}.
6159:
6160: * NO_SRC_ON_FTP
6161:
6162: Distfiles may not made available via FTP at no charge. In this case, set
6163: this variable to ${RESTRICTED}. If this variable is set, the distfile(s)
6164: will not be mirrored on ftp.NetBSD.org.
6165:
1.111 sevan 6166: Please note that packages will be removed from pkgsrc when the distfiles are
1.33 wiz 6167: not distributable and cannot be obtained for a period of one full quarter
1.111 sevan 6168: branch. Packages with manual/interactive fetch must have a maintainer and it is
6169: his/her responsibility to ensure this.
1.33 wiz 6170:
1.154 rillig 6171: 21.1.5. Handling dependencies
1.1 dsieger 6172:
1.175 gutterid 6173: Your package may depend on some other package being present, and there are
6174: various ways of expressing this dependency. pkgsrc supports the DEPENDS,
6175: BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS definitions, the USE_TOOLS
6176: definition, as well as dependencies via buildlink3.mk, which is the preferred
6177: way to handle dependencies, and which uses the variables named above. See
6178: Chapter 16, Buildlink methodology for more information.
6179:
6180: The basic difference is that the DEPENDS definition registers that
6181: pre-requisite in the binary package so it will be pulled in when the binary
6182: package is later installed, whilst the BUILD_DEPENDS, TOOL_DEPENDS, and
6183: TEST_DEPENDS definitions do not, marking a dependency that is only needed for
6184: building or testing the resulting package. See also Chapter 12, Creating a new
6185: pkgsrc package from scratch for more information.
6186:
6187: This means that if you only need a package present whilst you are building or
6188: testing, it should be noted as a TOOL_DEPENDS, BUILD_DEPENDS, or TEST_DEPENDS.
6189: When cross-compiling, TOOL_DEPENDS are native packages, i.e. packages for the
6190: architecture where the package is built; BUILD_DEPENDS are target packages,
6191: i.e., packages for the architecture for which the package is built.
1.1 dsieger 6192:
1.175 gutterid 6193: The format for a DEPENDS, BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS
6194: definition is:
1.1 dsieger 6195:
6196: <pre-req-package-name>:../../<category>/<pre-req-package>
6197:
6198: Please note that the "pre-req-package-name" may include any of the wildcard
6199: version numbers recognized by pkg_info(1).
6200:
1.55 wiz 6201: 1. If your package needs another package's binaries or libraries to build and
1.1 dsieger 6202: run, and if that package has a buildlink3.mk file available, use it:
6203:
6204: .include "../../graphics/jpeg/buildlink3.mk"
6205:
1.55 wiz 6206: 2. If your package needs another package's binaries or libraries only for
6207: building, and if that package has a buildlink3.mk file available, use it:
6208:
6209: .include "../../graphics/jpeg/buildlink3.mk"
6210:
6211: but set BUILDLINK_DEPMETHOD.jpeg?=build to make it a build dependency only.
6212: This case is rather rare.
6213:
6214: 3. If your package needs binaries from another package to build, use the
1.156 leot 6215: TOOL_DEPENDS definition:
6216:
6217: TOOL_DEPENDS+= itstool-[0-9]*:../../textproc/itstool
1.1 dsieger 6218:
1.156 leot 6219: 4. If your package needs static libraries to link against, header files to
6220: include, etc. from another package to build, use the BUILD_DEPENDS
6221: definition.
1.1 dsieger 6222:
1.156 leot 6223: 5. If your package needs a library with which to link and there is no
1.26 spz 6224: buildlink3.mk file available, create one. Using DEPENDS won't be sufficient
6225: because the include files and libraries will be hidden from the compiler.
1.1 dsieger 6226:
1.156 leot 6227: 6. If your package needs some executable to be able to run correctly and if
1.26 spz 6228: there's no buildlink3.mk file, this is specified using the DEPENDS
6229: variable. The print/lyx package needs to be able to execute the latex
1.129 wiz 6230: binary from the tex-latex-bin package when it runs, and that is specified:
1.1 dsieger 6231:
1.129 wiz 6232: DEPENDS+= tex-latex-bin-[0-9]*:../../print/tex-latex-bin
1.1 dsieger 6233:
1.175 gutterid 6234: 7. If your package includes a test suite that has extra dependencies only
6235: required for this purpose (frequently this can be run as a "make test"
6236: target), use the TEST_DEPENDS variable.
6237:
6238: 8. You can use wildcards in package dependencies. Note that such wildcard
1.26 spz 6239: dependencies are retained when creating binary packages. The dependency is
6240: checked when installing the binary package and any package which matches
6241: the pattern will be used. Wildcard dependencies should be used with care.
1.1 dsieger 6242:
6243: The "-[0-9]*" should be used instead of "-*" to avoid potentially ambiguous
6244: matches such as "tk-postgresql" matching a "tk-*" DEPENDS.
6245:
6246: Wildcards can also be used to specify that a package will only build
6247: against a certain minimum version of a pre-requisite:
6248:
1.26 spz 6249: DEPENDS+= ImageMagick>=6.0:../../graphics/ImageMagick
1.1 dsieger 6250:
1.26 spz 6251: This means that the package will build using version 6.0 of ImageMagick or
6252: newer. Such a dependency may be warranted if, for example, the command line
6253: options of an executable have changed.
6254:
6255: If you need to depend on minimum versions of libraries, see the buildlink
6256: section of the pkgsrc guide.
1.1 dsieger 6257:
6258: For security fixes, please update the package vulnerabilities file. See
1.154 rillig 6259: Section 21.1.9, "Handling packages with security problems" for more
1.1 dsieger 6260: information.
6261:
6262: If your package needs files from another package to build, add the relevant
6263: distribution files to DISTFILES, so they will be extracted automatically. See
6264: the print/ghostscript package for an example. (It relies on the jpeg sources
6265: being present in source form during the build.)
6266:
1.154 rillig 6267: 21.1.6. Handling conflicts with other packages
1.1 dsieger 6268:
6269: Your package may conflict with other packages a user might already have
6270: installed on his system, e.g. if your package installs the same set of files as
1.80 wiz 6271: another package in the pkgsrc tree or has the same PKGNAME.
1.1 dsieger 6272:
1.142 leot 6273: For example, x11/libXaw3d and x11/Xaw-Xpm install the same shared library, thus
6274: you set in pkgsrc/x11/libXaw3d/Makefile:
1.1 dsieger 6275:
1.142 leot 6276: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 dsieger 6277:
6278:
1.142 leot 6279: and in pkgsrc/x11/Xaw-Xpm/Makefile:
1.1 dsieger 6280:
1.142 leot 6281: CONFLICTS= libXaw3d-[0-9]*
1.1 dsieger 6282:
1.142 leot 6283:
6284: pkg_add(1) is able to detect attempts to install packages that conflict with
6285: existing packages and abort. However, in many situations this is too late in
6286: the process. Binary package managers will not know about the conflict until
6287: they attempt to install the package after already downloading it and all its
6288: dependencies. Users may also waste time building a package and its dependencies
6289: only to find out at the end that it conflicts with another package they have
6290: installed.
6291:
6292: To avoid these issues CONFLICTS entries should be added in all cases where it
6293: is known that packages conflict with each other. These CONFLICTS entries are
6294: exported in pkg_summary(5) files and consumed by binary package managers to
6295: inform users that packages cannot be installed onto the target system.
1.1 dsieger 6296:
1.154 rillig 6297: 21.1.7. Packages that cannot or should not be built
1.1 dsieger 6298:
6299: There are several reasons why a package might be instructed to not build under
6300: certain circumstances. If the package builds and runs on most platforms, the
1.83 dholland 6301: exceptions should be noted with BROKEN_ON_PLATFORM. If the package builds and
6302: runs on a small handful of platforms, set BROKEN_EXCEPT_ON_PLATFORM instead.
6303: Both BROKEN_ON_PLATFORM and BROKEN_EXCEPT_ON_PLATFORM are OS triples
6304: (OS-version-platform) that can use glob-style wildcards.
6305:
1.114 maya 6306: If a package is not appropriate for some platforms (as opposed to merely
1.83 dholland 6307: broken), a different set of variables should be used as this affects failure
6308: reporting and statistics. If the package is appropriate for most platforms, the
6309: exceptions should be noted with NOT_FOR_PLATFORM. If the package is appropriate
6310: for only a small handful of platforms (often exactly one), set
6311: ONLY_FOR_PLATFORM instead. Both ONLY_FOR_PLATFORM and NOT_FOR_PLATFORM are OS
6312: triples (OS-version-platform) that can use glob-style wildcards.
1.1 dsieger 6313:
6314: Some packages are tightly bound to a specific version of an operating system,
6315: e.g. LKMs or sysutils/lsof. Such binary packages are not backwards compatible
6316: with other versions of the OS, and should be uploaded to a version specific
6317: directory on the FTP server. Mark these packages by setting OSVERSION_SPECIFIC
6318: to "yes". This variable is not currently used by any of the package system
6319: internals, but may be used in the future.
6320:
6321: If the package should be skipped (for example, because it provides
6322: functionality already provided by the system), set PKG_SKIP_REASON to a
6323: descriptive message. If the package should fail because some preconditions are
6324: not met, set PKG_FAIL_REASON to a descriptive message.
6325:
1.154 rillig 6326: 21.1.8. Packages which should not be deleted, once installed
1.1 dsieger 6327:
6328: To ensure that a package may not be deleted, once it has been installed, the
6329: PKG_PRESERVE definition should be set in the package Makefile. This will be
1.25 wiz 6330: carried into any binary package that is made from this pkgsrc entry. A "
6331: preserved" package will not be deleted using pkg_delete(1) unless the "-f"
1.1 dsieger 6332: option is used.
6333:
1.154 rillig 6334: 21.1.9. Handling packages with security problems
1.1 dsieger 6335:
6336: When a vulnerability is found, this should be noted in localsrc/security/
1.32 wiz 6337: advisories/pkg-vulnerabilities, and after committing that file, ask
6338: pkgsrc-security@NetBSD.org to update the file on ftp.NetBSD.org.
1.1 dsieger 6339:
6340: After fixing the vulnerability by a patch, its PKGREVISION should be increased
6341: (this is of course not necessary if the problem is fixed by using a newer
1.32 wiz 6342: release of the software), and the pattern in the pkg-vulnerabilities file must
6343: be updated.
1.1 dsieger 6344:
6345: Also, if the fix should be applied to the stable pkgsrc branch, be sure to
6346: submit a pullup request!
6347:
6348: Binary packages already on ftp.NetBSD.org will be handled semi-automatically by
6349: a weekly cron job.
6350:
1.154 rillig 6351: 21.1.10. How to handle incrementing versions when fixing an existing package
1.1 dsieger 6352:
6353: When making fixes to an existing package it can be useful to change the version
6354: number in PKGNAME. To avoid conflicting with future versions by the original
6355: author, a "nb1", "nb2", ... suffix can be used on package versions by setting
6356: PKGREVISION=1 (2, ...). The "nb" is treated like a "." by the package tools.
6357: e.g.
6358:
6359: DISTNAME= foo-17.42
6360: PKGREVISION= 9
6361:
6362: will result in a PKGNAME of "foo-17.42nb9". If you want to use the original
6363: value of PKGNAME without the "nbX" suffix, e.g. for setting DIST_SUBDIR, use
6364: PKGNAME_NOREV.
6365:
6366: When a new release of the package is released, the PKGREVISION should be
6367: removed, e.g. on a new minor release of the above package, things should be
6368: like:
6369:
6370: DISTNAME= foo-17.43
6371:
6372: PKGREVISION should be incremented for any non-trivial change in the resulting
6373: binary package. Without a PKGREVISION bump, someone with the previous version
6374: installed has no way of knowing that their package is out of date. Thus,
6375: changes without increasing PKGREVISION are essentially labeled "this is so
6376: trivial that no reasonable person would want to upgrade", and this is the rough
6377: test for when increasing PKGREVISION is appropriate. Examples of changes that
6378: do not merit increasing PKGREVISION are:
6379:
1.14 jmcneill 6380: * Changing HOMEPAGE, MAINTAINER, OWNER, or comments in Makefile.
1.1 dsieger 6381:
6382: * Changing build variables if the resulting binary package is the same.
6383:
6384: * Changing DESCR.
6385:
6386: * Adding PKG_OPTIONS if the default options don't change.
6387:
6388: Examples of changes that do merit an increase to PKGREVISION include:
6389:
6390: * Security fixes
6391:
6392: * Changes or additions to a patch file
6393:
6394: * Changes to the PLIST
6395:
1.12 weinem 6396: * A dependency is changed or renamed.
6397:
1.1 dsieger 6398: PKGREVISION must also be incremented when dependencies have ABI changes.
6399:
1.154 rillig 6400: 21.1.11. Substituting variable text in the package files (the SUBST framework)
1.1 dsieger 6401:
1.180 rillig 6402: When you want to replace the same text in multiple files, or multiple times in
6403: the same file, it is cumbersome to maintain a patch file for this. This is
6404: where the SUBST framework steps in. It provides an easy-to-use interface for
6405: replacing text in files. It just needs the following information:
1.172 rillig 6406:
1.180 rillig 6407: * In which phase of the package build cycle should the replacement happen?
1.172 rillig 6408:
1.180 rillig 6409: * In which files should the replacement happen?
1.172 rillig 6410:
6411: * Which text should be replaced with what?
6412:
1.180 rillig 6413: This information is encoded in a block of SUBST variables. A minimal example
6414: is:
6415:
6416: SUBST_CLASSES+= paths
6417: SUBST_STAGE.paths= pre-configure
6418: SUBST_FILES.paths= src/*.c
6419: SUBST_SED.paths= -e 's,/usr/local,${PREFIX},g'
6420:
6421: Translated into English, it means: In the pre-configure stage (that is, after
6422: applying the patches from the patches/ directory and before running the
6423: configure script and the portability check), replace the text /usr/local with
6424: the content of the variable PREFIX.
6425:
6426: Each SUBST block starts by appending an identifier to SUBST_CLASSES (note the +
6427: =). This identifier can be chosen freely by the package. If there should ever
6428: be duplicate identifiers, the pkgsrc infrastructure will catch this and fail
6429: early, so don't worry about name collisions.
6430:
6431: Except for SUBST_CLASSES, all variables in a SUBST block are parameterized
6432: using this identifier. In the remainder of this section, these parameterized
6433: variables are written as SUBST_STAGE.*.
6434:
6435: SUBST_CLASSES+= paths
6436: SUBST_STAGE.paths= pre-configure
6437: SUBST_MESSAGE.paths= Fixing absolute paths.
6438: SUBST_FILES.paths= src/*.c
6439: SUBST_FILES.paths+= scripts/*.sh
6440: SUBST_SED.paths= -e 's,"/usr/local,"${PREFIX},g'
6441: SUBST_SED.paths+= -e 's,"/var/log,"${VARBASE}/log,g'
6442: SUBST_VARS.paths= LOCALBASE PREFIX PKGVERSION
6443:
6444: To get a complete picture about the SUBST substitutions, run bmake
6445: show-all-subst. If something doesn't work as expected, run pkglint on the
6446: package, which detects several typical mistakes surrounding the SUBST blocks.
6447: For any questions that might remain after this, have a look at mk/subst.mk.
6448:
6449: 21.1.11.1. Choosing the time where the substitutions happen
6450:
6451: The SUBST_STAGE.* is one of {pre,do,post}-
6452: {extract,patch,configure,build,test,install}. Of these, pre-configure is used
6453: most often, by far. The most popular stages are, in chronological order:
6454:
6455: post-extract
6456:
6457: The substitutions are applied immediately after the distfiles are
6458: extracted. Running bmake extract on the package will leave no traces of the
6459: original files.
6460:
6461: When the substitution applies to files for which there is also a patch in
6462: the patches/ directory, this means that the patches will be computed based
6463: on the result of the substitution. When these patches are sent to the
6464: upstream maintainer later, to be fixed in the upstream package, these
6465: patches may no longer match what the upstream author is used to. Because of
6466: this, pre-configure is often a better choice.
6467:
6468: pre-configure
6469:
6470: The substitutions are applied after the patches from the patches/
6471: directory. This makes it possible to run bmake patch on the package, after
6472: which the patches can be edited using the tools pkgvi and mkpatches from
6473: the pkgtools/pkgdiff package.
6474:
6475: When updating the patches, it is helpful to explicitly separate the bmake
6476: patch from the bmake configure, and to only edit the patches between these
6477: commands. Otherwise the substitutions from the SUBST block will end up in
6478: the patch file. When this happens in really obvious ways, pkglint will
6479: complain about patches that contain a hard-coded /usr/pkg instead of the
6480: correct and intended @PREFIX@, but it can only detect these really obvious
6481: cases.
6482:
6483: do-configure
6484:
6485: This stage should only be used if the package defines a pre-configure
6486: action itself, and the substitution must happen after that. Typical
6487: examples are packages that use the pre-configure stage to regenerate the
6488: GNU configure script from configure.ac.
6489:
6490: post-configure
6491:
6492: This stage is used to fix up any mistakes by the configure stage.
6493:
6494: pre-build
6495:
6496: This stage should only be used for substitutions that are clearly related
6497: to building the package, not for fixing the configuration. Substitutions
6498: for pathnames (such as replacing /usr/local with ${PREFIX}) or user names
6499: (such as replacing @MY_USER@ with the actual username) belong in
6500: pre-configure or post-configure instead.
6501:
6502: post-build
6503:
6504: Just as with pre-build, this stage should only be used for substitutions
6505: that are clearly related to building the package, not for fixing the
6506: configuration. Substitutions for pathnames (such as replacing /usr/local
6507: with ${PREFIX}) or user names (such as replacing @MY_USER@ with the actual
6508: username) belong in pre-configure or post-configure instead.
6509:
6510: A typical use is to update pkg-config files to include the rpath compiler
6511: options.
6512:
6513: pre-install
6514:
6515: In general, the install phase should be as simple as possible. As with the
6516: pre-build and post-build stages, it should not be used to fix pathnames or
6517: user names, these belong in pre-configure instead. There are only few
6518: legitimate use cases for applying substitutions in this stage.
6519:
1.181 rillig 6520: 21.1.11.2. Choosing the files where the substitutions happen
1.180 rillig 6521:
6522: The SUBST_FILES.* variable contains a list of filename patterns. These patterns
6523: are relative to WRKSRC since that is where most substitutions happen. A typical
6524: example is:
6525:
6526: SUBST_FILES.path= Makefile */Makefile */*/Makefile *.[ch]
6527:
6528: The above patterns, especially the last, are quite broad. The SUBST
6529: implementation checks that each filename pattern that is mentioned here has an
6530: effect. For example, if none of the */*/Makefile files contains the patterns to
6531: be found and substituted, that filename pattern is redundant and should be left
1.181 rillig 6532: out. By default, the SUBST framework will complain with an error message. If
6533: the text to be substituted occurs in some of the files from a single pattern,
6534: but not in all of them, that is totally ok, and the SUBST framework will only
6535: print an INFO message for those files.
1.180 rillig 6536:
6537: If there is a good reason for having redundant filename patterns, set
1.181 rillig 6538: SUBST_NOOP_OK.* to yes.
1.180 rillig 6539:
6540: Another popular way of choosing the files for the substitutions is via a shell
6541: command, like this:
6542:
1.181 rillig 6543: C_FILES_CMD= cd ${WRKSRC} && ${FIND} . -name '*.c'
1.180 rillig 6544: SUBST_FILES.path= ${C_FILES_CMD:sh}
6545:
6546: The variable name C_FILES_CMD in this example is freely chosen and independent
6547: of the SUBST framework.
6548:
6549: In this variant, the SUBST_FILES.* variable lists each file individually.
6550: Thereby chances are higher that there are filename patterns in which no
6551: substitution happens. Since the SUBST framework cannot know whether the
6552: filename patterns in SUBST_FILES.* have been explicitly listed in the Makefile
6553: (where any redundant filename pattern would be suspicious) or been generated by
6554: a shell command (in which redundant filename patterns are more likely and to be
6555: expected), it will complain about these redundant filename patterns. Therefore,
6556: SUBST blocks that use a shell command to generate the list of filename patterns
6557: often need to set SUBST_NOOP_OK.* to yes.
6558:
6559: 21.1.11.3. Choosing what to substitute
6560:
6561: In most cases, the substitutions are given using one or more sed(1) commands,
6562: like this:
6563:
6564: SUBST_SED.path= -e 's|/usr/local|${PREFIX}|g'
6565:
6566: Each of the sed commands needs to be preceded by the -e option and should be
6567: specified on a line of its own, to avoid hiding short sed commands at the end
6568: of a line.
6569:
6570: Since the sed commands often contain shell metacharacters as the separator (the
6571: | in the above example), it is common to enclose them in single quotes.
6572:
6573: A common substitution is to replace placeholders of the form @VARNAME@ with
6574: their pkgsrc counterpart variable ${VARNAME}. A typical example is:
6575:
6576: SUBST_VARS.path= PREFIX
6577:
1.181 rillig 6578: This type of substitutions is typically done by the GNU configure scripts
6579: during the do-configure stage, but in some cases these need to be overridden.
6580: The same pattern is also used when a package defines patches that replace
6581: previously hard-coded paths like /usr/local with a @PREFIX@ placeholder first,
6582: which then gets substituted by the actual ${PREFIX} in the pre-configure stage.
6583: In many of these cases, it works equally well to just use the SUBST framework
6584: to directly replace /usr/local with ${PREFIX}, thereby omitting the
6585: intermediate patch file.
1.180 rillig 6586:
6587: If the above is not flexible enough, it is possible to not use sed at all for
6588: the substitution but to specify an entirely different command, like this:
6589:
6590: SUBST_FILTER_CMD.path= LC_ALL=C ${TR} -d '\r'
1.1 dsieger 6591:
1.180 rillig 6592: This is used for the few remaining packages in which the distributed files use
6593: Windows-style line endings that need to be converted to UNIX-style line
6594: endings.
1.1 dsieger 6595:
1.180 rillig 6596: 21.1.11.4. Other SUBST variables
1.172 rillig 6597:
1.180 rillig 6598: When a SUBST block is applied during a package build, a message is logged. The
6599: default message is fine for most purposes but can be overridden by setting
6600: SUBST_MESSAGE.* to an individual message.
1.1 dsieger 6601:
1.154 rillig 6602: 21.2. The fetch phase
1.1 dsieger 6603:
1.154 rillig 6604: 21.2.1. Packages whose distfiles aren't available for plain downloading
1.1 dsieger 6605:
6606: If you need to download from a dynamic URL you can set DYNAMIC_MASTER_SITES and
6607: a make fetch will call files/getsite.sh with the name of each file to download
6608: as an argument, expecting it to output the URL of the directory from which to
6609: download it. graphics/ns-cult3d is an example of this usage.
6610:
6611: If the download can't be automated, because the user must submit personal
6612: information to apply for a password, or must pay for the source, or whatever,
6613: you can set FETCH_MESSAGE to a list of lines that are displayed to the user
6614: before aborting the build. Example:
6615:
6616: FETCH_MESSAGE= "Please download the files"
6617: FETCH_MESSAGE+= " "${DISTFILES:Q}
6618: FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"."
6619:
1.154 rillig 6620: 21.2.2. How to handle modified distfiles with the 'old' name
1.1 dsieger 6621:
6622: Sometimes authors of a software package make some modifications after the
6623: software was released, and they put up a new distfile without changing the
6624: package's version number. If a package is already in pkgsrc at that time, the
6625: checksum will no longer match. The contents of the new distfile should be
6626: compared against the old one before changing anything, to make sure the
6627: distfile was really updated on purpose, and that no trojan horse or so crept
6628: in. Please mention that the distfiles were compared and what was found in your
1.54 rodent 6629: commit message.
6630:
6631: Then, the correct way to work around this is to set DIST_SUBDIR to a unique
1.109 wiz 6632: directory name, usually based on PKGNAME_NOREV (but take care with python or
6633: ruby packages, where PKGNAME includes a variable prefix). All DISTFILES and
6634: PATCHFILES for this package will be put in that subdirectory of the local
1.154 rillig 6635: distfiles directory. (See Section 21.1.10, "How to handle incrementing versions
1.109 wiz 6636: when fixing an existing package" for more details.) In case this happens more
6637: often, PKGNAME can be used (thus including the nbX suffix) or a date stamp can
6638: be appended, like ${PKGNAME_NOREV}-YYYYMMDD.
1.54 rodent 6639:
6640: DIST_SUBDIR is also used when a distfile's name does not contain a version and
6641: the distfile is apt to change. In cases where the likelihood of this is very
6642: small, DIST_SUBDIR might not be required. Additionally, DIST_SUBDIR must not be
6643: removed unless the distfile name changes, even if a package is being moved or
6644: renamed.
6645:
6646: Do not forget regenerating the distinfo file after that, since it contains the
6647: DIST_SUBDIR path in the filenames. Also, increase the PKGREVISION if the
6648: installed package is different. Furthermore, a mail to the package's authors
6649: seems appropriate telling them that changing distfiles after releases without
6650: changing the file names is not good practice.
1.1 dsieger 6651:
1.154 rillig 6652: 21.2.3. Packages hosted on github.com
1.88 tnn 6653:
1.90 tnn 6654: Helper methods exist for packages hosted on github.com which will often have
6655: distfile names that clash with other packages, for example 1.0.tar.gz. Use one
6656: of the three recipes from below:
1.88 tnn 6657:
1.154 rillig 6658: 21.2.3.1. Fetch based on a tagged release
1.88 tnn 6659:
1.174 leot 6660: If your distfile URL looks similar to https://github.com/username/
6661: exampleproject/archive/v1.0.zip, then you are packaging a tagged release.
1.88 tnn 6662:
6663: DISTNAME= exampleproject-1.0
1.90 tnn 6664: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6665: #GITHUB_PROJECT= # can be omitted if same as DISTNAME
6666: GITHUB_TAG= v${PKGVERSION_NOREV}
1.88 tnn 6667: EXTRACT_SUFX= .zip
6668:
1.154 rillig 6669: 21.2.3.2. Fetch based on a specific commit
1.88 tnn 6670:
1.174 leot 6671: If your distfile URL looks similar to https://github.com?/example?/example?/
1.169 rillig 6672: archive?/988881adc9fc3655077dc2d4d757d480b5ea0e11.tar.gz, then you are
6673: packaging a specific commit not tied to a release.
1.88 tnn 6674:
6675: DISTNAME= example-1.0
1.107 jnemeth 6676: MASTER_SITES= ${MASTER_SITE_GITHUB:=example/}
1.90 tnn 6677: #GITHUB_PROJECT= # can be omitted if same as DISTNAME
6678: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
1.88 tnn 6679:
1.154 rillig 6680: 21.2.3.3. Fetch based on release
1.88 tnn 6681:
1.174 leot 6682: If your distfile URL looks similar to https://github.com?/username/
1.169 rillig 6683: exampleproject?/releases?/download?/rel-1.6?/offensive-1.6.zip, then you are
6684: packaging a release.
1.88 tnn 6685:
1.90 tnn 6686: DISTNAME= offensive-1.6
1.88 tnn 6687: PKGNAME= ${DISTNAME:S/offensive/proper/}
1.90 tnn 6688: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6689: GITHUB_PROJECT= exampleproject
6690: GITHUB_RELEASE= rel-${PKGVERSION_NOREV} # usually just set this to ${DISTNAME}
6691: EXTRACT_SUFX= .zip
1.88 tnn 6692:
1.154 rillig 6693: 21.3. The configure phase
1.1 dsieger 6694:
1.154 rillig 6695: 21.3.1. Shared libraries - libtool
1.1 dsieger 6696:
6697: pkgsrc supports many different machines, with different object formats like
6698: a.out and ELF, and varying abilities to do shared library and dynamic loading
6699: at all. To accompany this, varying commands and options have to be passed to
6700: the compiler, linker, etc. to get the Right Thing, which can be pretty annoying
6701: especially if you don't have all the machines at your hand to test things. The
6702: devel/libtool pkg can help here, as it just "knows" how to build both static
6703: and dynamic libraries from a set of source files, thus being
6704: platform-independent.
6705:
6706: Here's how to use libtool in a package in seven simple steps:
6707:
6708: 1. Add USE_LIBTOOL=yes to the package Makefile.
6709:
6710: 2. For library objects, use "${LIBTOOL} --mode=compile ${CC}" in place of "$
6711: {CC}". You could even add it to the definition of CC, if only libraries are
6712: being built in a given Makefile. This one command will build both PIC and
6713: non-PIC library objects, so you need not have separate shared and
6714: non-shared library rules.
6715:
6716: 3. For the linking of the library, remove any "ar", "ranlib", and "ld
6717: -Bshareable" commands, and instead use:
6718:
6719: ${LIBTOOL} --mode=link \
6720: ${CC} -o ${.TARGET:.a=.la} \
6721: ${OBJS:.o=.lo} \
6722: -rpath ${PREFIX}/lib \
6723: -version-info major:minor
6724:
6725: Note that the library is changed to have a .la extension, and the objects
6726: are changed to have a .lo extension. Change OBJS as necessary. This
6727: automatically creates all of the .a, .so.major.minor, and ELF symlinks (if
6728: necessary) in the build directory. Be sure to include "-version-info",
6729: especially when major and minor are zero, as libtool will otherwise strip
6730: off the shared library version.
6731:
6732: From the libtool manual:
6733:
6734: So, libtool library versions are described by three integers:
6735:
6736: CURRENT
6737: The most recent interface number that this library implements.
6738:
6739: REVISION
6740: The implementation number of the CURRENT interface.
6741:
6742: AGE
6743: The difference between the newest and oldest interfaces that
6744: this library implements. In other words, the library implements
6745: all the interface numbers in the range from number `CURRENT -
6746: AGE' to `CURRENT'.
6747:
6748: If two libraries have identical CURRENT and AGE numbers, then the
6749: dynamic linker chooses the library with the greater REVISION number.
6750:
6751: The "-release" option will produce different results for a.out and ELF
1.25 wiz 6752: (excluding symlinks) in only one case. An ELF library of the form "
6753: libfoo-release.so.x.y" will have a symlink of "libfoo.so.x.y" on an a.out
1.1 dsieger 6754: platform. This is handled automatically.
6755:
6756: The "-rpath argument" is the install directory of the library being built.
6757:
6758: In the PLIST, include only the .la file, the other files will be added
6759: automatically.
6760:
6761: 4. When linking shared object (.so) files, i.e. files that are loaded via
6762: dlopen(3), NOT shared libraries, use "-module -avoid-version" to prevent
6763: them getting version tacked on.
6764:
6765: The PLIST file gets the foo.so entry.
6766:
6767: 5. When linking programs that depend on these libraries before they are
6768: installed, preface the cc(1) or ld(1) line with "${LIBTOOL} --mode=link",
6769: and it will find the correct libraries (static or shared), but please be
6770: aware that libtool will not allow you to specify a relative path in -L
6771: (such as "-L../somelib"), because it expects you to change that argument to
6772: be the .la file. e.g.
6773:
6774: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
6775:
6776: should be changed to:
6777:
6778: ${LIBTOOL} --mode=link ${CC} -o someprog ../somelib/somelib.la
6779:
6780: and it will do the right thing with the libraries.
6781:
6782: 6. When installing libraries, preface the install(1) or cp(1) command with "$
6783: {LIBTOOL} --mode=install", and change the library name to .la. e.g.
6784:
1.23 jakllsch 6785: ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 dsieger 6786:
6787: This will install the static .a, shared library, any needed symlinks, and
6788: run ldconfig(8).
6789:
6790: 7. In your PLIST, include only the .la file (this is a change from previous
6791: behaviour).
6792:
1.154 rillig 6793: 21.3.2. Using libtool on GNU packages that already support libtool
1.1 dsieger 6794:
6795: Add USE_LIBTOOL=yes to the package Makefile. This will override the package's
6796: own libtool in most cases. For older libtool using packages, libtool is made by
6797: ltconfig script during the do-configure step; you can check the libtool script
6798: location by doing make configure; find work*/ -name libtool.
6799:
6800: LIBTOOL_OVERRIDE specifies which libtool scripts, relative to WRKSRC, to
6801: override. By default, it is set to "libtool */libtool */*/libtool". If this
6802: does not match the location of the package's libtool script(s), set it as
6803: appropriate.
6804:
6805: If you do not need *.a static libraries built and installed, then use
6806: SHLIBTOOL_OVERRIDE instead.
6807:
6808: If your package makes use of the platform-independent library for loading
6809: dynamic shared objects, that comes with libtool (libltdl), you should include
6810: devel/libltdl/buildlink3.mk.
6811:
6812: Some packages use libtool incorrectly so that the package may not work or build
6813: in some circumstances. Some of the more common errors are:
6814:
6815: * The inclusion of a shared object (-module) as a dependent library in an
6816: executable or library. This in itself isn't a problem if one of two things
6817: has been done:
6818:
6819: 1. The shared object is named correctly, i.e. libfoo.la, not foo.la
6820:
6821: 2. The -dlopen option is used when linking an executable.
6822:
6823: * The use of libltdl without the correct calls to initialisation routines.
6824: The function lt_dlinit() should be called and the macro
6825: LTDL_SET_PRELOADED_SYMBOLS included in executables.
6826:
1.154 rillig 6827: 21.3.3. GNU Autoconf/Automake
1.1 dsieger 6828:
6829: If a package needs GNU autoconf or automake to be executed to regenerate the
6830: configure script and Makefile.in makefile templates, then they should be
6831: executed in a pre-configure target.
6832:
6833: For packages that need only autoconf:
6834:
6835: AUTOCONF_REQD= 2.50 # if default version is not good enough
6836: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
6837: ...
6838:
6839: pre-configure:
6840: cd ${WRKSRC} && autoconf
6841:
6842: ...
6843:
6844: and for packages that need automake and autoconf:
6845:
6846: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
6847: USE_TOOLS+= automake # use "automake14" for automake-1.4
6848: ...
6849:
6850: pre-configure:
6851: set -e; cd ${WRKSRC}; \
6852: aclocal; autoheader; automake -a --foreign -i; autoconf
6853:
6854: ...
6855:
6856: Packages which use GNU Automake will almost certainly require GNU Make.
6857:
6858: There are times when the configure process makes additional changes to the
6859: generated files, which then causes the build process to try to re-execute the
6860: automake sequence. This is prevented by touching various files in the configure
6861: stage. If this causes problems with your package you can set AUTOMAKE_OVERRIDE=
6862: NO in the package Makefile.
6863:
1.154 rillig 6864: 21.4. Programming languages
1.1 dsieger 6865:
1.154 rillig 6866: 21.4.1. C, C++, and Fortran
1.1 dsieger 6867:
6868: Compilers for the C, C++, and Fortran languages comes with the NetBSD base
6869: system. By default, pkgsrc assumes that a package is written in C and will hide
1.154 rillig 6870: all other compilers (via the wrapper framework, see Chapter 16, Buildlink
1.1 dsieger 6871: methodology).
6872:
6873: To declare which language's compiler a package needs, set the USE_LANGUAGES
6874: variable. Allowed values currently are "c", "c++", and "fortran" (and any
6875: combination). The default is "c". Packages using GNU configure scripts, even if
6876: written in C++, usually need a C compiler for the configure phase.
6877:
1.154 rillig 6878: 21.4.2. Java
1.1 dsieger 6879:
6880: If a program is written in Java, use the Java framework in pkgsrc. The package
6881: must include ../../mk/java-vm.mk. This Makefile fragment provides the following
6882: variables:
6883:
6884: * USE_JAVA defines if a build dependency on the JDK is added. If USE_JAVA is
6885: set to "run", then there is only a runtime dependency on the JDK. The
6886: default is "yes", which also adds a build dependency on the JDK.
6887:
6888: * Set USE_JAVA2 to declare that a package needs a Java2 implementation. The
6889: supported values are "yes", "1.4", and "1.5". "yes" accepts any Java2
6890: implementation, "1.4" insists on versions 1.4 or above, and "1.5" only
6891: accepts versions 1.5 or above. This variable is not set by default.
6892:
1.25 wiz 6893: * PKG_JAVA_HOME is automatically set to the runtime location of the used Java
6894: implementation dependency. It may be used to set JAVA_HOME to a good value
6895: if the program needs this variable to be defined.
6896:
1.154 rillig 6897: 21.4.3. Packages containing perl scripts
1.1 dsieger 6898:
6899: If your package contains interpreted perl scripts, add "perl" to the USE_TOOLS
6900: variable and set REPLACE_PERL to ensure that the proper interpreter path is
6901: set. REPLACE_PERL should contain a list of scripts, relative to WRKSRC, that
1.74 wiz 6902: you want adjusted. Every occurrence of */bin/perl in a she-bang line will be
6903: replaced with the full path to the perl executable.
1.1 dsieger 6904:
6905: If a particular version of perl is needed, set the PERL5_REQD variable to the
6906: version number. The default is "5.0".
6907:
1.154 rillig 6908: See Section 21.6.6, "Packages installing perl modules" for information about
1.1 dsieger 6909: handling perl modules.
6910:
1.154 rillig 6911: 21.4.4. Packages containing shell scripts
1.41 wiz 6912:
6913: REPLACE_SH, REPLACE_BASH, REPLACE_CSH, and REPLACE_KSH can be used to replace
6914: shell hash bangs in files. Please use the appropriate one, prefering REPLACE_SH
1.74 wiz 6915: in case this shell is sufficient. Each should contain a list of scripts,
6916: relative to WRKSRC, that you want adjusted. Every occurrence of the matching
6917: shell in a she-bang line will be replaced with the full path to the shell
6918: executable. When using REPLACE_BASH, don't forget to add bash to USE_TOOLS.
1.41 wiz 6919:
1.154 rillig 6920: 21.4.5. Other programming languages
1.1 dsieger 6921:
6922: Currently, there is no special handling for other languages in pkgsrc. If a
6923: compiler package provides a buildlink3.mk file, include that, otherwise just
6924: add a (build) dependency on the appropriate compiler package.
6925:
1.154 rillig 6926: 21.5. The build phase
1.1 dsieger 6927:
6928: The most common failures when building a package are that some platforms do not
6929: provide certain header files, functions or libraries, or they provide the
6930: functions in a library that the original package author didn't know. To work
6931: around this, you can rewrite the source code in most cases so that it does not
6932: use the missing functions or provides a replacement function.
6933:
1.154 rillig 6934: 21.5.1. Compiling C and C++ code conditionally
1.1 dsieger 6935:
6936: If a package already comes with a GNU configure script, the preferred way to
6937: fix the build failure is to change the configure script, not the code. In the
6938: other cases, you can utilize the C preprocessor, which defines certain macros
6939: depending on the operating system and hardware architecture it compiles for.
6940: These macros can be queried using for example #if defined(__i386). Almost every
6941: operating system, hardware architecture and compiler has its own macro. For
6942: example, if the macros __GNUC__, __i386__ and __NetBSD__ are all defined, you
6943: know that you are using NetBSD on an i386 compatible CPU, and your compiler is
6944: GCC.
6945:
6946: The list of the following macros for hardware and operating system depends on
6947: the compiler that is used. For example, if you want to conditionally compile
6948: code on Solaris, don't use __sun__, as the SunPro compiler does not define it.
6949: Use __sun instead.
6950:
1.154 rillig 6951: 21.5.1.1. C preprocessor macros to identify the operating system
1.1 dsieger 6952:
6953: To distinguish between 4.4 BSD-derived systems and the rest of the world, you
6954: should use the following code.
6955:
6956: #include <sys/param.h>
6957: #if (defined(BSD) && BSD >= 199306)
6958: /* BSD-specific code goes here */
6959: #else
6960: /* non-BSD-specific code goes here */
6961: #endif
6962:
6963: If this distinction is not fine enough, you can also test for the following
6964: macros.
6965:
1.46 obache 6966: Cygwin __CYGWIN__
6967: DragonFly __DragonFly__
1.1 dsieger 6968: FreeBSD __FreeBSD__
1.46 obache 6969: Haiku __HAIKU__
1.1 dsieger 6970: Interix __INTERIX
6971: IRIX __sgi (TODO: get a definite source for this)
6972: Linux linux, __linux, __linux__
1.83 dholland 6973: Mac OS X __APPLE__
1.46 obache 6974: MirBSD __MirBSD__ (__OpenBSD__ is also defined)
6975: Minix3 __minix
1.1 dsieger 6976: NetBSD __NetBSD__
6977: OpenBSD __OpenBSD__
6978: Solaris sun, __sun
6979:
1.154 rillig 6980: 21.5.1.2. C preprocessor macros to identify the hardware architecture
1.1 dsieger 6981:
6982: i386 i386, __i386, __i386__
6983: MIPS __mips
6984: SPARC sparc, __sparc
6985:
1.154 rillig 6986: 21.5.1.3. C preprocessor macros to identify the compiler
1.1 dsieger 6987:
6988: GCC __GNUC__ (major version), __GNUC_MINOR__
6989: MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41)
6990: SunPro __SUNPRO_C (0x570 for Sun C 5.7)
6991: SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8)
6992:
1.154 rillig 6993: 21.5.2. How to handle compiler bugs
1.1 dsieger 6994:
6995: Some source files trigger bugs in the compiler, based on combinations of
6996: compiler version and architecture and almost always relation to optimisation
6997: being enabled. Common symptoms are gcc internal errors or never finishing
6998: compiling a file.
6999:
7000: Typically, a workaround involves testing the MACHINE_ARCH and compiler version,
1.87 tnn 7001: disabling optimisation for that combination of file, MACHINE_ARCH and compiler.
7002:
7003: This used to be a big problem in the past, but is rarely needed now as compiler
7004: technology has matured. If you still need to add a compiler specific
7005: workaround, please do so in the file hacks.mk and describe the symptom and
7006: compiler version as detailed as possible.
1.1 dsieger 7007:
1.172 rillig 7008: 21.5.3. No such file or directory
7009:
7010: Compilation sometimes fails with an error message like this:
7011:
7012: .../x11/gtk3/work/gtk+-3.24.12/gdk/gdktypes.h:35:10:
7013: fatal error: pango/pango.h: No such file or directory
7014:
7015: The proper way to fix this problem depends on the type of the header, which is
7016: described in the following sections.
7017:
7018: 21.5.3.1. Headers from other packages
7019:
7020: If the header name looks like it comes from a different package, that other
7021: package should be included via the buildlink3 framework.
7022:
7023: First, look whether the header is somewhere in the buildlink3 directory below
7024: WRKDIR. In the above case of the missing Pango header:
7025:
7026: $ find work/.buildlink/ -print | grep -F pango/pango.h
7027:
7028: In the case of Pango, the output is:
7029:
7030: work/.buildlink/include/pango-1.0/pango/pango.h
7031:
7032: If the pango/pango.h file were placed directly in the .buildlink directory, it
7033: would have been found automatically. There is an extra pango-1.0 path component
7034: though, which means that the compiler command line must contain an option of
7035: the form -I${BUILDLINK3_PREFIX.pango}/include/pango-1.0. In most cases this
7036: option is generated by the configure script, which can be examined using:
7037:
7038: $ $ grep -o '[-]I[^[:space:]]*/pango[^[:space:]]*' work/*/Makefile
7039: -I/usr/pkg/include/pango-1.0
7040: -I/usr/pkg/include/pango-1.0
7041: -I/usr/pkg/include/pango-1.0
7042: -I/usr/pkg/include/pango-1.0
7043: -I/usr/pkg/include/pango-1.0
7044:
7045: This looks good. These options are transformed by the buildlink wrapper to
7046: refer to the correct path inside work/.buildlink.
7047:
7048: Since the compilation fails though, examine the compiler command lines in work
7049: /.work.log to see whether the -I option is included in the particular command
7050: line.
7051:
7052: To further analyze the situation, run bmake build-env, which sets up an
7053: interactive, realistic environment including all the pkgsrc wrapper commands
7054: and environment variables. From there, try to compile some simple example
7055: programs that use the header.
7056:
7057: 21.5.3.2. Headers generated during the build
7058:
7059: If the name of the header seems to come from the package itself, and if the
7060: build is run with parallel jobs, the package may have some undeclared
7061: dependencies between the .c and the .h files, and a C file is compiled before
7062: its required header is generated.
7063:
7064: To see whether the build runs with parallel jobs, run bmake show-all-build |
7065: grep JOBS. Its output looks like this:
7066:
7067: usr MAKE_JOBS= 7
7068: pkg MAKE_JOBS_SAFE # undefined
7069: def _MAKE_JOBS_N= 7
7070:
7071: In this case the pkgsrc user has asked pkgsrc to build packages with 7 jobs in
7072: parallel (MAKE_JOBS). The package could have disabled parallel builds by
7073: setting MAKE_JOBS_SAFE to no, but in this case it hasn't.
7074:
7075: To see whether the build failure is caused by parallel builds, first save the
7076: exact error message and a bit of context, maybe you need it later for reporting
7077: a bug. Next, run:
7078:
7079: MAKE_JOBS_SAFE=no bmake clean build
7080:
7081: If that succeeds, file a bug report against the pkgsrc package, including the
7082: exact error message and the contents of your mk.conf file.
7083:
1.173 rillig 7084: 21.5.3.3. Symlinks
7085:
7086: Pkgsrc does not work reliably if any of LOCALBASE, VARBASE or WRKDIR contains a
7087: symlink. Since 2019Q2, the pkgsrc bootstrap program prevents installing pkgsrc
7088: in symlink-based directories. Existing pkgsrc installations are not checked for
7089: symlinks though.
7090:
7091: The "No such file or directory" error messages are a typical symptom of
7092: symlinks, and it's quite difficult to find out that this is the actual cause.
7093:
7094: 21.5.3.4. Stale working directories
7095:
7096: When building a hierarchy of packages, it may happen that one package is built
7097: and then pkgsrc is updated. This situation can provoke various hard to diagnose
7098: build errors. To clean up the situation:
7099:
7100: $ (cd ../../ && test -f mk/bsd.pkg.mk && rm -rf */*/work)
7101:
7102: (The test for bsd.pkg.mk just prevents running this command in the wrong
7103: directory.)
7104:
7105: If you have set WRKOBJDIR in mk.conf, remove that directory as well.
7106:
7107: 21.5.3.5. Other possible reasons
7108:
7109: On platforms other than BSD, third-party packages are installed in /usr/
7110: include, together with the base system. This means that pkgsrc cannot
7111: distinguish between headers provided by the base system (which it needs) and
7112: headers from third-party packages (which are often included in pkgsrc as well).
7113: This can lead to subtle version mismatches.
7114:
7115: In pkgsrc installations that have been active for several years, it may happen
7116: that some files are manually deleted. To exclude this unlikely reason, run
7117: pkg_admin check.
7118:
7119: It may help to run pkg_admin rebuild-tree to check/fix dependencies.
7120:
7121: If all of the above doesn't help, see Chapter 2, Getting help for contact
7122: information. Be prepared to describe what you have tried so far and what any
7123: error messages were.
7124:
1.172 rillig 7125: 21.5.4. Undefined reference to "..."
1.1 dsieger 7126:
7127: This error message often means that a package did not link to a shared library
7128: it needs. The following functions are known to cause this error message over
7129: and over.
7130:
7131: +-----------------------------------------------------+
7132: | Function |Library |Affected platforms|
7133: |-------------------------+--------+------------------|
7134: |accept, bind, connect |-lsocket|Solaris |
7135: |-------------------------+--------+------------------|
7136: |crypt |-lcrypt |DragonFly, NetBSD |
7137: |-------------------------+--------+------------------|
7138: |dlopen, dlsym |-ldl |Linux |
7139: |-------------------------+--------+------------------|
7140: |gethost* |-lnsl |Solaris |
7141: |-------------------------+--------+------------------|
7142: |inet_aton |-lresolv|Solaris |
7143: |-------------------------+--------+------------------|
7144: |nanosleep, sem_*, timer_*|-lrt |Solaris |
7145: |-------------------------+--------+------------------|
7146: |openpty |-lutil |Linux |
7147: +-----------------------------------------------------+
7148:
7149: To fix these linker errors, it is often sufficient to say LIBS.OperatingSystem+
7150: = -lfoo to the package Makefile and then say bmake clean; bmake.
7151:
1.172 rillig 7152: 21.5.4.1. Special issue: The SunPro compiler
1.1 dsieger 7153:
7154: When you are using the SunPro compiler, there is another possibility. That
7155: compiler cannot handle the following code:
7156:
7157: extern int extern_func(int);
7158:
7159: static inline int
7160: inline_func(int x)
7161: {
7162: return extern_func(x);
7163: }
7164:
7165: int main(void)
7166: {
7167: return 0;
7168: }
7169:
7170: It generates the code for inline_func even if that function is never used. This
7171: code then refers to extern_func, which can usually not be resolved. To solve
7172: this problem you can try to tell the package to disable inlining of functions.
7173:
1.172 rillig 7174: 21.5.5. Running out of memory
1.1 dsieger 7175:
7176: Sometimes packages fail to build because the compiler runs into an operating
7177: system specific soft limit. With the UNLIMIT_RESOURCES variable pkgsrc can be
1.94 wiz 7178: told to unlimit the resources. Currently, the allowed values are any
7179: combination of "cputime", "datasize", "memorysize", and "stacksize". Setting
7180: this variable is similar to running the shell builtin ulimit command to raise
7181: the maximum data segment size or maximum stack size of a process, respectively,
7182: to their hard limits.
1.1 dsieger 7183:
1.154 rillig 7184: 21.6. The install phase
1.1 dsieger 7185:
1.154 rillig 7186: 21.6.1. Creating needed directories
1.1 dsieger 7187:
7188: The BSD-compatible install supplied with some operating systems cannot create
7189: more than one directory at a time. As such, you should call ${INSTALL_*_DIR}
7190: like this:
7191:
7192: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
7193: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
7194:
7195: You can also just append "dir1 dir2" to the INSTALLATION_DIRS variable, which
7196: will automatically do the right thing.
7197:
1.154 rillig 7198: 21.6.2. Where to install documentation
1.1 dsieger 7199:
7200: In general, documentation should be installed into ${PREFIX}/share/doc/$
7201: {PKGBASE} or ${PREFIX}/share/doc/${PKGNAME} (the latter includes the version
7202: number of the package).
7203:
7204: Many modern packages using GNU autoconf allow to set the directory where HTML
7205: documentation is installed with the "--with-html-dir" option. Sometimes using
7206: this flag is needed because otherwise the documentation ends up in ${PREFIX}/
7207: share/doc/html or other places.
7208:
7209: An exception to the above is that library API documentation generated with the
7210: textproc/gtk-doc tools, for use by special browsers (devhelp) should be left at
7211: their default location, which is ${PREFIX}/share/gtk-doc. Such documentation
7212: can be recognized from files ending in .devhelp or .devhelp2. (It is also
7213: acceptable to install such files in ${PREFIX}/share/doc/${PKGBASE} or ${PREFIX}
7214: /share/doc/${PKGNAME}; the .devhelp* file must be directly in that directory
7215: then, no additional subdirectory level is allowed in this case. This is usually
7216: achieved by using "--with-html-dir=${PREFIX}/share/doc". ${PREFIX}/share/
7217: gtk-doc is preferred though.)
7218:
1.154 rillig 7219: 21.6.3. Installing highscore files
1.1 dsieger 7220:
7221: Certain packages, most of them in the games category, install a score file that
7222: allows all users on the system to record their highscores. In order for this to
7223: work, the binaries need to be installed setgid and the score files owned by the
1.36 wiz 7224: appropriate group and/or owner (traditionally the "games" user/group). Set
7225: USE_GAMESGROUP to yes to support this. The following variables, documented in
7226: more detail in mk/defaults/mk.conf, control this behaviour: GAMEDATAMODE,
1.100 leot 7227: GAMEDIRMODE, GAMES_GROUP, GAMEMODE, GAME_USER. Other useful variables are:
7228: GAMEDIR_PERMS, GAMEDATA_PERMS and SETGID_GAMES_PERMS.
7229:
7230: An example that illustrates some of the variables described above is games/
7231: moon-buggy. OWN_DIRS_PERMS is used to properly set directory permissions of the
7232: directory where the scorefile is saved, REQD_FILES_PERMS is used to create a
7233: dummy scorefile (mbscore) with the proper permissions and SPECIAL_PERMS is used
7234: to install setgid the game binary:
7235:
7236: USE_GAMESGROUP= yes
7237:
7238: BUILD_DEFS+= VARBASE
7239:
7240: OWN_DIRS_PERMS+= ${VARBASE}/games/moon-buggy ${GAMEDIR_PERMS}
7241: REQD_FILES_PERMS+= /dev/null ${VARBASE}/games/moon-buggy/mbscore ${GAMEDATA_PERMS}
7242: SPECIAL_PERMS+= ${PREFIX}/bin/moon-buggy ${SETGID_GAMES_PERMS}
7243:
7244: Various INSTALL_* variables are also available: INSTALL_GAME to install setgid
7245: game binaries, INSTALL_GAME_DIR to install game directories that are needed to
7246: be accessed by setgid games and INSTALL_GAME_DATA to install scorefiles.
1.1 dsieger 7247:
1.14 jmcneill 7248: A package should therefore never hard code file ownership or access permissions
1.100 leot 7249: but rely on *_PERMS as described above or alternatively on INSTALL_GAME,
7250: INSTALL_GAME_DATA and INSTALL_GAME_DIR to set these correctly.
1.1 dsieger 7251:
1.154 rillig 7252: 21.6.4. Adding DESTDIR support to packages
1.4 rillig 7253:
1.14 jmcneill 7254: DESTDIR support means that a package installs into a staging directory, not the
7255: final location of the files. Then a binary package is created which can be used
7256: for installation as usual. There are two ways: Either the package must install
1.25 wiz 7257: as root ("destdir") or the package can install as non-root user ("user-destdir"
7258: ).
1.14 jmcneill 7259:
1.113 leot 7260: * PKG_DESTDIR_SUPPORT has to be set to "destdir" or "user-destdir". By
7261: default PKG_DESTDIR_SUPPORT is set to "user-destdir" to help catching more
7262: potential packaging problems. If bsd.prefs.mk is included in the Makefile,
7263: PKG_DESTDIR_SUPPORT needs to be set before the inclusion.
1.14 jmcneill 7264:
1.4 rillig 7265: * All installation operations have to be prefixed with ${DESTDIR}.
7266:
7267: * automake gets this DESTDIR mostly right automatically. Many manual rules
7268: and pre/post-install often are incorrect; fix them.
7269:
1.17 imil 7270: * If files are installed with special owner/group use SPECIAL_PERMS.
1.4 rillig 7271:
7272: * In general, packages should support UNPRIVILEGED to be able to use DESTDIR.
7273:
1.154 rillig 7274: 21.6.5. Packages with hardcoded paths to other interpreters
1.1 dsieger 7275:
7276: Your package may also contain scripts with hardcoded paths to other
7277: interpreters besides (or as well as) perl. To correct the full pathname to the
7278: script interpreter, you need to set the following definitions in your Makefile
7279: (we shall use tclsh in this example):
7280:
7281: REPLACE_INTERPRETER+= tcl
7282: REPLACE.tcl.old= .*/bin/tclsh
7283: REPLACE.tcl.new= ${PREFIX}/bin/tclsh
7284: REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
7285: # relative to ${WRKSRC}, just as in REPLACE_PERL
7286:
7287: Note
7288:
7289: Before March 2006, these variables were called _REPLACE.* and _REPLACE_FILES.*.
7290:
1.154 rillig 7291: 21.6.6. Packages installing perl modules
1.1 dsieger 7292:
7293: Makefiles of packages providing perl5 modules should include the Makefile
7294: fragment ../../lang/perl5/module.mk. It provides a do-configure target for the
7295: standard perl configuration for such modules as well as various hooks to tune
7296: this configuration. See comments in this file for details.
7297:
7298: Perl5 modules will install into different places depending on the version of
7299: perl used during the build process. To address this, pkgsrc will append lines
7300: to the PLIST corresponding to the files listed in the installed .packlist file
7301: generated by most perl5 modules. This is invoked by defining PERL5_PACKLIST to
1.48 wiz 7302: a space-separated list of packlist files relative to PERL5_PACKLIST_DIR
7303: (PERL5_INSTALLVENDORARCH by default), e.g.:
1.1 dsieger 7304:
1.48 wiz 7305: PERL5_PACKLIST= auto/Pg/.packlist
1.1 dsieger 7306:
1.48 wiz 7307: The perl5 config variables installarchlib, installscript, installvendorbin,
7308: installvendorscript, installvendorarch, installvendorlib, installvendorman1dir,
7309: and installvendorman3dir represent those locations in which components of perl5
7310: modules may be installed, provided as variable with uppercase and prefixed with
7311: PERL5_, e.g. PERL5_INSTALLARCHLIB and may be used by perl5 packages that don't
7312: have a packlist. These variables are also substituted for in the PLIST as
7313: uppercase prefixed with PERL5_SUB_.
1.1 dsieger 7314:
1.154 rillig 7315: 21.6.7. Packages installing info files
1.1 dsieger 7316:
7317: Some packages install info files or use the "makeinfo" or "install-info"
7318: commands. INFO_FILES should be defined in the package Makefile so that INSTALL
7319: and DEINSTALL scripts will be generated to handle registration of the info
7320: files in the Info directory file. The "install-info" command used for the info
7321: files registration is either provided by the system, or by a special purpose
7322: package automatically added as dependency if needed.
7323:
7324: PKGINFODIR is the directory under ${PREFIX} where info files are primarily
7325: located. PKGINFODIR defaults to "info" and can be overridden by the user.
7326:
7327: The info files for the package should be listed in the package PLIST; however
7328: any split info files need not be listed.
7329:
7330: A package which needs the "makeinfo" command at build time must add "makeinfo"
7331: to USE_TOOLS in its Makefile. If a minimum version of the "makeinfo" command is
7332: needed it should be noted with the TEXINFO_REQD variable in the package
7333: Makefile. By default, a minimum version of 3.12 is required. If the system does
7334: not provide a makeinfo command or if it does not match the required minimum, a
7335: build dependency on the devel/gtexinfo package will be added automatically.
7336:
7337: The build and installation process of the software provided by the package
7338: should not use the install-info command as the registration of info files is
1.25 wiz 7339: the task of the package INSTALL script, and it must use the appropriate
1.1 dsieger 7340: makeinfo command.
7341:
7342: To achieve this goal, the pkgsrc infrastructure creates overriding scripts for
7343: the install-info and makeinfo commands in a directory listed early in PATH.
7344:
7345: The script overriding install-info has no effect except the logging of a
7346: message. The script overriding makeinfo logs a message and according to the
7347: value of TEXINFO_REQD either runs the appropriate makeinfo command or exit on
7348: error.
7349:
1.154 rillig 7350: 21.6.8. Packages installing man pages
1.1 dsieger 7351:
7352: All packages that install manual pages should install them into the same
7353: directory, so that there is one common place to look for them. In pkgsrc, this
7354: place is ${PREFIX}/${PKGMANDIR}, and this expression should be used in
1.25 wiz 7355: packages. The default for PKGMANDIR is "man". Another often-used value is "
7356: share/man".
1.1 dsieger 7357:
7358: Note
7359:
7360: The support for a custom PKGMANDIR is far from complete.
7361:
7362: The PLIST files can just use man/ as the top level directory for the man page
7363: file entries, and the pkgsrc framework will convert as needed. In all other
7364: places, the correct PKGMANDIR must be used.
7365:
7366: Packages that are configured with GNU_CONFIGURE set as "yes", by default will
7367: use the ./configure --mandir switch to set where the man pages should be
7368: installed. The path is GNU_CONFIGURE_MANDIR which defaults to ${PREFIX}/$
7369: {PKGMANDIR}.
7370:
7371: Packages that use GNU_CONFIGURE but do not use --mandir, can set
7372: CONFIGURE_HAS_MANDIR to "no". Or if the ./configure script uses a non-standard
7373: use of --mandir, you can set GNU_CONFIGURE_MANDIR as needed.
7374:
1.154 rillig 7375: See Section 15.5, "Man page compression" for information on installation of
1.1 dsieger 7376: compressed manual pages.
7377:
1.154 rillig 7378: 21.6.9. Packages installing GConf data files
1.1 dsieger 7379:
1.7 rillig 7380: If a package installs .schemas or .entries files, used by GConf, you need to
1.1 dsieger 7381: take some extra steps to make sure they get registered in the database:
7382:
1.7 rillig 7383: 1. Include ../../devel/GConf/schemas.mk instead of its buildlink3.mk file.
7384: This takes care of rebuilding the GConf database at installation and
7385: deinstallation time, and tells the package where to install GConf data
1.1 dsieger 7386: files using some standard configure arguments. It also disallows any access
7387: to the database directly from the package.
7388:
7389: 2. Ensure that the package installs its .schemas files under ${PREFIX}/share/
7390: gconf/schemas. If they get installed under ${PREFIX}/etc, you will need to
7391: manually patch the package.
7392:
7393: 3. Check the PLIST and remove any entries under the etc/gconf directory, as
1.154 rillig 7394: they will be handled automatically. See Section 10.13, "How do I change the
1.1 dsieger 7395: location of configuration files?" for more information.
7396:
1.7 rillig 7397: 4. Define the GCONF_SCHEMAS variable in your Makefile with a list of all
1.1 dsieger 7398: .schemas files installed by the package, if any. Names must not contain any
7399: directories in them.
7400:
1.7 rillig 7401: 5. Define the GCONF_ENTRIES variable in your Makefile with a list of all
1.1 dsieger 7402: .entries files installed by the package, if any. Names must not contain any
7403: directories in them.
7404:
1.154 rillig 7405: 21.6.10. Packages installing scrollkeeper/rarian data files
1.1 dsieger 7406:
1.18 mishka 7407: If a package installs .omf files, used by scrollkeeper/rarian, you need to take
7408: some extra steps to make sure they get registered in the database:
1.1 dsieger 7409:
1.18 mishka 7410: 1. Include ../../mk/omf-scrollkeeper.mk instead of rarian's buildlink3.mk
7411: file. This takes care of rebuilding the scrollkeeper database at
7412: installation and deinstallation time, and disallows any access to it
7413: directly from the package.
1.1 dsieger 7414:
7415: 2. Check the PLIST and remove any entries under the libdata/scrollkeeper
7416: directory, as they will be handled automatically.
7417:
7418: 3. Remove the share/omf directory from the PLIST. It will be handled by
1.18 mishka 7419: rarian. (make print-PLIST does this automatically.)
1.1 dsieger 7420:
1.154 rillig 7421: 21.6.11. Packages installing X11 fonts
1.1 dsieger 7422:
7423: If a package installs font files, you will need to rebuild the fonts database
7424: in the directory where they get installed at installation and deinstallation
7425: time. This can be automatically done by using the pkginstall framework.
7426:
7427: You can list the directories where fonts are installed in the FONTS_DIRS.type
7428: variables, where type can be one of "ttf", "type1" or "x11". Also make sure
7429: that the database file fonts.dir is not listed in the PLIST.
7430:
7431: Note that you should not create new directories for fonts; instead use the
7432: standard ones to avoid that the user needs to manually configure his X server
7433: to find them.
7434:
1.154 rillig 7435: 21.6.12. Packages installing GTK2 modules
1.1 dsieger 7436:
7437: If a package installs GTK2 immodules or loaders, you need to take some extra
7438: steps to get them registered in the GTK2 database properly:
7439:
7440: 1. Include ../../x11/gtk2/modules.mk instead of its buildlink3.mk file. This
7441: takes care of rebuilding the database at installation and deinstallation
7442: time.
7443:
7444: 2. Set GTK2_IMMODULES=YES if your package installs GTK2 immodules.
7445:
7446: 3. Set GTK2_LOADERS=YES if your package installs GTK2 loaders.
7447:
7448: 4. Patch the package to not touch any of the GTK2 databases directly. These
7449: are:
7450:
1.42 asau 7451: + libdata/gtk-2.0/gdk-pixbuf.loaders
1.1 dsieger 7452:
1.42 asau 7453: + libdata/gtk-2.0/gtk.immodules
1.1 dsieger 7454:
7455: 5. Check the PLIST and remove any entries under the libdata/gtk-2.0 directory,
7456: as they will be handled automatically.
7457:
1.154 rillig 7458: 21.6.13. Packages installing SGML or XML data
1.1 dsieger 7459:
7460: If a package installs SGML or XML data files that need to be registered in
7461: system-wide catalogs (like DTDs, sub-catalogs, etc.), you need to take some
7462: extra steps:
7463:
7464: 1. Include ../../textproc/xmlcatmgr/catalogs.mk in your Makefile, which takes
7465: care of registering those files in system-wide catalogs at installation and
7466: deinstallation time.
7467:
7468: 2. Set SGML_CATALOGS to the full path of any SGML catalogs installed by the
7469: package.
7470:
7471: 3. Set XML_CATALOGS to the full path of any XML catalogs installed by the
7472: package.
7473:
7474: 4. Set SGML_ENTRIES to individual entries to be added to the SGML catalog.
7475: These come in groups of three strings; see xmlcatmgr(1) for more
7476: information (specifically, arguments recognized by the 'add' action). Note
7477: that you will normally not use this variable.
7478:
7479: 5. Set XML_ENTRIES to individual entries to be added to the XML catalog. These
7480: come in groups of three strings; see xmlcatmgr(1) for more information
7481: (specifically, arguments recognized by the 'add' action). Note that you
7482: will normally not use this variable.
7483:
1.154 rillig 7484: 21.6.14. Packages installing extensions to the MIME database
1.1 dsieger 7485:
7486: If a package provides extensions to the MIME database by installing .xml files
7487: inside ${PREFIX}/share/mime/packages, you need to take some extra steps to
7488: ensure that the database is kept consistent with respect to these new files:
7489:
7490: 1. Include ../../databases/shared-mime-info/mimedb.mk (avoid using the
7491: buildlink3.mk file from this same directory, which is reserved for
7492: inclusion from other buildlink3.mk files). It takes care of rebuilding the
7493: MIME database at installation and deinstallation time, and disallows any
7494: access to it directly from the package.
7495:
1.25 wiz 7496: 2. Check the PLIST and remove any entries under the share/mime directory,
1.1 dsieger 7497: except for files saved under share/mime/packages. The former are handled
7498: automatically by the update-mime-database program, but the latter are
7499: package-dependent and must be removed by the package that installed them in
7500: the first place.
7501:
7502: 3. Remove any share/mime/* directories from the PLIST. They will be handled by
7503: the shared-mime-info package.
7504:
1.154 rillig 7505: 21.6.15. Packages using intltool
1.1 dsieger 7506:
7507: If a package uses intltool during its build, add intltool to the USE_TOOLS,
7508: which forces it to use the intltool package provided by pkgsrc, instead of the
7509: one bundled with the distribution file.
7510:
7511: This tracks intltool's build-time dependencies and uses the latest available
7512: version; this way, the package benefits of any bug fixes that may have appeared
7513: since it was released.
7514:
1.154 rillig 7515: 21.6.16. Packages installing startup scripts
1.1 dsieger 7516:
7517: If a package contains a rc.d script, it won't be copied into the startup
7518: directory by default, but you can enable it, by adding the option
1.4 rillig 7519: PKG_RCD_SCRIPTS=YES in mk.conf. This option will copy the scripts into /etc/
7520: rc.d when a package is installed, and it will automatically remove the scripts
7521: when the package is deinstalled.
1.1 dsieger 7522:
1.154 rillig 7523: 21.6.17. Packages installing TeX modules
1.1 dsieger 7524:
7525: If a package installs TeX packages into the texmf tree, the ls-R database of
7526: the tree needs to be updated.
7527:
7528: Note
7529:
1.23 jakllsch 7530: Except the main TeX packages such as kpathsea, packages should install files
7531: into ${PREFIX}/share/texmf-dist, not ${PREFIX}/share/texmf.
1.1 dsieger 7532:
1.23 jakllsch 7533: 1. Include ../../print/kpathsea/texmf.mk. This takes care of rebuilding the
7534: ls-R database at installation and deinstallation time.
1.1 dsieger 7535:
1.23 jakllsch 7536: 2. If your package installs files into a texmf tree other than the one at $
7537: {PREFIX}/share/texmf-dist, set TEX_TEXMF_DIRS to the list of all texmf
7538: trees that need database update.
1.1 dsieger 7539:
7540: If your package also installs font map files that need to be registered
1.30 dholland 7541: using updmap, include ../../print/tex-tetex/map.mk and set TEX_MAP_FILES
7542: and/or TEX_MIXEDMAP_FILES to the list of all such font map files. Then
7543: updmap will be run automatically at installation/deinstallation to enable/
7544: disable font map files for TeX output drivers.
1.1 dsieger 7545:
7546: 3. Make sure that none of ls-R databases are included in PLIST, as they will
1.30 dholland 7547: be removed only by the kpathsea package.
1.1 dsieger 7548:
1.154 rillig 7549: 21.6.18. Packages supporting running binaries in emulation
1.1 dsieger 7550:
7551: There are some packages that provide libraries and executables for running
7552: binaries from a one operating system on a different one (if the latter supports
7553: it). One example is running Linux binaries on NetBSD.
7554:
7555: The pkgtools/rpm2pkg helps in extracting and packaging Linux rpm packages.
7556:
7557: The CHECK_SHLIBS can be set to no to avoid the check-shlibs target, which tests
7558: if all libraries for each installed executable can be found by the dynamic
7559: linker. Since the standard dynamic linker is run, this fails for emulation
7560: packages, because the libraries used by the emulation are not in the standard
7561: directories.
7562:
1.154 rillig 7563: 21.6.19. Packages installing hicolor theme icons
1.1 dsieger 7564:
7565: If a package installs images under the share/icons/hicolor and/or updates the
7566: share/icons/hicolor/icon-theme.cache database, you need to take some extra
7567: steps to make sure that the shared theme directory is handled appropriately and
7568: that the cache database is rebuilt:
7569:
7570: 1. Include ../../graphics/hicolor-icon-theme/buildlink3.mk.
7571:
7572: 2. Check the PLIST and remove the entry that refers to the theme cache.
7573:
7574: 3. Ensure that the PLIST does not remove the shared icon directories from the
7575: share/icons/hicolor hierarchy because they will be handled automatically.
7576:
7577: The best way to verify that the PLIST is correct with respect to the last two
7578: points is to regenerate it using make print-PLIST.
7579:
1.154 rillig 7580: 21.6.20. Packages installing desktop files
1.1 dsieger 7581:
7582: If a package installs .desktop files under share/applications and these include
1.54 rodent 7583: MIME information (MimeType key), you need to take extra steps to ensure that
7584: they are registered into the MIME database:
1.1 dsieger 7585:
7586: 1. Include ../../sysutils/desktop-file-utils/desktopdb.mk.
7587:
7588: 2. Check the PLIST and remove the entry that refers to the share/applications/
7589: mimeinfo.cache file. It will be handled automatically.
7590:
7591: The best way to verify that the PLIST is correct with respect to the last point
7592: is to regenerate it using make print-PLIST.
7593:
1.154 rillig 7594: 21.7. Marking packages as having problems
1.1 dsieger 7595:
1.23 jakllsch 7596: In some cases one does not have the time to solve a problem immediately. In
7597: this case, one can plainly mark a package as broken. For this, one just sets
7598: the variable BROKEN to the reason why the package is broken (similar to the
1.162 rillig 7599: PKG_FAIL_REASON variable). A user trying to build the package will immediately
7600: be shown this message, and the build will not be even tried.
1.1 dsieger 7601:
1.23 jakllsch 7602: BROKEN packages are removed from pkgsrc in irregular intervals.
1.1 dsieger 7603:
1.154 rillig 7604: Chapter 22. Debugging
1.1 dsieger 7605:
7606: To check out all the gotchas when building a package, here are the steps that I
7607: do in order to get a package working. Please note this is basically the same as
7608: what was explained in the previous sections, only with some debugging aids.
7609:
1.4 rillig 7610: * Be sure to set PKG_DEVELOPER=yes in mk.conf.
1.1 dsieger 7611:
7612: * Install pkgtools/url2pkg, create a directory for a new package, change into
7613: it, then run url2pkg:
7614:
7615: % mkdir /usr/pkgsrc/category/examplepkg
7616: % cd /usr/pkgsrc/category/examplepkg
1.174 leot 7617: % url2pkg https://www.example.com/path/to/distfile.tar.gz
1.1 dsieger 7618:
7619: * Edit the Makefile as requested.
7620:
7621: * Fill in the DESCR file
7622:
7623: * Run make configure
7624:
7625: * Add any dependencies glimpsed from documentation and the configure step to
7626: the package's Makefile.
7627:
7628: * Make the package compile, doing multiple rounds of
7629:
7630: % make
7631: % pkgvi ${WRKSRC}/some/file/that/does/not/compile
7632: % mkpatches
7633: % patchdiff
7634: % mv ${WRKDIR}/.newpatches/* patches
7635: % make mps
7636: % make clean
7637:
7638: Doing this step as non-root user will ensure that no files are modified
7639: that shouldn't be, especially during the build phase. mkpatches, patchdiff
7640: and pkgvi are from the pkgtools/pkgdiff package.
7641:
1.154 rillig 7642: * Look at the Makefile, fix if necessary; see Section 13.1, "Makefile".
1.1 dsieger 7643:
7644: * Generate a PLIST:
7645:
7646: # make install
7647: # make print-PLIST >PLIST
7648: # make deinstall
7649: # make install
7650: # make deinstall
7651:
7652: You usually need to be root to do this. Look if there are any files left:
7653:
7654: # make print-PLIST
7655:
7656: If this reveals any files that are missing in PLIST, add them.
7657:
7658: * Now that the PLIST is OK, install the package again and make a binary
7659: package:
7660:
7661: # make reinstall
7662: # make package
7663:
7664: * Delete the installed package:
7665:
7666: # pkg_delete examplepkg
7667:
7668: * Repeat the above make print-PLIST command, which shouldn't find anything
7669: now:
7670:
7671: # make print-PLIST
7672:
7673: * Reinstall the binary package:
7674:
7675: # pkg_add .../examplepkg.tgz
7676:
7677: * Play with it. Make sure everything works.
7678:
7679: * Run pkglint from pkgtools/pkglint, and fix the problems it reports:
7680:
7681: # pkglint
7682:
1.154 rillig 7683: * Submit (or commit, if you have cvs access); see Chapter 23, Submitting and
1.1 dsieger 7684: Committing.
7685:
1.154 rillig 7686: Chapter 23. Submitting and Committing
1.1 dsieger 7687:
7688: Table of Contents
7689:
1.154 rillig 7690: 23.1. Submitting binary packages
7691: 23.2. Submitting source packages (for non-NetBSD-developers)
7692: 23.3. General notes when adding, updating, or removing packages
7693: 23.4. Commit Messages
7694: 23.5. Committing: Adding a package to CVS
7695: 23.6. Updating a package to a newer version
7696: 23.7. Renaming a package in pkgsrc
7697: 23.8. Moving a package in pkgsrc
1.1 dsieger 7698:
1.154 rillig 7699: 23.1. Submitting binary packages
1.1 dsieger 7700:
7701: Our policy is that we accept binaries only from pkgsrc developers to guarantee
7702: that the packages don't contain any trojan horses etc. This is not to annoy
7703: anyone but rather to protect our users! You're still free to put up your
7704: home-made binary packages and tell the world where to get them. NetBSD
1.154 rillig 7705: developers doing bulk builds and wanting to upload them please see Chapter 8,
1.66 asau 7706: Creating binary packages for everything in pkgsrc (bulk builds).
1.1 dsieger 7707:
1.154 rillig 7708: 23.2. Submitting source packages (for non-NetBSD-developers)
1.1 dsieger 7709:
7710: First, check that your package is complete, compiles and runs well; see
1.154 rillig 7711: Chapter 22, Debugging and the rest of this document. Next, generate an
1.1 dsieger 7712: uuencoded gzipped tar(1) archive that contains all files that make up the
7713: package. Finally, send this package to the pkgsrc bug tracking system, either
7714: with the send-pr(1) command, or if you don't have that, go to the web page
1.174 leot 7715: https://www.NetBSD.org/support/send-pr.html, which contains some instructions
1.22 snj 7716: and a link to a form where you can submit packages. The sysutils/gtk-send-pr
7717: package is also available as a substitute for either of the above two tools.
1.1 dsieger 7718:
7719: In the form of the problem report, the category should be "pkg", the synopsis
7720: should include the package name and version number, and the description field
7721: should contain a short description of your package (contents of the COMMENT
1.25 wiz 7722: variable or DESCR file are OK). The uuencoded package data should go into the "
7723: fix" field.
1.1 dsieger 7724:
7725: If you want to submit several packages, please send a separate PR for each one,
7726: it's easier for us to track things that way.
7727:
7728: Alternatively, you can also import new packages into pkgsrc-wip ("pkgsrc
1.174 leot 7729: work-in-progress"); see the homepage at https://pkgsrc.org/wip/ for details.
1.1 dsieger 7730:
1.154 rillig 7731: 23.3. General notes when adding, updating, or removing packages
1.1 dsieger 7732:
7733: Please note all package additions, updates, moves, and removals in pkgsrc/doc/
7734: CHANGES-YYYY. It's very important to keep this file up to date and conforming
7735: to the existing format, because it will be used by scripts to automatically
7736: update pages on www.NetBSD.org and other sites. Additionally, check the pkgsrc/
7737: doc/TODO file and remove the entry for the package you updated or removed, in
7738: case it was mentioned there.
7739:
7740: When the PKGREVISION of a package is bumped, the change should appear in pkgsrc
7741: /doc/CHANGES-YYYY if it is security related or otherwise relevant. Mass bumps
7742: that result from a dependency being updated should not be mentioned. In all
7743: other cases it's the developer's decision.
7744:
7745: There is a make target that helps in creating proper CHANGES-YYYY entries: make
7746: changes-entry. It uses the optional CTYPE and NETBSD_LOGIN_NAME variables. The
7747: general usage is to first make sure that your CHANGES-YYYY file is up-to-date
7748: (to avoid having to resolve conflicts later-on) and then to cd to the package
7749: directory. For package updates, make changes-entry is enough. For new packages,
7750: or package moves or removals, set the CTYPE variable on the command line to
1.4 rillig 7751: "Added", "Moved", or "Removed". You can set NETBSD_LOGIN_NAME in mk.conf if
1.23 jakllsch 7752: your local login name is not the same as your NetBSD login name. The target
7753: also automatically removes possibly existing entries for the package in the
7754: TODO file. Don't forget to commit the changes, e.g. by using make
1.66 asau 7755: commit-changes-entry! If you are not using a checkout directly from
1.23 jakllsch 7756: cvs.NetBSD.org, but e.g. a local copy of the repository, you can set
7757: USE_NETBSD_REPO=yes. This makes the cvs commands use the main repository.
1.1 dsieger 7758:
1.154 rillig 7759: 23.4. Commit Messages
1.130 wiz 7760:
7761: For several years, there have been mirrors of pkgsrc in fossil, git, and hg.
7762: Standard practise when using these tools is to make the first line of a commit
7763: message function as a summary that can be read without the rest, such as is
7764: commonly done with "git log --oneline". For this reason, we have the following
7765: guidelines for pkgsrc commit messages:
7766:
1.131 wiz 7767: * Start the commit message with a line that explains the big picture in 65
1.130 wiz 7768: characters or less. When a commit is for one package, include the name of
7769: the package. For updates, include the version to which it is updated.
7770:
7771: * Leave the next line empty.
7772:
7773: * Then come the details for the commit (changes in that package, reason for a
7774: change) and any relevant PRs. Wrap this section.
7775:
7776: Here is an example:
7777:
7778: libxslt: update to 1.0.30
7779:
7780: Changes since 1.0.29:
7781: ...
7782:
7783:
7784: Here is another example:
7785:
7786: mk/bsd.pkg.mk: enable SSP by default on NetBSD
7787:
7788: (rationale)
7789:
7790:
7791: Commit messages are final: no "cvs admin" is allowed on the pkgsrc repository
7792: to change commit messages.
7793:
1.154 rillig 7794: 23.5. Committing: Adding a package to CVS
1.1 dsieger 7795:
7796: This section is only of interest for pkgsrc developers with write access to the
1.34 wiz 7797: pkgsrc repository.
7798:
7799: When the package is finished, "cvs add" the files. Start by adding the
7800: directory and then files in the directory. Don't forget to add the new package
7801: to the category's Makefile. Make sure you don't forget any files; you can check
7802: by running "cvs status". An example:
7803:
7804: $ cd .../pkgsrc/category
7805: $ cvs add pkgname
7806: $ cd pkgname
7807: $ cvs add DESCR Makefile PLIST distinfo buildlink3.mk patches
7808: $ cvs add patches/p*
7809: $ cvs status | less
1.35 wiz 7810: $ cvs commit
1.34 wiz 7811: $ cd ..
7812: $ vi Makefile # add SUBDIRS+=pkgname line
1.35 wiz 7813: $ cvs commit Makefile
1.66 asau 7814: $ cd pkgname
1.73 jnemeth 7815: $ make CTYPE=Added commit-changes-entry
1.1 dsieger 7816:
7817: The commit message of the initial import should include part of the DESCR file,
7818: so people reading the mailing lists know what the package is/does.
7819:
1.34 wiz 7820: Also mention the new package in pkgsrc/doc/CHANGES-20xx.
7821:
7822: Previously, "cvs import" was suggested, but it was much easier to get wrong
7823: than "cvs add".
1.1 dsieger 7824:
1.154 rillig 7825: 23.6. Updating a package to a newer version
1.1 dsieger 7826:
7827: Please always put a concise, appropriate and relevant summary of the changes
7828: between old and new versions into the commit log when updating a package. There
7829: are various reasons for this:
7830:
7831: * A URL is volatile, and can change over time. It may go away completely or
7832: its information may be overwritten by newer information.
7833:
7834: * Having the change information between old and new versions in our CVS
7835: repository is very useful for people who use either cvs or anoncvs.
7836:
7837: * Having the change information between old and new versions in our CVS
7838: repository is very useful for people who read the pkgsrc-changes mailing
7839: list, so that they can make tactical decisions about when to upgrade the
7840: package.
7841:
7842: Please also recognize that, just because a new version of a package has been
7843: released, it should not automatically be upgraded in the CVS repository. We
7844: prefer to be conservative in the packages that are included in pkgsrc -
7845: development or beta packages are not really the best thing for most places in
7846: which pkgsrc is used. Please use your judgement about what should go into
7847: pkgsrc, and bear in mind that stability is to be preferred above new and
7848: possibly untested features.
7849:
1.154 rillig 7850: 23.7. Renaming a package in pkgsrc
1.21 snj 7851:
7852: Renaming packages is not recommended.
7853:
1.175 gutterid 7854: When renaming packages, be sure to fix any references to the old name in other
1.21 snj 7855: Makefiles, options, buildlink files, etc.
7856:
1.175 gutterid 7857: Also, when renaming a package, please add the package name and version pattern
1.167 leot 7858: (s) of the previous package to SUPERSEDES. This may be repeated for multiple
7859: renames. The new package would be an exact replacement. Example:
7860:
7861: SUPERSEDES+= p5-IO-Compress-Zlib<2.017
7862: SUPERSEDES+= optcomp-[0-9]*
1.21 snj 7863:
7864: Note that "successor" in the CHANGES-YYYY file doesn't necessarily mean that it
7865: supersedes, as that successor may not be an exact replacement but is a
7866: suggestion for the replaced functionality.
7867:
1.154 rillig 7868: 23.8. Moving a package in pkgsrc
1.21 snj 7869:
7870: It is preferred that packages are not renamed or moved, but if needed please
7871: follow these steps.
1.1 dsieger 7872:
7873: 1. Make a copy of the directory somewhere else.
7874:
7875: 2. Remove all CVS dirs.
7876:
7877: Alternatively to the first two steps you can also do:
7878:
7879: % cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package
7880:
7881: and use that for further work.
7882:
1.25 wiz 7883: 3. Fix CATEGORIES and any DEPENDS paths that just did "../package" instead of
1.1 dsieger 7884: "../../category/package".
7885:
1.21 snj 7886: 4. In the modified package's Makefile, consider setting PREV_PKGPATH to the
7887: previous category/package pathname. The PREV_PKGPATH can be used by tools
7888: for doing an update using pkgsrc building; for example, it can search the
7889: pkg_summary(5) database for PREV_PKGPATH (if no SUPERSEDES) and then use
7890: the corresponding new PKGPATH for that moved package. Note that it may have
7891: multiple matches, so the tool should also check on the PKGBASE too. The
7892: PREV_PKGPATH probably has no value unless SUPERSEDES is not set, i.e.
7893: PKGBASE stays the same.
7894:
7895: 5. cvs import the modified package in the new place.
1.1 dsieger 7896:
1.21 snj 7897: 6. Check if any package depends on it:
1.1 dsieger 7898:
7899: % cd /usr/pkgsrc
7900: % grep /package */*/Makefile* */*/buildlink*
7901:
1.21 snj 7902: 7. Fix paths in packages from step 5 to point to new location.
1.1 dsieger 7903:
1.21 snj 7904: 8. cvs rm (-f) the package at the old location.
1.1 dsieger 7905:
1.21 snj 7906: 9. Remove from oldcategory/Makefile.
1.1 dsieger 7907:
1.21 snj 7908: 10. Add to newcategory/Makefile.
1.1 dsieger 7909:
1.21 snj 7910: 11. Commit the changed and removed files:
1.1 dsieger 7911:
7912: % cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile
7913:
7914: (and any packages from step 5, of course).
7915:
1.154 rillig 7916: Chapter 24. Frequently Asked Questions
1.1 dsieger 7917:
7918: This section contains the answers to questions that may arise when you are
7919: writing a package. If you don't find your question answered here, first have a
7920: look in the other chapters, and if you still don't have the answer, ask on the
7921: pkgsrc-users mailing list.
7922:
1.154 rillig 7923: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
7924: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
7925: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
7926: 24.4. What is the difference between BUILDLINK_LDFLAGS, BUILDLINK_LDADD and
1.1 dsieger 7927: BUILDLINK_LIBS?
1.154 rillig 7928: 24.5. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
7929: 24.6. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.1 dsieger 7930: the := inside it.
1.154 rillig 7931: 24.7. Which mailing lists are there for package developers?
7932: 24.8. Where is the pkgsrc documentation?
7933: 24.9. I have a little time to kill. What shall I do?
1.1 dsieger 7934:
1.154 rillig 7935: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
1.1 dsieger 7936:
7937: MAKEFLAGS are the flags passed to the pkgsrc-internal invocations of make
7938: (1), while MAKE_FLAGS are the flags that are passed to the MAKE_PROGRAM
7939: when building the package. [FIXME: What is .MAKEFLAGS for?]
7940:
1.154 rillig 7941: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
1.1 dsieger 7942:
7943: MAKE is the path to the make(1) program that is used in the pkgsrc
7944: infrastructure. GMAKE is the path to GNU Make, but you need to say
7945: USE_TOOLS+=gmake to use that. MAKE_PROGRAM is the path to the Make
7946: program that is used for building the package.
7947:
1.154 rillig 7948: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
1.1 dsieger 7949:
7950: CC is the path to the real C compiler, which can be configured by the
7951: pkgsrc user. PKG_CC is the path to the compiler wrapper. PKGSRC_COMPILER
7952: is not a path to a compiler, but the type of compiler that should be
7953: used. See mk/compiler.mk for more information about the latter variable.
7954:
1.154 rillig 7955: 24.4. What is the difference between BUILDLINK_LDFLAGS, BUILDLINK_LDADD and
1.1 dsieger 7956: BUILDLINK_LIBS?
7957:
7958: [FIXME]
7959:
1.154 rillig 7960: 24.5. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
1.1 dsieger 7961:
1.25 wiz 7962: For optimization reasons, some variables are only available in the "
7963: wrapper" phase and later. To "simulate" the wrapper phase, append
1.1 dsieger 7964: PKG_PHASE=wrapper to the above command.
7965:
1.154 rillig 7966: 24.6. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.1 dsieger 7967: the := inside it.
7968:
1.108 rillig 7969: The := is not really an assignment operator, although it looks like it.
7970: Instead, it is a degenerate form of ${LIST:old_string=new_string}, which
7971: is documented in the make(1) man page and which is commonly used in the
7972: form ${SRCS:.c=.o}. In the case of MASTER_SITE_*, old_string is the empty
7973: string and new_string is package/. That's where the : and the = fall
7974: together.
1.1 dsieger 7975:
1.154 rillig 7976: 24.7. Which mailing lists are there for package developers?
1.1 dsieger 7977:
7978: tech-pkg
7979:
7980: This is a list for technical discussions related to pkgsrc
7981: development, e.g. soliciting feedback for changes to pkgsrc
7982: infrastructure, proposed new features, questions related to porting
7983: pkgsrc to a new platform, advice for maintaining a package, patches
7984: that affect many packages, help requests moved from pkgsrc-users when
7985: an infrastructure bug is found, etc.
7986:
7987: pkgsrc-bugs
7988:
7989: All bug reports in category "pkg" sent with send-pr(1) appear here.
7990: Please do not report your bugs here directly; use one of the other
7991: mailing lists.
7992:
1.154 rillig 7993: 24.8. Where is the pkgsrc documentation?
1.1 dsieger 7994:
7995: There are many places where you can find documentation about pkgsrc:
7996:
7997: * The pkgsrc guide (this document) is a collection of chapters that
7998: explain large parts of pkgsrc, but some chapters tend to be outdated.
7999: Which ones they are is hard to say.
8000:
1.174 leot 8001: * On the mailing list archives (see https://mail-index.NetBSD.org/),
8002: you can find discussions about certain features, announcements of new
1.1 dsieger 8003: parts of the pkgsrc infrastructure and sometimes even announcements
8004: that a certain feature has been marked as obsolete. The benefit here
8005: is that each message has a date appended to it.
8006:
8007: * Many of the files in the mk/ directory start with a comment that
8008: describes the purpose of the file and how it can be used by the
8009: pkgsrc user and package authors. An easy way to find this
8010: documentation is to run bmake help.
8011:
8012: * The CVS log messages are a rich source of information, but they tend
8013: to be highly abbreviated, especially for actions that occur often.
8014: Some contain a detailed description of what has changed, but they are
8015: geared towards the other pkgsrc developers, not towards an average
8016: pkgsrc user. They also only document changes, so if you don't know
8017: what has been before, these messages may not be worth too much to
8018: you.
8019:
8020: * Some parts of pkgsrc are only "implicitly documented", that is the
8021: documentation exists only in the mind of the developer who wrote the
8022: code. To get this information, use the cvs annotate command to see
8023: who has written it and ask on the tech-pkg mailing list, so that
8024: others can find your questions later (see above). To be sure that the
8025: developer in charge reads the mail, you may CC him or her.
8026:
1.154 rillig 8027: 24.9. I have a little time to kill. What shall I do?
1.1 dsieger 8028:
8029: This is not really an FAQ yet, but here's the answer anyway.
8030:
8031: * Run pkg_chk -N (from the pkgtools/pkg_chk package). It will tell you
8032: about newer versions of installed packages that are available, but
8033: not yet updated in pkgsrc.
8034:
8035: * Browse pkgsrc/doc/TODO ? it contains a list of suggested new packages
8036: and a list of cleanups and enhancements for pkgsrc that would be nice
8037: to have.
8038:
1.71 wiz 8039: * Review packages for which review was requested on the tech-pkg
8040: mailing list.
1.1 dsieger 8041:
1.154 rillig 8042: Chapter 25. GNOME packaging and porting
1.1 dsieger 8043:
8044: Table of Contents
8045:
1.154 rillig 8046: 25.1. Meta packages
8047: 25.2. Packaging a GNOME application
8048: 25.3. Updating GNOME to a newer version
8049: 25.4. Patching guidelines
1.1 dsieger 8050:
8051: Quoting GNOME's web site:
8052:
8053: The GNOME project provides two things: The GNOME desktop environment, an
8054: intuitive and attractive desktop for users, and the GNOME development
8055: platform, an extensive framework for building applications that integrate
8056: into the rest of the desktop.
8057:
8058: pkgsrc provides a seamless way to automatically build and install a complete
8059: GNOME environment under many different platforms. We can say with confidence
8060: that pkgsrc is one of the most advanced build and packaging systems for GNOME
8061: due to its included technologies buildlink3, the wrappers and tools framework
8062: and automatic configuration file management. Lots of efforts are put into
8063: achieving a completely clean deinstallation of installed software components.
8064:
8065: Given that pkgsrc is NetBSD's official packaging system, the above also means
8066: that great efforts are put into making GNOME work under this operating system.
8067: Recently, DragonFly BSD also adopted pkgsrc as its preferred packaging system,
8068: contributing lots of portability fixes to make GNOME build and install under
8069: it.
8070:
8071: This chapter is aimed at pkgsrc developers and other people interested in
8072: helping our GNOME porting and packaging efforts. It provides instructions on
8073: how to manage the existing packages and some important information regarding
8074: their internals.
8075:
8076: We need your help!
8077:
8078: Should you have some spare cycles to devote to NetBSD, pkgsrc and GNOME and are
8079: willing to learn new exciting stuff, please jump straight to the pending work
8080: list! There is still a long way to go to get a fully-functional GNOME desktop
8081: under NetBSD and we need your help to achieve it!
8082:
1.154 rillig 8083: 25.1. Meta packages
1.1 dsieger 8084:
8085: pkgsrc includes three GNOME-related meta packages:
8086:
8087: * meta-pkgs/gnome-base: Provides the core GNOME desktop environment. It only
8088: includes the necessary bits to get it to boot correctly, although it may
8089: lack important functionality for daily operation. The idea behind this
8090: package is to let end users build their own configurations on top of this
8091: one, first installing this meta package to achieve a functional setup and
8092: then adding individual applications.
8093:
8094: * meta-pkgs/gnome: Provides a complete installation of the GNOME platform and
8095: desktop as defined by the GNOME project; this is based on the components
8096: distributed in the platform/x.y/x.y.z/sources and desktop/x.y/x.y.z/sources
8097: directories of the official FTP server. Developer-only tools found in those
8098: directories are not installed unless required by some other component to
8099: work properly. Similarly, packages from the bindings set (bindings/x.y/
8100: x.y.z/sources) are not pulled in unless required as a dependency for an
8101: end-user component. This package "extends" meta-pkgs/gnome-base.
8102:
8103: * meta-pkgs/gnome-devel: Installs all the tools required to build a GNOME
8104: component when fetched from the CVS repository. These are required to let
8105: the autogen.sh scripts work appropriately.
8106:
8107: In all these packages, the DEPENDS lines are sorted in a way that eases
8108: updates: a package may depend on other packages listed before it but not on any
1.25 wiz 8109: listed after it. It is very important to keep this order to ease updates so...
1.1 dsieger 8110: do not change it to alphabetical sorting!
8111:
1.154 rillig 8112: 25.2. Packaging a GNOME application
1.1 dsieger 8113:
8114: Almost all GNOME applications are written in C and use a common set of tools as
8115: their build system. Things get different with the new bindings to other
8116: languages (such as Python), but the following will give you a general idea on
8117: the minimum required tools:
8118:
8119: * Almost all GNOME applications use the GNU Autotools as their build system.
8120: As a general rule you will need to tell this to your package:
8121:
8122: GNU_CONFIGURE=yes
8123: USE_LIBTOOL=yes
8124: USE_TOOLS+=gmake
8125:
8126: * If the package uses pkg-config to detect dependencies, add this tool to the
8127: list of required utilities:
8128:
8129: USE_TOOLS+=pkg-config
8130:
8131: Also use pkgtools/verifypc at the end of the build process to ensure that
8132: you did not miss to specify any dependency in your package and that the
8133: version requirements are all correct.
8134:
8135: * If the package uses intltool, be sure to add intltool to the USE_TOOLS to
8136: handle dependencies and to force the package to use the latest available
8137: version.
8138:
8139: * If the package uses gtk-doc (a documentation generation utility), do not
8140: add a dependency on it. The tool is rather big and the distfile should come
8141: with pregenerated documentation anyway; if it does not, it is a bug that
8142: you ought to report. For such packages you should disable gtk-doc (unless
8143: it is the default):
8144:
8145: CONFIGURE_ARGS+=--disable-gtk-doc
8146:
8147: The default location of installed HTML files (share/gtk-doc/<package-name>)
8148: is correct and should not be changed unless the package insists on
8149: installing them somewhere else. Otherwise programs as devhelp will not be
8150: able to open them. You can do that with an entry similar to:
8151:
8152: CONFIGURE_ARGS+=--with-html-dir=${PREFIX}/share/gtk-doc/...
8153:
8154: GNOME uses multiple shared directories and files under the installation prefix
8155: to maintain databases. In this context, shared means that those exact same
8156: directories and files are used among several different packages, leading to
8157: conflicts in the PLIST. pkgsrc currently includes functionality to handle the
8158: most common cases, so you have to forget about using @unexec ${RMDIR} lines in
8159: your file lists and omitting shared files from them. If you find yourself doing
8160: those, your package is most likely incorrect.
8161:
8162: The following table lists the common situations that result in using shared
8163: directories or files. For each of them, the appropriate solution is given.
1.25 wiz 8164: After applying the solution be sure to regenerate the package's file list with
1.1 dsieger 8165: make print-PLIST and ensure it is correct.
8166:
1.154 rillig 8167: Table 25.1. PLIST handling for GNOME packages
1.1 dsieger 8168:
8169: +-----------------------------------------------------------------------------+
8170: | If the package... | Then... |
8171: |-------------------------------------------+---------------------------------|
1.154 rillig 8172: | |See Section 21.6.10, "Packages |
1.18 mishka 8173: |Installs OMF files under share/omf. |installing scrollkeeper/rarian |
8174: | |data files". |
1.1 dsieger 8175: |-------------------------------------------+---------------------------------|
1.154 rillig 8176: |Installs icons under the share/icons/ |See Section 21.6.19, "Packages |
1.1 dsieger 8177: |hicolor hierarchy or updates share/icons/ |installing hicolor theme icons". |
8178: |hicolor/icon-theme.cache. | |
8179: |-------------------------------------------+---------------------------------|
1.154 rillig 8180: | |See Section 21.6.14, "Packages |
1.1 dsieger 8181: |Installs files under share/mime/packages. |installing extensions to the MIME|
8182: | |database". |
8183: |-------------------------------------------+---------------------------------|
1.154 rillig 8184: |Installs .desktop files under share/ |See Section 21.6.20, "Packages |
1.1 dsieger 8185: |applications and these include MIME |installing desktop files". |
8186: |information. | |
8187: +-----------------------------------------------------------------------------+
8188:
8189:
1.154 rillig 8190: 25.3. Updating GNOME to a newer version
1.1 dsieger 8191:
8192: When seeing GNOME as a whole, there are two kinds of updates:
8193:
8194: Major update
8195:
8196: Given that there is still a very long way for GNOME 3 (if it ever appears),
8197: we consider a major update one that goes from a 2.X version to a 2.Y one,
8198: where Y is even and greater than X. These are hard to achieve because they
8199: introduce lots of changes in the components' code and almost all GNOME
8200: distfiles are updated to newer versions. Some of them can even break API
8201: and ABI compatibility with the previous major version series. As a result,
8202: the update needs to be done all at once to minimize breakage.
8203:
8204: A major update typically consists of around 80 package updates and the
8205: addition of some new ones.
8206:
8207: Minor update
8208:
8209: We consider a minor update one that goes from a 2.A.X version to a 2.A.Y
8210: one where Y is greater than X. These are easy to achieve because they do
8211: not update all GNOME components, can be done in an incremental way and do
8212: not break API nor ABI compatibility.
8213:
8214: A minor update typically consists of around 50 package updates, although
8215: the numbers here may vary a lot.
8216:
8217: In order to update the GNOME components in pkgsrc to a new stable release
8218: (either major or minor), the following steps should be followed:
8219:
8220: 1. Get a list of all the tarballs that form the new release by using the
1.19 snj 8221: following commands. These will leave the full list of the components'
1.1 dsieger 8222: distfiles into the list.txt file:
8223:
8224: % echo ls "*.tar.bz2" | \
8225: ftp -V ftp://ftp.gnome.org/pub/gnome/platform/x.y/x.y.z/sources/ | \
8226: awk '{ print $9 }' >list.txt
8227: % echo ls "*.tar.bz2" | \
8228: ftp -V ftp://ftp.gnome.org/pub/gnome/desktop/x.y/x.y.z/sources/ | \
8229: awk '{ print $9 }' >>list.txt
8230:
8231: 2. Open each meta package's Makefile and bump their version to the release you
8232: are updating them to. The three meta packages should be always consistent
8233: with versioning. Obviously remove any PKGREVISIONs that might be in them.
8234:
8235: 3. For each meta package, update all its DEPENDS lines to match the latest
8236: versions as shown by the above commands. Do not list any newer version
8237: (even if found in the FTP) because the meta packages are supposed to list
8238: the exact versions that form a specific GNOME release. Exceptions are
8239: permitted here if a newer version solves a serious issue in the overall
8240: desktop experience; these typically come in the form of a revision bump in
8241: pkgsrc, not in newer versions from the developers.
8242:
8243: Packages not listed in the list.txt file should be updated to the latest
8244: version available (if found in pkgsrc). This is the case, for example, of
8245: the dependencies on the GNU Autotools in the meta-pkgs/gnome-devel meta
8246: package.
8247:
8248: 4. Generate a patch from the modified meta packages and extract the list of
8249: "new" lines. This will provide you an outline on what packages need to be
8250: updated in pkgsrc and in what order:
8251:
8252: % cvs diff -u gnome-devel gnome-base gnome | grep '^+D' >todo.txt
8253:
8254: 5. For major desktop updates it is recommended to zap all your installed
8255: packages and start over from scratch at this point.
8256:
8257: 6. Now comes the longest step by far: iterate over the contents of todo.txt
8258: and update the packages listed in it in order. For major desktop updates
8259: none of these should be committed until the entire set is completed because
8260: there are chances of breaking not-yet-updated packages.
8261:
8262: 7. Once the packages are up to date and working, commit them to the tree one
8263: by one with appropriate log messages. At the end, commit the three meta
8264: package updates and all the corresponding changes to the doc/CHANGES-<YEAR>
8265: and pkgsrc/doc/TODO files.
8266:
1.154 rillig 8267: 25.4. Patching guidelines
1.1 dsieger 8268:
8269: GNOME is a very big component in pkgsrc which approaches 100 packages. Please,
8270: it is very important that you always, always, always feed back any portability
8271: fixes you do to a GNOME package to the mainstream developers (see
1.154 rillig 8272: Section 13.3.5, "Feedback to the author"). This is the only way to get their
1.1 dsieger 8273: attention on portability issues and to ensure that future versions can be built
8274: out-of-the box on NetBSD. The less custom patches in pkgsrc, the easier further
8275: updates are. Those developers in charge of issuing major GNOME updates will be
8276: grateful if you do that.
8277:
8278: The most common places to report bugs are the GNOME's Bugzilla and the
8279: freedesktop.org's Bugzilla. Not all components use these to track bugs, but
8280: most of them do. Do not be short on your reports: always provide detailed
8281: explanations of the current failure, how it can be improved to achieve maximum
8282: portability and, if at all possible, provide a patch against CVS head. The more
8283: verbose you are, the higher chances of your patch being accepted.
8284:
8285: Also, please avoid using preprocessor magic to fix portability issues. While
8286: the FreeBSD GNOME people are doing a great job in porting GNOME to their
8287: operating system, the official GNOME sources are now plagued by conditionals
8288: that check for __FreeBSD__ and similar macros. This hurts portability. Please
1.154 rillig 8289: see our patching guidelines (Section 13.3.4, "Patching guidelines") for more
1.1 dsieger 8290: details.
8291:
8292: Part III. The pkgsrc infrastructure internals
8293:
8294: This part of the guide deals with everything from the infrastructure that is
8295: behind the interfaces described in the developer's guide. A casual package
8296: maintainer should not need anything from this part.
8297:
8298: Table of Contents
8299:
1.154 rillig 8300: 26. Design of the pkgsrc infrastructure
1.1 dsieger 8301:
1.154 rillig 8302: 26.1. The meaning of variable definitions
8303: 26.2. Avoiding problems before they arise
8304: 26.3. Variable evaluation
1.1 dsieger 8305:
1.154 rillig 8306: 26.3.1. At load time
8307: 26.3.2. At runtime
1.1 dsieger 8308:
1.154 rillig 8309: 26.4. How can variables be specified?
8310: 26.5. Designing interfaces for Makefile fragments
1.1 dsieger 8311:
1.154 rillig 8312: 26.5.1. Procedures with parameters
8313: 26.5.2. Actions taken on behalf of parameters
1.1 dsieger 8314:
1.154 rillig 8315: 26.6. The order in which files are loaded
1.1 dsieger 8316:
1.154 rillig 8317: 26.6.1. The order in bsd.prefs.mk
8318: 26.6.2. The order in bsd.pkg.mk
1.1 dsieger 8319:
1.154 rillig 8320: 27. Regression tests
1.1 dsieger 8321:
1.154 rillig 8322: 27.1. Running the regression tests
8323: 27.2. Adding a new regression test
1.1 dsieger 8324:
1.154 rillig 8325: 27.2.1. Overridable functions
8326: 27.2.2. Helper functions
1.1 dsieger 8327:
1.154 rillig 8328: 28. Porting pkgsrc
1.1 dsieger 8329:
1.154 rillig 8330: 28.1. Porting pkgsrc to a new operating system
1.1 dsieger 8331:
1.154 rillig 8332: Chapter 26. Design of the pkgsrc infrastructure
1.1 dsieger 8333:
8334: Table of Contents
8335:
1.154 rillig 8336: 26.1. The meaning of variable definitions
8337: 26.2. Avoiding problems before they arise
8338: 26.3. Variable evaluation
1.1 dsieger 8339:
1.154 rillig 8340: 26.3.1. At load time
8341: 26.3.2. At runtime
1.1 dsieger 8342:
1.154 rillig 8343: 26.4. How can variables be specified?
8344: 26.5. Designing interfaces for Makefile fragments
1.1 dsieger 8345:
1.154 rillig 8346: 26.5.1. Procedures with parameters
8347: 26.5.2. Actions taken on behalf of parameters
1.1 dsieger 8348:
1.154 rillig 8349: 26.6. The order in which files are loaded
1.1 dsieger 8350:
1.154 rillig 8351: 26.6.1. The order in bsd.prefs.mk
8352: 26.6.2. The order in bsd.pkg.mk
1.1 dsieger 8353:
8354: The pkgsrc infrastructure consists of many small Makefile fragments. Each such
8355: fragment needs a properly specified interface. This chapter explains how such
8356: an interface looks like.
8357:
1.154 rillig 8358: 26.1. The meaning of variable definitions
1.1 dsieger 8359:
8360: Whenever a variable is defined in the pkgsrc infrastructure, the location and
8361: the way of definition provide much information about the intended use of that
8362: variable. Additionally, more documentation may be found in a header comment or
8363: in this pkgsrc guide.
8364:
8365: A special file is mk/defaults/mk.conf, which lists all variables that are
8366: intended to be user-defined. They are either defined using the ?= operator or
8367: they are left undefined because defining them to anything would effectively
8368: mean "yes". All these variables may be overridden by the pkgsrc user in the
8369: MAKECONF file.
8370:
8371: Outside this file, the following conventions apply: Variables that are defined
8372: using the ?= operator may be overridden by a package.
8373:
8374: Variables that are defined using the = operator may be used read-only at
8375: run-time.
8376:
8377: Variables whose name starts with an underscore must not be accessed outside the
8378: pkgsrc infrastructure at all. They may change without further notice.
8379:
8380: Note
8381:
8382: These conventions are currently not applied consistently to the complete pkgsrc
8383: infrastructure.
8384:
1.154 rillig 8385: 26.2. Avoiding problems before they arise
1.1 dsieger 8386:
8387: All variables that contain lists of things should default to being empty. Two
8388: examples that do not follow this rule are USE_LANGUAGES and DISTFILES. These
8389: variables cannot simply be modified using the += operator in package Makefiles
8390: (or other files included by them), since there is no guarantee whether the
8391: variable is already set or not, and what its value is. In the case of
8392: DISTFILES, the packages "know" the default value and just define it as in the
8393: following example.
8394:
8395: DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
8396:
8397: Because of the selection of this default value, the same value appears in many
8398: package Makefiles. Similarly for USE_LANGUAGES, but in this case the default
8399: value ("c") is so short that it doesn't stand out. Nevertheless it is mentioned
8400: in many files.
8401:
1.154 rillig 8402: 26.3. Variable evaluation
1.1 dsieger 8403:
1.154 rillig 8404: 26.3.1. At load time
1.1 dsieger 8405:
8406: Variable evaluation takes place either at load time or at runtime, depending on
8407: the context in which they occur. The contexts where variables are evaluated at
8408: load time are:
8409:
8410: * The right hand side of the := and != operators,
8411:
8412: * Make directives like .if or .for,
8413:
8414: * Dependency lines.
8415:
8416: A special exception are references to the iteration variables of .for loops,
8417: which are expanded inline, no matter in which context they appear.
8418:
8419: As the values of variables may change during load time, care must be taken not
8420: to evaluate them by accident. Typical examples for variables that should not be
8421: evaluated at load time are DEPENDS and CONFIGURE_ARGS. To make the effect more
8422: clear, here is an example:
8423:
8424: CONFIGURE_ARGS= # none
8425: CFLAGS= -O
8426: CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
8427:
8428: CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
8429:
8430: CFLAGS+= -Wall
8431:
8432: This code shows how the use of the := operator can quickly lead to unexpected
8433: results. The first paragraph is fairly common code. The second paragraph
8434: evaluates the CONFIGURE_ARGS variable, which results in CFLAGS=-O. In the third
8435: paragraph, the -Wall is appended to the CFLAGS, but this addition will not
8436: appear in CONFIGURE_ARGS. In actual code, the three paragraphs from above
8437: typically occur in completely unrelated files.
8438:
1.154 rillig 8439: 26.3.2. At runtime
1.1 dsieger 8440:
8441: After all the files have been loaded, the values of the variables cannot be
8442: changed anymore. Variables that are used in the shell commands are expanded at
8443: this point.
8444:
1.154 rillig 8445: 26.4. How can variables be specified?
1.1 dsieger 8446:
8447: There are many ways in which the definition and use of a variable can be
8448: restricted in order to detect bugs and violations of the (mostly unwritten)
1.108 rillig 8449: policies. A package can be checked with pkglint -Wall to see whether it meets
8450: these rules.
1.1 dsieger 8451:
1.154 rillig 8452: 26.5. Designing interfaces for Makefile fragments
1.1 dsieger 8453:
8454: Most of the .mk files fall into one of the following classes. Cases where a
8455: file falls into more than one class should be avoided as it often leads to
8456: subtle bugs.
8457:
1.154 rillig 8458: 26.5.1. Procedures with parameters
1.1 dsieger 8459:
8460: In a traditional imperative programming language some of the .mk files could be
1.23 jakllsch 8461: described as procedures. They take some input parameters and?after
8462: inclusion?provide a result in output parameters. Since all variables in
8463: Makefiles have global scope care must be taken not to use parameter names that
8464: have already another meaning. For example, PKGNAME is a bad choice for a
8465: parameter name.
1.1 dsieger 8466:
8467: Procedures are completely evaluated at preprocessing time. That is, when
8468: calling a procedure all input parameters must be completely resolvable. For
8469: example, CONFIGURE_ARGS should never be an input parameter since it is very
8470: likely that further text will be added after calling the procedure, which would
8471: effectively apply the procedure to only a part of the variable. Also,
1.108 rillig 8472: references to other variables will be modified after calling the procedure.
1.1 dsieger 8473:
8474: A procedure can declare its output parameters either as suitable for use in
8475: preprocessing directives or as only available at runtime. The latter
8476: alternative is for variables that contain references to other runtime
8477: variables.
8478:
8479: Procedures shall be written such that it is possible to call the procedure more
8480: than once. That is, the file must not contain multiple-inclusion guards.
8481:
8482: Examples for procedures are mk/bsd.options.mk and mk/buildlink3/bsd.builtin.mk.
8483: To express that the parameters are evaluated at load time, they should be
8484: assigned using the := operator, which should be used only for this purpose.
8485:
1.154 rillig 8486: 26.5.2. Actions taken on behalf of parameters
1.1 dsieger 8487:
8488: Action files take some input parameters and may define runtime variables. They
8489: shall not define loadtime variables. There are action files that are included
8490: implicitly by the pkgsrc infrastructure, while other must be included
8491: explicitly.
8492:
8493: An example for action files is mk/subst.mk.
8494:
1.154 rillig 8495: 26.6. The order in which files are loaded
1.1 dsieger 8496:
8497: Package Makefiles usually consist of a set of variable definitions, and include
8498: the file ../../mk/bsd.pkg.mk in the very last line. Before that, they may also
8499: include various other *.mk files if they need to query the availability of
8500: certain features like the type of compiler or the X11 implementation. Due to
8501: the heavy use of preprocessor directives like .if and .for, the order in which
8502: the files are loaded matters.
8503:
8504: This section describes at which point the various files are loaded and gives
8505: reasons for that order.
8506:
1.154 rillig 8507: 26.6.1. The order in bsd.prefs.mk
1.1 dsieger 8508:
8509: The very first action in bsd.prefs.mk is to define some essential variables
8510: like OPSYS, OS_VERSION and MACHINE_ARCH.
8511:
1.4 rillig 8512: Then, the user settings are loaded from the file specified in MAKECONF, which
8513: is usually mk.conf. After that, those variables that have not been overridden
8514: by the user are loaded from mk/defaults/mk.conf.
1.1 dsieger 8515:
8516: After the user settings, the system settings and platform settings are loaded,
8517: which may override the user settings.
8518:
8519: Then, the tool definitions are loaded. The tool wrappers are not yet in effect.
8520: This only happens when building a package, so the proper variables must be used
8521: instead of the direct tool names.
8522:
8523: As the last steps, some essential variables from the wrapper and the package
8524: system flavor are loaded, as well as the variables that have been cached in
8525: earlier phases of a package build.
8526:
1.154 rillig 8527: 26.6.2. The order in bsd.pkg.mk
1.1 dsieger 8528:
8529: First, bsd.prefs.mk is loaded.
8530:
8531: Then, the various *-vars.mk files are loaded, which fill default values for
8532: those variables that have not been defined by the package. These variables may
8533: later be used even in unrelated files.
8534:
8535: Then, the file bsd.pkg.error.mk provides the target error-check that is added
8536: as a special dependency to all other targets that use DELAYED_ERROR_MSG or
8537: DELAYED_WARNING_MSG.
8538:
8539: Then, the package-specific hacks from hacks.mk are included.
8540:
8541: Then, various other files follow. Most of them don't have any dependencies on
8542: what they need to have included before or after them, though some do.
8543:
8544: The code to check PKG_FAIL_REASON and PKG_SKIP_REASON is then executed, which
8545: restricts the use of these variables to all the files that have been included
8546: before. Appearances in later files will be silently ignored.
8547:
8548: Then, the files for the main targets are included, in the order of later
8549: execution, though the actual order should not matter.
8550:
8551: At last, some more files are included that don't set any interesting variables
8552: but rather just define make targets to be executed.
8553:
1.154 rillig 8554: Chapter 27. Regression tests
1.1 dsieger 8555:
8556: Table of Contents
8557:
1.154 rillig 8558: 27.1. Running the regression tests
8559: 27.2. Adding a new regression test
1.1 dsieger 8560:
1.154 rillig 8561: 27.2.1. Overridable functions
8562: 27.2.2. Helper functions
1.1 dsieger 8563:
8564: The pkgsrc infrastructure consists of a large codebase, and there are many
8565: corners where every little bit of a file is well thought out, making pkgsrc
8566: likely to fail as soon as anything is changed near those parts. To prevent most
8567: changes from breaking anything, a suite of regression tests should go along
8568: with every important part of the pkgsrc infrastructure. This chapter describes
8569: how regression tests work in pkgsrc and how you can add new tests.
8570:
1.154 rillig 8571: 27.1. Running the regression tests
1.1 dsieger 8572:
1.25 wiz 8573: You first need to install the pkgtools/pkg_regress package, which provides the
1.1 dsieger 8574: pkg_regress command. Then you can simply run that command, which will run all
1.168 rillig 8575: tests in the regress/ directory.
1.1 dsieger 8576:
1.154 rillig 8577: 27.2. Adding a new regression test
1.1 dsieger 8578:
1.168 rillig 8579: Every directory in the regress/ directory that contains a file called spec is
1.1 dsieger 8580: considered a regression test. This file is a shell program that is included by
8581: the pkg_regress command. The following functions can be overridden to suit your
8582: needs.
8583:
1.154 rillig 8584: 27.2.1. Overridable functions
1.1 dsieger 8585:
1.108 rillig 8586: These functions do not take any parameters. Although they are called in "set -e
1.168 rillig 8587: " mode, they don't stop at the first failing command. See this Stack Overflow
1.108 rillig 8588: question for details.
1.1 dsieger 8589:
1.108 rillig 8590: do_setup
1.1 dsieger 8591:
8592: This function prepares the environment for the test. By default it does
8593: nothing.
8594:
1.108 rillig 8595: do_test
1.1 dsieger 8596:
8597: This function runs the actual test. By default, it calls TEST_MAKE with the
8598: arguments MAKEARGS_TEST and writes its output including error messages into
8599: the file TEST_OUTFILE.
8600:
1.108 rillig 8601: When defining this function, make sure that all output that needs to be
8602: checked is written to the correct output file. Example:
8603:
8604: do_test() {
8605: echo "Example output"
8606: } 1>$TEST_OUTFILE 2>&1
8607:
8608: check_result
1.1 dsieger 8609:
8610: This function is run after the test and is typically used to compare the
8611: actual output from the one that is expected. It can make use of the various
1.108 rillig 8612: helper functions from the next section. Example:
8613:
8614: check_result() {
8615: exit_status 0
8616: output_require "Example"
8617: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
8618: output_prohibit "no such file or directory"
1.169 rillig 8619: regress_fail "expected $expected but got $actual for input $input"
1.108 rillig 8620: }
1.1 dsieger 8621:
1.108 rillig 8622: do_cleanup
1.1 dsieger 8623:
8624: This function cleans everything up after the test has been run. By default
8625: it does nothing.
8626:
1.154 rillig 8627: 27.2.2. Helper functions
1.1 dsieger 8628:
1.168 rillig 8629: regress_fail message...
8630:
8631: This function makes the test fail with the given error message.
8632:
1.108 rillig 8633: exit_status expected
1.1 dsieger 8634:
1.108 rillig 8635: This function compares the exitcode of the do_test function with its first
8636: parameter. If they differ, the test will fail.
1.1 dsieger 8637:
1.108 rillig 8638: output_require regex...
1.1 dsieger 8639:
8640: This function checks for each of its parameters if the output from do_test
1.108 rillig 8641: matches the extended regular expression. If it does not, the test will
8642: fail. Example:
8643:
8644: output_require "looks fine"
8645: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
1.1 dsieger 8646:
1.177 leot 8647: output_prohibit regex...
1.1 dsieger 8648:
8649: This function checks for each of its parameters if the output from do_test
8650: () does not match the extended regular expression. If any of the regular
8651: expressions matches, the test will fail.
8652:
1.154 rillig 8653: Chapter 28. Porting pkgsrc
1.1 dsieger 8654:
8655: Table of Contents
8656:
1.154 rillig 8657: 28.1. Porting pkgsrc to a new operating system
1.1 dsieger 8658:
8659: The pkgsrc system has already been ported to many operating systems, hardware
8660: architectures and compilers. This chapter explains the necessary steps to make
8661: pkgsrc even more portable.
8662:
1.154 rillig 8663: 28.1. Porting pkgsrc to a new operating system
1.1 dsieger 8664:
8665: To port pkgsrc to a new operating system (called MyOS in this example), you
8666: need to touch the following files:
8667:
8668: pkgtools/bootstrap-mk-files/files/mods/MyOS.sys.mk
8669:
8670: This file contains some basic definitions, for example the name of the C
8671: compiler.
8672:
8673: mk/bsd.prefs.mk
8674:
8675: Insert code that defines the variables OPSYS, OS_VERSION, LOWER_OS_VERSION,
8676: LOWER_VENDOR, MACHINE_ARCH, OBJECT_FMT, APPEND_ELF, and the other variables
8677: that appear in this file.
8678:
8679: mk/platform/MyOS.mk
8680:
8681: This file contains the platform-specific definitions that are used by
8682: pkgsrc. Start by copying one of the other files and edit it to your needs.
8683:
8684: mk/tools/tools.MyOS.mk
8685:
8686: This file defines the paths to all the tools that are needed by one or the
8687: other package in pkgsrc, as well as by pkgsrc itself. Find out where these
8688: tools are on your platform and add them.
8689:
8690: Now, you should be able to build some basic packages, like lang/perl5, shells/
8691: bash.
8692:
8693: Appendix A. A simple example package: bison
8694:
8695: Table of Contents
8696:
8697: A.1. files
8698:
8699: A.1.1. Makefile
8700: A.1.2. DESCR
8701: A.1.3. PLIST
8702: A.1.4. Checking a package with pkglint
8703:
8704: A.2. Steps for building, installing, packaging
8705:
8706: We checked to find a piece of software that wasn't in the packages collection,
1.25 wiz 8707: and picked GNU bison. Quite why someone would want to have bison when Berkeley
1.1 dsieger 8708: yacc is already present in the tree is beyond us, but it's useful for the
8709: purposes of this exercise.
8710:
8711: A.1. files
8712:
8713: A.1.1. Makefile
8714:
1.2 rillig 8715: # $NetBSD$
1.1 dsieger 8716: #
8717:
8718: DISTNAME= bison-1.25
8719: CATEGORIES= devel
1.171 rillig 8720: MASTER_SITES= ${MASTER_SITE_GNU:=bison/}
1.1 dsieger 8721:
1.30 dholland 8722: MAINTAINER= pkgsrc-users@NetBSD.org
1.174 leot 8723: HOMEPAGE= https://www.gnu.org/software/bison/bison.html
1.1 dsieger 8724: COMMENT= GNU yacc clone
8725:
8726: GNU_CONFIGURE= yes
1.47 wiz 8727: INFO_FILES= yes
1.1 dsieger 8728:
8729: .include "../../mk/bsd.pkg.mk"
8730:
8731: A.1.2. DESCR
8732:
8733: GNU version of yacc. Can make re-entrant parsers, and numerous other
8734: improvements. Why you would want this when Berkeley yacc(1) is part
8735: of the NetBSD source tree is beyond me.
8736:
8737: A.1.3. PLIST
8738:
1.2 rillig 8739: @comment $NetBSD$
1.1 dsieger 8740: bin/bison
8741: man/man1/bison.1.gz
8742: share/bison.simple
8743: share/bison.hairy
8744:
8745: A.1.4. Checking a package with pkglint
8746:
8747: The NetBSD package system comes with pkgtools/pkglint which helps to check the
8748: contents of these files. After installation it is quite easy to use, just
1.171 rillig 8749: change to the directory of the package you wish to examine and run pkglint:
1.1 dsieger 8750:
8751: $ pkglint
1.171 rillig 8752: ERROR: Makefile: Each package must define its LICENSE.
8753: WARN: Makefile:9: HOMEPAGE should migrate from http to https.
8754: NOTE: PLIST:3: The .gz extension is unnecessary for manual pages.
8755: WARN: PLIST:5: "share/bison.hairy" should be sorted before "share/bison.simple".
8756: 1 error, 2 warnings and 1 note found.
8757: (Run "pkglint -e" to show explanations.)
8758: (Run "pkglint -fs" to show what can be fixed automatically.)
1.172 rillig 8759: (Run "pkglint -F" to automatically fix some issues.)
1.1 dsieger 8760:
8761: Depending on the supplied command line arguments (see pkglint(1)), more checks
1.170 rillig 8762: will be performed. Use e.g. pkglint -Wall for a very thorough check.
1.1 dsieger 8763:
8764: A.2. Steps for building, installing, packaging
8765:
8766: Create the directory where the package lives, plus any auxiliary directories:
8767:
8768: # cd /usr/pkgsrc/lang
8769: # mkdir bison
8770: # cd bison
8771: # mkdir patches
8772:
1.154 rillig 8773: Create Makefile, DESCR and PLIST (see Chapter 13, Package components - files,
1.1 dsieger 8774: directories and contents) then continue with fetching the distfile:
8775:
8776: # make fetch
8777: >> bison-1.25.tar.gz doesn't seem to exist on this system.
8778: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
8779: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8780: ftp: Error retrieving file: 500 Internal error
8781:
8782: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
8783: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8784: ftp: Error retrieving file: 500 Internal error
8785:
8786: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
8787: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8788: Successfully retrieved file.
8789:
8790: Generate the checksum of the distfile into distinfo:
8791:
8792: # make makedistinfo
8793:
8794: Now compile:
8795:
8796: # make
8797: >> Checksum OK for bison-1.25.tar.gz.
8798: ===> Extracting for bison-1.25
8799: ===> Patching for bison-1.25
8800: ===> Ignoring empty patch directory
8801: ===> Configuring for bison-1.25
8802: creating cache ./config.cache
8803: checking for gcc... cc
8804: checking whether we are using GNU C... yes
8805: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
8806: checking how to run the C preprocessor... cc -E
8807: checking for minix/config.h... no
8808: checking for POSIXized ISC... no
8809: checking whether cross-compiling... no
8810: checking for ANSI C header files... yes
8811: checking for string.h... yes
8812: checking for stdlib.h... yes
8813: checking for memory.h... yes
8814: checking for working const... yes
8815: checking for working alloca.h... no
8816: checking for alloca... yes
8817: checking for strerror... yes
8818: updating cache ./config.cache
8819: creating ./config.status
8820: creating Makefile
8821: ===> Building for bison-1.25
8822: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g LR0.c
8823: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g allocate.c
8824: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g closure.c
8825: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g conflicts.c
8826: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g derives.c
8827: 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
8828: 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
8829: 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
8830: 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
8831: 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
8832: 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
8833: 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
8834: 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
8835: 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
8836: 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
8837: 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
8838: 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
8839: 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
8840: 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
8841: 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
8842: 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
8843: 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
8844: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
8845: rm -f bison.s1
8846: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
8847:
8848: Everything seems OK, so install the files:
8849:
8850: # make install
8851: >> Checksum OK for bison-1.25.tar.gz.
8852: ===> Installing for bison-1.25
8853: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
8854: rm -f /usr/pkg/bin/bison
8855: cd /usr/pkg/share; rm -f bison.simple bison.hairy
8856: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
8857: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
8858: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
8859: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
8860: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
8861: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
8862: ===> Registering installation for bison-1.25
8863:
8864: You can now use bison, and also - if you decide so - remove it with pkg_delete
8865: bison. Should you decide that you want a binary package, do this now:
8866:
8867: # make package
8868: >> Checksum OK for bison-1.25.tar.gz.
8869: ===> Building package for bison-1.25
8870: Creating package bison-1.25.tgz
8871: Registering depends:.
8872: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
8873:
8874: Now that you don't need the source and object files any more, clean up:
8875:
8876: # make clean
8877: ===> Cleaning for bison-1.25
8878:
8879: Appendix B. Build logs
8880:
8881: Table of Contents
8882:
8883: B.1. Building figlet
8884: B.2. Packaging figlet
8885:
8886: B.1. Building figlet
8887:
8888: # make
8889: ===> Checking for vulnerabilities in figlet-2.2.1nb2
8890: => figlet221.tar.gz doesn't seem to exist on this system.
8891: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
8892: => [172219 bytes]
8893: Connected to ftp.plig.net.
8894: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
8895: 331 Guest login ok, send your complete e-mail address as password.
8896: 230-You are user #5 of 500 simultaneous users allowed.
8897: 230-
8898: 230- ___ _ _ _
8899: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
8900: 230- | _| _| . |_| . | | | . |_| . | _| . |
8901: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
8902: 230- |_| |_| |___| |___|
8903: 230-
8904: 230-** Welcome to ftp.plig.org **
8905: 230-
8906: 230-Please note that all transfers from this FTP site are logged. If you
8907: 230-do not like this, please disconnect now.
8908: 230-
1.19 snj 8909: 230-This archive is available via
1.1 dsieger 8910: 230-
8911: 230-HTTP: http://ftp.plig.org/
8912: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
8913: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
8914: 230-
8915: 230-Please email comments, bug reports and requests for packages to be
8916: 230-mirrored to ftp-admin@plig.org.
8917: 230-
8918: 230-
8919: 230 Logged in anonymously.
8920: Remote system type is UNIX.
8921: Using binary mode to transfer files.
8922: 200 Type okay.
8923: 250 "/pub" is new cwd.
8924: 250-"/pub/figlet" is new cwd.
8925: 250-
8926: 250-Welcome to the figlet archive at ftp.figlet.org
8927: 250-
8928: 250- ftp://ftp.figlet.org/pub/figlet/
8929: 250-
8930: 250-The official FIGlet web page is:
8931: 250- http://www.figlet.org/
8932: 250-
8933: 250-If you have questions, please mailto:info@figlet.org. If you want to
8934: 250-contribute a font or something else, you can email us.
8935: 250
8936: 250 "/pub/figlet/program" is new cwd.
8937: 250 "/pub/figlet/program/unix" is new cwd.
8938: local: figlet221.tar.gz remote: figlet221.tar.gz
8939: 502 Unimplemented command.
8940: 227 Entering Passive Mode (195,40,6,41,246,104)
8941: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
8942: 38% |************** | 65800 64.16 KB/s 00:01 ETA
8943: 226 Transfer completed.
8944: 172219 bytes received in 00:02 (75.99 KB/s)
8945: 221 Goodbye.
8946: => Checksum OK for figlet221.tar.gz.
8947: ===> Extracting for figlet-2.2.1nb2
8948: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
8949: ===> Patching for figlet-2.2.1nb2
8950: ===> Applying pkgsrc patches for figlet-2.2.1nb2
8951: ===> Overriding tools for figlet-2.2.1nb2
8952: ===> Creating toolchain wrappers for figlet-2.2.1nb2
8953: ===> Configuring for figlet-2.2.1nb2
8954: ===> Building for figlet-2.2.1nb2
8955: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
8956: chmod a+x figlet
8957: gcc -O2 -o chkfont chkfont.c
8958: => Unwrapping files-to-be-installed.
8959: #
8960: # make install
8961: ===> Checking for vulnerabilities in figlet-2.2.1nb2
8962: ===> Installing for figlet-2.2.1nb2
8963: install -d -o root -g wheel -m 755 /usr/pkg/bin
8964: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
8965: mkdir -p /usr/pkg/share/figlet
8966: cp figlet /usr/pkg/bin
8967: cp chkfont /usr/pkg/bin
8968: chmod 555 figlist showfigfonts
8969: cp figlist /usr/pkg/bin
8970: cp showfigfonts /usr/pkg/bin
8971: cp fonts/*.flf /usr/pkg/share/figlet
8972: cp fonts/*.flc /usr/pkg/share/figlet
8973: cp figlet.6 /usr/pkg/man/man6
8974: ===> Registering installation for figlet-2.2.1nb2
8975: #
8976:
8977: B.2. Packaging figlet
8978:
8979: # make package
8980: ===> Checking for vulnerabilities in figlet-2.2.1nb2
8981: ===> Packaging figlet-2.2.1nb2
8982: ===> Building binary package for figlet-2.2.1nb2
8983: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
8984: Using SrcDir value of /usr/pkg
8985: Registering depends:.
8986: #
8987:
8988: Appendix C. Directory layout of the pkgsrc FTP server
8989:
8990: Table of Contents
8991:
1.23 jakllsch 8992: C.1. distfiles: The distributed source files
8993: C.2. misc: Miscellaneous things
8994: C.3. packages: Binary packages
8995: C.4. reports: Bulk build reports
1.148 leot 8996: C.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 8997:
8998: As in other big projects, the directory layout of pkgsrc is quite complex for
8999: newbies. This chapter explains where you find things on the FTP server. The
9000: base directory on ftp.NetBSD.org is /pub/pkgsrc/. On other servers it may be
9001: different, but inside this directory, everything should look the same, no
9002: matter on which server you are. This directory contains some subdirectories,
9003: which are explained below.
9004:
1.23 jakllsch 9005: C.1. distfiles: The distributed source files
1.1 dsieger 9006:
9007: The directory distfiles contains lots of archive files from all pkgsrc
9008: packages, which are mirrored here. The subdirectories are called after their
9009: package names and are used when the distributed files have names that don't
9010: explicitly contain a version number or are otherwise too generic (for example
9011: release.tar.gz).
9012:
1.23 jakllsch 9013: C.2. misc: Miscellaneous things
1.1 dsieger 9014:
9015: This directory contains things that individual pkgsrc developers find worth
9016: publishing.
9017:
1.23 jakllsch 9018: C.3. packages: Binary packages
1.1 dsieger 9019:
1.3 rillig 9020: This directory contains binary packages for the various platforms that are
9021: supported by pkgsrc. Each subdirectory is of the form OPSYS/ARCH/OSVERSION_TAG.
9022: The meaning of these variables is:
9023:
9024: * OPSYS is the name of the operating system for which the packages have been
1.9 rillig 9025: built. The name is taken from the output of the uname command, so it may
9026: differ from the one you are used to hear.
1.3 rillig 9027:
1.8 rillig 9028: * ARCH is the hardware architecture of the platform for which the packages
1.10 hubertf 9029: have been built. It also includes the ABI (Application Binary Interface)
9030: for platforms that have several of them.
1.3 rillig 9031:
1.8 rillig 9032: * OSVERSION is the version of the operating system. For version numbers that
9033: change often (for example NetBSD-current), the often-changing part should
9034: be replaced with an x, for example 4.99.x.
1.3 rillig 9035:
1.23 jakllsch 9036: * TAG is either 20xxQy for a stable branch, or head for packages built from
1.8 rillig 9037: the HEAD branch. The latter should only be used when the packages are
9038: updated on a regular basis. Otherwise the date from checking out pkgsrc
9039: should be appended, for example head_20071015.
1.3 rillig 9040:
9041: The rationale for exactly this scheme is that the pkgsrc users looking for
9042: binary packages can quickly click through the directories on the server and
9043: find the best binary packages for their machines. Since they usually know the
9044: operating system and the hardware architecture, OPSYS and ARCH are placed
9045: first. After these choices, they can select the best combination of OSVERSION
9046: and TAG together, since it is usually the case that packages stay compatible
9047: between different version of the operating system.
9048:
9049: In each of these directories, there is a whole binary packages collection for a
9050: specific platform. It has a directory called All which contains all binary
9051: packages. Besides that, there are various category directories that contain
9052: symbolic links to the real binary packages.
1.1 dsieger 9053:
1.23 jakllsch 9054: C.4. reports: Bulk build reports
1.8 rillig 9055:
9056: Here are the reports from bulk builds, for those who want to fix packages that
9057: didn't build on some of the platforms. The structure of subdirectories should
1.23 jakllsch 9058: look like the one in Section C.3, "packages: Binary packages".
1.8 rillig 9059:
1.148 leot 9060: C.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 9061:
9062: These directories contain the "real" pkgsrc, that is the files that define how
9063: to create binary packages from source archives.
9064:
1.149 leot 9065: Each of the current, stable and pkgsrc-20xxQy directories share the same
9066: structure. They each contain a pkgsrc directory and pkgsrc.tar.{bz,gz,xz} file.
9067:
1.1 dsieger 9068: The directory pkgsrc contains a snapshot of the CVS repository, which is
1.149 leot 9069: updated regularly. The file pkgsrc.tar.{bz,gz,xz} contains the same as the
9070: directory, ready to be downloaded as a whole.
1.1 dsieger 9071:
1.149 leot 9072: The current directory contains files related to the HEAD branch of the CVS
9073: repository. In this directory there is an additional file called
9074: pkgsrc-readmes.tar.{bz,gz,xz} that contains all pkgsrc READMEs with information
9075: about categories and packages.
9076:
9077: The stable directory is a symlink to the latest pkgsrc-20xxQy.
9078:
9079: The pkgsrc-20xxQy. directories contain files related to the -20xxQy stable
9080: branch of the CVS repository. In these directories there is an additional file
9081: called pkgsrc-20xxQy.tar.{bz,gz,xz}, which contains the state of pkgsrc when it
9082: was branched.
1.148 leot 9083:
1.154 rillig 9084: Appendix D. Help topics
9085:
9086: The following list contains all help topics that are available when running
9087: bmake help topic=:index.
9088:
1.180 rillig 9089: #! -lintl
9090: 64bit ABI
9091: ACCEPTABLE_LICENSES ACROREAD_FONTPATH
9092: ADDITIONAL AFAIK
9093: AIX ALLOW_VULNERABLE_PACKAGES
9094: ALL_ENV ALSA_PC
9095: ALTERNATIVES_SRC AMANDA_TMP
9096: AMANDA_USER AMANDA_VAR
9097: APACHE_GROUP APACHE_MODULE_NAME
9098: APACHE_MODULE_SRC APACHE_MODULE_SRCDIR
9099: APACHE_PKG_PREFIX APACHE_SUEXEC_CONFIGURE_ARGS
9100: APACHE_SUEXEC_DOCROOT APACHE_USER
9101: APPEND_ABI APPEND_ELF
9102: ARLA_CACHE AUDIT_PACKAGES_FLAGS
9103: AUTOCONF_REQD AUTOMAKE_OVERRIDE
9104: AUTOMAKE_REQD AUTO_MKDIRS
9105: BDB185_DEFAULT BDBBASE
9106: BDB_ACCEPTED BDB_DEFAULT
9107: BDB_LIBS BDB_TYPE
9108: BIND_DIR BIND_GROUP
9109: BIND_USER BINPKG_SITES
9110: BIN_INSTALL_FLAGS BISON_PKGDATADIR
9111: BLAS_ACCEPTED BLAS_LIBS
9112: BLAS_TYPE BOOTSTRAP_DEPENDS
9113: BOOTSTRAP_SETUPTOOLS BROKEN
9114: BROKEN_EXCEPT_ON_PLATFORM BROKEN_ON_PLATFORM
9115: BSDSRCDIR BSDXSRCDIR
9116: BSD_MAKE_ENV BUILDLINK_AUTO_DIRS
9117: BUILDLINK_AUTO_VARS BUILDLINK_CFLAGS
9118: BUILDLINK_CONTENTS_FILTER BUILDLINK_CPPFLAGS
9119: BUILDLINK_DEPMETHOD BUILDLINK_FILES
9120: BUILDLINK_FILES_CMD BUILDLINK_FNAME_TRANSFORM
9121: BUILDLINK_LDFLAGS BUILDLINK_LIBS
9122: BUILDLINK_OPSYS_SUPPORT_PTHREAD BUILDLINK_PKGNAME
9123: BUILDLINK_PREFIX BUILDLINK_RPATHDIRS
9124: BUILDLINK_TREE BUILD_DEFS
9125: BUILD_DEFS_EFFECTS BUILD_DEPENDS
9126: BUILD_DIRS BUILD_ENV_SHELL
9127: BUILD_MAKE_CMD BUILD_MAKE_FLAGS
9128: BUILD_TARGET BUILTIN_FIND_FILES
9129: BUILTIN_FIND_FILES_VAR BUILTIN_FIND_GREP
9130: BUILTIN_FIND_HEADERS BUILTIN_FIND_HEADERS_VAR
9131: BUILTIN_PKG BUILTIN_TEST_CURSES_DEFINES
9132: BUILTIN_TEST_CURSES_FUNCS BUILTIN_VERSION_SCRIPT
9133: BUILTIN_X11_TYPE BUILTIN_X11_VERSION
9134: CACTI_GROUP CACTI_USER
9135: CANNA_GROUP CANNA_USER
9136: CAT CCACHE_BASE
9137: CCACHE_DIR CCACHE_LOGFILE
9138: CC_VERSION CC_VERSION_STRING
9139: CDRECORD_CONF CDROM_PKG_URL_DIR
9140: CDROM_PKG_URL_HOST CHECKOUT_DATE
9141: CHECK_COMPILER CHECK_FAKEHOME
9142: CHECK_FILES CHECK_FILES_SKIP
9143: CHECK_FILES_STRICT CHECK_HEADERS
9144: CHECK_HEADERS_SKIP CHECK_INTERPRETER
9145: CHECK_INTERPRETER_SKIP CHECK_PERMS
9146: CHECK_PERMS_AUTOFIX CHECK_PERMS_SKIP
9147: CHECK_PORTABILITY CHECK_PORTABILITY_EXPERIMENTAL
9148: CHECK_PORTABILITY_SKIP CHECK_RELRO
9149: CHECK_RELRO_SKIP CHECK_RELRO_SUPPORTED
9150: CHECK_SHLIBS CHECK_SHLIBS_BLACKLIST
9151: CHECK_SHLIBS_SKIP CHECK_SHLIBS_SUPPORTED
9152: CHECK_SSP CHECK_SSP_SKIP
9153: CHECK_SSP_SUPPORTED CHECK_STRIPPED
9154: CHECK_STRIPPED_SKIP CHECK_WRKREF
9155: CHECK_WRKREF_EXTRA_DIRS CHECK_WRKREF_SKIP
9156: CLAMAV_DBDIR CLAMAV_GROUP
9157: CLAMAV_USER CLANGBASE
9158: CLEANDEPENDS CMAKE_DEPENDENCIES_REWRITE
9159: CMAKE_INSTALL_PREFIX CMAKE_MODULE_PATH_OVERRIDE
9160: CMAKE_PKGSRC_BUILD_FLAGS CMAKE_PREFIX_PATH
9161: CMAKE_USE_GNU_INSTALL_DIRS COMMON_LISP_DOCFILES
9162: COMMON_LISP_EXAMPLES COMMON_LISP_EXTRAFILES
9163: COMMON_LISP_PACKAGES COMMON_LISP_SYSTEM
9164: COMPILER_RPATH_FLAG COMPILER_USE_SYMLINKS
9165: CONFIGURE_ARGS CONFIGURE_DIRS
9166: CONFIGURE_ENV CONFIGURE_ENV_SHELL
9167: CONFIGURE_HAS_INFODIR CONFIGURE_HAS_MANDIR
9168: CONFIGURE_SCRIPT CONFIG_SHELL
9169: CONFIG_SHELL_FLAGS CONF_FILES
9170: CONF_FILES_MODE CONF_FILES_PERMS
9171: CONSERVER_DEFAULTHOST CONSERVER_DEFAULTPORT
9172: CP CPP
9173: CPP_PRECOMP_FLAGS CREATE_WRKDIR_SYMLINK
9174: CROSSBASE CTFCONVERT
9175: CTF_FILES_SKIP CTF_SUPPORTED
9176: CTYPE CUPS_GROUP
9177: CUPS_SYSTEM_GROUPS CUPS_USER
9178: CURSES_DEFAULT CURSES_TYPE
9179: CVS_EXTRACTDIR CVS_MODULE
9180: CVS_PROJECT CVS_REPOSITORIES
9181: CVS_ROOT CVS_ROOT_GNU
9182: CVS_ROOT_NONGNU CVS_ROOT_SOURCEFORGE
9183: CVS_TAG CXX
9184: CYRUS_GROUP CYRUS_IDLE
9185: CYRUS_USER DAEMONTOOLS_GROUP
9186: DAEMONTOOLS_LOG_USER DBUS_GROUP
9187: DBUS_USER DEFANG_GROUP
9188: DEFANG_USER DEFAULT_ACCEPTABLE_LICENSES
9189: DEFAULT_DISTFILES DEFAULT_IRC_SERVER
9190: DEFAULT_SERIAL_DEVICE DEF_UMASK
9191: DEINSTALLDEPENDS DEINSTALL_SRC
9192: DEINSTALL_TEMPLATES DELAYED_ERROR_MSG
9193: DELAYED_WARNING_MSG DEPENDS
9194: DEPENDS_TARGET DEPENDS_TYPE
9195: DESTDIR DESTDIR_VARNAME
9196: DIALER_GROUP DIGEST_REQD
9197: DISTDIR DISTFILES
9198: DISTINFO_FILE DISTNAME
9199: DIST_PATH DIST_SUBDIR
9200: DJBDNS_AXFR_USER DJBDNS_CACHE_USER
9201: DJBDNS_DJBDNS_GROUP DJBDNS_LOG_USER
9202: DJBDNS_RBL_USER DJBDNS_TINY_USER
9203: DLOPEN_REQUIRE_PTHREADS DL_AUTO_VARS
9204: DL_CFLAGS DL_LDFLAGS
9205: DL_LIBS DNS
9206: DOWNLOADED_DISTFILE DT_LAYOUT
9207: DYNAMIC_SITES_CMD DYNAMIC_SITES_SCRIPT
9208: ECHO ECHO_N
9209: ELK_GUI EMACS_TYPE
9210: EMULDIR EMULSUBDIR
9211: EMULSUBDIRSLASH EMUL_ARCH
9212: EMUL_DISTRO EMUL_EXEC_FMT
9213: EMUL_IS_NATIVE EMUL_MODULES
9214: EMUL_OPSYS EMUL_PKG_FMT
9215: EMUL_PLATFORM EMUL_PLATFORMS
9216: EMUL_PREFER EMUL_REQD
9217: EMUL_TYPE ERROR_MSG
9218: EXIM_GROUP EXIM_USER
9219: EXPORT_SYMBOLS_LDFLAGS EXTRACTOR
9220: EXTRACT_CMD EXTRACT_CMD_DEFAULT
9221: EXTRACT_DIR EXTRACT_ELEMENTS
9222: EXTRACT_ENV EXTRACT_ONLY
9223: EXTRACT_OPTS EXTRACT_SUFX
9224: EXTRACT_USING FAIL
9225: FAILOVER_FETCH FAIL_MSG
9226: FAKE_NCURSES FAM
9227: FAM_ACCEPTED FAM_DEFAULT
9228: FAM_SERVER FCPATH
9229: FEATURE_CPPFLAGS FEATURE_LDFLAGS
9230: FEATURE_LIBS FETCH_AFTER_ARGS
9231: FETCH_BEFORE_ARGS FETCH_CMD
9232: FETCH_OUTPUT_ARGS FETCH_PROXY
9233: FETCH_RESUME_ARGS FETCH_USING
9234: FILES_SUBST FILES_SUBST_SED
9235: FIX_SYSTEM_HEADERS FLUXBOX_USE_GNOME
9236: FLUXBOX_USE_KDE FLUXBOX_USE_XFT
9237: FLUXBOX_USE_XINERAMA FONTDIR
9238: FONTS_DIRS FONTS_VERBOSE
9239: FOO_HACKS_MK FOSSIL_EXTRACTDIR
9240: FOSSIL_REPO FOSSIL_REPOSITORIES
9241: FOSSIL_VERSION FOX_USE_XUNICODE
9242: FREEWNN_GROUP FREEWNN_USER
9243: FTP_PKG_URL_DIR FTP_PKG_URL_HOST
9244: GAMEDATAMODE GAMEDATA_PERMS
9245: GAMEDIRMODE GAMEDIR_PERMS
9246: GAMEGRP GAMEMODE
9247: GAMEOWN GAMES_GROUP
9248: GAMES_USER GCC
9249: GCCBASE GCC_REQD
9250: GCC_VERSION_SUFFIX GEM_BUILD
9251: GEM_CLEANBUILD GEM_CLEANBUILD_EXTENSIONS
9252: GEM_DOCDIR GEM_EXTSDIR
9253: GEM_HOME GEM_KEEPBUILD
9254: GEM_LIBDIR GEM_NAME
9255: GEM_PATH GEM_SPECFILE
9256: GENERATE_PLIST GHOSTSCRIPT_REQD
9257: GITHUB_PROJECT GITHUB_RELEASE
9258: GITHUB_TAG GITHUB_TYPE
9259: GITLAB_PROJECT GITLAB_TAG
9260: GITLAB_TYPE GIT_BRANCH
9261: GIT_ENV GIT_EXTRACTDIR
9262: GIT_REPO GIT_REPOSITORIES
9263: GIT_REVISION GIT_TAG
9264: GNU GNU_CONFIGURE
9265: GNU_CONFIGURE_INFODIR GNU_CONFIGURE_MANDIR
9266: GNU_CONFIGURE_QUIET GNU_CONFIGURE_STRICT
9267: GODEP_REDIRECTS GO_BUILD_PATTERN
9268: GO_DEPS GO_DIST_BASE
9269: GO_MODULE_FILES GO_SRCPATH
9270: GO_VERSION_DEFAULT GROUP_SPECIFIC_PKGS
9271: GRUB_NETWORK_CARDS GRUB_PRESET_COMMAND
9272: GRUB_SCAN_ARGS GZIP
9273: HASKELL_COMPILER HASKELL_ENABLE_HADDOCK_DOCUMENTATION
9274: HASKELL_ENABLE_LIBRARY_PROFILING HASKELL_ENABLE_SHARED_LIBRARY
9275: HASKELL_OPTIMIZATION_LEVEL HAS_CONFIGURE
9276: HEADER_TEMPLATES HG_REPO
9277: HG_REPOSITORIES HG_TAG
9278: HOST_PKGTOOLS_ARGS HOST_SPECIFIC_PKGS
9279: HOWL_GROUP HOWL_USER
9280: ICCBASE ICECAST_CHROOTDIR
9281: ICON_THEMES IDOBASE
9282: IGNORE_CCACHE IGNORE_INFO_DIRS
9283: IGNORE_INTERACTIVE_FETCH IMAKE
9284: IMAKEOPTS IMAKE_MAKE
9285: IMAKE_MANINSTALL IMAP_UW_CCLIENT_MBOX_FMT
9286: IMDICTDIR INCOMPAT_CURSES
9287: INFO_DIR INFO_FILES
9288: INFO_FILES_VERBOSE INFO_MSG
9289: INIT_SYSTEM INN_DATA_DIR
9290: INN_GROUP INN_USER
9291: INSTALLATION_DIRS INSTALLATION_DIRS_FROM_PLIST
9292: INSTALL_ENV INSTALL_SH_OVERRIDE
9293: INSTALL_SRC INSTALL_TEMPLATES
9294: INSTALL_UNSTRIPPED IRCD_HYBRID_IRC_GROUP
9295: IRCD_HYBRID_IRC_USER IRCD_HYBRID_MAXCONN
9296: IRCD_HYBRID_NICLEN IRCD_HYBRID_SYSLOG_EVENTS
9297: IRCD_HYBRID_SYSLOG_FACILITY IRCD_HYBRID_TOPICLEN
9298: IRIX IRRD_USE_PGP
9299: JABBERD_GROUP JABBERD_LOGDIR
9300: JABBERD_PIDDIR JABBERD_SPOOLDIR
9301: JABBERD_USER JAKARTA_HOME
9302: JAVA_APP_PATH JAVA_APP_TARGETS
9303: JAVA_BINPREFIX JAVA_CLASSPATH
9304: JAVA_HOME JAVA_LD_LIBRARY_PATH
9305: JAVA_NAME JAVA_UNLIMIT
9306: JAVA_WRAPPERS JPEG_ACCEPTED
9307: JPEG_DEFAULT KERBEROS
9308: KERMIT_SUID_UUCP KJS_USE_PCRE
9309: KNEWS_DOMAIN_FILE KNEWS_DOMAIN_NAME
9310: KRB5_ACCEPTED KRB5_DEFAULT
9311: LANGUAGES LAPACK_LIBS
9312: LATEX2HTML_ICONPATH LDCONFIG_ADD_CMD
9313: LDCONFIG_REMOVE_CMD LEAFNODE_DATA_DIR
9314: LEAFNODE_GROUP LEAFNODE_USER
9315: LIBDVDCSS_HOMEPAGE LIBDVDCSS_MASTER_SITES
9316: LIBRSVG_TYPE LIBTOOL
9317: LIBTOOLIZE_PLIST LIBTOOL_M4_OVERRIDE
9318: LIBUSB_TYPE LICENSE
9319: LINKER_RPATH_FLAG LINK_RPATH_FLAG
9320: LINUX_BASE_NODEPS LINUX_BASE_PREFERRED
9321: LINUX_BASE_REQUIRED LINUX_LOCALES
9322: LOCALBASE LOCALBASE_LOCKTYPE
9323: LOCALPATCHES LOVE_DATA
9324: LOVE_GAME LOVE_VERSION
9325: LP64PLATFORMS MACHINE_PLATFORM
9326: MAILAGENT_DOMAIN MAILAGENT_EMAIL
9327: MAILAGENT_FQDN MAILAGENT_ORGANIZATION
9328: MAJORDOMO_HOMEDIR MAJOR_OS_VERSION
9329: MAKEINFO_ARGS MAKE_DIRS
9330: MAKE_DIRS_PERMS MAKE_ENV
9331: MAKE_FILE MAKE_FLAGS
9332: MAKE_JOBS MAKE_JOBS_SAFE
9333: MAKE_PROGRAM MANINSTALL
9334: MANZ MASTER_SITES
9335: MASTER_SITE_BACKUP MASTER_SITE_LOCAL
9336: MASTER_SITE_MOZILLA MASTER_SITE_OVERRIDE
9337: MASTER_SITE_PERL_CPAN MASTER_SORT
9338: MASTER_SORT_RANDOM MASTER_SORT_REGEX
9339: MECAB_CHARSET MEDIATOMB_GROUP
9340: MEDIATOMB_USER MIPSPROBASE
9341: MIREDO_GROUP MIREDO_USER
9342: MISSING_FEATURES MKDIR
9343: MLDONKEY_GROUP MLDONKEY_HOME
9344: MLDONKEY_USER MONOTONE_GROUP
9345: MONOTONE_USER MOTIFBASE
9346: MOTIF_TYPE MOTIF_TYPE_DEFAULT
9347: MPI_TYPE MSGFMT_STRIP_MSGCTXT
9348: MSGFMT_STRIP_MSGID_PLURAL MTOOLS_ENABLE_FLOPPYD
9349: MUST MV
9350: MYSQL_CHARSET MYSQL_DATADIR
9351: MYSQL_EXTRA_CHARSET MYSQL_GROUP
9352: MYSQL_PKGSRCDIR MYSQL_USER
9353: MYSQL_VERSIONS_ACCEPTED MYSQL_VERSION_DEFAULT
9354: NAGIOSCMD_GROUP NAGIOSDIR
9355: NAGIOS_GROUP NAGIOS_USER
9356: NATIVE_APPEND_ABI NATIVE_APPEND_ELF
9357: NATIVE_EXEC_FMT NATIVE_MACHINE_PLATFORM
9358: NATIVE_OBJECT_FMT NBPAX_PROGRAM_PREFIX
9359: NETBSD_LOGIN_NAME NMH_EDITOR
9360: NMH_MTA NMH_PAGER
9361: NOLOGIN NOTE
9362: NOT_FOR_PLATFORM NOT_PAX_ASLR_SAFE
9363: NOT_PAX_MPROTECT_SAFE NO_BUILD
9364: NO_CHECKSUM NO_CONFIGURE
9365: NO_SKIP NS_PREFERRED
9366: NULLMAILER_GROUP NULLMAILER_USER
9367: OASIS OASIS_BUILD_ARGS
9368: OBJHOSTNAME OBJMACHINE
9369: OCAML_FINDLIB_DIRS OCAML_FINDLIB_REGISTER
9370: OCAML_FINDLIB_REGISTER_VERBOSE OCAML_SITELIBDIR
9371: OCAML_TOPKG_DOCDIR OCAML_USE_DUNE
9372: OCAML_USE_FINDLIB OCAML_USE_JBUILDER
9373: OCAML_USE_OASIS OCAML_USE_OASIS_DYNRUN
9374: OCAML_USE_OPAM OCAML_USE_OPT_COMPILER
9375: OCAML_USE_TOPKG OMF
9376: ONLY_FOR_COMPILER ONLY_FOR_PLATFORM
9377: OPENSSH_CHROOT OPENSSH_GROUP
9378: OPENSSH_USER OPSYS
9379: OPSYS_EMULDIR OSS_TYPE
9380: OSX OSX_TOLERATE_SDK_SKEW
9381: OS_HAVE_ALSA OS_HAVE_RCD
9382: OS_VARIANT OS_VERSION
9383: OTF_FONTS_DIR OVERRIDE_DIRDEPTH
9384: OVERRIDE_GEMSPEC OVERRIDE_GNU_CONFIG_SCRIPTS
9385: OVERRIDE_ROCKSPEC OWN_DIRS
9386: OWN_DIRS_PERMS P4GROUP
9387: P4PORT P4ROOT
9388: P4USER PACKAGES
9389: PALMOS_DEFAULT_SDK PAMBASE
9390: PAM_DEFAULT PAPERSIZE
9391: PASSIVE_FETCH PATCHDIR
9392: PATCHFILES PATCH_ARGS
9393: PATCH_DEBUG PATCH_DIST_ARGS
9394: PATCH_DIST_CAT PATCH_DIST_STRIP
9395: PATCH_FUZZ_FACTOR PATCH_STRIP
9396: PATH PCCBASE
9397: PEAR PEAR_CHANNEL
9398: PEAR_CHANNEL_ALIAS PEAR_CHANNEL_VERSION
9399: PEAR_CMD PEAR_LIB
9400: PEAR_PACKAGE_XML PERL5
9401: PERL5_CONFIGURE PERL5_CONFIGURE_DIRS
9402: PERL5_LDFLAGS PERL5_LICENSE
9403: PERL5_MODULE_TYPE PERL5_PACKLIST
9404: PERL5_PACKLIST_DIR PERL5_PERLBASE
9405: PERL5_SITEBASE PERL5_USE_PACKLIST
9406: PERL5_VENDORBASE PFCTL
9407: PFVAR_H PF_VERSION
9408: PGGROUP PGHOME
9409: PGPKGSRCDIR PGSQL_TYPE
9410: PGSQL_VERSIONS_ACCEPTED PGSQL_VERSION_DEFAULT
9411: PGUSER PG_LIB_EXT
9412: PHP PHPCOMMON_MK
9413: PHPPKGSRCDIR PHP_BASE_VERS
9414: PHP_CHECK_INSTALLED PHP_EXTENSION_DIR
9415: PHP_INITIAL_TEENY PHP_PKG_PREFIX
9416: PHP_VERSION PHP_VERSIONS_ACCEPTED
9417: PHP_VERSIONS_INCOMPATIBLE PHP_VERSION_DEFAULT
9418: PHP_VERSION_REQD PILRC_USE_GTK
9419: PKGCONFIG_BASE PKGCONFIG_FILE
9420: PKGCONFIG_OVERRIDE PKGCONFIG_OVERRIDE_STAGE
9421: PKGDIR PKGGNUDIR
9422: PKGINFODIR PKGLOCALEDIR
9423: PKGMANDIR PKGNAME
9424: PKGNAME_REQD PKGPATH
9425: PKGREVISION PKGSRC_BLAS_TYPES
9426: PKGSRC_CHANGES PKGSRC_COMPILER
9427: PKGSRC_KEEP_BIN_PKGS PKGSRC_LOCKTYPE
9428: PKGSRC_MAKE_ENV PKGSRC_MESSAGE_RECIPIENTS
9429: PKGSRC_MKPIE PKGSRC_MKREPRO
9430: PKGSRC_RUN_TEST PKGSRC_SETENV
9431: PKGSRC_SLEEPSECS PKGSRC_TODO
9432: PKGSRC_USE_CTF PKGSRC_USE_FORTIFY
9433: PKGSRC_USE_RELRO PKGSRC_USE_SSP
9434: PKGSRC_USE_STACK_CHECK PKGTASKS_DATAFILE
9435: PKGTOOLS_ARGS PKGTOOLS_ENV
9436: PKG_ALTERNATIVES PKG_APACHE
9437: PKG_APACHE_ACCEPTED PKG_APACHE_DEFAULT
9438: PKG_BEST_EXISTS PKG_BUILD_OPTIONS
9439: PKG_COMPRESSION PKG_CONFIG
9440: PKG_CONFIG_PERMS PKG_CREATE_USERGROUP
9441: PKG_DB_TMPDIR PKG_DEBUG_LEVEL
9442: PKG_DEFAULT_OPTIONS PKG_DESTDIR_SUPPORT
9443: PKG_DEVELOPER PKG_DISABLED_OPTIONS
9444: PKG_FATAL_ERRORS PKG_FC
9445: PKG_FILELIST_CMD PKG_GECOS
9446: PKG_GID PKG_GROUPS
9447: PKG_GROUPS_VARS PKG_HOME
9448: PKG_INIT_SCRIPTS PKG_JAVA_HOME
9449: PKG_JVM PKG_JVMS_ACCEPTED
9450: PKG_JVM_DEFAULT PKG_LEGACY_OPTIONS
9451: PKG_LIBTOOL PKG_OPTIONS
9452: PKG_OPTIONS_DEPRECATED_WARNINGS PKG_OPTIONS_LEGACY_OPTS
9453: PKG_OPTIONS_LEGACY_VARS PKG_OPTIONS_NONEMPTY_SETS
9454: PKG_OPTIONS_OPTIONAL_GROUPS PKG_OPTIONS_REQUIRED_GROUPS
9455: PKG_OPTIONS_VAR PKG_PHP
9456: PKG_PHP_MAJOR_VERS PKG_PHP_VERSION
9457: PKG_RCD_SCRIPTS PKG_REFCOUNT_DBDIR
9458: PKG_REGISTER_SHELLS PKG_RESUME_TRANSFERS
9459: PKG_SHELL PKG_SUGGESTED_OPTIONS
9460: PKG_SUPPORTED_OPTIONS PKG_SYSCONFBASE
9461: PKG_SYSCONFBASEDIR PKG_SYSCONFDIR
9462: PKG_SYSCONFDIR_PERMS PKG_SYSCONFSUBDIR
9463: PKG_SYSCONFVAR PKG_TOOLS_BIN
9464: PKG_UID PKG_UPDATE_FONTS_DB
9465: PKG_USERS PKG_USERS_VARS
9466: PKG_VERBOSE PLIST
9467: PLIST_AWK PLIST_AWK_ENV
9468: PLIST_SRC PLIST_SUBST
9469: PLIST_TYPE PLIST_VARS
9470: POPTOP_USE_MPPE POSSIBLE_GFORTRAN_VERSION
9471: POST_FETCH_HOOK PREFER
9472: PREFER_NATIVE PREFER_NATIVE_PTHREADS
9473: PREFER_PKGSRC PREFIX
9474: PREPEND_PATH PRE_ROOT_CMD
9475: PRIVILEGED_STAGES PS
9476: PTHREAD_AUTO_VARS PTHREAD_CFLAGS
9477: PTHREAD_LDFLAGS PTHREAD_LIBS
9478: PTHREAD_OPTS PTHREAD_TYPE
9479: PVM_SSH PYPKGPREFIX
9480: PYTHON_FOR_BUILD_ONLY PYTHON_SELF_CONFLICT
9481: PYTHON_VERSIONED_DEPENDENCIES PYTHON_VERSIONS_ACCEPTED
9482: PYTHON_VERSIONS_INCOMPATIBLE PYTHON_VERSION_DEFAULT
9483: PYTHON_VERSION_REQD PYVERSSUFFIX
9484: PY_NO_EGG QMAILDIR
9485: QMAIL_ALIAS_USER QMAIL_DAEMON_USER
9486: QMAIL_LOG_USER QMAIL_NOFILES_GROUP
9487: QMAIL_PASSWD_USER QMAIL_QMAIL_GROUP
9488: QMAIL_QUEUE_DIR QMAIL_QUEUE_EXTRA
9489: QMAIL_QUEUE_USER QMAIL_REMOTE_USER
9490: QMAIL_ROOT_USER QMAIL_SEND_USER
9491: QPOPPER_FAC QPOPPER_SPOOL_DIR
9492: QPOPPER_USER RAKE_NAME
9493: RASMOL_DEPTH RCD_DIR
9494: RCD_ORDER RCD_SCRIPTS
9495: RCD_SCRIPTS_DIR RCD_SCRIPTS_EXAMPLEDIR
9496: RCD_SCRIPTS_MODE RCD_SCRIPTS_SHELL
9497: RCD_SCRIPT_SRC RCD_SUBR
9498: RDOC READLINE_DEFAULT
9499: READLINE_TYPE REAL_ROOT_GROUP
9500: REAL_ROOT_USER RECURSIVE_MAKE
9501: RELAY_CTRL_DIR REPLACE_AWK
9502: REPLACE_BASH REPLACE_CSH
9503: REPLACE_KSH REPLACE_PERL
9504: REPLACE_PERL6 REPLACE_PHP
9505: REPLACE_PYTHON REPLACE_RUBY
9506: REPLACE_RUBY_DIRS REPLACE_RUBY_PAT
9507: REPLACE_SH REPLACE_TEXLUA
9508: REQD_DIRS REQD_DIRS_PERMS
9509: REQD_FILES REQD_FILES_MODE
9510: REQD_FILES_PERMS RESOLV_AUTO_VARS
9511: RESOLV_LDFLAGS RESOLV_LIBS
9512: RM ROCKSPEC_NAME
9513: ROCKSPEC_SPECFILE ROOT_CMD
9514: ROOT_GROUP ROOT_USER
9515: RPCGEN RPM
9516: RPM2PKG_PLIST RPM2PKG_PREFIX
9517: RPM2PKG_STAGE RPM2PKG_STRIP
9518: RPM2PKG_SUBPREFIX RPMFILES
9519: RPMIGNOREPATH RPM_DB_PREFIX
9520: RSSH_CVS_PATH RSSH_RDIST_PATH
9521: RSSH_RSYNC_PATH RSSH_SCP_PATH
9522: RSSH_SFTP_SERVER_PATH RUBY
9523: RUBYGEM RUBYGEM_NAME
9524: RUBYGEM_OPTIONS RUBY_ABI_VERSION
9525: RUBY_ARCH RUBY_ARCHINC
9526: RUBY_ARCHLIB RUBY_BASE
9527: RUBY_BASERIDIR RUBY_BUILD_DOCUMENT
9528: RUBY_DLEXT RUBY_DOC
9529: RUBY_DYNAMIC_DIRS RUBY_EG
9530: RUBY_ENCODING_ARG RUBY_EXTCONF
9531: RUBY_EXTCONF_CHECK RUBY_EXTCONF_DEBUG
9532: RUBY_EXTCONF_MAKEFILE RUBY_GEM_BASE
9533: RUBY_INC RUBY_LIB
9534: RUBY_LIB_BASE RUBY_NAME
9535: RUBY_NOVERSION RUBY_PKGPREFIX
9536: RUBY_RAILS RUBY_RAILS51_VERSION
9537: RUBY_RAILS52_VERSION RUBY_RAILS60_VERSION
9538: RUBY_RAILS_ACCEPTED RUBY_RAILS_DEFAULT
9539: RUBY_RAILS_REQD RUBY_RAILS_STRICT_DEP
9540: RUBY_RIDIR RUBY_SETUP
9541: RUBY_SHLIB RUBY_SHLIBALIAS
9542: RUBY_SHLIBVER RUBY_SIMPLE_INSTALL
9543: RUBY_SITEARCHLIB RUBY_SITELIB
9544: RUBY_SITELIB_BASE RUBY_SITERIDIR
9545: RUBY_SLEXT RUBY_SRCDIR
9546: RUBY_STATICLIB RUBY_SUFFIX
9547: RUBY_SYSRIDIR RUBY_USE_PTHREAD
9548: RUBY_VENDORARCHLIB RUBY_VENDORLIB
9549: RUBY_VENDORLIB_BASE RUBY_VER
9550: RUBY_VERSION RUBY_VERSIONS_ACCEPTED
9551: RUBY_VERSIONS_INCOMPATIBLE RUBY_VERSION_DEFAULT
9552: RUBY_VERSION_REQD RUBY_VER_DIR
9553: RUN RUN_LDCONFIG
9554: SAWFISH_THEMES SCO
9555: SCREWS_GROUP SCREWS_USER
9556: SCRIPTS_ENV SCROLLKEEPER_DATADIR
9557: SCROLLKEEPER_REBUILDDB SCROLLKEEPER_UPDATEDB
9558: SDIST_PAWD SERIAL_DEVICES
9559: SETGIDGAME SETGID_GAMES_PERMS
9560: SETUID_ROOT_PERMS SH
9561: SHLIB SHORTNAME
9562: SIGN_PACKAGES SILC_CLIENT_WITH_PERL
9563: SITE_SPECIFIC_PKGS SKIP_DEPENDS
9564: SMF_INSTANCES SMF_MANIFEST
9565: SMF_METHODS SMF_METHOD_SHELL
9566: SMF_METHOD_SRC SMF_NAME
9567: SMF_PREFIX SMF_SRCDIR
9568: SNIPROXY_GROUP SNIPROXY_USER
9569: SOURCE_BUFFSIZE SPECIAL_PERMS
9570: SPECIFIC_PKGS SSH_SUID
9571: SSP_SUPPORTED SSYNC_PAWD
9572: STEP_MSG STRIP
9573: STRIP_DBG STRIP_DEBUG
9574: STRIP_DEBUG_SUPPORTED STRIP_FILES_SKIP
9575: SU SUBDIR
9576: SUBST SUBST_CLASSES
9577: SUBST_FILES SUBST_FILTER_CMD
9578: SUBST_MESSAGE SUBST_NOOP_OK
9579: SUBST_SED SUBST_SHOW_DIFF
9580: SUBST_SKIP_TEXT_CHECK SUBST_STAGE
9581: SUBST_VARS SUNWSPROBASE
9582: SUSE_PREFER SU_CMD
9583: SVN_EXTRACTDIR SVN_REPO
9584: SVN_REPOSITORIES SVN_REVISION
9585: TERMCAP_TYPE TERMINFO_DEFAULT
9586: TERMINFO_TYPE TEST
9587: TEST_DEPENDS TEST_DIRS
9588: TEST_ENV TEST_ENV_SHELL
9589: TEST_MAKE_CMD TEST_MAKE_FLAGS
9590: TEST_TARGET TEXLIVE_IGNORE_PATTERNS
9591: TEXLIVE_REV TEXLIVE_UNVERSIONED
9592: TEXMFSITE TEX_FORMATS
9593: TEX_HYPHEN_DAT TEX_HYPHEN_DEF
9594: TEX_TEXMF_DIRS THTTPD_LOG_FACILITY
9595: TO TOOLS_ALIASES
9596: TOOLS_ALWAYS_WRAP TOOLS_ARGS
9597: TOOLS_BROKEN TOOLS_CMD
9598: TOOLS_CREATE TOOLS_DIR
9599: TOOLS_FAIL TOOLS_GNU_MISSING
9600: TOOLS_LDCONFIG TOOLS_NOOP
9601: TOOLS_PATH TOOLS_SCRIPT
9602: TOOL_DEPENDS TTF_FONTDIR
9603: TTF_FONTS_DIR TYPE
9604: UAC_REQD_EXECS UCSPI_SSL_GROUP
9605: UCSPI_SSL_USER UNLIMIT_RESOURCES
9606: UNPRIVILEGED UNPRIVILEGED_GROUP
9607: UNPRIVILEGED_GROUPS UNPRIVILEGED_USER
9608: UNWRAP_FILES UNWRAP_PATTERNS
9609: UPDATE_GEMSPEC UPDATE_TARGET
9610: URI USERGROUP_PHASE
9611: USERPPP_GROUP USER_SPECIFIC_PKGS
9612: USE_ABI_DEPENDS USE_APR
9613: USE_BSD_MAKEFILE USE_BUILTIN
9614: USE_CROSS_COMPILE USE_CURSES
9615: USE_CWRAPPERS USE_DB185
9616: USE_FEATURES USE_GAMESGROUP
9617: USE_GCC_RUNTIME USE_IMAKE
9618: USE_JAVA USE_JAVA2
9619: USE_LANGUAGES USE_LIBTOOL
9620: USE_NATIVE_GCC USE_NETBSD_REPO
9621: USE_PKGSRC_GCC USE_PKGSRC_GCC_RUNTIME
9622: USE_PKGTASKS USE_PKG_ADMIN_DIGEST
9623: USE_RUBY_EXTCONF USE_RUBY_INSTALL
9624: USE_RUBY_SETUP USE_RUBY_SETUP_PKG
9625: USE_TOOLS UUCP_GROUP
9626: UUCP_USER VARBASE
9627: VARNAME VIM_EXTRA_OPTS
9628: WARNING_MSG WCALC_CGIDIR
9629: WCALC_CGIPATH WCALC_HTMLDIR
9630: WCALC_HTMLPATH WDM_MANAGERS
9631: WRAPPER_REORDER_CMDS WRKDIR
9632: WRKDIR_BASENAME WRKDIR_LOCKTYPE
9633: WRKLOG WRKOBJDIR
9634: WRKSRC X10_PORT
9635: X11 X11BASE
9636: X11_PKGSRCDIR X11_TYPE
9637: X509_CERTIFICATE X509_KEY
9638: XAW_TYPE XLOCK_DEFAULT_MODE
9639: XMKMF_FLAGS XXX
9640: XXXX YES
9641: ZSH_STATIC __stdc__
9642: _vargroups accept
9643: acquire-localbase-lock acquire-lock
9644: add administrator
9645: alloca alternatives
9646: aslr asprintf
9647: atlas autoconf
9648: automake autoreconf
9649: awk bash
9650: big-endian bin-install
9651: bind binpkg-list
9652: blas bootstrap-depends
9653: broken broken_on_platform
9654: bsd bsd.prog.mk
9655: build build-env
9656: buildlink-directories buildlink-oss-soundcard-h
9657: c c++
9658: ccache cce
9659: cdefs ceil
9660: changes changes-entry
9661: changes-entry-noupdate check
9662: check-clean check-files
9663: check-files-clean check-vulnerable
9664: checksum checksum-phase
9665: clean clean-depends
9666: cleandir commit
9667: commit-changes-entry compact
9668: compiler conf
9669: config.guess config.sub
9670: configuration configure
9671: configure-env configure-help
9672: configure_args connect
9673: cos cputime
9674: create-usergroup csh
9675: ctf cvs
9676: debug declaration
9677: declare defined
9678: depend dependencies
9679: depends depends-checksum
9680: depends-fetch deps
9681: describe destdir
9682: disable distclean
9683: distinfo dl
9684: dlopen do-build
9685: do-buildlink do-clean
9686: do-configure do-configure-post-hook
9687: do-extract do-fetch
9688: do-install emul
9689: emul-distinfo emul-fetch
9690: emulation emulator
9691: enable endian
9692: endif enomem
9693: err errx
9694: etc exp
9695: extract-rpm fabs
9696: feature features
9697: fetch fetch-list
9698: follows forbids
9699: form format
9700: fortify fortify_source
9701: fossil friend
9702: fts fts_close
9703: fts_open fts_read
9704: fts_set gcc
9705: gethostbyaddr gethostbyname
9706: gethostbyname2 getopt_long
9707: getprogname getservbyname
9708: getservbyport getservent
9709: gettext git
9710: github gitlab
9711: glob gnu
9712: gnu_configure_strict go
9713: go-deps golang
9714: guess-license hashbang
9715: heimdal help
9716: hg imake
9717: increment inet_aton
9718: interp interpreter
9719: intl iso
9720: kerberos krb
9721: krb5 ksh
9722: lapack latex
9723: libintl_bindtextdomain libintl_gettext
9724: libintl_textdomain libnbcompat
9725: libs libtool
9726: licence license
9727: lintl little-endian
9728: lock locking
9729: lvalue make
9730: makesum memory
9731: mercurial meta
9732: meta-package meta_package
9733: mit-krb5 mk.conf
9734: mkl mount
9735: mprotect mremap
9736: nb nbcompat
9737: obstack obstack_ptr_grow
9738: occurs only
9739: openblas options
9740: options.mk order
9741: override override-intltool
9742: override-message-intltool package
9743: parallel path
9744: pax paxctl
9745: pbulk-index pc
9746: perl perl5
9747: perms php
9748: pkg-build-options pkg-config
9749: pkg_build_options platform
9750: plist post-extract
9751: post-fetch post-wrapper
9752: pre-build-checks-hook pre-configure
9753: pre-configure-checks-hook pre-extract
9754: pre-fetch print-go-deps
9755: print-plist print-summary-data
9756: privileged-install-hook pypi
9757: python readme-all
9758: recv recvfrom
9759: regcomp release-localbase-lock
9760: release-lock relro
9761: rename reorder
9762: replace replace_interpreter
9763: reproducible resolv
9764: root ruby
9765: send sendfile
9766: sendto setenv
9767: setgid setprogname
9768: setuid sh
1.181 rillig 9769: shebang show
9770: show-all show-build-defs
9771: show-depends show-deps
9772: show-distfiles show-downlevel
9773: show-subdir-var show-tools
9774: show-var show-vars
9775: snprintf socket
9776: ssp st_mode
9777: stage-install strcasestr
9778: strict strip
9779: strndup strnlen
9780: strsep subst
9781: substitutions subversion
9782: sun sunpro
9783: sunwspro svn
9784: symlink test
9785: test-env tex
9786: texlive tmp
9787: tool tools
9788: tools-libtool-m4-override type
9789: ulimit undefined
9790: undo-replace unlimit
9791: unprivileged unprivileged-install-hook
9792: unstripped update
9793: upload upload-distfiles
9794: use_tools user
9795: utimes vasprintf
9796: verbose vsnprintf
9797: warn warning
9798: warnings warnx
9799: wattr_off wattr_on
9800: work wrapper
9801: wrkdir
1.154 rillig 9802:
9803: Appendix E. Editing guidelines for the pkgsrc guide
1.1 dsieger 9804:
9805: Table of Contents
9806:
1.154 rillig 9807: E.1. Make targets
9808: E.2. Procedure
1.1 dsieger 9809:
9810: This section contains information on editing the pkgsrc guide itself.
9811:
1.154 rillig 9812: E.1. Make targets
1.1 dsieger 9813:
9814: The pkgsrc guide's source code is stored in pkgsrc/doc/guide/files, and several
9815: files are created from it:
9816:
9817: * pkgsrc/doc/pkgsrc.txt
9818:
9819: * pkgsrc/doc/pkgsrc.html
9820:
1.174 leot 9821: * https://www.NetBSD.org/docs/pkgsrc/
1.1 dsieger 9822:
1.174 leot 9823: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.pdf: The PDF version of the
9824: pkgsrc guide.
1.1 dsieger 9825:
1.174 leot 9826: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.ps: PostScript version of the
1.2 rillig 9827: pkgsrc guide.
1.1 dsieger 9828:
1.154 rillig 9829: E.2. Procedure
1.1 dsieger 9830:
9831: The procedure to edit the pkgsrc guide is:
9832:
9833: 1. Make sure you have the packages needed to regenerate the pkgsrc guide (and
1.46 obache 9834: other XML-based NetBSD documentation) installed. These are automatically
9835: installed when you install the meta-pkgs/pkgsrc-guide-tools package.
1.1 dsieger 9836:
9837: 2. Run cd doc/guide to get to the right directory. All further steps will take
9838: place here.
9839:
9840: 3. Edit the XML file(s) in files/.
9841:
9842: 4. Run bmake to check the pkgsrc guide for valid XML and to build the final
9843: output files. If you get any errors at this stage, you can just edit the
9844: files, as there are only symbolic links in the working directory, pointing
9845: to the files in files/.
9846:
9847: 5. (cd files && cvs commit)
9848:
9849: 6. Run bmake clean && bmake to regenerate the output files with the proper RCS
9850: Ids.
9851:
9852: 7. Run bmake regen to install and commit the files in both pkgsrc/doc and
9853: htdocs.
9854:
9855: Note
9856:
9857: If you have added, removed or renamed some chapters, you need to
9858: synchronize them using cvs add or cvs delete in the htdocs directory.
9859:
CVSweb <webmaster@jp.NetBSD.org>