Annotation of htdocs/docs/pkgsrc/pkgsrc.txt, revision 1.176
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
105: 8.2. Running a pbulk-style 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
110: 8.4. Creating a multiple CD-ROM packages collection
1.6 rillig 111:
1.154 rillig 112: 8.4.1. Example of cdpack
1.6 rillig 113:
1.154 rillig 114: 9. Directory layout of the installed files
1.6 rillig 115:
1.154 rillig 116: 9.1. File system layout in ${LOCALBASE}
117: 9.2. File system layout in ${VARBASE}
1.6 rillig 118:
1.154 rillig 119: 10. Frequently Asked Questions
1.6 rillig 120:
1.154 rillig 121: 10.1. Are there any mailing lists for pkg-related discussion?
122: 10.2. Utilities for package management (pkgtools)
123: 10.3. How to use pkgsrc as non-root
124: 10.4. How to resume transfers when fetching distfiles?
125: 10.5. How can I install/use modular X.org from pkgsrc?
126: 10.6. How to fetch files from behind a firewall
127: 10.7. How to fetch files from HTTPS sites
128: 10.8. How do I tell make fetch to do passive FTP?
129: 10.9. How to fetch all distfiles at once
130: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc"
1.24 wiz 131: mean?
1.154 rillig 132: 10.11. What does "Could not find bsd.own.mk" mean?
133: 10.12. Using 'sudo' with pkgsrc
134: 10.13. How do I change the location of configuration files?
135: 10.14. Automated security checks
136: 10.15. Why do some packages ignore my CFLAGS?
137: 10.16. A package does not build. What shall I do?
138: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/???
1.24 wiz 139: merge conflicts" mean?
1.1 dsieger 140:
141: II. The pkgsrc developer's guide
142:
1.154 rillig 143: 11. Getting help
144: 12. Creating a new pkgsrc package from scratch
1.1 dsieger 145:
1.154 rillig 146: 12.1. Common types of packages
1.1 dsieger 147:
1.154 rillig 148: 12.1.1. Perl modules
149: 12.1.2. Python modules and programs
1.160 brook 150: 12.1.3. R packages
151: 12.1.4. TeXlive packages
1.1 dsieger 152:
1.154 rillig 153: 12.2. Examples
1.1 dsieger 154:
1.154 rillig 155: 12.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 156:
1.154 rillig 157: 13. Package components - files, directories and contents
1.1 dsieger 158:
1.154 rillig 159: 13.1. Makefile
160: 13.2. distinfo
161: 13.3. patches/*
1.1 dsieger 162:
1.154 rillig 163: 13.3.1. Structure of a single patch file
164: 13.3.2. Creating patch files
165: 13.3.3. Sources where the patch files come from
166: 13.3.4. Patching guidelines
167: 13.3.5. Feedback to the author
1.1 dsieger 168:
1.154 rillig 169: 13.4. Other mandatory files
170: 13.5. Optional files
1.1 dsieger 171:
1.154 rillig 172: 13.5.1. Files affecting the binary package
173: 13.5.2. Files affecting the build process
174: 13.5.3. Files affecting nothing at all
1.1 dsieger 175:
1.154 rillig 176: 13.6. work*
177: 13.7. files/*
1.1 dsieger 178:
1.154 rillig 179: 14. Programming in Makefiles
1.1 dsieger 180:
1.154 rillig 181: 14.1. Caveats
182: 14.2. Makefile variables
1.1 dsieger 183:
1.154 rillig 184: 14.2.1. Naming conventions
1.1 dsieger 185:
1.154 rillig 186: 14.3. Code snippets
1.1 dsieger 187:
1.154 rillig 188: 14.3.1. Adding things to a list
189: 14.3.2. Echoing a string exactly as-is
190: 14.3.3. Passing CFLAGS to GNU configure scripts
191: 14.3.4. Handling possibly empty variables
1.1 dsieger 192:
1.154 rillig 193: 15. PLIST issues
1.1 dsieger 194:
1.154 rillig 195: 15.1. RCS ID
196: 15.2. Semi-automatic PLIST generation
197: 15.3. Tweaking output of make print-PLIST
198: 15.4. Variable substitution in PLIST
199: 15.5. Man page compression
200: 15.6. Changing PLIST source with PLIST_SRC
201: 15.7. Platform-specific and differing PLISTs
202: 15.8. Build-specific PLISTs
203: 15.9. Sharing directories between packages
1.1 dsieger 204:
1.154 rillig 205: 16. Buildlink methodology
1.1 dsieger 206:
1.154 rillig 207: 16.1. Converting packages to use buildlink3
208: 16.2. Writing buildlink3.mk files
1.1 dsieger 209:
1.154 rillig 210: 16.2.1. Anatomy of a buildlink3.mk file
211: 16.2.2. Updating BUILDLINK_API_DEPENDS.pkg and
1.27 wiz 212: BUILDLINK_ABI_DEPENDS.pkg in buildlink3.mk files
1.1 dsieger 213:
1.154 rillig 214: 16.3. Writing builtin.mk files
1.1 dsieger 215:
1.154 rillig 216: 16.3.1. Anatomy of a builtin.mk file
217: 16.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 218:
1.154 rillig 219: 17. The pkginstall framework
1.1 dsieger 220:
1.154 rillig 221: 17.1. Files and directories outside the installation prefix
1.1 dsieger 222:
1.154 rillig 223: 17.1.1. Directory manipulation
224: 17.1.2. File manipulation
1.1 dsieger 225:
1.154 rillig 226: 17.2. Configuration files
1.1 dsieger 227:
1.154 rillig 228: 17.2.1. How PKG_SYSCONFDIR is set
229: 17.2.2. Telling the software where configuration files are
230: 17.2.3. Patching installations
231: 17.2.4. Disabling handling of configuration files
1.1 dsieger 232:
1.154 rillig 233: 17.3. System startup scripts
1.1 dsieger 234:
1.154 rillig 235: 17.3.1. Disabling handling of system startup scripts
1.1 dsieger 236:
1.154 rillig 237: 17.4. System users and groups
238: 17.5. System shells
1.1 dsieger 239:
1.154 rillig 240: 17.5.1. Disabling shell registration
1.1 dsieger 241:
1.154 rillig 242: 17.6. Fonts
1.1 dsieger 243:
1.154 rillig 244: 17.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 245:
1.154 rillig 246: 18. Options handling
1.1 dsieger 247:
1.154 rillig 248: 18.1. Global default options
249: 18.2. Converting packages to use bsd.options.mk
250: 18.3. Option Names
251: 18.4. Determining the options of dependencies
1.1 dsieger 252:
1.154 rillig 253: 19. The build process
1.1 dsieger 254:
1.154 rillig 255: 19.1. Introduction
256: 19.2. Program location
257: 19.3. Directories used during the build process
258: 19.4. Running a phase
259: 19.5. The fetch phase
1.1 dsieger 260:
1.154 rillig 261: 19.5.1. What to fetch and where to get it from
262: 19.5.2. How are the files fetched?
1.1 dsieger 263:
1.154 rillig 264: 19.6. The checksum phase
265: 19.7. The extract phase
266: 19.8. The patch phase
267: 19.9. The tools phase
268: 19.10. The wrapper phase
269: 19.11. The configure phase
270: 19.12. The build phase
271: 19.13. The test phase
272: 19.14. The install phase
273: 19.15. The package phase
274: 19.16. Cleaning up
275: 19.17. Other helpful targets
1.1 dsieger 276:
1.154 rillig 277: 20. Tools needed for building or running
1.1 dsieger 278:
1.154 rillig 279: 20.1. Tools for pkgsrc builds
280: 20.2. Tools needed by packages
281: 20.3. Tools provided by platforms
1.1 dsieger 282:
1.154 rillig 283: 21. Making your package work
1.1 dsieger 284:
1.154 rillig 285: 21.1. General operation
1.1 dsieger 286:
1.154 rillig 287: 21.1.1. How to pull in user-settable variables from mk.conf
288: 21.1.2. User interaction
289: 21.1.3. Handling licenses
290: 21.1.4. Restricted packages
291: 21.1.5. Handling dependencies
292: 21.1.6. Handling conflicts with other packages
293: 21.1.7. Packages that cannot or should not be built
294: 21.1.8. Packages which should not be deleted, once installed
295: 21.1.9. Handling packages with security problems
296: 21.1.10. How to handle incrementing versions when fixing an
1.1 dsieger 297: existing package
1.154 rillig 298: 21.1.11. Substituting variable text in the package files (the SUBST
1.1 dsieger 299: framework)
300:
1.154 rillig 301: 21.2. The fetch phase
1.1 dsieger 302:
1.154 rillig 303: 21.2.1. Packages whose distfiles aren't available for plain
1.1 dsieger 304: downloading
1.154 rillig 305: 21.2.2. How to handle modified distfiles with the 'old' name
306: 21.2.3. Packages hosted on github.com
1.1 dsieger 307:
1.154 rillig 308: 21.3. The configure phase
1.1 dsieger 309:
1.154 rillig 310: 21.3.1. Shared libraries - libtool
311: 21.3.2. Using libtool on GNU packages that already support libtool
312: 21.3.3. GNU Autoconf/Automake
313:
314: 21.4. Programming languages
315:
316: 21.4.1. C, C++, and Fortran
317: 21.4.2. Java
318: 21.4.3. Packages containing perl scripts
319: 21.4.4. Packages containing shell scripts
320: 21.4.5. Other programming languages
321:
322: 21.5. The build phase
323:
324: 21.5.1. Compiling C and C++ code conditionally
325: 21.5.2. How to handle compiler bugs
1.172 rillig 326: 21.5.3. No such file or directory
327: 21.5.4. Undefined reference to "..."
328: 21.5.5. Running out of memory
1.154 rillig 329:
330: 21.6. The install phase
331:
332: 21.6.1. Creating needed directories
333: 21.6.2. Where to install documentation
334: 21.6.3. Installing highscore files
335: 21.6.4. Adding DESTDIR support to packages
336: 21.6.5. Packages with hardcoded paths to other interpreters
337: 21.6.6. Packages installing perl modules
338: 21.6.7. Packages installing info files
339: 21.6.8. Packages installing man pages
340: 21.6.9. Packages installing GConf data files
341: 21.6.10. Packages installing scrollkeeper/rarian data files
342: 21.6.11. Packages installing X11 fonts
343: 21.6.12. Packages installing GTK2 modules
344: 21.6.13. Packages installing SGML or XML data
345: 21.6.14. Packages installing extensions to the MIME database
346: 21.6.15. Packages using intltool
347: 21.6.16. Packages installing startup scripts
348: 21.6.17. Packages installing TeX modules
349: 21.6.18. Packages supporting running binaries in emulation
350: 21.6.19. Packages installing hicolor theme icons
351: 21.6.20. Packages installing desktop files
352:
353: 21.7. Marking packages as having problems
354:
355: 22. Debugging
356: 23. Submitting and Committing
357:
358: 23.1. Submitting binary packages
359: 23.2. Submitting source packages (for non-NetBSD-developers)
360: 23.3. General notes when adding, updating, or removing packages
361: 23.4. Commit Messages
362: 23.5. Committing: Adding a package to CVS
363: 23.6. Updating a package to a newer version
364: 23.7. Renaming a package in pkgsrc
365: 23.8. Moving a package in pkgsrc
366:
367: 24. Frequently Asked Questions
368: 25. GNOME packaging and porting
369:
370: 25.1. Meta packages
371: 25.2. Packaging a GNOME application
372: 25.3. Updating GNOME to a newer version
373: 25.4. Patching guidelines
1.1 dsieger 374:
375: III. The pkgsrc infrastructure internals
376:
1.154 rillig 377: 26. Design of the pkgsrc infrastructure
1.1 dsieger 378:
1.154 rillig 379: 26.1. The meaning of variable definitions
380: 26.2. Avoiding problems before they arise
381: 26.3. Variable evaluation
1.1 dsieger 382:
1.154 rillig 383: 26.3.1. At load time
384: 26.3.2. At runtime
1.1 dsieger 385:
1.154 rillig 386: 26.4. How can variables be specified?
387: 26.5. Designing interfaces for Makefile fragments
1.1 dsieger 388:
1.154 rillig 389: 26.5.1. Procedures with parameters
390: 26.5.2. Actions taken on behalf of parameters
1.1 dsieger 391:
1.154 rillig 392: 26.6. The order in which files are loaded
1.1 dsieger 393:
1.154 rillig 394: 26.6.1. The order in bsd.prefs.mk
395: 26.6.2. The order in bsd.pkg.mk
1.1 dsieger 396:
1.154 rillig 397: 27. Regression tests
1.1 dsieger 398:
1.154 rillig 399: 27.1. Running the regression tests
400: 27.2. Adding a new regression test
1.1 dsieger 401:
1.154 rillig 402: 27.2.1. Overridable functions
403: 27.2.2. Helper functions
1.1 dsieger 404:
1.154 rillig 405: 28. Porting pkgsrc
1.1 dsieger 406:
1.154 rillig 407: 28.1. Porting pkgsrc to a new operating system
1.1 dsieger 408:
409: A. A simple example package: bison
410:
411: A.1. files
412:
413: A.1.1. Makefile
414: A.1.2. DESCR
415: A.1.3. PLIST
416: A.1.4. Checking a package with pkglint
417:
418: A.2. Steps for building, installing, packaging
419:
420: B. Build logs
421:
422: B.1. Building figlet
423: B.2. Packaging figlet
424:
425: C. Directory layout of the pkgsrc FTP server
426:
1.23 jakllsch 427: C.1. distfiles: The distributed source files
428: C.2. misc: Miscellaneous things
429: C.3. packages: Binary packages
430: C.4. reports: Bulk build reports
1.148 leot 431: C.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 432:
1.154 rillig 433: D. Help topics
434: E. Editing guidelines for the pkgsrc guide
1.1 dsieger 435:
1.154 rillig 436: E.1. Make targets
437: E.2. Procedure
1.1 dsieger 438:
439: List of Tables
440:
441: 1.1. Platforms supported by pkgsrc
1.154 rillig 442: 13.1. Patching examples
443: 25.1. PLIST handling for GNOME packages
1.1 dsieger 444:
445: Chapter 1. What is pkgsrc?
446:
447: Table of Contents
448:
449: 1.1. Introduction
450:
451: 1.1.1. Why pkgsrc?
452: 1.1.2. Supported platforms
453:
454: 1.2. Overview
455: 1.3. Terminology
456:
457: 1.3.1. Roles involved in pkgsrc
458:
459: 1.4. Typography
460:
461: 1.1. Introduction
462:
463: There is a lot of software freely available for Unix-based systems, which is
464: usually available in form of the source code. Before such software can be used,
465: it needs to be configured to the local system, compiled and installed, and this
466: is exactly what The NetBSD Packages Collection (pkgsrc) does. pkgsrc also has
467: some basic commands to handle binary packages, so that not every user has to
468: build the packages for himself, which is a time-costly task.
469:
470: pkgsrc currently contains several thousand packages, including:
471:
1.104 sevan 472: * www/apache24 - The Apache web server
1.1 dsieger 473:
474: * www/firefox - The Firefox web browser
475:
476: * meta-pkgs/gnome - The GNOME Desktop Environment
477:
1.102 ryoon 478: * meta-pkgs/kde4 - The K Desktop Environment
1.1 dsieger 479:
1.108 rillig 480: ? just to name a few.
1.1 dsieger 481:
482: pkgsrc has built-in support for handling varying dependencies, such as pthreads
483: and X11, and extended features such as IPv6 support on a range of platforms.
484:
485: 1.1.1. Why pkgsrc?
486:
487: pkgsrc provides the following key features:
488:
489: * Easy building of software from source as well as the creation and
490: installation of binary packages. The source and latest patches are
491: retrieved from a master or mirror download site, checksum verified, then
492: built on your system. Support for binary-only distributions is available
493: for both native platforms and NetBSD emulated platforms.
494:
495: * All packages are installed in a consistent directory tree, including
496: binaries, libraries, man pages and other documentation.
497:
1.104 sevan 498: * Tracking of package dependencies automatically, including when performing
499: updates, to ensure required packages are installed. The configuration files
500: of various packages are handled automatically during updates, so local
501: changes are preserved.
1.1 dsieger 502:
503: * Like NetBSD, pkgsrc is designed with portability in mind and consists of
504: highly portable code. This allows the greatest speed of development when
1.26 spz 505: porting to a new platform. This portability also ensures that pkgsrc is
1.1 dsieger 506: consistent across all platforms.
507:
508: * The installation prefix, acceptable software licenses, international
509: encryption requirements and build-time options for a large number of
510: packages are all set in a simple, central configuration file.
511:
512: * The entire source (not including the distribution files) is freely
513: available under a BSD license, so you may extend and adapt pkgsrc to your
514: needs. Support for local packages and patches is available right out of the
515: box, so you can configure it specifically for your environment.
516:
517: The following principles are basic to pkgsrc:
518:
519: * "It should only work if it's right." ? That means, if a package contains
520: bugs, it's better to find them and to complain about them rather than to
521: just install the package and hope that it works. There are numerous checks
1.175 gutterid 522: in pkgsrc that try to find such bugs: static analysis tools (pkgtools/
1.1 dsieger 523: pkglint), build-time checks (portability of shell scripts), and
524: post-installation checks (installed files, references to shared libraries,
525: script interpreters).
526:
527: * "If it works, it should work everywhere" ? Like NetBSD has been ported to
528: many hardware architectures, pkgsrc has been ported to many operating
529: systems. Care is taken that packages behave the same on all platforms.
530:
531: 1.1.2. Supported platforms
532:
533: pkgsrc consists of both a source distribution and a binary distribution for
534: these operating systems. After retrieving the required source or binaries, you
535: can be up and running with pkgsrc in just minutes!
536:
537: pkgsrc was derived from FreeBSD's ports system, and initially developed for
538: NetBSD only. Since then, pkgsrc has grown a lot, and now supports the following
539: platforms:
540:
541: Table 1.1. Platforms supported by pkgsrc
542:
1.92 sevan 543: +-----------------------------------------------------------------------------+
544: | Platform | Date Support | Notes |
545: | | Added | |
546: |--------------------------------------+---------------+----------------------|
547: |NetBSD | Aug 1997 | |
548: |--------------------------------------+---------------+----------------------|
549: |Solaris | Mar 1999 |README.Solaris |
550: |--------------------------------------+---------------+----------------------|
551: |Linux | Jun 1999 |README.Linux |
552: |--------------------------------------+---------------+----------------------|
1.118 sevan 553: |Darwin / Mac OS X / OS X / macOS | Oct 2001 |README.MacOSX |
1.92 sevan 554: |--------------------------------------+---------------+----------------------|
555: |FreeBSD | Nov 2002 |README.FreeBSD |
556: |--------------------------------------+---------------+----------------------|
557: |OpenBSD | Nov 2002 |README.OpenBSD |
558: |--------------------------------------+---------------+----------------------|
559: |IRIX | Dec 2002 |README.IRIX |
560: | | |README.IRIX5.3 |
561: |--------------------------------------+---------------+----------------------|
562: |BSD/OS | Dec 2003 | |
563: |--------------------------------------+---------------+----------------------|
564: |AIX | Dec 2003 |README.AIX |
565: |--------------------------------------+---------------+----------------------|
566: |Interix (Microsoft Windows Services | Mar 2004 |README.Interix |
567: |for Unix) | | |
568: |--------------------------------------+---------------+----------------------|
569: |DragonFlyBSD | Oct 2004 | |
570: |--------------------------------------+---------------+----------------------|
571: |OSF/1 | Nov 2004 |README.OSF1 |
572: |--------------------------------------+---------------+----------------------|
573: |HP-UX | Apr 2007 |README.HPUX |
574: |--------------------------------------+---------------+----------------------|
575: |Haiku | Sep 2010 |README.Haiku |
576: |--------------------------------------+---------------+----------------------|
577: |MirBSD | Jan 2011 | |
578: |--------------------------------------+---------------+----------------------|
579: |Minix3 | Nov 2011 |README.Minix3 |
580: |--------------------------------------+---------------+----------------------|
581: |Cygwin | Mar 2013 |README.Cygwin |
582: |--------------------------------------+---------------+----------------------|
583: |GNU/kFreeBSD | Jul 2013 |README.GNUkFreeBSD |
1.104 sevan 584: |--------------------------------------+---------------+----------------------|
585: |Bitrig | Jun 2014 |README.Bitrig |
1.92 sevan 586: +-----------------------------------------------------------------------------+
1.1 dsieger 587:
588:
589: 1.2. Overview
590:
591: This document is divided into three parts. The first, The pkgsrc user's guide,
592: describes how one can use one of the packages in the Package Collection, either
593: by installing a precompiled binary package, or by building one's own copy using
594: the NetBSD package system. The second part, The pkgsrc developer's guide,
595: explains how to prepare a package so it can be easily built by other NetBSD
596: users without knowing about the package's building details. The third part, The
597: pkgsrc infrastructure internals is intended for those who want to understand
598: how pkgsrc is implemented.
599:
600: This document is available in various formats: HTML, PDF, PS, TXT.
601:
602: 1.3. Terminology
603:
604: There has been a lot of talk about "ports", "packages", etc. so far. Here is a
605: description of all the terminology used within this document.
606:
607: Package
608:
609: A set of files and building instructions that describe what's necessary to
610: build a certain piece of software using pkgsrc. Packages are traditionally
1.123 wiz 611: stored under /usr/pkgsrc, but may be stored in any location, referred to as
612: PKGSRCDIR.
1.1 dsieger 613:
614: The NetBSD package system
615:
616: This is the former name of "pkgsrc". It is part of the NetBSD operating
617: system and can be bootstrapped to run on non-NetBSD operating systems as
618: well. It handles building (compiling), installing, and removing of
619: packages.
620:
621: Distfile
622:
623: This term describes the file or files that are provided by the author of
624: the piece of software to distribute his work. All the changes necessary to
625: build on NetBSD are reflected in the corresponding package. Usually the
626: distfile is in the form of a compressed tar-archive, but other types are
627: possible, too. Distfiles are usually stored below /usr/pkgsrc/distfiles.
628:
629: Port
630:
631: This is the term used by FreeBSD and OpenBSD people for what we call a
632: package. In NetBSD terminology, "port" refers to a different architecture.
633:
634: Precompiled/binary package
635:
636: A set of binaries built with pkgsrc from a distfile and stuffed together in
637: a single .tgz file so it can be installed on machines of the same machine
638: architecture without the need to recompile. Packages are usually generated
639: in /usr/pkgsrc/packages; there is also an archive on ftp.NetBSD.org.
640:
641: Sometimes, this is referred to by the term "package" too, especially in the
642: context of precompiled packages.
643:
644: Program
645:
646: The piece of software to be installed which will be constructed from all
647: the files in the distfile by the actions defined in the corresponding
648: package.
649:
650: 1.3.1. Roles involved in pkgsrc
651:
652: pkgsrc users
653:
654: The pkgsrc users are people who use the packages provided by pkgsrc.
655: Typically they are system administrators. The people using the software
656: that is inside the packages (maybe called "end users") are not covered by
657: the pkgsrc guide.
658:
659: There are two kinds of pkgsrc users: Some only want to install pre-built
660: binary packages. Others build the pkgsrc packages from source, either for
661: installing them directly or for building binary packages themselves. For
662: pkgsrc users Part I, "The pkgsrc user's guide" should provide all necessary
663: documentation.
664:
665: package maintainers
666:
667: A package maintainer creates packages as described in Part II, "The pkgsrc
668: developer's guide".
669:
670: infrastructure developers
671:
672: These people are involved in all those files that live in the mk/ directory
673: and below. Only these people should need to read through Part III, "The
674: pkgsrc infrastructure internals", though others might be curious, too.
675:
676: 1.4. Typography
677:
678: When giving examples for commands, shell prompts are used to show if the
679: command should/can be issued as root, or if "normal" user privileges are
1.115 sevan 680: sufficient. We use a # for root's shell prompt, a % for users' shell prompt,
681: assuming they use the C-shell or tcsh and a $ for bourne shell and derivatives.
1.1 dsieger 682:
683: Part I. The pkgsrc user's guide
684:
685: Table of Contents
686:
1.154 rillig 687: 2. Getting help
688: 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 689:
1.154 rillig 690: 3.1. Getting pkgsrc for the first time
1.1 dsieger 691:
1.154 rillig 692: 3.1.1. As tar archive
693: 3.1.2. Via anonymous CVS
1.1 dsieger 694:
1.154 rillig 695: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 696:
1.154 rillig 697: 3.2.1. Via tar files
698: 3.2.2. Via CVS
1.1 dsieger 699:
1.154 rillig 700: 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 701:
1.154 rillig 702: 4.1. Binary distribution
703: 4.2. Bootstrapping pkgsrc
1.1 dsieger 704:
1.154 rillig 705: 5. Using pkgsrc
1.1 dsieger 706:
1.154 rillig 707: 5.1. Using binary packages
1.1 dsieger 708:
1.154 rillig 709: 5.1.1. Finding binary packages
710: 5.1.2. Installing binary packages
711: 5.1.3. Deinstalling packages
712: 5.1.4. Getting information about installed packages
713: 5.1.5. Checking for security vulnerabilities in installed packages
714: 5.1.6. Finding if newer versions of your installed packages are in
1.1 dsieger 715: pkgsrc
1.154 rillig 716: 5.1.7. Other administrative functions
1.1 dsieger 717:
1.154 rillig 718: 5.2. Building packages from source
1.1 dsieger 719:
1.154 rillig 720: 5.2.1. Requirements
721: 5.2.2. Fetching distfiles
722: 5.2.3. How to build and install
1.1 dsieger 723:
1.154 rillig 724: 6. Configuring pkgsrc
1.1 dsieger 725:
1.154 rillig 726: 6.1. General configuration
727: 6.2. Variables affecting the build process
728: 6.3. Variables affecting the installation process
729: 6.4. Selecting and configuring the compiler
1.1 dsieger 730:
1.154 rillig 731: 6.4.1. Selecting the compiler
732: 6.4.2. Additional flags to the compiler (CFLAGS)
733: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 734:
1.154 rillig 735: 6.5. Developer/advanced settings
736: 6.6. Selecting Build Options
1.1 dsieger 737:
1.154 rillig 738: 7. Creating binary packages
1.1 dsieger 739:
1.154 rillig 740: 7.1. Building a single binary package
741: 7.2. Settings for creation of binary packages
1.1 dsieger 742:
1.154 rillig 743: 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 744:
1.154 rillig 745: 8.1. Preparations
746: 8.2. Running a pbulk-style bulk build
1.6 rillig 747:
1.154 rillig 748: 8.2.1. Configuration
1.6 rillig 749:
1.154 rillig 750: 8.3. Requirements of a full bulk build
751: 8.4. Creating a multiple CD-ROM packages collection
1.6 rillig 752:
1.154 rillig 753: 8.4.1. Example of cdpack
1.6 rillig 754:
1.154 rillig 755: 9. Directory layout of the installed files
1.6 rillig 756:
1.154 rillig 757: 9.1. File system layout in ${LOCALBASE}
758: 9.2. File system layout in ${VARBASE}
1.6 rillig 759:
1.154 rillig 760: 10. Frequently Asked Questions
1.6 rillig 761:
1.154 rillig 762: 10.1. Are there any mailing lists for pkg-related discussion?
763: 10.2. Utilities for package management (pkgtools)
764: 10.3. How to use pkgsrc as non-root
765: 10.4. How to resume transfers when fetching distfiles?
766: 10.5. How can I install/use modular X.org from pkgsrc?
767: 10.6. How to fetch files from behind a firewall
768: 10.7. How to fetch files from HTTPS sites
769: 10.8. How do I tell make fetch to do passive FTP?
770: 10.9. How to fetch all distfiles at once
771: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
772: 10.11. What does "Could not find bsd.own.mk" mean?
773: 10.12. Using 'sudo' with pkgsrc
774: 10.13. How do I change the location of configuration files?
775: 10.14. Automated security checks
776: 10.15. Why do some packages ignore my CFLAGS?
777: 10.16. A package does not build. What shall I do?
778: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.24 wiz 779: conflicts" mean?
1.1 dsieger 780:
1.154 rillig 781: Chapter 2. Getting help
782:
783: To get help when using pkgsrc, the definitive source is this document, the
784: pkgsrc guide. If you don't find anything here, there are alternatives:
785:
786: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
787: Run bmake help topic=? to get help for any topic, such as a variable name
788: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
789: like strcasecmp or any other topic.
790:
791: The available help topics are listed in Appendix D, Help topics.
792:
1.163 rillig 793: * To see the value of a single variable, run bmake show-var VARNAME=X.
794:
795: * To see the values of the most common variables, run bmake show-all. These
796: variables are grouped by topic. To see the variables for a single topic,
797: run bmake show-all-topic, for example bmake show-all-fetch.
798:
1.154 rillig 799: * The pkgsrc-users mailing list, to which you can subscribe and then ask your
800: questions.
801:
802: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
803: a specialized chat program such as XChat. Pick any user name and join the
804: channel #pkgsrc.
805:
806: Chapter 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 807:
808: Table of Contents
809:
1.154 rillig 810: 3.1. Getting pkgsrc for the first time
1.1 dsieger 811:
1.154 rillig 812: 3.1.1. As tar archive
813: 3.1.2. Via anonymous CVS
1.1 dsieger 814:
1.154 rillig 815: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 816:
1.154 rillig 817: 3.2.1. Via tar files
818: 3.2.2. Via CVS
1.1 dsieger 819:
820: Before you download and extract the files, you need to decide where you want to
821: extract them. When using pkgsrc as root user, pkgsrc is usually installed in /
822: usr/pkgsrc. You are though free to install the sources and binary packages
823: wherever you want in your filesystem, provided that the pathname does not
824: contain white-space or other characters that are interpreted specially by the
825: shell and some other programs. A safe bet is to use only letters, digits,
826: underscores and dashes.
827:
1.154 rillig 828: 3.1. Getting pkgsrc for the first time
1.1 dsieger 829:
1.25 wiz 830: Before you download any pkgsrc files, you should decide whether you want the
1.1 dsieger 831: current branch or the stable branch. The latter is forked on a quarterly basis
832: from the current branch and only gets modified for security updates. The names
833: of the stable branches are built from the year and the quarter, for example
1.174 leot 834: 2020Q1.
1.1 dsieger 835:
836: The second step is to decide how you want to download pkgsrc. You can get it as
1.24 wiz 837: a tar file or via CVS. Both ways are described here.
1.1 dsieger 838:
1.52 asau 839: Note that tar archive contains CVS working copy. Thus you can switch to using
840: CVS at any later time.
1.1 dsieger 841:
1.154 rillig 842: 3.1.1. As tar archive
1.52 asau 843:
1.151 sevan 844: The primary download location for all pkgsrc files is https://cdn.NetBSD.org/
845: pub/pkgsrc/ or ftp://ftp.NetBSD.org/pub/pkgsrc/ (it points to the same
846: location). There are a number of subdirectories for different purposes, which
847: are described in detail in Appendix C, Directory layout of the pkgsrc FTP
848: server.
1.1 dsieger 849:
1.52 asau 850: The tar archive for the current branch is in the directory current and is
1.118 sevan 851: called pkgsrc.tar.gz. It is autogenerated weekly.
1.52 asau 852:
853: To save download time we provide bzip2- and xz-compressed archives which are
854: published at pkgsrc.tar.bz2 and pkgsrc.tar.xz respectively.
855:
856: You can fetch the same files using FTP.
1.1 dsieger 857:
1.174 leot 858: The tar file for the stable branch 2020Q1 is in the directory pkgsrc-2020Q1 and
1.59 jnemeth 859: is also called pkgsrc.tar.gz.
1.1 dsieger 860:
1.136 leot 861: To download the latest pkgsrc stable tarball, run:
1.12 weinem 862:
1.174 leot 863: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2020Q1/pkgsrc.tar.gz
1.12 weinem 864:
1.78 snj 865: If you prefer, you can also fetch it using "wget", "curl", or your web browser.
1.52 asau 866:
1.12 weinem 867: Then, extract it with:
868:
1.78 snj 869: $ tar -xzf pkgsrc.tar.gz -C /usr
1.12 weinem 870:
871: This will create the directory pkgsrc/ in /usr/ and all the package source will
872: be stored under /usr/pkgsrc/.
873:
874: To download pkgsrc-current, run:
875:
876: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz
1.1 dsieger 877:
1.154 rillig 878: 3.1.2. Via anonymous CVS
1.1 dsieger 879:
1.24 wiz 880: To fetch a specific pkgsrc stable branch, run:
1.1 dsieger 881:
1.174 leot 882: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2020Q1 -P pkgsrc
1.13 weinem 883:
1.24 wiz 884: This will create the directory pkgsrc/ in your /usr/ directory and all the
885: package source will be stored under /usr/pkgsrc/.
886:
887: To fetch the pkgsrc current branch, run:
1.1 dsieger 888:
1.40 wiz 889: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 890:
1.30 dholland 891: Refer to the list of available mirrors to choose a faster CVS mirror, if
892: needed.
1.1 dsieger 893:
1.24 wiz 894: If you get error messages from rsh, you need to set CVS_RSH variable. E.g.:
1.1 dsieger 895:
1.40 wiz 896: $ cd /usr && env CVS_RSH=ssh cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 897:
1.24 wiz 898: Refer to documentation on your command shell how to set CVS_RSH=ssh
899: permanently. For Bourne shells, you can set it in your .profile or better
900: globally in /etc/profile:
901:
902: # set CVS remote shell command
903: CVS_RSH=ssh
904: export CVS_RSH
1.12 weinem 905:
1.13 weinem 906: By default, CVS doesn't do things like most people would expect it to do. But
907: there is a way to convince CVS, by creating a file called .cvsrc in your home
1.12 weinem 908: directory and saving the following lines to it. This file will save you lots of
909: headache and some bug reports, so we strongly recommend it. You can find an
910: explanation of this file in the CVS documentation.
1.2 rillig 911:
912: # recommended CVS configuration file from the pkgsrc guide
1.155 sevan 913: cvs -q
1.2 rillig 914: checkout -P
1.4 rillig 915: update -dP
916: diff -upN
1.2 rillig 917: rdiff -u
1.24 wiz 918: release -d
1.1 dsieger 919:
1.154 rillig 920: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 921:
922: The preferred way to keep pkgsrc up-to-date is via CVS (which also works if you
923: have first installed it via a tar file). It saves bandwidth and hard disk
924: activity, compared to downloading the tar file again.
925:
1.154 rillig 926: 3.2.1. Via tar files
1.1 dsieger 927:
928: Warning
929:
930: When updating from a tar file, you first need to completely remove the old
931: pkgsrc directory. Otherwise those files that have been removed from pkgsrc in
932: the mean time will not be removed on your local disk, resulting in
933: inconsistencies. When removing the old files, any changes that you have done to
934: the pkgsrc files will be lost after updating. Therefore updating via CVS is
935: strongly recommended.
936:
937: Note that by default the distfiles and the binary packages are saved in the
938: pkgsrc tree, so don't forget to rescue them before updating. You can also
1.78 snj 939: configure pkgsrc to store distfiles and packages in directories outside the
1.154 rillig 940: pkgsrc tree by setting the DISTDIR and PACKAGES variables. See Chapter 6,
1.78 snj 941: Configuring pkgsrc for the details.
1.1 dsieger 942:
943: To update pkgsrc from a tar file, download the tar file as explained above.
944: Then, make sure that you have not made any changes to the files in the pkgsrc
945: directory. Remove the pkgsrc directory and extract the new tar file. Done.
946:
1.154 rillig 947: 3.2.2. Via CVS
1.1 dsieger 948:
1.26 spz 949: To update pkgsrc via CVS, change to the pkgsrc directory and run cvs:
1.12 weinem 950:
1.26 spz 951: $ cd /usr/pkgsrc && cvs update -dP
952:
953: If you get error messages from rsh, you need to set CVS_RSH variable as
954: described above. E.g.:
955:
956: $ cd /usr/pkgsrc && env CVS_RSH=ssh cvs up -dP
1.1 dsieger 957:
1.154 rillig 958: 3.2.2.1. Switching between different pkgsrc branches
1.1 dsieger 959:
960: When updating pkgsrc, the CVS program keeps track of the branch you selected.
961: But if you, for whatever reason, want to switch from the stable branch to the
962: current one, you can do it by adding the option "-A" after the "update"
1.25 wiz 963: keyword. To switch from the current branch back to the stable branch, add the "
1.174 leot 964: -rpkgsrc-2020Q1" option.
1.1 dsieger 965:
1.154 rillig 966: 3.2.2.2. What happens to my changes when updating?
1.1 dsieger 967:
968: When you update pkgsrc, the CVS program will only touch those files that are
969: registered in the CVS repository. That means that any packages that you created
970: on your own will stay unmodified. If you change files that are managed by CVS,
971: later updates will try to merge your changes with those that have been done by
972: others. See the CVS manual, chapter "update" for details.
973:
1.154 rillig 974: Chapter 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 975:
976: Table of Contents
977:
1.154 rillig 978: 4.1. Binary distribution
979: 4.2. Bootstrapping pkgsrc
1.1 dsieger 980:
1.154 rillig 981: 4.1. Binary distribution
1.1 dsieger 982:
1.154 rillig 983: See Section 5.1, "Using binary packages".
1.1 dsieger 984:
1.154 rillig 985: 4.2. Bootstrapping pkgsrc
1.1 dsieger 986:
1.44 asau 987: pkgsrc can be bootstrapped for use in two different modes: privileged and
988: unprivileged one. In unprivileged mode in contrast to privileged one all
1.45 asau 989: programs are installed under one particular user and cannot utilise privileged
1.44 asau 990: operations (packages don't create special users and all special file
991: permissions like setuid are ignored).
992:
1.1 dsieger 993: Installing the bootstrap kit from source should be as simple as:
994:
1.60 asau 995: # env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 996: # cd pkgsrc/bootstrap
997: # ./bootstrap
998:
999:
1.44 asau 1000: To bootstrap in unprivileged mode pass "--unprivileged" flag to bootstrap
1001:
1002: By default, in privileged mode pkgsrc uses /usr/pkg for prefix where programs
1.118 sevan 1003: will be installed in, and /usr/pkg/pkgdb for the package database directory
1004: where pkgsrc will do its internal bookkeeping, /var is used as varbase, where
1.44 asau 1005: packages install their persistent data. In unprivileged mode pkgsrc uses ~/pkg
1.118 sevan 1006: for prefix, ~/pkg/pkgdb for the package database, and ~/pkg/var for varbase.
1.44 asau 1007:
1008: You can change default layout using command-line arguments. Run "./bootstrap
1009: --help" to get details.
1.1 dsieger 1010:
1011: Note
1012:
1013: The bootstrap installs a bmake tool. Use this bmake when building via pkgsrc.
1014: For examples in this guide, use bmake instead of "make".
1015:
1.44 asau 1016: Note
1017:
1018: It is possible to bootstrap multiple instances of pkgsrc using non-intersecting
1019: directories. Use bmake corresponding to the installation you're working with to
1020: build and install packages.
1021:
1.154 rillig 1022: Chapter 5. Using pkgsrc
1.1 dsieger 1023:
1024: Table of Contents
1025:
1.154 rillig 1026: 5.1. Using binary packages
1.1 dsieger 1027:
1.154 rillig 1028: 5.1.1. Finding binary packages
1029: 5.1.2. Installing binary packages
1030: 5.1.3. Deinstalling packages
1031: 5.1.4. Getting information about installed packages
1032: 5.1.5. Checking for security vulnerabilities in installed packages
1033: 5.1.6. Finding if newer versions of your installed packages are in pkgsrc
1034: 5.1.7. Other administrative functions
1035:
1036: 5.2. Building packages from source
1037:
1038: 5.2.1. Requirements
1039: 5.2.2. Fetching distfiles
1040: 5.2.3. How to build and install
1.1 dsieger 1041:
1042: Basically, there are two ways of using pkgsrc. The first is to only install the
1043: package tools and to use binary packages that someone else has prepared. This
1044: is the "pkg" in pkgsrc. The second way is to install the "src" of pkgsrc, too.
1045: Then you are able to build your own packages, and you can still use binary
1046: packages from someone else.
1047:
1.154 rillig 1048: 5.1. Using binary packages
1.1 dsieger 1049:
1.151 sevan 1050: On the cdn.NetBSD.org site and mirrors, there are collections of binary
1.9 rillig 1051: packages, ready to be installed. These binary packages have been built using
1052: the default settings for the directories, that is:
1053:
1054: * /usr/pkg for LOCALBASE, where most of the files are installed,
1055:
1056: * /usr/pkg/etc for configuration files,
1057:
1058: * /var for VARBASE, where those files are installed that may change after
1059: installation.
1060:
1061: If you cannot use these directories for whatever reasons (maybe because you're
1062: not root), you cannot use these binary packages, but have to build the packages
1.154 rillig 1063: yourself, which is explained in Section 4.2, "Bootstrapping pkgsrc".
1.1 dsieger 1064:
1.154 rillig 1065: 5.1.1. Finding binary packages
1.1 dsieger 1066:
1.5 weinem 1067: To install binary packages, you first need to know from where to get them. The
1068: first place where you should look is on the main pkgsrc FTP server in the
1069: directory /pub/pkgsrc/packages.
1070:
1071: This directory contains binary packages for multiple platforms. First, select
1072: your operating system. (Ignore the directories with version numbers attached to
1073: it, they just exist for legacy reasons.) Then, select your hardware
1074: architecture, and in the third step, the OS version and the "version" of
1.9 rillig 1075: pkgsrc.
1076:
1077: In this directory, you often find a file called bootstrap.tar.gz which contains
1078: the package management tools. If the file is missing, it is likely that your
1079: operating system already provides those tools. Download the file and extract it
1080: in the / directory. It will create the directories /usr/pkg (containing the
1.118 sevan 1081: tools for managing binary packages and the database of installed packages).
1.1 dsieger 1082:
1.154 rillig 1083: 5.1.2. Installing binary packages
1.1 dsieger 1084:
1.85 wiz 1085: In the directory from the last section, there is a subdirectory called All/,
1.9 rillig 1086: which contains all the binary packages that are available for the platform,
1087: excluding those that may not be distributed via FTP or CDROM (depending on
1.24 wiz 1088: which medium you are using).
1.9 rillig 1089:
1090: To install packages directly from an FTP or HTTP server, run the following
1091: commands in a Bourne-compatible shell (be sure to su to root first):
1092:
1093: # PATH="/usr/pkg/sbin:$PATH"
1.174 leot 1094: # PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages"
1.169 rillig 1095: # PKG_PATH="$PKG_PATH/OPSYS/ARCH/VERSIONS/All/"
1.9 rillig 1096: # export PATH PKG_PATH
1097:
1098: Instead of URLs, you can also use local paths, for example if you are
1099: installing from a set of CDROMs, DVDs or an NFS-mounted repository. If you want
1100: to install packages from multiple sources, you can separate them by a semicolon
1101: in PKG_PATH.
1102:
1103: After these preparations, installing a package is very easy:
1104:
1.118 sevan 1105: # pkg_add libreoffice
1106: # pkg_add ap24-php71-*
1.1 dsieger 1107:
1108: Note that any prerequisite packages needed to run the package in question will
1109: be installed, too, assuming they are present where you install from.
1110:
1.25 wiz 1111: Adding packages might install vulnerable packages. Thus you should run
1.24 wiz 1112: pkg_admin audit regularly, especially after installing new packages, and verify
1113: that the vulnerabilities are acceptable for your configuration.
1.1 dsieger 1114:
1115: After you've installed packages, be sure to have /usr/pkg/bin and /usr/pkg/sbin
1116: in your PATH so you can actually start the just installed program.
1117:
1.154 rillig 1118: 5.1.3. Deinstalling packages
1.1 dsieger 1119:
1120: To deinstall a package, it does not matter whether it was installed from source
1121: code or from a binary package. The pkg_delete command does not know it anyway.
1122: To delete a package, you can just run pkg_delete package-name. The package name
1123: can be given with or without version number. Wildcards can also be used to
1124: deinstall a set of packages, for example *emacs*. Be sure to include them in
1125: quotes, so that the shell does not expand them before pkg_delete sees them.
1126:
1127: The -r option is very powerful: it removes all the packages that require the
1128: package in question and then removes the package itself. For example:
1129:
1130: # pkg_delete -r jpeg
1131:
1132:
1133: will remove jpeg and all the packages that used it; this allows upgrading the
1134: jpeg package.
1135:
1.154 rillig 1136: 5.1.4. Getting information about installed packages
1.1 dsieger 1137:
1138: The pkg_info shows information about installed packages or binary package
1139: files.
1140:
1.154 rillig 1141: 5.1.5. Checking for security vulnerabilities in installed packages
1.1 dsieger 1142:
1.164 leot 1143: The pkgsrc Security Team and Packages Groups maintain a list of known security
1144: vulnerabilities to packages which are (or have been) included in pkgsrc. The
1.174 leot 1145: list is available from the NetBSD FTP site at https://ftp.NetBSD.org/pub/NetBSD
1146: /packages/vulns/pkg-vulnerabilities.
1.1 dsieger 1147:
1.23 jakllsch 1148: Through pkg_admin fetch-pkg-vulnerabilities, this list can be downloaded
1149: automatically, and a security audit of all packages installed on a system can
1150: take place.
1151:
1152: There are two components to auditing. The first step, pkg_admin
1153: fetch-pkg-vulnerabilities, is for downloading the list of vulnerabilities from
1154: the NetBSD FTP site. The second step, pkg_admin audit, checks to see if any of
1155: your installed packages are vulnerable. If a package is vulnerable, you will
1156: see output similar to the following:
1.1 dsieger 1157:
1158: Package samba-2.0.9 has a local-root-shell vulnerability, see
1.174 leot 1159: https://www.samba.org/samba/whatsnew/macroexploit.html
1.1 dsieger 1160:
1.23 jakllsch 1161: You may wish to have the vulnerabilities file downloaded daily so that it
1162: remains current. This may be done by adding an appropriate entry to the root
1163: users crontab(5) entry. For example the entry
1164:
1.121 sevan 1165: # Download vulnerabilities file
1.118 sevan 1166: 0 3 * * * /usr/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities >/dev/null 2>&1
1.121 sevan 1167: # Audit the installed packages and email results to root
1168: 9 3 * * * /usr/pkg/sbin/pkg_admin audit |mail -s "Installed package audit result" \
1169: root >/dev/null 2>&1
1.118 sevan 1170:
1171:
1172: will update the vulnerability list every day at 3AM, followed by an audit at
1173: 3:09AM. The result of the audit are then emailed to root. On NetBSD this may be
1174: accomplished instead by adding the following line to /etc/daily.conf:
1175:
1176: fetch_pkg_vulnerabilities=YES
1177:
1.23 jakllsch 1178:
1.118 sevan 1179: to fetch the vulnerability list from the daily security script. The system is
1180: set to audit the packages by default but can be set explicitly, if desired (not
1.123 wiz 1181: required), by adding the following line to /etc/security.conf:
1.23 jakllsch 1182:
1.118 sevan 1183: check_pkg_vulnerabilities=YES
1.23 jakllsch 1184:
1185:
1.118 sevan 1186: see daily.conf(5) and security.conf(5) for more details.
1.1 dsieger 1187:
1.154 rillig 1188: 5.1.6. Finding if newer versions of your installed packages are in pkgsrc
1.1 dsieger 1189:
1.12 weinem 1190: Install pkgtools/lintpkgsrc and run lintpkgsrc with the "-i" argument to check
1191: if your packages are up-to-date, e.g.
1.1 dsieger 1192:
1193: % lintpkgsrc -i
1194: ...
1195: Version mismatch: 'tcsh' 6.09.00 vs 6.10.00
1196:
1197:
1198: You can then use make update to update the package on your system and rebuild
1199: any dependencies.
1200:
1.154 rillig 1201: 5.1.7. Other administrative functions
1.1 dsieger 1202:
1203: The pkg_admin executes various administrative functions on the package system.
1204:
1.154 rillig 1205: 5.2. Building packages from source
1.1 dsieger 1206:
1207: After obtaining pkgsrc, the pkgsrc directory now contains a set of packages,
1.25 wiz 1208: organized into categories. You can browse the online index of packages, or run
1.1 dsieger 1209: make readme from the pkgsrc directory to build local README.html files for all
1210: packages, viewable with any web browser such as www/lynx or www/firefox.
1211:
1212: The default prefix for installed packages is /usr/pkg. If you wish to change
1213: this, you should do so by setting LOCALBASE in mk.conf. You should not try to
1214: use multiple different LOCALBASE definitions on the same system (inside a
1215: chroot is an exception).
1216:
1217: The rest of this chapter assumes that the package is already in pkgsrc. If it
1218: is not, see Part II, "The pkgsrc developer's guide" for instructions how to
1219: create your own packages.
1220:
1.154 rillig 1221: 5.2.1. Requirements
1.1 dsieger 1222:
1223: To build packages from source, you need a working C compiler. On NetBSD, you
1224: need to install the "comp" and the "text" distribution sets. If you want to
1225: build X11-related packages, the "xbase" and "xcomp" distribution sets are
1226: required, too.
1227:
1.154 rillig 1228: 5.2.2. Fetching distfiles
1.1 dsieger 1229:
1230: The first step for building a package is downloading the distfiles (i.e. the
1231: unmodified source). If they have not yet been downloaded, pkgsrc will fetch
1232: them automatically.
1233:
1234: If you have all files that you need in the distfiles directory, you don't need
1235: to connect. If the distfiles are on CD-ROM, you can mount the CD-ROM on /cdrom
1236: and add:
1237:
1238: DISTDIR=/cdrom/pkgsrc/distfiles
1239:
1240: to your mk.conf.
1241:
1242: By default a list of distribution sites will be randomly intermixed to prevent
1243: huge load on servers which holding popular packages (for example,
1244: SourceForge.net mirrors). Thus, every time when you need to fetch yet another
1245: distfile all the mirrors will be tried in new (random) order. You can turn this
1246: feature off by setting MASTER_SORT_RANDOM=NO (for PKG_DEVELOPERs it's already
1247: disabled).
1248:
1249: You can overwrite some of the major distribution sites to fit to sites that are
1250: close to your own. By setting one or two variables you can modify the order in
1251: which the master sites are accessed. MASTER_SORT contains a whitespace
1252: delimited list of domain suffixes. MASTER_SORT_REGEX is even more flexible, it
1253: contains a whitespace delimited list of regular expressions. It has higher
1254: priority than MASTER_SORT. Have a look at pkgsrc/mk/defaults/mk.conf to find
1255: some examples. This may save some of your bandwidth and time.
1256:
1257: You can change these settings either in your shell's environment, or, if you
1.4 rillig 1258: want to keep the settings, by editing the mk.conf file, and adding the
1.1 dsieger 1259: definitions there.
1260:
1.132 wiz 1261: If a package depends on many other packages (such as meta-pkgs/kde4), the build
1.1 dsieger 1262: process may alternate between periods of downloading source, and compiling. To
1263: ensure you have all the source downloaded initially you can run the command:
1264:
1265: % make fetch-list | sh
1266:
1267: which will output and run a set of shell commands to fetch the necessary files
1268: into the distfiles directory. You can also choose to download the files
1269: manually.
1270:
1.154 rillig 1271: 5.2.3. How to build and install
1.1 dsieger 1272:
1273: Once the software has downloaded, any patches will be applied, then it will be
1274: compiled for you. This may take some time depending on your computer, and how
1275: many other packages the software depends on and their compile time.
1276:
1277: Note
1278:
1279: If using bootstrap or pkgsrc on a non-NetBSD system, use the pkgsrc bmake
1280: command instead of "make" in the examples in this guide.
1281:
1282: For example, type
1283:
1284: % cd misc/figlet
1285: % make
1286:
1287:
1288: at the shell prompt to build the various components of the package.
1289:
1290: The next stage is to actually install the newly compiled program onto your
1291: system. Do this by entering:
1292:
1293: % make install
1294:
1295:
1296: while you are still in the directory for whatever package you are installing.
1297:
1298: Installing the package on your system may require you to be root. However,
1299: pkgsrc has a just-in-time-su feature, which allows you to only become root for
1300: the actual installation step.
1301:
1302: That's it, the software should now be installed and setup for use. You can now
1303: enter:
1304:
1305: % make clean
1306:
1307:
1308: to remove the compiled files in the work directory, as you shouldn't need them
1309: any more. If other packages were also added to your system (dependencies) to
1310: allow your program to compile, you can tidy these up also with the command:
1311:
1312: % make clean-depends
1313:
1314:
1315: Taking the figlet utility as an example, we can install it on our system by
1316: building as shown in Appendix B, Build logs.
1317:
1318: The program is installed under the default root of the packages tree - /usr/
1319: pkg. Should this not conform to your tastes, set the LOCALBASE variable in your
1320: environment, and it will use that value as the root of your packages tree. So,
1321: to use /usr/local, set LOCALBASE=/usr/local in your environment. Please note
1322: that you should use a directory which is dedicated to packages and not shared
1323: with other programs (i.e., do not try and use LOCALBASE=/usr). Also, you should
1324: not try to add any of your own files or directories (such as src/, obj/, or
1325: pkgsrc/) below the LOCALBASE tree. This is to prevent possible conflicts
1326: between programs and other files installed by the package system and whatever
1327: else may have been installed there.
1328:
1.4 rillig 1329: Some packages look in mk.conf to alter some configuration options at build
1.1 dsieger 1330: time. Have a look at pkgsrc/mk/defaults/mk.conf to get an overview of what will
1331: be set there by default. Environment variables such as LOCALBASE can be set in
1.4 rillig 1332: mk.conf to save having to remember to set them each time you want to use
1.1 dsieger 1333: pkgsrc.
1334:
1335: Occasionally, people want to "look under the covers" to see what is going on
1336: when a package is building or being installed. This may be for debugging
1337: purposes, or out of simple curiosity. A number of utility values have been
1338: added to help with this.
1339:
1340: 1. If you invoke the make(1) command with PKG_DEBUG_LEVEL=2, then a huge
1341: amount of information will be displayed. For example,
1342:
1343: make patch PKG_DEBUG_LEVEL=2
1344:
1.25 wiz 1345: will show all the commands that are invoked, up to and including the "patch
1346: " stage.
1.1 dsieger 1347:
1348: 2. If you want to know the value of a certain make(1) definition, then the
1349: VARNAME definition should be used, in conjunction with the show-var target.
1350: e.g. to show the expansion of the make(1) variable LOCALBASE:
1351:
1352: % make show-var VARNAME=LOCALBASE
1353: /usr/pkg
1354: %
1355:
1356:
1357: If you want to install a binary package that you've either created yourself
1358: (see next section), that you put into pkgsrc/packages manually or that is
1359: located on a remote FTP server, you can use the "bin-install" target. This
1360: target will install a binary package - if available - via pkg_add(1), else do a
1361: make package. The list of remote FTP sites searched is kept in the variable
1362: BINPKG_SITES, which defaults to ftp.NetBSD.org. Any flags that should be added
1363: to pkg_add(1) can be put into BIN_INSTALL_FLAGS. See pkgsrc/mk/defaults/mk.conf
1364: for more details.
1365:
1366: A final word of warning: If you set up a system that has a non-standard setting
1367: for LOCALBASE, be sure to set that before any packages are installed, as you
1368: cannot use several directories for the same purpose. Doing so will result in
1369: pkgsrc not being able to properly detect your installed packages, and fail
1370: miserably. Note also that precompiled binary packages are usually built with
1371: the default LOCALBASE of /usr/pkg, and that you should not install any if you
1372: use a non-standard LOCALBASE.
1373:
1.154 rillig 1374: Chapter 6. Configuring pkgsrc
1.1 dsieger 1375:
1376: Table of Contents
1377:
1.154 rillig 1378: 6.1. General configuration
1379: 6.2. Variables affecting the build process
1380: 6.3. Variables affecting the installation process
1381: 6.4. Selecting and configuring the compiler
1382:
1383: 6.4.1. Selecting the compiler
1384: 6.4.2. Additional flags to the compiler (CFLAGS)
1385: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 1386:
1.154 rillig 1387: 6.5. Developer/advanced settings
1388: 6.6. Selecting Build Options
1.1 dsieger 1389:
1390: The whole pkgsrc system is configured in a single file, usually called mk.conf.
1391: In which directory pkgsrc looks for that file depends on the installation. On
1392: NetBSD, when you use make(1) from the base system, it is in the directory /etc
1393: /. In all other cases the default location is ${PREFIX}/etc/, depending on
1394: where you told the bootstrap program to install the binary packages.
1395:
1396: The format of the configuration file is that of the usual BSD-style Makefiles.
1397: The whole pkgsrc configuration is done by setting variables in this file. Note
1398: that you can define all kinds of variables, and no special error checking (for
1.112 rillig 1399: example for spelling mistakes) takes place.
1.1 dsieger 1400:
1.154 rillig 1401: 6.1. General configuration
1.1 dsieger 1402:
1.112 rillig 1403: The following variables apply to all pkgsrc packages. A complete list of the
1404: variables that can be configured by the user is available in mk/defaults/
1405: mk.conf, together with some comments that describe each variable's intent.
1.1 dsieger 1406:
1407: * LOCALBASE: Where packages will be installed. The default is /usr/pkg. Do
1408: not mix binary packages with different LOCALBASEs!
1409:
1410: * CROSSBASE: Where "cross" category packages will be installed. The default
1411: is ${LOCALBASE}/cross.
1412:
1.84 wiz 1413: * X11BASE: Where X11 is installed on the system. The default is /usr/X11R7.
1.1 dsieger 1414:
1415: * DISTDIR: Where to store the downloaded copies of the original source
1416: distributions used for building pkgsrc packages. The default is $
1417: {PKGSRCDIR}/distfiles.
1418:
1419: * PKG_DBDIR: Where the database about installed packages is stored. The
1.118 sevan 1420: default is /usr/pkg/pkgdb.
1.1 dsieger 1421:
1422: * MASTER_SITE_OVERRIDE: If set, override the packages' MASTER_SITES with this
1423: value.
1424:
1425: * MASTER_SITE_BACKUP: Backup location(s) for distribution files and patch
1426: files if not found locally or in ${MASTER_SITES} or ${PATCH_SITES}
1.118 sevan 1427: respectively. The defaults is ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/$
1.1 dsieger 1428: {DIST_SUBDIR}/.
1429:
1430: * BINPKG_SITES: List of sites carrying binary pkgs. rel and arch are replaced
1431: with OS release ("2.0", etc.) and architecture ("mipsel", etc.).
1432:
1.23 jakllsch 1433: * ACCEPTABLE_LICENSES: List of acceptable licenses. License names are
1434: case-sensitive. Whenever you try to build a package whose license is not in
1435: this list, you will get an error message. If the license condition is
1436: simple enough, the error message will include specific instructions on how
1437: to change this variable.
1.1 dsieger 1438:
1.154 rillig 1439: 6.2. Variables affecting the build process
1.1 dsieger 1440:
1441: * PACKAGES: The top level directory for the binary packages. The default is $
1442: {PKGSRCDIR}/packages.
1443:
1444: * WRKOBJDIR: The top level directory where, if defined, the separate working
1445: directories will get created, and symbolically linked to from ${WRKDIR}
1446: (see below). This is useful for building packages on several architectures,
1447: then ${PKGSRCDIR} can be NFS-mounted while ${WRKOBJDIR} is local to every
1448: architecture. (It should be noted that PKGSRCDIR should not be set by the
1449: user ? it is an internal definition which refers to the root of the pkgsrc
1450: tree. It is possible to have many pkgsrc tree instances.)
1451:
1452: * LOCALPATCHES: Directory for local patches that aren't part of pkgsrc. See
1.154 rillig 1453: Section 13.3, "patches/*" for more information.
1.1 dsieger 1454:
1455: * PKGMAKECONF: Location of the mk.conf file used by a package's BSD-style
1456: Makefile. If this is not set, MAKECONF is set to /dev/null to avoid picking
1457: up settings used by builds in /usr/src.
1458:
1.154 rillig 1459: 6.3. Variables affecting the installation process
1.1 dsieger 1460:
1.143 maya 1461: * PKGSRC_KEEP_BIN_PKGSRC: By default, binary packages of built packages are
1.150 leot 1462: preserved in ${PACKAGES}/All. Setting this variable to "no" prevents this.
1.1 dsieger 1463:
1.107 jnemeth 1464: Packages have to support installation into a subdirectory of WRKDIR. This
1465: allows a package to be built, before the actual filesystem is touched. DESTDIR
1466: support exists in two variations:
1.4 rillig 1467:
1468: * Basic DESTDIR support means that the package installation and packaging is
1469: still run as root.
1470:
1471: * Full DESTDIR support can run the complete build, installation and packaging
1472: as normal user. Root privileges are only needed to add packages.
1473:
1474: With basic DESTDIR support, make clean needs to be run as root.
1475:
1.17 imil 1476: Considering the foo/bar package, DESTDIR full support can be tested using the
1477: following commands
1478:
1479: $ id
1480: uid=1000(myusername) gid=100(users) groups=100(users),0(wheel)
1481: $ mkdir $HOME/packages
1482: $ cd $PKGSRCDIR/foo/bar
1483:
1484: Verify DESTDIR full support, no root privileges should be needed
1485:
1.66 asau 1486: $ make stage-install
1.17 imil 1487:
1488: Create a package without root privileges
1489:
1.66 asau 1490: $ make PACKAGES=$HOME/packages package
1.17 imil 1491:
1492: For the following command, you must be able to gain root privileges using su(1)
1493:
1.66 asau 1494: $ make PACKAGES=$HOME/packages install
1.17 imil 1495:
1496: Then, as a simple user
1497:
1498: $ make clean
1499:
1.154 rillig 1500: 6.4. Selecting and configuring the compiler
1.4 rillig 1501:
1.154 rillig 1502: 6.4.1. Selecting the compiler
1.1 dsieger 1503:
1504: By default, pkgsrc will use GCC to build packages. This may be overridden by
1505: setting the following variables in /etc/mk.conf:
1506:
1507: PKGSRC_COMPILER:
1508:
1509: This is a list of values specifying the chain of compilers to invoke when
1510: building packages. Valid values are:
1511:
1.66 asau 1512: + ccc: Compaq C Compilers (Tru64)
1513:
1514: + ccache: compiler cache (chainable)
1515:
1516: + clang: Clang C and Objective-C compiler
1517:
1.42 asau 1518: + distcc: distributed C/C++ (chainable)
1.1 dsieger 1519:
1.66 asau 1520: + f2c: Fortran 77 to C compiler (chainable)
1521:
1522: + icc: Intel C++ Compiler (Linux)
1523:
1524: + ido: SGI IRIS Development Option cc (IRIX 5)
1.1 dsieger 1525:
1.42 asau 1526: + gcc: GNU C/C++ Compiler
1.1 dsieger 1527:
1.66 asau 1528: + hp: HP-UX C/aC++ compilers
1529:
1.42 asau 1530: + mipspro: Silicon Graphics, Inc. MIPSpro (n32/n64)
1.1 dsieger 1531:
1.66 asau 1532: + mipspro-ucode: Silicon Graphics, Inc. MIPSpro (o32)
1.1 dsieger 1533:
1.42 asau 1534: + sunpro: Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio
1.1 dsieger 1535:
1.118 sevan 1536: + xlc: IBM's XL C/C++ compiler suite
1.66 asau 1537:
1.1 dsieger 1538: The default is "gcc". You can use ccache and/or distcc with an appropriate
1539: PKGSRC_COMPILER setting, e.g. "ccache gcc". This variable should always be
1540: terminated with a value for a real compiler. Note that only one real
1541: compiler should be listed (e.g. "sunpro gcc" is not allowed).
1542:
1543: GCC_REQD:
1544:
1545: This specifies the minimum version of GCC to use when building packages. If
1546: the system GCC doesn't satisfy this requirement, then pkgsrc will build and
1547: install one of the GCC packages to use instead.
1548:
1.153 leot 1549: PYTHON_VERSION_DEFAULT:
1.114 maya 1550:
1551: Specifies which version of python to use when several options are
1552: available.
1553:
1554: PKGSRC_FORTRAN:
1555:
1.176 ! gutterid 1556: Specifies the Fortran compiler to use. The default is gfortran.
1.114 maya 1557:
1558: GFORTRAN_VERSION:
1559:
1560: If PKGSRC_FORTRAN= gfortran is used, this option specifies which version to
1561: use.
1562:
1.154 rillig 1563: 6.4.2. Additional flags to the compiler (CFLAGS)
1.1 dsieger 1564:
1565: If you wish to set the CFLAGS variable, please make sure to use the += operator
1566: instead of the = operator:
1567:
1568: CFLAGS+= -your -flags
1569:
1570: Using CFLAGS= (i.e. without the "+") may lead to problems with packages that
1.16 jnemeth 1571: need to add their own flags. You may want to take a look at the devel/cpuflags
1.24 wiz 1572: package if you're interested in optimization specifically for the current CPU.
1.1 dsieger 1573:
1.154 rillig 1574: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 1575:
1576: If you want to pass flags to the linker, both in the configure step and the
1577: build step, you can do this in two ways. Either set LDFLAGS or LIBS. The
1578: difference between the two is that LIBS will be appended to the command line,
1579: while LDFLAGS come earlier. LDFLAGS is pre-loaded with rpath settings for ELF
1580: machines depending on the setting of USE_IMAKE or the inclusion of mk/
1581: x11.buildlink3.mk. As with CFLAGS, if you do not wish to override these
1582: settings, use the += operator:
1583:
1584: LDFLAGS+= -your -linkerflags
1585:
1.154 rillig 1586: 6.5. Developer/advanced settings
1.1 dsieger 1587:
1588: * PKG_DEVELOPER: Run some sanity checks that package developers want:
1589:
1.42 asau 1590: + make sure patches apply with zero fuzz
1.1 dsieger 1591:
1.42 asau 1592: + run check-shlibs to see that all binaries will find their shared libs.
1.1 dsieger 1593:
1594: * PKG_DEBUG_LEVEL: The level of debugging output which is displayed whilst
1595: making and installing the package. The default value for this is 0, which
1596: will not display the commands as they are executed (normal, default, quiet
1597: operation); the value 1 will display all shell commands before their
1598: invocation, and the value 2 will display both the shell commands before
1.112 rillig 1599: their invocation, as well as their actual execution progress with set -x.
1.1 dsieger 1600:
1.154 rillig 1601: 6.6. Selecting Build Options
1.1 dsieger 1602:
1603: Some packages have build time options, usually to select between different
1604: dependencies, enable optional support for big dependencies or enable
1605: experimental features.
1606:
1607: To see which options, if any, a package supports, and which options are
1608: mutually exclusive, run make show-options, for example:
1609:
1610: The following options are supported by this package:
1611: ssl Enable SSL support.
1612: Exactly one of the following gecko options is required:
1613: firefox Use firefox as gecko rendering engine.
1614: mozilla Use mozilla as gecko rendering engine.
1615: At most one of the following database options may be selected:
1616: mysql Enable support for MySQL database.
1617: pgsql Enable support for PostgreSQL database.
1618:
1619: These options are enabled by default: firefox
1620: These options are currently enabled: mozilla ssl
1621:
1.4 rillig 1622: The following variables can be defined in mk.conf to select which options to
1623: enable for a package: PKG_DEFAULT_OPTIONS, which can be used to select or
1.1 dsieger 1624: disable options for all packages that support them, and PKG_OPTIONS.pkgbase,
1625: which can be used to select or disable options specifically for package pkgbase
1626: . Options listed in these variables are selected, options preceded by "-" are
1627: disabled. A few examples:
1628:
1.4 rillig 1629: $ grep "PKG.*OPTION" mk.conf
1.1 dsieger 1630: PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
1631: PKG_OPTIONS.kdebase= debug -sasl
1632: PKG_OPTIONS.apache= suexec
1633:
1.11 rillig 1634: It is important to note that options that were specifically suggested by the
1.19 snj 1635: package maintainer must be explicitly removed if you do not wish to include the
1636: option. If you are unsure you can view the current state with make show-options
1637: .
1.11 rillig 1638:
1.1 dsieger 1639: The following settings are consulted in the order given, and the last setting
1640: that selects or disables an option is used:
1641:
1642: 1. the default options as suggested by the package maintainer
1643:
1644: 2. the options implied by the settings of legacy variables (see below)
1645:
1646: 3. PKG_DEFAULT_OPTIONS
1647:
1648: 4. PKG_OPTIONS.pkgbase
1649:
1650: For groups of mutually exclusive options, the last option selected is used, all
1651: others are automatically disabled. If an option of the group is explicitly
1652: disabled, the previously selected option, if any, is used. It is an error if no
1653: option from a required group of options is selected, and building the package
1654: will fail.
1655:
1656: Before the options framework was introduced, build options were selected by
1.4 rillig 1657: setting a variable (often named USE_FOO) in mk.conf for each option. To ease
1658: transition to the options framework for the user, these legacy variables are
1659: converted to the appropriate options setting (PKG_OPTIONS.pkgbase)
1660: automatically. A warning is issued to prompt the user to update mk.conf to use
1661: the options framework directly. Support for the legacy variables will be
1.1 dsieger 1662: removed eventually.
1663:
1.154 rillig 1664: Chapter 7. Creating binary packages
1.1 dsieger 1665:
1666: Table of Contents
1667:
1.154 rillig 1668: 7.1. Building a single binary package
1669: 7.2. Settings for creation of binary packages
1.1 dsieger 1670:
1.154 rillig 1671: 7.1. Building a single binary package
1.1 dsieger 1672:
1673: Once you have built and installed a package, you can create a binary package
1674: which can be installed on another system with pkg_add(1). This saves having to
1675: build the same package on a group of hosts and wasting CPU time. It also
1676: provides a simple means for others to install your package, should you
1677: distribute it.
1678:
1679: To create a binary package, change into the appropriate directory in pkgsrc,
1680: and run make package:
1681:
1.112 rillig 1682: $ cd misc/figlet
1683: $ make package
1.1 dsieger 1684:
1685: This will build and install your package (if not already done), and then build
1686: a binary package from what was installed. You can then use the pkg_* tools to
1687: manipulate it. Binary packages are created by default in /usr/pkgsrc/packages,
1688: in the form of a gzipped tar file. See Section B.2, "Packaging figlet" for a
1689: continuation of the above misc/figlet example.
1690:
1.154 rillig 1691: See Chapter 23, Submitting and Committing for information on how to submit such
1.1 dsieger 1692: a binary package.
1693:
1.154 rillig 1694: 7.2. Settings for creation of binary packages
1.1 dsieger 1695:
1.154 rillig 1696: See Section 19.17, "Other helpful targets".
1.6 rillig 1697:
1.154 rillig 1698: Chapter 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 1699:
1700: Table of Contents
1701:
1.154 rillig 1702: 8.1. Preparations
1703: 8.2. Running a pbulk-style bulk build
1.6 rillig 1704:
1.154 rillig 1705: 8.2.1. Configuration
1.6 rillig 1706:
1.154 rillig 1707: 8.3. Requirements of a full bulk build
1708: 8.4. Creating a multiple CD-ROM packages collection
1.6 rillig 1709:
1.154 rillig 1710: 8.4.1. Example of cdpack
1.6 rillig 1711:
1.175 gutterid 1712: For a number of reasons, you may want to build binary packages for a large
1713: selected set of packages in pkgsrc, or even for all pkgsrc packages. For
1.71 wiz 1714: instance, when you have multiple machines that should run the same software, it
1715: is wasted time if they all build their packages themselves from source. Or you
1716: may want to build a list of packages you want and check them before deploying
1.175 gutterid 1717: onto production systems. There is a way of getting a set of binary packages:
1718: the bulk build system, or pbulk ("p" stands for "parallel"). This chapter
1719: describes how to set it up.
1.71 wiz 1720:
1.154 rillig 1721: 8.1. Preparations
1.71 wiz 1722:
1723: First of all, you have to decide whether you build all packages or a limited
1724: set of them. Full bulk builds usually consume a lot more resources, both space
1.175 gutterid 1725: and time, than builds for some practical sets of packages. A number of
1726: particularly heavy packages exist that are not actually interesting to a wide
1727: audience. (The approximate resource consumption for a full bulk build is given
1728: in section Section 8.3, "Requirements of a full bulk build".) For limited bulk
1729: builds you need to make a list of packages you want to build. Note that all
1730: their dependencies will be built, so you don't need to track them manually.
1.71 wiz 1731:
1732: During bulk builds various packages are installed and deinstalled in /usr/pkg
1733: (or whatever LOCALBASE is), so make sure that you don't need any package during
1.112 rillig 1734: the builds. Essentially, you should provide a fresh system, either a chroot
1.71 wiz 1735: environment or something even more restrictive, depending on what the operating
1736: system provides, or dedicate the whole physical machine. As a useful side
1737: effect this makes sure that bulk builds cannot break anything in your system.
1738: There have been numerous cases where certain packages tried to install files
1739: outside the LOCALBASE or wanted to edit some files in /etc.
1.6 rillig 1740:
1.154 rillig 1741: 8.2. Running a pbulk-style bulk build
1.6 rillig 1742:
1.15 rillig 1743: Running a pbulk-style bulk build works roughly as follows:
1744:
1745: * First, build the pbulk infrastructure in a fresh pkgsrc location.
1746:
1747: * Then, build each of the packages from a clean installation directory using
1748: the infrastructure.
1749:
1.154 rillig 1750: 8.2.1. Configuration
1.6 rillig 1751:
1.112 rillig 1752: To simplify configuration, we provide the helper script mk/pbulk/pbulk.sh.
1.6 rillig 1753:
1.68 asau 1754: In order to use it, prepare a clear system (real one, chroot environment, jail,
1755: zone, virtual machine). Configure network access to fetch distribution files.
1.112 rillig 1756: Create a user with name "pbulk".
1.68 asau 1757:
1758: Fetch and extract pkgsrc. Use a command like one of these:
1759:
1.151 sevan 1760: # (cd /usr && ftp -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1761: # (cd /usr && fetch -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1.72 wiz 1762: # (cd /usr && cvs -Q -z3 -d anoncvs@anoncvs.NetBSD.org:/cvsroot get -P pkgsrc)
1.68 asau 1763:
1764: Or any other way that fits (e.g., curl, wget).
1765:
1766: Deploy and configure pbulk tools, e.g.:
1767:
1.118 sevan 1768: # sh pbulk.sh -n # use native make, no bootstrap kit needed (for use on NetBSD)
1.68 asau 1769: # sh pbulk.sh -n -c mk.conf.frag # native, apply settings from given mk.conf fragment
1770: # sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build
1771:
1772: Note
1773:
1774: mk.conf.frag is a fragment of mk.conf that contains settings you want to apply
1775: to packages you build. For instance,
1776:
1.112 rillig 1777: PKG_DEVELOPER= yes # perform more checks
1778: X11_TYPE= modular # use pkgsrc X11
1779: SKIP_LICENSE_CHECK= yes # accept all licences (useful
1780: # when building all packages)
1.68 asau 1781:
1782: If configured for limited list, replace the list in /usr/pbulk/etc/pbulk.list
1.112 rillig 1783: with your list of packages, one per line without empty lines or comments. E.g.:
1.68 asau 1784:
1785: www/firefox
1786: mail/thunderbird
1787: misc/libreoffice4
1788:
1.69 asau 1789: At this point you can also review configuration in /usr/pbulk/etc and make
1790: final amendments, if wanted.
1791:
1.68 asau 1792: Start it:
1793:
1794: # /usr/pbulk/bin/bulkbuild
1795:
1796: After it finishes, you'll have /mnt filled with distribution files, binary
1797: packages, and reports, plain text summary in /mnt/bulklog/meta/report.txt
1798:
1799: Note
1800:
1801: The pbulk.sh script does not cover all possible use cases. While being ready to
1802: run, it serves as a good starting point to understand and build more complex
1803: setups. The script is kept small enough for better understanding.
1804:
1805: Note
1806:
1807: The pbulk.sh script supports running unprivileged bulk build and helps
1808: configuring distributed bulk builds.
1.15 rillig 1809:
1.154 rillig 1810: 8.3. Requirements of a full bulk build
1.71 wiz 1811:
1812: A complete bulk build requires lots of disk space. Some of the disk space can
1813: be read-only, some other must be writable. Some can be on remote filesystems
1814: (such as NFS) and some should be local. Some can be temporary filesystems,
1815: others must survive a sudden reboot.
1816:
1817: * 40 GB for the distfiles (read-write, remote, temporary)
1818:
1819: * 30 GB for the binary packages (read-write, remote, permanent)
1820:
1821: * 1 GB for the pkgsrc tree (read-only, remote, permanent)
1822:
1823: * 5 GB for LOCALBASE (read-write, local, temporary)
1824:
1825: * 10 GB for the log files (read-write, remote, permanent)
1826:
1827: * 5 GB for temporary files (read-write, local, temporary)
1828:
1.154 rillig 1829: 8.4. Creating a multiple CD-ROM packages collection
1.1 dsieger 1830:
1831: After your pkgsrc bulk-build has completed, you may wish to create a CD-ROM set
1832: of the resulting binary packages to assist in installing packages on other
1833: machines. The pkgtools/cdpack package provides a simple tool for creating the
1834: ISO 9660 images. cdpack arranges the packages on the CD-ROMs in a way that
1835: keeps all the dependencies for a given package on the same CD as that package.
1836:
1.154 rillig 1837: 8.4.1. Example of cdpack
1.1 dsieger 1838:
1839: Complete documentation for cdpack is found in the cdpack(1) man page. The
1840: following short example assumes that the binary packages are left in /usr/
1841: pkgsrc/packages/All and that sufficient disk space exists in /u2 to hold the
1842: ISO 9660 images.
1843:
1844: # mkdir /u2/images
1845: # pkg_add /usr/pkgsrc/packages/All/cdpack
1846: # cdpack /usr/pkgsrc/packages/All /u2/images
1847:
1848:
1849: If you wish to include a common set of files (COPYRIGHT, README, etc.) on each
1850: CD in the collection, then you need to create a directory which contains these
1.175 gutterid 1851: files, e.g.:
1.1 dsieger 1852:
1853: # mkdir /tmp/common
1854: # echo "This is a README" > /tmp/common/README
1855: # echo "Another file" > /tmp/common/COPYING
1856: # mkdir /tmp/common/bin
1857: # echo "#!/bin/sh" > /tmp/common/bin/myscript
1858: # echo "echo Hello world" >> /tmp/common/bin/myscript
1859: # chmod 755 /tmp/common/bin/myscript
1860:
1861:
1862: Now create the images:
1863:
1864: # cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images
1865:
1866: Each image will contain README, COPYING, and bin/myscript in their root
1867: directories.
1868:
1.154 rillig 1869: Chapter 9. Directory layout of the installed files
1.1 dsieger 1870:
1871: Table of Contents
1872:
1.154 rillig 1873: 9.1. File system layout in ${LOCALBASE}
1874: 9.2. File system layout in ${VARBASE}
1.1 dsieger 1875:
1876: The files that are installed by pkgsrc are organized in a way that is similar
1877: to what you find in the /usr directory of the base system. But some details are
1878: different. This is because pkgsrc initially came from FreeBSD and had adopted
1879: its file system hierarchy. Later it was largely influenced by NetBSD. But no
1880: matter which operating system you are using pkgsrc with, you can expect the
1881: same layout for pkgsrc.
1882:
1883: There are mainly four root directories for pkgsrc, which are all configurable
1884: in the bootstrap/bootstrap script. When pkgsrc has been installed as root, the
1885: default locations are:
1886:
1887: LOCALBASE= /usr/pkg
1888: PKG_SYSCONFBASE= /usr/pkg/etc
1889: VARBASE= /var
1.119 sevan 1890: PKG_DBDIR= /usr/pkg/pkgdb
1.1 dsieger 1891:
1892: In unprivileged mode (when pkgsrc has been installed as any other user), the
1893: default locations are:
1894:
1895: LOCALBASE= ${HOME}/pkg
1896: PKG_SYSCONFBASE= ${HOME}/pkg/etc
1897: VARBASE= ${HOME}/pkg/var
1.119 sevan 1898: PKG_DBDIR= ${HOME}/pkg/pkgdb
1.1 dsieger 1899:
1900: What these four directories are for, and what they look like is explained
1901: below.
1902:
1.25 wiz 1903: * LOCALBASE corresponds to the /usr directory in the base system. It is the "
1904: main" directory where the files are installed and contains the well-known
1.1 dsieger 1905: subdirectories like bin, include, lib, share and sbin.
1906:
1907: * VARBASE corresponds to /var in the base system. Some programs (especially
1908: games, network daemons) need write access to it during normal operation.
1909:
1910: * PKG_SYSCONFDIR corresponds to /etc in the base system. It contains
1911: configuration files of the packages, as well as pkgsrc's mk.conf itself.
1912:
1.154 rillig 1913: 9.1. File system layout in ${LOCALBASE}
1.1 dsieger 1914:
1915: The following directories exist in a typical pkgsrc installation in $
1916: {LOCALBASE}.
1917:
1918: bin
1919:
1920: Contains executable programs that are intended to be directly used by the
1921: end user.
1922:
1923: emul
1924:
1925: Contains files for the emulation layers of various other operating systems,
1926: especially for NetBSD.
1927:
1928: etc (the usual location of ${PKG_SYSCONFDIR})
1929:
1930: Contains the configuration files.
1931:
1932: include
1933:
1934: Contains headers for the C and C++ programming languages.
1935:
1936: info
1937:
1938: Contains GNU info files of various packages.
1939:
1940: lib
1941:
1942: Contains shared and static libraries.
1943:
1944: libdata
1945:
1946: Contains data files that don't change after installation. Other data files
1947: belong into ${VARBASE}.
1948:
1949: libexec
1950:
1951: Contains programs that are not intended to be used by end users, such as
1952: helper programs or network daemons.
1953:
1954: libexec/cgi-bin
1955:
1956: Contains programs that are intended to be executed as CGI scripts by a web
1957: server.
1958:
1959: man (the usual value of ${PKGMANDIR})
1960:
1961: Contains brief documentation in form of manual pages.
1962:
1963: sbin
1964:
1965: Contains programs that are intended to be used only by the super-user.
1966:
1967: share
1968:
1969: Contains platform-independent data files that don't change after
1970: installation.
1971:
1972: share/doc
1973:
1974: Contains documentation files provided by the packages.
1975:
1976: share/examples
1977:
1978: Contains example files provided by the packages. Among others, the original
1979: configuration files are saved here and copied to ${PKG_SYSCONFDIR} during
1980: installation.
1981:
1982: share/examples/rc.d
1983:
1984: Contains the original files for rc.d scripts.
1985:
1986: var (the usual location of ${VARBASE})
1987:
1988: Contains files that may be modified after installation.
1989:
1.154 rillig 1990: 9.2. File system layout in ${VARBASE}
1.1 dsieger 1991:
1992: db/pkg (the usual location of ${PKG_DBDIR})
1993:
1994: Contains information about the currently installed packages.
1995:
1996: games
1997:
1998: Contains highscore files.
1999:
2000: log
2001:
2002: Contains log files.
2003:
2004: run
2005:
2006: Contains informational files about daemons that are currently running.
2007:
1.154 rillig 2008: Chapter 10. Frequently Asked Questions
1.1 dsieger 2009:
2010: Table of Contents
2011:
1.154 rillig 2012: 10.1. Are there any mailing lists for pkg-related discussion?
2013: 10.2. Utilities for package management (pkgtools)
2014: 10.3. How to use pkgsrc as non-root
2015: 10.4. How to resume transfers when fetching distfiles?
2016: 10.5. How can I install/use modular X.org from pkgsrc?
2017: 10.6. How to fetch files from behind a firewall
2018: 10.7. How to fetch files from HTTPS sites
2019: 10.8. How do I tell make fetch to do passive FTP?
2020: 10.9. How to fetch all distfiles at once
2021: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
2022: 10.11. What does "Could not find bsd.own.mk" mean?
2023: 10.12. Using 'sudo' with pkgsrc
2024: 10.13. How do I change the location of configuration files?
2025: 10.14. Automated security checks
2026: 10.15. Why do some packages ignore my CFLAGS?
2027: 10.16. A package does not build. What shall I do?
2028: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.24 wiz 2029: conflicts" mean?
1.1 dsieger 2030:
2031: This section contains hints, tips & tricks on special things in pkgsrc that we
2032: didn't find a better place for in the previous chapters, and it contains items
2033: for both pkgsrc users and developers.
2034:
1.154 rillig 2035: 10.1. Are there any mailing lists for pkg-related discussion?
1.1 dsieger 2036:
2037: The following mailing lists may be of interest to pkgsrc users:
2038:
2039: * pkgsrc-users: This is a general purpose list for most issues regarding
2040: pkgsrc, regardless of platform, e.g. soliciting user help for pkgsrc
2041: configuration, unexpected build failures, using particular packages,
2042: upgrading pkgsrc installations, questions regarding the pkgsrc release
2043: branches, etc. General announcements or proposals for changes that impact
2044: the pkgsrc user community, e.g. major infrastructure changes, new features,
2045: package removals, etc., may also be posted.
2046:
2047: * pkgsrc-bulk: A list where the results of pkgsrc bulk builds are sent and
2048: discussed.
2049:
2050: * pkgsrc-changes: This list is for those who are interested in getting a
2051: commit message for every change committed to pkgsrc. It is also available
2052: in digest form, meaning one daily message containing all commit messages
2053: for changes to the package source tree in that 24 hour period.
2054:
2055: To subscribe, do:
2056:
2057: % echo subscribe listname | mail majordomo@NetBSD.org
2058:
1.174 leot 2059: Archives for all these mailing lists are available from https://
1.1 dsieger 2060: mail-index.NetBSD.org/.
2061:
1.154 rillig 2062: 10.2. Utilities for package management (pkgtools)
1.1 dsieger 2063:
2064: The directory pkgsrc/pkgtools contains a number of useful utilities for both
2065: users and developers of pkgsrc. This section attempts only to make the reader
1.121 sevan 2066: aware of some of the utilities and when they might be useful, and not to
2067: duplicate the documentation that comes with each package.
1.1 dsieger 2068:
2069: Utilities used by pkgsrc (automatically installed when needed):
2070:
2071: * pkgtools/x11-links: Symlinks for use by buildlink.
2072:
2073: OS tool augmentation (automatically installed when needed):
2074:
1.121 sevan 2075: * pkgtools/digest: Calculates various kinds of checksums (including SHA3).
1.1 dsieger 2076:
2077: * pkgtools/libnbcompat: Compatibility library for pkgsrc tools.
2078:
2079: * pkgtools/mtree: Installed on non-BSD systems due to lack of native mtree.
2080:
2081: * pkgtools/pkg_install: Up-to-date replacement for /usr/sbin/pkg_install, or
2082: for use on operating systems where pkg_install is not present.
2083:
2084: Utilities used by pkgsrc (not automatically installed):
2085:
2086: * pkgtools/pkg_tarup: Create a binary package from an already-installed
2087: package. Used by make replace to save the old package.
2088:
2089: * pkgtools/dfdisk: Adds extra functionality to pkgsrc, allowing it to fetch
2090: distfiles from multiple locations. It currently supports the following
2091: methods: multiple CD-ROMs and network FTP/HTTP connections.
2092:
2093: * devel/cpuflags: Determine the best compiler flags to optimise code for your
1.24 wiz 2094: current CPU and compiler.
1.1 dsieger 2095:
2096: Utilities for keeping track of installed packages, being up to date, etc:
2097:
1.65 wiz 2098: * pkgtools/pkgin: A package update tool similar to apt(1). Download, install,
2099: and upgrade binary packages easily.
2100:
1.1 dsieger 2101: * pkgtools/pkg_chk: Reports on packages whose installed versions do not match
2102: the latest pkgsrc entries.
2103:
2104: * pkgtools/pkgdep: Makes dependency graphs of packages, to aid in choosing a
2105: strategy for updating.
2106:
2107: * pkgtools/pkgdepgraph: Makes graphs from the output of pkgtools/pkgdep (uses
2108: graphviz).
2109:
1.12 weinem 2110: * pkgtools/pkglint: The pkglint(1) program checks a pkgsrc entry for errors.
2111:
2112: * pkgtools/lintpkgsrc: The lintpkgsrc(1) program does various checks on the
2113: complete pkgsrc system.
1.1 dsieger 2114:
2115: * pkgtools/pkgsurvey: Report what packages you have installed.
2116:
2117: Utilities for people maintaining or creating individual packages:
2118:
2119: * pkgtools/pkgdiff: Automate making and maintaining patches for a package
2120: (includes pkgdiff, pkgvi, mkpatches, etc.).
2121:
1.65 wiz 2122: * pkgtools/url2pkg: Aids in converting to pkgsrc.
1.1 dsieger 2123:
2124: Utilities for people maintaining pkgsrc (or: more obscure pkg utilities)
2125:
2126: * pkgtools/pkg_comp: Build packages in a chrooted area.
2127:
2128: * pkgtools/libkver: Spoof kernel version for chrooted cross builds.
2129:
1.154 rillig 2130: 10.3. How to use pkgsrc as non-root
1.1 dsieger 2131:
1.108 rillig 2132: To install packages from source as a non-root user, download pkgsrc as
1.154 rillig 2133: described in Chapter 3, Where to get pkgsrc and how to keep it up-to-date, cd
1.108 rillig 2134: into that directory and run the command ./bootstrap/bootstrap --unprivileged.
2135:
2136: This will install the binary part of pkgsrc to ~/pkg and put the pkgsrc
2137: configuration mk.conf into ~/pkg/etc.
2138:
2139: For more details, see mk/unprivileged.mk.
1.1 dsieger 2140:
1.154 rillig 2141: 10.4. How to resume transfers when fetching distfiles?
1.1 dsieger 2142:
2143: By default, resuming transfers in pkgsrc is disabled, but you can enable this
1.4 rillig 2144: feature by adding the option PKG_RESUME_TRANSFERS=YES into mk.conf. If, during
2145: a fetch step, an incomplete distfile is found, pkgsrc will try to resume it.
1.1 dsieger 2146:
1.61 wiz 2147: You can also use a different program than the platform default program by
2148: changing the FETCH_USING variable. You can specify the program by using of ftp,
2149: fetch, wget or curl. Alternatively, fetching can be disabled by using the value
2150: manual. A value of custom disables the system defaults and dependency tracking
2151: for the fetch program. In that case you have to provide FETCH_CMD,
2152: FETCH_BEFORE_ARGS, FETCH_RESUME_ARGS, FETCH_OUTPUT_ARGS, FETCH_AFTER_ARGS.
1.1 dsieger 2153:
1.16 jnemeth 2154: For example, if you want to use wget to download, you'll have to use something
2155: like:
1.1 dsieger 2156:
1.16 jnemeth 2157: FETCH_USING= wget
1.1 dsieger 2158:
1.154 rillig 2159: 10.5. How can I install/use modular X.org from pkgsrc?
1.1 dsieger 2160:
1.4 rillig 2161: If you want to use modular X.org from pkgsrc instead of your system's own X11
2162: (/usr/X11R6, /usr/openwin, ...) you will have to add the following line into
1.1 dsieger 2163: mk.conf:
2164:
1.4 rillig 2165: X11_TYPE=modular
1.1 dsieger 2166:
1.154 rillig 2167: 10.6. How to fetch files from behind a firewall
1.1 dsieger 2168:
2169: If you are sitting behind a firewall which does not allow direct connections to
2170: Internet hosts (i.e. non-NAT), you may specify the relevant proxy hosts. This
2171: is done using an environment variable in the form of a URL, e.g. in Amdahl, the
2172: machine "orpheus.amdahl.com" is one of the firewalls, and it uses port 80 as
2173: the proxy port number. So the proxy environment variables are:
2174:
2175: ftp_proxy=ftp://orpheus.amdahl.com:80/
2176: http_proxy=http://orpheus.amdahl.com:80/
2177:
1.154 rillig 2178: 10.7. How to fetch files from HTTPS sites
1.65 wiz 2179:
2180: Some fetch tools are not prepared to support HTTPS by default (for example, the
2181: one in NetBSD 6.0), or the one installed by the pkgsrc bootstrap (to avoid an
2182: openssl dependency that low in the dependency graph).
2183:
2184: Usually you won't notice, because distribution files are mirrored weekly to "
2185: ftp.NetBSD.org", but that might not be often enough if you are following
2186: pkgsrc-current. In that case, set FETCH_USING in your mk.conf file to "curl" or
2187: "wget", which are both compiled with HTTPS support by default. Of course, these
2188: tools need to be installed before you can use them this way.
2189:
1.154 rillig 2190: 10.8. How do I tell make fetch to do passive FTP?
1.1 dsieger 2191:
2192: This depends on which utility is used to retrieve distfiles. From bsd.pkg.mk,
2193: FETCH_CMD is assigned the first available command from the following list:
2194:
2195: * ${LOCALBASE}/bin/ftp
2196:
2197: * /usr/bin/ftp
2198:
2199: On a default NetBSD installation, this will be /usr/bin/ftp, which
2200: automatically tries passive connections first, and falls back to active
2201: connections if the server refuses to do passive. For the other tools, add the
1.4 rillig 2202: following to your mk.conf file: PASSIVE_FETCH=1.
1.1 dsieger 2203:
2204: Having that option present will prevent /usr/bin/ftp from falling back to
2205: active transfers.
2206:
1.154 rillig 2207: 10.9. How to fetch all distfiles at once
1.1 dsieger 2208:
2209: You would like to download all the distfiles in a single batch from work or
2210: university, where you can't run a make fetch. There is an archive of distfiles
2211: on ftp.NetBSD.org, but downloading the entire directory may not be appropriate.
2212:
2213: The answer here is to do a make fetch-list in /usr/pkgsrc or one of its
2214: subdirectories, carry the resulting list to your machine at work/school and use
2215: it there. If you don't have a NetBSD-compatible ftp(1) (like tnftp) at work,
2216: don't forget to set FETCH_CMD to something that fetches a URL:
2217:
2218: At home:
2219:
2220: % cd /usr/pkgsrc
2221: % make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh
2222: % scp /tmp/fetch.sh work:/tmp
2223:
2224: At work:
2225:
2226: % sh /tmp/fetch.sh
2227:
2228: then tar up /tmp/distfiles and take it home.
2229:
2230: If you have a machine running NetBSD, and you want to get all distfiles (even
2231: ones that aren't for your machine architecture), you can do so by using the
2232: above-mentioned make fetch-list approach, or fetch the distfiles directly by
2233: running:
2234:
2235: % make mirror-distfiles
2236:
2237: If you even decide to ignore NO_{SRC,BIN}_ON_{FTP,CDROM}, then you can get
2238: everything by running:
2239:
2240: % make fetch NO_SKIP=yes
2241:
1.154 rillig 2242: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
1.1 dsieger 2243:
2244: When compiling the pkgtools/pkg_install package, you get the error from make
2245: that it doesn't know how to make /usr/share/tmac/tmac.andoc? This indicates
2246: that you don't have installed the "text" set (nroff, ...) from the NetBSD base
2247: distribution on your machine. It is recommended to do that to format man pages.
2248:
2249: In the case of the pkgtools/pkg_install package, you can get away with setting
1.4 rillig 2250: NOMAN=YES either in the environment or in mk.conf.
1.1 dsieger 2251:
1.154 rillig 2252: 10.11. What does "Could not find bsd.own.mk" mean?
1.1 dsieger 2253:
2254: You didn't install the compiler set, comp.tgz, when you installed your NetBSD
2255: machine. Please get and install it, by extracting it in /:
2256:
2257: # cd /
2258: # tar --unlink -zxvpf .../comp.tgz
2259:
2260: comp.tgz is part of every NetBSD release. Get the one that corresponds to your
2261: release (determine via uname -r).
2262:
1.154 rillig 2263: 10.12. Using 'sudo' with pkgsrc
1.1 dsieger 2264:
2265: When installing packages as non-root user and using the just-in-time su(1)
2266: feature of pkgsrc, it can become annoying to type in the root password for each
2267: required package installed. To avoid this, the sudo package can be used, which
2268: does password caching over a limited time. To use it, install sudo (either as
1.4 rillig 2269: binary package or from security/sudo) and then put the following into your
2270: mk.conf, somewhere after the definition of the LOCALBASE variable:
1.1 dsieger 2271:
2272: .if exists(${LOCALBASE}/bin/sudo)
2273: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
2274: .endif
2275:
1.154 rillig 2276: 10.13. How do I change the location of configuration files?
1.1 dsieger 2277:
2278: As the system administrator, you can choose where configuration files are
2279: installed. The default settings make all these files go into ${PREFIX}/etc or
2280: some of its subdirectories; this may be suboptimal depending on your
2281: expectations (e.g., a read-only, NFS-exported PREFIX with a need of per-machine
2282: configuration of the provided packages).
2283:
2284: In order to change the defaults, you can modify the PKG_SYSCONFBASE variable
1.4 rillig 2285: (in mk.conf) to point to your preferred configuration directory; some common
2286: examples include /etc or /etc/pkg.
1.1 dsieger 2287:
2288: Furthermore, you can change this value on a per-package basis by setting the
2289: PKG_SYSCONFDIR.${PKG_SYSCONFVAR} variable. PKG_SYSCONFVAR's value usually
2290: matches the name of the package you would like to modify, that is, the contents
2291: of PKGBASE.
2292:
2293: Note that after changing these settings, you must rebuild and reinstall any
2294: affected packages.
2295:
1.154 rillig 2296: 10.14. Automated security checks
1.1 dsieger 2297:
2298: Please be aware that there can often be bugs in third-party software, and some
2299: of these bugs can leave a machine vulnerable to exploitation by attackers. In
2300: an effort to lessen the exposure, the NetBSD packages team maintains a database
2301: of known-exploits to packages which have at one time been included in pkgsrc.
2302: The database can be downloaded automatically, and a security audit of all
1.14 jmcneill 2303: packages installed on a system can take place. To do this, refer to the
2304: following two tools (installed as part of the pkgtools/pkg_install package):
1.1 dsieger 2305:
1.21 snj 2306: 1. pkg_admin fetch-pkg-vulnerabilities, an easy way to download a list of the
2307: security vulnerabilities information. This list is kept up to date by the
1.26 spz 2308: pkgsrc security team, and is distributed from the NetBSD ftp server:
1.1 dsieger 2309:
1.26 spz 2310: ftp://ftp.NetBSD.org/pkgsrc/distfiles/pkg-vulnerabilities
1.1 dsieger 2311:
1.21 snj 2312: 2. pkg_admin audit, an easy way to audit the current machine, checking each
1.24 wiz 2313: known vulnerability. If a vulnerable package is installed, it will be shown
2314: by output to stdout, including a description of the type of vulnerability,
2315: and a URL containing more information.
1.1 dsieger 2316:
1.154 rillig 2317: Use of these tools is strongly recommended! See Section 5.1.5, "Checking for
1.121 sevan 2318: security vulnerabilities in installed packages" for instructions on how to
2319: automate checking and reporting.
2320:
2321: If this database is installed, pkgsrc builds will use it to perform a security
2322: check before building any package.
1.1 dsieger 2323:
1.154 rillig 2324: 10.15. Why do some packages ignore my CFLAGS?
1.1 dsieger 2325:
2326: When you add your own preferences to the CFLAGS variable in your mk.conf, these
2327: flags are passed in environment variables to the ./configure scripts and to
2328: make(1). Some package authors ignore the CFLAGS from the environment variable
2329: by overriding them in the Makefiles of their package.
2330:
2331: Currently there is no solution to this problem. If you really need the package
2332: to use your CFLAGS you should run make patch in the package directory and then
2333: inspect any Makefile and Makefile.in for whether they define CFLAGS explicitly.
2334: Usually you can remove these lines. But be aware that some "smart" programmers
2335: write so bad code that it only works for the specific combination of CFLAGS
2336: they have chosen.
2337:
1.172 rillig 2338: To find out where the CFLAGS are ignored, add the following lines to mk.conf:
2339:
2340: CPPFLAGS+= -Dpkgsrc___CPPFLAGS
2341: CFLAGS+= -Dpkgsrc___CFLAGS
2342: CXXFLAGS+= -Dpkgsrc___CXXFLAGS
2343:
2344: Then run bmake show-all-configure show-all-build to see whether the above flags
2345: are passed to the actual build commands in general.
2346:
2347: To find out whether the flags are passed to individual compiler commands, have
2348: a look at the file work/.work.log. In most cases, the flags from the original
2349: command lines (the lines starting with [*]) are passed unmodified to the actual
2350: compiler (the lines starting with <.>). If the flag is missing from the actual
2351: compiler command, it must have been removed by the pkgsrc compiler wrappers.
2352:
1.154 rillig 2353: 10.16. A package does not build. What shall I do?
1.1 dsieger 2354:
2355: 1. Make sure that your copy of pkgsrc is consistent. A case that occurs often
2356: is that people only update pkgsrc in parts, because of performance reasons.
2357: Since pkgsrc is one large system, not a collection of many small systems,
2358: there are sometimes changes that only work when the whole pkgsrc tree is
2359: updated.
2360:
1.25 wiz 2361: 2. Make sure that you don't have any CVS conflicts. Search for "<<<<<<" or "
2362: >>>>>>" in all your pkgsrc files.
1.1 dsieger 2363:
1.25 wiz 2364: 3. Make sure that you don't have old copies of the packages extracted. Run
1.1 dsieger 2365: make clean clean-depends to verify this.
2366:
1.108 rillig 2367: 4. If you are a package developer who wants to invest some work, have a look
1.154 rillig 2368: at Chapter 21, Making your package work.
1.108 rillig 2369:
2370: 5. If the problem still exists, write a mail to the pkgsrc-users mailing list.
1.1 dsieger 2371:
1.154 rillig 2372: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.1 dsieger 2373: conflicts" mean?
2374:
2375: You have modified a file from pkgsrc, and someone else has modified that same
2376: file afterwards in the CVS repository. Both changes are in the same region of
2377: the file, so when you updated pkgsrc, the cvs command marked the conflicting
2378: changes in the file. Because of these markers, the file is no longer a valid
2379: Makefile.
2380:
2381: Have a look at that file, and if you don't need your local changes anymore, you
2382: can remove that file and run cvs -q update -dP in that directory to download
2383: the current version.
2384:
2385: Part II. The pkgsrc developer's guide
2386:
2387: This part of the book deals with creating and modifying packages. It starts
2388: with a "HOWTO"-like guide on creating a new package. The remaining chapters are
2389: more like a reference manual for pkgsrc.
2390:
2391: Table of Contents
2392:
1.154 rillig 2393: 11. Getting help
2394: 12. Creating a new pkgsrc package from scratch
1.1 dsieger 2395:
1.154 rillig 2396: 12.1. Common types of packages
1.1 dsieger 2397:
1.154 rillig 2398: 12.1.1. Perl modules
2399: 12.1.2. Python modules and programs
1.160 brook 2400: 12.1.3. R packages
2401: 12.1.4. TeXlive packages
1.1 dsieger 2402:
1.154 rillig 2403: 12.2. Examples
1.1 dsieger 2404:
1.154 rillig 2405: 12.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 2406:
1.154 rillig 2407: 13. Package components - files, directories and contents
1.1 dsieger 2408:
1.154 rillig 2409: 13.1. Makefile
2410: 13.2. distinfo
2411: 13.3. patches/*
1.1 dsieger 2412:
1.154 rillig 2413: 13.3.1. Structure of a single patch file
2414: 13.3.2. Creating patch files
2415: 13.3.3. Sources where the patch files come from
2416: 13.3.4. Patching guidelines
2417: 13.3.5. Feedback to the author
1.1 dsieger 2418:
1.154 rillig 2419: 13.4. Other mandatory files
2420: 13.5. Optional files
1.1 dsieger 2421:
1.154 rillig 2422: 13.5.1. Files affecting the binary package
2423: 13.5.2. Files affecting the build process
2424: 13.5.3. Files affecting nothing at all
1.1 dsieger 2425:
1.154 rillig 2426: 13.6. work*
2427: 13.7. files/*
1.1 dsieger 2428:
1.154 rillig 2429: 14. Programming in Makefiles
1.1 dsieger 2430:
1.154 rillig 2431: 14.1. Caveats
2432: 14.2. Makefile variables
1.1 dsieger 2433:
1.154 rillig 2434: 14.2.1. Naming conventions
1.1 dsieger 2435:
1.154 rillig 2436: 14.3. Code snippets
1.1 dsieger 2437:
1.154 rillig 2438: 14.3.1. Adding things to a list
2439: 14.3.2. Echoing a string exactly as-is
2440: 14.3.3. Passing CFLAGS to GNU configure scripts
2441: 14.3.4. Handling possibly empty variables
1.1 dsieger 2442:
1.154 rillig 2443: 15. PLIST issues
1.1 dsieger 2444:
1.154 rillig 2445: 15.1. RCS ID
2446: 15.2. Semi-automatic PLIST generation
2447: 15.3. Tweaking output of make print-PLIST
2448: 15.4. Variable substitution in PLIST
2449: 15.5. Man page compression
2450: 15.6. Changing PLIST source with PLIST_SRC
2451: 15.7. Platform-specific and differing PLISTs
2452: 15.8. Build-specific PLISTs
2453: 15.9. Sharing directories between packages
1.1 dsieger 2454:
1.154 rillig 2455: 16. Buildlink methodology
1.1 dsieger 2456:
1.154 rillig 2457: 16.1. Converting packages to use buildlink3
2458: 16.2. Writing buildlink3.mk files
1.1 dsieger 2459:
1.154 rillig 2460: 16.2.1. Anatomy of a buildlink3.mk file
2461: 16.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.
1.27 wiz 2462: pkg in buildlink3.mk files
1.1 dsieger 2463:
1.154 rillig 2464: 16.3. Writing builtin.mk files
1.1 dsieger 2465:
1.154 rillig 2466: 16.3.1. Anatomy of a builtin.mk file
2467: 16.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 2468:
1.154 rillig 2469: 17. The pkginstall framework
1.1 dsieger 2470:
1.154 rillig 2471: 17.1. Files and directories outside the installation prefix
1.1 dsieger 2472:
1.154 rillig 2473: 17.1.1. Directory manipulation
2474: 17.1.2. File manipulation
1.1 dsieger 2475:
1.154 rillig 2476: 17.2. Configuration files
1.1 dsieger 2477:
1.154 rillig 2478: 17.2.1. How PKG_SYSCONFDIR is set
2479: 17.2.2. Telling the software where configuration files are
2480: 17.2.3. Patching installations
2481: 17.2.4. Disabling handling of configuration files
1.1 dsieger 2482:
1.154 rillig 2483: 17.3. System startup scripts
1.1 dsieger 2484:
1.154 rillig 2485: 17.3.1. Disabling handling of system startup scripts
1.1 dsieger 2486:
1.154 rillig 2487: 17.4. System users and groups
2488: 17.5. System shells
1.1 dsieger 2489:
1.154 rillig 2490: 17.5.1. Disabling shell registration
1.1 dsieger 2491:
1.154 rillig 2492: 17.6. Fonts
1.1 dsieger 2493:
1.154 rillig 2494: 17.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 2495:
1.154 rillig 2496: 18. Options handling
1.1 dsieger 2497:
1.154 rillig 2498: 18.1. Global default options
2499: 18.2. Converting packages to use bsd.options.mk
2500: 18.3. Option Names
2501: 18.4. Determining the options of dependencies
1.1 dsieger 2502:
1.154 rillig 2503: 19. The build process
1.1 dsieger 2504:
1.154 rillig 2505: 19.1. Introduction
2506: 19.2. Program location
2507: 19.3. Directories used during the build process
2508: 19.4. Running a phase
2509: 19.5. The fetch phase
1.1 dsieger 2510:
1.154 rillig 2511: 19.5.1. What to fetch and where to get it from
2512: 19.5.2. How are the files fetched?
1.1 dsieger 2513:
1.154 rillig 2514: 19.6. The checksum phase
2515: 19.7. The extract phase
2516: 19.8. The patch phase
2517: 19.9. The tools phase
2518: 19.10. The wrapper phase
2519: 19.11. The configure phase
2520: 19.12. The build phase
2521: 19.13. The test phase
2522: 19.14. The install phase
2523: 19.15. The package phase
2524: 19.16. Cleaning up
2525: 19.17. Other helpful targets
1.1 dsieger 2526:
1.154 rillig 2527: 20. Tools needed for building or running
1.1 dsieger 2528:
1.154 rillig 2529: 20.1. Tools for pkgsrc builds
2530: 20.2. Tools needed by packages
2531: 20.3. Tools provided by platforms
1.1 dsieger 2532:
1.154 rillig 2533: 21. Making your package work
1.1 dsieger 2534:
1.154 rillig 2535: 21.1. General operation
1.1 dsieger 2536:
1.154 rillig 2537: 21.1.1. How to pull in user-settable variables from mk.conf
2538: 21.1.2. User interaction
2539: 21.1.3. Handling licenses
2540: 21.1.4. Restricted packages
2541: 21.1.5. Handling dependencies
2542: 21.1.6. Handling conflicts with other packages
2543: 21.1.7. Packages that cannot or should not be built
2544: 21.1.8. Packages which should not be deleted, once installed
2545: 21.1.9. Handling packages with security problems
2546: 21.1.10. How to handle incrementing versions when fixing an existing
1.1 dsieger 2547: package
1.154 rillig 2548: 21.1.11. Substituting variable text in the package files (the SUBST
1.1 dsieger 2549: framework)
2550:
1.154 rillig 2551: 21.2. The fetch phase
1.1 dsieger 2552:
1.154 rillig 2553: 21.2.1. Packages whose distfiles aren't available for plain downloading
2554: 21.2.2. How to handle modified distfiles with the 'old' name
2555: 21.2.3. Packages hosted on github.com
2556:
2557: 21.3. The configure phase
2558:
2559: 21.3.1. Shared libraries - libtool
2560: 21.3.2. Using libtool on GNU packages that already support libtool
2561: 21.3.3. GNU Autoconf/Automake
2562:
2563: 21.4. Programming languages
2564:
2565: 21.4.1. C, C++, and Fortran
2566: 21.4.2. Java
2567: 21.4.3. Packages containing perl scripts
2568: 21.4.4. Packages containing shell scripts
2569: 21.4.5. Other programming languages
2570:
2571: 21.5. The build phase
2572:
2573: 21.5.1. Compiling C and C++ code conditionally
2574: 21.5.2. How to handle compiler bugs
1.172 rillig 2575: 21.5.3. No such file or directory
2576: 21.5.4. Undefined reference to "..."
2577: 21.5.5. Running out of memory
1.154 rillig 2578:
2579: 21.6. The install phase
2580:
2581: 21.6.1. Creating needed directories
2582: 21.6.2. Where to install documentation
2583: 21.6.3. Installing highscore files
2584: 21.6.4. Adding DESTDIR support to packages
2585: 21.6.5. Packages with hardcoded paths to other interpreters
2586: 21.6.6. Packages installing perl modules
2587: 21.6.7. Packages installing info files
2588: 21.6.8. Packages installing man pages
2589: 21.6.9. Packages installing GConf data files
2590: 21.6.10. Packages installing scrollkeeper/rarian data files
2591: 21.6.11. Packages installing X11 fonts
2592: 21.6.12. Packages installing GTK2 modules
2593: 21.6.13. Packages installing SGML or XML data
2594: 21.6.14. Packages installing extensions to the MIME database
2595: 21.6.15. Packages using intltool
2596: 21.6.16. Packages installing startup scripts
2597: 21.6.17. Packages installing TeX modules
2598: 21.6.18. Packages supporting running binaries in emulation
2599: 21.6.19. Packages installing hicolor theme icons
2600: 21.6.20. Packages installing desktop files
2601:
2602: 21.7. Marking packages as having problems
2603:
2604: 22. Debugging
2605: 23. Submitting and Committing
2606:
2607: 23.1. Submitting binary packages
2608: 23.2. Submitting source packages (for non-NetBSD-developers)
2609: 23.3. General notes when adding, updating, or removing packages
2610: 23.4. Commit Messages
2611: 23.5. Committing: Adding a package to CVS
2612: 23.6. Updating a package to a newer version
2613: 23.7. Renaming a package in pkgsrc
2614: 23.8. Moving a package in pkgsrc
2615:
2616: 24. Frequently Asked Questions
2617: 25. GNOME packaging and porting
2618:
2619: 25.1. Meta packages
2620: 25.2. Packaging a GNOME application
2621: 25.3. Updating GNOME to a newer version
2622: 25.4. Patching guidelines
2623:
2624: Chapter 11. Getting help
2625:
2626: To get help when developing pkgsrc, the definitive source is this document, the
2627: pkgsrc guide. If you don't find anything here, there are alternatives:
2628:
2629: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
2630: Run bmake help topic=? to get help for any topic, such as a variable name
2631: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
2632: like strcasecmp or any other topic.
2633:
2634: The available help topics are listed in Appendix D, Help topics.
2635:
1.163 rillig 2636: * To see the value of a single variable, run bmake show-var VARNAME=X.
2637:
2638: * To see the values of the most common variables, run bmake show-all. These
2639: variables are grouped by topic. To see the variables for a single topic,
2640: run bmake show-all-topic, for example bmake show-all-fetch.
2641:
1.154 rillig 2642: * The tech-pkg mailing list, to which you can subscribe and then ask your
2643: questions.
2644:
2645: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
2646: a specialized chat program such as XChat. Pick any user name and join the
2647: channel #pkgsrc.
1.1 dsieger 2648:
1.154 rillig 2649: Chapter 12. Creating a new pkgsrc package from scratch
1.1 dsieger 2650:
2651: Table of Contents
2652:
1.154 rillig 2653: 12.1. Common types of packages
1.1 dsieger 2654:
1.154 rillig 2655: 12.1.1. Perl modules
2656: 12.1.2. Python modules and programs
1.160 brook 2657: 12.1.3. R packages
2658: 12.1.4. TeXlive packages
1.1 dsieger 2659:
1.154 rillig 2660: 12.2. Examples
1.1 dsieger 2661:
1.154 rillig 2662: 12.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 2663:
2664: When you find a package that is not yet in pkgsrc, you most likely have a URL
2665: from where you can download the source code. Starting with this URL, creating a
2666: package involves only a few steps.
2667:
2668: 1. First, install the packages pkgtools/url2pkg and pkgtools/pkglint.
2669:
2670: 2. Then, choose one of the top-level directories as the category in which you
2671: want to place your package. You can also create a directory of your own
2672: (maybe called local). In that category directory, create another directory
2673: for your package and change into it.
2674:
2675: 3. Run the program url2pkg, which will ask you for a URL. Enter the URL of the
2676: distribution file (in most cases a .tar.gz file) and watch how the basic
2677: ingredients of your package are created automatically. The distribution
2678: file is extracted automatically to fill in some details in the Makefile
2679: that would otherwise have to be done manually.
2680:
2681: 4. Examine the extracted files to determine the dependencies of your package.
2682: Ideally, this is mentioned in some README file, but things may differ. For
2683: each of these dependencies, look where it exists in pkgsrc, and if there is
2684: a file called buildlink3.mk in that directory, add a line to your package
2685: Makefile which includes that file just before the last line. If the
1.26 spz 2686: buildlink3.mk file does not exist, it must be created first. The
2687: buildlink3.mk file makes sure that the package's include files and
2688: libraries are provided.
2689:
2690: If you just need binaries from a package, add a DEPENDS line to the
2691: Makefile, which specifies the version of the dependency and where it can be
2692: found in pkgsrc. This line should be placed in the third paragraph. If the
1.1 dsieger 2693: dependency is only needed for building the package, but not when using it,
1.156 leot 2694: use TOOL_DEPENDS or BUILD_DEPENDS instead of DEPENDS. The difference
2695: between TOOL_DEPENDS and BUILD_DEPENDS occurs when cross-compiling:
2696: TOOL_DEPENDS are native packages, i.e. packages for the architecture where
2697: the package is built; BUILD_DEPENDS are target packages, i.e. packages for
1.175 gutterid 2698: the architecture for which the package is built. There is also
2699: TEST_DEPENDS, which is used to specify a dependency used only for testing
2700: the resulting package built, using the upstream project's included test
2701: suite. Your package may then look like this:
1.1 dsieger 2702:
2703: [...]
2704:
1.156 leot 2705: TOOL_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt
1.1 dsieger 2706: DEPENDS+= screen-[0-9]*:../../misc/screen
2707: DEPENDS+= screen>=4.0:../../misc/screen
2708:
2709: [...]
2710:
2711: .include "../../category/package/buildlink3.mk"
2712: .include "../../devel/glib2/buildlink3.mk"
2713: .include "../../mk/bsd.pkg.mk"
2714:
2715: 5. Run pkglint to see what things still need to be done to make your package a
2716: "good" one. If you don't know what pkglint's warnings want to tell you, try
2717: pkglint --explain or pkglint -e, which outputs additional explanations.
2718:
2719: 6. In many cases the package is not yet ready to build. You can find
1.154 rillig 2720: instructions for the most common cases in the next section, Section 12.1,
1.1 dsieger 2721: "Common types of packages". After you have followed the instructions over
2722: there, you can hopefully continue here.
2723:
2724: 7. Run bmake clean to clean the working directory from the extracted files.
2725: Besides these files, a lot of cache files and other system information has
2726: been saved in the working directory, which may become wrong after you
2727: edited the Makefile.
2728:
2729: 8. Now, run bmake to build the package. For the various things that can go
1.154 rillig 2730: wrong in this phase, consult Chapter 21, Making your package work.
1.1 dsieger 2731:
1.25 wiz 2732: 9. When the package builds fine, the next step is to install the package. Run
1.1 dsieger 2733: bmake install and hope that everything works.
2734:
2735: 10. Up to now, the file PLIST, which contains a list of the files that are
2736: installed by the package, is nearly empty. Run bmake print-PLIST >PLIST to
2737: generate a probably correct list. Check the file using your preferred text
2738: editor to see if the list of files looks plausible.
2739:
2740: 11. Run pkglint again to see if the generated PLIST contains garbage or not.
2741:
2742: 12. When you ran bmake install, the package has been registered in the database
2743: of installed files, but with an empty list of files. To fix this, run bmake
2744: deinstall and bmake install again. Now the package is registered with the
2745: list of files from PLIST.
2746:
2747: 13. Run bmake package to create a binary package from the set of installed
2748: files.
2749:
1.154 rillig 2750: 12.1. Common types of packages
1.1 dsieger 2751:
1.154 rillig 2752: 12.1.1. Perl modules
1.1 dsieger 2753:
2754: Simple Perl modules are handled automatically by url2pkg, including
2755: dependencies.
2756:
1.154 rillig 2757: 12.1.2. Python modules and programs
1.17 imil 2758:
2759: Python modules and programs packages are easily created using a set of
2760: predefined variables.
2761:
1.63 wiz 2762: If some Python versions are not supported by the software, set the
2763: PYTHON_VERSIONS_INCOMPATIBLE variable to the Python versions that are not
2764: supported, e.g.
1.17 imil 2765:
1.93 sevan 2766: PYTHON_VERSIONS_INCOMPATIBLE= 27
1.17 imil 2767:
1.103 wiz 2768: If the packaged software is a Python module, include one of ../../lang/python/
2769: egg.mk, ../../lang/python/distutils.mk, or ../../lang/python/extension.mk.
2770:
2771: Most Python packages use either "distutils" or easy-setup/setuptools ("eggs").
1.175 gutterid 2772: If the packaged software is using setuptools, you only need to include "../../
1.103 wiz 2773: lang/python/egg.mk". Otherwise, if the software uses "distutils", include "..
1.175 gutterid 2774: /../lang/python/distutils.mk", so pkgsrc will use this framework. "distutils"
2775: uses a script called setup.py; if the "distutils" driver is not called
1.103 wiz 2776: setup.py, set the PYSETUP variable to the name of the script.
2777:
2778: Either way, the package directory should be called "py-software" and PKGNAME
2779: should be set to "${PYPKGPREFIX}-${DISTNAME}", e.g.
1.17 imil 2780:
2781: DISTNAME= foopymodule-1.2.10
2782: PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
2783:
1.63 wiz 2784: If it is an application, include "../../lang/python/application.mk". In order
2785: to correctly set the path to the Python interpreter, use the REPLACE_PYTHON
2786: variable and set it to the list of files (paths relative to WRKSRC) that must
2787: be corrected. For example:
1.17 imil 2788:
1.63 wiz 2789: REPLACE_PYTHON= *.py
1.17 imil 2790:
1.63 wiz 2791: Some Python modules have separate distributions for Python-2.x and Python-3.x
2792: support. In pkgsrc this is handled by the versioned_dependencies.mk file. Set
2793: PYTHON_VERSIONED_DEPENDENCIES to the list of packages that should be depended
2794: upon and include "../../lang/python/versioned_dependencies.mk", then the pkgsrc
2795: infrastructure will depend on the appropriate package version. For example:
1.17 imil 2796:
1.135 wiz 2797: PYTHON_VERSIONED_DEPENDENCIES=dialog
1.63 wiz 2798:
2799: Look inside versioned_dependencies.mk for a list of supported packages.
1.17 imil 2800:
1.160 brook 2801: 12.1.3. R packages
2802:
2803: Simple R packages from CRAN are handled automatically by R2pkg, which is
2804: available in pkgtools/R2pkg. Individual packages (and optionally their
2805: dependencies) may be created and updated. R packages generally follow the same
2806: form, and most of the relevant information needed is contained in a DESCRIPTION
2807: file as part of each R package on CRAN. Consequently, R2pkg downloads that
2808: information and creates or updates a package in the canonical form. The
2809: resulting package should be reviewed for correctness.
2810:
2811: 12.1.4. TeXlive packages
2812:
2813: TeXlive packages from CTAN are handled automatically by texlive2pkg, which is
2814: available in pkgtools/texlive2pkg.
2815:
2816: If the TeXlive package name is not known, it may be useful to search CTAN. A "
2817: Contained in" field on the package page typically identifies the basename of
2818: the package file in the TeXlive archive.
2819:
2820: If the TeXlive package name is known, download the files from the TeXlive
2821: archive. For package foo, you will need to download foo.tar.xz. Most TeXlive
2822: packages also have associated documentation packages, so download
2823: foo.doc.tar.xz at the same time. These files should be placed in the
2824: appropriate category directory, which is often but not always print. Then run
2825: the following command in the category directory.
2826:
2827: texlive2pkg foo.tar.xz foo.doc.tar.xz
2828:
2829: This will create two packages, tex-foo and tex-foo-doc. Be sure to check that
2830: both packages are correct.
2831:
2832: Finally, CTAN currently does not include version information in package
2833: filenames and changes their contents periodically when updates occur.
2834: Consequently, pkgsrc avoids downloading distfiles directly from CTAN and
2835: instead relies on the pkgsrc archives. For each new or updated TeXlive package,
2836: e.g., the main one and the corresponding documentation, upload the distfiles
2837: with the following command in each package directory.
2838:
2839: make upload-distfiles
2840:
1.154 rillig 2841: 12.2. Examples
1.1 dsieger 2842:
1.154 rillig 2843: 12.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 2844:
1.154 rillig 2845: 12.2.1.1. The initial package
1.1 dsieger 2846:
2847: Looking at the file pkgsrc/doc/TODO, I saw that the "nvu" package has not yet
2848: been imported into pkgsrc. As the description says it has to do with the web,
2849: the obvious choice for the category is "www".
2850:
2851: $ mkdir www/nvu
2852: $ cd www/nvu
2853:
2854: The web site says that the sources are available as a tar file, so I fed that
2855: URL to the url2pkg program:
2856:
2857: $ url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
2858:
2859: My editor popped up, and I added a PKGNAME line below the DISTNAME line, as the
2860: package name should not have the word "sources" in it. I also filled in the
2861: MAINTAINER, HOMEPAGE and COMMENT fields. Then the package Makefile looked like
2862: that:
2863:
1.121 sevan 2864: # $NetBSD $
1.1 dsieger 2865: #
2866:
2867: DISTNAME= nvu-1.0-sources
2868: PKGNAME= nvu-1.0
2869: CATEGORIES= www
2870: MASTER_SITES= http://cvs.nvu.com/download/
2871: EXTRACT_SUFX= .tar.bz2
2872:
2873: MAINTAINER= rillig@NetBSD.org
2874: HOMEPAGE= http://cvs.nvu.com/
2875: COMMENT= Web Authoring System
2876:
2877: # url2pkg-marker (please do not remove this line.)
2878: .include "../../mk/bsd.pkg.mk"
2879:
1.124 wiz 2880: On the first line of output above, an artificial space has been added between
1.121 sevan 2881: NetBSD and $, this is a workaround to prevent CVS expanding to the filename of
2882: the guide.
2883:
1.1 dsieger 2884: Then, I quit the editor and watched pkgsrc downloading a large source archive:
2885:
2886: url2pkg> Running "make makesum" ...
2887: => Required installed package digest>=20010302: digest-20060826 found
2888: => Fetching nvu-1.0-sources.tar.bz2
2889: Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
2890: 100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA
2891: 29687976 bytes retrieved in 03:12 (150.77 KB/s)
2892: url2pkg> Running "make extract" ...
2893: => Required installed package digest>=20010302: digest-20060826 found
2894: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
2895: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
2896: work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc
2897: ===> Installing dependencies for nvu-1.0
2898: ===> Overriding tools for nvu-1.0
2899: ===> Extracting for nvu-1.0
2900: url2pkg> Adjusting the Makefile.
2901:
2902: Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
2903:
2904: Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
2905:
1.154 rillig 2906: 12.2.1.2. Fixing all kinds of problems to make the package work
1.1 dsieger 2907:
2908: Now that the package has been extracted, let's see what's inside it. The
2909: package has a README.txt, but that only says something about mozilla, so it's
2910: probably useless for seeing what dependencies this package has. But since there
2911: is a GNU configure script in the package, let's hope that it will complain
2912: about everything it needs.
2913:
2914: $ bmake
2915: => Required installed package digest>=20010302: digest-20060826 found
2916: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
2917: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
2918: ===> Patching for nvu-1.0
2919: ===> Creating toolchain wrappers for nvu-1.0
2920: ===> Configuring for nvu-1.0
2921: [...]
2922: configure: error: Perl 5.004 or higher is required.
2923: [...]
2924: WARNING: Please add USE_TOOLS+=perl to the package Makefile.
2925: [...]
2926:
2927: That worked quite well. So I opened the package Makefile in my editor, and
2928: since it already has a USE_TOOLS line, I just appended "perl" to it. Since the
2929: dependencies of the package have changed now, and since a perl wrapper is
2930: automatically installed in the "tools" phase, I need to build the package from
2931: scratch.
2932:
2933: $ bmake clean
2934: ===> Cleaning for nvu-1.0
2935: $ bmake
2936: [...]
2937: *** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
2938: GNU Make. You will not be able to build Mozilla without GNU Make.
2939: [...]
2940:
2941: So I added "gmake" to the USE_TOOLS line and tried again (from scratch).
2942:
2943: [...]
2944: checking for GTK - version >= 1.2.0... no
2945: *** Could not run GTK test program, checking why...
2946: [...]
2947:
2948: Now to the other dependencies. The first question is: Where is the GTK package
2949: hidden in pkgsrc?
2950:
2951: $ echo ../../*/gtk*
2952: [many packages ...]
2953: $ echo ../../*/gtk
2954: ../../x11/gtk
2955: $ echo ../../*/gtk2
2956: ../../x11/gtk2
2957: $ echo ../../*/gtk2/bui*
2958: ../../x11/gtk2/buildlink3.mk
2959:
2960: The first try was definitely too broad. The second one had exactly one result,
2961: which is very good. But there is one pitfall with GNOME packages. Before GNOME
2962: 2 had been released, there were already many GNOME 1 packages in pkgsrc. To be
2963: able to continue to use these packages, the GNOME 2 packages were imported as
2964: separate packages, and their names usually have a "2" appended. So I checked
2965: whether this was the case here, and indeed it was.
2966:
2967: Since the GTK2 package has a buildlink3.mk file, adding the dependency is very
2968: easy. I just inserted an .include line before the last line of the package
2969: Makefile, so that it now looks like this:
2970:
2971: [...]
2972: .include "../../x11/gtk2/buildlink3.mk"
2973: .include "../../mk/bsd.pkg.mk
2974:
2975: After another bmake clean && bmake, the answer was:
2976:
2977: [...]
2978: checking for gtk-config... /home/roland/pkg/bin/gtk-config
2979: checking for GTK - version >= 1.2.0... no
2980: *** Could not run GTK test program, checking why...
2981: *** The test program failed to compile or link. See the file config.log for the
2982: *** exact error that occured. This usually means GTK was incorrectly installed
2983: *** or that you have moved GTK since it was installed. In the latter case, you
2984: *** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
2985: configure: error: Test for GTK failed.
2986: [...]
2987:
2988: In this particular case, the assumption that "every package prefers GNOME 2"
2989: had been wrong. The first of the lines above told me that this package really
2990: wanted to have the GNOME 1 version of GTK. If the package had looked for GTK2,
2991: it would have looked for pkg-config instead of gtk-config. So I changed the x11
2992: /gtk2 to x11/gtk in the package Makefile, and tried again.
2993:
2994: [...]
1.59 jnemeth 2995: cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...]
1.1 dsieger 2996: In file included from xpidl.c:42:
2997: xpidl.h:53:24: libIDL/IDL.h: No such file or directory
2998: In file included from xpidl.c:42:
2999: xpidl.h:132: error: parse error before "IDL_ns"
3000: [...]
3001:
3002: The package still does not find all of its dependencies. Now the question is:
3003: Which package provides the libIDL/IDL.h header file?
3004:
3005: $ echo ../../*/*idl*
3006: ../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
3007: $ echo ../../*/*IDL*
3008: ../../net/libIDL
3009:
3010: Let's take the one from the second try. So I included the ../../net/libIDL/
3011: buildlink3.mk file and tried again. But the error didn't change. After digging
3012: through some of the code, I concluded that the build process of the package was
3013: broken and couldn't have ever worked, but since the Mozilla source tree is
3014: quite large, I didn't want to fix it. So I added the following to the package
3015: Makefile and tried again:
3016:
3017: CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
1.139 leot 3018: BUILDLINK_TRANSFORM+= l:IDL:IDL-2
1.1 dsieger 3019:
3020: The latter line is needed because the package expects the library libIDL.so,
3021: but only libIDL-2.so is available. So I told the compiler wrapper to rewrite
3022: that on the fly.
3023:
3024: The next problem was related to a recent change of the FreeType interface. I
3025: looked up in www/seamonkey which patch files were relevant for this issue and
3026: copied them to the patches directory. Then I retried, fixed the patches so that
3027: they applied cleanly and retried again. This time, everything worked.
3028:
1.154 rillig 3029: 12.2.1.3. Installing the package
1.1 dsieger 3030:
3031: $ bmake CHECK_FILES=no install
3032: [...]
3033: $ bmake print-PLIST >PLIST
3034: $ bmake deinstall
3035: $ bmake install
3036:
1.154 rillig 3037: Chapter 13. Package components - files, directories and contents
1.1 dsieger 3038:
3039: Table of Contents
3040:
1.154 rillig 3041: 13.1. Makefile
3042: 13.2. distinfo
3043: 13.3. patches/*
3044:
3045: 13.3.1. Structure of a single patch file
3046: 13.3.2. Creating patch files
3047: 13.3.3. Sources where the patch files come from
3048: 13.3.4. Patching guidelines
3049: 13.3.5. Feedback to the author
3050:
3051: 13.4. Other mandatory files
3052: 13.5. Optional files
3053:
3054: 13.5.1. Files affecting the binary package
3055: 13.5.2. Files affecting the build process
3056: 13.5.3. Files affecting nothing at all
1.1 dsieger 3057:
1.154 rillig 3058: 13.6. work*
3059: 13.7. files/*
1.1 dsieger 3060:
3061: Whenever you're preparing a package, there are a number of files involved which
3062: are described in the following sections.
3063:
1.154 rillig 3064: 13.1. Makefile
1.1 dsieger 3065:
3066: Building, installation and creation of a binary package are all controlled by
3067: the package's Makefile. The Makefile describes various things about a package,
3068: for example from where to get it, how to configure, build, and install it.
3069:
3070: A package Makefile contains several sections that describe the package.
3071:
3072: In the first section there are the following variables, which should appear
3073: exactly in the order given here. The order and grouping of the variables is
3074: mostly historical and has no further meaning.
3075:
3076: * DISTNAME is the basename of the distribution file to be downloaded from the
3077: package's website.
3078:
1.66 asau 3079: * PKGNAME is the name of the package, as used by pkgsrc. You need to provide
3080: it if DISTNAME (which is the default) is not a good name for the package in
3081: pkgsrc or DISTNAME is not provided (no distribution file is required).
3082: Usually it is the pkgsrc directory name together with the version number.
3083: It must match the regular expression ^[A-Za-z0-9][A-Za-z0-9-_.+]*$, that
3084: is, it starts with a letter or digit, and contains only letters, digits,
3085: dashes, underscores, dots and plus signs.
1.1 dsieger 3086:
3087: * CATEGORIES is a list of categories which the package fits in. You can
3088: choose any of the top-level directories of pkgsrc for it.
3089:
3090: Currently the following values are available for CATEGORIES. If more than
3091: one is used, they need to be separated by spaces:
3092:
3093: archivers cross geography meta-pkgs security
3094: audio databases graphics misc shells
3095: benchmarks devel ham multimedia sysutils
3096: biology editors inputmethod net textproc
3097: cad emulators lang news time
3098: chat finance mail parallel wm
3099: comms fonts math pkgtools www
3100: converters games mbone print x11
3101:
3102: * MASTER_SITES, DYNAMIC_MASTER_SITES, DIST_SUBDIR, EXTRACT_SUFX and DISTFILES
1.154 rillig 3103: are discussed in detail in Section 19.5, "The fetch phase".
1.1 dsieger 3104:
3105: The second section contains information about separately downloaded patches, if
3106: any.
3107:
3108: * PATCHFILES: Name(s) of additional files that contain distribution patches.
3109: There is no default. pkgsrc will look for them at PATCH_SITES. They will
3110: automatically be uncompressed before patching if the names end with .gz or
3111: .Z.
3112:
3113: * PATCH_SITES: Primary location(s) for distribution patch files (see
1.80 wiz 3114: PATCHFILES above) if not found locally.
3115:
3116: * PATCH_DIST_STRIP: an argument to patch(1) that sets the pathname strip
3117: count to help find the correct files to patch. It defaults to -p0.
1.1 dsieger 3118:
3119: The third section contains the following variables.
3120:
3121: * MAINTAINER is the email address of the person who feels responsible for
3122: this package, and who is most likely to look at problems or questions
3123: regarding this package which have been reported with send-pr(1). Other
1.14 jmcneill 3124: developers may contact the MAINTAINER before making changes to the package,
3125: but are not required to do so. When packaging a new program, set MAINTAINER
3126: to yourself. If you really can't maintain the package for future updates,
3127: set it to <pkgsrc-users@NetBSD.org>.
3128:
3129: * OWNER should be used instead of MAINTAINER when you do not want other
3130: developers to update or change the package without contacting you first. A
3131: package Makefile should contain one of MAINTAINER or OWNER, but not both.
1.1 dsieger 3132:
3133: * HOMEPAGE is a URL where users can find more information about the package.
3134:
3135: * COMMENT is a one-line description of the package (should not include the
3136: package name).
3137:
1.122 leot 3138: * LICENSE indicates the license(s) applicable for the package. See
1.154 rillig 3139: Section 21.1.3, "Handling licenses" for further details.
1.122 leot 3140:
1.1 dsieger 3141: Other variables that affect the build:
3142:
3143: * WRKSRC: The directory where the interesting distribution files of the
3144: package are found. The default is ${WRKDIR}/${DISTNAME}, which works for
3145: most packages.
3146:
3147: If a package doesn't create a subdirectory for itself (most GNU software
3148: does, for instance), but extracts itself in the current directory, you
3149: should set WRKSRC=${WRKDIR}.
3150:
3151: If a package doesn't create a subdirectory with the name of DISTNAME but
3152: some different name, set WRKSRC to point to the proper name in ${WRKDIR},
3153: for example WRKSRC=${WRKDIR}/${DISTNAME}/unix. See lang/tcl and x11/tk for
3154: other examples.
3155:
3156: The name of the working directory created by pkgsrc is taken from the
3157: WRKDIR_BASENAME variable. By default, its value is work. If you want to use
3158: the same pkgsrc tree for building different kinds of binary packages, you
3159: can change the variable according to your needs. Two other variables handle
3160: common cases of setting WRKDIR_BASENAME individually. If OBJHOSTNAME is
1.4 rillig 3161: defined in mk.conf, the first component of the host's name is attached to
3162: the directory name. If OBJMACHINE is defined, the platform name is
1.1 dsieger 3163: attached, which might look like work.i386 or work.sparc.
3164:
3165: Please pay attention to the following gotchas:
3166:
3167: * Add MANCOMPRESSED if man pages are installed in compressed form by the
3168: package. For packages using BSD-style makefiles which honor MANZ, there is
3169: MANCOMPRESSED_IF_MANZ.
3170:
3171: * Replace /usr/local with "${PREFIX}" in all files (see patches, below).
3172:
1.154 rillig 3173: * If the package installs any info files, see Section 21.6.7, "Packages
1.1 dsieger 3174: installing info files".
3175:
1.154 rillig 3176: 13.2. distinfo
1.1 dsieger 3177:
3178: The distinfo file contains the message digest, or checksum, of each distfile
3179: needed for the package. This ensures that the distfiles retrieved from the
3180: Internet have not been corrupted during transfer or altered by a malign force
1.108 rillig 3181: to introduce a security hole. To provide maximum security, all distfiles are
3182: protected using three different message digest algorithms (SHA1, RMD160,
3183: SHA512), as well as the file size.
1.1 dsieger 3184:
3185: The distinfo file also contains the checksums for all the patches found in the
1.154 rillig 3186: patches directory (see Section 13.3, "patches/*"). These checksums ensure that
1.145 leot 3187: patches are only applied intentionally and that they don't accidentally change,
3188: e.g. when merging different changes together. They also make sure that new
3189: patches are actually added to CVS and old ones are removed. Too see whether the
3190: patches and the distinfo file match, run pkglint after changing the patches.
1.1 dsieger 3191:
1.108 rillig 3192: To regenerate the distinfo file, use the make distinfo command.
1.1 dsieger 3193:
3194: Some packages have different sets of distfiles depending on the platform, for
1.24 wiz 3195: example lang/openjdk7. These are kept in the same distinfo file and care should
3196: be taken when upgrading such a package to ensure distfile information is not
3197: lost.
1.1 dsieger 3198:
1.154 rillig 3199: 13.3. patches/*
1.1 dsieger 3200:
1.108 rillig 3201: Some packages don't work out-of-the box on the various platforms that are
3202: supported by pkgsrc. These packages need to be patched to make them work. The
3203: patch files can be found in the patches/ directory.
1.1 dsieger 3204:
3205: In the patch phase, these patches are applied to the files in WRKSRC directory
1.25 wiz 3206: after extracting them, in alphabetic order.
1.1 dsieger 3207:
1.154 rillig 3208: 13.3.1. Structure of a single patch file
1.1 dsieger 3209:
3210: The patch-* files should be in diff -bu format, and apply without a fuzz to
3211: avoid problems. (To force patches to apply with fuzz you can set
3212: PATCH_FUZZ_FACTOR=-F2). Furthermore, each patch should contain only changes for
3213: a single file, and no file should be patched by more than one patch file. This
3214: helps to keep future modifications simple.
3215:
3216: Each patch file is structured as follows: In the first line, there is the RCS
3217: Id of the patch itself. The second line should be empty for aesthetic reasons.
3218: After that, there should be a comment for each change that the patch does.
3219: There are a number of standard cases:
3220:
3221: * Patches for commonly known vulnerabilities should mention the vulnerability
3222: ID (CAN, CVE).
3223:
3224: * Patches that change source code should mention the platform and other
3225: environment (for example, the compiler) that the patch is needed for.
3226:
1.108 rillig 3227: The patch should be commented so that any developer who knows the code of the
3228: application can make some use of the patch. Special care should be taken for
3229: the upstream developers, since we generally want that they accept our patches,
3230: so we have less work in the future.
1.1 dsieger 3231:
1.154 rillig 3232: 13.3.2. Creating patch files
1.1 dsieger 3233:
3234: One important thing to mention is to pay attention that no RCS IDs get stored
3235: in the patch files, as these will cause problems when later checked into the
3236: NetBSD CVS tree. Use the pkgdiff command from the pkgtools/pkgdiff package to
3237: avoid these problems.
3238:
3239: For even more automation, we recommend using mkpatches from the same package to
3240: make a whole set of patches. You just have to backup files before you edit them
1.25 wiz 3241: to filename.orig, e.g. with cp -p filename filename.orig or, easier, by using
1.1 dsieger 3242: pkgvi again from the same package. If you upgrade a package this way, you can
1.25 wiz 3243: easily compare the new set of patches with the previously existing one with
3244: patchdiff. The files in patches are replaced by new files, so carefully check
3245: if you want to take all the changes.
1.1 dsieger 3246:
3247: When you have finished a package, remember to generate the checksums for the
1.154 rillig 3248: patch files by using the make makepatchsum command, see Section 13.2,
1.1 dsieger 3249: "distinfo".
3250:
3251: When adding a patch that corrects a problem in the distfile (rather than e.g.
3252: enforcing pkgsrc's view of where man pages should go), send the patch as a bug
3253: report to the maintainer. This benefits non-pkgsrc users of the package, and
3254: usually makes it possible to remove the patch in future version.
3255:
1.25 wiz 3256: The file names of the patch files are usually of the form patch-
3257: path_to_file__with__underscores.c. Many packages still use the previous
3258: convention patch-[a-z][a-z], but new patches should be of the form containing
3259: the filename. mkpatches included in pkgtools/pkgdiff takes care of the name
3260: automatically.
1.2 rillig 3261:
1.154 rillig 3262: 13.3.3. Sources where the patch files come from
1.1 dsieger 3263:
3264: If you want to share patches between multiple packages in pkgsrc, e.g. because
3265: they use the same distfiles, set PATCHDIR to the path where the patch files can
3266: be found, e.g.:
3267:
1.159 rillig 3268: PATCHDIR= ../../editors/xemacs/patches
1.1 dsieger 3269:
3270: Patch files that are distributed by the author or other maintainers can be
3271: listed in PATCHFILES.
3272:
3273: If it is desired to store any patches that should not be committed into pkgsrc,
3274: they can be kept outside the pkgsrc tree in the $LOCALPATCHES directory. The
3275: directory tree there is expected to have the same "category/package" structure
3276: as pkgsrc, and patches are expected to be stored inside these dirs (also known
3277: as $LOCALPATCHES/$PKGPATH). For example, if you want to keep a private patch
3278: for pkgsrc/graphics/png, keep it in $LOCALPATCHES/graphics/png/mypatch. All
3279: files in the named directory are expected to be patch files, and they are
3280: applied after pkgsrc patches are applied.
3281:
1.154 rillig 3282: 13.3.4. Patching guidelines
1.1 dsieger 3283:
3284: When fixing a portability issue in the code do not use preprocessor magic to
3285: check for the current operating system nor platform. Doing so hurts portability
3286: to other platforms because the OS-specific details are not abstracted
3287: appropriately.
3288:
3289: The general rule to follow is: instead of checking for the operating system the
3290: application is being built on, check for the specific features you need. For
3291: example, instead of assuming that kqueue is available under NetBSD and using
3292: the __NetBSD__ macro to conditionalize kqueue support, add a check that detects
3293: kqueue itself ? yes, this generally involves patching the configure script.
3294: There is absolutely nothing that prevents some OSes from adopting interfaces
3295: from other OSes (e.g. Linux implementing kqueue), something that the above
3296: checks cannot take into account.
3297:
3298: Of course, checking for features generally involves more work on the
3299: developer's side, but the resulting changes are cleaner and there are chances
3300: they will work on many other platforms. Not to mention that there are higher
3301: chances of being later integrated into the mainstream sources. Remember: It
3302: doesn't work unless it is right!
3303:
3304: Some typical examples:
3305:
1.154 rillig 3306: Table 13.1. Patching examples
1.1 dsieger 3307:
3308: +-------------------------------------------------------------------------------------------+
3309: | Where | Incorrect | Correct |
3310: |---------+--------------------------+------------------------------------------------------|
3311: | |case ${target_os} in | |
3312: |configure|netbsd*) have_kvm=yes ;; |AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)|
3313: |script |*) have_kvm=no ;; | |
3314: | |esac | |
3315: |---------+--------------------------+------------------------------------------------------|
1.2 rillig 3316: |C source |#if defined(__NetBSD__) |#if defined(HAVE_SYS_EVENT_H) |
3317: |file |# include <sys/event.h> |# include <sys/event.h> |
3318: | |#endif |#endif |
1.1 dsieger 3319: |---------+--------------------------+------------------------------------------------------|
3320: | |int |int |
3321: | |monitor_file(...) |monitor_file(...) |
3322: | |{ |{ |
3323: | |#if defined(__NetBSD__) |#if defined(HAVE_KQUEUE) |
3324: |C source | int fd = kqueue();| int fd = kqueue(); |
3325: |file | ... | ... |
3326: | |#else |#else |
3327: | | ... | ... |
3328: | |#endif |#endif |
3329: | |} |} |
3330: +-------------------------------------------------------------------------------------------+
3331:
3332:
1.154 rillig 3333: 13.3.5. Feedback to the author
1.1 dsieger 3334:
3335: Always, always, always feed back any portability fixes or improvements you do
3336: to a package to the mainstream developers. This is the only way to get their
3337: attention on portability issues and to ensure that future versions can be built
3338: out-of-the box on NetBSD. Furthermore, any user that gets newer distfiles will
3339: get the fixes straight from the packaged code.
3340:
3341: This generally involves cleaning up the patches (because sometimes the patches
1.41 wiz 3342: that are added to pkgsrc are quick hacks), filing bug reports in the
1.1 dsieger 3343: appropriate trackers for the projects and working with the mainstream authors
3344: to accept your changes. It is extremely important that you do it so that the
3345: packages in pkgsrc are kept simple and thus further changes can be done without
3346: much hassle.
3347:
1.25 wiz 3348: When you have done this, please add a URL to the upstream bug report to the
3349: patch comment.
3350:
1.1 dsieger 3351: Support the idea of free software!
3352:
1.154 rillig 3353: 13.4. Other mandatory files
1.1 dsieger 3354:
3355: DESCR
3356:
3357: A multi-line description of the piece of software. This should include any
3358: credits where they are due. Please bear in mind that others do not share
3359: your sense of humour (or spelling idiosyncrasies), and that others will
3360: read everything that you write here.
3361:
3362: PLIST
3363:
3364: This file governs the files that are installed on your system: all the
3365: binaries, manual pages, etc. There are other directives which may be
3366: entered in this file, to control the creation and deletion of directories,
1.154 rillig 3367: and the location of inserted files. See Chapter 15, PLIST issues for more
1.1 dsieger 3368: information.
3369:
1.154 rillig 3370: 13.5. Optional files
1.1 dsieger 3371:
1.154 rillig 3372: 13.5.1. Files affecting the binary package
1.1 dsieger 3373:
3374: INSTALL
3375:
3376: This shell script is invoked twice by pkg_add(1). First time after package
3377: extraction and before files are moved in place, the second time after the
3378: files to install are moved in place. This can be used to do any custom
3379: procedures not possible with @exec commands in PLIST. See pkg_add(1) and
1.154 rillig 3380: pkg_create(1) for more information. See also Section 17.1, "Files and
1.29 wiz 3381: directories outside the installation prefix". Please note that you can
3382: modify variables in it easily by using FILES_SUBST in the package's
3383: Makefile:
3384:
3385: FILES_SUBST+= SOMEVAR="somevalue"
3386:
3387: replaces "@SOMEVAR@" with "somevalue" in the INSTALL. By default,
3388: substitution is performed for PREFIX, LOCALBASE, X11BASE, VARBASE, and a
3389: few others, type make help topic=FILES_SUBST for a complete list.
1.1 dsieger 3390:
3391: DEINSTALL
3392:
3393: This script is executed before and after any files are removed. It is this
3394: script's responsibility to clean up any additional messy details around the
3395: package's installation, since all pkg_delete knows is how to delete the
3396: files created in the original distribution. See pkg_delete(1) and
1.29 wiz 3397: pkg_create(1) for more information. The same methods to replace variables
3398: can be used as for the INSTALL file.
1.1 dsieger 3399:
3400: MESSAGE
3401:
3402: This file is displayed after installation of the package. Useful for things
3403: like legal notices on almost-free software and hints for updating config
3404: files after installing modules for apache, PHP etc. Please note that you
3405: can modify variables in it easily by using MESSAGE_SUBST in the package's
3406: Makefile:
3407:
3408: MESSAGE_SUBST+= SOMEVAR="somevalue"
3409:
3410: replaces "${SOMEVAR}" with "somevalue" in MESSAGE. By default, substitution
1.99 sevan 3411: is performed for PKGNAME, PKGBASE, PREFIX, LOCALBASE, X11BASE,
1.16 jnemeth 3412: PKG_SYSCONFDIR, ROOT_GROUP, and ROOT_USER.
1.1 dsieger 3413:
3414: You can display a different or additional files by setting the MESSAGE_SRC
3415: variable. Its default is MESSAGE, if the file exists.
3416:
3417: ALTERNATIVES
3418:
1.66 asau 3419: This file is used by the alternatives framework. It creates, configures,
3420: and destroys generic wrappers used to run programs with similar interfaces.
3421: See pkg_alternatives(8) from pkgtools/pkg_alternatives for more
3422: information.
3423:
3424: Each line of the file contains two filenames, first the wrapper and then
3425: the alternative provided by the package. Both paths are relative to PREFIX.
1.1 dsieger 3426:
1.154 rillig 3427: 13.5.2. Files affecting the build process
1.1 dsieger 3428:
3429: Makefile.common
3430:
3431: This file contains arbitrary things that could also go into a Makefile, but
3432: its purpose is to be used by more than one package. This file should only
3433: be used when the packages that will use the file are known in advance. For
3434: other purposes it is often better to write a *.mk file and give it a good
3435: name that describes what it does.
3436:
3437: buildlink3.mk
3438:
3439: This file contains the dependency information for the buildlink3 framework
1.154 rillig 3440: (see Chapter 16, Buildlink methodology).
1.1 dsieger 3441:
3442: hacks.mk
3443:
3444: This file contains workarounds for compiler bugs and similar things. It is
3445: included automatically by the pkgsrc infrastructure, so you don't need an
3446: extra .include line for it.
3447:
3448: options.mk
3449:
3450: This file contains the code for the package-specific options (see
1.154 rillig 3451: Chapter 18, Options handling) that can be selected by the user. If a
1.1 dsieger 3452: package has only one or two options, it is equally acceptable to put the
3453: code directly into the Makefile.
3454:
1.154 rillig 3455: 13.5.3. Files affecting nothing at all
1.1 dsieger 3456:
3457: README*
3458:
3459: These files do not take place in the creation of a package and thus are
3460: purely informative to the package developer.
3461:
3462: TODO
3463:
3464: This file contains things that need to be done to make the package even
3465: better.
3466:
1.154 rillig 3467: 13.6. work*
1.1 dsieger 3468:
3469: When you type make, the distribution files are unpacked into the directory
3470: denoted by WRKDIR. It can be removed by running make clean. Besides the
3471: sources, this directory is also used to keep various timestamp files. The
3472: directory gets removed completely on clean. The default is ${.CURDIR}/work or $
3473: {.CURDIR}/work.${MACHINE_ARCH} if OBJMACHINE is set.
3474:
1.154 rillig 3475: 13.7. files/*
1.1 dsieger 3476:
3477: If you have any files that you wish to be placed in the package prior to
1.172 rillig 3478: configuration or building, you can place these files here and use a ${CP}
3479: command in the "post-extract" target to achieve this.
1.1 dsieger 3480:
3481: If you want to share files in this way with other packages, set the FILESDIR
3482: variable to point to the other package's files directory, e.g.:
3483:
1.159 rillig 3484: FILESDIR= ../../editors/xemacs/files
1.1 dsieger 3485:
1.154 rillig 3486: Chapter 14. Programming in Makefiles
1.1 dsieger 3487:
3488: Table of Contents
3489:
1.154 rillig 3490: 14.1. Caveats
3491: 14.2. Makefile variables
1.1 dsieger 3492:
1.154 rillig 3493: 14.2.1. Naming conventions
1.1 dsieger 3494:
1.154 rillig 3495: 14.3. Code snippets
1.1 dsieger 3496:
1.154 rillig 3497: 14.3.1. Adding things to a list
3498: 14.3.2. Echoing a string exactly as-is
3499: 14.3.3. Passing CFLAGS to GNU configure scripts
3500: 14.3.4. Handling possibly empty variables
1.1 dsieger 3501:
3502: Pkgsrc consists of many Makefile fragments, each of which forms a well-defined
3503: part of the pkgsrc system. Using the make(1) system as a programming language
3504: for a big system like pkgsrc requires some discipline to keep the code correct
3505: and understandable.
3506:
1.154 rillig 3507: The basic ingredients for Makefile programming are variables and shell
3508: commands. Among these shell commands may even be more complex ones like awk(1)
3509: programs. To make sure that every shell command runs as intended it is
3510: necessary to quote all variables correctly when they are used.
1.1 dsieger 3511:
1.154 rillig 3512: This chapter describes some patterns that appear quite often in Makefiles,
1.1 dsieger 3513: including the pitfalls that come along with them.
3514:
1.154 rillig 3515: 14.1. Caveats
1.1 dsieger 3516:
3517: * When you are creating a file as a target of a rule, always write the data
3518: to a temporary file first and finally rename that file. Otherwise there
3519: might occur an error in the middle of generating the file, and when the
3520: user runs make(1) for the second time, the file exists and will not be
3521: regenerated properly. Example:
3522:
3523: wrong:
3524: @echo "line 1" > ${.TARGET}
3525: @echo "line 2" >> ${.TARGET}
3526: @false
3527:
3528: correct:
3529: @echo "line 1" > ${.TARGET}.tmp
3530: @echo "line 2" >> ${.TARGET}.tmp
3531: @false
3532: @mv ${.TARGET}.tmp ${.TARGET}
3533:
3534: When you run make wrong twice, the file wrong will exist, although there
3535: was an error message in the first run. On the other hand, running make
3536: correct gives an error message twice, as expected.
3537:
3538: You might remember that make(1) sometimes removes ${.TARGET} in case of
3539: error, but this only happens when it is interrupted, for example by
1.154 rillig 3540: pressing Ctrl+C. This does not happen when one of the commands fails (like
1.1 dsieger 3541: false(1) above).
3542:
1.154 rillig 3543: 14.2. Makefile variables
1.1 dsieger 3544:
3545: Makefile variables contain strings that can be processed using the five
1.154 rillig 3546: operators =, +=, ?=, := and !=, which are described in the make(1) man page.
1.1 dsieger 3547:
1.154 rillig 3548: When a variable's value is parsed from a Makefile, the hash character # and the
3549: backslash character \ are handled specially. If a backslash is the last
3550: character in a line, that backslash is removed from the line and the line
3551: continues with the next line of the file.
3552:
3553: The # character starts a comment that reaches until the end of the line. To get
3554: an actual # character, such as in a URL, write \# instead.
1.1 dsieger 3555:
1.108 rillig 3556: The evaluation of variables either happens immediately or lazy. It happens
1.154 rillig 3557: immediately when the variable occurs on the right-hand side of the := or the !=
3558: operator, in a .if condition or a .for loop. In the other cases, it is
3559: evaluated lazily.
1.1 dsieger 3560:
3561: Some of the modifiers split the string into words and then operate on the
3562: words, others operate on the string as a whole. When a string is split into
1.154 rillig 3563: words, double quotes and single quotes are interpreted as delimiters, just like
3564: in sh(1).
1.1 dsieger 3565:
1.154 rillig 3566: 14.2.1. Naming conventions
1.1 dsieger 3567:
3568: * All variable names starting with an underscore are reserved for use by the
1.154 rillig 3569: pkgsrc infrastructure. They shall not be used by packages.
1.1 dsieger 3570:
3571: * In .for loops you should use lowercase variable names for the iteration
3572: variables.
3573:
1.154 rillig 3574: * All list variables should have a plural name, such as PKG_OPTIONS or
1.1 dsieger 3575: DISTFILES.
3576:
1.154 rillig 3577: 14.3. Code snippets
1.1 dsieger 3578:
1.154 rillig 3579: 14.3.1. Adding things to a list
1.108 rillig 3580:
3581: When adding a string that possibly contains whitespace or quotes to a list
3582: (example 1), it must be quoted using the :Q modifier.
1.1 dsieger 3583:
1.108 rillig 3584: When adding another list to a list (example 2), it must not be quoted, since
3585: its elements are already quoted.
1.1 dsieger 3586:
1.108 rillig 3587: STRING= foo * bar `date`
3588: LIST= # empty
3589: ANOTHER_LIST= a=b c=d
1.1 dsieger 3590:
1.108 rillig 3591: LIST+= ${STRING:Q} # 1
3592: LIST+= ${ANOTHER_LIST} # 2
1.1 dsieger 3593:
1.154 rillig 3594: 14.3.2. Echoing a string exactly as-is
1.1 dsieger 3595:
1.108 rillig 3596: Echoing a string containing special characters needs special work.
1.1 dsieger 3597:
3598: STRING= foo bar < > * `date` $$HOME ' "
1.108 rillig 3599: EXAMPLE_ENV= string=${STRING:Q} x=multiple\ quoted\ words
1.1 dsieger 3600:
3601: all:
3602: echo ${STRING} # 1
1.108 rillig 3603: echo ${STRING:Q} # 2
3604: printf '%s\n' ${STRING:Q}'' # 3
3605: env ${EXAMPLE_ENV} sh -c 'echo "$$string"; echo "$$x"' # 4
1.1 dsieger 3606:
3607: Example 1 leads to a syntax error in the shell, as the characters are just
3608: copied.
3609:
1.108 rillig 3610: Example 2 quotes the string so that the shell interprets it correctly. But the
3611: echo command may additionally interpret strings with a leading dash or those
3612: containing backslashes.
3613:
3614: Example 3 can handle arbitrary strings, since printf(1) only interprets the
1.139 leot 3615: format string, but not the next argument. The trailing single quotes handle the
3616: case when the string is empty. In that case, the :Q modifier would result in an
3617: empty string too, which would then be skipped by the shell. For printf(1) this
3618: doesn't make a difference, but other programs may care.
1.108 rillig 3619:
3620: In example 4, the EXAMPLE_ENV does not need to be quoted because the quoting
3621: has already been done when adding elements to the list.
3622:
1.154 rillig 3623: 14.3.3. Passing CFLAGS to GNU configure scripts
1.108 rillig 3624:
3625: When passing CFLAGS or similar variables to a GNU-style configure script
3626: (especially those that call other configure scripts), it must not have leading
3627: or trailing whitespace, since otherwise the configure script gets confused. To
3628: trim leading and trailing whitespace, use the :M modifier, as in the following
3629: example:
3630:
3631: CPPFLAGS= # empty
3632: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX}\"
3633: CPPFLAGS+= ${MY_CPPFLAGS}
3634:
3635: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
3636:
3637: all:
3638: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
3639: echo x${CONFIGURE_ARGS:Q}x # properly trimmed
3640:
3641: In this example, CPPFLAGS has both leading and trailing whitespace because the
3642: += operator always adds a space.
3643:
1.154 rillig 3644: 14.3.4. Handling possibly empty variables
1.108 rillig 3645:
3646: When a possibly empty variable is used in a shell program, it may lead to a
3647: syntax error.
3648:
3649: EGFILES= # empty
3650:
3651: install-examples: # produces a syntax error in the shell
3652: for egfile in ${EGFILES}; do \
3653: echo "Installing $$egfile"; \
3654: done
3655:
3656: The shell only sees the text for egfile in ; do, since ${EGFILES} is replaced
3657: with an empty string by make(1). To fix this syntax error, use one of the
3658: snippets below.
3659:
3660: EMPTY= # empty
3661:
3662: install-examples:
3663: for egfile in ${EGFILES} ""; do \
3664: [ -n "$$egfile" ] || continue; \
3665: echo "Installing $$egfile"; \
3666: done
3667:
3668: In this case, an empty string is appended to the iteration list (to prevent the
3669: syntax error) and filtered out later.
1.1 dsieger 3670:
1.108 rillig 3671: EGFILES= # empty
1.1 dsieger 3672:
1.108 rillig 3673: install-examples:
3674: .for egfile in ${EGFILES}
3675: echo "Installing ${egfile}"
3676: .endfor
3677:
1.154 rillig 3678: If one of the filenames contains special characters, it should be enclosed in
3679: single or double quotes.
1.108 rillig 3680:
3681: To have a shell command test whether a make variable is empty, use the
3682: following code: ${TEST} -z ${POSSIBLY_EMPTY:Q}"".
1.1 dsieger 3683:
1.154 rillig 3684: Chapter 15. PLIST issues
1.1 dsieger 3685:
3686: Table of Contents
3687:
1.154 rillig 3688: 15.1. RCS ID
3689: 15.2. Semi-automatic PLIST generation
3690: 15.3. Tweaking output of make print-PLIST
3691: 15.4. Variable substitution in PLIST
3692: 15.5. Man page compression
3693: 15.6. Changing PLIST source with PLIST_SRC
3694: 15.7. Platform-specific and differing PLISTs
3695: 15.8. Build-specific PLISTs
3696: 15.9. Sharing directories between packages
1.1 dsieger 3697:
3698: The PLIST file contains a package's "packing list", i.e. a list of files that
3699: belong to the package (relative to the ${PREFIX} directory it's been installed
3700: in) plus some additional statements - see the pkg_create(1) man page for a full
3701: list. This chapter addresses some issues that need attention when dealing with
3702: the PLIST file (or files, see below!).
3703:
1.154 rillig 3704: 15.1. RCS ID
1.1 dsieger 3705:
3706: Be sure to add a RCS ID line as the first thing in any PLIST file you write:
3707:
1.121 sevan 3708: @comment $NetBSD $
3709:
1.123 wiz 3710: An artificial space has been added between NetBSD and $, this is a workaround
1.121 sevan 3711: here to prevent CVS expanding to the filename of the guide. When adding the RCS
1.125 leot 3712: ID the space should be omitted.
1.1 dsieger 3713:
1.154 rillig 3714: 15.2. Semi-automatic PLIST generation
1.1 dsieger 3715:
3716: You can use the make print-PLIST command to output a PLIST that matches any new
1.154 rillig 3717: files since the package was extracted. See Section 19.17, "Other helpful
1.1 dsieger 3718: targets" for more information on this target.
3719:
1.154 rillig 3720: 15.3. Tweaking output of make print-PLIST
1.1 dsieger 3721:
3722: The PRINT_PLIST_AWK variable takes a set of AWK patterns and actions that are
3723: used to filter the output of print-PLIST. You can append any chunk of AWK
3724: scripting you like to it, but be careful with quoting.
3725:
3726: For example, to get all files inside the libdata/foo directory removed from the
3727: resulting PLIST:
3728:
3729: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
3730:
1.154 rillig 3731: 15.4. Variable substitution in PLIST
1.1 dsieger 3732:
3733: A number of variables are substituted automatically in PLISTs when a package is
3734: installed on a system. This includes the following variables:
3735:
3736: ${MACHINE_ARCH}, ${MACHINE_GNU_ARCH}
3737:
3738: Some packages like emacs and perl embed information about which
3739: architecture they were built on into the pathnames where they install their
3740: files. To handle this case, PLIST will be preprocessed before actually
3741: used, and the symbol "${MACHINE_ARCH}" will be replaced by what uname -p
3742: gives. The same is done if the string ${MACHINE_GNU_ARCH} is embedded in
3743: PLIST somewhere - use this on packages that have GNU autoconf-created
3744: configure scripts.
3745:
3746: Legacy note
3747:
3748: There used to be a symbol "$ARCH" that was replaced by the output of uname
3749: -m, but that's no longer supported and has been removed.
3750:
3751: ${OPSYS}, ${LOWER_OPSYS}, ${OS_VERSION}
3752:
3753: Some packages want to embed the OS name and version into some paths. To do
3754: this, use these variables in the PLIST:
3755:
1.42 asau 3756: + ${OPSYS} - output of "uname -s"
1.1 dsieger 3757:
1.42 asau 3758: + ${LOWER_OPSYS} - lowercase common name (eg. "solaris")
1.1 dsieger 3759:
1.42 asau 3760: + ${OS_VERSION} - "uname -r"
1.1 dsieger 3761:
1.88 tnn 3762: For a list of values which are replaced by default, the output of make help
3763: topic=PLIST_SUBST as well as searching the pkgsrc/mk directory with grep for
3764: PLIST_SUBST should help.
1.1 dsieger 3765:
3766: If you want to change other variables not listed above, you can add variables
3767: and their expansions to this variable in the following way, similar to
1.154 rillig 3768: MESSAGE_SUBST (see Section 13.5, "Optional files"):
1.1 dsieger 3769:
3770: PLIST_SUBST+= SOMEVAR="somevalue"
3771:
3772: This replaces all occurrences of "${SOMEVAR}" in the PLIST with "somevalue".
3773:
1.19 snj 3774: The PLIST_VARS variable can be used to simplify the common case of
3775: conditionally including some PLIST entries. It can be done by adding
3776: PLIST_VARS+=foo and setting the corresponding PLIST.foo variable to yes if the
3777: entry should be included. This will substitute "${PLIST.foo}" in the PLIST with
3778: either """" or ""@comment "". For example, in Makefile:
1.18 mishka 3779:
3780: PLIST_VARS+= foo
3781: .if condition
3782: PLIST.foo= yes
3783: .else
3784:
3785: And then in PLIST:
3786:
1.121 sevan 3787: @comment $NetBSD $
1.18 mishka 3788: bin/bar
3789: man/man1/bar.1
3790: ${PLIST.foo}bin/foo
3791: ${PLIST.foo}man/man1/foo.1
3792: ${PLIST.foo}share/bar/foo.data
3793:
1.123 wiz 3794: An artificial space has been added between NetBSD and $, this is a workaround
1.121 sevan 3795: here to prevent CVS expanding to the filename of the guide. When adding the RCS
3796: ID the space should be ommited.
3797:
1.154 rillig 3798: 15.5. Man page compression
1.1 dsieger 3799:
3800: Man pages should be installed in compressed form if MANZ is set (in
3801: bsd.own.mk), and uncompressed otherwise. To handle this in the PLIST file, the
3802: suffix ".gz" is appended/removed automatically for man pages according to MANZ
3803: and MANCOMPRESSED being set or not, see above for details. This modification of
3804: the PLIST file is done on a copy of it, not PLIST itself.
3805:
1.154 rillig 3806: 15.6. Changing PLIST source with PLIST_SRC
1.1 dsieger 3807:
3808: To use one or more files as source for the PLIST used in generating the binary
3809: package, set the variable PLIST_SRC to the names of that file(s). The files are
3810: later concatenated using cat(1), and the order of things is important. The
3811: default for PLIST_SRC is ${PKGDIR}/PLIST.
3812:
1.154 rillig 3813: 15.7. Platform-specific and differing PLISTs
1.1 dsieger 3814:
3815: Some packages decide to install a different set of files based on the operating
3816: system being used. These differences can be automatically handled by using the
3817: following files:
3818:
3819: * PLIST.common
3820:
3821: * PLIST.${OPSYS}
3822:
3823: * PLIST.${MACHINE_ARCH}
3824:
3825: * PLIST.${OPSYS}-${MACHINE_ARCH}
3826:
3827: * PLIST.common_end
3828:
1.154 rillig 3829: 15.8. Build-specific PLISTs
1.86 wiz 3830:
3831: Some packages decide to generate hard-to-guess file names during installation
3832: that are hard to wire down.
3833:
3834: In such cases, you can set the GENERATE_PLIST variable to shell code terminated
3835: (with a semicolon) that will output PLIST entries which will be appended to the
3836: PLIST
3837:
3838: You can find one example in editors/xemacs:
3839:
1.111 sevan 3840: GENERATE_PLIST+= ${ECHO} bin/${DISTNAME}-`${WRKSRC}/src/xemacs -sd`.dmp ;
1.86 wiz 3841:
3842: which will append something like bin/xemacs-21.4.23-54e8ea71.dmp to the PLIST.
3843:
1.154 rillig 3844: 15.9. Sharing directories between packages
1.1 dsieger 3845:
3846: A "shared directory" is a directory where multiple (and unrelated) packages
1.23 jakllsch 3847: install files. These directories were problematic because you had to add
1.1 dsieger 3848: special tricks in the PLIST to conditionally remove them, or have some
3849: centralized package handle them.
3850:
1.23 jakllsch 3851: In pkgsrc, it is now easy: Each package should create directories and install
3852: files as needed; pkg_delete will remove any directories left empty after
3853: uninstalling a package.
1.1 dsieger 3854:
1.23 jakllsch 3855: If a package needs an empty directory to work, create the directory during
3856: installation as usual, and also add an entry to the PLIST:
1.1 dsieger 3857:
1.23 jakllsch 3858: @pkgdir path/to/empty/directory
1.1 dsieger 3859:
1.86 wiz 3860: or take a look at MAKE_DIRS and OWN_DIRS.
3861:
1.154 rillig 3862: Chapter 16. Buildlink methodology
1.1 dsieger 3863:
3864: Table of Contents
3865:
1.154 rillig 3866: 16.1. Converting packages to use buildlink3
3867: 16.2. Writing buildlink3.mk files
1.1 dsieger 3868:
1.154 rillig 3869: 16.2.1. Anatomy of a buildlink3.mk file
3870: 16.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
1.27 wiz 3871: buildlink3.mk files
1.1 dsieger 3872:
1.154 rillig 3873: 16.3. Writing builtin.mk files
1.1 dsieger 3874:
1.154 rillig 3875: 16.3.1. Anatomy of a builtin.mk file
3876: 16.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 3877:
3878: Buildlink is a framework in pkgsrc that controls what headers and libraries are
3879: seen by a package's configure and build processes. This is implemented in a two
3880: step process:
3881:
3882: 1. Symlink headers and libraries for dependencies into BUILDLINK_DIR, which by
3883: default is a subdirectory of WRKDIR.
3884:
3885: 2. Create wrapper scripts that are used in place of the normal compiler tools
3886: that translate -I${LOCALBASE}/include and -L${LOCALBASE}/lib into
3887: references to BUILDLINK_DIR. The wrapper scripts also make native compiler
3888: on some operating systems look like GCC, so that packages that expect GCC
3889: won't require modifications to build with those native compilers.
3890:
3891: This normalizes the environment in which a package is built so that the package
3892: may be built consistently despite what other software may be installed. Please
3893: note that the normal system header and library paths, e.g. /usr/include, /usr/
3894: lib, etc., are always searched -- buildlink3 is designed to insulate the
3895: package build from non-system-supplied software.
3896:
1.154 rillig 3897: 16.1. Converting packages to use buildlink3
1.1 dsieger 3898:
1.25 wiz 3899: The process of converting packages to use the buildlink3 framework ("bl3ifying"
3900: ) is fairly straightforward. The things to keep in mind are:
1.1 dsieger 3901:
3902: 1. Ensure that the build always calls the wrapper scripts instead of the
3903: actual toolchain. Some packages are tricky, and the only way to know for
3904: sure is the check ${WRKDIR}/.work.log to see if the wrappers are being
3905: invoked.
3906:
3907: 2. Don't override PREFIX from within the package Makefile, e.g. Java VMs,
3908: standalone shells, etc., because the code to symlink files into $
3909: {BUILDLINK_DIR} looks for files relative to "pkg_info -qp pkgname".
3910:
3911: 3. Remember that only the buildlink3.mk files that you list in a package's
3912: Makefile are added as dependencies for that package.
3913:
3914: If a dependency on a particular package is required for its libraries and
3915: headers, then we replace:
3916:
3917: DEPENDS+= foo>=1.1.0:../../category/foo
3918:
3919: with
3920:
3921: .include "../../category/foo/buildlink3.mk"
3922:
3923: The buildlink3.mk files usually define the required dependencies. If you need a
3924: newer version of the dependency when using buildlink3.mk files, then you can
3925: define it in your Makefile; for example:
3926:
3927: BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0
3928: .include "../../category/foo/buildlink3.mk"
3929:
3930: There are several buildlink3.mk files in pkgsrc/mk that handle special package
3931: issues:
3932:
3933: * bdb.buildlink3.mk chooses either the native or a pkgsrc Berkeley DB
3934: implementation based on the values of BDB_ACCEPTED and BDB_DEFAULT.
3935:
3936: * curses.buildlink3.mk: If the system comes with neither Curses nor NCurses,
3937: this will take care to install the devel/ncurses package.
3938:
3939: * krb5.buildlink3.mk uses the value of KRB5_ACCEPTED to choose between adding
3940: a dependency on Heimdal or MIT-krb5 for packages that require a Kerberos 5
3941: implementation.
3942:
3943: * motif.buildlink3.mk checks for a system-provided Motif installation or adds
1.126 leot 3944: a dependency on x11/lesstif or x11/motif. The user can set MOTIF_TYPE to "
3945: dt", "lesstif" or "motif" to choose which Motif version will be used.
1.1 dsieger 3946:
1.57 wiz 3947: * readline.buildlink3.mk checks for a system-provided GNU readline or
3948: editline (libedit) installation, or adds a dependency on devel/readline,
3949: devel/editline. The user can set READLINE_DEFAULT to choose readline
1.56 ryoon 3950: implementation. If your package really needs GNU readline library, its
3951: Makefile should include devel/readline/buildlink3.mk instead of
3952: readline.buildlink3.mk.
3953:
1.1 dsieger 3954: * oss.buildlink3.mk defines several variables that may be used by packages
3955: that use the Open Sound System (OSS) API.
3956:
1.36 wiz 3957: * pgsql.buildlink3.mk will accept any of the Postgres versions in the
3958: variable PGSQL_VERSIONS_ACCEPTED and default to the version
3959: PGSQL_VERSION_DEFAULT. See the file for more information.
1.1 dsieger 3960:
3961: * pthread.buildlink3.mk uses the value of PTHREAD_OPTS and checks for native
3962: pthreads or adds a dependency on devel/pth as needed.
3963:
3964: * xaw.buildlink3.mk uses the value of XAW_TYPE to choose a particular Athena
3965: widgets library.
3966:
3967: The comments in those buildlink3.mk files provide a more complete description
3968: of how to use them properly.
3969:
1.154 rillig 3970: 16.2. Writing buildlink3.mk files
1.1 dsieger 3971:
3972: A package's buildlink3.mk file is included by Makefiles to indicate the need to
3973: compile and link against header files and libraries provided by the package. A
3974: buildlink3.mk file should always provide enough information to add the correct
3975: type of dependency relationship and include any other buildlink3.mk files that
3976: it needs to find headers and libraries that it needs in turn.
3977:
3978: To generate an initial buildlink3.mk file for further editing, Rene Hexel's
3979: pkgtools/createbuildlink package is highly recommended. For most packages, the
3980: following command will generate a good starting point for buildlink3.mk files:
3981:
3982: % cd pkgsrc/category/pkgdir
3983: % createbuildlink >buildlink3.mk
3984:
3985:
1.154 rillig 3986: 16.2.1. Anatomy of a buildlink3.mk file
1.1 dsieger 3987:
3988: The following real-life example buildlink3.mk is taken from pkgsrc/graphics/
3989: tiff:
3990:
1.19 snj 3991: # $NetBSD: buildlink3.mk,v 1.16 2009/03/20 19:24:45 joerg Exp $
1.1 dsieger 3992:
1.19 snj 3993: BUILDLINK_TREE+= tiff
1.1 dsieger 3994:
1.19 snj 3995: .if !defined(TIFF_BUILDLINK3_MK)
3996: TIFF_BUILDLINK3_MK:=
1.1 dsieger 3997:
1.19 snj 3998: BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1
3999: BUILDLINK_ABI_DEPENDS.tiff+= tiff>=3.7.2nb1
1.1 dsieger 4000: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
4001:
4002: .include "../../devel/zlib/buildlink3.mk"
4003: .include "../../graphics/jpeg/buildlink3.mk"
1.19 snj 4004: .endif # TIFF_BUILDLINK3_MK
1.1 dsieger 4005:
1.19 snj 4006: BUILDLINK_TREE+= -tiff
1.1 dsieger 4007:
1.19 snj 4008: The header and footer manipulate BUILDLINK_TREE, which is common across all
4009: buildlink3.mk files and is used to track the dependency tree.
1.1 dsieger 4010:
1.19 snj 4011: The main section is protected from multiple inclusion and controls how the
1.1 dsieger 4012: dependency on pkg is added. Several important variables are set in the section:
4013:
4014: * BUILDLINK_API_DEPENDS.pkg is the actual dependency recorded in the
4015: installed package; this should always be set using += to ensure that we're
4016: appending to any pre-existing list of values. This variable should be set
1.27 wiz 4017: to the first version of the package that had an backwards-incompatible API
4018: change.
1.1 dsieger 4019:
4020: * BUILDLINK_PKGSRCDIR.pkg is the location of the pkg pkgsrc directory.
4021:
4022: * BUILDLINK_DEPMETHOD.pkg (not shown above) controls whether we use
4023: BUILD_DEPENDS or DEPENDS to add the dependency on pkg. The build dependency
4024: is selected by setting BUILDLINK_DEPMETHOD.pkg to "build". By default, the
4025: full dependency is used.
4026:
4027: * BUILDLINK_INCDIRS.pkg and BUILDLINK_LIBDIRS.pkg (not shown above) are lists
4028: of subdirectories of ${BUILDLINK_PREFIX.pkg} to add to the header and
4029: library search paths. These default to "include" and "lib" respectively.
4030:
4031: * BUILDLINK_CPPFLAGS.pkg (not shown above) is the list of preprocessor flags
4032: to add to CPPFLAGS, which are passed on to the configure and build phases.
4033: The "-I" option should be avoided and instead be handled using
4034: BUILDLINK_INCDIRS.pkg as above.
4035:
4036: The following variables are all optionally defined within this second section
4037: (protected against multiple inclusion) and control which package files are
4038: symlinked into ${BUILDLINK_DIR} and how their names are transformed during the
4039: symlinking:
4040:
4041: * BUILDLINK_FILES.pkg (not shown above) is a shell glob pattern relative to $
4042: {BUILDLINK_PREFIX.pkg} to be symlinked into ${BUILDLINK_DIR}, e.g. include/
4043: *.h.
4044:
4045: * BUILDLINK_FILES_CMD.pkg (not shown above) is a shell pipeline that outputs
4046: to stdout a list of files relative to ${BUILDLINK_PREFIX.pkg}. The
4047: resulting files are to be symlinked into ${BUILDLINK_DIR}. By default, this
4048: takes the +CONTENTS of a pkg and filters it through $
4049: {BUILDLINK_CONTENTS_FILTER.pkg}.
4050:
4051: * BUILDLINK_CONTENTS_FILTER.pkg (not shown above) is a filter command that
4052: filters +CONTENTS input into a list of files relative to $
1.84 wiz 4053: {BUILDLINK_PREFIX.pkg} on stdout. By default, BUILDLINK_CONTENTS_FILTER.pkg
4054: outputs the contents of the include and lib directories in the package
4055: +CONTENTS.
1.1 dsieger 4056:
4057: * BUILDLINK_FNAME_TRANSFORM.pkg (not shown above) is a list of sed arguments
4058: used to transform the name of the source filename into a destination
4059: filename, e.g. -e "s|/curses.h|/ncurses.h|g".
4060:
1.19 snj 4061: This section can additionally include any buildlink3.mk needed for pkg's
4062: library dependencies. Including these buildlink3.mk files means that the
4063: headers and libraries for these dependencies are also symlinked into $
4064: {BUILDLINK_DIR} whenever the pkg buildlink3.mk file is included. Dependencies
4065: are only added for directly include buildlink3.mk files.
1.1 dsieger 4066:
1.48 wiz 4067: When providing a buildlink3.mk and including other buildlink3.mk files in it,
1.51 wiz 4068: please only add necessary ones, i.e., those whose libraries or header files are
1.48 wiz 4069: automatically exposed when the package is use.
4070:
4071: In particular, if only an executable (bin/foo) is linked against a library,
4072: that library does not need to be propagated in the buildlink3.mk file.
4073:
4074: The following steps should help you decide if a buildlink3.mk file needs to be
4075: included:
4076:
4077: * Look at the installed header files: What headers do they include? The
4078: packages providing these files must be buildlinked.
4079:
1.50 wiz 4080: * Run ldd on all installed libraries and look against what other libraries
4081: they link. Some of the packages providing these probably need to be
4082: buildlinked; however, it's not automatic, since e.g. GTK on some systems
4083: pulls in the X libraries, so they will show up in the ldd output, while on
1.51 wiz 4084: others (like OS X) it won't. ldd output can thus only be used as a hint.
1.50 wiz 4085:
1.154 rillig 4086: 16.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
1.27 wiz 4087: buildlink3.mk files
1.1 dsieger 4088:
1.27 wiz 4089: These two variables differ in that one describes source compatibility (API) and
4090: the other binary compatibility (ABI). The difference is that a change in the
4091: API breaks compilation of programs while changes in the ABI stop compiled
4092: programs from running.
4093:
1.28 wiz 4094: Changes to the BUILDLINK_API_DEPENDS.pkg variable in a buildlink3.mk file
4095: happen very rarely. One possible reason is that all packages depending on this
4096: already need a newer version. In case it is bumped see the description below.
1.27 wiz 4097:
4098: The most common example of an ABI change is that the major version of a shared
4099: library is increased. In this case, BUILDLINK_ABI_DEPENDS.pkg should be
4100: adjusted to require at least the new package version. Then the packages that
4101: depend on this package need their PKGREVISIONs increased and, if they have
4102: buildlink3.mk files, their BUILDLINK_ABI_DEPENDS.pkg adjusted, too. This is
4103: needed so pkgsrc will require the correct package dependency and not settle for
4104: an older one when building the source.
1.1 dsieger 4105:
1.154 rillig 4106: See Section 21.1.5, "Handling dependencies" for more information about
1.1 dsieger 4107: dependencies on other packages, including the BUILDLINK_ABI_DEPENDS and
4108: ABI_DEPENDS definitions.
4109:
4110: Please take careful consideration before adjusting BUILDLINK_API_DEPENDS.pkg or
4111: BUILDLINK_ABI_DEPENDS.pkg as we don't want to cause unneeded package deletions
4112: and rebuilds. In many cases, new versions of packages work just fine with older
4113: dependencies.
4114:
4115: Also it is not needed to set BUILDLINK_ABI_DEPENDS.pkg when it is identical to
4116: BUILDLINK_API_DEPENDS.pkg.
4117:
1.154 rillig 4118: 16.3. Writing builtin.mk files
1.1 dsieger 4119:
4120: Some packages in pkgsrc install headers and libraries that coincide with
4121: headers and libraries present in the base system. Aside from a buildlink3.mk
4122: file, these packages should also include a builtin.mk file that includes the
4123: necessary checks to decide whether using the built-in software or the pkgsrc
4124: software is appropriate.
4125:
4126: The only requirements of a builtin.mk file for pkg are:
4127:
4128: 1. It should set USE_BUILTIN.pkg to either "yes" or "no" after it is included.
4129:
4130: 2. It should not override any USE_BUILTIN.pkg which is already set before the
4131: builtin.mk file is included.
4132:
4133: 3. It should be written to allow multiple inclusion. This is very important
4134: and takes careful attention to Makefile coding.
4135:
1.154 rillig 4136: 16.3.1. Anatomy of a builtin.mk file
1.1 dsieger 4137:
4138: The following is the recommended template for builtin.mk files:
4139:
4140: .if !defined(IS_BUILTIN.foo)
4141: #
4142: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
4143: # genuinely exists in the system or not.
4144: #
4145: IS_BUILTIN.foo?= no
4146:
4147: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
4148: # version can be determined.
4149: #
4150: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
4151: BUILTIN_PKG.foo?= foo-1.0
4152: . endif
4153: .endif # IS_BUILTIN.foo
4154:
4155: .if !defined(USE_BUILTIN.foo)
4156: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
4157: . if defined(BUILTIN_PKG.foo)
4158: . for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
4159: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
4160: USE_BUILTIN.foo!= \
4161: ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \
4162: && ${ECHO} "yes" || ${ECHO} "no"
4163: . endif
4164: . endfor
4165: . endif
4166: .endif # USE_BUILTIN.foo
4167:
4168: CHECK_BUILTIN.foo?= no
4169: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
4170: #
4171: # Here we place code that depends on whether USE_BUILTIN.foo is set to
4172: # "yes" or "no".
4173: #
4174: .endif # CHECK_BUILTIN.foo
4175:
4176: The first section sets IS_BUILTIN.pkg depending on if pkg really exists in the
4177: base system. This should not be a base system software with similar
4178: functionality to pkg; it should only be "yes" if the actual package is included
4179: as part of the base system. This variable is only used internally within the
4180: builtin.mk file.
4181:
4182: The second section sets BUILTIN_PKG.pkg to the version of pkg in the base
4183: system if it exists (if IS_BUILTIN.pkg is "yes"). This variable is only used
4184: internally within the builtin.mk file.
4185:
4186: The third section sets USE_BUILTIN.pkg and is required in all builtin.mk files.
4187: The code in this section must make the determination whether the built-in
4188: software is adequate to satisfy the dependencies listed in
4189: BUILDLINK_API_DEPENDS.pkg. This is typically done by comparing BUILTIN_PKG.pkg
1.25 wiz 4190: against each of the dependencies in BUILDLINK_API_DEPENDS.pkg. USE_BUILTIN.pkg
1.1 dsieger 4191: must be set to the correct value by the end of the builtin.mk file. Note that
4192: USE_BUILTIN.pkg may be "yes" even if IS_BUILTIN.pkg is "no" because we may make
4193: the determination that the built-in version of the software is similar enough
4194: to be used as a replacement.
4195:
4196: The last section is guarded by CHECK_BUILTIN.pkg, and includes code that uses
4197: the value of USE_BUILTIN.pkg set in the previous section. This typically
4198: includes, e.g., adding additional dependency restrictions and listing
4199: additional files to symlink into ${BUILDLINK_DIR} (via BUILDLINK_FILES.pkg).
4200:
1.154 rillig 4201: 16.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 4202:
4203: When building packages, it's possible to choose whether to set a global
4204: preference for using either the built-in (native) version or the pkgsrc version
4205: of software to satisfy a dependency. This is controlled by setting
1.25 wiz 4206: PREFER_PKGSRC and PREFER_NATIVE. These variables take values of either "yes", "
4207: no", or a list of packages. PREFER_PKGSRC tells pkgsrc to use the pkgsrc
1.1 dsieger 4208: versions of software, while PREFER_NATIVE tells pkgsrc to use the built-in
4209: versions. Preferences are determined by the most specific instance of the
4210: package in either PREFER_PKGSRC or PREFER_NATIVE. If a package is specified in
4211: neither or in both variables, then PREFER_PKGSRC has precedence over
4212: PREFER_NATIVE. For example, to require using pkgsrc versions of software for
4213: all but the most basic bits on a NetBSD system, you can set:
4214:
4215: PREFER_PKGSRC= yes
4216: PREFER_NATIVE= getopt skey tcp_wrappers
4217:
4218: A package must have a builtin.mk file to be listed in PREFER_NATIVE, otherwise
4219: it is simply ignored in that list.
4220:
1.117 sevan 4221: Setting PREFER_NATIVE should be performed straight after bootstrap and
4222: PREFER_PKGSRC during bootstrap. Switching between settings globally at a later
4223: date can introduce complications with dependency resolution. This is caused by
4224: packages built with the opposite preference being installed alongside each
4225: other.
4226:
4227: # ./bootstrap --prefer-pkgsrc yes
4228:
1.154 rillig 4229: Chapter 17. The pkginstall framework
1.1 dsieger 4230:
4231: Table of Contents
4232:
1.154 rillig 4233: 17.1. Files and directories outside the installation prefix
1.1 dsieger 4234:
1.154 rillig 4235: 17.1.1. Directory manipulation
4236: 17.1.2. File manipulation
1.1 dsieger 4237:
1.154 rillig 4238: 17.2. Configuration files
1.1 dsieger 4239:
1.154 rillig 4240: 17.2.1. How PKG_SYSCONFDIR is set
4241: 17.2.2. Telling the software where configuration files are
4242: 17.2.3. Patching installations
4243: 17.2.4. Disabling handling of configuration files
1.1 dsieger 4244:
1.154 rillig 4245: 17.3. System startup scripts
1.1 dsieger 4246:
1.154 rillig 4247: 17.3.1. Disabling handling of system startup scripts
1.1 dsieger 4248:
1.154 rillig 4249: 17.4. System users and groups
4250: 17.5. System shells
1.1 dsieger 4251:
1.154 rillig 4252: 17.5.1. Disabling shell registration
1.1 dsieger 4253:
1.154 rillig 4254: 17.6. Fonts
1.1 dsieger 4255:
1.154 rillig 4256: 17.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 4257:
4258: This chapter describes the framework known as pkginstall, whose key features
4259: are:
4260:
4261: * Generic installation and manipulation of directories and files outside the
4262: pkgsrc-handled tree, LOCALBASE.
4263:
4264: * Automatic handling of configuration files during installation, provided
4265: that packages are correctly designed.
4266:
4267: * Generation and installation of system startup scripts.
4268:
4269: * Registration of system users and groups.
4270:
4271: * Registration of system shells.
4272:
4273: * Automatic updating of fonts databases.
4274:
4275: The following sections inspect each of the above points in detail.
4276:
4277: You may be thinking that many of the things described here could be easily done
4278: with simple code in the package's post-installation target (post-install). This
4279: is incorrect, as the code in them is only executed when building from source.
4280: Machines using binary packages could not benefit from it at all (as the code
4281: itself could be unavailable). Therefore, the only way to achieve any of the
4282: items described above is by means of the installation scripts, which are
4283: automatically generated by pkginstall.
4284:
1.154 rillig 4285: 17.1. Files and directories outside the installation prefix
1.1 dsieger 4286:
4287: As you already know, the PLIST file holds a list of files and directories that
4288: belong to a package. The names used in it are relative to the installation
4289: prefix (${PREFIX}), which means that it cannot register files outside this
4290: directory (absolute path names are not allowed). Despite this restriction, some
4291: packages need to install files outside this location; e.g., under ${VARBASE} or
4292: ${PKG_SYSCONFDIR}. The only way to achieve this is to create such files during
4293: installation time by using installation scripts.
4294:
4295: The generic installation scripts are shell scripts that can contain arbitrary
4296: code. The list of scripts to execute is taken from the INSTALL_FILE variable,
4297: which defaults to INSTALL. A similar variable exists for package removal
4298: (DEINSTALL_FILE, whose default is DEINSTALL). These scripts can run arbitrary
4299: commands, so they have the potential to create and manage files anywhere in the
4300: file system.
4301:
4302: Using these general installation files is not recommended, but may be needed in
4303: some special cases. One reason for avoiding them is that the user has to trust
4304: the packager that there is no unwanted or simply erroneous code included in the
4305: installation script. Also, previously there were many similar scripts for the
4306: same functionality, and fixing a common error involved finding and changing all
4307: of them.
4308:
4309: The pkginstall framework offers another, standardized way. It provides generic
4310: scripts to abstract the manipulation of such files and directories based on
4311: variables set in the package's Makefile. The rest of this section describes
4312: these variables.
4313:
1.154 rillig 4314: 17.1.1. Directory manipulation
1.1 dsieger 4315:
4316: The following variables can be set to request the creation of directories
4317: anywhere in the file system:
4318:
4319: * MAKE_DIRS and OWN_DIRS contain a list of directories that should be created
4320: and should attempt to be destroyed by the installation scripts. The
4321: difference between the two is that the latter prompts the administrator to
4322: remove any directories that may be left after deinstallation (because they
1.108 rillig 4323: were not empty), while the former does not. Example:
4324:
4325: MAKE_DIRS+= ${VARBASE}/foo/private
1.1 dsieger 4326:
4327: * MAKE_DIRS_PERMS and OWN_DIRS_PERMS contain a list of tuples describing
4328: which directories should be created and should attempt to be destroyed by
4329: the installation scripts. Each tuple holds the following values, separated
4330: by spaces: the directory name, its owner, its group and its numerical mode.
4331: For example:
4332:
1.108 rillig 4333: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private \
4334: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 4335:
4336: The difference between the two is exactly the same as their non-PERMS
4337: counterparts.
4338:
1.154 rillig 4339: 17.1.2. File manipulation
1.1 dsieger 4340:
4341: Creating non-empty files outside the installation prefix is tricky because the
4342: PLIST forces all files to be inside it. To overcome this problem, the only
4343: solution is to extract the file in the known place (i.e., inside the
4344: installation prefix) and copy it to the appropriate location during
4345: installation (done by the installation scripts generated by pkginstall). We
4346: will call the former the master file in the following paragraphs, which
4347: describe the variables that can be used to automatically and consistently
4348: handle files outside the installation prefix:
4349:
1.31 wiz 4350: * CONF_FILES and REQD_FILES are pairs of master and target files. During
1.1 dsieger 4351: installation time, the master file is copied to the target one if and only
4352: if the latter does not exist. Upon deinstallation, the target file is
4353: removed provided that it was not modified by the installation.
4354:
4355: The difference between the two is that the latter prompts the administrator
4356: to remove any files that may be left after deinstallation (because they
4357: were not empty), while the former does not.
4358:
1.31 wiz 4359: * CONF_FILES_PERMS and REQD_FILES_PERMS contain tuples describing master
1.1 dsieger 4360: files as well as their target locations. For each of them, it also
4361: specifies their owner, their group and their numeric permissions, in this
4362: order. For example:
4363:
1.108 rillig 4364: REQD_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile \
4365: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 4366:
4367: The difference between the two is exactly the same as their non-PERMS
4368: counterparts.
4369:
1.154 rillig 4370: 17.2. Configuration files
1.1 dsieger 4371:
4372: Configuration files are special in the sense that they are installed in their
4373: own specific directory, PKG_SYSCONFDIR, and need special treatment during
4374: installation (most of which is automated by pkginstall). The main concept you
4375: must bear in mind is that files marked as configuration files are automatically
4376: copied to the right place (somewhere inside PKG_SYSCONFDIR) during installation
4377: if and only if they didn't exist before. Similarly, they will not be removed if
4378: they have local modifications. This ensures that administrators never lose any
4379: custom changes they may have made.
4380:
1.154 rillig 4381: 17.2.1. How PKG_SYSCONFDIR is set
1.1 dsieger 4382:
4383: As said before, the PKG_SYSCONFDIR variable specifies where configuration files
4384: shall be installed. Its contents are set based upon the following variables:
4385:
4386: * PKG_SYSCONFBASE: The configuration's root directory. Defaults to ${PREFIX}/
4387: etc although it may be overridden by the user to point to his preferred
4388: location (e.g., /etc, /etc/pkg, etc.). Packages must not use it directly.
4389:
4390: * PKG_SYSCONFSUBDIR: A subdirectory of PKG_SYSCONFBASE under which the
4391: configuration files for the package being built shall be installed. The
4392: definition of this variable only makes sense in the package's Makefile
4393: (i.e., it is not user-customizable).
4394:
1.68 asau 4395: As an example, consider the Apache package, www/apache24, which places its
1.1 dsieger 4396: configuration files under the httpd/ subdirectory of PKG_SYSCONFBASE. This
4397: should be set in the package Makefile.
4398:
4399: * PKG_SYSCONFVAR: Specifies the name of the variable that holds this
4400: package's configuration directory (if different from PKG_SYSCONFBASE). It
4401: defaults to PKGBASE's value, and is always prefixed with PKG_SYSCONFDIR.
4402:
4403: * PKG_SYSCONFDIR.${PKG_SYSCONFVAR}: Holds the directory where the
4404: configuration files for the package identified by PKG_SYSCONFVAR's shall be
4405: placed.
4406:
4407: Based on the above variables, pkginstall determines the value of
4408: PKG_SYSCONFDIR, which is the only variable that can be used within a package to
4409: refer to its configuration directory. The algorithm used to set its value is
4410: basically the following:
4411:
4412: 1. If PKG_SYSCONFDIR.${PKG_SYSCONFVAR} is set, its value is used.
4413:
4414: 2. If the previous variable is not defined but PKG_SYSCONFSUBDIR is set in the
4415: package's Makefile, the resulting value is ${PKG_SYSCONFBASE}/$
4416: {PKG_SYSCONFSUBDIR}.
4417:
4418: 3. Otherwise, it is set to ${PKG_SYSCONFBASE}.
4419:
4420: It is worth mentioning that ${PKG_SYSCONFDIR} is automatically added to
1.154 rillig 4421: OWN_DIRS. See Section 17.1.1, "Directory manipulation" what this means. This
1.16 jnemeth 4422: does not apply to subdirectories of ${PKG_SYSCONFDIR}, they still have to be
4423: created with OWN_DIRS or MAKE_DIRS.
1.1 dsieger 4424:
1.154 rillig 4425: 17.2.2. Telling the software where configuration files are
1.1 dsieger 4426:
4427: Given that pkgsrc (and users!) expect configuration files to be in a known
4428: place, you need to teach each package where it shall install its files. In some
4429: cases you will have to patch the package Makefiles to achieve it. If you are
4430: lucky, though, it may be as easy as passing an extra flag to the configuration
4431: script; this is the case of GNU Autoconf- generated files:
4432:
4433: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
4434:
4435: Note that this specifies where the package has to look for its configuration
4436: files, not where they will be originally installed (although the difference is
4437: never explicit, unfortunately).
4438:
1.154 rillig 4439: 17.2.3. Patching installations
1.1 dsieger 4440:
4441: As said before, pkginstall automatically handles configuration files. This
4442: means that the packages themselves must not touch the contents of $
4443: {PKG_SYSCONFDIR} directly. Bad news is that many software installation scripts
4444: will, out of the box, mess with the contents of that directory. So what is the
4445: correct procedure to fix this issue?
4446:
4447: You must teach the package (usually by manually patching it) to install any
4448: configuration files under the examples hierarchy, share/examples/${PKGBASE}/.
4449: This way, the PLIST registers them and the administrator always has the
4450: original copies available.
4451:
4452: Once the required configuration files are in place (i.e., under the examples
4453: hierarchy), the pkginstall framework can use them as master copies during the
4454: package installation to update what is in ${PKG_SYSCONFDIR}. To achieve this,
4455: the variables CONF_FILES and CONF_FILES_PERMS are used. Check out
1.154 rillig 4456: Section 17.1.2, "File manipulation" for information about their syntax and
1.1 dsieger 4457: their purpose. Here is an example, taken from the mail/mutt package:
4458:
4459: EGDIR= ${PREFIX}/share/doc/mutt/samples
4460: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
4461:
4462: Note that the EGDIR variable is specific to that package and has no meaning
4463: outside it.
4464:
1.154 rillig 4465: 17.2.4. Disabling handling of configuration files
1.1 dsieger 4466:
4467: The automatic copying of config files can be toggled by setting the environment
4468: variable PKG_CONFIG prior to package installation.
4469:
1.154 rillig 4470: 17.3. System startup scripts
1.1 dsieger 4471:
4472: System startup scripts are special files because they must be installed in a
4473: place known by the underlying OS, usually outside the installation prefix.
1.154 rillig 4474: Therefore, the same rules described in Section 17.1, "Files and directories
1.1 dsieger 4475: outside the installation prefix" apply, and the same solutions can be used.
4476: However, pkginstall provides a special mechanism to handle these files.
4477:
4478: In order to provide system startup scripts, the package has to:
4479:
4480: 1. Store the script inside ${FILESDIR}, with the .sh suffix appended.
4481: Considering the print/cups package as an example, it has a cupsd.sh in its
4482: files directory.
4483:
4484: 2. Tell pkginstall to handle it, appending the name of the script, without its
4485: extension, to the RCD_SCRIPTS variable. Continuing the previous example:
4486:
4487: RCD_SCRIPTS+= cupsd
4488:
4489: Once this is done, pkginstall will do the following steps for each script in an
4490: automated fashion:
4491:
4492: 1. Process the file found in the files directory applying all the
4493: substitutions described in the FILES_SUBST variable.
4494:
4495: 2. Copy the script from the files directory to the examples hierarchy, $
4496: {PREFIX}/share/examples/rc.d/. Note that this master file must be
4497: explicitly registered in the PLIST.
4498:
4499: 3. Add code to the installation scripts to copy the startup script from the
4500: examples hierarchy into the system-wide startup scripts directory.
4501:
1.154 rillig 4502: 17.3.1. Disabling handling of system startup scripts
1.1 dsieger 4503:
4504: The automatic copying of config files can be toggled by setting the environment
4505: variable PKG_RCD_SCRIPTS prior to package installation. Note that the scripts
4506: will be always copied inside the examples hierarchy, ${PREFIX}/share/examples/
4507: rc.d/, no matter what the value of this variable is.
4508:
1.154 rillig 4509: 17.4. System users and groups
1.1 dsieger 4510:
4511: If a package needs to create special users and/or groups during installation,
4512: it can do so by using the pkginstall framework.
4513:
4514: Users can be created by adding entries to the PKG_USERS variable. Each entry
4515: has the following syntax:
4516:
4517: user:group
4518:
4519: Further specification of user details may be done by setting per-user
4520: variables. PKG_UID.user is the numeric UID for the user. PKG_GECOS.user is the
4521: user's description or comment. PKG_HOME.user is the user's home directory, and
4522: defaults to /nonexistent if not specified. PKG_SHELL.user is the user's shell,
4523: and defaults to /sbin/nologin if not specified.
4524:
4525: Similarly, groups can be created by adding entries to the PKG_GROUPS variable,
4526: whose syntax is:
4527:
4528: group
4529:
4530: The numeric GID of the group may be set by defining PKG_GID.group.
4531:
4532: If a package needs to create the users and groups at an earlier stage, then it
1.116 wiz 4533: can set USERGROUP_PHASE to either configure,build, or pre-install to indicate
4534: the phase before which the users and groups are created. In this case, the
4535: numeric UIDs and GIDs of the created users and groups are automatically
4536: hardcoded into the final installation scripts.
1.1 dsieger 4537:
1.154 rillig 4538: 17.5. System shells
1.1 dsieger 4539:
4540: Packages that install system shells should register them in the shell database,
4541: /etc/shells, to make things easier to the administrator. This must be done from
4542: the installation scripts to keep binary packages working on any system.
4543: pkginstall provides an easy way to accomplish this task.
4544:
4545: When a package provides a shell interpreter, it has to set the PKG_SHELL
4546: variable to its absolute file name. This will add some hooks to the
4547: installation scripts to handle it. Consider the following example, taken from
4548: shells/zsh:
4549:
4550: PKG_SHELL= ${PREFIX}/bin/zsh
4551:
1.154 rillig 4552: 17.5.1. Disabling shell registration
1.1 dsieger 4553:
4554: The automatic registration of shell interpreters can be disabled by the
4555: administrator by setting the PKG_REGISTER_SHELLS environment variable to NO.
4556:
1.154 rillig 4557: 17.6. Fonts
1.1 dsieger 4558:
4559: Packages that install X11 fonts should update the database files that index the
4560: fonts within each fonts directory. This can easily be accomplished within the
4561: pkginstall framework.
4562:
4563: When a package installs X11 fonts, it must list the directories in which fonts
4564: are installed in the FONTS_DIRS.type variables, where type can be one of "ttf",
4565: "type1" or "x11". This will add hooks to the installation scripts to run the
4566: appropriate commands to update the fonts database files within each of those
4567: directories. For convenience, if the directory path is relative, it is taken to
4568: be relative to the package's installation prefix. Consider the following
4569: example, taken from fonts/dbz-ttf:
4570:
1.67 wiz 4571: FONTS_DIRS.ttf= ${PREFIX}/share/fonts/X11/TTF
1.1 dsieger 4572:
1.154 rillig 4573: 17.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 4574:
4575: The automatic update of fonts databases can be disabled by the administrator by
4576: setting the PKG_UPDATE_FONTS_DB environment variable to NO.
4577:
1.154 rillig 4578: Chapter 18. Options handling
1.1 dsieger 4579:
4580: Table of Contents
4581:
1.154 rillig 4582: 18.1. Global default options
4583: 18.2. Converting packages to use bsd.options.mk
4584: 18.3. Option Names
4585: 18.4. Determining the options of dependencies
1.1 dsieger 4586:
4587: Many packages have the ability to be built to support different sets of
4588: features. bsd.options.mk is a framework in pkgsrc that provides generic
4589: handling of those options that determine different ways in which the packages
4590: can be built. It's possible for the user to specify exactly which sets of
4591: options will be built into a package or to allow a set of global default
4592: options apply.
4593:
1.7 rillig 4594: There are two broad classes of behaviors that one might want to control via
4595: options. One is whether some particular feature is enabled in a program that
4596: will be built anyway, often by including or not including a dependency on some
4597: other package. The other is whether or not an additional program will be built
4598: as part of the package. Generally, it is better to make a split package for
4599: such additional programs instead of using options, because it enables binary
4600: packages to be built which can then be added separately. For example, the foo
4601: package might have minimal dependencies (those packages without which foo
4602: doesn't make sense), and then the foo-gfoo package might include the GTK
4603: frontend program gfoo. This is better than including a gtk option to foo that
4604: adds gfoo, because either that option is default, in which case binary users
4605: can't get foo without gfoo, or not default, in which case they can't get gfoo.
4606: With split packages, they can install foo without having GTK, and later decide
4607: to install gfoo (pulling in GTK at that time). This is an advantage to source
4608: users too, avoiding the need for rebuilds.
4609:
4610: Plugins with widely varying dependencies should usually be split instead of
4611: options.
4612:
4613: It is often more work to maintain split packages, especially if the upstream
4614: package does not support this. The decision of split vs. option should be made
4615: based on the likelihood that users will want or object to the various pieces,
4616: the size of the dependencies that are included, and the amount of work.
4617:
4618: A further consideration is licensing. Non-free parts, or parts that depend on
4619: non-free dependencies (especially plugins) should almost always be split if
4620: feasible.
4621:
1.154 rillig 4622: 18.1. Global default options
1.1 dsieger 4623:
4624: Global default options are listed in PKG_DEFAULT_OPTIONS, which is a list of
4625: the options that should be built into every package if that option is
1.4 rillig 4626: supported. This variable should be set in mk.conf.
1.1 dsieger 4627:
1.154 rillig 4628: 18.2. Converting packages to use bsd.options.mk
1.1 dsieger 4629:
4630: The following example shows how bsd.options.mk should be used by the
4631: hypothetical ``wibble'' package, either in the package Makefile, or in a file,
4632: e.g. options.mk, that is included by the main package Makefile.
4633:
4634: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
4635: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
4636: PKG_OPTIONS_OPTIONAL_GROUPS= database
4637: PKG_OPTIONS_GROUP.database= mysql pgsql
4638: PKG_SUGGESTED_OPTIONS= wibble-foo
4639: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
4640: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
4641:
4642: .include "../../mk/bsd.prefs.mk"
4643:
4644: # this package was previously named wibble2
4645: .if defined(PKG_OPTIONS.wibble2)
4646: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
4647: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
4648: "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead."
4649: .endif
4650:
4651: .include "../../mk/bsd.options.mk"
4652:
4653: # Package-specific option-handling
4654:
4655: ###
4656: ### FOO support
4657: ###
4658: .if !empty(PKG_OPTIONS:Mwibble-foo)
4659: CONFIGURE_ARGS+= --enable-foo
4660: .endif
4661:
4662: ###
4663: ### LDAP support
4664: ###
4665: .if !empty(PKG_OPTIONS:Mldap)
4666: . include "../../databases/openldap-client/buildlink3.mk"
4667: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client}
4668: .endif
4669:
4670: ###
4671: ### database support
4672: ###
4673: .if !empty(PKG_OPTIONS:Mmysql)
4674: . include "../../mk/mysql.buildlink3.mk"
4675: .endif
4676: .if !empty(PKG_OPTIONS:Mpgsql)
4677: . include "../../mk/pgsql.buildlink3.mk"
4678: .endif
4679:
4680: The first section contains the information about which build options are
4681: supported by the package, and any default options settings if needed.
4682:
4683: 1. PKG_OPTIONS_VAR is the name of the make(1) variable that the user can set
4684: to override the default options. It should be set to PKG_OPTIONS.pkgbase.
4685: Do not set it to PKG_OPTIONS.${PKGBASE}, since PKGBASE is not defined at
4686: the point where the options are processed.
4687:
4688: 2. PKG_SUPPORTED_OPTIONS is a list of build options supported by the package.
4689:
4690: 3. PKG_OPTIONS_OPTIONAL_GROUPS is a list of names of groups of mutually
4691: exclusive options. The options in each group are listed in
4692: PKG_OPTIONS_GROUP.groupname. The most specific setting of any option from
4693: the group takes precedence over all other options in the group. Options
4694: from the groups will be automatically added to PKG_SUPPORTED_OPTIONS.
4695:
4696: 4. PKG_OPTIONS_REQUIRED_GROUPS is like PKG_OPTIONS_OPTIONAL_GROUPS, but
4697: building the packages will fail if no option from the group is selected.
4698:
4699: 5. PKG_OPTIONS_NONEMPTY_SETS is a list of names of sets of options. At least
4700: one option from each set must be selected. The options in each set are
4701: listed in PKG_OPTIONS_SET.setname. Options from the sets will be
4702: automatically added to PKG_SUPPORTED_OPTIONS. Building the package will
4703: fail if no option from the set is selected.
4704:
4705: 6. PKG_SUGGESTED_OPTIONS is a list of build options which are enabled by
4706: default.
4707:
4708: 7. PKG_OPTIONS_LEGACY_VARS is a list of "USE_VARIABLE:option" pairs that map
1.4 rillig 4709: legacy mk.conf variables to their option counterparts. Pairs should be
1.1 dsieger 4710: added with "+=" to keep the listing of global legacy variables. A warning
4711: will be issued if the user uses a legacy variable.
4712:
4713: 8. PKG_OPTIONS_LEGACY_OPTS is a list of "old-option:new-option" pairs that map
4714: options that have been renamed to their new counterparts. Pairs should be
4715: added with "+=" to keep the listing of global legacy options. A warning
4716: will be issued if the user uses a legacy option.
4717:
4718: 9. PKG_LEGACY_OPTIONS is a list of options implied by deprecated variables
4719: used. This can be used for cases that neither PKG_OPTIONS_LEGACY_VARS nor
4720: PKG_OPTIONS_LEGACY_OPTS can handle, e. g. when PKG_OPTIONS_VAR is renamed.
4721:
4722: 10. PKG_OPTIONS_DEPRECATED_WARNINGS is a list of warnings about deprecated
4723: variables or options used, and what to use instead.
4724:
4725: A package should never modify PKG_DEFAULT_OPTIONS or the variable named in
4726: PKG_OPTIONS_VAR. These are strictly user-settable. To suggest a default set of
4727: options, use PKG_SUGGESTED_OPTIONS.
4728:
4729: PKG_OPTIONS_VAR must be defined before including bsd.options.mk. If none of
4730: PKG_SUPPORTED_OPTIONS, PKG_OPTIONS_OPTIONAL_GROUPS, and
4731: PKG_OPTIONS_REQUIRED_GROUPS are defined (as can happen with platform-specific
4732: options if none of them is supported on the current platform), PKG_OPTIONS is
4733: set to the empty list and the package is otherwise treated as not using the
4734: options framework.
4735:
4736: After the inclusion of bsd.options.mk, the variable PKG_OPTIONS contains the
4737: list of selected build options, properly filtered to remove unsupported and
4738: duplicate options.
4739:
4740: The remaining sections contain the logic that is specific to each option. The
4741: correct way to check for an option is to check whether it is listed in
4742: PKG_OPTIONS:
4743:
4744: .if !empty(PKG_OPTIONS:Moption)
4745:
1.154 rillig 4746: 18.3. Option Names
1.1 dsieger 4747:
4748: Options that enable similar features in different packages (like optional
4749: support for a library) should use a common name in all packages that support it
4750: (like the name of the library). If another package already has an option with
4751: the same meaning, use the same name.
4752:
4753: Options that enable features specific to one package, where it's unlikely that
4754: another (unrelated) package has the same (or a similar) optional feature,
4755: should use a name prefixed with pkgname-.
4756:
4757: If a group of related packages share an optional feature specific to that
4758: group, prefix it with the name of the "main" package (e. g.
4759: djbware-errno-hack).
4760:
4761: For new options, add a line to mk/defaults/options.description. Lines have two
4762: fields, separated by tab. The first field is the option name, the second its
4763: description. The description should be a whole sentence (starting with an
4764: uppercase letter and ending with a period) that describes what enabling the
4765: option does. E. g. "Enable ispell support." The file is sorted by option names.
4766:
1.154 rillig 4767: 18.4. Determining the options of dependencies
1.7 rillig 4768:
4769: When writing buildlink3.mk files, it is often necessary to list different
4770: dependencies based on the options with which the package was built. For
4771: querying these options, the file pkgsrc/mk/pkg-build-options.mk should be used.
4772: A typical example looks like this:
4773:
4774: pkgbase := libpurple
4775: .include "../../mk/pkg-build-options.mk"
4776:
4777: .if !empty(PKG_BUILD_OPTIONS.libpurple:Mdbus)
4778: ...
4779: .endif
4780:
4781: Including pkg-build-options.mk here will set the variable
4782: PKG_BUILD_OPTIONS.libpurple to the build options of the libpurple package,
4783: which can then be queried like PKG_OPTIONS in the options.mk file. See the file
4784: pkg-build-options.mk for more details.
4785:
1.154 rillig 4786: Chapter 19. The build process
1.1 dsieger 4787:
4788: Table of Contents
4789:
1.154 rillig 4790: 19.1. Introduction
4791: 19.2. Program location
4792: 19.3. Directories used during the build process
4793: 19.4. Running a phase
4794: 19.5. The fetch phase
4795:
4796: 19.5.1. What to fetch and where to get it from
4797: 19.5.2. How are the files fetched?
4798:
4799: 19.6. The checksum phase
4800: 19.7. The extract phase
4801: 19.8. The patch phase
4802: 19.9. The tools phase
4803: 19.10. The wrapper phase
4804: 19.11. The configure phase
4805: 19.12. The build phase
4806: 19.13. The test phase
4807: 19.14. The install phase
4808: 19.15. The package phase
4809: 19.16. Cleaning up
4810: 19.17. Other helpful targets
1.1 dsieger 4811:
1.154 rillig 4812: 19.1. Introduction
1.1 dsieger 4813:
4814: This chapter gives a detailed description on how a package is built. Building a
4815: package is separated into different phases (for example fetch, build, install),
1.19 snj 4816: all of which are described in the following sections. Each phase is split into
4817: so-called stages, which take the name of the containing phase, prefixed by one
4818: of pre-, do- or post-. (Examples are pre-configure, post-build.) Most of the
4819: actual work is done in the do-* stages.
1.1 dsieger 4820:
4821: Never override the regular targets (like fetch), if you have to, override the
4822: do-* ones instead.
4823:
4824: The basic steps for building a program are always the same. First the program's
4825: source (distfile) must be brought to the local system and then extracted. After
4826: any pkgsrc-specific patches to compile properly are applied, the software can
4827: be configured, then built (usually by compiling), and finally the generated
4828: binaries, etc. can be put into place on the system.
4829:
4830: To get more details about what is happening at each step, you can set the
4831: PKG_VERBOSE variable, or the PATCH_DEBUG variable if you are just interested in
4832: more details about the patch step.
4833:
1.154 rillig 4834: 19.2. Program location
1.1 dsieger 4835:
4836: Before outlining the process performed by the NetBSD package system in the next
4837: section, here's a brief discussion on where programs are installed, and which
4838: variables influence this.
4839:
4840: The automatic variable PREFIX indicates where all files of the final program
4841: shall be installed. It is usually set to LOCALBASE (/usr/pkg), or CROSSBASE for
4842: pkgs in the cross category. The value of PREFIX needs to be put into the
4843: various places in the program's source where paths to these files are encoded.
1.154 rillig 4844: See Section 13.3, "patches/*" and Section 21.3.1, "Shared libraries - libtool"
1.1 dsieger 4845: for more details.
4846:
4847: When choosing which of these variables to use, follow the following rules:
4848:
4849: * PREFIX always points to the location where the current pkg will be
1.25 wiz 4850: installed. When referring to a pkg's own installation path, use "${PREFIX}"
4851: .
1.1 dsieger 4852:
4853: * LOCALBASE is where all non-X11 pkgs are installed. If you need to construct
4854: a -I or -L argument to the compiler to find includes and libraries
4855: installed by another non-X11 pkg, use "${LOCALBASE}". The name LOCALBASE
4856: stems from FreeBSD, which installed all packages in /usr/local. As pkgsrc
4857: leaves /usr/local for the system administrator, this variable is a
4858: misnomer.
4859:
4860: * X11BASE is where the actual X11 distribution (from xsrc, etc.) is
4861: installed. When looking for standard X11 includes (not those installed by a
4862: package), use "${X11BASE}".
4863:
1.99 sevan 4864: * X11-based packages using imake must set USE_IMAKE to be installed correctly
4865: under LOCALBASE.
1.1 dsieger 4866:
4867: * Within ${PREFIX}, packages should install files according to hier(7), with
4868: the exception that manual pages go into ${PREFIX}/man, not ${PREFIX}/share/
4869: man.
4870:
1.154 rillig 4871: 19.3. Directories used during the build process
1.1 dsieger 4872:
1.14 jmcneill 4873: When building a package, various directories are used to store source files,
1.1 dsieger 4874: temporary files, pkgsrc-internal files, and so on. These directories are
4875: explained here.
4876:
4877: Some of the directory variables contain relative pathnames. There are two
4878: common base directories for these relative directories: PKGSRCDIR/PKGPATH is
4879: used for directories that are pkgsrc-specific. WRKSRC is used for directories
4880: inside the package itself.
4881:
4882: PKGSRCDIR
4883:
4884: This is an absolute pathname that points to the pkgsrc root directory.
4885: Generally, you don't need it.
4886:
4887: PKGDIR
4888:
4889: This is an absolute pathname that points to the current package.
4890:
4891: PKGPATH
4892:
4893: This is a pathname relative to PKGSRCDIR that points to the current
4894: package.
4895:
4896: WRKDIR
4897:
4898: This is an absolute pathname pointing to the directory where all work takes
4899: place. The distfiles are extracted to this directory. It also contains
4900: temporary directories and log files used by the various pkgsrc frameworks,
4901: like buildlink or the wrappers.
4902:
4903: WRKSRC
4904:
4905: This is an absolute pathname pointing to the directory where the distfiles
4906: are extracted. It is usually a direct subdirectory of WRKDIR, and often
4907: it's the only directory entry that isn't hidden. This variable may be
4908: changed by a package Makefile.
4909:
1.14 jmcneill 4910: The CREATE_WRKDIR_SYMLINK definition takes either the value yes or no and
1.15 rillig 4911: defaults to no. It indicates whether a symbolic link to the WRKDIR is to be
1.14 jmcneill 4912: created in the pkgsrc entry's directory. If users would like to have their
4913: pkgsrc trees behave in a read-only manner, then the value of
4914: CREATE_WRKDIR_SYMLINK should be set to no.
4915:
1.154 rillig 4916: 19.4. Running a phase
1.1 dsieger 4917:
4918: You can run a particular phase by typing make phase, where phase is the name of
4919: the phase. This will automatically run all phases that are required for this
4920: phase. The default phase is build, that is, when you run make without
4921: parameters in a package directory, the package will be built, but not
4922: installed.
4923:
1.154 rillig 4924: 19.5. The fetch phase
1.1 dsieger 4925:
4926: The first step in building a package is to fetch the distribution files
1.25 wiz 4927: (distfiles) from the sites that are providing them. This is the task of the
1.1 dsieger 4928: fetch phase.
4929:
1.154 rillig 4930: 19.5.1. What to fetch and where to get it from
1.1 dsieger 4931:
4932: In simple cases, MASTER_SITES defines all URLs from where the distfile, whose
4933: name is derived from the DISTNAME variable, is fetched. The more complicated
4934: cases are described below.
4935:
4936: The variable DISTFILES specifies the list of distfiles that have to be fetched.
1.66 asau 4937: Its value defaults to ${DEFAULT_DISTFILES} and its value is ${DISTNAME}$
4938: {EXTRACT_SUFX}, so that most packages don't need to define it at all.
4939: EXTRACT_SUFX is .tar.gz by default, but can be changed freely. Note that if
4940: your package requires additional distfiles to the default one, you cannot just
4941: append the additional filenames using the += operator, but you have write for
4942: example:
1.1 dsieger 4943:
1.66 asau 4944: DISTFILES= ${DEFAULT_DISTFILES} additional-files.tar.gz
1.1 dsieger 4945:
4946: Each distfile is fetched from a list of sites, usually MASTER_SITES. If the
4947: package has multiple DISTFILES or multiple PATCHFILES from different sites, you
4948: can set SITES.distfile to the list of URLs where the file distfile (including
4949: the suffix) can be found.
4950:
4951: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
4952: DISTFILES+= foo-file.tar.gz
4953: SITES.foo-file.tar.gz= \
1.174 leot 4954: https://www.somewhere.com/somehow/ \
4955: https://www.somewhereelse.com/mirror/somehow/
1.1 dsieger 4956:
4957: When actually fetching the distfiles, each item from MASTER_SITES or SITES.*
4958: gets the name of each distfile appended to it, without an intermediate slash.
4959: Therefore, all site values have to end with a slash or other separator
4960: character. This allows for example to set MASTER_SITES to a URL of a CGI script
4961: that gets the name of the distfile as a parameter. In this case, the definition
4962: would look like:
4963:
1.174 leot 4964: MASTER_SITES= https://www.example.com/download.cgi?file=
1.1 dsieger 4965:
1.23 jakllsch 4966: The exception to this rule are URLs starting with a dash. In that case the URL
4967: is taken as is, fetched and the result stored under the name of the distfile.
1.66 asau 4968: You can use this style for the case when the download URL style does not match
4969: the above common case. For example, if permanent download URL is a redirector
4970: to the real download URL, or the download file name is offered by an HTTP
4971: Content-Disposition header. In the following example, foo-1.0.0.tar.gz will be
4972: created instead of the default v1.0.0.tar.gz.
4973:
4974: DISTNAME= foo-1.0.0
1.174 leot 4975: MASTER_SITES= -https://www.example.com/archive/v1.0.0.tar.gz
1.23 jakllsch 4976:
1.1 dsieger 4977: There are some predefined values for MASTER_SITES, which can be used in
4978: packages. The names of the variables should speak for themselves.
4979:
1.156 leot 4980: MASTER_SITE_APACHE MASTER_SITE_BACKUP
4981: MASTER_SITE_CRATESIO MASTER_SITE_CYGWIN
4982: MASTER_SITE_DEBIAN MASTER_SITE_FREEBSD
4983: MASTER_SITE_FREEBSD_LOCAL MASTER_SITE_GENTOO
4984: MASTER_SITE_GITHUB MASTER_SITE_GNOME
4985: MASTER_SITE_GNU MASTER_SITE_GNUSTEP
4986: MASTER_SITE_HASKELL_HACKAGE MASTER_SITE_IFARCHIVE
4987: MASTER_SITE_KDE MASTER_SITE_MOZILLA
4988: MASTER_SITE_MOZILLA_ALL MASTER_SITE_MYSQL
4989: MASTER_SITE_NETLIB MASTER_SITE_OPENBSD
4990: MASTER_SITE_OPENOFFICE MASTER_SITE_OSDN
4991: MASTER_SITE_PERL_CPAN MASTER_SITE_PGSQL
4992: MASTER_SITE_PYPI MASTER_SITE_RUBYGEMS
4993: MASTER_SITE_R_CRAN MASTER_SITE_SOURCEFORGE
4994: MASTER_SITE_SUNSITE MASTER_SITE_SUSE
4995: MASTER_SITE_TEX_CTAN MASTER_SITE_XCONTRIB
4996: MASTER_SITE_XEMACS MASTER_SITE_XORG
1.1 dsieger 4997:
4998: Some explanations for the less self-explaining ones: MASTER_SITE_BACKUP
4999: contains backup sites for packages that are maintained in ftp://ftp.NetBSD.org/
1.27 wiz 5000: pub/pkgsrc/distfiles/${DIST_SUBDIR}. MASTER_SITE_LOCAL contains local package
1.26 spz 5001: source distributions that are maintained in ftp://ftp.NetBSD.org/pub/pkgsrc/
5002: distfiles/LOCAL_PORTS/.
1.1 dsieger 5003:
5004: If you choose one of these predefined sites, you may want to specify a
5005: subdirectory of that site. Since these macros may expand to more than one
5006: actual site, you must use the following construct to specify a subdirectory:
5007:
5008: MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/}
5009: MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=project_name/}
5010:
5011: Note the trailing slash after the subdirectory name.
5012:
1.154 rillig 5013: 19.5.2. How are the files fetched?
1.1 dsieger 5014:
5015: The fetch phase makes sure that all the distfiles exist in a local directory
5016: (DISTDIR, which can be set by the pkgsrc user). If the files do not exist, they
5017: are fetched using commands of the form
5018:
5019: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
5020:
5021: where ${site} varies through several possibilities in turn: first,
5022: MASTER_SITE_OVERRIDE is tried, then the sites specified in either SITES.file if
5023: defined, else MASTER_SITES or PATCH_SITES, as applies, then finally the value
5024: of MASTER_SITE_BACKUP. The order of all except the first and the last can be
5025: optionally sorted by the user, via setting either MASTER_SORT_RANDOM, and
5026: MASTER_SORT_AWK or MASTER_SORT_REGEX.
5027:
1.16 jnemeth 5028: The specific command and arguments used depend on the FETCH_USING parameter.
5029: The example above is for FETCH_USING=custom.
5030:
1.1 dsieger 5031: The distfiles mirror run by the NetBSD Foundation uses the mirror-distfiles
5032: target to mirror the distfiles, if they are freely distributable. Packages
5033: setting NO_SRC_ON_FTP (usually to "${RESTRICTED}") will not have their
5034: distfiles mirrored.
5035:
1.154 rillig 5036: 19.6. The checksum phase
1.1 dsieger 5037:
5038: After the distfile(s) are fetched, their checksum is generated and compared
5039: with the checksums stored in the distinfo file. If the checksums don't match,
5040: the build is aborted. This is to ensure the same distfile is used for building,
5041: and that the distfile wasn't changed, e.g. by some malign force, deliberately
5042: changed distfiles on the master distribution site or network lossage.
5043:
1.154 rillig 5044: 19.7. The extract phase
1.1 dsieger 5045:
5046: When the distfiles are present on the local system, they need to be extracted,
5047: as they usually come in the form of some compressed archive format.
5048:
5049: By default, all DISTFILES are extracted. If you only need some of them, you can
5050: set the EXTRACT_ONLY variable to the list of those files.
5051:
5052: Extracting the files is usually done by a little program, mk/extract/extract,
5053: which already knows how to extract various archive formats, so most likely you
5054: will not need to change anything here. But if you need, the following variables
5055: may help you:
5056:
5057: EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}
5058:
5059: Use these variables to override the default options for an extract command,
5060: which are defined in mk/extract/extract.
5061:
5062: EXTRACT_USING
5063:
1.14 jmcneill 5064: This variable can be set to bsdtar, gtar, nbtar (which is the default
5065: value), pax, or an absolute pathname pointing to the command with which tar
5066: archives should be extracted. It is preferred to choose bsdtar over gtar if
5067: NetBSD's pax-as-tar is not good enough.
1.1 dsieger 5068:
5069: If the extract program doesn't serve your needs, you can also override the
5070: EXTRACT_CMD variable, which holds the command used for extracting the files.
5071: This command is executed in the ${WRKSRC} directory. During execution of this
5072: command, the shell variable extract_file holds the absolute pathname of the
5073: file that is going to be extracted.
5074:
5075: And if that still does not suffice, you can override the do-extract target in
5076: the package Makefile.
5077:
1.154 rillig 5078: 19.8. The patch phase
1.1 dsieger 5079:
5080: After extraction, all the patches named by the PATCHFILES, those present in the
5081: patches subdirectory of the package as well as in $LOCALPATCHES/$PKGPATH (e.g.
5082: /usr/local/patches/graphics/png) are applied. Patchfiles ending in .Z or .gz
5083: are uncompressed before they are applied, files ending in .orig or .rej are
5084: ignored. Any special options to patch(1) can be handed in PATCH_DIST_ARGS. See
1.154 rillig 5085: Section 13.3, "patches/*" for more details.
1.1 dsieger 5086:
5087: By default patch(1) is given special args to make it fail if the patches apply
5088: with some lines of fuzz. Please fix (regen) the patches so that they apply
5089: cleanly. The rationale behind this is that patches that don't apply cleanly may
5090: end up being applied in the wrong place, and cause severe harm there.
5091:
1.154 rillig 5092: 19.9. The tools phase
1.1 dsieger 5093:
1.154 rillig 5094: This is covered in Chapter 20, Tools needed for building or running.
1.1 dsieger 5095:
1.154 rillig 5096: 19.10. The wrapper phase
1.1 dsieger 5097:
5098: This phase creates wrapper programs for the compilers and linkers. The
5099: following variables can be used to tweak the wrappers.
5100:
5101: ECHO_WRAPPER_MSG
5102:
5103: The command used to print progress messages. Does nothing by default. Set
5104: to ${ECHO} to see the progress messages.
5105:
5106: WRAPPER_DEBUG
5107:
5108: This variable can be set to yes (default) or no, depending on whether you
5109: want additional information in the wrapper log file.
5110:
5111: WRAPPER_UPDATE_CACHE
5112:
5113: This variable can be set to yes or no, depending on whether the wrapper
5114: should use its cache, which will improve the speed. The default value is
5115: yes, but is forced to no if the platform does not support it.
5116:
5117: WRAPPER_REORDER_CMDS
5118:
5119: A list of reordering commands. A reordering command has the form reorder:l:
5120: lib1:lib2. It ensures that that -llib1 occurs before -llib2.
5121:
5122: WRAPPER_TRANSFORM_CMDS
5123:
5124: A list of transformation commands. [TODO: investigate further]
5125:
1.154 rillig 5126: 19.11. The configure phase
1.1 dsieger 5127:
5128: Most pieces of software need information on the header files, system calls, and
5129: library routines which are available on the platform they run on. The process
5130: of determining this information is known as configuration, and is usually
5131: automated. In most cases, a script is supplied with the distfiles, and its
5132: invocation results in generation of header files, Makefiles, etc.
5133:
5134: If the package contains a configure script, this can be invoked by setting
5135: HAS_CONFIGURE to "yes". If the configure script is a GNU autoconf script, you
5136: should set GNU_CONFIGURE to "yes" instead. What happens in the configure phase
5137: is roughly:
5138:
5139: .for d in ${CONFIGURE_DIRS}
5140: cd ${WRKSRC} \
5141: && cd ${d} \
5142: && env ${CONFIGURE_ENV} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
5143: .endfor
5144:
5145: CONFIGURE_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In
5146: each of these directories, the configure script is run with the environment
5147: CONFIGURE_ENV and arguments CONFIGURE_ARGS. The variables CONFIGURE_ENV,
5148: CONFIGURE_SCRIPT (default: "./configure") and CONFIGURE_ARGS may all be changed
5149: by the package.
5150:
1.38 wiz 5151: If the program uses the Perl way of configuration (mainly Perl modules, but not
5152: only), i.e. a file called Makefile.PL, it should include ../../lang/perl5/
5153: module.mk. To set any parameter for Makefile.PL use the MAKE_PARAMS variable
5154: (e.g., MAKE_PARAMS+=foo=bar
5155:
1.1 dsieger 5156: If the program uses an Imakefile for configuration, the appropriate steps can
1.99 sevan 5157: be invoked by setting USE_IMAKE to "yes". If you only need xmkmf, add it to
5158: USE_TOOLS. You can add variables to xmkmf's environment by adding them to the
5159: SCRIPTS_ENV variable.
1.1 dsieger 5160:
1.11 rillig 5161: If the program uses cmake for configuration, the appropriate steps can be
5162: invoked by setting USE_CMAKE to "yes". You can add variables to cmake's
5163: environment by adding them to the CONFIGURE_ENV variable and arguments to cmake
5164: by adding them to the CMAKE_ARGS variable. The top directory argument is given
5165: by the CMAKE_ARG_PATH variable, that defaults to "." (relative to
5166: CONFIGURE_DIRS)
5167:
1.1 dsieger 5168: If there is no configure step at all, set NO_CONFIGURE to "yes".
5169:
1.154 rillig 5170: 19.12. The build phase
1.1 dsieger 5171:
5172: For building a package, a rough equivalent of the following code is executed.
5173:
5174: .for d in ${BUILD_DIRS}
5175: cd ${WRKSRC} \
5176: && cd ${d} \
5177: && env ${MAKE_ENV} \
5178: ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
5179: -f ${MAKE_FILE} \
5180: ${BUILD_TARGET}
5181: .endfor
5182:
5183: BUILD_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In each of
5184: these directories, MAKE_PROGRAM is run with the environment MAKE_ENV and
5185: arguments BUILD_MAKE_FLAGS. The variables MAKE_ENV, BUILD_MAKE_FLAGS, MAKE_FILE
5186: and BUILD_TARGET may all be changed by the package.
5187:
1.25 wiz 5188: The default value of MAKE_PROGRAM is "gmake" if USE_TOOLS contains "gmake", "
5189: make" otherwise. The default value of MAKE_FILE is "Makefile", and BUILD_TARGET
5190: defaults to "all".
1.1 dsieger 5191:
5192: If there is no build step at all, set NO_BUILD to "yes".
5193:
1.154 rillig 5194: 19.13. The test phase
1.1 dsieger 5195:
5196: [TODO]
5197:
1.154 rillig 5198: 19.14. The install phase
1.1 dsieger 5199:
5200: Once the build stage has completed, the final step is to install the software
5201: in public directories, so users can access the programs and files.
5202:
5203: In the install phase, a rough equivalent of the following code is executed.
5204: Additionally, before and after this code, much magic is performed to do
5205: consistency checks, registering the package, and so on.
5206:
5207: .for d in ${INSTALL_DIRS}
5208: cd ${WRKSRC} \
5209: && cd ${d} \
5210: && env ${MAKE_ENV} \
5211: ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \
5212: -f ${MAKE_FILE} \
5213: ${INSTALL_TARGET}
5214: .endfor
5215:
5216: The variable's meanings are analogous to the ones in the build phase.
5217: INSTALL_DIRS defaults to BUILD_DIRS. INSTALL_TARGET is "install" by default,
5218: plus "install.man" if USE_IMAKE is defined and NO_INSTALL_MANPAGES is not
5219: defined.
5220:
5221: In the install phase, the following variables are useful. They are all
5222: variations of the install(1) command that have the owner, group and permissions
5223: preset. INSTALL is the plain install command. The specialized variants,
5224: together with their intended use, are:
5225:
5226: INSTALL_PROGRAM_DIR
5227:
5228: directories that contain binaries
5229:
5230: INSTALL_SCRIPT_DIR
5231:
5232: directories that contain scripts
5233:
5234: INSTALL_LIB_DIR
5235:
5236: directories that contain shared and static libraries
5237:
5238: INSTALL_DATA_DIR
5239:
5240: directories that contain data files
5241:
5242: INSTALL_MAN_DIR
5243:
5244: directories that contain man pages
5245:
1.100 leot 5246: INSTALL_GAME_DIR
5247:
5248: directories that contain data files for games
5249:
1.1 dsieger 5250: INSTALL_PROGRAM
5251:
5252: binaries that can be stripped from debugging symbols
5253:
5254: INSTALL_SCRIPT
5255:
5256: binaries that cannot be stripped
5257:
5258: INSTALL_GAME
5259:
5260: game binaries
5261:
5262: INSTALL_LIB
5263:
5264: shared and static libraries
5265:
5266: INSTALL_DATA
5267:
5268: data files
5269:
5270: INSTALL_GAME_DATA
5271:
5272: data files for games
5273:
5274: INSTALL_MAN
5275:
5276: man pages
5277:
5278: Some other variables are:
5279:
1.106 tnn 5280: INSTALL_UNSTRIPPED
5281:
5282: If set to yes, do not run strip(1) when installing binaries. Any debugging
5283: sections and symbols present in binaries will be preserved.
5284:
1.1 dsieger 5285: INSTALLATION_DIRS
5286:
5287: A list of directories relative to PREFIX that are created by pkgsrc at the
5288: beginning of the install phase. The package is supposed to create all
5289: needed directories itself before installing files to it and list all other
5290: directories here.
5291:
1.25 wiz 5292: In the rare cases that a package shouldn't install anything, set NO_INSTALL to
1.1 dsieger 5293: "yes". This is mostly relevant for packages in the regress category.
5294:
1.154 rillig 5295: 19.15. The package phase
1.1 dsieger 5296:
5297: Once the install stage has completed, a binary package of the installed files
5298: can be built. These binary packages can be used for quick installation without
5299: previous compilation, e.g. by the make bin-install or by using pkg_add.
5300:
5301: By default, the binary packages are created in ${PACKAGES}/All and symlinks are
5302: created in ${PACKAGES}/category, one for each category in the CATEGORIES
5303: variable. PACKAGES defaults to pkgsrc/packages.
5304:
1.154 rillig 5305: 19.16. Cleaning up
1.1 dsieger 5306:
5307: Once you're finished with a package, you can clean the work directory by
5308: running make clean. If you want to clean the work directories of all
5309: dependencies too, use make clean-depends.
5310:
1.154 rillig 5311: 19.17. Other helpful targets
1.1 dsieger 5312:
5313: pre/post-*
5314:
5315: For any of the main targets described in the previous section, two
5316: auxiliary targets exist with "pre-" and "post-" used as a prefix for the
5317: main target's name. These targets are invoked before and after the main
5318: target is called, allowing extra configuration or installation steps be
5319: performed from a package's Makefile, for example, which a program's
5320: configure script or install target omitted.
5321:
5322: do-*
5323:
5324: Should one of the main targets do the wrong thing, and should there be no
5325: variable to fix this, you can redefine it with the do-* target. (Note that
5326: redefining the target itself instead of the do-* target is a bad idea, as
5327: the pre-* and post-* targets won't be called anymore, etc.) You will not
5328: usually need to do this.
5329:
5330: reinstall
5331:
5332: If you did a make install and you noticed some file was not installed
5333: properly, you can repeat the installation with this target, which will
5334: ignore the "already installed" flag.
5335:
5336: This is the default value of DEPENDS_TARGET except in the case of make
5337: update and make package, where the defaults are "package" and "update",
5338: respectively.
5339:
5340: deinstall
5341:
5342: This target does a pkg_delete(1) in the current directory, effectively
5343: de-installing the package. The following variables can be used to tune the
5344: behaviour:
5345:
5346: PKG_VERBOSE
5347:
5348: Add a "-v" to the pkg_delete(1) command.
5349:
5350: DEINSTALLDEPENDS
5351:
5352: Remove all packages that require (depend on) the given package. This
5353: can be used to remove any packages that may have been pulled in by a
5354: given package, e.g. if make deinstall DEINSTALLDEPENDS=1 is done in
1.25 wiz 5355: pkgsrc/x11/kde, this is likely to remove whole KDE. Works by adding "-R
5356: " to the pkg_delete(1) command line.
1.1 dsieger 5357:
5358: bin-install
5359:
5360: Install a binary package from local disk and via FTP from a list of sites
5361: (see the BINPKG_SITES variable), and do a make package if no binary package
5362: is available anywhere. The arguments given to pkg_add can be set via
5363: BIN_INSTALL_FLAGS e.g., to do verbose operation, etc.
5364:
1.95 wiz 5365: install-clean
5366:
5367: This target removes the state files for the "install" and later phases so
5368: that the "install" target may be re-invoked. This can be used after editing
5369: the PLIST to install the package without rebuilding it.
5370:
5371: build-clean
5372:
5373: This target removes the state files for the "build" and later phases so
5374: that the "build" target may be re-invoked.
5375:
1.1 dsieger 5376: update
5377:
5378: This target causes the current package to be updated to the latest version.
5379: The package and all depending packages first get de-installed, then current
5380: versions of the corresponding packages get compiled and installed. This is
5381: similar to manually noting which packages are currently installed, then
5382: performing a series of make deinstall and make install (or whatever
5383: UPDATE_TARGET is set to) for these packages.
5384:
5385: You can use the "update" target to resume package updating in case a
5386: previous make update was interrupted for some reason. However, in this
5387: case, make sure you don't call make clean or otherwise remove the list of
5388: dependent packages in WRKDIR. Otherwise, you lose the ability to
5389: automatically update the current package along with the dependent packages
5390: you have installed.
5391:
5392: Resuming an interrupted make update will only work as long as the package
5393: tree remains unchanged. If the source code for one of the packages to be
5394: updated has been changed, resuming make update will most certainly fail!
5395:
1.4 rillig 5396: The following variables can be used either on the command line or in
1.1 dsieger 5397: mk.conf to alter the behaviour of make update:
5398:
5399: UPDATE_TARGET
5400:
5401: Install target to recursively use for the updated package and the
5402: dependent packages. Defaults to DEPENDS_TARGET if set, "install"
1.25 wiz 5403: otherwise for make update. Other good targets are "package" or "
5404: bin-install". Do not set this to "update" or you will get stuck in an
1.1 dsieger 5405: endless loop!
5406:
5407: NOCLEAN
5408:
5409: Don't clean up after updating. Useful if you want to leave the work
5410: sources of the updated packages around for inspection or other
1.25 wiz 5411: purposes. Be sure you eventually clean up the source tree (see the "
5412: clean-update" target below) or you may run into troubles with old
1.1 dsieger 5413: source code still lying around on your next make or make update.
5414:
5415: REINSTALL
5416:
5417: Deinstall each package before installing (making DEPENDS_TARGET). This
5418: may be necessary if the "clean-update" target (see below) was called
5419: after interrupting a running make update.
5420:
5421: DEPENDS_TARGET
5422:
5423: Allows you to disable recursion and hardcode the target for packages.
5424: The default is "update" for the update target, facilitating a recursive
5425: update of prerequisite packages. Only set DEPENDS_TARGET if you want to
5426: disable recursive updates. Use UPDATE_TARGET instead to just set a
5427: specific target for each package to be installed during make update
5428: (see above).
5429:
5430: clean-update
5431:
5432: Clean the source tree for all packages that would get updated if make
5433: update was called from the current directory. This target should not be
5434: used if the current package (or any of its depending packages) have already
5435: been de-installed (e.g., after calling make update) or you may lose some
1.25 wiz 5436: packages you intended to update. As a rule of thumb: only use this target
1.1 dsieger 5437: before the first time you run make update and only if you have a dirty
5438: package tree (e.g., if you used NOCLEAN).
5439:
5440: If you are unsure about whether your tree is clean, you can either perform
5441: a make clean at the top of the tree, or use the following sequence of
5442: commands from the directory of the package you want to update (before
5443: running make update for the first time, otherwise you lose all the packages
5444: you wanted to update!):
5445:
5446: # make clean-update
5447: # make clean CLEANDEPENDS=YES
5448: # make update
5449:
5450:
1.4 rillig 5451: The following variables can be used either on the command line or in
1.1 dsieger 5452: mk.conf to alter the behaviour of make clean-update:
5453:
5454: CLEAR_DIRLIST
5455:
5456: After make clean, do not reconstruct the list of directories to update
5457: for this package. Only use this if make update successfully installed
5458: all packages you wanted to update. Normally, this is done automatically
5459: on make update, but may have been suppressed by the NOCLEAN variable
5460: (see above).
5461:
5462: replace
5463:
5464: Update the installation of the current package. This differs from update in
5465: that it does not replace dependent packages. You will need to install
5466: pkgtools/pkg_tarup for this target to work.
5467:
5468: Be careful when using this target! There are no guarantees that dependent
5469: packages will still work, in particular they will most certainly break if
5470: you make replace a library package whose shared library major version
5471: changed between your installed version and the new one. For this reason,
5472: this target is not officially supported and only recommended for advanced
5473: users.
5474:
5475: info
5476:
5477: This target invokes pkg_info(1) for the current package. You can use this
5478: to check which version of a package is installed.
5479:
5480: index
5481:
5482: This is a top-level command, i.e. it should be used in the pkgsrc
5483: directory. It creates a database of all packages in the local pkgsrc tree,
5484: including dependencies, comment, maintainer, and some other useful
5485: information. Individual entries are created by running make describe in the
5486: packages' directories. This index file is saved as pkgsrc/INDEX. It can be
5487: displayed in verbose format by running make print-index. You can search in
5488: it with make search key=something. You can extract a list of all packages
5489: that depend on a particular one by running make show-deps PKG=somepackage.
5490:
5491: Running this command takes a very long time, some hours even on fast
5492: machines!
5493:
5494: readme
5495:
5496: This target generates a README.html file, which can be viewed using a
5497: browser such as www/firefox or www/links. The generated files contain
5498: references to any packages which are in the PACKAGES directory on the local
5499: host. The generated files can be made to refer to URLs based on
5500: FTP_PKG_URL_HOST and FTP_PKG_URL_DIR. For example, if I wanted to generate
5501: README.html files which pointed to binary packages on the local machine, in
5502: the directory /usr/packages, set FTP_PKG_URL_HOST=file://localhost and
5503: FTP_PKG_URL_DIR=/usr/packages. The ${PACKAGES} directory and its
5504: subdirectories will be searched for all the binary packages.
5505:
5506: The target can be run at the toplevel or in category directories, in which
5507: case it descends recursively.
5508:
5509: readme-all
5510:
5511: This is a top-level command, run it in pkgsrc. Use this target to create a
5512: file README-all.html which contains a list of all packages currently
5513: available in the NetBSD Packages Collection, together with the category
5514: they belong to and a short description. This file is compiled from the
5515: pkgsrc/*/README.html files, so be sure to run this after a make readme.
5516:
5517: cdrom-readme
5518:
5519: This is very much the same as the "readme" target (see above), but is to be
5520: used when generating a pkgsrc tree to be written to a CD-ROM. This target
5521: also produces README.html files, and can be made to refer to URLs based on
5522: CDROM_PKG_URL_HOST and CDROM_PKG_URL_DIR.
5523:
5524: show-distfiles
5525:
5526: This target shows which distfiles and patchfiles are needed to build the
5527: package (ALLFILES, which contains all DISTFILES and PATCHFILES, but not
5528: patches/*).
5529:
5530: show-downlevel
5531:
5532: This target shows nothing if the package is not installed. If a version of
5533: this package is installed, but is not the version provided in this version
5534: of pkgsrc, then a warning message is displayed. This target can be used to
5535: show which of your installed packages are downlevel, and so the old
5536: versions can be deleted, and the current ones added.
5537:
5538: show-pkgsrc-dir
5539:
5540: This target shows the directory in the pkgsrc hierarchy from which the
5541: package can be built and installed. This may not be the same directory as
5542: the one from which the package was installed. This target is intended to be
5543: used by people who may wish to upgrade many packages on a single host, and
1.25 wiz 5544: can be invoked from the top-level pkgsrc Makefile by using the "
5545: show-host-specific-pkgs" target.
1.1 dsieger 5546:
5547: show-installed-depends
5548:
5549: This target shows which installed packages match the current package's
5550: DEPENDS. Useful if out of date dependencies are causing build problems.
5551:
1.95 wiz 5552: print-build-depends-list
5553:
5554: This target shows the list of packages that the current package depends on
5555: for building.
5556:
5557: print-run-depends-list
5558:
5559: This target shows the list of packages that the current package depends on
5560: for running.
5561:
1.1 dsieger 5562: check-shlibs
5563:
5564: After a package is installed, check all its binaries and (on ELF platforms)
5565: shared libraries to see if they find the shared libs they need. Run by
1.4 rillig 5566: default if PKG_DEVELOPER is set in mk.conf.
1.1 dsieger 5567:
5568: print-PLIST
5569:
5570: After a "make install" from a new or upgraded pkg, this prints out an
5571: attempt to generate a new PLIST from a find -newer work/.extract_done. An
5572: attempt is made to care for shared libs etc., but it is strongly
5573: recommended to review the result before putting it into PLIST. On upgrades,
5574: it's useful to diff the output of this command against an already existing
5575: PLIST file.
5576:
5577: If the package installs files via tar(1) or other methods that don't update
5578: file access times, be sure to add these files manually to your PLIST, as
5579: the "find -newer" command used by this target won't catch them!
5580:
1.154 rillig 5581: See Section 15.3, "Tweaking output of make print-PLIST" for more
1.1 dsieger 5582: information on this target.
5583:
5584: bulk-package
5585:
5586: Used to do bulk builds. If an appropriate binary package already exists, no
5587: action is taken. If not, this target will compile, install and package it
1.154 rillig 5588: (and its depends, if PKG_DEPENDS is set properly. See Chapter 8, Creating
1.66 asau 5589: binary packages for everything in pkgsrc (bulk builds)). After creating the
5590: binary package, the sources, the just-installed package and its required
5591: packages are removed, preserving free disk space.
1.1 dsieger 5592:
5593: Beware that this target may deinstall all packages installed on a system!
5594:
5595: bulk-install
5596:
5597: Used during bulk-installs to install required packages. If an up-to-date
1.25 wiz 5598: binary package is available, it will be installed via pkg_add(1). If not,
1.1 dsieger 5599: make bulk-package will be executed, but the installed binary won't be
5600: removed.
5601:
5602: A binary package is considered "up-to-date" to be installed via pkg_add(1)
5603: if:
5604:
1.42 asau 5605: + None of the package's files (Makefile, ...) were modified since it was
1.1 dsieger 5606: built.
5607:
1.42 asau 5608: + None of the package's required (binary) packages were modified since it
1.1 dsieger 5609: was built.
5610:
5611: Beware that this target may deinstall all packages installed on a system!
5612:
1.154 rillig 5613: Chapter 20. Tools needed for building or running
1.1 dsieger 5614:
5615: Table of Contents
5616:
1.154 rillig 5617: 20.1. Tools for pkgsrc builds
5618: 20.2. Tools needed by packages
5619: 20.3. Tools provided by platforms
1.1 dsieger 5620:
5621: The USE_TOOLS definition is used both internally by pkgsrc and also for
5622: individual packages to define what commands are needed for building a package
1.156 leot 5623: (like TOOL_DEPENDS) or for later run-time of an installed packaged (such as
1.1 dsieger 5624: DEPENDS). If the native system provides an adequate tool, then in many cases, a
5625: pkgsrc package will not be used.
5626:
5627: When building a package, the replacement tools are made available in a
5628: directory (as symlinks or wrapper scripts) that is early in the executable
5629: search path. Just like the buildlink system, this helps with consistent builds.
5630:
5631: A tool may be needed to help build a specific package. For example, perl, GNU
5632: make (gmake) or yacc may be needed.
5633:
5634: Also a tool may be needed, for example, because the native system's supplied
5635: tool may be inefficient for building a package with pkgsrc. For example, a
5636: package may need GNU awk, bison (instead of yacc) or a better sed.
5637:
5638: The tools used by a package can be listed by running make show-tools.
5639:
1.154 rillig 5640: 20.1. Tools for pkgsrc builds
1.1 dsieger 5641:
5642: The default set of tools used by pkgsrc is defined in bsd.pkg.mk. This includes
5643: standard Unix tools, such as: cat, awk, chmod, test, and so on. These can be
5644: seen by running: make show-var VARNAME=USE_TOOLS.
5645:
5646: If a package needs a specific program to build then the USE_TOOLS variable can
5647: be used to define the tools needed.
5648:
1.154 rillig 5649: 20.2. Tools needed by packages
1.1 dsieger 5650:
1.29 wiz 5651: In the following examples, the :run means that it is needed at run-time (and
5652: becomes a DEPENDS). The default is a build dependency which can be set with
5653: :build. (So in this example, it is the same as gmake:build and
5654: pkg-config:build.)
1.1 dsieger 5655:
5656: USE_TOOLS+= gmake perl:run pkg-config
5657:
5658: When using the tools framework, a TOOLS_PATH.foo variable is defined which
5659: contains the full path to the appropriate tool. For example, TOOLS_PATH.bash
5660: could be "/bin/bash" on Linux systems.
5661:
5662: If you always need a pkgsrc version of the tool at run-time, then just use
5663: DEPENDS instead.
5664:
1.154 rillig 5665: 20.3. Tools provided by platforms
1.1 dsieger 5666:
5667: When improving or porting pkgsrc to a new platform, have a look at (or create)
5668: the corresponding platform specific make file fragment under pkgsrc/mk/tools/
5669: tools.${OPSYS}.mk which defines the name of the common tools. For example:
5670:
5671: .if exists(/usr/bin/bzcat)
5672: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
5673: .elif exists(/usr/bin/bzip2)
5674: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
5675: .endif
5676:
5677: TOOLS_PLATFORM.true?= true # shell builtin
5678:
1.154 rillig 5679: Chapter 21. Making your package work
1.1 dsieger 5680:
5681: Table of Contents
5682:
1.154 rillig 5683: 21.1. General operation
1.1 dsieger 5684:
1.154 rillig 5685: 21.1.1. How to pull in user-settable variables from mk.conf
5686: 21.1.2. User interaction
5687: 21.1.3. Handling licenses
5688: 21.1.4. Restricted packages
5689: 21.1.5. Handling dependencies
5690: 21.1.6. Handling conflicts with other packages
5691: 21.1.7. Packages that cannot or should not be built
5692: 21.1.8. Packages which should not be deleted, once installed
5693: 21.1.9. Handling packages with security problems
5694: 21.1.10. How to handle incrementing versions when fixing an existing
1.1 dsieger 5695: package
1.154 rillig 5696: 21.1.11. Substituting variable text in the package files (the SUBST
1.1 dsieger 5697: framework)
5698:
1.154 rillig 5699: 21.2. The fetch phase
1.1 dsieger 5700:
1.154 rillig 5701: 21.2.1. Packages whose distfiles aren't available for plain downloading
5702: 21.2.2. How to handle modified distfiles with the 'old' name
5703: 21.2.3. Packages hosted on github.com
5704:
5705: 21.3. The configure phase
5706:
5707: 21.3.1. Shared libraries - libtool
5708: 21.3.2. Using libtool on GNU packages that already support libtool
5709: 21.3.3. GNU Autoconf/Automake
5710:
5711: 21.4. Programming languages
5712:
5713: 21.4.1. C, C++, and Fortran
5714: 21.4.2. Java
5715: 21.4.3. Packages containing perl scripts
5716: 21.4.4. Packages containing shell scripts
5717: 21.4.5. Other programming languages
5718:
5719: 21.5. The build phase
5720:
5721: 21.5.1. Compiling C and C++ code conditionally
5722: 21.5.2. How to handle compiler bugs
1.172 rillig 5723: 21.5.3. No such file or directory
5724: 21.5.4. Undefined reference to "..."
5725: 21.5.5. Running out of memory
1.154 rillig 5726:
5727: 21.6. The install phase
5728:
5729: 21.6.1. Creating needed directories
5730: 21.6.2. Where to install documentation
5731: 21.6.3. Installing highscore files
5732: 21.6.4. Adding DESTDIR support to packages
5733: 21.6.5. Packages with hardcoded paths to other interpreters
5734: 21.6.6. Packages installing perl modules
5735: 21.6.7. Packages installing info files
5736: 21.6.8. Packages installing man pages
5737: 21.6.9. Packages installing GConf data files
5738: 21.6.10. Packages installing scrollkeeper/rarian data files
5739: 21.6.11. Packages installing X11 fonts
5740: 21.6.12. Packages installing GTK2 modules
5741: 21.6.13. Packages installing SGML or XML data
5742: 21.6.14. Packages installing extensions to the MIME database
5743: 21.6.15. Packages using intltool
5744: 21.6.16. Packages installing startup scripts
5745: 21.6.17. Packages installing TeX modules
5746: 21.6.18. Packages supporting running binaries in emulation
5747: 21.6.19. Packages installing hicolor theme icons
5748: 21.6.20. Packages installing desktop files
1.1 dsieger 5749:
1.154 rillig 5750: 21.7. Marking packages as having problems
1.1 dsieger 5751:
1.154 rillig 5752: 21.1. General operation
1.1 dsieger 5753:
5754: One appealing feature of pkgsrc is that it runs on many different platforms. As
5755: a result, it is important to ensure, where possible, that packages in pkgsrc
5756: are portable. This chapter mentions some particular details you should pay
5757: attention to while working on pkgsrc.
5758:
1.154 rillig 5759: 21.1.1. How to pull in user-settable variables from mk.conf
1.1 dsieger 5760:
5761: The pkgsrc user can configure pkgsrc by overriding several variables in the
1.4 rillig 5762: file pointed to by MAKECONF, which is mk.conf by default. When you want to use
5763: those variables in the preprocessor directives of make(1) (for example .if or
5764: .for), you need to include the file ../../mk/bsd.prefs.mk before, which in turn
5765: loads the user preferences.
1.1 dsieger 5766:
5767: But note that some variables may not be completely defined after ../../mk/
5768: bsd.prefs.mk has been included, as they may contain references to variables
1.108 rillig 5769: that are not yet defined. In shell commands (the lines in Makefile that are
5770: indented with a tab) this is no problem, since variables are only expanded when
5771: they are used. But in the preprocessor directives mentioned above and in
5772: dependency lines (of the form target: dependencies) the variables are expanded
5773: at load time.
1.1 dsieger 5774:
5775: Note
5776:
1.108 rillig 5777: To check whether a variable can be used at load time, run pkglint -Wall on your
5778: package.
1.1 dsieger 5779:
1.154 rillig 5780: 21.1.2. User interaction
1.1 dsieger 5781:
5782: Occasionally, packages require interaction from the user, and this can be in a
5783: number of ways:
5784:
5785: * When fetching the distfiles, some packages require user interaction such as
5786: entering username/password or accepting a license on a web page.
5787:
5788: * When extracting the distfiles, some packages may ask for passwords.
5789:
5790: * help to configure the package before it is built
5791:
5792: * help during the build process
5793:
5794: * help during the installation of a package
5795:
1.108 rillig 5796: A package can set the INTERACTIVE_STAGE variable to define which stages need
5797: interaction. This should be done in the package's Makefile, e.g.:
1.1 dsieger 5798:
5799: INTERACTIVE_STAGE= configure install
5800:
5801: The user can then decide to skip this package by setting the BATCH variable.
1.108 rillig 5802: Packages that require interaction are also excluded from bulk builds.
1.1 dsieger 5803:
1.154 rillig 5804: 21.1.3. Handling licenses
1.1 dsieger 5805:
5806: Authors of software can choose the licence under which software can be copied.
1.111 sevan 5807: The Free Software Foundation has declared some licenses "Free", and the Open
5808: Source Initiative has a definition of "Open Source".
5809:
5810: By default, pkgsrc allows packages with Free or Open Source licenses to be
5811: built. To allow packages with other licenses to be built as well, the pkgsrc
5812: user needs to add these licenses to the ACCEPTABLE_LICENSES variable in mk.conf
5813: . Note that this variable only affects which packages may be built, while the
5814: license terms often also restrict the actual use of the package and its
5815: redistribution.
1.1 dsieger 5816:
5817: One might want to only install packages with a BSD license, or the GPL, and not
1.20 jnemeth 5818: the other. The free licenses are added to the default ACCEPTABLE_LICENSES
1.111 sevan 5819: variable. The pkgsrc user can override the default by setting the
5820: ACCEPTABLE_LICENSES variable with "=" instead of "+=". The licenses accepted by
5821: default are defined in the DEFAULT_ACCEPTABLE_LICENSES variable in the file
5822: pkgsrc/mk/license.mk.
1.1 dsieger 5823:
5824: The license tag mechanism is intended to address copyright-related issues
5825: surrounding building, installing and using a package, and not to address
1.20 jnemeth 5826: redistribution issues (see RESTRICTED and NO_SRC_ON_FTP, etc.). Packages with
5827: redistribution restrictions should set these tags.
1.1 dsieger 5828:
5829: Denoting that a package may be copied according to a particular license is done
5830: by placing the license in pkgsrc/licenses and setting the LICENSE variable to a
5831: string identifying the license, e.g. in graphics/xv:
5832:
5833: LICENSE= xv-license
5834:
5835: When trying to build, the user will get a notice that the package is covered by
5836: a license which has not been placed in the ACCEPTABLE_LICENSES variable:
5837:
5838: % make
5839: ===> xv-3.10anb9 has an unacceptable license: xv-license.
5840: ===> To view the license, enter "/usr/bin/make show-license".
5841: ===> To indicate acceptance, add this line to your /etc/mk.conf:
5842: ===> ACCEPTABLE_LICENSES+=xv-license
5843: *** Error code 1
5844:
5845: The license can be viewed with make show-license, and if the user so chooses,
1.4 rillig 5846: the line printed above can be added to mk.conf to convey to pkgsrc that it
1.1 dsieger 5847: should not in the future fail because of that license:
5848:
5849: ACCEPTABLE_LICENSES+=xv-license
5850:
1.111 sevan 5851: The use of LICENSE=shareware, LICENSE=no-commercial-use, and similar language
5852: is deprecated because it does not crisply refer to a particular license text.
5853: Another problem with such usage is that it does not enable a user to tell
5854: pkgsrc to proceed for a single package without also telling pkgsrc to proceed
5855: for all packages with that tag.
5856:
1.154 rillig 5857: 21.1.3.1. Adding a package with a new license
1.1 dsieger 5858:
1.49 rodent 5859: When adding a package with a new license, the following steps are required:
5860:
1.111 sevan 5861: 1. Check whether the license qualifies as Free or Open Source by referencing
5862: Various Licenses and Comments about Them and Licenses by Name | Open Source
5863: Initiative. If this is the case, the filename in pkgsrc/licenses/ does not
5864: need the -license suffix, and the license name should be added to:
1.49 rodent 5865:
5866: + DEFAULT_ACCEPTABLE_LICENSES in pkgsrc/mk/license.mk
5867:
5868: + default_acceptable_licenses in pkgsrc/pkgtools/pkg_install/files/lib/
5869: license.c
5870:
5871: 2. The license text should be added to pkgsrc/licenses for displaying. A list
5872: of known licenses can be seen in this directory.
1.1 dsieger 5873:
1.154 rillig 5874: 21.1.3.2. Change to the license
1.1 dsieger 5875:
1.111 sevan 5876: When the license changes (in a way other than formatting), make sure that the
5877: new license has a different name (e.g., append the version number if it exists,
5878: or the date). Just because a user told pkgsrc to build programs under a
5879: previous version of a license does not mean that pkgsrc should build programs
5880: under the new licenses. The higher-level point is that pkgsrc does not evaluate
5881: licenses for reasonableness; the only test is a mechanistic test of whether a
5882: particular text has been approved by either of two bodies (FSF or OSI).
1.1 dsieger 5883:
1.154 rillig 5884: 21.1.4. Restricted packages
1.1 dsieger 5885:
1.111 sevan 5886: Some licenses restrict how software may be re-distributed. By declaring the
5887: restrictions, package tools can automatically refrain from e.g. placing binary
5888: packages on FTP sites.
5889:
5890: There are four possible restrictions, which are the cross product of sources
5891: (distfiles) and binaries not being placed on FTP sites and CD-ROMs. Because
5892: this is rarely the exact language in any license, and because non-Free licenses
5893: tend to be different from each other, pkgsrc adopts a definition of FTP and
5894: CD-ROM. "FTP" means making the source or binary file available over the
5895: Internet at no charge. "CD-ROM" means making the source or binary available on
5896: some kind of media, together with other source and binary packages, which is
5897: sold for a distribution charge.
1.1 dsieger 5898:
5899: In order to encode these restrictions, the package system defines five make
5900: variables that can be set to note these restrictions:
5901:
5902: * RESTRICTED
5903:
5904: This variable should be set whenever a restriction exists (regardless of
5905: its kind). Set this variable to a string containing the reason for the
5906: restriction. It should be understood that those wanting to understand the
5907: restriction will have to read the license, and perhaps seek advice of
5908: counsel.
5909:
5910: * NO_BIN_ON_CDROM
5911:
5912: Binaries may not be placed on CD-ROM containing other binary packages, for
5913: which a distribution charge may be made. In this case, set this variable to
5914: ${RESTRICTED}.
5915:
5916: * NO_BIN_ON_FTP
5917:
5918: Binaries may not made available on the Internet without charge. In this
5919: case, set this variable to ${RESTRICTED}. If this variable is set, binary
5920: packages will not be included on ftp.NetBSD.org.
5921:
5922: * NO_SRC_ON_CDROM
5923:
5924: Distfiles may not be placed on CD-ROM, together with other distfiles, for
5925: which a fee may be charged. In this case, set this variable to $
5926: {RESTRICTED}.
5927:
5928: * NO_SRC_ON_FTP
5929:
5930: Distfiles may not made available via FTP at no charge. In this case, set
5931: this variable to ${RESTRICTED}. If this variable is set, the distfile(s)
5932: will not be mirrored on ftp.NetBSD.org.
5933:
1.111 sevan 5934: Please note that packages will be removed from pkgsrc when the distfiles are
1.33 wiz 5935: not distributable and cannot be obtained for a period of one full quarter
1.111 sevan 5936: branch. Packages with manual/interactive fetch must have a maintainer and it is
5937: his/her responsibility to ensure this.
1.33 wiz 5938:
1.154 rillig 5939: 21.1.5. Handling dependencies
1.1 dsieger 5940:
1.175 gutterid 5941: Your package may depend on some other package being present, and there are
5942: various ways of expressing this dependency. pkgsrc supports the DEPENDS,
5943: BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS definitions, the USE_TOOLS
5944: definition, as well as dependencies via buildlink3.mk, which is the preferred
5945: way to handle dependencies, and which uses the variables named above. See
5946: Chapter 16, Buildlink methodology for more information.
5947:
5948: The basic difference is that the DEPENDS definition registers that
5949: pre-requisite in the binary package so it will be pulled in when the binary
5950: package is later installed, whilst the BUILD_DEPENDS, TOOL_DEPENDS, and
5951: TEST_DEPENDS definitions do not, marking a dependency that is only needed for
5952: building or testing the resulting package. See also Chapter 12, Creating a new
5953: pkgsrc package from scratch for more information.
5954:
5955: This means that if you only need a package present whilst you are building or
5956: testing, it should be noted as a TOOL_DEPENDS, BUILD_DEPENDS, or TEST_DEPENDS.
5957: When cross-compiling, TOOL_DEPENDS are native packages, i.e. packages for the
5958: architecture where the package is built; BUILD_DEPENDS are target packages,
5959: i.e., packages for the architecture for which the package is built.
1.1 dsieger 5960:
1.175 gutterid 5961: The format for a DEPENDS, BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS
5962: definition is:
1.1 dsieger 5963:
5964: <pre-req-package-name>:../../<category>/<pre-req-package>
5965:
5966: Please note that the "pre-req-package-name" may include any of the wildcard
5967: version numbers recognized by pkg_info(1).
5968:
1.55 wiz 5969: 1. If your package needs another package's binaries or libraries to build and
1.1 dsieger 5970: run, and if that package has a buildlink3.mk file available, use it:
5971:
5972: .include "../../graphics/jpeg/buildlink3.mk"
5973:
1.55 wiz 5974: 2. If your package needs another package's binaries or libraries only for
5975: building, and if that package has a buildlink3.mk file available, use it:
5976:
5977: .include "../../graphics/jpeg/buildlink3.mk"
5978:
5979: but set BUILDLINK_DEPMETHOD.jpeg?=build to make it a build dependency only.
5980: This case is rather rare.
5981:
5982: 3. If your package needs binaries from another package to build, use the
1.156 leot 5983: TOOL_DEPENDS definition:
5984:
5985: TOOL_DEPENDS+= itstool-[0-9]*:../../textproc/itstool
1.1 dsieger 5986:
1.156 leot 5987: 4. If your package needs static libraries to link against, header files to
5988: include, etc. from another package to build, use the BUILD_DEPENDS
5989: definition.
1.1 dsieger 5990:
1.156 leot 5991: 5. If your package needs a library with which to link and there is no
1.26 spz 5992: buildlink3.mk file available, create one. Using DEPENDS won't be sufficient
5993: because the include files and libraries will be hidden from the compiler.
1.1 dsieger 5994:
1.156 leot 5995: 6. If your package needs some executable to be able to run correctly and if
1.26 spz 5996: there's no buildlink3.mk file, this is specified using the DEPENDS
5997: variable. The print/lyx package needs to be able to execute the latex
1.129 wiz 5998: binary from the tex-latex-bin package when it runs, and that is specified:
1.1 dsieger 5999:
1.129 wiz 6000: DEPENDS+= tex-latex-bin-[0-9]*:../../print/tex-latex-bin
1.1 dsieger 6001:
1.175 gutterid 6002: 7. If your package includes a test suite that has extra dependencies only
6003: required for this purpose (frequently this can be run as a "make test"
6004: target), use the TEST_DEPENDS variable.
6005:
6006: 8. You can use wildcards in package dependencies. Note that such wildcard
1.26 spz 6007: dependencies are retained when creating binary packages. The dependency is
6008: checked when installing the binary package and any package which matches
6009: the pattern will be used. Wildcard dependencies should be used with care.
1.1 dsieger 6010:
6011: The "-[0-9]*" should be used instead of "-*" to avoid potentially ambiguous
6012: matches such as "tk-postgresql" matching a "tk-*" DEPENDS.
6013:
6014: Wildcards can also be used to specify that a package will only build
6015: against a certain minimum version of a pre-requisite:
6016:
1.26 spz 6017: DEPENDS+= ImageMagick>=6.0:../../graphics/ImageMagick
1.1 dsieger 6018:
1.26 spz 6019: This means that the package will build using version 6.0 of ImageMagick or
6020: newer. Such a dependency may be warranted if, for example, the command line
6021: options of an executable have changed.
6022:
6023: If you need to depend on minimum versions of libraries, see the buildlink
6024: section of the pkgsrc guide.
1.1 dsieger 6025:
6026: For security fixes, please update the package vulnerabilities file. See
1.154 rillig 6027: Section 21.1.9, "Handling packages with security problems" for more
1.1 dsieger 6028: information.
6029:
6030: If your package needs files from another package to build, add the relevant
6031: distribution files to DISTFILES, so they will be extracted automatically. See
6032: the print/ghostscript package for an example. (It relies on the jpeg sources
6033: being present in source form during the build.)
6034:
1.154 rillig 6035: 21.1.6. Handling conflicts with other packages
1.1 dsieger 6036:
6037: Your package may conflict with other packages a user might already have
6038: installed on his system, e.g. if your package installs the same set of files as
1.80 wiz 6039: another package in the pkgsrc tree or has the same PKGNAME.
1.1 dsieger 6040:
1.142 leot 6041: For example, x11/libXaw3d and x11/Xaw-Xpm install the same shared library, thus
6042: you set in pkgsrc/x11/libXaw3d/Makefile:
1.1 dsieger 6043:
1.142 leot 6044: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 dsieger 6045:
6046:
1.142 leot 6047: and in pkgsrc/x11/Xaw-Xpm/Makefile:
1.1 dsieger 6048:
1.142 leot 6049: CONFLICTS= libXaw3d-[0-9]*
1.1 dsieger 6050:
1.142 leot 6051:
6052: pkg_add(1) is able to detect attempts to install packages that conflict with
6053: existing packages and abort. However, in many situations this is too late in
6054: the process. Binary package managers will not know about the conflict until
6055: they attempt to install the package after already downloading it and all its
6056: dependencies. Users may also waste time building a package and its dependencies
6057: only to find out at the end that it conflicts with another package they have
6058: installed.
6059:
6060: To avoid these issues CONFLICTS entries should be added in all cases where it
6061: is known that packages conflict with each other. These CONFLICTS entries are
6062: exported in pkg_summary(5) files and consumed by binary package managers to
6063: inform users that packages cannot be installed onto the target system.
1.1 dsieger 6064:
1.154 rillig 6065: 21.1.7. Packages that cannot or should not be built
1.1 dsieger 6066:
6067: There are several reasons why a package might be instructed to not build under
6068: certain circumstances. If the package builds and runs on most platforms, the
1.83 dholland 6069: exceptions should be noted with BROKEN_ON_PLATFORM. If the package builds and
6070: runs on a small handful of platforms, set BROKEN_EXCEPT_ON_PLATFORM instead.
6071: Both BROKEN_ON_PLATFORM and BROKEN_EXCEPT_ON_PLATFORM are OS triples
6072: (OS-version-platform) that can use glob-style wildcards.
6073:
1.114 maya 6074: If a package is not appropriate for some platforms (as opposed to merely
1.83 dholland 6075: broken), a different set of variables should be used as this affects failure
6076: reporting and statistics. If the package is appropriate for most platforms, the
6077: exceptions should be noted with NOT_FOR_PLATFORM. If the package is appropriate
6078: for only a small handful of platforms (often exactly one), set
6079: ONLY_FOR_PLATFORM instead. Both ONLY_FOR_PLATFORM and NOT_FOR_PLATFORM are OS
6080: triples (OS-version-platform) that can use glob-style wildcards.
1.1 dsieger 6081:
6082: Some packages are tightly bound to a specific version of an operating system,
6083: e.g. LKMs or sysutils/lsof. Such binary packages are not backwards compatible
6084: with other versions of the OS, and should be uploaded to a version specific
6085: directory on the FTP server. Mark these packages by setting OSVERSION_SPECIFIC
6086: to "yes". This variable is not currently used by any of the package system
6087: internals, but may be used in the future.
6088:
6089: If the package should be skipped (for example, because it provides
6090: functionality already provided by the system), set PKG_SKIP_REASON to a
6091: descriptive message. If the package should fail because some preconditions are
6092: not met, set PKG_FAIL_REASON to a descriptive message.
6093:
1.154 rillig 6094: 21.1.8. Packages which should not be deleted, once installed
1.1 dsieger 6095:
6096: To ensure that a package may not be deleted, once it has been installed, the
6097: PKG_PRESERVE definition should be set in the package Makefile. This will be
1.25 wiz 6098: carried into any binary package that is made from this pkgsrc entry. A "
6099: preserved" package will not be deleted using pkg_delete(1) unless the "-f"
1.1 dsieger 6100: option is used.
6101:
1.154 rillig 6102: 21.1.9. Handling packages with security problems
1.1 dsieger 6103:
6104: When a vulnerability is found, this should be noted in localsrc/security/
1.32 wiz 6105: advisories/pkg-vulnerabilities, and after committing that file, ask
6106: pkgsrc-security@NetBSD.org to update the file on ftp.NetBSD.org.
1.1 dsieger 6107:
6108: After fixing the vulnerability by a patch, its PKGREVISION should be increased
6109: (this is of course not necessary if the problem is fixed by using a newer
1.32 wiz 6110: release of the software), and the pattern in the pkg-vulnerabilities file must
6111: be updated.
1.1 dsieger 6112:
6113: Also, if the fix should be applied to the stable pkgsrc branch, be sure to
6114: submit a pullup request!
6115:
6116: Binary packages already on ftp.NetBSD.org will be handled semi-automatically by
6117: a weekly cron job.
6118:
1.154 rillig 6119: 21.1.10. How to handle incrementing versions when fixing an existing package
1.1 dsieger 6120:
6121: When making fixes to an existing package it can be useful to change the version
6122: number in PKGNAME. To avoid conflicting with future versions by the original
6123: author, a "nb1", "nb2", ... suffix can be used on package versions by setting
6124: PKGREVISION=1 (2, ...). The "nb" is treated like a "." by the package tools.
6125: e.g.
6126:
6127: DISTNAME= foo-17.42
6128: PKGREVISION= 9
6129:
6130: will result in a PKGNAME of "foo-17.42nb9". If you want to use the original
6131: value of PKGNAME without the "nbX" suffix, e.g. for setting DIST_SUBDIR, use
6132: PKGNAME_NOREV.
6133:
6134: When a new release of the package is released, the PKGREVISION should be
6135: removed, e.g. on a new minor release of the above package, things should be
6136: like:
6137:
6138: DISTNAME= foo-17.43
6139:
6140: PKGREVISION should be incremented for any non-trivial change in the resulting
6141: binary package. Without a PKGREVISION bump, someone with the previous version
6142: installed has no way of knowing that their package is out of date. Thus,
6143: changes without increasing PKGREVISION are essentially labeled "this is so
6144: trivial that no reasonable person would want to upgrade", and this is the rough
6145: test for when increasing PKGREVISION is appropriate. Examples of changes that
6146: do not merit increasing PKGREVISION are:
6147:
1.14 jmcneill 6148: * Changing HOMEPAGE, MAINTAINER, OWNER, or comments in Makefile.
1.1 dsieger 6149:
6150: * Changing build variables if the resulting binary package is the same.
6151:
6152: * Changing DESCR.
6153:
6154: * Adding PKG_OPTIONS if the default options don't change.
6155:
6156: Examples of changes that do merit an increase to PKGREVISION include:
6157:
6158: * Security fixes
6159:
6160: * Changes or additions to a patch file
6161:
6162: * Changes to the PLIST
6163:
1.12 weinem 6164: * A dependency is changed or renamed.
6165:
1.1 dsieger 6166: PKGREVISION must also be incremented when dependencies have ABI changes.
6167:
1.154 rillig 6168: 21.1.11. Substituting variable text in the package files (the SUBST framework)
1.1 dsieger 6169:
6170: When you want to replace the same text in multiple files or when the
6171: replacement text varies, patches alone cannot help. This is where the SUBST
6172: framework comes in. It provides an easy-to-use interface for replacing text in
1.172 rillig 6173: files. It just needs the following information:
6174:
6175: * When should the replacement happen?
6176:
6177: * Where should the replacement happen, i.e. in which files?
6178:
6179: * Which text should be replaced with what?
6180:
6181: This information is encoded in a block of SUBST variables, like in this
6182: example:
1.1 dsieger 6183:
6184: SUBST_CLASSES+= fix-paths
6185: SUBST_STAGE.fix-paths= pre-configure
6186: SUBST_MESSAGE.fix-paths= Fixing absolute paths.
6187: SUBST_FILES.fix-paths= src/*.c
6188: SUBST_FILES.fix-paths+= scripts/*.sh
6189: SUBST_SED.fix-paths= -e 's,"/usr/local,"${PREFIX},g'
6190: SUBST_SED.fix-paths+= -e 's,"/var/log,"${VARBASE}/log,g'
6191:
6192: SUBST_CLASSES is a list of identifiers that are used to identify the different
6193: SUBST blocks that are defined. The SUBST framework is heavily used by pkgsrc,
6194: so it is important to always use the += operator with this variable. Otherwise
6195: some substitutions may be skipped.
6196:
6197: The remaining variables of each SUBST block are parameterized with the
6198: identifier from the first line (fix-paths in this case.) They can be seen as
6199: parameters to a function call.
6200:
6201: SUBST_STAGE.* specifies the stage at which the replacement will take place. All
6202: combinations of pre-, do- and post- together with a phase name are possible,
6203: though only few are actually used. Most commonly used are post-patch and
6204: pre-configure. Of these two, pre-configure should be preferred because then it
6205: is possible to run bmake patch and have the state after applying the patches
6206: but before making any other changes. This is especially useful when you are
6207: debugging a package in order to create new patches for it. Similarly,
6208: post-build is preferred over pre-install, because the install phase should
6209: generally be kept as simple as possible. When you use post-build, you have the
6210: same files in the working directory that will be installed later, so you can
6211: check if the substitution has succeeded.
6212:
6213: SUBST_MESSAGE.* is an optional text that is printed just before the
6214: substitution is done.
6215:
6216: SUBST_FILES.* is the list of shell globbing patterns that specifies the files
6217: in which the substitution will take place. The patterns are interpreted
6218: relatively to the WRKSRC directory.
6219:
6220: SUBST_SED.* is a list of arguments to sed(1) that specify the actual
6221: substitution. Every sed command should be prefixed with -e, so that all SUBST
6222: blocks look uniform.
6223:
1.172 rillig 6224: SUBST_VARS.* is a list of variable names. For each of these variables, the text
6225: @VAR@ is replaced with the value of the variable VAR.
6226:
1.1 dsieger 6227: There are some more variables, but they are so seldomly used that they are only
6228: documented in the mk/subst.mk file.
6229:
1.154 rillig 6230: 21.2. The fetch phase
1.1 dsieger 6231:
1.154 rillig 6232: 21.2.1. Packages whose distfiles aren't available for plain downloading
1.1 dsieger 6233:
6234: If you need to download from a dynamic URL you can set DYNAMIC_MASTER_SITES and
6235: a make fetch will call files/getsite.sh with the name of each file to download
6236: as an argument, expecting it to output the URL of the directory from which to
6237: download it. graphics/ns-cult3d is an example of this usage.
6238:
6239: If the download can't be automated, because the user must submit personal
6240: information to apply for a password, or must pay for the source, or whatever,
6241: you can set FETCH_MESSAGE to a list of lines that are displayed to the user
6242: before aborting the build. Example:
6243:
6244: FETCH_MESSAGE= "Please download the files"
6245: FETCH_MESSAGE+= " "${DISTFILES:Q}
6246: FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"."
6247:
1.154 rillig 6248: 21.2.2. How to handle modified distfiles with the 'old' name
1.1 dsieger 6249:
6250: Sometimes authors of a software package make some modifications after the
6251: software was released, and they put up a new distfile without changing the
6252: package's version number. If a package is already in pkgsrc at that time, the
6253: checksum will no longer match. The contents of the new distfile should be
6254: compared against the old one before changing anything, to make sure the
6255: distfile was really updated on purpose, and that no trojan horse or so crept
6256: in. Please mention that the distfiles were compared and what was found in your
1.54 rodent 6257: commit message.
6258:
6259: Then, the correct way to work around this is to set DIST_SUBDIR to a unique
1.109 wiz 6260: directory name, usually based on PKGNAME_NOREV (but take care with python or
6261: ruby packages, where PKGNAME includes a variable prefix). All DISTFILES and
6262: PATCHFILES for this package will be put in that subdirectory of the local
1.154 rillig 6263: distfiles directory. (See Section 21.1.10, "How to handle incrementing versions
1.109 wiz 6264: when fixing an existing package" for more details.) In case this happens more
6265: often, PKGNAME can be used (thus including the nbX suffix) or a date stamp can
6266: be appended, like ${PKGNAME_NOREV}-YYYYMMDD.
1.54 rodent 6267:
6268: DIST_SUBDIR is also used when a distfile's name does not contain a version and
6269: the distfile is apt to change. In cases where the likelihood of this is very
6270: small, DIST_SUBDIR might not be required. Additionally, DIST_SUBDIR must not be
6271: removed unless the distfile name changes, even if a package is being moved or
6272: renamed.
6273:
6274: Do not forget regenerating the distinfo file after that, since it contains the
6275: DIST_SUBDIR path in the filenames. Also, increase the PKGREVISION if the
6276: installed package is different. Furthermore, a mail to the package's authors
6277: seems appropriate telling them that changing distfiles after releases without
6278: changing the file names is not good practice.
1.1 dsieger 6279:
1.154 rillig 6280: 21.2.3. Packages hosted on github.com
1.88 tnn 6281:
1.90 tnn 6282: Helper methods exist for packages hosted on github.com which will often have
6283: distfile names that clash with other packages, for example 1.0.tar.gz. Use one
6284: of the three recipes from below:
1.88 tnn 6285:
1.154 rillig 6286: 21.2.3.1. Fetch based on a tagged release
1.88 tnn 6287:
1.174 leot 6288: If your distfile URL looks similar to https://github.com/username/
6289: exampleproject/archive/v1.0.zip, then you are packaging a tagged release.
1.88 tnn 6290:
6291: DISTNAME= exampleproject-1.0
1.90 tnn 6292: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6293: #GITHUB_PROJECT= # can be omitted if same as DISTNAME
6294: GITHUB_TAG= v${PKGVERSION_NOREV}
1.88 tnn 6295: EXTRACT_SUFX= .zip
6296:
1.154 rillig 6297: 21.2.3.2. Fetch based on a specific commit
1.88 tnn 6298:
1.174 leot 6299: If your distfile URL looks similar to https://github.com?/example?/example?/
1.169 rillig 6300: archive?/988881adc9fc3655077dc2d4d757d480b5ea0e11.tar.gz, then you are
6301: packaging a specific commit not tied to a release.
1.88 tnn 6302:
6303: DISTNAME= example-1.0
1.107 jnemeth 6304: MASTER_SITES= ${MASTER_SITE_GITHUB:=example/}
1.90 tnn 6305: #GITHUB_PROJECT= # can be omitted if same as DISTNAME
6306: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
1.88 tnn 6307:
1.154 rillig 6308: 21.2.3.3. Fetch based on release
1.88 tnn 6309:
1.174 leot 6310: If your distfile URL looks similar to https://github.com?/username/
1.169 rillig 6311: exampleproject?/releases?/download?/rel-1.6?/offensive-1.6.zip, then you are
6312: packaging a release.
1.88 tnn 6313:
1.90 tnn 6314: DISTNAME= offensive-1.6
1.88 tnn 6315: PKGNAME= ${DISTNAME:S/offensive/proper/}
1.90 tnn 6316: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6317: GITHUB_PROJECT= exampleproject
6318: GITHUB_RELEASE= rel-${PKGVERSION_NOREV} # usually just set this to ${DISTNAME}
6319: EXTRACT_SUFX= .zip
1.88 tnn 6320:
1.154 rillig 6321: 21.3. The configure phase
1.1 dsieger 6322:
1.154 rillig 6323: 21.3.1. Shared libraries - libtool
1.1 dsieger 6324:
6325: pkgsrc supports many different machines, with different object formats like
6326: a.out and ELF, and varying abilities to do shared library and dynamic loading
6327: at all. To accompany this, varying commands and options have to be passed to
6328: the compiler, linker, etc. to get the Right Thing, which can be pretty annoying
6329: especially if you don't have all the machines at your hand to test things. The
6330: devel/libtool pkg can help here, as it just "knows" how to build both static
6331: and dynamic libraries from a set of source files, thus being
6332: platform-independent.
6333:
6334: Here's how to use libtool in a package in seven simple steps:
6335:
6336: 1. Add USE_LIBTOOL=yes to the package Makefile.
6337:
6338: 2. For library objects, use "${LIBTOOL} --mode=compile ${CC}" in place of "$
6339: {CC}". You could even add it to the definition of CC, if only libraries are
6340: being built in a given Makefile. This one command will build both PIC and
6341: non-PIC library objects, so you need not have separate shared and
6342: non-shared library rules.
6343:
6344: 3. For the linking of the library, remove any "ar", "ranlib", and "ld
6345: -Bshareable" commands, and instead use:
6346:
6347: ${LIBTOOL} --mode=link \
6348: ${CC} -o ${.TARGET:.a=.la} \
6349: ${OBJS:.o=.lo} \
6350: -rpath ${PREFIX}/lib \
6351: -version-info major:minor
6352:
6353: Note that the library is changed to have a .la extension, and the objects
6354: are changed to have a .lo extension. Change OBJS as necessary. This
6355: automatically creates all of the .a, .so.major.minor, and ELF symlinks (if
6356: necessary) in the build directory. Be sure to include "-version-info",
6357: especially when major and minor are zero, as libtool will otherwise strip
6358: off the shared library version.
6359:
6360: From the libtool manual:
6361:
6362: So, libtool library versions are described by three integers:
6363:
6364: CURRENT
6365: The most recent interface number that this library implements.
6366:
6367: REVISION
6368: The implementation number of the CURRENT interface.
6369:
6370: AGE
6371: The difference between the newest and oldest interfaces that
6372: this library implements. In other words, the library implements
6373: all the interface numbers in the range from number `CURRENT -
6374: AGE' to `CURRENT'.
6375:
6376: If two libraries have identical CURRENT and AGE numbers, then the
6377: dynamic linker chooses the library with the greater REVISION number.
6378:
6379: The "-release" option will produce different results for a.out and ELF
1.25 wiz 6380: (excluding symlinks) in only one case. An ELF library of the form "
6381: libfoo-release.so.x.y" will have a symlink of "libfoo.so.x.y" on an a.out
1.1 dsieger 6382: platform. This is handled automatically.
6383:
6384: The "-rpath argument" is the install directory of the library being built.
6385:
6386: In the PLIST, include only the .la file, the other files will be added
6387: automatically.
6388:
6389: 4. When linking shared object (.so) files, i.e. files that are loaded via
6390: dlopen(3), NOT shared libraries, use "-module -avoid-version" to prevent
6391: them getting version tacked on.
6392:
6393: The PLIST file gets the foo.so entry.
6394:
6395: 5. When linking programs that depend on these libraries before they are
6396: installed, preface the cc(1) or ld(1) line with "${LIBTOOL} --mode=link",
6397: and it will find the correct libraries (static or shared), but please be
6398: aware that libtool will not allow you to specify a relative path in -L
6399: (such as "-L../somelib"), because it expects you to change that argument to
6400: be the .la file. e.g.
6401:
6402: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
6403:
6404: should be changed to:
6405:
6406: ${LIBTOOL} --mode=link ${CC} -o someprog ../somelib/somelib.la
6407:
6408: and it will do the right thing with the libraries.
6409:
6410: 6. When installing libraries, preface the install(1) or cp(1) command with "$
6411: {LIBTOOL} --mode=install", and change the library name to .la. e.g.
6412:
1.23 jakllsch 6413: ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 dsieger 6414:
6415: This will install the static .a, shared library, any needed symlinks, and
6416: run ldconfig(8).
6417:
6418: 7. In your PLIST, include only the .la file (this is a change from previous
6419: behaviour).
6420:
1.154 rillig 6421: 21.3.2. Using libtool on GNU packages that already support libtool
1.1 dsieger 6422:
6423: Add USE_LIBTOOL=yes to the package Makefile. This will override the package's
6424: own libtool in most cases. For older libtool using packages, libtool is made by
6425: ltconfig script during the do-configure step; you can check the libtool script
6426: location by doing make configure; find work*/ -name libtool.
6427:
6428: LIBTOOL_OVERRIDE specifies which libtool scripts, relative to WRKSRC, to
6429: override. By default, it is set to "libtool */libtool */*/libtool". If this
6430: does not match the location of the package's libtool script(s), set it as
6431: appropriate.
6432:
6433: If you do not need *.a static libraries built and installed, then use
6434: SHLIBTOOL_OVERRIDE instead.
6435:
6436: If your package makes use of the platform-independent library for loading
6437: dynamic shared objects, that comes with libtool (libltdl), you should include
6438: devel/libltdl/buildlink3.mk.
6439:
6440: Some packages use libtool incorrectly so that the package may not work or build
6441: in some circumstances. Some of the more common errors are:
6442:
6443: * The inclusion of a shared object (-module) as a dependent library in an
6444: executable or library. This in itself isn't a problem if one of two things
6445: has been done:
6446:
6447: 1. The shared object is named correctly, i.e. libfoo.la, not foo.la
6448:
6449: 2. The -dlopen option is used when linking an executable.
6450:
6451: * The use of libltdl without the correct calls to initialisation routines.
6452: The function lt_dlinit() should be called and the macro
6453: LTDL_SET_PRELOADED_SYMBOLS included in executables.
6454:
1.154 rillig 6455: 21.3.3. GNU Autoconf/Automake
1.1 dsieger 6456:
6457: If a package needs GNU autoconf or automake to be executed to regenerate the
6458: configure script and Makefile.in makefile templates, then they should be
6459: executed in a pre-configure target.
6460:
6461: For packages that need only autoconf:
6462:
6463: AUTOCONF_REQD= 2.50 # if default version is not good enough
6464: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
6465: ...
6466:
6467: pre-configure:
6468: cd ${WRKSRC} && autoconf
6469:
6470: ...
6471:
6472: and for packages that need automake and autoconf:
6473:
6474: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
6475: USE_TOOLS+= automake # use "automake14" for automake-1.4
6476: ...
6477:
6478: pre-configure:
6479: set -e; cd ${WRKSRC}; \
6480: aclocal; autoheader; automake -a --foreign -i; autoconf
6481:
6482: ...
6483:
6484: Packages which use GNU Automake will almost certainly require GNU Make.
6485:
6486: There are times when the configure process makes additional changes to the
6487: generated files, which then causes the build process to try to re-execute the
6488: automake sequence. This is prevented by touching various files in the configure
6489: stage. If this causes problems with your package you can set AUTOMAKE_OVERRIDE=
6490: NO in the package Makefile.
6491:
1.154 rillig 6492: 21.4. Programming languages
1.1 dsieger 6493:
1.154 rillig 6494: 21.4.1. C, C++, and Fortran
1.1 dsieger 6495:
6496: Compilers for the C, C++, and Fortran languages comes with the NetBSD base
6497: system. By default, pkgsrc assumes that a package is written in C and will hide
1.154 rillig 6498: all other compilers (via the wrapper framework, see Chapter 16, Buildlink
1.1 dsieger 6499: methodology).
6500:
6501: To declare which language's compiler a package needs, set the USE_LANGUAGES
6502: variable. Allowed values currently are "c", "c++", and "fortran" (and any
6503: combination). The default is "c". Packages using GNU configure scripts, even if
6504: written in C++, usually need a C compiler for the configure phase.
6505:
1.154 rillig 6506: 21.4.2. Java
1.1 dsieger 6507:
6508: If a program is written in Java, use the Java framework in pkgsrc. The package
6509: must include ../../mk/java-vm.mk. This Makefile fragment provides the following
6510: variables:
6511:
6512: * USE_JAVA defines if a build dependency on the JDK is added. If USE_JAVA is
6513: set to "run", then there is only a runtime dependency on the JDK. The
6514: default is "yes", which also adds a build dependency on the JDK.
6515:
6516: * Set USE_JAVA2 to declare that a package needs a Java2 implementation. The
6517: supported values are "yes", "1.4", and "1.5". "yes" accepts any Java2
6518: implementation, "1.4" insists on versions 1.4 or above, and "1.5" only
6519: accepts versions 1.5 or above. This variable is not set by default.
6520:
1.25 wiz 6521: * PKG_JAVA_HOME is automatically set to the runtime location of the used Java
6522: implementation dependency. It may be used to set JAVA_HOME to a good value
6523: if the program needs this variable to be defined.
6524:
1.154 rillig 6525: 21.4.3. Packages containing perl scripts
1.1 dsieger 6526:
6527: If your package contains interpreted perl scripts, add "perl" to the USE_TOOLS
6528: variable and set REPLACE_PERL to ensure that the proper interpreter path is
6529: set. REPLACE_PERL should contain a list of scripts, relative to WRKSRC, that
1.74 wiz 6530: you want adjusted. Every occurrence of */bin/perl in a she-bang line will be
6531: replaced with the full path to the perl executable.
1.1 dsieger 6532:
6533: If a particular version of perl is needed, set the PERL5_REQD variable to the
6534: version number. The default is "5.0".
6535:
1.154 rillig 6536: See Section 21.6.6, "Packages installing perl modules" for information about
1.1 dsieger 6537: handling perl modules.
6538:
1.154 rillig 6539: 21.4.4. Packages containing shell scripts
1.41 wiz 6540:
6541: REPLACE_SH, REPLACE_BASH, REPLACE_CSH, and REPLACE_KSH can be used to replace
6542: shell hash bangs in files. Please use the appropriate one, prefering REPLACE_SH
1.74 wiz 6543: in case this shell is sufficient. Each should contain a list of scripts,
6544: relative to WRKSRC, that you want adjusted. Every occurrence of the matching
6545: shell in a she-bang line will be replaced with the full path to the shell
6546: executable. When using REPLACE_BASH, don't forget to add bash to USE_TOOLS.
1.41 wiz 6547:
1.154 rillig 6548: 21.4.5. Other programming languages
1.1 dsieger 6549:
6550: Currently, there is no special handling for other languages in pkgsrc. If a
6551: compiler package provides a buildlink3.mk file, include that, otherwise just
6552: add a (build) dependency on the appropriate compiler package.
6553:
1.154 rillig 6554: 21.5. The build phase
1.1 dsieger 6555:
6556: The most common failures when building a package are that some platforms do not
6557: provide certain header files, functions or libraries, or they provide the
6558: functions in a library that the original package author didn't know. To work
6559: around this, you can rewrite the source code in most cases so that it does not
6560: use the missing functions or provides a replacement function.
6561:
1.154 rillig 6562: 21.5.1. Compiling C and C++ code conditionally
1.1 dsieger 6563:
6564: If a package already comes with a GNU configure script, the preferred way to
6565: fix the build failure is to change the configure script, not the code. In the
6566: other cases, you can utilize the C preprocessor, which defines certain macros
6567: depending on the operating system and hardware architecture it compiles for.
6568: These macros can be queried using for example #if defined(__i386). Almost every
6569: operating system, hardware architecture and compiler has its own macro. For
6570: example, if the macros __GNUC__, __i386__ and __NetBSD__ are all defined, you
6571: know that you are using NetBSD on an i386 compatible CPU, and your compiler is
6572: GCC.
6573:
6574: The list of the following macros for hardware and operating system depends on
6575: the compiler that is used. For example, if you want to conditionally compile
6576: code on Solaris, don't use __sun__, as the SunPro compiler does not define it.
6577: Use __sun instead.
6578:
1.154 rillig 6579: 21.5.1.1. C preprocessor macros to identify the operating system
1.1 dsieger 6580:
6581: To distinguish between 4.4 BSD-derived systems and the rest of the world, you
6582: should use the following code.
6583:
6584: #include <sys/param.h>
6585: #if (defined(BSD) && BSD >= 199306)
6586: /* BSD-specific code goes here */
6587: #else
6588: /* non-BSD-specific code goes here */
6589: #endif
6590:
6591: If this distinction is not fine enough, you can also test for the following
6592: macros.
6593:
1.46 obache 6594: Cygwin __CYGWIN__
6595: DragonFly __DragonFly__
1.1 dsieger 6596: FreeBSD __FreeBSD__
1.46 obache 6597: Haiku __HAIKU__
1.1 dsieger 6598: Interix __INTERIX
6599: IRIX __sgi (TODO: get a definite source for this)
6600: Linux linux, __linux, __linux__
1.83 dholland 6601: Mac OS X __APPLE__
1.46 obache 6602: MirBSD __MirBSD__ (__OpenBSD__ is also defined)
6603: Minix3 __minix
1.1 dsieger 6604: NetBSD __NetBSD__
6605: OpenBSD __OpenBSD__
6606: Solaris sun, __sun
6607:
1.154 rillig 6608: 21.5.1.2. C preprocessor macros to identify the hardware architecture
1.1 dsieger 6609:
6610: i386 i386, __i386, __i386__
6611: MIPS __mips
6612: SPARC sparc, __sparc
6613:
1.154 rillig 6614: 21.5.1.3. C preprocessor macros to identify the compiler
1.1 dsieger 6615:
6616: GCC __GNUC__ (major version), __GNUC_MINOR__
6617: MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41)
6618: SunPro __SUNPRO_C (0x570 for Sun C 5.7)
6619: SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8)
6620:
1.154 rillig 6621: 21.5.2. How to handle compiler bugs
1.1 dsieger 6622:
6623: Some source files trigger bugs in the compiler, based on combinations of
6624: compiler version and architecture and almost always relation to optimisation
6625: being enabled. Common symptoms are gcc internal errors or never finishing
6626: compiling a file.
6627:
6628: Typically, a workaround involves testing the MACHINE_ARCH and compiler version,
1.87 tnn 6629: disabling optimisation for that combination of file, MACHINE_ARCH and compiler.
6630:
6631: This used to be a big problem in the past, but is rarely needed now as compiler
6632: technology has matured. If you still need to add a compiler specific
6633: workaround, please do so in the file hacks.mk and describe the symptom and
6634: compiler version as detailed as possible.
1.1 dsieger 6635:
1.172 rillig 6636: 21.5.3. No such file or directory
6637:
6638: Compilation sometimes fails with an error message like this:
6639:
6640: .../x11/gtk3/work/gtk+-3.24.12/gdk/gdktypes.h:35:10:
6641: fatal error: pango/pango.h: No such file or directory
6642:
6643: The proper way to fix this problem depends on the type of the header, which is
6644: described in the following sections.
6645:
6646: 21.5.3.1. Headers from other packages
6647:
6648: If the header name looks like it comes from a different package, that other
6649: package should be included via the buildlink3 framework.
6650:
6651: First, look whether the header is somewhere in the buildlink3 directory below
6652: WRKDIR. In the above case of the missing Pango header:
6653:
6654: $ find work/.buildlink/ -print | grep -F pango/pango.h
6655:
6656: In the case of Pango, the output is:
6657:
6658: work/.buildlink/include/pango-1.0/pango/pango.h
6659:
6660: If the pango/pango.h file were placed directly in the .buildlink directory, it
6661: would have been found automatically. There is an extra pango-1.0 path component
6662: though, which means that the compiler command line must contain an option of
6663: the form -I${BUILDLINK3_PREFIX.pango}/include/pango-1.0. In most cases this
6664: option is generated by the configure script, which can be examined using:
6665:
6666: $ $ grep -o '[-]I[^[:space:]]*/pango[^[:space:]]*' work/*/Makefile
6667: -I/usr/pkg/include/pango-1.0
6668: -I/usr/pkg/include/pango-1.0
6669: -I/usr/pkg/include/pango-1.0
6670: -I/usr/pkg/include/pango-1.0
6671: -I/usr/pkg/include/pango-1.0
6672:
6673: This looks good. These options are transformed by the buildlink wrapper to
6674: refer to the correct path inside work/.buildlink.
6675:
6676: Since the compilation fails though, examine the compiler command lines in work
6677: /.work.log to see whether the -I option is included in the particular command
6678: line.
6679:
6680: To further analyze the situation, run bmake build-env, which sets up an
6681: interactive, realistic environment including all the pkgsrc wrapper commands
6682: and environment variables. From there, try to compile some simple example
6683: programs that use the header.
6684:
6685: 21.5.3.2. Headers generated during the build
6686:
6687: If the name of the header seems to come from the package itself, and if the
6688: build is run with parallel jobs, the package may have some undeclared
6689: dependencies between the .c and the .h files, and a C file is compiled before
6690: its required header is generated.
6691:
6692: To see whether the build runs with parallel jobs, run bmake show-all-build |
6693: grep JOBS. Its output looks like this:
6694:
6695: usr MAKE_JOBS= 7
6696: pkg MAKE_JOBS_SAFE # undefined
6697: def _MAKE_JOBS_N= 7
6698:
6699: In this case the pkgsrc user has asked pkgsrc to build packages with 7 jobs in
6700: parallel (MAKE_JOBS). The package could have disabled parallel builds by
6701: setting MAKE_JOBS_SAFE to no, but in this case it hasn't.
6702:
6703: To see whether the build failure is caused by parallel builds, first save the
6704: exact error message and a bit of context, maybe you need it later for reporting
6705: a bug. Next, run:
6706:
6707: MAKE_JOBS_SAFE=no bmake clean build
6708:
6709: If that succeeds, file a bug report against the pkgsrc package, including the
6710: exact error message and the contents of your mk.conf file.
6711:
1.173 rillig 6712: 21.5.3.3. Symlinks
6713:
6714: Pkgsrc does not work reliably if any of LOCALBASE, VARBASE or WRKDIR contains a
6715: symlink. Since 2019Q2, the pkgsrc bootstrap program prevents installing pkgsrc
6716: in symlink-based directories. Existing pkgsrc installations are not checked for
6717: symlinks though.
6718:
6719: The "No such file or directory" error messages are a typical symptom of
6720: symlinks, and it's quite difficult to find out that this is the actual cause.
6721:
6722: 21.5.3.4. Stale working directories
6723:
6724: When building a hierarchy of packages, it may happen that one package is built
6725: and then pkgsrc is updated. This situation can provoke various hard to diagnose
6726: build errors. To clean up the situation:
6727:
6728: $ (cd ../../ && test -f mk/bsd.pkg.mk && rm -rf */*/work)
6729:
6730: (The test for bsd.pkg.mk just prevents running this command in the wrong
6731: directory.)
6732:
6733: If you have set WRKOBJDIR in mk.conf, remove that directory as well.
6734:
6735: 21.5.3.5. Other possible reasons
6736:
6737: On platforms other than BSD, third-party packages are installed in /usr/
6738: include, together with the base system. This means that pkgsrc cannot
6739: distinguish between headers provided by the base system (which it needs) and
6740: headers from third-party packages (which are often included in pkgsrc as well).
6741: This can lead to subtle version mismatches.
6742:
6743: In pkgsrc installations that have been active for several years, it may happen
6744: that some files are manually deleted. To exclude this unlikely reason, run
6745: pkg_admin check.
6746:
6747: It may help to run pkg_admin rebuild-tree to check/fix dependencies.
6748:
6749: If all of the above doesn't help, see Chapter 2, Getting help for contact
6750: information. Be prepared to describe what you have tried so far and what any
6751: error messages were.
6752:
1.172 rillig 6753: 21.5.4. Undefined reference to "..."
1.1 dsieger 6754:
6755: This error message often means that a package did not link to a shared library
6756: it needs. The following functions are known to cause this error message over
6757: and over.
6758:
6759: +-----------------------------------------------------+
6760: | Function |Library |Affected platforms|
6761: |-------------------------+--------+------------------|
6762: |accept, bind, connect |-lsocket|Solaris |
6763: |-------------------------+--------+------------------|
6764: |crypt |-lcrypt |DragonFly, NetBSD |
6765: |-------------------------+--------+------------------|
6766: |dlopen, dlsym |-ldl |Linux |
6767: |-------------------------+--------+------------------|
6768: |gethost* |-lnsl |Solaris |
6769: |-------------------------+--------+------------------|
6770: |inet_aton |-lresolv|Solaris |
6771: |-------------------------+--------+------------------|
6772: |nanosleep, sem_*, timer_*|-lrt |Solaris |
6773: |-------------------------+--------+------------------|
6774: |openpty |-lutil |Linux |
6775: +-----------------------------------------------------+
6776:
6777: To fix these linker errors, it is often sufficient to say LIBS.OperatingSystem+
6778: = -lfoo to the package Makefile and then say bmake clean; bmake.
6779:
1.172 rillig 6780: 21.5.4.1. Special issue: The SunPro compiler
1.1 dsieger 6781:
6782: When you are using the SunPro compiler, there is another possibility. That
6783: compiler cannot handle the following code:
6784:
6785: extern int extern_func(int);
6786:
6787: static inline int
6788: inline_func(int x)
6789: {
6790: return extern_func(x);
6791: }
6792:
6793: int main(void)
6794: {
6795: return 0;
6796: }
6797:
6798: It generates the code for inline_func even if that function is never used. This
6799: code then refers to extern_func, which can usually not be resolved. To solve
6800: this problem you can try to tell the package to disable inlining of functions.
6801:
1.172 rillig 6802: 21.5.5. Running out of memory
1.1 dsieger 6803:
6804: Sometimes packages fail to build because the compiler runs into an operating
6805: system specific soft limit. With the UNLIMIT_RESOURCES variable pkgsrc can be
1.94 wiz 6806: told to unlimit the resources. Currently, the allowed values are any
6807: combination of "cputime", "datasize", "memorysize", and "stacksize". Setting
6808: this variable is similar to running the shell builtin ulimit command to raise
6809: the maximum data segment size or maximum stack size of a process, respectively,
6810: to their hard limits.
1.1 dsieger 6811:
1.154 rillig 6812: 21.6. The install phase
1.1 dsieger 6813:
1.154 rillig 6814: 21.6.1. Creating needed directories
1.1 dsieger 6815:
6816: The BSD-compatible install supplied with some operating systems cannot create
6817: more than one directory at a time. As such, you should call ${INSTALL_*_DIR}
6818: like this:
6819:
6820: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
6821: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
6822:
6823: You can also just append "dir1 dir2" to the INSTALLATION_DIRS variable, which
6824: will automatically do the right thing.
6825:
1.154 rillig 6826: 21.6.2. Where to install documentation
1.1 dsieger 6827:
6828: In general, documentation should be installed into ${PREFIX}/share/doc/$
6829: {PKGBASE} or ${PREFIX}/share/doc/${PKGNAME} (the latter includes the version
6830: number of the package).
6831:
6832: Many modern packages using GNU autoconf allow to set the directory where HTML
6833: documentation is installed with the "--with-html-dir" option. Sometimes using
6834: this flag is needed because otherwise the documentation ends up in ${PREFIX}/
6835: share/doc/html or other places.
6836:
6837: An exception to the above is that library API documentation generated with the
6838: textproc/gtk-doc tools, for use by special browsers (devhelp) should be left at
6839: their default location, which is ${PREFIX}/share/gtk-doc. Such documentation
6840: can be recognized from files ending in .devhelp or .devhelp2. (It is also
6841: acceptable to install such files in ${PREFIX}/share/doc/${PKGBASE} or ${PREFIX}
6842: /share/doc/${PKGNAME}; the .devhelp* file must be directly in that directory
6843: then, no additional subdirectory level is allowed in this case. This is usually
6844: achieved by using "--with-html-dir=${PREFIX}/share/doc". ${PREFIX}/share/
6845: gtk-doc is preferred though.)
6846:
1.154 rillig 6847: 21.6.3. Installing highscore files
1.1 dsieger 6848:
6849: Certain packages, most of them in the games category, install a score file that
6850: allows all users on the system to record their highscores. In order for this to
6851: work, the binaries need to be installed setgid and the score files owned by the
1.36 wiz 6852: appropriate group and/or owner (traditionally the "games" user/group). Set
6853: USE_GAMESGROUP to yes to support this. The following variables, documented in
6854: more detail in mk/defaults/mk.conf, control this behaviour: GAMEDATAMODE,
1.100 leot 6855: GAMEDIRMODE, GAMES_GROUP, GAMEMODE, GAME_USER. Other useful variables are:
6856: GAMEDIR_PERMS, GAMEDATA_PERMS and SETGID_GAMES_PERMS.
6857:
6858: An example that illustrates some of the variables described above is games/
6859: moon-buggy. OWN_DIRS_PERMS is used to properly set directory permissions of the
6860: directory where the scorefile is saved, REQD_FILES_PERMS is used to create a
6861: dummy scorefile (mbscore) with the proper permissions and SPECIAL_PERMS is used
6862: to install setgid the game binary:
6863:
6864: USE_GAMESGROUP= yes
6865:
6866: BUILD_DEFS+= VARBASE
6867:
6868: OWN_DIRS_PERMS+= ${VARBASE}/games/moon-buggy ${GAMEDIR_PERMS}
6869: REQD_FILES_PERMS+= /dev/null ${VARBASE}/games/moon-buggy/mbscore ${GAMEDATA_PERMS}
6870: SPECIAL_PERMS+= ${PREFIX}/bin/moon-buggy ${SETGID_GAMES_PERMS}
6871:
6872: Various INSTALL_* variables are also available: INSTALL_GAME to install setgid
6873: game binaries, INSTALL_GAME_DIR to install game directories that are needed to
6874: be accessed by setgid games and INSTALL_GAME_DATA to install scorefiles.
1.1 dsieger 6875:
1.14 jmcneill 6876: A package should therefore never hard code file ownership or access permissions
1.100 leot 6877: but rely on *_PERMS as described above or alternatively on INSTALL_GAME,
6878: INSTALL_GAME_DATA and INSTALL_GAME_DIR to set these correctly.
1.1 dsieger 6879:
1.154 rillig 6880: 21.6.4. Adding DESTDIR support to packages
1.4 rillig 6881:
1.14 jmcneill 6882: DESTDIR support means that a package installs into a staging directory, not the
6883: final location of the files. Then a binary package is created which can be used
6884: for installation as usual. There are two ways: Either the package must install
1.25 wiz 6885: as root ("destdir") or the package can install as non-root user ("user-destdir"
6886: ).
1.14 jmcneill 6887:
1.113 leot 6888: * PKG_DESTDIR_SUPPORT has to be set to "destdir" or "user-destdir". By
6889: default PKG_DESTDIR_SUPPORT is set to "user-destdir" to help catching more
6890: potential packaging problems. If bsd.prefs.mk is included in the Makefile,
6891: PKG_DESTDIR_SUPPORT needs to be set before the inclusion.
1.14 jmcneill 6892:
1.4 rillig 6893: * All installation operations have to be prefixed with ${DESTDIR}.
6894:
6895: * automake gets this DESTDIR mostly right automatically. Many manual rules
6896: and pre/post-install often are incorrect; fix them.
6897:
1.17 imil 6898: * If files are installed with special owner/group use SPECIAL_PERMS.
1.4 rillig 6899:
6900: * In general, packages should support UNPRIVILEGED to be able to use DESTDIR.
6901:
1.154 rillig 6902: 21.6.5. Packages with hardcoded paths to other interpreters
1.1 dsieger 6903:
6904: Your package may also contain scripts with hardcoded paths to other
6905: interpreters besides (or as well as) perl. To correct the full pathname to the
6906: script interpreter, you need to set the following definitions in your Makefile
6907: (we shall use tclsh in this example):
6908:
6909: REPLACE_INTERPRETER+= tcl
6910: REPLACE.tcl.old= .*/bin/tclsh
6911: REPLACE.tcl.new= ${PREFIX}/bin/tclsh
6912: REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
6913: # relative to ${WRKSRC}, just as in REPLACE_PERL
6914:
6915: Note
6916:
6917: Before March 2006, these variables were called _REPLACE.* and _REPLACE_FILES.*.
6918:
1.154 rillig 6919: 21.6.6. Packages installing perl modules
1.1 dsieger 6920:
6921: Makefiles of packages providing perl5 modules should include the Makefile
6922: fragment ../../lang/perl5/module.mk. It provides a do-configure target for the
6923: standard perl configuration for such modules as well as various hooks to tune
6924: this configuration. See comments in this file for details.
6925:
6926: Perl5 modules will install into different places depending on the version of
6927: perl used during the build process. To address this, pkgsrc will append lines
6928: to the PLIST corresponding to the files listed in the installed .packlist file
6929: generated by most perl5 modules. This is invoked by defining PERL5_PACKLIST to
1.48 wiz 6930: a space-separated list of packlist files relative to PERL5_PACKLIST_DIR
6931: (PERL5_INSTALLVENDORARCH by default), e.g.:
1.1 dsieger 6932:
1.48 wiz 6933: PERL5_PACKLIST= auto/Pg/.packlist
1.1 dsieger 6934:
1.48 wiz 6935: The perl5 config variables installarchlib, installscript, installvendorbin,
6936: installvendorscript, installvendorarch, installvendorlib, installvendorman1dir,
6937: and installvendorman3dir represent those locations in which components of perl5
6938: modules may be installed, provided as variable with uppercase and prefixed with
6939: PERL5_, e.g. PERL5_INSTALLARCHLIB and may be used by perl5 packages that don't
6940: have a packlist. These variables are also substituted for in the PLIST as
6941: uppercase prefixed with PERL5_SUB_.
1.1 dsieger 6942:
1.154 rillig 6943: 21.6.7. Packages installing info files
1.1 dsieger 6944:
6945: Some packages install info files or use the "makeinfo" or "install-info"
6946: commands. INFO_FILES should be defined in the package Makefile so that INSTALL
6947: and DEINSTALL scripts will be generated to handle registration of the info
6948: files in the Info directory file. The "install-info" command used for the info
6949: files registration is either provided by the system, or by a special purpose
6950: package automatically added as dependency if needed.
6951:
6952: PKGINFODIR is the directory under ${PREFIX} where info files are primarily
6953: located. PKGINFODIR defaults to "info" and can be overridden by the user.
6954:
6955: The info files for the package should be listed in the package PLIST; however
6956: any split info files need not be listed.
6957:
6958: A package which needs the "makeinfo" command at build time must add "makeinfo"
6959: to USE_TOOLS in its Makefile. If a minimum version of the "makeinfo" command is
6960: needed it should be noted with the TEXINFO_REQD variable in the package
6961: Makefile. By default, a minimum version of 3.12 is required. If the system does
6962: not provide a makeinfo command or if it does not match the required minimum, a
6963: build dependency on the devel/gtexinfo package will be added automatically.
6964:
6965: The build and installation process of the software provided by the package
6966: should not use the install-info command as the registration of info files is
1.25 wiz 6967: the task of the package INSTALL script, and it must use the appropriate
1.1 dsieger 6968: makeinfo command.
6969:
6970: To achieve this goal, the pkgsrc infrastructure creates overriding scripts for
6971: the install-info and makeinfo commands in a directory listed early in PATH.
6972:
6973: The script overriding install-info has no effect except the logging of a
6974: message. The script overriding makeinfo logs a message and according to the
6975: value of TEXINFO_REQD either runs the appropriate makeinfo command or exit on
6976: error.
6977:
1.154 rillig 6978: 21.6.8. Packages installing man pages
1.1 dsieger 6979:
6980: All packages that install manual pages should install them into the same
6981: directory, so that there is one common place to look for them. In pkgsrc, this
6982: place is ${PREFIX}/${PKGMANDIR}, and this expression should be used in
1.25 wiz 6983: packages. The default for PKGMANDIR is "man". Another often-used value is "
6984: share/man".
1.1 dsieger 6985:
6986: Note
6987:
6988: The support for a custom PKGMANDIR is far from complete.
6989:
6990: The PLIST files can just use man/ as the top level directory for the man page
6991: file entries, and the pkgsrc framework will convert as needed. In all other
6992: places, the correct PKGMANDIR must be used.
6993:
6994: Packages that are configured with GNU_CONFIGURE set as "yes", by default will
6995: use the ./configure --mandir switch to set where the man pages should be
6996: installed. The path is GNU_CONFIGURE_MANDIR which defaults to ${PREFIX}/$
6997: {PKGMANDIR}.
6998:
6999: Packages that use GNU_CONFIGURE but do not use --mandir, can set
7000: CONFIGURE_HAS_MANDIR to "no". Or if the ./configure script uses a non-standard
7001: use of --mandir, you can set GNU_CONFIGURE_MANDIR as needed.
7002:
1.154 rillig 7003: See Section 15.5, "Man page compression" for information on installation of
1.1 dsieger 7004: compressed manual pages.
7005:
1.154 rillig 7006: 21.6.9. Packages installing GConf data files
1.1 dsieger 7007:
1.7 rillig 7008: If a package installs .schemas or .entries files, used by GConf, you need to
1.1 dsieger 7009: take some extra steps to make sure they get registered in the database:
7010:
1.7 rillig 7011: 1. Include ../../devel/GConf/schemas.mk instead of its buildlink3.mk file.
7012: This takes care of rebuilding the GConf database at installation and
7013: deinstallation time, and tells the package where to install GConf data
1.1 dsieger 7014: files using some standard configure arguments. It also disallows any access
7015: to the database directly from the package.
7016:
7017: 2. Ensure that the package installs its .schemas files under ${PREFIX}/share/
7018: gconf/schemas. If they get installed under ${PREFIX}/etc, you will need to
7019: manually patch the package.
7020:
7021: 3. Check the PLIST and remove any entries under the etc/gconf directory, as
1.154 rillig 7022: they will be handled automatically. See Section 10.13, "How do I change the
1.1 dsieger 7023: location of configuration files?" for more information.
7024:
1.7 rillig 7025: 4. Define the GCONF_SCHEMAS variable in your Makefile with a list of all
1.1 dsieger 7026: .schemas files installed by the package, if any. Names must not contain any
7027: directories in them.
7028:
1.7 rillig 7029: 5. Define the GCONF_ENTRIES variable in your Makefile with a list of all
1.1 dsieger 7030: .entries files installed by the package, if any. Names must not contain any
7031: directories in them.
7032:
1.154 rillig 7033: 21.6.10. Packages installing scrollkeeper/rarian data files
1.1 dsieger 7034:
1.18 mishka 7035: If a package installs .omf files, used by scrollkeeper/rarian, you need to take
7036: some extra steps to make sure they get registered in the database:
1.1 dsieger 7037:
1.18 mishka 7038: 1. Include ../../mk/omf-scrollkeeper.mk instead of rarian's buildlink3.mk
7039: file. This takes care of rebuilding the scrollkeeper database at
7040: installation and deinstallation time, and disallows any access to it
7041: directly from the package.
1.1 dsieger 7042:
7043: 2. Check the PLIST and remove any entries under the libdata/scrollkeeper
7044: directory, as they will be handled automatically.
7045:
7046: 3. Remove the share/omf directory from the PLIST. It will be handled by
1.18 mishka 7047: rarian. (make print-PLIST does this automatically.)
1.1 dsieger 7048:
1.154 rillig 7049: 21.6.11. Packages installing X11 fonts
1.1 dsieger 7050:
7051: If a package installs font files, you will need to rebuild the fonts database
7052: in the directory where they get installed at installation and deinstallation
7053: time. This can be automatically done by using the pkginstall framework.
7054:
7055: You can list the directories where fonts are installed in the FONTS_DIRS.type
7056: variables, where type can be one of "ttf", "type1" or "x11". Also make sure
7057: that the database file fonts.dir is not listed in the PLIST.
7058:
7059: Note that you should not create new directories for fonts; instead use the
7060: standard ones to avoid that the user needs to manually configure his X server
7061: to find them.
7062:
1.154 rillig 7063: 21.6.12. Packages installing GTK2 modules
1.1 dsieger 7064:
7065: If a package installs GTK2 immodules or loaders, you need to take some extra
7066: steps to get them registered in the GTK2 database properly:
7067:
7068: 1. Include ../../x11/gtk2/modules.mk instead of its buildlink3.mk file. This
7069: takes care of rebuilding the database at installation and deinstallation
7070: time.
7071:
7072: 2. Set GTK2_IMMODULES=YES if your package installs GTK2 immodules.
7073:
7074: 3. Set GTK2_LOADERS=YES if your package installs GTK2 loaders.
7075:
7076: 4. Patch the package to not touch any of the GTK2 databases directly. These
7077: are:
7078:
1.42 asau 7079: + libdata/gtk-2.0/gdk-pixbuf.loaders
1.1 dsieger 7080:
1.42 asau 7081: + libdata/gtk-2.0/gtk.immodules
1.1 dsieger 7082:
7083: 5. Check the PLIST and remove any entries under the libdata/gtk-2.0 directory,
7084: as they will be handled automatically.
7085:
1.154 rillig 7086: 21.6.13. Packages installing SGML or XML data
1.1 dsieger 7087:
7088: If a package installs SGML or XML data files that need to be registered in
7089: system-wide catalogs (like DTDs, sub-catalogs, etc.), you need to take some
7090: extra steps:
7091:
7092: 1. Include ../../textproc/xmlcatmgr/catalogs.mk in your Makefile, which takes
7093: care of registering those files in system-wide catalogs at installation and
7094: deinstallation time.
7095:
7096: 2. Set SGML_CATALOGS to the full path of any SGML catalogs installed by the
7097: package.
7098:
7099: 3. Set XML_CATALOGS to the full path of any XML catalogs installed by the
7100: package.
7101:
7102: 4. Set SGML_ENTRIES to individual entries to be added to the SGML catalog.
7103: These come in groups of three strings; see xmlcatmgr(1) for more
7104: information (specifically, arguments recognized by the 'add' action). Note
7105: that you will normally not use this variable.
7106:
7107: 5. Set XML_ENTRIES to individual entries to be added to the XML catalog. These
7108: come in groups of three strings; see xmlcatmgr(1) for more information
7109: (specifically, arguments recognized by the 'add' action). Note that you
7110: will normally not use this variable.
7111:
1.154 rillig 7112: 21.6.14. Packages installing extensions to the MIME database
1.1 dsieger 7113:
7114: If a package provides extensions to the MIME database by installing .xml files
7115: inside ${PREFIX}/share/mime/packages, you need to take some extra steps to
7116: ensure that the database is kept consistent with respect to these new files:
7117:
7118: 1. Include ../../databases/shared-mime-info/mimedb.mk (avoid using the
7119: buildlink3.mk file from this same directory, which is reserved for
7120: inclusion from other buildlink3.mk files). It takes care of rebuilding the
7121: MIME database at installation and deinstallation time, and disallows any
7122: access to it directly from the package.
7123:
1.25 wiz 7124: 2. Check the PLIST and remove any entries under the share/mime directory,
1.1 dsieger 7125: except for files saved under share/mime/packages. The former are handled
7126: automatically by the update-mime-database program, but the latter are
7127: package-dependent and must be removed by the package that installed them in
7128: the first place.
7129:
7130: 3. Remove any share/mime/* directories from the PLIST. They will be handled by
7131: the shared-mime-info package.
7132:
1.154 rillig 7133: 21.6.15. Packages using intltool
1.1 dsieger 7134:
7135: If a package uses intltool during its build, add intltool to the USE_TOOLS,
7136: which forces it to use the intltool package provided by pkgsrc, instead of the
7137: one bundled with the distribution file.
7138:
7139: This tracks intltool's build-time dependencies and uses the latest available
7140: version; this way, the package benefits of any bug fixes that may have appeared
7141: since it was released.
7142:
1.154 rillig 7143: 21.6.16. Packages installing startup scripts
1.1 dsieger 7144:
7145: If a package contains a rc.d script, it won't be copied into the startup
7146: directory by default, but you can enable it, by adding the option
1.4 rillig 7147: PKG_RCD_SCRIPTS=YES in mk.conf. This option will copy the scripts into /etc/
7148: rc.d when a package is installed, and it will automatically remove the scripts
7149: when the package is deinstalled.
1.1 dsieger 7150:
1.154 rillig 7151: 21.6.17. Packages installing TeX modules
1.1 dsieger 7152:
7153: If a package installs TeX packages into the texmf tree, the ls-R database of
7154: the tree needs to be updated.
7155:
7156: Note
7157:
1.23 jakllsch 7158: Except the main TeX packages such as kpathsea, packages should install files
7159: into ${PREFIX}/share/texmf-dist, not ${PREFIX}/share/texmf.
1.1 dsieger 7160:
1.23 jakllsch 7161: 1. Include ../../print/kpathsea/texmf.mk. This takes care of rebuilding the
7162: ls-R database at installation and deinstallation time.
1.1 dsieger 7163:
1.23 jakllsch 7164: 2. If your package installs files into a texmf tree other than the one at $
7165: {PREFIX}/share/texmf-dist, set TEX_TEXMF_DIRS to the list of all texmf
7166: trees that need database update.
1.1 dsieger 7167:
7168: If your package also installs font map files that need to be registered
1.30 dholland 7169: using updmap, include ../../print/tex-tetex/map.mk and set TEX_MAP_FILES
7170: and/or TEX_MIXEDMAP_FILES to the list of all such font map files. Then
7171: updmap will be run automatically at installation/deinstallation to enable/
7172: disable font map files for TeX output drivers.
1.1 dsieger 7173:
7174: 3. Make sure that none of ls-R databases are included in PLIST, as they will
1.30 dholland 7175: be removed only by the kpathsea package.
1.1 dsieger 7176:
1.154 rillig 7177: 21.6.18. Packages supporting running binaries in emulation
1.1 dsieger 7178:
7179: There are some packages that provide libraries and executables for running
7180: binaries from a one operating system on a different one (if the latter supports
7181: it). One example is running Linux binaries on NetBSD.
7182:
7183: The pkgtools/rpm2pkg helps in extracting and packaging Linux rpm packages.
7184:
7185: The CHECK_SHLIBS can be set to no to avoid the check-shlibs target, which tests
7186: if all libraries for each installed executable can be found by the dynamic
7187: linker. Since the standard dynamic linker is run, this fails for emulation
7188: packages, because the libraries used by the emulation are not in the standard
7189: directories.
7190:
1.154 rillig 7191: 21.6.19. Packages installing hicolor theme icons
1.1 dsieger 7192:
7193: If a package installs images under the share/icons/hicolor and/or updates the
7194: share/icons/hicolor/icon-theme.cache database, you need to take some extra
7195: steps to make sure that the shared theme directory is handled appropriately and
7196: that the cache database is rebuilt:
7197:
7198: 1. Include ../../graphics/hicolor-icon-theme/buildlink3.mk.
7199:
7200: 2. Check the PLIST and remove the entry that refers to the theme cache.
7201:
7202: 3. Ensure that the PLIST does not remove the shared icon directories from the
7203: share/icons/hicolor hierarchy because they will be handled automatically.
7204:
7205: The best way to verify that the PLIST is correct with respect to the last two
7206: points is to regenerate it using make print-PLIST.
7207:
1.154 rillig 7208: 21.6.20. Packages installing desktop files
1.1 dsieger 7209:
7210: If a package installs .desktop files under share/applications and these include
1.54 rodent 7211: MIME information (MimeType key), you need to take extra steps to ensure that
7212: they are registered into the MIME database:
1.1 dsieger 7213:
7214: 1. Include ../../sysutils/desktop-file-utils/desktopdb.mk.
7215:
7216: 2. Check the PLIST and remove the entry that refers to the share/applications/
7217: mimeinfo.cache file. It will be handled automatically.
7218:
7219: The best way to verify that the PLIST is correct with respect to the last point
7220: is to regenerate it using make print-PLIST.
7221:
1.154 rillig 7222: 21.7. Marking packages as having problems
1.1 dsieger 7223:
1.23 jakllsch 7224: In some cases one does not have the time to solve a problem immediately. In
7225: this case, one can plainly mark a package as broken. For this, one just sets
7226: the variable BROKEN to the reason why the package is broken (similar to the
1.162 rillig 7227: PKG_FAIL_REASON variable). A user trying to build the package will immediately
7228: be shown this message, and the build will not be even tried.
1.1 dsieger 7229:
1.23 jakllsch 7230: BROKEN packages are removed from pkgsrc in irregular intervals.
1.1 dsieger 7231:
1.154 rillig 7232: Chapter 22. Debugging
1.1 dsieger 7233:
7234: To check out all the gotchas when building a package, here are the steps that I
7235: do in order to get a package working. Please note this is basically the same as
7236: what was explained in the previous sections, only with some debugging aids.
7237:
1.4 rillig 7238: * Be sure to set PKG_DEVELOPER=yes in mk.conf.
1.1 dsieger 7239:
7240: * Install pkgtools/url2pkg, create a directory for a new package, change into
7241: it, then run url2pkg:
7242:
7243: % mkdir /usr/pkgsrc/category/examplepkg
7244: % cd /usr/pkgsrc/category/examplepkg
1.174 leot 7245: % url2pkg https://www.example.com/path/to/distfile.tar.gz
1.1 dsieger 7246:
7247: * Edit the Makefile as requested.
7248:
7249: * Fill in the DESCR file
7250:
7251: * Run make configure
7252:
7253: * Add any dependencies glimpsed from documentation and the configure step to
7254: the package's Makefile.
7255:
7256: * Make the package compile, doing multiple rounds of
7257:
7258: % make
7259: % pkgvi ${WRKSRC}/some/file/that/does/not/compile
7260: % mkpatches
7261: % patchdiff
7262: % mv ${WRKDIR}/.newpatches/* patches
7263: % make mps
7264: % make clean
7265:
7266: Doing this step as non-root user will ensure that no files are modified
7267: that shouldn't be, especially during the build phase. mkpatches, patchdiff
7268: and pkgvi are from the pkgtools/pkgdiff package.
7269:
1.154 rillig 7270: * Look at the Makefile, fix if necessary; see Section 13.1, "Makefile".
1.1 dsieger 7271:
7272: * Generate a PLIST:
7273:
7274: # make install
7275: # make print-PLIST >PLIST
7276: # make deinstall
7277: # make install
7278: # make deinstall
7279:
7280: You usually need to be root to do this. Look if there are any files left:
7281:
7282: # make print-PLIST
7283:
7284: If this reveals any files that are missing in PLIST, add them.
7285:
7286: * Now that the PLIST is OK, install the package again and make a binary
7287: package:
7288:
7289: # make reinstall
7290: # make package
7291:
7292: * Delete the installed package:
7293:
7294: # pkg_delete examplepkg
7295:
7296: * Repeat the above make print-PLIST command, which shouldn't find anything
7297: now:
7298:
7299: # make print-PLIST
7300:
7301: * Reinstall the binary package:
7302:
7303: # pkg_add .../examplepkg.tgz
7304:
7305: * Play with it. Make sure everything works.
7306:
7307: * Run pkglint from pkgtools/pkglint, and fix the problems it reports:
7308:
7309: # pkglint
7310:
1.154 rillig 7311: * Submit (or commit, if you have cvs access); see Chapter 23, Submitting and
1.1 dsieger 7312: Committing.
7313:
1.154 rillig 7314: Chapter 23. Submitting and Committing
1.1 dsieger 7315:
7316: Table of Contents
7317:
1.154 rillig 7318: 23.1. Submitting binary packages
7319: 23.2. Submitting source packages (for non-NetBSD-developers)
7320: 23.3. General notes when adding, updating, or removing packages
7321: 23.4. Commit Messages
7322: 23.5. Committing: Adding a package to CVS
7323: 23.6. Updating a package to a newer version
7324: 23.7. Renaming a package in pkgsrc
7325: 23.8. Moving a package in pkgsrc
1.1 dsieger 7326:
1.154 rillig 7327: 23.1. Submitting binary packages
1.1 dsieger 7328:
7329: Our policy is that we accept binaries only from pkgsrc developers to guarantee
7330: that the packages don't contain any trojan horses etc. This is not to annoy
7331: anyone but rather to protect our users! You're still free to put up your
7332: home-made binary packages and tell the world where to get them. NetBSD
1.154 rillig 7333: developers doing bulk builds and wanting to upload them please see Chapter 8,
1.66 asau 7334: Creating binary packages for everything in pkgsrc (bulk builds).
1.1 dsieger 7335:
1.154 rillig 7336: 23.2. Submitting source packages (for non-NetBSD-developers)
1.1 dsieger 7337:
7338: First, check that your package is complete, compiles and runs well; see
1.154 rillig 7339: Chapter 22, Debugging and the rest of this document. Next, generate an
1.1 dsieger 7340: uuencoded gzipped tar(1) archive that contains all files that make up the
7341: package. Finally, send this package to the pkgsrc bug tracking system, either
7342: with the send-pr(1) command, or if you don't have that, go to the web page
1.174 leot 7343: https://www.NetBSD.org/support/send-pr.html, which contains some instructions
1.22 snj 7344: and a link to a form where you can submit packages. The sysutils/gtk-send-pr
7345: package is also available as a substitute for either of the above two tools.
1.1 dsieger 7346:
7347: In the form of the problem report, the category should be "pkg", the synopsis
7348: should include the package name and version number, and the description field
7349: should contain a short description of your package (contents of the COMMENT
1.25 wiz 7350: variable or DESCR file are OK). The uuencoded package data should go into the "
7351: fix" field.
1.1 dsieger 7352:
7353: If you want to submit several packages, please send a separate PR for each one,
7354: it's easier for us to track things that way.
7355:
7356: Alternatively, you can also import new packages into pkgsrc-wip ("pkgsrc
1.174 leot 7357: work-in-progress"); see the homepage at https://pkgsrc.org/wip/ for details.
1.1 dsieger 7358:
1.154 rillig 7359: 23.3. General notes when adding, updating, or removing packages
1.1 dsieger 7360:
7361: Please note all package additions, updates, moves, and removals in pkgsrc/doc/
7362: CHANGES-YYYY. It's very important to keep this file up to date and conforming
7363: to the existing format, because it will be used by scripts to automatically
7364: update pages on www.NetBSD.org and other sites. Additionally, check the pkgsrc/
7365: doc/TODO file and remove the entry for the package you updated or removed, in
7366: case it was mentioned there.
7367:
7368: When the PKGREVISION of a package is bumped, the change should appear in pkgsrc
7369: /doc/CHANGES-YYYY if it is security related or otherwise relevant. Mass bumps
7370: that result from a dependency being updated should not be mentioned. In all
7371: other cases it's the developer's decision.
7372:
7373: There is a make target that helps in creating proper CHANGES-YYYY entries: make
7374: changes-entry. It uses the optional CTYPE and NETBSD_LOGIN_NAME variables. The
7375: general usage is to first make sure that your CHANGES-YYYY file is up-to-date
7376: (to avoid having to resolve conflicts later-on) and then to cd to the package
7377: directory. For package updates, make changes-entry is enough. For new packages,
7378: or package moves or removals, set the CTYPE variable on the command line to
1.4 rillig 7379: "Added", "Moved", or "Removed". You can set NETBSD_LOGIN_NAME in mk.conf if
1.23 jakllsch 7380: your local login name is not the same as your NetBSD login name. The target
7381: also automatically removes possibly existing entries for the package in the
7382: TODO file. Don't forget to commit the changes, e.g. by using make
1.66 asau 7383: commit-changes-entry! If you are not using a checkout directly from
1.23 jakllsch 7384: cvs.NetBSD.org, but e.g. a local copy of the repository, you can set
7385: USE_NETBSD_REPO=yes. This makes the cvs commands use the main repository.
1.1 dsieger 7386:
1.154 rillig 7387: 23.4. Commit Messages
1.130 wiz 7388:
7389: For several years, there have been mirrors of pkgsrc in fossil, git, and hg.
7390: Standard practise when using these tools is to make the first line of a commit
7391: message function as a summary that can be read without the rest, such as is
7392: commonly done with "git log --oneline". For this reason, we have the following
7393: guidelines for pkgsrc commit messages:
7394:
1.131 wiz 7395: * Start the commit message with a line that explains the big picture in 65
1.130 wiz 7396: characters or less. When a commit is for one package, include the name of
7397: the package. For updates, include the version to which it is updated.
7398:
7399: * Leave the next line empty.
7400:
7401: * Then come the details for the commit (changes in that package, reason for a
7402: change) and any relevant PRs. Wrap this section.
7403:
7404: Here is an example:
7405:
7406: libxslt: update to 1.0.30
7407:
7408: Changes since 1.0.29:
7409: ...
7410:
7411:
7412: Here is another example:
7413:
7414: mk/bsd.pkg.mk: enable SSP by default on NetBSD
7415:
7416: (rationale)
7417:
7418:
7419: Commit messages are final: no "cvs admin" is allowed on the pkgsrc repository
7420: to change commit messages.
7421:
1.154 rillig 7422: 23.5. Committing: Adding a package to CVS
1.1 dsieger 7423:
7424: This section is only of interest for pkgsrc developers with write access to the
1.34 wiz 7425: pkgsrc repository.
7426:
7427: When the package is finished, "cvs add" the files. Start by adding the
7428: directory and then files in the directory. Don't forget to add the new package
7429: to the category's Makefile. Make sure you don't forget any files; you can check
7430: by running "cvs status". An example:
7431:
7432: $ cd .../pkgsrc/category
7433: $ cvs add pkgname
7434: $ cd pkgname
7435: $ cvs add DESCR Makefile PLIST distinfo buildlink3.mk patches
7436: $ cvs add patches/p*
7437: $ cvs status | less
1.35 wiz 7438: $ cvs commit
1.34 wiz 7439: $ cd ..
7440: $ vi Makefile # add SUBDIRS+=pkgname line
1.35 wiz 7441: $ cvs commit Makefile
1.66 asau 7442: $ cd pkgname
1.73 jnemeth 7443: $ make CTYPE=Added commit-changes-entry
1.1 dsieger 7444:
7445: The commit message of the initial import should include part of the DESCR file,
7446: so people reading the mailing lists know what the package is/does.
7447:
1.34 wiz 7448: Also mention the new package in pkgsrc/doc/CHANGES-20xx.
7449:
7450: Previously, "cvs import" was suggested, but it was much easier to get wrong
7451: than "cvs add".
1.1 dsieger 7452:
1.154 rillig 7453: 23.6. Updating a package to a newer version
1.1 dsieger 7454:
7455: Please always put a concise, appropriate and relevant summary of the changes
7456: between old and new versions into the commit log when updating a package. There
7457: are various reasons for this:
7458:
7459: * A URL is volatile, and can change over time. It may go away completely or
7460: its information may be overwritten by newer information.
7461:
7462: * Having the change information between old and new versions in our CVS
7463: repository is very useful for people who use either cvs or anoncvs.
7464:
7465: * Having the change information between old and new versions in our CVS
7466: repository is very useful for people who read the pkgsrc-changes mailing
7467: list, so that they can make tactical decisions about when to upgrade the
7468: package.
7469:
7470: Please also recognize that, just because a new version of a package has been
7471: released, it should not automatically be upgraded in the CVS repository. We
7472: prefer to be conservative in the packages that are included in pkgsrc -
7473: development or beta packages are not really the best thing for most places in
7474: which pkgsrc is used. Please use your judgement about what should go into
7475: pkgsrc, and bear in mind that stability is to be preferred above new and
7476: possibly untested features.
7477:
1.154 rillig 7478: 23.7. Renaming a package in pkgsrc
1.21 snj 7479:
7480: Renaming packages is not recommended.
7481:
1.175 gutterid 7482: When renaming packages, be sure to fix any references to the old name in other
1.21 snj 7483: Makefiles, options, buildlink files, etc.
7484:
1.175 gutterid 7485: Also, when renaming a package, please add the package name and version pattern
1.167 leot 7486: (s) of the previous package to SUPERSEDES. This may be repeated for multiple
7487: renames. The new package would be an exact replacement. Example:
7488:
7489: SUPERSEDES+= p5-IO-Compress-Zlib<2.017
7490: SUPERSEDES+= optcomp-[0-9]*
1.21 snj 7491:
7492: Note that "successor" in the CHANGES-YYYY file doesn't necessarily mean that it
7493: supersedes, as that successor may not be an exact replacement but is a
7494: suggestion for the replaced functionality.
7495:
1.154 rillig 7496: 23.8. Moving a package in pkgsrc
1.21 snj 7497:
7498: It is preferred that packages are not renamed or moved, but if needed please
7499: follow these steps.
1.1 dsieger 7500:
7501: 1. Make a copy of the directory somewhere else.
7502:
7503: 2. Remove all CVS dirs.
7504:
7505: Alternatively to the first two steps you can also do:
7506:
7507: % cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package
7508:
7509: and use that for further work.
7510:
1.25 wiz 7511: 3. Fix CATEGORIES and any DEPENDS paths that just did "../package" instead of
1.1 dsieger 7512: "../../category/package".
7513:
1.21 snj 7514: 4. In the modified package's Makefile, consider setting PREV_PKGPATH to the
7515: previous category/package pathname. The PREV_PKGPATH can be used by tools
7516: for doing an update using pkgsrc building; for example, it can search the
7517: pkg_summary(5) database for PREV_PKGPATH (if no SUPERSEDES) and then use
7518: the corresponding new PKGPATH for that moved package. Note that it may have
7519: multiple matches, so the tool should also check on the PKGBASE too. The
7520: PREV_PKGPATH probably has no value unless SUPERSEDES is not set, i.e.
7521: PKGBASE stays the same.
7522:
7523: 5. cvs import the modified package in the new place.
1.1 dsieger 7524:
1.21 snj 7525: 6. Check if any package depends on it:
1.1 dsieger 7526:
7527: % cd /usr/pkgsrc
7528: % grep /package */*/Makefile* */*/buildlink*
7529:
1.21 snj 7530: 7. Fix paths in packages from step 5 to point to new location.
1.1 dsieger 7531:
1.21 snj 7532: 8. cvs rm (-f) the package at the old location.
1.1 dsieger 7533:
1.21 snj 7534: 9. Remove from oldcategory/Makefile.
1.1 dsieger 7535:
1.21 snj 7536: 10. Add to newcategory/Makefile.
1.1 dsieger 7537:
1.21 snj 7538: 11. Commit the changed and removed files:
1.1 dsieger 7539:
7540: % cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile
7541:
7542: (and any packages from step 5, of course).
7543:
1.154 rillig 7544: Chapter 24. Frequently Asked Questions
1.1 dsieger 7545:
7546: This section contains the answers to questions that may arise when you are
7547: writing a package. If you don't find your question answered here, first have a
7548: look in the other chapters, and if you still don't have the answer, ask on the
7549: pkgsrc-users mailing list.
7550:
1.154 rillig 7551: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
7552: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
7553: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
7554: 24.4. What is the difference between BUILDLINK_LDFLAGS, BUILDLINK_LDADD and
1.1 dsieger 7555: BUILDLINK_LIBS?
1.154 rillig 7556: 24.5. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
7557: 24.6. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.1 dsieger 7558: the := inside it.
1.154 rillig 7559: 24.7. Which mailing lists are there for package developers?
7560: 24.8. Where is the pkgsrc documentation?
7561: 24.9. I have a little time to kill. What shall I do?
1.1 dsieger 7562:
1.154 rillig 7563: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
1.1 dsieger 7564:
7565: MAKEFLAGS are the flags passed to the pkgsrc-internal invocations of make
7566: (1), while MAKE_FLAGS are the flags that are passed to the MAKE_PROGRAM
7567: when building the package. [FIXME: What is .MAKEFLAGS for?]
7568:
1.154 rillig 7569: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
1.1 dsieger 7570:
7571: MAKE is the path to the make(1) program that is used in the pkgsrc
7572: infrastructure. GMAKE is the path to GNU Make, but you need to say
7573: USE_TOOLS+=gmake to use that. MAKE_PROGRAM is the path to the Make
7574: program that is used for building the package.
7575:
1.154 rillig 7576: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
1.1 dsieger 7577:
7578: CC is the path to the real C compiler, which can be configured by the
7579: pkgsrc user. PKG_CC is the path to the compiler wrapper. PKGSRC_COMPILER
7580: is not a path to a compiler, but the type of compiler that should be
7581: used. See mk/compiler.mk for more information about the latter variable.
7582:
1.154 rillig 7583: 24.4. What is the difference between BUILDLINK_LDFLAGS, BUILDLINK_LDADD and
1.1 dsieger 7584: BUILDLINK_LIBS?
7585:
7586: [FIXME]
7587:
1.154 rillig 7588: 24.5. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
1.1 dsieger 7589:
1.25 wiz 7590: For optimization reasons, some variables are only available in the "
7591: wrapper" phase and later. To "simulate" the wrapper phase, append
1.1 dsieger 7592: PKG_PHASE=wrapper to the above command.
7593:
1.154 rillig 7594: 24.6. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.1 dsieger 7595: the := inside it.
7596:
1.108 rillig 7597: The := is not really an assignment operator, although it looks like it.
7598: Instead, it is a degenerate form of ${LIST:old_string=new_string}, which
7599: is documented in the make(1) man page and which is commonly used in the
7600: form ${SRCS:.c=.o}. In the case of MASTER_SITE_*, old_string is the empty
7601: string and new_string is package/. That's where the : and the = fall
7602: together.
1.1 dsieger 7603:
1.154 rillig 7604: 24.7. Which mailing lists are there for package developers?
1.1 dsieger 7605:
7606: tech-pkg
7607:
7608: This is a list for technical discussions related to pkgsrc
7609: development, e.g. soliciting feedback for changes to pkgsrc
7610: infrastructure, proposed new features, questions related to porting
7611: pkgsrc to a new platform, advice for maintaining a package, patches
7612: that affect many packages, help requests moved from pkgsrc-users when
7613: an infrastructure bug is found, etc.
7614:
7615: pkgsrc-bugs
7616:
7617: All bug reports in category "pkg" sent with send-pr(1) appear here.
7618: Please do not report your bugs here directly; use one of the other
7619: mailing lists.
7620:
1.154 rillig 7621: 24.8. Where is the pkgsrc documentation?
1.1 dsieger 7622:
7623: There are many places where you can find documentation about pkgsrc:
7624:
7625: * The pkgsrc guide (this document) is a collection of chapters that
7626: explain large parts of pkgsrc, but some chapters tend to be outdated.
7627: Which ones they are is hard to say.
7628:
1.174 leot 7629: * On the mailing list archives (see https://mail-index.NetBSD.org/),
7630: you can find discussions about certain features, announcements of new
1.1 dsieger 7631: parts of the pkgsrc infrastructure and sometimes even announcements
7632: that a certain feature has been marked as obsolete. The benefit here
7633: is that each message has a date appended to it.
7634:
7635: * Many of the files in the mk/ directory start with a comment that
7636: describes the purpose of the file and how it can be used by the
7637: pkgsrc user and package authors. An easy way to find this
7638: documentation is to run bmake help.
7639:
7640: * The CVS log messages are a rich source of information, but they tend
7641: to be highly abbreviated, especially for actions that occur often.
7642: Some contain a detailed description of what has changed, but they are
7643: geared towards the other pkgsrc developers, not towards an average
7644: pkgsrc user. They also only document changes, so if you don't know
7645: what has been before, these messages may not be worth too much to
7646: you.
7647:
7648: * Some parts of pkgsrc are only "implicitly documented", that is the
7649: documentation exists only in the mind of the developer who wrote the
7650: code. To get this information, use the cvs annotate command to see
7651: who has written it and ask on the tech-pkg mailing list, so that
7652: others can find your questions later (see above). To be sure that the
7653: developer in charge reads the mail, you may CC him or her.
7654:
1.154 rillig 7655: 24.9. I have a little time to kill. What shall I do?
1.1 dsieger 7656:
7657: This is not really an FAQ yet, but here's the answer anyway.
7658:
7659: * Run pkg_chk -N (from the pkgtools/pkg_chk package). It will tell you
7660: about newer versions of installed packages that are available, but
7661: not yet updated in pkgsrc.
7662:
7663: * Browse pkgsrc/doc/TODO ? it contains a list of suggested new packages
7664: and a list of cleanups and enhancements for pkgsrc that would be nice
7665: to have.
7666:
1.71 wiz 7667: * Review packages for which review was requested on the tech-pkg
7668: mailing list.
1.1 dsieger 7669:
1.154 rillig 7670: Chapter 25. GNOME packaging and porting
1.1 dsieger 7671:
7672: Table of Contents
7673:
1.154 rillig 7674: 25.1. Meta packages
7675: 25.2. Packaging a GNOME application
7676: 25.3. Updating GNOME to a newer version
7677: 25.4. Patching guidelines
1.1 dsieger 7678:
7679: Quoting GNOME's web site:
7680:
7681: The GNOME project provides two things: The GNOME desktop environment, an
7682: intuitive and attractive desktop for users, and the GNOME development
7683: platform, an extensive framework for building applications that integrate
7684: into the rest of the desktop.
7685:
7686: pkgsrc provides a seamless way to automatically build and install a complete
7687: GNOME environment under many different platforms. We can say with confidence
7688: that pkgsrc is one of the most advanced build and packaging systems for GNOME
7689: due to its included technologies buildlink3, the wrappers and tools framework
7690: and automatic configuration file management. Lots of efforts are put into
7691: achieving a completely clean deinstallation of installed software components.
7692:
7693: Given that pkgsrc is NetBSD's official packaging system, the above also means
7694: that great efforts are put into making GNOME work under this operating system.
7695: Recently, DragonFly BSD also adopted pkgsrc as its preferred packaging system,
7696: contributing lots of portability fixes to make GNOME build and install under
7697: it.
7698:
7699: This chapter is aimed at pkgsrc developers and other people interested in
7700: helping our GNOME porting and packaging efforts. It provides instructions on
7701: how to manage the existing packages and some important information regarding
7702: their internals.
7703:
7704: We need your help!
7705:
7706: Should you have some spare cycles to devote to NetBSD, pkgsrc and GNOME and are
7707: willing to learn new exciting stuff, please jump straight to the pending work
7708: list! There is still a long way to go to get a fully-functional GNOME desktop
7709: under NetBSD and we need your help to achieve it!
7710:
1.154 rillig 7711: 25.1. Meta packages
1.1 dsieger 7712:
7713: pkgsrc includes three GNOME-related meta packages:
7714:
7715: * meta-pkgs/gnome-base: Provides the core GNOME desktop environment. It only
7716: includes the necessary bits to get it to boot correctly, although it may
7717: lack important functionality for daily operation. The idea behind this
7718: package is to let end users build their own configurations on top of this
7719: one, first installing this meta package to achieve a functional setup and
7720: then adding individual applications.
7721:
7722: * meta-pkgs/gnome: Provides a complete installation of the GNOME platform and
7723: desktop as defined by the GNOME project; this is based on the components
7724: distributed in the platform/x.y/x.y.z/sources and desktop/x.y/x.y.z/sources
7725: directories of the official FTP server. Developer-only tools found in those
7726: directories are not installed unless required by some other component to
7727: work properly. Similarly, packages from the bindings set (bindings/x.y/
7728: x.y.z/sources) are not pulled in unless required as a dependency for an
7729: end-user component. This package "extends" meta-pkgs/gnome-base.
7730:
7731: * meta-pkgs/gnome-devel: Installs all the tools required to build a GNOME
7732: component when fetched from the CVS repository. These are required to let
7733: the autogen.sh scripts work appropriately.
7734:
7735: In all these packages, the DEPENDS lines are sorted in a way that eases
7736: updates: a package may depend on other packages listed before it but not on any
1.25 wiz 7737: listed after it. It is very important to keep this order to ease updates so...
1.1 dsieger 7738: do not change it to alphabetical sorting!
7739:
1.154 rillig 7740: 25.2. Packaging a GNOME application
1.1 dsieger 7741:
7742: Almost all GNOME applications are written in C and use a common set of tools as
7743: their build system. Things get different with the new bindings to other
7744: languages (such as Python), but the following will give you a general idea on
7745: the minimum required tools:
7746:
7747: * Almost all GNOME applications use the GNU Autotools as their build system.
7748: As a general rule you will need to tell this to your package:
7749:
7750: GNU_CONFIGURE=yes
7751: USE_LIBTOOL=yes
7752: USE_TOOLS+=gmake
7753:
7754: * If the package uses pkg-config to detect dependencies, add this tool to the
7755: list of required utilities:
7756:
7757: USE_TOOLS+=pkg-config
7758:
7759: Also use pkgtools/verifypc at the end of the build process to ensure that
7760: you did not miss to specify any dependency in your package and that the
7761: version requirements are all correct.
7762:
7763: * If the package uses intltool, be sure to add intltool to the USE_TOOLS to
7764: handle dependencies and to force the package to use the latest available
7765: version.
7766:
7767: * If the package uses gtk-doc (a documentation generation utility), do not
7768: add a dependency on it. The tool is rather big and the distfile should come
7769: with pregenerated documentation anyway; if it does not, it is a bug that
7770: you ought to report. For such packages you should disable gtk-doc (unless
7771: it is the default):
7772:
7773: CONFIGURE_ARGS+=--disable-gtk-doc
7774:
7775: The default location of installed HTML files (share/gtk-doc/<package-name>)
7776: is correct and should not be changed unless the package insists on
7777: installing them somewhere else. Otherwise programs as devhelp will not be
7778: able to open them. You can do that with an entry similar to:
7779:
7780: CONFIGURE_ARGS+=--with-html-dir=${PREFIX}/share/gtk-doc/...
7781:
7782: GNOME uses multiple shared directories and files under the installation prefix
7783: to maintain databases. In this context, shared means that those exact same
7784: directories and files are used among several different packages, leading to
7785: conflicts in the PLIST. pkgsrc currently includes functionality to handle the
7786: most common cases, so you have to forget about using @unexec ${RMDIR} lines in
7787: your file lists and omitting shared files from them. If you find yourself doing
7788: those, your package is most likely incorrect.
7789:
7790: The following table lists the common situations that result in using shared
7791: directories or files. For each of them, the appropriate solution is given.
1.25 wiz 7792: After applying the solution be sure to regenerate the package's file list with
1.1 dsieger 7793: make print-PLIST and ensure it is correct.
7794:
1.154 rillig 7795: Table 25.1. PLIST handling for GNOME packages
1.1 dsieger 7796:
7797: +-----------------------------------------------------------------------------+
7798: | If the package... | Then... |
7799: |-------------------------------------------+---------------------------------|
1.154 rillig 7800: | |See Section 21.6.10, "Packages |
1.18 mishka 7801: |Installs OMF files under share/omf. |installing scrollkeeper/rarian |
7802: | |data files". |
1.1 dsieger 7803: |-------------------------------------------+---------------------------------|
1.154 rillig 7804: |Installs icons under the share/icons/ |See Section 21.6.19, "Packages |
1.1 dsieger 7805: |hicolor hierarchy or updates share/icons/ |installing hicolor theme icons". |
7806: |hicolor/icon-theme.cache. | |
7807: |-------------------------------------------+---------------------------------|
1.154 rillig 7808: | |See Section 21.6.14, "Packages |
1.1 dsieger 7809: |Installs files under share/mime/packages. |installing extensions to the MIME|
7810: | |database". |
7811: |-------------------------------------------+---------------------------------|
1.154 rillig 7812: |Installs .desktop files under share/ |See Section 21.6.20, "Packages |
1.1 dsieger 7813: |applications and these include MIME |installing desktop files". |
7814: |information. | |
7815: +-----------------------------------------------------------------------------+
7816:
7817:
1.154 rillig 7818: 25.3. Updating GNOME to a newer version
1.1 dsieger 7819:
7820: When seeing GNOME as a whole, there are two kinds of updates:
7821:
7822: Major update
7823:
7824: Given that there is still a very long way for GNOME 3 (if it ever appears),
7825: we consider a major update one that goes from a 2.X version to a 2.Y one,
7826: where Y is even and greater than X. These are hard to achieve because they
7827: introduce lots of changes in the components' code and almost all GNOME
7828: distfiles are updated to newer versions. Some of them can even break API
7829: and ABI compatibility with the previous major version series. As a result,
7830: the update needs to be done all at once to minimize breakage.
7831:
7832: A major update typically consists of around 80 package updates and the
7833: addition of some new ones.
7834:
7835: Minor update
7836:
7837: We consider a minor update one that goes from a 2.A.X version to a 2.A.Y
7838: one where Y is greater than X. These are easy to achieve because they do
7839: not update all GNOME components, can be done in an incremental way and do
7840: not break API nor ABI compatibility.
7841:
7842: A minor update typically consists of around 50 package updates, although
7843: the numbers here may vary a lot.
7844:
7845: In order to update the GNOME components in pkgsrc to a new stable release
7846: (either major or minor), the following steps should be followed:
7847:
7848: 1. Get a list of all the tarballs that form the new release by using the
1.19 snj 7849: following commands. These will leave the full list of the components'
1.1 dsieger 7850: distfiles into the list.txt file:
7851:
7852: % echo ls "*.tar.bz2" | \
7853: ftp -V ftp://ftp.gnome.org/pub/gnome/platform/x.y/x.y.z/sources/ | \
7854: awk '{ print $9 }' >list.txt
7855: % echo ls "*.tar.bz2" | \
7856: ftp -V ftp://ftp.gnome.org/pub/gnome/desktop/x.y/x.y.z/sources/ | \
7857: awk '{ print $9 }' >>list.txt
7858:
7859: 2. Open each meta package's Makefile and bump their version to the release you
7860: are updating them to. The three meta packages should be always consistent
7861: with versioning. Obviously remove any PKGREVISIONs that might be in them.
7862:
7863: 3. For each meta package, update all its DEPENDS lines to match the latest
7864: versions as shown by the above commands. Do not list any newer version
7865: (even if found in the FTP) because the meta packages are supposed to list
7866: the exact versions that form a specific GNOME release. Exceptions are
7867: permitted here if a newer version solves a serious issue in the overall
7868: desktop experience; these typically come in the form of a revision bump in
7869: pkgsrc, not in newer versions from the developers.
7870:
7871: Packages not listed in the list.txt file should be updated to the latest
7872: version available (if found in pkgsrc). This is the case, for example, of
7873: the dependencies on the GNU Autotools in the meta-pkgs/gnome-devel meta
7874: package.
7875:
7876: 4. Generate a patch from the modified meta packages and extract the list of
7877: "new" lines. This will provide you an outline on what packages need to be
7878: updated in pkgsrc and in what order:
7879:
7880: % cvs diff -u gnome-devel gnome-base gnome | grep '^+D' >todo.txt
7881:
7882: 5. For major desktop updates it is recommended to zap all your installed
7883: packages and start over from scratch at this point.
7884:
7885: 6. Now comes the longest step by far: iterate over the contents of todo.txt
7886: and update the packages listed in it in order. For major desktop updates
7887: none of these should be committed until the entire set is completed because
7888: there are chances of breaking not-yet-updated packages.
7889:
7890: 7. Once the packages are up to date and working, commit them to the tree one
7891: by one with appropriate log messages. At the end, commit the three meta
7892: package updates and all the corresponding changes to the doc/CHANGES-<YEAR>
7893: and pkgsrc/doc/TODO files.
7894:
1.154 rillig 7895: 25.4. Patching guidelines
1.1 dsieger 7896:
7897: GNOME is a very big component in pkgsrc which approaches 100 packages. Please,
7898: it is very important that you always, always, always feed back any portability
7899: fixes you do to a GNOME package to the mainstream developers (see
1.154 rillig 7900: Section 13.3.5, "Feedback to the author"). This is the only way to get their
1.1 dsieger 7901: attention on portability issues and to ensure that future versions can be built
7902: out-of-the box on NetBSD. The less custom patches in pkgsrc, the easier further
7903: updates are. Those developers in charge of issuing major GNOME updates will be
7904: grateful if you do that.
7905:
7906: The most common places to report bugs are the GNOME's Bugzilla and the
7907: freedesktop.org's Bugzilla. Not all components use these to track bugs, but
7908: most of them do. Do not be short on your reports: always provide detailed
7909: explanations of the current failure, how it can be improved to achieve maximum
7910: portability and, if at all possible, provide a patch against CVS head. The more
7911: verbose you are, the higher chances of your patch being accepted.
7912:
7913: Also, please avoid using preprocessor magic to fix portability issues. While
7914: the FreeBSD GNOME people are doing a great job in porting GNOME to their
7915: operating system, the official GNOME sources are now plagued by conditionals
7916: that check for __FreeBSD__ and similar macros. This hurts portability. Please
1.154 rillig 7917: see our patching guidelines (Section 13.3.4, "Patching guidelines") for more
1.1 dsieger 7918: details.
7919:
7920: Part III. The pkgsrc infrastructure internals
7921:
7922: This part of the guide deals with everything from the infrastructure that is
7923: behind the interfaces described in the developer's guide. A casual package
7924: maintainer should not need anything from this part.
7925:
7926: Table of Contents
7927:
1.154 rillig 7928: 26. Design of the pkgsrc infrastructure
1.1 dsieger 7929:
1.154 rillig 7930: 26.1. The meaning of variable definitions
7931: 26.2. Avoiding problems before they arise
7932: 26.3. Variable evaluation
1.1 dsieger 7933:
1.154 rillig 7934: 26.3.1. At load time
7935: 26.3.2. At runtime
1.1 dsieger 7936:
1.154 rillig 7937: 26.4. How can variables be specified?
7938: 26.5. Designing interfaces for Makefile fragments
1.1 dsieger 7939:
1.154 rillig 7940: 26.5.1. Procedures with parameters
7941: 26.5.2. Actions taken on behalf of parameters
1.1 dsieger 7942:
1.154 rillig 7943: 26.6. The order in which files are loaded
1.1 dsieger 7944:
1.154 rillig 7945: 26.6.1. The order in bsd.prefs.mk
7946: 26.6.2. The order in bsd.pkg.mk
1.1 dsieger 7947:
1.154 rillig 7948: 27. Regression tests
1.1 dsieger 7949:
1.154 rillig 7950: 27.1. Running the regression tests
7951: 27.2. Adding a new regression test
1.1 dsieger 7952:
1.154 rillig 7953: 27.2.1. Overridable functions
7954: 27.2.2. Helper functions
1.1 dsieger 7955:
1.154 rillig 7956: 28. Porting pkgsrc
1.1 dsieger 7957:
1.154 rillig 7958: 28.1. Porting pkgsrc to a new operating system
1.1 dsieger 7959:
1.154 rillig 7960: Chapter 26. Design of the pkgsrc infrastructure
1.1 dsieger 7961:
7962: Table of Contents
7963:
1.154 rillig 7964: 26.1. The meaning of variable definitions
7965: 26.2. Avoiding problems before they arise
7966: 26.3. Variable evaluation
1.1 dsieger 7967:
1.154 rillig 7968: 26.3.1. At load time
7969: 26.3.2. At runtime
1.1 dsieger 7970:
1.154 rillig 7971: 26.4. How can variables be specified?
7972: 26.5. Designing interfaces for Makefile fragments
1.1 dsieger 7973:
1.154 rillig 7974: 26.5.1. Procedures with parameters
7975: 26.5.2. Actions taken on behalf of parameters
1.1 dsieger 7976:
1.154 rillig 7977: 26.6. The order in which files are loaded
1.1 dsieger 7978:
1.154 rillig 7979: 26.6.1. The order in bsd.prefs.mk
7980: 26.6.2. The order in bsd.pkg.mk
1.1 dsieger 7981:
7982: The pkgsrc infrastructure consists of many small Makefile fragments. Each such
7983: fragment needs a properly specified interface. This chapter explains how such
7984: an interface looks like.
7985:
1.154 rillig 7986: 26.1. The meaning of variable definitions
1.1 dsieger 7987:
7988: Whenever a variable is defined in the pkgsrc infrastructure, the location and
7989: the way of definition provide much information about the intended use of that
7990: variable. Additionally, more documentation may be found in a header comment or
7991: in this pkgsrc guide.
7992:
7993: A special file is mk/defaults/mk.conf, which lists all variables that are
7994: intended to be user-defined. They are either defined using the ?= operator or
7995: they are left undefined because defining them to anything would effectively
7996: mean "yes". All these variables may be overridden by the pkgsrc user in the
7997: MAKECONF file.
7998:
7999: Outside this file, the following conventions apply: Variables that are defined
8000: using the ?= operator may be overridden by a package.
8001:
8002: Variables that are defined using the = operator may be used read-only at
8003: run-time.
8004:
8005: Variables whose name starts with an underscore must not be accessed outside the
8006: pkgsrc infrastructure at all. They may change without further notice.
8007:
8008: Note
8009:
8010: These conventions are currently not applied consistently to the complete pkgsrc
8011: infrastructure.
8012:
1.154 rillig 8013: 26.2. Avoiding problems before they arise
1.1 dsieger 8014:
8015: All variables that contain lists of things should default to being empty. Two
8016: examples that do not follow this rule are USE_LANGUAGES and DISTFILES. These
8017: variables cannot simply be modified using the += operator in package Makefiles
8018: (or other files included by them), since there is no guarantee whether the
8019: variable is already set or not, and what its value is. In the case of
8020: DISTFILES, the packages "know" the default value and just define it as in the
8021: following example.
8022:
8023: DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
8024:
8025: Because of the selection of this default value, the same value appears in many
8026: package Makefiles. Similarly for USE_LANGUAGES, but in this case the default
8027: value ("c") is so short that it doesn't stand out. Nevertheless it is mentioned
8028: in many files.
8029:
1.154 rillig 8030: 26.3. Variable evaluation
1.1 dsieger 8031:
1.154 rillig 8032: 26.3.1. At load time
1.1 dsieger 8033:
8034: Variable evaluation takes place either at load time or at runtime, depending on
8035: the context in which they occur. The contexts where variables are evaluated at
8036: load time are:
8037:
8038: * The right hand side of the := and != operators,
8039:
8040: * Make directives like .if or .for,
8041:
8042: * Dependency lines.
8043:
8044: A special exception are references to the iteration variables of .for loops,
8045: which are expanded inline, no matter in which context they appear.
8046:
8047: As the values of variables may change during load time, care must be taken not
8048: to evaluate them by accident. Typical examples for variables that should not be
8049: evaluated at load time are DEPENDS and CONFIGURE_ARGS. To make the effect more
8050: clear, here is an example:
8051:
8052: CONFIGURE_ARGS= # none
8053: CFLAGS= -O
8054: CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
8055:
8056: CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
8057:
8058: CFLAGS+= -Wall
8059:
8060: This code shows how the use of the := operator can quickly lead to unexpected
8061: results. The first paragraph is fairly common code. The second paragraph
8062: evaluates the CONFIGURE_ARGS variable, which results in CFLAGS=-O. In the third
8063: paragraph, the -Wall is appended to the CFLAGS, but this addition will not
8064: appear in CONFIGURE_ARGS. In actual code, the three paragraphs from above
8065: typically occur in completely unrelated files.
8066:
1.154 rillig 8067: 26.3.2. At runtime
1.1 dsieger 8068:
8069: After all the files have been loaded, the values of the variables cannot be
8070: changed anymore. Variables that are used in the shell commands are expanded at
8071: this point.
8072:
1.154 rillig 8073: 26.4. How can variables be specified?
1.1 dsieger 8074:
8075: There are many ways in which the definition and use of a variable can be
8076: restricted in order to detect bugs and violations of the (mostly unwritten)
1.108 rillig 8077: policies. A package can be checked with pkglint -Wall to see whether it meets
8078: these rules.
1.1 dsieger 8079:
1.154 rillig 8080: 26.5. Designing interfaces for Makefile fragments
1.1 dsieger 8081:
8082: Most of the .mk files fall into one of the following classes. Cases where a
8083: file falls into more than one class should be avoided as it often leads to
8084: subtle bugs.
8085:
1.154 rillig 8086: 26.5.1. Procedures with parameters
1.1 dsieger 8087:
8088: In a traditional imperative programming language some of the .mk files could be
1.23 jakllsch 8089: described as procedures. They take some input parameters and?after
8090: inclusion?provide a result in output parameters. Since all variables in
8091: Makefiles have global scope care must be taken not to use parameter names that
8092: have already another meaning. For example, PKGNAME is a bad choice for a
8093: parameter name.
1.1 dsieger 8094:
8095: Procedures are completely evaluated at preprocessing time. That is, when
8096: calling a procedure all input parameters must be completely resolvable. For
8097: example, CONFIGURE_ARGS should never be an input parameter since it is very
8098: likely that further text will be added after calling the procedure, which would
8099: effectively apply the procedure to only a part of the variable. Also,
1.108 rillig 8100: references to other variables will be modified after calling the procedure.
1.1 dsieger 8101:
8102: A procedure can declare its output parameters either as suitable for use in
8103: preprocessing directives or as only available at runtime. The latter
8104: alternative is for variables that contain references to other runtime
8105: variables.
8106:
8107: Procedures shall be written such that it is possible to call the procedure more
8108: than once. That is, the file must not contain multiple-inclusion guards.
8109:
8110: Examples for procedures are mk/bsd.options.mk and mk/buildlink3/bsd.builtin.mk.
8111: To express that the parameters are evaluated at load time, they should be
8112: assigned using the := operator, which should be used only for this purpose.
8113:
1.154 rillig 8114: 26.5.2. Actions taken on behalf of parameters
1.1 dsieger 8115:
8116: Action files take some input parameters and may define runtime variables. They
8117: shall not define loadtime variables. There are action files that are included
8118: implicitly by the pkgsrc infrastructure, while other must be included
8119: explicitly.
8120:
8121: An example for action files is mk/subst.mk.
8122:
1.154 rillig 8123: 26.6. The order in which files are loaded
1.1 dsieger 8124:
8125: Package Makefiles usually consist of a set of variable definitions, and include
8126: the file ../../mk/bsd.pkg.mk in the very last line. Before that, they may also
8127: include various other *.mk files if they need to query the availability of
8128: certain features like the type of compiler or the X11 implementation. Due to
8129: the heavy use of preprocessor directives like .if and .for, the order in which
8130: the files are loaded matters.
8131:
8132: This section describes at which point the various files are loaded and gives
8133: reasons for that order.
8134:
1.154 rillig 8135: 26.6.1. The order in bsd.prefs.mk
1.1 dsieger 8136:
8137: The very first action in bsd.prefs.mk is to define some essential variables
8138: like OPSYS, OS_VERSION and MACHINE_ARCH.
8139:
1.4 rillig 8140: Then, the user settings are loaded from the file specified in MAKECONF, which
8141: is usually mk.conf. After that, those variables that have not been overridden
8142: by the user are loaded from mk/defaults/mk.conf.
1.1 dsieger 8143:
8144: After the user settings, the system settings and platform settings are loaded,
8145: which may override the user settings.
8146:
8147: Then, the tool definitions are loaded. The tool wrappers are not yet in effect.
8148: This only happens when building a package, so the proper variables must be used
8149: instead of the direct tool names.
8150:
8151: As the last steps, some essential variables from the wrapper and the package
8152: system flavor are loaded, as well as the variables that have been cached in
8153: earlier phases of a package build.
8154:
1.154 rillig 8155: 26.6.2. The order in bsd.pkg.mk
1.1 dsieger 8156:
8157: First, bsd.prefs.mk is loaded.
8158:
8159: Then, the various *-vars.mk files are loaded, which fill default values for
8160: those variables that have not been defined by the package. These variables may
8161: later be used even in unrelated files.
8162:
8163: Then, the file bsd.pkg.error.mk provides the target error-check that is added
8164: as a special dependency to all other targets that use DELAYED_ERROR_MSG or
8165: DELAYED_WARNING_MSG.
8166:
8167: Then, the package-specific hacks from hacks.mk are included.
8168:
8169: Then, various other files follow. Most of them don't have any dependencies on
8170: what they need to have included before or after them, though some do.
8171:
8172: The code to check PKG_FAIL_REASON and PKG_SKIP_REASON is then executed, which
8173: restricts the use of these variables to all the files that have been included
8174: before. Appearances in later files will be silently ignored.
8175:
8176: Then, the files for the main targets are included, in the order of later
8177: execution, though the actual order should not matter.
8178:
8179: At last, some more files are included that don't set any interesting variables
8180: but rather just define make targets to be executed.
8181:
1.154 rillig 8182: Chapter 27. Regression tests
1.1 dsieger 8183:
8184: Table of Contents
8185:
1.154 rillig 8186: 27.1. Running the regression tests
8187: 27.2. Adding a new regression test
1.1 dsieger 8188:
1.154 rillig 8189: 27.2.1. Overridable functions
8190: 27.2.2. Helper functions
1.1 dsieger 8191:
8192: The pkgsrc infrastructure consists of a large codebase, and there are many
8193: corners where every little bit of a file is well thought out, making pkgsrc
8194: likely to fail as soon as anything is changed near those parts. To prevent most
8195: changes from breaking anything, a suite of regression tests should go along
8196: with every important part of the pkgsrc infrastructure. This chapter describes
8197: how regression tests work in pkgsrc and how you can add new tests.
8198:
1.154 rillig 8199: 27.1. Running the regression tests
1.1 dsieger 8200:
1.25 wiz 8201: You first need to install the pkgtools/pkg_regress package, which provides the
1.1 dsieger 8202: pkg_regress command. Then you can simply run that command, which will run all
1.168 rillig 8203: tests in the regress/ directory.
1.1 dsieger 8204:
1.154 rillig 8205: 27.2. Adding a new regression test
1.1 dsieger 8206:
1.168 rillig 8207: Every directory in the regress/ directory that contains a file called spec is
1.1 dsieger 8208: considered a regression test. This file is a shell program that is included by
8209: the pkg_regress command. The following functions can be overridden to suit your
8210: needs.
8211:
1.154 rillig 8212: 27.2.1. Overridable functions
1.1 dsieger 8213:
1.108 rillig 8214: These functions do not take any parameters. Although they are called in "set -e
1.168 rillig 8215: " mode, they don't stop at the first failing command. See this Stack Overflow
1.108 rillig 8216: question for details.
1.1 dsieger 8217:
1.108 rillig 8218: do_setup
1.1 dsieger 8219:
8220: This function prepares the environment for the test. By default it does
8221: nothing.
8222:
1.108 rillig 8223: do_test
1.1 dsieger 8224:
8225: This function runs the actual test. By default, it calls TEST_MAKE with the
8226: arguments MAKEARGS_TEST and writes its output including error messages into
8227: the file TEST_OUTFILE.
8228:
1.108 rillig 8229: When defining this function, make sure that all output that needs to be
8230: checked is written to the correct output file. Example:
8231:
8232: do_test() {
8233: echo "Example output"
8234: } 1>$TEST_OUTFILE 2>&1
8235:
8236: check_result
1.1 dsieger 8237:
8238: This function is run after the test and is typically used to compare the
8239: actual output from the one that is expected. It can make use of the various
1.108 rillig 8240: helper functions from the next section. Example:
8241:
8242: check_result() {
8243: exit_status 0
8244: output_require "Example"
8245: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
8246: output_prohibit "no such file or directory"
1.169 rillig 8247: regress_fail "expected $expected but got $actual for input $input"
1.108 rillig 8248: }
1.1 dsieger 8249:
1.108 rillig 8250: do_cleanup
1.1 dsieger 8251:
8252: This function cleans everything up after the test has been run. By default
8253: it does nothing.
8254:
1.154 rillig 8255: 27.2.2. Helper functions
1.1 dsieger 8256:
1.168 rillig 8257: regress_fail message...
8258:
8259: This function makes the test fail with the given error message.
8260:
1.108 rillig 8261: exit_status expected
1.1 dsieger 8262:
1.108 rillig 8263: This function compares the exitcode of the do_test function with its first
8264: parameter. If they differ, the test will fail.
1.1 dsieger 8265:
1.108 rillig 8266: output_require regex...
1.1 dsieger 8267:
8268: This function checks for each of its parameters if the output from do_test
1.108 rillig 8269: matches the extended regular expression. If it does not, the test will
8270: fail. Example:
8271:
8272: output_require "looks fine"
8273: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
1.1 dsieger 8274:
8275: output_prohibit(regex...)
8276:
8277: This function checks for each of its parameters if the output from do_test
8278: () does not match the extended regular expression. If any of the regular
8279: expressions matches, the test will fail.
8280:
1.154 rillig 8281: Chapter 28. Porting pkgsrc
1.1 dsieger 8282:
8283: Table of Contents
8284:
1.154 rillig 8285: 28.1. Porting pkgsrc to a new operating system
1.1 dsieger 8286:
8287: The pkgsrc system has already been ported to many operating systems, hardware
8288: architectures and compilers. This chapter explains the necessary steps to make
8289: pkgsrc even more portable.
8290:
1.154 rillig 8291: 28.1. Porting pkgsrc to a new operating system
1.1 dsieger 8292:
8293: To port pkgsrc to a new operating system (called MyOS in this example), you
8294: need to touch the following files:
8295:
8296: pkgtools/bootstrap-mk-files/files/mods/MyOS.sys.mk
8297:
8298: This file contains some basic definitions, for example the name of the C
8299: compiler.
8300:
8301: mk/bsd.prefs.mk
8302:
8303: Insert code that defines the variables OPSYS, OS_VERSION, LOWER_OS_VERSION,
8304: LOWER_VENDOR, MACHINE_ARCH, OBJECT_FMT, APPEND_ELF, and the other variables
8305: that appear in this file.
8306:
8307: mk/platform/MyOS.mk
8308:
8309: This file contains the platform-specific definitions that are used by
8310: pkgsrc. Start by copying one of the other files and edit it to your needs.
8311:
8312: mk/tools/tools.MyOS.mk
8313:
8314: This file defines the paths to all the tools that are needed by one or the
8315: other package in pkgsrc, as well as by pkgsrc itself. Find out where these
8316: tools are on your platform and add them.
8317:
8318: Now, you should be able to build some basic packages, like lang/perl5, shells/
8319: bash.
8320:
8321: Appendix A. A simple example package: bison
8322:
8323: Table of Contents
8324:
8325: A.1. files
8326:
8327: A.1.1. Makefile
8328: A.1.2. DESCR
8329: A.1.3. PLIST
8330: A.1.4. Checking a package with pkglint
8331:
8332: A.2. Steps for building, installing, packaging
8333:
8334: We checked to find a piece of software that wasn't in the packages collection,
1.25 wiz 8335: and picked GNU bison. Quite why someone would want to have bison when Berkeley
1.1 dsieger 8336: yacc is already present in the tree is beyond us, but it's useful for the
8337: purposes of this exercise.
8338:
8339: A.1. files
8340:
8341: A.1.1. Makefile
8342:
1.2 rillig 8343: # $NetBSD$
1.1 dsieger 8344: #
8345:
8346: DISTNAME= bison-1.25
8347: CATEGORIES= devel
1.171 rillig 8348: MASTER_SITES= ${MASTER_SITE_GNU:=bison/}
1.1 dsieger 8349:
1.30 dholland 8350: MAINTAINER= pkgsrc-users@NetBSD.org
1.174 leot 8351: HOMEPAGE= https://www.gnu.org/software/bison/bison.html
1.1 dsieger 8352: COMMENT= GNU yacc clone
8353:
8354: GNU_CONFIGURE= yes
1.47 wiz 8355: INFO_FILES= yes
1.1 dsieger 8356:
8357: .include "../../mk/bsd.pkg.mk"
8358:
8359: A.1.2. DESCR
8360:
8361: GNU version of yacc. Can make re-entrant parsers, and numerous other
8362: improvements. Why you would want this when Berkeley yacc(1) is part
8363: of the NetBSD source tree is beyond me.
8364:
8365: A.1.3. PLIST
8366:
1.2 rillig 8367: @comment $NetBSD$
1.1 dsieger 8368: bin/bison
8369: man/man1/bison.1.gz
8370: share/bison.simple
8371: share/bison.hairy
8372:
8373: A.1.4. Checking a package with pkglint
8374:
8375: The NetBSD package system comes with pkgtools/pkglint which helps to check the
8376: contents of these files. After installation it is quite easy to use, just
1.171 rillig 8377: change to the directory of the package you wish to examine and run pkglint:
1.1 dsieger 8378:
8379: $ pkglint
1.171 rillig 8380: ERROR: Makefile: Each package must define its LICENSE.
8381: WARN: Makefile:9: HOMEPAGE should migrate from http to https.
8382: NOTE: PLIST:3: The .gz extension is unnecessary for manual pages.
8383: WARN: PLIST:5: "share/bison.hairy" should be sorted before "share/bison.simple".
8384: 1 error, 2 warnings and 1 note found.
8385: (Run "pkglint -e" to show explanations.)
8386: (Run "pkglint -fs" to show what can be fixed automatically.)
1.172 rillig 8387: (Run "pkglint -F" to automatically fix some issues.)
1.1 dsieger 8388:
8389: Depending on the supplied command line arguments (see pkglint(1)), more checks
1.170 rillig 8390: will be performed. Use e.g. pkglint -Wall for a very thorough check.
1.1 dsieger 8391:
8392: A.2. Steps for building, installing, packaging
8393:
8394: Create the directory where the package lives, plus any auxiliary directories:
8395:
8396: # cd /usr/pkgsrc/lang
8397: # mkdir bison
8398: # cd bison
8399: # mkdir patches
8400:
1.154 rillig 8401: Create Makefile, DESCR and PLIST (see Chapter 13, Package components - files,
1.1 dsieger 8402: directories and contents) then continue with fetching the distfile:
8403:
8404: # make fetch
8405: >> bison-1.25.tar.gz doesn't seem to exist on this system.
8406: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
8407: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8408: ftp: Error retrieving file: 500 Internal error
8409:
8410: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
8411: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8412: ftp: Error retrieving file: 500 Internal error
8413:
8414: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
8415: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8416: Successfully retrieved file.
8417:
8418: Generate the checksum of the distfile into distinfo:
8419:
8420: # make makedistinfo
8421:
8422: Now compile:
8423:
8424: # make
8425: >> Checksum OK for bison-1.25.tar.gz.
8426: ===> Extracting for bison-1.25
8427: ===> Patching for bison-1.25
8428: ===> Ignoring empty patch directory
8429: ===> Configuring for bison-1.25
8430: creating cache ./config.cache
8431: checking for gcc... cc
8432: checking whether we are using GNU C... yes
8433: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
8434: checking how to run the C preprocessor... cc -E
8435: checking for minix/config.h... no
8436: checking for POSIXized ISC... no
8437: checking whether cross-compiling... no
8438: checking for ANSI C header files... yes
8439: checking for string.h... yes
8440: checking for stdlib.h... yes
8441: checking for memory.h... yes
8442: checking for working const... yes
8443: checking for working alloca.h... no
8444: checking for alloca... yes
8445: checking for strerror... yes
8446: updating cache ./config.cache
8447: creating ./config.status
8448: creating Makefile
8449: ===> Building for bison-1.25
8450: 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
8451: 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
8452: 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
8453: 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
8454: 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
8455: 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
8456: 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
8457: 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
8458: 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
8459: 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
8460: 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
8461: 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
8462: 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
8463: 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
8464: 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
8465: 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
8466: 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
8467: 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
8468: 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
8469: 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
8470: 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
8471: 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
8472: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
8473: rm -f bison.s1
8474: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
8475:
8476: Everything seems OK, so install the files:
8477:
8478: # make install
8479: >> Checksum OK for bison-1.25.tar.gz.
8480: ===> Installing for bison-1.25
8481: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
8482: rm -f /usr/pkg/bin/bison
8483: cd /usr/pkg/share; rm -f bison.simple bison.hairy
8484: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
8485: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
8486: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
8487: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
8488: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
8489: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
8490: ===> Registering installation for bison-1.25
8491:
8492: You can now use bison, and also - if you decide so - remove it with pkg_delete
8493: bison. Should you decide that you want a binary package, do this now:
8494:
8495: # make package
8496: >> Checksum OK for bison-1.25.tar.gz.
8497: ===> Building package for bison-1.25
8498: Creating package bison-1.25.tgz
8499: Registering depends:.
8500: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
8501:
8502: Now that you don't need the source and object files any more, clean up:
8503:
8504: # make clean
8505: ===> Cleaning for bison-1.25
8506:
8507: Appendix B. Build logs
8508:
8509: Table of Contents
8510:
8511: B.1. Building figlet
8512: B.2. Packaging figlet
8513:
8514: B.1. Building figlet
8515:
8516: # make
8517: ===> Checking for vulnerabilities in figlet-2.2.1nb2
8518: => figlet221.tar.gz doesn't seem to exist on this system.
8519: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
8520: => [172219 bytes]
8521: Connected to ftp.plig.net.
8522: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
8523: 331 Guest login ok, send your complete e-mail address as password.
8524: 230-You are user #5 of 500 simultaneous users allowed.
8525: 230-
8526: 230- ___ _ _ _
8527: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
8528: 230- | _| _| . |_| . | | | . |_| . | _| . |
8529: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
8530: 230- |_| |_| |___| |___|
8531: 230-
8532: 230-** Welcome to ftp.plig.org **
8533: 230-
8534: 230-Please note that all transfers from this FTP site are logged. If you
8535: 230-do not like this, please disconnect now.
8536: 230-
1.19 snj 8537: 230-This archive is available via
1.1 dsieger 8538: 230-
8539: 230-HTTP: http://ftp.plig.org/
8540: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
8541: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
8542: 230-
8543: 230-Please email comments, bug reports and requests for packages to be
8544: 230-mirrored to ftp-admin@plig.org.
8545: 230-
8546: 230-
8547: 230 Logged in anonymously.
8548: Remote system type is UNIX.
8549: Using binary mode to transfer files.
8550: 200 Type okay.
8551: 250 "/pub" is new cwd.
8552: 250-"/pub/figlet" is new cwd.
8553: 250-
8554: 250-Welcome to the figlet archive at ftp.figlet.org
8555: 250-
8556: 250- ftp://ftp.figlet.org/pub/figlet/
8557: 250-
8558: 250-The official FIGlet web page is:
8559: 250- http://www.figlet.org/
8560: 250-
8561: 250-If you have questions, please mailto:info@figlet.org. If you want to
8562: 250-contribute a font or something else, you can email us.
8563: 250
8564: 250 "/pub/figlet/program" is new cwd.
8565: 250 "/pub/figlet/program/unix" is new cwd.
8566: local: figlet221.tar.gz remote: figlet221.tar.gz
8567: 502 Unimplemented command.
8568: 227 Entering Passive Mode (195,40,6,41,246,104)
8569: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
8570: 38% |************** | 65800 64.16 KB/s 00:01 ETA
8571: 226 Transfer completed.
8572: 172219 bytes received in 00:02 (75.99 KB/s)
8573: 221 Goodbye.
8574: => Checksum OK for figlet221.tar.gz.
8575: ===> Extracting for figlet-2.2.1nb2
8576: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
8577: ===> Patching for figlet-2.2.1nb2
8578: ===> Applying pkgsrc patches for figlet-2.2.1nb2
8579: ===> Overriding tools for figlet-2.2.1nb2
8580: ===> Creating toolchain wrappers for figlet-2.2.1nb2
8581: ===> Configuring for figlet-2.2.1nb2
8582: ===> Building for figlet-2.2.1nb2
8583: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
8584: chmod a+x figlet
8585: gcc -O2 -o chkfont chkfont.c
8586: => Unwrapping files-to-be-installed.
8587: #
8588: # make install
8589: ===> Checking for vulnerabilities in figlet-2.2.1nb2
8590: ===> Installing for figlet-2.2.1nb2
8591: install -d -o root -g wheel -m 755 /usr/pkg/bin
8592: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
8593: mkdir -p /usr/pkg/share/figlet
8594: cp figlet /usr/pkg/bin
8595: cp chkfont /usr/pkg/bin
8596: chmod 555 figlist showfigfonts
8597: cp figlist /usr/pkg/bin
8598: cp showfigfonts /usr/pkg/bin
8599: cp fonts/*.flf /usr/pkg/share/figlet
8600: cp fonts/*.flc /usr/pkg/share/figlet
8601: cp figlet.6 /usr/pkg/man/man6
8602: ===> Registering installation for figlet-2.2.1nb2
8603: #
8604:
8605: B.2. Packaging figlet
8606:
8607: # make package
8608: ===> Checking for vulnerabilities in figlet-2.2.1nb2
8609: ===> Packaging figlet-2.2.1nb2
8610: ===> Building binary package for figlet-2.2.1nb2
8611: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
8612: Using SrcDir value of /usr/pkg
8613: Registering depends:.
8614: #
8615:
8616: Appendix C. Directory layout of the pkgsrc FTP server
8617:
8618: Table of Contents
8619:
1.23 jakllsch 8620: C.1. distfiles: The distributed source files
8621: C.2. misc: Miscellaneous things
8622: C.3. packages: Binary packages
8623: C.4. reports: Bulk build reports
1.148 leot 8624: C.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 8625:
8626: As in other big projects, the directory layout of pkgsrc is quite complex for
8627: newbies. This chapter explains where you find things on the FTP server. The
8628: base directory on ftp.NetBSD.org is /pub/pkgsrc/. On other servers it may be
8629: different, but inside this directory, everything should look the same, no
8630: matter on which server you are. This directory contains some subdirectories,
8631: which are explained below.
8632:
1.23 jakllsch 8633: C.1. distfiles: The distributed source files
1.1 dsieger 8634:
8635: The directory distfiles contains lots of archive files from all pkgsrc
8636: packages, which are mirrored here. The subdirectories are called after their
8637: package names and are used when the distributed files have names that don't
8638: explicitly contain a version number or are otherwise too generic (for example
8639: release.tar.gz).
8640:
1.23 jakllsch 8641: C.2. misc: Miscellaneous things
1.1 dsieger 8642:
8643: This directory contains things that individual pkgsrc developers find worth
8644: publishing.
8645:
1.23 jakllsch 8646: C.3. packages: Binary packages
1.1 dsieger 8647:
1.3 rillig 8648: This directory contains binary packages for the various platforms that are
8649: supported by pkgsrc. Each subdirectory is of the form OPSYS/ARCH/OSVERSION_TAG.
8650: The meaning of these variables is:
8651:
8652: * OPSYS is the name of the operating system for which the packages have been
1.9 rillig 8653: built. The name is taken from the output of the uname command, so it may
8654: differ from the one you are used to hear.
1.3 rillig 8655:
1.8 rillig 8656: * ARCH is the hardware architecture of the platform for which the packages
1.10 hubertf 8657: have been built. It also includes the ABI (Application Binary Interface)
8658: for platforms that have several of them.
1.3 rillig 8659:
1.8 rillig 8660: * OSVERSION is the version of the operating system. For version numbers that
8661: change often (for example NetBSD-current), the often-changing part should
8662: be replaced with an x, for example 4.99.x.
1.3 rillig 8663:
1.23 jakllsch 8664: * TAG is either 20xxQy for a stable branch, or head for packages built from
1.8 rillig 8665: the HEAD branch. The latter should only be used when the packages are
8666: updated on a regular basis. Otherwise the date from checking out pkgsrc
8667: should be appended, for example head_20071015.
1.3 rillig 8668:
8669: The rationale for exactly this scheme is that the pkgsrc users looking for
8670: binary packages can quickly click through the directories on the server and
8671: find the best binary packages for their machines. Since they usually know the
8672: operating system and the hardware architecture, OPSYS and ARCH are placed
8673: first. After these choices, they can select the best combination of OSVERSION
8674: and TAG together, since it is usually the case that packages stay compatible
8675: between different version of the operating system.
8676:
8677: In each of these directories, there is a whole binary packages collection for a
8678: specific platform. It has a directory called All which contains all binary
8679: packages. Besides that, there are various category directories that contain
8680: symbolic links to the real binary packages.
1.1 dsieger 8681:
1.23 jakllsch 8682: C.4. reports: Bulk build reports
1.8 rillig 8683:
8684: Here are the reports from bulk builds, for those who want to fix packages that
8685: didn't build on some of the platforms. The structure of subdirectories should
1.23 jakllsch 8686: look like the one in Section C.3, "packages: Binary packages".
1.8 rillig 8687:
1.148 leot 8688: C.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 8689:
8690: These directories contain the "real" pkgsrc, that is the files that define how
8691: to create binary packages from source archives.
8692:
1.149 leot 8693: Each of the current, stable and pkgsrc-20xxQy directories share the same
8694: structure. They each contain a pkgsrc directory and pkgsrc.tar.{bz,gz,xz} file.
8695:
1.1 dsieger 8696: The directory pkgsrc contains a snapshot of the CVS repository, which is
1.149 leot 8697: updated regularly. The file pkgsrc.tar.{bz,gz,xz} contains the same as the
8698: directory, ready to be downloaded as a whole.
1.1 dsieger 8699:
1.149 leot 8700: The current directory contains files related to the HEAD branch of the CVS
8701: repository. In this directory there is an additional file called
8702: pkgsrc-readmes.tar.{bz,gz,xz} that contains all pkgsrc READMEs with information
8703: about categories and packages.
8704:
8705: The stable directory is a symlink to the latest pkgsrc-20xxQy.
8706:
8707: The pkgsrc-20xxQy. directories contain files related to the -20xxQy stable
8708: branch of the CVS repository. In these directories there is an additional file
8709: called pkgsrc-20xxQy.tar.{bz,gz,xz}, which contains the state of pkgsrc when it
8710: was branched.
1.148 leot 8711:
1.154 rillig 8712: Appendix D. Help topics
8713:
8714: The following list contains all help topics that are available when running
8715: bmake help topic=:index.
8716:
1.172 rillig 8717: #! -lintl
8718: 64bit ABI
8719: ACCEPTABLE_LICENSES ACROREAD_FONTPATH
8720: ADDITIONAL AFAIK
8721: AIX ALLOW_VULNERABLE_PACKAGES
1.175 gutterid 8722: ALL_ENV ALTERNATIVES_SRC
8723: AMANDA_TMP AMANDA_USER
8724: AMANDA_VAR APACHE_GROUP
8725: APACHE_MODULE_NAME APACHE_MODULE_SRC
8726: APACHE_MODULE_SRCDIR APACHE_PKG_PREFIX
8727: APACHE_SUEXEC_CONFIGURE_ARGS APACHE_SUEXEC_DOCROOT
8728: APACHE_USER APPEND_ABI
8729: APPEND_ELF ARLA_CACHE
8730: AUDIT_PACKAGES_FLAGS AUTOCONF_REQD
8731: AUTOMAKE_OVERRIDE AUTOMAKE_REQD
8732: AUTO_MKDIRS BDB185_DEFAULT
8733: BDBBASE BDB_ACCEPTED
8734: BDB_DEFAULT BDB_LIBS
8735: BDB_TYPE BIND_DIR
8736: BIND_GROUP BIND_USER
8737: BINPKG_SITES BIN_INSTALL_FLAGS
8738: BISON_PKGDATADIR BOOTSTRAP_DEPENDS
1.172 rillig 8739: BOOTSTRAP_SETUPTOOLS BROKEN
8740: BROKEN_EXCEPT_ON_PLATFORM BROKEN_ON_PLATFORM
8741: BSDSRCDIR BSDXSRCDIR
8742: BSD_MAKE_ENV BUILDLINK_AUTO_DIRS
8743: BUILDLINK_AUTO_VARS BUILDLINK_CFLAGS
8744: BUILDLINK_CONTENTS_FILTER BUILDLINK_CPPFLAGS
8745: BUILDLINK_DEPMETHOD BUILDLINK_FILES
8746: BUILDLINK_FILES_CMD BUILDLINK_FNAME_TRANSFORM
8747: BUILDLINK_LDFLAGS BUILDLINK_LIBS
8748: BUILDLINK_OPSYS_SUPPORT_PTHREAD BUILDLINK_PKGNAME
8749: BUILDLINK_PREFIX BUILDLINK_RPATHDIRS
8750: BUILDLINK_TREE BUILD_DEFS
8751: BUILD_DEFS_EFFECTS BUILD_DEPENDS
8752: BUILD_DIRS BUILD_ENV_SHELL
8753: BUILD_MAKE_CMD BUILD_MAKE_FLAGS
8754: BUILD_TARGET BUILTIN_FIND_FILES
8755: BUILTIN_FIND_FILES_VAR BUILTIN_FIND_GREP
8756: BUILTIN_FIND_HEADERS BUILTIN_FIND_HEADERS_VAR
8757: BUILTIN_PKG BUILTIN_TEST_CURSES_DEFINES
8758: BUILTIN_TEST_CURSES_FUNCS BUILTIN_VERSION_SCRIPT
8759: BUILTIN_X11_TYPE BUILTIN_X11_VERSION
8760: CACTI_GROUP CACTI_USER
8761: CANNA_GROUP CANNA_USER
8762: CAT CCACHE_BASE
8763: CCACHE_DIR CCACHE_LOGFILE
8764: CC_VERSION CC_VERSION_STRING
8765: CDRECORD_CONF CDROM_PKG_URL_DIR
1.175 gutterid 8766: CDROM_PKG_URL_HOST CHECK_FAKEHOME
8767: CHECK_FILES CHECK_FILES_SKIP
8768: CHECK_FILES_STRICT CHECK_HEADERS
8769: CHECK_HEADERS_SKIP CHECK_INTERPRETER
8770: CHECK_INTERPRETER_SKIP CHECK_PERMS
8771: CHECK_PERMS_AUTOFIX CHECK_PERMS_SKIP
8772: CHECK_PORTABILITY CHECK_PORTABILITY_SKIP
8773: CHECK_RELRO CHECK_RELRO_SKIP
8774: CHECK_RELRO_SUPPORTED CHECK_SHLIBS
8775: CHECK_SHLIBS_BLACKLIST CHECK_SHLIBS_SKIP
8776: CHECK_SHLIBS_SUPPORTED CHECK_SSP
8777: CHECK_SSP_SKIP CHECK_SSP_SUPPORTED
8778: CHECK_STRIPPED CHECK_STRIPPED_SKIP
8779: CHECK_WRKREF CHECK_WRKREF_EXTRA_DIRS
8780: CHECK_WRKREF_SKIP CLAMAV_DBDIR
8781: CLAMAV_GROUP CLAMAV_USER
8782: CLANGBASE CLEANDEPENDS
8783: CMAKE_DEPENDENCIES_REWRITE CMAKE_INSTALL_PREFIX
8784: CMAKE_MODULE_PATH_OVERRIDE CMAKE_PKGSRC_BUILD_FLAGS
8785: CMAKE_PREFIX_PATH CMAKE_USE_GNU_INSTALL_DIRS
1.172 rillig 8786: COMPILER_RPATH_FLAG COMPILER_USE_SYMLINKS
8787: CONFIGURE_ARGS CONFIGURE_DIRS
8788: CONFIGURE_ENV CONFIGURE_ENV_SHELL
8789: CONFIGURE_HAS_INFODIR CONFIGURE_HAS_MANDIR
8790: CONFIGURE_SCRIPT CONFIG_SHELL
8791: CONFIG_SHELL_FLAGS CONF_FILES
8792: CONF_FILES_MODE CONF_FILES_PERMS
8793: CONSERVER_DEFAULTHOST CONSERVER_DEFAULTPORT
8794: CP CPP
8795: CPP_PRECOMP_FLAGS CREATE_WRKDIR_SYMLINK
8796: CROSSBASE CTFCONVERT
8797: CTF_FILES_SKIP CTF_SUPPORTED
8798: CTYPE CUPS_GROUP
8799: CUPS_SYSTEM_GROUPS CUPS_USER
8800: CURSES_DEFAULT CURSES_TYPE
1.175 gutterid 8801: CXX CYRUS_GROUP
8802: CYRUS_IDLE CYRUS_USER
8803: DAEMONTOOLS_GROUP DAEMONTOOLS_LOG_USER
8804: DBUS_GROUP DBUS_USER
8805: DEFANG_GROUP DEFANG_USER
8806: DEFAULT_ACCEPTABLE_LICENSES DEFAULT_DISTFILES
8807: DEFAULT_IRC_SERVER DEFAULT_SERIAL_DEVICE
8808: DEF_UMASK DEINSTALLDEPENDS
8809: DEINSTALL_SRC DEINSTALL_TEMPLATES
8810: DELAYED_ERROR_MSG DELAYED_WARNING_MSG
8811: DEPENDS DEPENDS_TARGET
8812: DEPENDS_TYPE DESTDIR
8813: DESTDIR_VARNAME DIALER_GROUP
8814: DIGEST_REQD DISTDIR
8815: DISTFILES DISTINFO_FILE
8816: DISTNAME DIST_PATH
8817: DIST_SUBDIR DJBDNS_AXFR_USER
8818: DJBDNS_CACHE_USER DJBDNS_DJBDNS_GROUP
8819: DJBDNS_LOG_USER DJBDNS_RBL_USER
8820: DJBDNS_TINY_USER DLOPEN_REQUIRE_PTHREADS
8821: DL_AUTO_VARS DL_CFLAGS
8822: DL_LDFLAGS DL_LIBS
8823: DNS DOWNLOADED_DISTFILE
8824: DT_LAYOUT DYNAMIC_SITES_CMD
8825: DYNAMIC_SITES_SCRIPT ECHO
8826: ECHO_N ELK_GUI
8827: EMACS_TYPE EMULDIR
8828: EMULSUBDIR EMULSUBDIRSLASH
8829: EMUL_ARCH EMUL_DISTRO
8830: EMUL_EXEC_FMT EMUL_IS_NATIVE
8831: EMUL_MODULES EMUL_OPSYS
8832: EMUL_PKG_FMT EMUL_PLATFORM
8833: EMUL_PLATFORMS EMUL_PREFER
8834: EMUL_REQD EMUL_TYPE
8835: ERROR_MSG EXIM_GROUP
8836: EXIM_USER EXPORT_SYMBOLS_LDFLAGS
8837: EXTRACTOR EXTRACT_CMD
8838: EXTRACT_CMD_DEFAULT EXTRACT_DIR
8839: EXTRACT_ELEMENTS EXTRACT_ENV
8840: EXTRACT_ONLY EXTRACT_OPTS
8841: EXTRACT_SUFX EXTRACT_USING
8842: FAILOVER_FETCH FAIL_MSG
8843: FAKE_NCURSES FAM
8844: FAM_ACCEPTED FAM_DEFAULT
8845: FAM_SERVER FCPATH
8846: FEATURE_CPPFLAGS FEATURE_LDFLAGS
8847: FEATURE_LIBS FETCH_AFTER_ARGS
8848: FETCH_BEFORE_ARGS FETCH_CMD
8849: FETCH_OUTPUT_ARGS FETCH_PROXY
8850: FETCH_RESUME_ARGS FETCH_USING
8851: FILES_SUBST FILES_SUBST_SED
8852: FIX_SYSTEM_HEADERS FLUXBOX_USE_GNOME
8853: FLUXBOX_USE_KDE FLUXBOX_USE_XFT
8854: FLUXBOX_USE_XINERAMA FONTS_DIRS
1.172 rillig 8855: FONTS_VERBOSE FOO_HACKS_MK
8856: FOX_USE_XUNICODE FREEWNN_GROUP
8857: FREEWNN_USER FTP_PKG_URL_DIR
8858: FTP_PKG_URL_HOST GAMEDATAMODE
8859: GAMEDATA_PERMS GAMEDIRMODE
8860: GAMEDIR_PERMS GAMEGRP
8861: GAMEMODE GAMEOWN
8862: GAMES_GROUP GAMES_USER
8863: GCC GCCBASE
8864: GCC_REQD GCC_VERSION_SUFFIX
8865: GEM_BUILD GEM_CLEANBUILD
8866: GEM_CLEANBUILD_EXTENSIONS GEM_DOCDIR
8867: GEM_EXTSDIR GEM_HOME
8868: GEM_LIBDIR GEM_NAME
8869: GEM_PATH GEM_SPECFILE
8870: GENERATE_PLIST GHOSTSCRIPT_REQD
8871: GITHUB_PROJECT GITHUB_RELEASE
8872: GITHUB_TAG GITHUB_TYPE
1.175 gutterid 8873: GNU GNU_CONFIGURE
8874: GNU_CONFIGURE_INFODIR GNU_CONFIGURE_MANDIR
8875: GNU_CONFIGURE_STRICT GODEP_REDIRECTS
8876: GO_BUILD_PATTERN GO_DEPS
8877: GO_DIST_BASE GO_MODULE_FILES
1.172 rillig 8878: GO_SRCPATH GO_VERSION_DEFAULT
8879: GROUP_SPECIFIC_PKGS GRUB_NETWORK_CARDS
8880: GRUB_PRESET_COMMAND GRUB_SCAN_ARGS
8881: GZIP HASKELL_COMPILER
8882: HASKELL_ENABLE_HADDOCK_DOCUMENTATION HASKELL_ENABLE_LIBRARY_PROFILING
8883: HASKELL_ENABLE_SHARED_LIBRARY HASKELL_OPTIMIZATION_LEVEL
8884: HAS_CONFIGURE HEADER_TEMPLATES
1.175 gutterid 8885: HOST_PKGTOOLS_ARGS HOST_SPECIFIC_PKGS
8886: HOWL_GROUP HOWL_USER
8887: ICCBASE ICECAST_CHROOTDIR
8888: ICON_THEMES IDOBASE
8889: IGNORE_CCACHE IGNORE_INFO_DIRS
8890: IGNORE_INTERACTIVE_FETCH IMAKE
8891: IMAKEOPTS IMAKE_MAKE
8892: IMAKE_MANINSTALL IMAP_UW_CCLIENT_MBOX_FMT
8893: IMDICTDIR INCOMPAT_CURSES
8894: INFO_DIR INFO_FILES
8895: INFO_FILES_VERBOSE INFO_MSG
8896: INIT_SYSTEM INN_DATA_DIR
8897: INN_GROUP INN_USER
8898: INSTALLATION_DIRS INSTALLATION_DIRS_FROM_PLIST
8899: INSTALL_ENV INSTALL_SH_OVERRIDE
8900: INSTALL_SRC INSTALL_TEMPLATES
8901: INSTALL_UNSTRIPPED IRCD_HYBRID_IRC_GROUP
8902: IRCD_HYBRID_IRC_USER IRCD_HYBRID_MAXCONN
8903: IRCD_HYBRID_NICLEN IRCD_HYBRID_SYSLOG_EVENTS
8904: IRCD_HYBRID_SYSLOG_FACILITY IRCD_HYBRID_TOPICLEN
8905: IRIX IRRD_USE_PGP
8906: JABBERD_GROUP JABBERD_LOGDIR
8907: JABBERD_PIDDIR JABBERD_SPOOLDIR
8908: JABBERD_USER JAKARTA_HOME
8909: JAVA_BINPREFIX JAVA_CLASSPATH
8910: JAVA_HOME JAVA_LD_LIBRARY_PATH
8911: JAVA_NAME JAVA_UNLIMIT
8912: JAVA_WRAPPERS JPEG_ACCEPTED
8913: JPEG_DEFAULT KERBEROS
8914: KERMIT_SUID_UUCP KJS_USE_PCRE
8915: KNEWS_DOMAIN_FILE KNEWS_DOMAIN_NAME
8916: KRB5_ACCEPTED KRB5_DEFAULT
8917: LANGUAGES LATEX2HTML_ICONPATH
1.172 rillig 8918: LDCONFIG_ADD_CMD LDCONFIG_REMOVE_CMD
8919: LEAFNODE_DATA_DIR LEAFNODE_GROUP
8920: LEAFNODE_USER LIBDVDCSS_HOMEPAGE
8921: LIBDVDCSS_MASTER_SITES LIBRSVG_TYPE
8922: LIBTOOL LIBTOOLIZE_PLIST
8923: LIBTOOL_M4_OVERRIDE LIBUSB_TYPE
8924: LICENSE LINKER_RPATH_FLAG
1.175 gutterid 8925: LINK_RPATH_FLAG LINUX_LOCALES
8926: LOCALBASE LOCALBASE_LOCKTYPE
8927: LOCALPATCHES LOVE_DATA
8928: LOVE_GAME LOVE_VERSION
8929: LP64PLATFORMS MACHINE_PLATFORM
8930: MAILAGENT_DOMAIN MAILAGENT_EMAIL
8931: MAILAGENT_FQDN MAILAGENT_ORGANIZATION
8932: MAJORDOMO_HOMEDIR MAKEINFO_ARGS
1.172 rillig 8933: MAKE_DIRS MAKE_DIRS_PERMS
8934: MAKE_ENV MAKE_FILE
8935: MAKE_FLAGS MAKE_JOBS
8936: MAKE_JOBS_SAFE MAKE_PROGRAM
8937: MANINSTALL MANZ
8938: MASTER_SITES MASTER_SITE_BACKUP
8939: MASTER_SITE_CYGWIN MASTER_SITE_GNOME
8940: MASTER_SITE_GNU MASTER_SITE_LOCAL
8941: MASTER_SITE_MOZILLA MASTER_SITE_OPENOFFICE
8942: MASTER_SITE_OVERRIDE MASTER_SITE_PERL_CPAN
8943: MASTER_SITE_SUNSITE MASTER_SITE_SUSE
8944: MASTER_SITE_TEX_CTAN MASTER_SITE_XCONTRIB
8945: MASTER_SITE_XEMACS MASTER_SORT
8946: MASTER_SORT_RANDOM MASTER_SORT_REGEX
8947: MECAB_CHARSET MEDIATOMB_GROUP
8948: MEDIATOMB_USER MIPSPROBASE
8949: MIREDO_GROUP MIREDO_USER
8950: MISSING_FEATURES MKDIR
8951: MLDONKEY_GROUP MLDONKEY_HOME
8952: MLDONKEY_USER MONOTONE_GROUP
8953: MONOTONE_USER MOTIFBASE
8954: MOTIF_TYPE MOTIF_TYPE_DEFAULT
8955: MPI_TYPE MSGFMT_STRIP_MSGCTXT
8956: MSGFMT_STRIP_MSGID_PLURAL MTOOLS_ENABLE_FLOPPYD
8957: MUST MV
8958: MYSQL_CHARSET MYSQL_DATADIR
8959: MYSQL_EXTRA_CHARSET MYSQL_GROUP
8960: MYSQL_PKGSRCDIR MYSQL_USER
8961: MYSQL_VERSIONS_ACCEPTED MYSQL_VERSION_DEFAULT
8962: NAGIOSCMD_GROUP NAGIOSDIR
8963: NAGIOS_GROUP NAGIOS_USER
8964: NATIVE_APPEND_ABI NATIVE_APPEND_ELF
8965: NATIVE_EXEC_FMT NATIVE_MACHINE_PLATFORM
8966: NATIVE_OBJECT_FMT NBPAX_PROGRAM_PREFIX
8967: NETBSD_LOGIN_NAME NMH_EDITOR
8968: NMH_MTA NMH_PAGER
8969: NOLOGIN NONZERO_FILESIZE_P
8970: NOTE NOT_FOR_PLATFORM
8971: NOT_PAX_ASLR_SAFE NOT_PAX_MPROTECT_SAFE
8972: NO_BUILD NO_CHECKSUM
8973: NO_CONFIGURE NO_SKIP
8974: NS_PREFERRED NULLMAILER_GROUP
8975: NULLMAILER_USER OASIS
8976: OASIS_BUILD_ARGS OBJHOSTNAME
8977: OBJMACHINE OCAML_FINDLIB_DIRS
8978: OCAML_FINDLIB_REGISTER OCAML_FINDLIB_REGISTER_VERBOSE
8979: OCAML_SITELIBDIR OCAML_TOPKG_DOCDIR
8980: OCAML_USE_DUNE OCAML_USE_FINDLIB
8981: OCAML_USE_JBUILDER OCAML_USE_OASIS
8982: OCAML_USE_OASIS_DYNRUN OCAML_USE_OPAM
8983: OCAML_USE_OPT_COMPILER OCAML_USE_TOPKG
8984: OMF ONLY_FOR_COMPILER
8985: ONLY_FOR_PLATFORM OPENSSH_CHROOT
8986: OPENSSH_GROUP OPENSSH_USER
8987: OPSYS OPSYS_EMULDIR
8988: OSS_TYPE OSX
1.175 gutterid 8989: OSX_TOLERATE_SDK_SKEW OS_VARIANT
1.172 rillig 8990: OS_VERSION OTF_FONTS_DIR
8991: OVERRIDE_DIRDEPTH OVERRIDE_GEMSPEC
1.175 gutterid 8992: OVERRIDE_GNU_CONFIG_SCRIPTS OWN_DIRS
8993: OWN_DIRS_PERMS P4GROUP
8994: P4PORT P4ROOT
8995: P4USER PACKAGES
8996: PALMOS_DEFAULT_SDK PAMBASE
8997: PAM_DEFAULT PAPERSIZE
8998: PASSIVE_FETCH PATCHDIR
8999: PATCHFILES PATCH_ARGS
9000: PATCH_DEBUG PATCH_DIST_ARGS
9001: PATCH_DIST_CAT PATCH_DIST_STRIP
9002: PATCH_FUZZ_FACTOR PATCH_STRIP
9003: PATH PCCBASE
9004: PEAR_CMD PEAR_LIB
9005: PEAR_PACKAGE_XML PERL5
9006: PERL5_CONFIGURE PERL5_CONFIGURE_DIRS
9007: PERL5_LDFLAGS PERL5_LICENSE
9008: PERL5_MODULE_TYPE PERL5_PACKLIST
9009: PERL5_PACKLIST_DIR PERL5_PERLBASE
9010: PERL5_SITEBASE PERL5_USE_PACKLIST
9011: PERL5_VENDORBASE PFCTL
9012: PFVAR_H PF_VERSION
9013: PGGROUP PGHOME
9014: PGPKGSRCDIR PGSQL_TYPE
9015: PGSQL_VERSIONS_ACCEPTED PGSQL_VERSION_DEFAULT
9016: PGUSER PG_LIB_EXT
9017: PHP PHPCOMMON_MK
9018: PHPPKGSRCDIR PHP_BASE_VERS
9019: PHP_CHECK_INSTALLED PHP_EXTENSION_DIR
9020: PHP_INITIAL_TEENY PHP_PKG_PREFIX
9021: PHP_VERSION PHP_VERSIONS_ACCEPTED
9022: PHP_VERSIONS_INCOMPATIBLE PHP_VERSION_DEFAULT
9023: PHP_VERSION_REQD PILRC_USE_GTK
9024: PKGCONFIG_BASE PKGCONFIG_FILE
9025: PKGCONFIG_OVERRIDE PKGCONFIG_OVERRIDE_STAGE
9026: PKGDIR PKGGNUDIR
9027: PKGINFODIR PKGLOCALEDIR
9028: PKGMANDIR PKGNAME
9029: PKGNAME_REQD PKGPATH
9030: PKGREVISION PKGSRC_CHANGES
1.172 rillig 9031: PKGSRC_COMPILER PKGSRC_KEEP_BIN_PKGS
9032: PKGSRC_LOCKTYPE PKGSRC_MAKE_ENV
9033: PKGSRC_MESSAGE_RECIPIENTS PKGSRC_MKPIE
9034: PKGSRC_MKREPRO PKGSRC_RUN_TEST
9035: PKGSRC_SETENV PKGSRC_SLEEPSECS
9036: PKGSRC_TODO PKGSRC_USE_CTF
9037: PKGSRC_USE_FORTIFY PKGSRC_USE_RELRO
9038: PKGSRC_USE_SSP PKGSRC_USE_STACK_CHECK
9039: PKGTASKS_DATAFILE PKGTOOLS_ARGS
9040: PKGTOOLS_ENV PKG_ALTERNATIVES
9041: PKG_APACHE PKG_APACHE_ACCEPTED
9042: PKG_APACHE_DEFAULT PKG_BEST_EXISTS
9043: PKG_BUILD_OPTIONS PKG_COMPRESSION
9044: PKG_CONFIG PKG_CONFIG_PERMS
9045: PKG_CREATE_USERGROUP PKG_DB_TMPDIR
9046: PKG_DEBUG_LEVEL PKG_DEFAULT_OPTIONS
9047: PKG_DESTDIR_SUPPORT PKG_DEVELOPER
9048: PKG_DISABLED_OPTIONS PKG_FATAL_ERRORS
9049: PKG_FC PKG_FILELIST_CMD
9050: PKG_GECOS PKG_GID
9051: PKG_GROUPS PKG_GROUPS_VARS
9052: PKG_HOME PKG_INIT_SCRIPTS
9053: PKG_JAVA_HOME PKG_JVM
9054: PKG_JVMS_ACCEPTED PKG_JVM_DEFAULT
9055: PKG_LEGACY_OPTIONS PKG_LIBTOOL
9056: PKG_OPTIONS PKG_OPTIONS_DEPRECATED_WARNINGS
9057: PKG_OPTIONS_LEGACY_OPTS PKG_OPTIONS_LEGACY_VARS
9058: PKG_OPTIONS_NONEMPTY_SETS PKG_OPTIONS_OPTIONAL_GROUPS
9059: PKG_OPTIONS_REQUIRED_GROUPS PKG_OPTIONS_VAR
9060: PKG_PHP PKG_PHP_MAJOR_VERS
9061: PKG_PHP_VERSION PKG_RCD_SCRIPTS
9062: PKG_REFCOUNT_DBDIR PKG_REGISTER_SHELLS
9063: PKG_RESUME_TRANSFERS PKG_SHELL
9064: PKG_SUGGESTED_OPTIONS PKG_SUPPORTED_OPTIONS
9065: PKG_SYSCONFBASE PKG_SYSCONFBASEDIR
9066: PKG_SYSCONFDIR PKG_SYSCONFDIR_PERMS
9067: PKG_SYSCONFSUBDIR PKG_SYSCONFVAR
9068: PKG_TOOLS_BIN PKG_UID
9069: PKG_UPDATE_FONTS_DB PKG_USERS
9070: PKG_USERS_VARS PKG_VERBOSE
9071: PLIST PLIST_AWK
9072: PLIST_AWK_ENV PLIST_SRC
9073: PLIST_SUBST PLIST_TYPE
9074: PLIST_VARS POPTOP_USE_MPPE
1.174 leot 9075: POSSIBLE_GFORTRAN_VERSION POST_FETCH_HOOK
9076: PREFER PREFER_NATIVE
9077: PREFER_NATIVE_PTHREADS PREFER_PKGSRC
9078: PREFIX PREPEND_PATH
9079: PRE_ROOT_CMD PRIVILEGED_STAGES
9080: PS PTHREAD_AUTO_VARS
9081: PTHREAD_CFLAGS PTHREAD_LDFLAGS
9082: PTHREAD_LIBS PTHREAD_OPTS
9083: PTHREAD_TYPE PVM_SSH
9084: PYPKGPREFIX PYTHON_FOR_BUILD_ONLY
9085: PYTHON_SELF_CONFLICT PYTHON_VERSIONED_DEPENDENCIES
9086: PYTHON_VERSIONS_ACCEPTED PYTHON_VERSIONS_INCOMPATIBLE
9087: PYTHON_VERSION_DEFAULT PYTHON_VERSION_REQD
9088: PYVERSSUFFIX PY_NO_EGG
9089: QMAILDIR QMAIL_ALIAS_USER
9090: QMAIL_DAEMON_USER QMAIL_LOG_USER
9091: QMAIL_NOFILES_GROUP QMAIL_PASSWD_USER
9092: QMAIL_QMAIL_GROUP QMAIL_QUEUE_DIR
9093: QMAIL_QUEUE_EXTRA QMAIL_QUEUE_USER
9094: QMAIL_REMOTE_USER QMAIL_ROOT_USER
9095: QMAIL_SEND_USER QPOPPER_FAC
9096: QPOPPER_SPOOL_DIR QPOPPER_USER
9097: RAKE_NAME RASMOL_DEPTH
9098: RCD_SCRIPTS RCD_SCRIPTS_DIR
9099: RCD_SCRIPTS_EXAMPLEDIR RCD_SCRIPTS_MODE
9100: RCD_SCRIPTS_SHELL RCD_SCRIPT_SRC
1.175 gutterid 9101: RDOC READLINE_DEFAULT
9102: READLINE_TYPE REAL_ROOT_GROUP
9103: REAL_ROOT_USER RECURSIVE_MAKE
9104: RELAY_CTRL_DIR REPLACE_AWK
9105: REPLACE_BASH REPLACE_CSH
9106: REPLACE_KSH REPLACE_PERL
9107: REPLACE_PERL6 REPLACE_PHP
9108: REPLACE_PYTHON REPLACE_RUBY
9109: REPLACE_RUBY_DIRS REPLACE_RUBY_PAT
9110: REPLACE_SH REPLACE_TEXLUA
9111: REQD_DIRS REQD_DIRS_PERMS
9112: REQD_FILES REQD_FILES_MODE
9113: REQD_FILES_PERMS RESOLV_AUTO_VARS
9114: RESOLV_LDFLAGS RESOLV_LIBS
9115: RM ROOT_CMD
9116: ROOT_GROUP ROOT_USER
9117: RPCGEN RPM
9118: RPM2PKG_PLIST RPM2PKG_PREFIX
9119: RPM2PKG_STAGE RPM2PKG_STRIP
9120: RPM2PKG_SUBPREFIX RPMFILES
9121: RPMIGNOREPATH RPM_DB_PREFIX
9122: RSSH_CVS_PATH RSSH_RDIST_PATH
9123: RSSH_RSYNC_PATH RSSH_SCP_PATH
9124: RSSH_SFTP_SERVER_PATH RUBY
9125: RUBYGEM RUBYGEM_NAME
9126: RUBYGEM_OPTIONS RUBY_ABI_VERSION
9127: RUBY_ARCH RUBY_ARCHINC
9128: RUBY_ARCHLIB RUBY_BASE
9129: RUBY_BASERIDIR RUBY_BUILD_DOCUMENT
9130: RUBY_DLEXT RUBY_DOC
9131: RUBY_DYNAMIC_DIRS RUBY_EG
9132: RUBY_ENCODING_ARG RUBY_EXTCONF
9133: RUBY_EXTCONF_CHECK RUBY_EXTCONF_DEBUG
9134: RUBY_EXTCONF_MAKEFILE RUBY_GEM_BASE
9135: RUBY_INC RUBY_LIB
9136: RUBY_LIB_BASE RUBY_NAME
9137: RUBY_NOVERSION RUBY_PKGPREFIX
9138: RUBY_RAILS RUBY_RAILS51_VERSION
9139: RUBY_RAILS52_VERSION RUBY_RAILS60_VERSION
9140: RUBY_RAILS_ACCEPTED RUBY_RAILS_DEFAULT
9141: RUBY_RAILS_REQD RUBY_RAILS_STRICT_DEP
9142: RUBY_RIDIR RUBY_SETUP
9143: RUBY_SHLIB RUBY_SHLIBALIAS
9144: RUBY_SHLIBVER RUBY_SIMPLE_INSTALL
9145: RUBY_SITEARCHLIB RUBY_SITELIB
9146: RUBY_SITELIB_BASE RUBY_SITERIDIR
9147: RUBY_SLEXT RUBY_SRCDIR
9148: RUBY_STATICLIB RUBY_SUFFIX
9149: RUBY_SYSRIDIR RUBY_USE_PTHREAD
9150: RUBY_VENDORARCHLIB RUBY_VENDORLIB
9151: RUBY_VENDORLIB_BASE RUBY_VER
9152: RUBY_VERSION RUBY_VERSIONS_ACCEPTED
9153: RUBY_VERSIONS_INCOMPATIBLE RUBY_VERSION_DEFAULT
9154: RUBY_VERSION_REQD RUBY_VER_DIR
9155: RUN RUN_LDCONFIG
9156: SAWFISH_THEMES SCO
9157: SCREWS_GROUP SCREWS_USER
9158: SCRIPTS_ENV SCROLLKEEPER_DATADIR
9159: SCROLLKEEPER_REBUILDDB SCROLLKEEPER_UPDATEDB
9160: SDIST_PAWD SERIAL_DEVICES
9161: SETGIDGAME SETGID_GAMES_PERMS
9162: SETUID_ROOT_PERMS SH
9163: SHLIB SIGN_PACKAGES
1.172 rillig 9164: SILC_CLIENT_WITH_PERL SITE_SPECIFIC_PKGS
9165: SKIP_DEPENDS SMF_INSTANCES
9166: SMF_MANIFEST SMF_METHODS
9167: SMF_METHOD_SHELL SMF_METHOD_SRC
9168: SMF_NAME SMF_PREFIX
9169: SMF_SRCDIR SNIPROXY_GROUP
9170: SNIPROXY_USER SOURCE_BUFFSIZE
9171: SPECIAL_PERMS SPECIFIC_PKGS
9172: SSH_SUID SSP_SUPPORTED
9173: SSYNC_PAWD STEP_MSG
9174: STRIP STRIP_DBG
9175: STRIP_DEBUG STRIP_DEBUG_SUPPORTED
9176: STRIP_FILES_SKIP SU
1.174 leot 9177: SUBDIR SUBST
9178: SUBST_CLASSES SUBST_FILES
9179: SUBST_FILTER_CMD SUBST_MESSAGE
9180: SUBST_NOOP_OK SUBST_SED
1.172 rillig 9181: SUBST_SHOW_DIFF SUBST_SKIP_TEXT_CHECK
9182: SUBST_STAGE SUBST_VARS
9183: SUNWSPROBASE SUSE_PREFER
1.175 gutterid 9184: SU_CMD TERMCAP_TYPE
1.172 rillig 9185: TERMINFO_DEFAULT TERMINFO_TYPE
9186: TEST TEST_DEPENDS
9187: TEST_DIRS TEST_ENV
1.174 leot 9188: TEST_ENV_SHELL TEST_MAKE_CMD
9189: TEST_MAKE_FLAGS TEST_TARGET
9190: TEXLIVE_IGNORE_PATTERNS TEXLIVE_REV
9191: TEXLIVE_UNVERSIONED TEXMFSITE
9192: TEX_FORMATS TEX_HYPHEN_DAT
9193: TEX_HYPHEN_DEF TEX_TEXMF_DIRS
9194: THTTPD_LOG_FACILITY TO
9195: TOOLS_ALIASES TOOLS_ARGS
9196: TOOLS_BROKEN TOOLS_CMD
9197: TOOLS_CREATE TOOLS_DIR
9198: TOOLS_FAIL TOOLS_GNU_MISSING
9199: TOOLS_LDCONFIG TOOLS_NOOP
9200: TOOLS_PATH TOOLS_SCRIPT
1.175 gutterid 9201: TOOL_DEPENDS TTF_FONTS_DIR
9202: TYPE UAC_REQD_EXECS
9203: UCSPI_SSL_GROUP UCSPI_SSL_USER
9204: UNLIMIT_RESOURCES UNPRIVILEGED
9205: UNPRIVILEGED_GROUP UNPRIVILEGED_GROUPS
9206: UNPRIVILEGED_USER UNWRAP_FILES
9207: UNWRAP_PATTERNS UPDATE_GEMSPEC
9208: UPDATE_TARGET URI
9209: USA USERGROUP_PHASE
9210: USERPPP_GROUP USER_SPECIFIC_PKGS
9211: USE_ABI_DEPENDS USE_APR
9212: USE_BSD_MAKEFILE USE_BUILTIN
9213: USE_CROSS_COMPILE USE_CURSES
9214: USE_CWRAPPERS USE_DB185
9215: USE_FEATURES USE_GAMESGROUP
9216: USE_GCC_RUNTIME USE_IMAKE
9217: USE_JAVA USE_JAVA2
9218: USE_LANGUAGES USE_LIBTOOL
9219: USE_NATIVE_GCC USE_NETBSD_REPO
9220: USE_PKGSRC_GCC USE_PKGSRC_GCC_RUNTIME
9221: USE_PKGTASKS USE_PKG_ADMIN_DIGEST
9222: USE_RUBY_EXTCONF USE_RUBY_INSTALL
9223: USE_RUBY_SETUP USE_RUBY_SETUP_PKG
9224: USE_TOOLS UUCP_GROUP
9225: UUCP_USER VARBASE
9226: VARNAME VIM_EXTRA_OPTS
9227: WARNING_MSG WCALC_CGIDIR
9228: WCALC_CGIPATH WCALC_HTMLDIR
9229: WCALC_HTMLPATH WDM_MANAGERS
9230: WRAPPER_REORDER_CMDS WRKDIR
9231: WRKDIR_BASENAME WRKDIR_LOCKTYPE
9232: WRKLOG WRKOBJDIR
9233: WRKSRC X10_PORT
9234: X11 X11BASE
9235: X11_PKGSRCDIR X11_TYPE
9236: X509_CERTIFICATE X509_KEY
9237: XAW_TYPE XLOCK_DEFAULT_MODE
9238: XMKMF_FLAGS XXX
1.174 leot 9239: YES ZERO_FILESIZE_P
9240: ZSH_STATIC __stdc__
9241: _vargroups accept
9242: acquire-localbase-lock acquire-lock
9243: add administrator
9244: alloca alternatives
9245: aslr asprintf
1.175 gutterid 9246: autoconf automake
9247: autoreconf awk
9248: bash big-endian
9249: bin-install bind
9250: binpkg-list bootstrap-depends
1.172 rillig 9251: broken broken_on_platform
1.174 leot 9252: bsd bsd.prog.mk
1.172 rillig 9253: build build-env
9254: buildlink-directories buildlink-oss-soundcard-h
9255: c c++
9256: ccache cce
1.174 leot 9257: cdefs ceil
9258: changes changes-entry
9259: changes-entry-noupdate check
9260: check-clean check-files
9261: check-files-clean check-vulnerable
9262: checksum checksum-phase
9263: clean clean-depends
9264: cleandir commit
9265: commit-changes-entry compact
9266: compiler conf
9267: config.guess config.sub
9268: configuration configure
9269: configure-env configure-help
9270: configure_args connect
9271: cos cputime
9272: create-usergroup csh
1.175 gutterid 9273: ctf debug
9274: declaration declare
9275: defined depend
9276: dependencies depends
9277: depends-checksum depends-fetch
9278: deps describe
9279: destdir disable
9280: distclean distinfo
9281: dl dlopen
9282: do-build do-buildlink
9283: do-clean do-configure
9284: do-configure-post-hook do-extract
9285: do-fetch emul
1.174 leot 9286: emul-distinfo emul-fetch
9287: emulation emulator
9288: enable endian
1.175 gutterid 9289: enomem err
9290: errx etc
9291: exp extract-rpm
9292: fabs feature
9293: features fetch
9294: fetch-list follows
9295: forbids form
9296: format fortify
9297: fortify_source friend
1.172 rillig 9298: fts fts_close
9299: fts_open fts_read
1.174 leot 9300: fts_set gcc
9301: gethostbyaddr gethostbyname
9302: gethostbyname2 getopt_long
9303: getprogname getservbyname
9304: getservbyport getservent
1.175 gutterid 9305: gettext github
9306: glob gnu
9307: gnu_configure_strict go
9308: go-deps golang
9309: guess-license hashbang
9310: heimdal help
1.174 leot 9311: imake increment
9312: inet_aton interp
1.172 rillig 9313: interpreter intl
9314: iso kerberos
9315: krb krb5
1.175 gutterid 9316: ksh latex
9317: libintl_bindtextdomain libintl_gettext
9318: libintl_textdomain libnbcompat
9319: libs libtool
9320: licence license
9321: lintl little-endian
9322: lock locking
9323: lvalue make
9324: makesum memory
1.174 leot 9325: meta meta-package
9326: meta_package mit-krb5
1.175 gutterid 9327: mk.conf mount
9328: mprotect mremap
9329: nb nbcompat
9330: obstack obstack_ptr_grow
9331: occurs only
1.172 rillig 9332: options options.mk
9333: order override
9334: override-intltool override-message-intltool
9335: package parallel
1.174 leot 9336: path pax
9337: paxctl pbulk-index
9338: pc perl
9339: perl5 perms
9340: php pkg-build-options
9341: pkg-config pkg_build_options
9342: platform plist
9343: post-extract post-fetch
9344: post-wrapper pre-build-checks-hook
9345: pre-configure pre-configure-checks-hook
9346: pre-extract pre-fetch
9347: print-go-deps print-plist
9348: print-summary-data privileged-install-hook
9349: pypi python
9350: readme-all recv
9351: recvfrom regcomp
9352: release-localbase-lock release-lock
9353: relro rename
9354: reorder replace
9355: replace_interpreter reproducible
9356: resolv root
9357: ruby send
9358: sendfile sendto
1.172 rillig 9359: setenv setgid
9360: setprogname setuid
9361: sh show
9362: show-all show-build-defs
9363: show-depends show-deps
9364: show-distfiles show-downlevel
9365: show-subdir-var show-tools
9366: show-var show-vars
1.174 leot 9367: snprintf socket
9368: ssp st_mode
9369: stage-install strcasestr
1.172 rillig 9370: strict strip
1.174 leot 9371: strndup strnlen
9372: strsep subst
1.175 gutterid 9373: substitutions sun
9374: sunpro sunwspro
1.172 rillig 9375: symlink test
1.174 leot 9376: test-env tex
9377: texlive tmp
9378: tool tools
9379: tools-libtool-m4-override type
9380: ulimit undefined
9381: undo-replace unlimit
9382: unprivileged unprivileged-install-hook
9383: unstripped update
9384: upload upload-distfiles
1.172 rillig 9385: use_tools user
9386: utimes vasprintf
9387: verbose vsnprintf
9388: warn warning
9389: warnings warnx
1.174 leot 9390: wattr_off wattr_on
9391: work wrapper
9392: wrkdir
1.154 rillig 9393:
9394: Appendix E. Editing guidelines for the pkgsrc guide
1.1 dsieger 9395:
9396: Table of Contents
9397:
1.154 rillig 9398: E.1. Make targets
9399: E.2. Procedure
1.1 dsieger 9400:
9401: This section contains information on editing the pkgsrc guide itself.
9402:
1.154 rillig 9403: E.1. Make targets
1.1 dsieger 9404:
9405: The pkgsrc guide's source code is stored in pkgsrc/doc/guide/files, and several
9406: files are created from it:
9407:
9408: * pkgsrc/doc/pkgsrc.txt
9409:
9410: * pkgsrc/doc/pkgsrc.html
9411:
1.174 leot 9412: * https://www.NetBSD.org/docs/pkgsrc/
1.1 dsieger 9413:
1.174 leot 9414: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.pdf: The PDF version of the
9415: pkgsrc guide.
1.1 dsieger 9416:
1.174 leot 9417: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.ps: PostScript version of the
1.2 rillig 9418: pkgsrc guide.
1.1 dsieger 9419:
1.154 rillig 9420: E.2. Procedure
1.1 dsieger 9421:
9422: The procedure to edit the pkgsrc guide is:
9423:
9424: 1. Make sure you have the packages needed to regenerate the pkgsrc guide (and
1.46 obache 9425: other XML-based NetBSD documentation) installed. These are automatically
9426: installed when you install the meta-pkgs/pkgsrc-guide-tools package.
1.1 dsieger 9427:
9428: 2. Run cd doc/guide to get to the right directory. All further steps will take
9429: place here.
9430:
9431: 3. Edit the XML file(s) in files/.
9432:
9433: 4. Run bmake to check the pkgsrc guide for valid XML and to build the final
9434: output files. If you get any errors at this stage, you can just edit the
9435: files, as there are only symbolic links in the working directory, pointing
9436: to the files in files/.
9437:
9438: 5. (cd files && cvs commit)
9439:
9440: 6. Run bmake clean && bmake to regenerate the output files with the proper RCS
9441: Ids.
9442:
9443: 7. Run bmake regen to install and commit the files in both pkgsrc/doc and
9444: htdocs.
9445:
9446: Note
9447:
9448: If you have added, removed or renamed some chapters, you need to
9449: synchronize them using cvs add or cvs delete in the htdocs directory.
9450:
CVSweb <webmaster@jp.NetBSD.org>