Annotation of htdocs/docs/pkgsrc/pkgsrc.txt, revision 1.210
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.196 jnemeth 15: Copyright 1994-2021 The NetBSD Foundation, Inc
1.1 dsieger 16:
1.207 leot 17: $NetBSD: pkgsrc.xml,v 1.40 2021/10/01 17:20:27 nia Exp $
1.1 dsieger 18:
19: Abstract
20:
21: pkgsrc is a centralized package management system for Unix-like operating
22: systems. This guide provides information for users and developers of pkgsrc. It
23: covers installation of binary and source packages, creation of binary and
24: source packages and a high-level overview about the infrastructure.
25:
26: -------------------------------------------------------------------------------
27:
28: Table of Contents
29:
30: 1. What is pkgsrc?
31:
32: 1.1. Introduction
33:
34: 1.1.1. Why pkgsrc?
35: 1.1.2. Supported platforms
36:
37: 1.2. Overview
38: 1.3. Terminology
39:
40: 1.3.1. Roles involved in pkgsrc
41:
42: 1.4. Typography
43:
44: I. The pkgsrc user's guide
45:
1.154 rillig 46: 2. Getting help
47: 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 48:
1.154 rillig 49: 3.1. Getting pkgsrc for the first time
1.1 dsieger 50:
1.154 rillig 51: 3.1.1. As tar archive
52: 3.1.2. Via anonymous CVS
1.1 dsieger 53:
1.154 rillig 54: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 55:
1.154 rillig 56: 3.2.1. Via tar files
57: 3.2.2. Via CVS
1.1 dsieger 58:
1.154 rillig 59: 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 60:
1.154 rillig 61: 4.1. Binary distribution
62: 4.2. Bootstrapping pkgsrc
1.1 dsieger 63:
1.154 rillig 64: 5. Using pkgsrc
1.1 dsieger 65:
1.154 rillig 66: 5.1. Using binary packages
1.1 dsieger 67:
1.154 rillig 68: 5.1.1. Finding binary packages
69: 5.1.2. Installing binary packages
1.202 nia 70: 5.1.3. Updating packages
71: 5.1.4. Deinstalling packages
72: 5.1.5. Getting information about installed packages
73: 5.1.6. Checking for security vulnerabilities in installed packages
74: 5.1.7. Finding if newer versions of your installed packages are in
1.1 dsieger 75: pkgsrc
1.202 nia 76: 5.1.8. Other administrative functions
1.1 dsieger 77:
1.154 rillig 78: 5.2. Building packages from source
1.1 dsieger 79:
1.154 rillig 80: 5.2.1. Requirements
81: 5.2.2. Fetching distfiles
82: 5.2.3. How to build and install
1.1 dsieger 83:
1.154 rillig 84: 6. Configuring pkgsrc
1.1 dsieger 85:
1.154 rillig 86: 6.1. General configuration
87: 6.2. Variables affecting the build process
88: 6.3. Variables affecting the installation process
89: 6.4. Selecting and configuring the compiler
1.1 dsieger 90:
1.154 rillig 91: 6.4.1. Selecting the compiler
92: 6.4.2. Additional flags to the compiler (CFLAGS)
93: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 94:
1.154 rillig 95: 6.5. Developer/advanced settings
96: 6.6. Selecting Build Options
1.1 dsieger 97:
1.154 rillig 98: 7. Creating binary packages
1.1 dsieger 99:
1.154 rillig 100: 7.1. Building a single binary package
101: 7.2. Settings for creation of binary packages
1.1 dsieger 102:
1.154 rillig 103: 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 104:
1.154 rillig 105: 8.1. Preparations
1.180 rillig 106: 8.2. Running a bulk build
1.6 rillig 107:
1.154 rillig 108: 8.2.1. Configuration
1.6 rillig 109:
1.154 rillig 110: 8.3. Requirements of a full bulk build
1.178 rillig 111: 8.4. Bulk build variants
1.6 rillig 112:
1.179 rillig 113: 8.4.1. Detect unknown configure options
114: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 115: 8.4.3. Force compiler options only in the build phase
116: 8.4.4. Use custom directories
117: 8.4.5. Turn warnings into errors
118: 8.4.6. Reject packages for which pkglint reports errors
119: 8.4.7. Reject packages that contain forbidden strings
120: 8.4.8. Reject packages whose self-test fails
121: 8.4.9. Reject packages that use undefined shell variables
122: 8.4.10. Turn off verbose logging
1.178 rillig 123:
124: 8.5. Creating a multiple CD-ROM packages collection
125:
126: 8.5.1. Example of cdpack
1.6 rillig 127:
1.154 rillig 128: 9. Directory layout of the installed files
1.6 rillig 129:
1.154 rillig 130: 9.1. File system layout in ${LOCALBASE}
131: 9.2. File system layout in ${VARBASE}
1.6 rillig 132:
1.154 rillig 133: 10. Frequently Asked Questions
1.6 rillig 134:
1.154 rillig 135: 10.1. Are there any mailing lists for pkg-related discussion?
136: 10.2. Utilities for package management (pkgtools)
137: 10.3. How to use pkgsrc as non-root
138: 10.4. How to resume transfers when fetching distfiles?
139: 10.5. How can I install/use modular X.org from pkgsrc?
140: 10.6. How to fetch files from behind a firewall
141: 10.7. How to fetch files from HTTPS sites
142: 10.8. How do I tell make fetch to do passive FTP?
143: 10.9. How to fetch all distfiles at once
144: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc"
1.24 wiz 145: mean?
1.154 rillig 146: 10.11. What does "Could not find bsd.own.mk" mean?
147: 10.12. Using 'sudo' with pkgsrc
148: 10.13. How do I change the location of configuration files?
149: 10.14. Automated security checks
150: 10.15. Why do some packages ignore my CFLAGS?
151: 10.16. A package does not build. What shall I do?
152: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/???
1.24 wiz 153: merge conflicts" mean?
1.1 dsieger 154:
155: II. The pkgsrc developer's guide
156:
1.154 rillig 157: 11. Getting help
1.184 rillig 158: 12. Package components - files, directories and contents
1.1 dsieger 159:
1.184 rillig 160: 12.1. Makefile
161: 12.2. distinfo
162: 12.3. patches/*
1.1 dsieger 163:
1.184 rillig 164: 12.3.1. Structure of a single patch file
165: 12.3.2. Creating patch files
166: 12.3.3. Sources where the patch files come from
167: 12.3.4. Patching guidelines
168: 12.3.5. Feedback to the author
1.1 dsieger 169:
1.184 rillig 170: 12.4. Other mandatory files
171: 12.5. Optional files
1.1 dsieger 172:
1.184 rillig 173: 12.5.1. Files affecting the binary package
174: 12.5.2. Files affecting the build process
175: 12.5.3. Files affecting nothing at all
1.1 dsieger 176:
1.184 rillig 177: 12.6. work*
178: 12.7. files/*
1.1 dsieger 179:
1.184 rillig 180: 13. The build process
1.1 dsieger 181:
1.184 rillig 182: 13.1. Introduction
183: 13.2. Program location
184: 13.3. Directories used during the build process
185: 13.4. Running a phase
186: 13.5. The fetch phase
1.1 dsieger 187:
1.184 rillig 188: 13.5.1. What to fetch and where to get it from
189: 13.5.2. How are the files fetched?
1.1 dsieger 190:
1.184 rillig 191: 13.6. The checksum phase
192: 13.7. The extract phase
193: 13.8. The patch phase
194: 13.9. The tools phase
195: 13.10. The wrapper phase
196: 13.11. The configure phase
197: 13.12. The build phase
198: 13.13. The test phase
199: 13.14. The install phase
200: 13.15. The package phase
201: 13.16. Cleaning up
202: 13.17. Other helpful targets
1.1 dsieger 203:
1.184 rillig 204: 14. Creating a new pkgsrc package from scratch
1.1 dsieger 205:
1.184 rillig 206: 14.1. Common types of packages
1.1 dsieger 207:
1.184 rillig 208: 14.1.1. Perl modules
209: 14.1.2. Python modules and programs
210: 14.1.3. R packages
211: 14.1.4. TeXlive packages
1.1 dsieger 212:
1.184 rillig 213: 14.2. Examples
1.1 dsieger 214:
1.184 rillig 215: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 216:
1.184 rillig 217: 15. Programming in Makefiles
1.1 dsieger 218:
1.184 rillig 219: 15.1. Caveats
220: 15.2. Makefile variables
1.1 dsieger 221:
1.184 rillig 222: 15.2.1. Naming conventions
1.1 dsieger 223:
1.184 rillig 224: 15.3. Code snippets
1.1 dsieger 225:
1.184 rillig 226: 15.3.1. Adding things to a list
227: 15.3.2. Echoing a string exactly as-is
228: 15.3.3. Passing CFLAGS to GNU configure scripts
229: 15.3.4. Handling possibly empty variables
1.1 dsieger 230:
1.184 rillig 231: 16. Options handling
1.1 dsieger 232:
1.184 rillig 233: 16.1. Global default options
234: 16.2. Converting packages to use bsd.options.mk
235: 16.3. Option Names
236: 16.4. Determining the options of dependencies
1.1 dsieger 237:
1.184 rillig 238: 17. Tools needed for building or running
1.1 dsieger 239:
1.184 rillig 240: 17.1. Tools for pkgsrc builds
241: 17.2. Tools needed by packages
242: 17.3. Tools provided by platforms
1.1 dsieger 243:
1.184 rillig 244: 18. Buildlink methodology
1.1 dsieger 245:
1.184 rillig 246: 18.1. Converting packages to use buildlink3
247: 18.2. Writing buildlink3.mk files
1.1 dsieger 248:
1.184 rillig 249: 18.2.1. Anatomy of a buildlink3.mk file
250: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and
251: BUILDLINK_ABI_DEPENDS.pkg in buildlink3.mk files
1.1 dsieger 252:
1.184 rillig 253: 18.3. Writing builtin.mk files
1.1 dsieger 254:
1.184 rillig 255: 18.3.1. Anatomy of a builtin.mk file
256: 18.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 257:
1.184 rillig 258: 19. PLIST issues
1.1 dsieger 259:
1.184 rillig 260: 19.1. RCS ID
261: 19.2. Semi-automatic PLIST generation
262: 19.3. Tweaking output of make print-PLIST
263: 19.4. Variable substitution in PLIST
264: 19.5. Man page compression
265: 19.6. Changing PLIST source with PLIST_SRC
266: 19.7. Platform-specific and differing PLISTs
267: 19.8. Build-specific PLISTs
268: 19.9. Sharing directories between packages
1.1 dsieger 269:
1.184 rillig 270: 20. The pkginstall framework
1.1 dsieger 271:
1.184 rillig 272: 20.1. Files and directories outside the installation prefix
1.1 dsieger 273:
1.184 rillig 274: 20.1.1. Directory manipulation
275: 20.1.2. File manipulation
1.1 dsieger 276:
1.184 rillig 277: 20.2. Configuration files
1.1 dsieger 278:
1.184 rillig 279: 20.2.1. How PKG_SYSCONFDIR is set
280: 20.2.2. Telling the software where configuration files are
281: 20.2.3. Patching installations
282: 20.2.4. Disabling handling of configuration files
1.1 dsieger 283:
1.184 rillig 284: 20.3. System startup scripts
1.1 dsieger 285:
1.184 rillig 286: 20.3.1. Disabling handling of system startup scripts
1.1 dsieger 287:
1.184 rillig 288: 20.4. System users and groups
289: 20.5. System shells
1.1 dsieger 290:
1.184 rillig 291: 20.5.1. Disabling shell registration
1.1 dsieger 292:
1.184 rillig 293: 20.6. Fonts
1.1 dsieger 294:
1.184 rillig 295: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 296:
1.154 rillig 297: 21. Making your package work
1.1 dsieger 298:
1.154 rillig 299: 21.1. General operation
1.1 dsieger 300:
1.154 rillig 301: 21.1.1. How to pull in user-settable variables from mk.conf
302: 21.1.2. User interaction
303: 21.1.3. Handling licenses
304: 21.1.4. Restricted packages
305: 21.1.5. Handling dependencies
306: 21.1.6. Handling conflicts with other packages
307: 21.1.7. Packages that cannot or should not be built
308: 21.1.8. Packages which should not be deleted, once installed
309: 21.1.9. Handling packages with security problems
310: 21.1.10. How to handle incrementing versions when fixing an
1.1 dsieger 311: existing package
1.154 rillig 312: 21.1.11. Substituting variable text in the package files (the SUBST
1.1 dsieger 313: framework)
314:
1.154 rillig 315: 21.2. The fetch phase
1.1 dsieger 316:
1.154 rillig 317: 21.2.1. Packages whose distfiles aren't available for plain
1.1 dsieger 318: downloading
1.154 rillig 319: 21.2.2. How to handle modified distfiles with the 'old' name
320: 21.2.3. Packages hosted on github.com
1.1 dsieger 321:
1.154 rillig 322: 21.3. The configure phase
1.1 dsieger 323:
1.154 rillig 324: 21.3.1. Shared libraries - libtool
325: 21.3.2. Using libtool on GNU packages that already support libtool
326: 21.3.3. GNU Autoconf/Automake
327:
328: 21.4. Programming languages
329:
330: 21.4.1. C, C++, and Fortran
331: 21.4.2. Java
1.205 wiz 332: 21.4.3. Go
333: 21.4.4. Packages containing Perl scripts
334: 21.4.5. Packages containing shell scripts
335: 21.4.6. Other programming languages
1.154 rillig 336:
337: 21.5. The build phase
338:
339: 21.5.1. Compiling C and C++ code conditionally
340: 21.5.2. How to handle compiler bugs
1.172 rillig 341: 21.5.3. No such file or directory
342: 21.5.4. Undefined reference to "..."
343: 21.5.5. Running out of memory
1.154 rillig 344:
345: 21.6. The install phase
346:
347: 21.6.1. Creating needed directories
348: 21.6.2. Where to install documentation
349: 21.6.3. Installing highscore files
350: 21.6.4. Adding DESTDIR support to packages
351: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 352: 21.6.6. Packages installing Perl modules
1.154 rillig 353: 21.6.7. Packages installing info files
354: 21.6.8. Packages installing man pages
1.203 nia 355: 21.6.9. Packages installing X11 fonts
356: 21.6.10. Packages installing SGML or XML data
357: 21.6.11. Packages installing extensions to the MIME database
358: 21.6.12. Packages using intltool
359: 21.6.13. Packages installing startup scripts
360: 21.6.14. Packages installing TeX modules
361: 21.6.15. Packages supporting running binaries in emulation
362: 21.6.16. Packages installing hicolor icons
363: 21.6.17. Packages installing desktop files
1.154 rillig 364:
365: 21.7. Marking packages as having problems
366:
1.184 rillig 367: 22. GNOME packaging and porting
368:
369: 22.1. Meta packages
370: 22.2. Packaging a GNOME application
371: 22.3. Updating GNOME to a newer version
372: 22.4. Patching guidelines
373:
1.154 rillig 374: 23. Submitting and Committing
375:
376: 23.1. Submitting binary packages
377: 23.2. Submitting source packages (for non-NetBSD-developers)
378: 23.3. General notes when adding, updating, or removing packages
379: 23.4. Commit Messages
380: 23.5. Committing: Adding a package to CVS
381: 23.6. Updating a package to a newer version
382: 23.7. Renaming a package in pkgsrc
383: 23.8. Moving a package in pkgsrc
384:
385: 24. Frequently Asked Questions
1.1 dsieger 386:
387: III. The pkgsrc infrastructure internals
388:
1.184 rillig 389: 25. Design of the pkgsrc infrastructure
1.1 dsieger 390:
1.184 rillig 391: 25.1. The meaning of variable definitions
392: 25.2. Avoiding problems before they arise
393: 25.3. Variable evaluation
1.1 dsieger 394:
1.184 rillig 395: 25.3.1. At load time
396: 25.3.2. At runtime
1.1 dsieger 397:
1.184 rillig 398: 25.4. How can variables be specified?
399: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 400:
1.184 rillig 401: 25.5.1. Procedures with parameters
402: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 403:
1.184 rillig 404: 25.6. The order in which files are loaded
1.1 dsieger 405:
1.184 rillig 406: 25.6.1. The order in bsd.prefs.mk
407: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 408:
1.184 rillig 409: 26. Regression tests
1.1 dsieger 410:
1.184 rillig 411: 26.1. Running the regression tests
412: 26.2. Adding a new regression test
1.1 dsieger 413:
1.184 rillig 414: 26.2.1. Overridable functions
415: 26.2.2. Helper functions
1.1 dsieger 416:
1.184 rillig 417: 27. Porting pkgsrc
1.1 dsieger 418:
1.184 rillig 419: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 420:
421: A. A simple example package: bison
422:
423: A.1. files
424:
425: A.1.1. Makefile
426: A.1.2. DESCR
427: A.1.3. PLIST
428: A.1.4. Checking a package with pkglint
429:
430: A.2. Steps for building, installing, packaging
431:
1.207 leot 432: B. Security hardening
1.1 dsieger 433:
1.207 leot 434: B.1. Mechanisms
1.1 dsieger 435:
1.207 leot 436: B.1.1. Enabled by default
437: B.1.2. Not enabled by default
1.1 dsieger 438:
1.207 leot 439: B.2. Caveats
1.1 dsieger 440:
1.207 leot 441: B.2.1. Problems with PKGSRC_MKPIE
442: B.2.2. Problems with PKGSRC_USE_FORTIFY
443: B.2.3. Problems with PKGSRC_USE_RELRO
444: B.2.4. Problems with PKGSRC_USE_SSP
1.1 dsieger 445:
1.207 leot 446: B.3. Auditing the system
447:
448: B.3.1. Checking for PIE
449: B.3.2. Checking for partial RELRO
450: B.3.3. Checking for full RELRO
451: B.3.4. Checking for SSP
452:
453: C. Build logs
454:
455: C.1. Building figlet
456: C.2. Packaging figlet
457:
458: D. Directory layout of the pkgsrc FTP server
459:
460: D.1. distfiles: The distributed source files
461: D.2. misc: Miscellaneous things
462: D.3. packages: Binary packages
463: D.4. reports: Bulk build reports
464: D.5. current, stable, pkgsrc-20xxQy: source packages
465:
466: E. Help topics
467: F. Editing guidelines for the pkgsrc guide
468:
469: F.1. Make targets
470: F.2. Procedure
1.1 dsieger 471:
472: List of Tables
473:
474: 1.1. Platforms supported by pkgsrc
1.184 rillig 475: 12.1. Patching examples
476: 22.1. PLIST handling for GNOME packages
1.1 dsieger 477:
478: Chapter 1. What is pkgsrc?
479:
480: Table of Contents
481:
482: 1.1. Introduction
483:
484: 1.1.1. Why pkgsrc?
485: 1.1.2. Supported platforms
486:
487: 1.2. Overview
488: 1.3. Terminology
489:
490: 1.3.1. Roles involved in pkgsrc
491:
492: 1.4. Typography
493:
494: 1.1. Introduction
495:
496: There is a lot of software freely available for Unix-based systems, which is
497: usually available in form of the source code. Before such software can be used,
498: it needs to be configured to the local system, compiled and installed, and this
499: is exactly what The NetBSD Packages Collection (pkgsrc) does. pkgsrc also has
500: some basic commands to handle binary packages, so that not every user has to
501: build the packages for himself, which is a time-costly task.
502:
503: pkgsrc currently contains several thousand packages, including:
504:
1.104 sevan 505: * www/apache24 - The Apache web server
1.1 dsieger 506:
507: * www/firefox - The Firefox web browser
508:
509: * meta-pkgs/gnome - The GNOME Desktop Environment
510:
1.102 ryoon 511: * meta-pkgs/kde4 - The K Desktop Environment
1.1 dsieger 512:
1.108 rillig 513: ? just to name a few.
1.1 dsieger 514:
515: pkgsrc has built-in support for handling varying dependencies, such as pthreads
516: and X11, and extended features such as IPv6 support on a range of platforms.
517:
518: 1.1.1. Why pkgsrc?
519:
520: pkgsrc provides the following key features:
521:
522: * Easy building of software from source as well as the creation and
523: installation of binary packages. The source and latest patches are
524: retrieved from a master or mirror download site, checksum verified, then
525: built on your system. Support for binary-only distributions is available
526: for both native platforms and NetBSD emulated platforms.
527:
528: * All packages are installed in a consistent directory tree, including
529: binaries, libraries, man pages and other documentation.
530:
1.104 sevan 531: * Tracking of package dependencies automatically, including when performing
532: updates, to ensure required packages are installed. The configuration files
533: of various packages are handled automatically during updates, so local
534: changes are preserved.
1.1 dsieger 535:
536: * Like NetBSD, pkgsrc is designed with portability in mind and consists of
537: highly portable code. This allows the greatest speed of development when
1.26 spz 538: porting to a new platform. This portability also ensures that pkgsrc is
1.1 dsieger 539: consistent across all platforms.
540:
541: * The installation prefix, acceptable software licenses, international
542: encryption requirements and build-time options for a large number of
543: packages are all set in a simple, central configuration file.
544:
545: * The entire source (not including the distribution files) is freely
546: available under a BSD license, so you may extend and adapt pkgsrc to your
547: needs. Support for local packages and patches is available right out of the
548: box, so you can configure it specifically for your environment.
549:
550: The following principles are basic to pkgsrc:
551:
1.198 leot 552: * "It should only work if it's right." -- That means, if a package contains
1.1 dsieger 553: bugs, it's better to find them and to complain about them rather than to
554: just install the package and hope that it works. There are numerous checks
1.175 gutterid 555: in pkgsrc that try to find such bugs: static analysis tools (pkgtools/
1.1 dsieger 556: pkglint), build-time checks (portability of shell scripts), and
557: post-installation checks (installed files, references to shared libraries,
558: script interpreters).
559:
1.198 leot 560: * "If it works, it should work everywhere" -- Like NetBSD has been ported to
1.1 dsieger 561: many hardware architectures, pkgsrc has been ported to many operating
562: systems. Care is taken that packages behave the same on all platforms.
563:
564: 1.1.2. Supported platforms
565:
566: pkgsrc consists of both a source distribution and a binary distribution for
567: these operating systems. After retrieving the required source or binaries, you
568: can be up and running with pkgsrc in just minutes!
569:
570: pkgsrc was derived from FreeBSD's ports system, and initially developed for
571: NetBSD only. Since then, pkgsrc has grown a lot, and now supports the following
572: platforms:
573:
574: Table 1.1. Platforms supported by pkgsrc
575:
1.92 sevan 576: +-----------------------------------------------------------------------------+
577: | Platform | Date Support | Notes |
578: | | Added | |
579: |--------------------------------------+---------------+----------------------|
580: |NetBSD | Aug 1997 | |
581: |--------------------------------------+---------------+----------------------|
582: |Solaris | Mar 1999 |README.Solaris |
583: |--------------------------------------+---------------+----------------------|
584: |Linux | Jun 1999 |README.Linux |
585: |--------------------------------------+---------------+----------------------|
1.191 bacon 586: |Darwin / Mac OS X / OS X / macOS | Oct 2001 |README.macOS |
1.92 sevan 587: |--------------------------------------+---------------+----------------------|
588: |FreeBSD | Nov 2002 |README.FreeBSD |
589: |--------------------------------------+---------------+----------------------|
590: |OpenBSD | Nov 2002 |README.OpenBSD |
591: |--------------------------------------+---------------+----------------------|
592: |IRIX | Dec 2002 |README.IRIX |
593: | | |README.IRIX5.3 |
594: |--------------------------------------+---------------+----------------------|
595: |BSD/OS | Dec 2003 | |
596: |--------------------------------------+---------------+----------------------|
597: |AIX | Dec 2003 |README.AIX |
598: |--------------------------------------+---------------+----------------------|
599: |Interix (Microsoft Windows Services | Mar 2004 |README.Interix |
600: |for Unix) | | |
601: |--------------------------------------+---------------+----------------------|
602: |DragonFlyBSD | Oct 2004 | |
603: |--------------------------------------+---------------+----------------------|
604: |OSF/1 | Nov 2004 |README.OSF1 |
605: |--------------------------------------+---------------+----------------------|
606: |HP-UX | Apr 2007 |README.HPUX |
607: |--------------------------------------+---------------+----------------------|
608: |Haiku | Sep 2010 |README.Haiku |
609: |--------------------------------------+---------------+----------------------|
610: |MirBSD | Jan 2011 | |
611: |--------------------------------------+---------------+----------------------|
612: |Minix3 | Nov 2011 |README.Minix3 |
613: |--------------------------------------+---------------+----------------------|
614: |Cygwin | Mar 2013 |README.Cygwin |
615: |--------------------------------------+---------------+----------------------|
616: |GNU/kFreeBSD | Jul 2013 |README.GNUkFreeBSD |
1.104 sevan 617: |--------------------------------------+---------------+----------------------|
618: |Bitrig | Jun 2014 |README.Bitrig |
1.92 sevan 619: +-----------------------------------------------------------------------------+
1.1 dsieger 620:
621:
622: 1.2. Overview
623:
624: This document is divided into three parts. The first, The pkgsrc user's guide,
625: describes how one can use one of the packages in the Package Collection, either
626: by installing a precompiled binary package, or by building one's own copy using
627: the NetBSD package system. The second part, The pkgsrc developer's guide,
628: explains how to prepare a package so it can be easily built by other NetBSD
629: users without knowing about the package's building details. The third part, The
630: pkgsrc infrastructure internals is intended for those who want to understand
631: how pkgsrc is implemented.
632:
633: This document is available in various formats: HTML, PDF, PS, TXT.
634:
635: 1.3. Terminology
636:
637: There has been a lot of talk about "ports", "packages", etc. so far. Here is a
638: description of all the terminology used within this document.
639:
640: Package
641:
642: A set of files and building instructions that describe what's necessary to
643: build a certain piece of software using pkgsrc. Packages are traditionally
1.123 wiz 644: stored under /usr/pkgsrc, but may be stored in any location, referred to as
645: PKGSRCDIR.
1.1 dsieger 646:
647: The NetBSD package system
648:
649: This is the former name of "pkgsrc". It is part of the NetBSD operating
650: system and can be bootstrapped to run on non-NetBSD operating systems as
651: well. It handles building (compiling), installing, and removing of
652: packages.
653:
654: Distfile
655:
656: This term describes the file or files that are provided by the author of
657: the piece of software to distribute his work. All the changes necessary to
658: build on NetBSD are reflected in the corresponding package. Usually the
659: distfile is in the form of a compressed tar-archive, but other types are
660: possible, too. Distfiles are usually stored below /usr/pkgsrc/distfiles.
661:
662: Port
663:
664: This is the term used by FreeBSD and OpenBSD people for what we call a
665: package. In NetBSD terminology, "port" refers to a different architecture.
666:
667: Precompiled/binary package
668:
669: A set of binaries built with pkgsrc from a distfile and stuffed together in
670: a single .tgz file so it can be installed on machines of the same machine
671: architecture without the need to recompile. Packages are usually generated
672: in /usr/pkgsrc/packages; there is also an archive on ftp.NetBSD.org.
673:
674: Sometimes, this is referred to by the term "package" too, especially in the
675: context of precompiled packages.
676:
677: Program
678:
679: The piece of software to be installed which will be constructed from all
680: the files in the distfile by the actions defined in the corresponding
681: package.
682:
683: 1.3.1. Roles involved in pkgsrc
684:
685: pkgsrc users
686:
687: The pkgsrc users are people who use the packages provided by pkgsrc.
688: Typically they are system administrators. The people using the software
689: that is inside the packages (maybe called "end users") are not covered by
690: the pkgsrc guide.
691:
692: There are two kinds of pkgsrc users: Some only want to install pre-built
693: binary packages. Others build the pkgsrc packages from source, either for
694: installing them directly or for building binary packages themselves. For
695: pkgsrc users Part I, "The pkgsrc user's guide" should provide all necessary
696: documentation.
697:
698: package maintainers
699:
700: A package maintainer creates packages as described in Part II, "The pkgsrc
701: developer's guide".
702:
703: infrastructure developers
704:
705: These people are involved in all those files that live in the mk/ directory
706: and below. Only these people should need to read through Part III, "The
707: pkgsrc infrastructure internals", though others might be curious, too.
708:
709: 1.4. Typography
710:
711: When giving examples for commands, shell prompts are used to show if the
712: command should/can be issued as root, or if "normal" user privileges are
1.115 sevan 713: sufficient. We use a # for root's shell prompt, a % for users' shell prompt,
714: assuming they use the C-shell or tcsh and a $ for bourne shell and derivatives.
1.1 dsieger 715:
716: Part I. The pkgsrc user's guide
717:
718: Table of Contents
719:
1.154 rillig 720: 2. Getting help
721: 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 722:
1.154 rillig 723: 3.1. Getting pkgsrc for the first time
1.1 dsieger 724:
1.154 rillig 725: 3.1.1. As tar archive
726: 3.1.2. Via anonymous CVS
1.1 dsieger 727:
1.154 rillig 728: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 729:
1.154 rillig 730: 3.2.1. Via tar files
731: 3.2.2. Via CVS
1.1 dsieger 732:
1.154 rillig 733: 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 734:
1.154 rillig 735: 4.1. Binary distribution
736: 4.2. Bootstrapping pkgsrc
1.1 dsieger 737:
1.154 rillig 738: 5. Using pkgsrc
1.1 dsieger 739:
1.154 rillig 740: 5.1. Using binary packages
1.1 dsieger 741:
1.154 rillig 742: 5.1.1. Finding binary packages
743: 5.1.2. Installing binary packages
1.202 nia 744: 5.1.3. Updating packages
745: 5.1.4. Deinstalling packages
746: 5.1.5. Getting information about installed packages
747: 5.1.6. Checking for security vulnerabilities in installed packages
748: 5.1.7. Finding if newer versions of your installed packages are in
1.1 dsieger 749: pkgsrc
1.202 nia 750: 5.1.8. Other administrative functions
1.1 dsieger 751:
1.154 rillig 752: 5.2. Building packages from source
1.1 dsieger 753:
1.154 rillig 754: 5.2.1. Requirements
755: 5.2.2. Fetching distfiles
756: 5.2.3. How to build and install
1.1 dsieger 757:
1.154 rillig 758: 6. Configuring pkgsrc
1.1 dsieger 759:
1.154 rillig 760: 6.1. General configuration
761: 6.2. Variables affecting the build process
762: 6.3. Variables affecting the installation process
763: 6.4. Selecting and configuring the compiler
1.1 dsieger 764:
1.154 rillig 765: 6.4.1. Selecting the compiler
766: 6.4.2. Additional flags to the compiler (CFLAGS)
767: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 768:
1.154 rillig 769: 6.5. Developer/advanced settings
770: 6.6. Selecting Build Options
1.1 dsieger 771:
1.154 rillig 772: 7. Creating binary packages
1.1 dsieger 773:
1.154 rillig 774: 7.1. Building a single binary package
775: 7.2. Settings for creation of binary packages
1.1 dsieger 776:
1.154 rillig 777: 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 778:
1.154 rillig 779: 8.1. Preparations
1.180 rillig 780: 8.2. Running a bulk build
1.6 rillig 781:
1.154 rillig 782: 8.2.1. Configuration
1.6 rillig 783:
1.154 rillig 784: 8.3. Requirements of a full bulk build
1.178 rillig 785: 8.4. Bulk build variants
786:
1.179 rillig 787: 8.4.1. Detect unknown configure options
788: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 789: 8.4.3. Force compiler options only in the build phase
790: 8.4.4. Use custom directories
791: 8.4.5. Turn warnings into errors
792: 8.4.6. Reject packages for which pkglint reports errors
793: 8.4.7. Reject packages that contain forbidden strings
794: 8.4.8. Reject packages whose self-test fails
795: 8.4.9. Reject packages that use undefined shell variables
796: 8.4.10. Turn off verbose logging
1.6 rillig 797:
1.178 rillig 798: 8.5. Creating a multiple CD-ROM packages collection
799:
800: 8.5.1. Example of cdpack
1.6 rillig 801:
1.154 rillig 802: 9. Directory layout of the installed files
1.6 rillig 803:
1.154 rillig 804: 9.1. File system layout in ${LOCALBASE}
805: 9.2. File system layout in ${VARBASE}
1.6 rillig 806:
1.154 rillig 807: 10. Frequently Asked Questions
1.6 rillig 808:
1.154 rillig 809: 10.1. Are there any mailing lists for pkg-related discussion?
810: 10.2. Utilities for package management (pkgtools)
811: 10.3. How to use pkgsrc as non-root
812: 10.4. How to resume transfers when fetching distfiles?
813: 10.5. How can I install/use modular X.org from pkgsrc?
814: 10.6. How to fetch files from behind a firewall
815: 10.7. How to fetch files from HTTPS sites
816: 10.8. How do I tell make fetch to do passive FTP?
817: 10.9. How to fetch all distfiles at once
818: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
819: 10.11. What does "Could not find bsd.own.mk" mean?
820: 10.12. Using 'sudo' with pkgsrc
821: 10.13. How do I change the location of configuration files?
822: 10.14. Automated security checks
823: 10.15. Why do some packages ignore my CFLAGS?
824: 10.16. A package does not build. What shall I do?
825: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.24 wiz 826: conflicts" mean?
1.1 dsieger 827:
1.154 rillig 828: Chapter 2. Getting help
829:
830: To get help when using pkgsrc, the definitive source is this document, the
831: pkgsrc guide. If you don't find anything here, there are alternatives:
832:
833: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
834: Run bmake help topic=? to get help for any topic, such as a variable name
835: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
836: like strcasecmp or any other topic.
837:
1.207 leot 838: The available help topics are listed in Appendix E, Help topics.
1.154 rillig 839:
1.163 rillig 840: * To see the value of a single variable, run bmake show-var VARNAME=X.
841:
842: * To see the values of the most common variables, run bmake show-all. These
843: variables are grouped by topic. To see the variables for a single topic,
844: run bmake show-all-topic, for example bmake show-all-fetch.
845:
1.154 rillig 846: * The pkgsrc-users mailing list, to which you can subscribe and then ask your
847: questions.
848:
849: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
850: a specialized chat program such as XChat. Pick any user name and join the
851: channel #pkgsrc.
852:
853: Chapter 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 854:
855: Table of Contents
856:
1.154 rillig 857: 3.1. Getting pkgsrc for the first time
1.1 dsieger 858:
1.154 rillig 859: 3.1.1. As tar archive
860: 3.1.2. Via anonymous CVS
1.1 dsieger 861:
1.154 rillig 862: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 863:
1.154 rillig 864: 3.2.1. Via tar files
865: 3.2.2. Via CVS
1.1 dsieger 866:
867: Before you download and extract the files, you need to decide where you want to
868: extract them. When using pkgsrc as root user, pkgsrc is usually installed in /
869: usr/pkgsrc. You are though free to install the sources and binary packages
870: wherever you want in your filesystem, provided that the pathname does not
871: contain white-space or other characters that are interpreted specially by the
872: shell and some other programs. A safe bet is to use only letters, digits,
873: underscores and dashes.
874:
1.154 rillig 875: 3.1. Getting pkgsrc for the first time
1.1 dsieger 876:
1.25 wiz 877: Before you download any pkgsrc files, you should decide whether you want the
1.1 dsieger 878: current branch or the stable branch. The latter is forked on a quarterly basis
879: from the current branch and only gets modified for security updates. The names
880: of the stable branches are built from the year and the quarter, for example
1.207 leot 881: 2021Q3.
1.1 dsieger 882:
883: The second step is to decide how you want to download pkgsrc. You can get it as
1.24 wiz 884: a tar file or via CVS. Both ways are described here.
1.1 dsieger 885:
1.52 asau 886: Note that tar archive contains CVS working copy. Thus you can switch to using
887: CVS at any later time.
1.1 dsieger 888:
1.154 rillig 889: 3.1.1. As tar archive
1.52 asau 890:
1.151 sevan 891: The primary download location for all pkgsrc files is https://cdn.NetBSD.org/
892: pub/pkgsrc/ or ftp://ftp.NetBSD.org/pub/pkgsrc/ (it points to the same
893: location). There are a number of subdirectories for different purposes, which
1.207 leot 894: are described in detail in Appendix D, Directory layout of the pkgsrc FTP
1.151 sevan 895: server.
1.1 dsieger 896:
1.52 asau 897: The tar archive for the current branch is in the directory current and is
1.118 sevan 898: called pkgsrc.tar.gz. It is autogenerated weekly.
1.52 asau 899:
900: To save download time we provide bzip2- and xz-compressed archives which are
901: published at pkgsrc.tar.bz2 and pkgsrc.tar.xz respectively.
902:
903: You can fetch the same files using FTP.
1.1 dsieger 904:
1.207 leot 905: The tar file for the stable branch 2021Q3 is in the directory pkgsrc-2021Q3 and
1.59 jnemeth 906: is also called pkgsrc.tar.gz.
1.1 dsieger 907:
1.136 leot 908: To download the latest pkgsrc stable tarball, run:
1.12 weinem 909:
1.207 leot 910: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2021Q3/pkgsrc.tar.gz
1.12 weinem 911:
1.78 snj 912: If you prefer, you can also fetch it using "wget", "curl", or your web browser.
1.52 asau 913:
1.12 weinem 914: Then, extract it with:
915:
1.78 snj 916: $ tar -xzf pkgsrc.tar.gz -C /usr
1.12 weinem 917:
918: This will create the directory pkgsrc/ in /usr/ and all the package source will
919: be stored under /usr/pkgsrc/.
920:
921: To download pkgsrc-current, run:
922:
923: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz
1.1 dsieger 924:
1.154 rillig 925: 3.1.2. Via anonymous CVS
1.1 dsieger 926:
1.24 wiz 927: To fetch a specific pkgsrc stable branch, run:
1.1 dsieger 928:
1.207 leot 929: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2021Q3 -P pkgsrc
1.13 weinem 930:
1.24 wiz 931: This will create the directory pkgsrc/ in your /usr/ directory and all the
932: package source will be stored under /usr/pkgsrc/.
933:
934: To fetch the pkgsrc current branch, run:
1.1 dsieger 935:
1.40 wiz 936: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 937:
1.30 dholland 938: Refer to the list of available mirrors to choose a faster CVS mirror, if
939: needed.
1.1 dsieger 940:
1.24 wiz 941: If you get error messages from rsh, you need to set CVS_RSH variable. E.g.:
1.1 dsieger 942:
1.40 wiz 943: $ cd /usr && env CVS_RSH=ssh cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 944:
1.24 wiz 945: Refer to documentation on your command shell how to set CVS_RSH=ssh
946: permanently. For Bourne shells, you can set it in your .profile or better
947: globally in /etc/profile:
948:
949: # set CVS remote shell command
950: CVS_RSH=ssh
951: export CVS_RSH
1.12 weinem 952:
1.13 weinem 953: By default, CVS doesn't do things like most people would expect it to do. But
954: there is a way to convince CVS, by creating a file called .cvsrc in your home
1.12 weinem 955: directory and saving the following lines to it. This file will save you lots of
956: headache and some bug reports, so we strongly recommend it. You can find an
957: explanation of this file in the CVS documentation.
1.2 rillig 958:
959: # recommended CVS configuration file from the pkgsrc guide
1.155 sevan 960: cvs -q
1.2 rillig 961: checkout -P
1.4 rillig 962: update -dP
963: diff -upN
1.2 rillig 964: rdiff -u
1.24 wiz 965: release -d
1.1 dsieger 966:
1.154 rillig 967: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 968:
969: The preferred way to keep pkgsrc up-to-date is via CVS (which also works if you
970: have first installed it via a tar file). It saves bandwidth and hard disk
971: activity, compared to downloading the tar file again.
972:
1.154 rillig 973: 3.2.1. Via tar files
1.1 dsieger 974:
975: Warning
976:
977: When updating from a tar file, you first need to completely remove the old
978: pkgsrc directory. Otherwise those files that have been removed from pkgsrc in
979: the mean time will not be removed on your local disk, resulting in
980: inconsistencies. When removing the old files, any changes that you have done to
981: the pkgsrc files will be lost after updating. Therefore updating via CVS is
982: strongly recommended.
983:
984: Note that by default the distfiles and the binary packages are saved in the
985: pkgsrc tree, so don't forget to rescue them before updating. You can also
1.78 snj 986: configure pkgsrc to store distfiles and packages in directories outside the
1.154 rillig 987: pkgsrc tree by setting the DISTDIR and PACKAGES variables. See Chapter 6,
1.78 snj 988: Configuring pkgsrc for the details.
1.1 dsieger 989:
990: To update pkgsrc from a tar file, download the tar file as explained above.
991: Then, make sure that you have not made any changes to the files in the pkgsrc
992: directory. Remove the pkgsrc directory and extract the new tar file. Done.
993:
1.154 rillig 994: 3.2.2. Via CVS
1.1 dsieger 995:
1.26 spz 996: To update pkgsrc via CVS, change to the pkgsrc directory and run cvs:
1.12 weinem 997:
1.26 spz 998: $ cd /usr/pkgsrc && cvs update -dP
999:
1000: If you get error messages from rsh, you need to set CVS_RSH variable as
1001: described above. E.g.:
1002:
1003: $ cd /usr/pkgsrc && env CVS_RSH=ssh cvs up -dP
1.1 dsieger 1004:
1.154 rillig 1005: 3.2.2.1. Switching between different pkgsrc branches
1.1 dsieger 1006:
1007: When updating pkgsrc, the CVS program keeps track of the branch you selected.
1008: But if you, for whatever reason, want to switch from the stable branch to the
1009: current one, you can do it by adding the option "-A" after the "update"
1.25 wiz 1010: keyword. To switch from the current branch back to the stable branch, add the "
1.207 leot 1011: -rpkgsrc-2021Q3" option.
1.1 dsieger 1012:
1.154 rillig 1013: 3.2.2.2. What happens to my changes when updating?
1.1 dsieger 1014:
1015: When you update pkgsrc, the CVS program will only touch those files that are
1016: registered in the CVS repository. That means that any packages that you created
1017: on your own will stay unmodified. If you change files that are managed by CVS,
1018: later updates will try to merge your changes with those that have been done by
1019: others. See the CVS manual, chapter "update" for details.
1020:
1.154 rillig 1021: Chapter 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 1022:
1023: Table of Contents
1024:
1.154 rillig 1025: 4.1. Binary distribution
1026: 4.2. Bootstrapping pkgsrc
1.1 dsieger 1027:
1.154 rillig 1028: 4.1. Binary distribution
1.1 dsieger 1029:
1.154 rillig 1030: See Section 5.1, "Using binary packages".
1.1 dsieger 1031:
1.154 rillig 1032: 4.2. Bootstrapping pkgsrc
1.1 dsieger 1033:
1.44 asau 1034: pkgsrc can be bootstrapped for use in two different modes: privileged and
1035: unprivileged one. In unprivileged mode in contrast to privileged one all
1.45 asau 1036: programs are installed under one particular user and cannot utilise privileged
1.44 asau 1037: operations (packages don't create special users and all special file
1038: permissions like setuid are ignored).
1039:
1.1 dsieger 1040: Installing the bootstrap kit from source should be as simple as:
1041:
1.60 asau 1042: # env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 1043: # cd pkgsrc/bootstrap
1044: # ./bootstrap
1045:
1046:
1.44 asau 1047: To bootstrap in unprivileged mode pass "--unprivileged" flag to bootstrap
1048:
1049: By default, in privileged mode pkgsrc uses /usr/pkg for prefix where programs
1.118 sevan 1050: will be installed in, and /usr/pkg/pkgdb for the package database directory
1051: where pkgsrc will do its internal bookkeeping, /var is used as varbase, where
1.44 asau 1052: packages install their persistent data. In unprivileged mode pkgsrc uses ~/pkg
1.118 sevan 1053: for prefix, ~/pkg/pkgdb for the package database, and ~/pkg/var for varbase.
1.44 asau 1054:
1055: You can change default layout using command-line arguments. Run "./bootstrap
1056: --help" to get details.
1.1 dsieger 1057:
1058: Note
1059:
1060: The bootstrap installs a bmake tool. Use this bmake when building via pkgsrc.
1061: For examples in this guide, use bmake instead of "make".
1062:
1.44 asau 1063: Note
1064:
1065: It is possible to bootstrap multiple instances of pkgsrc using non-intersecting
1066: directories. Use bmake corresponding to the installation you're working with to
1067: build and install packages.
1068:
1.154 rillig 1069: Chapter 5. Using pkgsrc
1.1 dsieger 1070:
1071: Table of Contents
1072:
1.154 rillig 1073: 5.1. Using binary packages
1.1 dsieger 1074:
1.154 rillig 1075: 5.1.1. Finding binary packages
1076: 5.1.2. Installing binary packages
1.202 nia 1077: 5.1.3. Updating packages
1078: 5.1.4. Deinstalling packages
1079: 5.1.5. Getting information about installed packages
1080: 5.1.6. Checking for security vulnerabilities in installed packages
1081: 5.1.7. Finding if newer versions of your installed packages are in pkgsrc
1082: 5.1.8. Other administrative functions
1.154 rillig 1083:
1084: 5.2. Building packages from source
1085:
1086: 5.2.1. Requirements
1087: 5.2.2. Fetching distfiles
1088: 5.2.3. How to build and install
1.1 dsieger 1089:
1090: Basically, there are two ways of using pkgsrc. The first is to only install the
1091: package tools and to use binary packages that someone else has prepared. This
1092: is the "pkg" in pkgsrc. The second way is to install the "src" of pkgsrc, too.
1093: Then you are able to build your own packages, and you can still use binary
1094: packages from someone else.
1095:
1.154 rillig 1096: 5.1. Using binary packages
1.1 dsieger 1097:
1.151 sevan 1098: On the cdn.NetBSD.org site and mirrors, there are collections of binary
1.9 rillig 1099: packages, ready to be installed. These binary packages have been built using
1100: the default settings for the directories, that is:
1101:
1102: * /usr/pkg for LOCALBASE, where most of the files are installed,
1103:
1104: * /usr/pkg/etc for configuration files,
1105:
1106: * /var for VARBASE, where those files are installed that may change after
1107: installation.
1108:
1109: If you cannot use these directories for whatever reasons (maybe because you're
1110: not root), you cannot use these binary packages, but have to build the packages
1.154 rillig 1111: yourself, which is explained in Section 4.2, "Bootstrapping pkgsrc".
1.1 dsieger 1112:
1.154 rillig 1113: 5.1.1. Finding binary packages
1.1 dsieger 1114:
1.5 weinem 1115: To install binary packages, you first need to know from where to get them. The
1.202 nia 1116: first place where you should look is on the main pkgsrc CDN in the directory /
1117: pub/pkgsrc/packages.
1.5 weinem 1118:
1119: This directory contains binary packages for multiple platforms. First, select
1120: your operating system. (Ignore the directories with version numbers attached to
1121: it, they just exist for legacy reasons.) Then, select your hardware
1122: architecture, and in the third step, the OS version and the "version" of
1.9 rillig 1123: pkgsrc.
1124:
1125: In this directory, you often find a file called bootstrap.tar.gz which contains
1126: the package management tools. If the file is missing, it is likely that your
1127: operating system already provides those tools. Download the file and extract it
1128: in the / directory. It will create the directories /usr/pkg (containing the
1.118 sevan 1129: tools for managing binary packages and the database of installed packages).
1.1 dsieger 1130:
1.154 rillig 1131: 5.1.2. Installing binary packages
1.1 dsieger 1132:
1.85 wiz 1133: In the directory from the last section, there is a subdirectory called All/,
1.9 rillig 1134: which contains all the binary packages that are available for the platform,
1.202 nia 1135: excluding those that may not be distributed via HTTP or FTP.
1.9 rillig 1136:
1137: To install packages directly from an FTP or HTTP server, run the following
1138: commands in a Bourne-compatible shell (be sure to su to root first):
1139:
1.202 nia 1140: # PATH="/usr/pkg/sbin:/usr/pkg/bin:$PATH"
1141: # PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages"
1.169 rillig 1142: # PKG_PATH="$PKG_PATH/OPSYS/ARCH/VERSIONS/All/"
1.9 rillig 1143: # export PATH PKG_PATH
1.202 nia 1144: # pkg_add pkgin
1.9 rillig 1145:
1146: Instead of URLs, you can also use local paths, for example if you are
1147: installing from a set of CDROMs, DVDs or an NFS-mounted repository. If you want
1148: to install packages from multiple sources, you can separate them by a semicolon
1149: in PKG_PATH.
1150:
1151: After these preparations, installing a package is very easy:
1152:
1.202 nia 1153: # pkgin search nginx
1154: nginx-1.19.6 Lightweight HTTP server and mail proxy server
1155: nginx-1.18.0nb8 Lightweight HTTP server and mail proxy server
1156: # pkgin install zsh nginx-1.19.6 vim
1.1 dsieger 1157:
1.202 nia 1158: Note that pkgin is a user-friendly frontend to the pkg_* tools.
1.1 dsieger 1159:
1.202 nia 1160: Any prerequisite packages needed to run the package in question will be
1161: installed, too, assuming they are present in the repository.
1.1 dsieger 1162:
1163: After you've installed packages, be sure to have /usr/pkg/bin and /usr/pkg/sbin
1164: in your PATH so you can actually start the just installed program.
1165:
1.202 nia 1166: 5.1.3. Updating packages
1.1 dsieger 1167:
1.202 nia 1168: To update binary packages, it is recommended that you use pkgin upgrade. This
1169: will compare the remote package repository to your locally installed packages
1170: and safely replace any older packages.
1.1 dsieger 1171:
1.202 nia 1172: Note that pkgsrc is released as quarterly branches. If you are updating to a
1173: newer quarterly branch of pkgsrc, you may need to adjust the repository in /usr
1174: /pkg/etc/pkgin/repositories.conf.
1.1 dsieger 1175:
1.202 nia 1176: 5.1.4. Deinstalling packages
1.1 dsieger 1177:
1.202 nia 1178: To deinstall a package, it does not matter whether it was installed from source
1179: code or from a binary package. Neither the pkgin or the pkg_delete command need
1180: to know.
1.1 dsieger 1181:
1.202 nia 1182: To delete a package, you can just run pkgin remove package-name. The package
1183: name can be given with or without version number.
1.1 dsieger 1184:
1.202 nia 1185: 5.1.5. Getting information about installed packages
1.1 dsieger 1186:
1187: The pkg_info shows information about installed packages or binary package
1.202 nia 1188: files. As with other management tools, it works with packages installed from
1189: source or binaries.
1.1 dsieger 1190:
1.202 nia 1191: 5.1.6. Checking for security vulnerabilities in installed packages
1.1 dsieger 1192:
1.202 nia 1193: The pkgsrc Security Team and Packages Groups maintain a list of known
1.164 leot 1194: vulnerabilities to packages which are (or have been) included in pkgsrc. The
1.202 nia 1195: list is available from the NetBSD CDN at https://cdn.NetBSD.org/pub/NetBSD/
1.179 rillig 1196: packages/vulns/pkg-vulnerabilities.
1.1 dsieger 1197:
1.202 nia 1198: Please note that not every "vulnerability" with a CVE assignment is exploitable
1199: in every configuration. Some bugs are marked as active simply because an fix
1200: was not marked as such. Operating system specific hardening and mitigation
1201: features may also reduce the impact of bugs.
1202:
1.23 jakllsch 1203: Through pkg_admin fetch-pkg-vulnerabilities, this list can be downloaded
1204: automatically, and a security audit of all packages installed on a system can
1205: take place.
1206:
1207: There are two components to auditing. The first step, pkg_admin
1208: fetch-pkg-vulnerabilities, is for downloading the list of vulnerabilities from
1209: the NetBSD FTP site. The second step, pkg_admin audit, checks to see if any of
1210: your installed packages are vulnerable. If a package is vulnerable, you will
1211: see output similar to the following:
1.1 dsieger 1212:
1213: Package samba-2.0.9 has a local-root-shell vulnerability, see
1.174 leot 1214: https://www.samba.org/samba/whatsnew/macroexploit.html
1.1 dsieger 1215:
1.23 jakllsch 1216: You may wish to have the vulnerabilities file downloaded daily so that it
1217: remains current. This may be done by adding an appropriate entry to the root
1218: users crontab(5) entry. For example the entry
1219:
1.121 sevan 1220: # Download vulnerabilities file
1.118 sevan 1221: 0 3 * * * /usr/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities >/dev/null 2>&1
1.121 sevan 1222: # Audit the installed packages and email results to root
1223: 9 3 * * * /usr/pkg/sbin/pkg_admin audit |mail -s "Installed package audit result" \
1224: root >/dev/null 2>&1
1.118 sevan 1225:
1226:
1227: will update the vulnerability list every day at 3AM, followed by an audit at
1228: 3:09AM. The result of the audit are then emailed to root. On NetBSD this may be
1229: accomplished instead by adding the following line to /etc/daily.conf:
1230:
1231: fetch_pkg_vulnerabilities=YES
1232:
1.23 jakllsch 1233:
1.118 sevan 1234: to fetch the vulnerability list from the daily security script. The system is
1235: set to audit the packages by default but can be set explicitly, if desired (not
1.123 wiz 1236: required), by adding the following line to /etc/security.conf:
1.23 jakllsch 1237:
1.118 sevan 1238: check_pkg_vulnerabilities=YES
1.23 jakllsch 1239:
1240:
1.118 sevan 1241: see daily.conf(5) and security.conf(5) for more details.
1.1 dsieger 1242:
1.202 nia 1243: 5.1.7. Finding if newer versions of your installed packages are in pkgsrc
1.1 dsieger 1244:
1.12 weinem 1245: Install pkgtools/lintpkgsrc and run lintpkgsrc with the "-i" argument to check
1.202 nia 1246: if any packages are stale, e.g.
1.1 dsieger 1247:
1248: % lintpkgsrc -i
1249: ...
1250: Version mismatch: 'tcsh' 6.09.00 vs 6.10.00
1251:
1252:
1.202 nia 1253: 5.1.8. Other administrative functions
1.1 dsieger 1254:
1255: The pkg_admin executes various administrative functions on the package system.
1256:
1.154 rillig 1257: 5.2. Building packages from source
1.1 dsieger 1258:
1259: After obtaining pkgsrc, the pkgsrc directory now contains a set of packages,
1.25 wiz 1260: organized into categories. You can browse the online index of packages, or run
1.1 dsieger 1261: make readme from the pkgsrc directory to build local README.html files for all
1262: packages, viewable with any web browser such as www/lynx or www/firefox.
1263:
1264: The default prefix for installed packages is /usr/pkg. If you wish to change
1265: this, you should do so by setting LOCALBASE in mk.conf. You should not try to
1266: use multiple different LOCALBASE definitions on the same system (inside a
1267: chroot is an exception).
1268:
1269: The rest of this chapter assumes that the package is already in pkgsrc. If it
1270: is not, see Part II, "The pkgsrc developer's guide" for instructions how to
1271: create your own packages.
1272:
1.154 rillig 1273: 5.2.1. Requirements
1.1 dsieger 1274:
1275: To build packages from source, you need a working C compiler. On NetBSD, you
1276: need to install the "comp" and the "text" distribution sets. If you want to
1277: build X11-related packages, the "xbase" and "xcomp" distribution sets are
1278: required, too.
1279:
1.154 rillig 1280: 5.2.2. Fetching distfiles
1.1 dsieger 1281:
1282: The first step for building a package is downloading the distfiles (i.e. the
1283: unmodified source). If they have not yet been downloaded, pkgsrc will fetch
1284: them automatically.
1285:
1286: If you have all files that you need in the distfiles directory, you don't need
1287: to connect. If the distfiles are on CD-ROM, you can mount the CD-ROM on /cdrom
1288: and add:
1289:
1290: DISTDIR=/cdrom/pkgsrc/distfiles
1291:
1292: to your mk.conf.
1293:
1294: By default a list of distribution sites will be randomly intermixed to prevent
1295: huge load on servers which holding popular packages (for example,
1296: SourceForge.net mirrors). Thus, every time when you need to fetch yet another
1297: distfile all the mirrors will be tried in new (random) order. You can turn this
1298: feature off by setting MASTER_SORT_RANDOM=NO (for PKG_DEVELOPERs it's already
1299: disabled).
1300:
1301: You can overwrite some of the major distribution sites to fit to sites that are
1302: close to your own. By setting one or two variables you can modify the order in
1303: which the master sites are accessed. MASTER_SORT contains a whitespace
1304: delimited list of domain suffixes. MASTER_SORT_REGEX is even more flexible, it
1305: contains a whitespace delimited list of regular expressions. It has higher
1306: priority than MASTER_SORT. Have a look at pkgsrc/mk/defaults/mk.conf to find
1307: some examples. This may save some of your bandwidth and time.
1308:
1309: You can change these settings either in your shell's environment, or, if you
1.4 rillig 1310: want to keep the settings, by editing the mk.conf file, and adding the
1.1 dsieger 1311: definitions there.
1312:
1.132 wiz 1313: If a package depends on many other packages (such as meta-pkgs/kde4), the build
1.1 dsieger 1314: process may alternate between periods of downloading source, and compiling. To
1315: ensure you have all the source downloaded initially you can run the command:
1316:
1317: % make fetch-list | sh
1318:
1319: which will output and run a set of shell commands to fetch the necessary files
1320: into the distfiles directory. You can also choose to download the files
1321: manually.
1322:
1.154 rillig 1323: 5.2.3. How to build and install
1.1 dsieger 1324:
1325: Once the software has downloaded, any patches will be applied, then it will be
1326: compiled for you. This may take some time depending on your computer, and how
1327: many other packages the software depends on and their compile time.
1328:
1329: Note
1330:
1331: If using bootstrap or pkgsrc on a non-NetBSD system, use the pkgsrc bmake
1332: command instead of "make" in the examples in this guide.
1333:
1334: For example, type
1335:
1336: % cd misc/figlet
1337: % make
1338:
1339:
1340: at the shell prompt to build the various components of the package.
1341:
1342: The next stage is to actually install the newly compiled program onto your
1343: system. Do this by entering:
1344:
1345: % make install
1346:
1347:
1348: while you are still in the directory for whatever package you are installing.
1349:
1350: Installing the package on your system may require you to be root. However,
1351: pkgsrc has a just-in-time-su feature, which allows you to only become root for
1352: the actual installation step.
1353:
1354: That's it, the software should now be installed and setup for use. You can now
1355: enter:
1356:
1357: % make clean
1358:
1359:
1360: to remove the compiled files in the work directory, as you shouldn't need them
1361: any more. If other packages were also added to your system (dependencies) to
1362: allow your program to compile, you can tidy these up also with the command:
1363:
1364: % make clean-depends
1365:
1366:
1367: Taking the figlet utility as an example, we can install it on our system by
1.207 leot 1368: building as shown in Appendix C, Build logs.
1.1 dsieger 1369:
1370: The program is installed under the default root of the packages tree - /usr/
1371: pkg. Should this not conform to your tastes, set the LOCALBASE variable in your
1372: environment, and it will use that value as the root of your packages tree. So,
1373: to use /usr/local, set LOCALBASE=/usr/local in your environment. Please note
1374: that you should use a directory which is dedicated to packages and not shared
1375: with other programs (i.e., do not try and use LOCALBASE=/usr). Also, you should
1376: not try to add any of your own files or directories (such as src/, obj/, or
1377: pkgsrc/) below the LOCALBASE tree. This is to prevent possible conflicts
1378: between programs and other files installed by the package system and whatever
1379: else may have been installed there.
1380:
1.4 rillig 1381: Some packages look in mk.conf to alter some configuration options at build
1.1 dsieger 1382: time. Have a look at pkgsrc/mk/defaults/mk.conf to get an overview of what will
1383: be set there by default. Environment variables such as LOCALBASE can be set in
1.4 rillig 1384: mk.conf to save having to remember to set them each time you want to use
1.1 dsieger 1385: pkgsrc.
1386:
1387: Occasionally, people want to "look under the covers" to see what is going on
1388: when a package is building or being installed. This may be for debugging
1389: purposes, or out of simple curiosity. A number of utility values have been
1390: added to help with this.
1391:
1392: 1. If you invoke the make(1) command with PKG_DEBUG_LEVEL=2, then a huge
1393: amount of information will be displayed. For example,
1394:
1395: make patch PKG_DEBUG_LEVEL=2
1396:
1.25 wiz 1397: will show all the commands that are invoked, up to and including the "patch
1398: " stage.
1.1 dsieger 1399:
1400: 2. If you want to know the value of a certain make(1) definition, then the
1401: VARNAME definition should be used, in conjunction with the show-var target.
1402: e.g. to show the expansion of the make(1) variable LOCALBASE:
1403:
1404: % make show-var VARNAME=LOCALBASE
1405: /usr/pkg
1406: %
1407:
1408:
1409: If you want to install a binary package that you've either created yourself
1410: (see next section), that you put into pkgsrc/packages manually or that is
1411: located on a remote FTP server, you can use the "bin-install" target. This
1412: target will install a binary package - if available - via pkg_add(1), else do a
1413: make package. The list of remote FTP sites searched is kept in the variable
1414: BINPKG_SITES, which defaults to ftp.NetBSD.org. Any flags that should be added
1415: to pkg_add(1) can be put into BIN_INSTALL_FLAGS. See pkgsrc/mk/defaults/mk.conf
1416: for more details.
1417:
1418: A final word of warning: If you set up a system that has a non-standard setting
1419: for LOCALBASE, be sure to set that before any packages are installed, as you
1420: cannot use several directories for the same purpose. Doing so will result in
1421: pkgsrc not being able to properly detect your installed packages, and fail
1422: miserably. Note also that precompiled binary packages are usually built with
1423: the default LOCALBASE of /usr/pkg, and that you should not install any if you
1424: use a non-standard LOCALBASE.
1425:
1.154 rillig 1426: Chapter 6. Configuring pkgsrc
1.1 dsieger 1427:
1428: Table of Contents
1429:
1.154 rillig 1430: 6.1. General configuration
1431: 6.2. Variables affecting the build process
1432: 6.3. Variables affecting the installation process
1433: 6.4. Selecting and configuring the compiler
1434:
1435: 6.4.1. Selecting the compiler
1436: 6.4.2. Additional flags to the compiler (CFLAGS)
1437: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 1438:
1.154 rillig 1439: 6.5. Developer/advanced settings
1440: 6.6. Selecting Build Options
1.1 dsieger 1441:
1442: The whole pkgsrc system is configured in a single file, usually called mk.conf.
1443: In which directory pkgsrc looks for that file depends on the installation. On
1444: NetBSD, when you use make(1) from the base system, it is in the directory /etc
1445: /. In all other cases the default location is ${PREFIX}/etc/, depending on
1446: where you told the bootstrap program to install the binary packages.
1447:
1448: The format of the configuration file is that of the usual BSD-style Makefiles.
1449: The whole pkgsrc configuration is done by setting variables in this file. Note
1450: that you can define all kinds of variables, and no special error checking (for
1.112 rillig 1451: example for spelling mistakes) takes place.
1.1 dsieger 1452:
1.154 rillig 1453: 6.1. General configuration
1.1 dsieger 1454:
1.112 rillig 1455: The following variables apply to all pkgsrc packages. A complete list of the
1456: variables that can be configured by the user is available in mk/defaults/
1457: mk.conf, together with some comments that describe each variable's intent.
1.1 dsieger 1458:
1459: * LOCALBASE: Where packages will be installed. The default is /usr/pkg. Do
1460: not mix binary packages with different LOCALBASEs!
1461:
1462: * CROSSBASE: Where "cross" category packages will be installed. The default
1463: is ${LOCALBASE}/cross.
1464:
1.84 wiz 1465: * X11BASE: Where X11 is installed on the system. The default is /usr/X11R7.
1.1 dsieger 1466:
1467: * DISTDIR: Where to store the downloaded copies of the original source
1468: distributions used for building pkgsrc packages. The default is $
1469: {PKGSRCDIR}/distfiles.
1470:
1471: * PKG_DBDIR: Where the database about installed packages is stored. The
1.118 sevan 1472: default is /usr/pkg/pkgdb.
1.1 dsieger 1473:
1474: * MASTER_SITE_OVERRIDE: If set, override the packages' MASTER_SITES with this
1475: value.
1476:
1477: * MASTER_SITE_BACKUP: Backup location(s) for distribution files and patch
1478: files if not found locally or in ${MASTER_SITES} or ${PATCH_SITES}
1.118 sevan 1479: respectively. The defaults is ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/$
1.1 dsieger 1480: {DIST_SUBDIR}/.
1481:
1482: * BINPKG_SITES: List of sites carrying binary pkgs. rel and arch are replaced
1483: with OS release ("2.0", etc.) and architecture ("mipsel", etc.).
1484:
1.23 jakllsch 1485: * ACCEPTABLE_LICENSES: List of acceptable licenses. License names are
1486: case-sensitive. Whenever you try to build a package whose license is not in
1487: this list, you will get an error message. If the license condition is
1488: simple enough, the error message will include specific instructions on how
1489: to change this variable.
1.1 dsieger 1490:
1.154 rillig 1491: 6.2. Variables affecting the build process
1.1 dsieger 1492:
1493: * PACKAGES: The top level directory for the binary packages. The default is $
1494: {PKGSRCDIR}/packages.
1495:
1496: * WRKOBJDIR: The top level directory where, if defined, the separate working
1497: directories will get created, and symbolically linked to from ${WRKDIR}
1498: (see below). This is useful for building packages on several architectures,
1499: then ${PKGSRCDIR} can be NFS-mounted while ${WRKOBJDIR} is local to every
1500: architecture. (It should be noted that PKGSRCDIR should not be set by the
1.198 leot 1501: user -- it is an internal definition which refers to the root of the pkgsrc
1.1 dsieger 1502: tree. It is possible to have many pkgsrc tree instances.)
1503:
1504: * LOCALPATCHES: Directory for local patches that aren't part of pkgsrc. See
1.184 rillig 1505: Section 12.3, "patches/*" for more information.
1.1 dsieger 1506:
1507: * PKGMAKECONF: Location of the mk.conf file used by a package's BSD-style
1508: Makefile. If this is not set, MAKECONF is set to /dev/null to avoid picking
1509: up settings used by builds in /usr/src.
1510:
1.154 rillig 1511: 6.3. Variables affecting the installation process
1.1 dsieger 1512:
1.198 leot 1513: * PKGSRC_KEEP_BIN_PKGS: By default, binary packages of built packages are
1.150 leot 1514: preserved in ${PACKAGES}/All. Setting this variable to "no" prevents this.
1.1 dsieger 1515:
1.107 jnemeth 1516: Packages have to support installation into a subdirectory of WRKDIR. This
1517: allows a package to be built, before the actual filesystem is touched. DESTDIR
1518: support exists in two variations:
1.4 rillig 1519:
1520: * Basic DESTDIR support means that the package installation and packaging is
1521: still run as root.
1522:
1523: * Full DESTDIR support can run the complete build, installation and packaging
1524: as normal user. Root privileges are only needed to add packages.
1525:
1526: With basic DESTDIR support, make clean needs to be run as root.
1527:
1.17 imil 1528: Considering the foo/bar package, DESTDIR full support can be tested using the
1529: following commands
1530:
1531: $ id
1532: uid=1000(myusername) gid=100(users) groups=100(users),0(wheel)
1533: $ mkdir $HOME/packages
1534: $ cd $PKGSRCDIR/foo/bar
1535:
1536: Verify DESTDIR full support, no root privileges should be needed
1537:
1.66 asau 1538: $ make stage-install
1.17 imil 1539:
1540: Create a package without root privileges
1541:
1.66 asau 1542: $ make PACKAGES=$HOME/packages package
1.17 imil 1543:
1544: For the following command, you must be able to gain root privileges using su(1)
1545:
1.66 asau 1546: $ make PACKAGES=$HOME/packages install
1.17 imil 1547:
1548: Then, as a simple user
1549:
1550: $ make clean
1551:
1.154 rillig 1552: 6.4. Selecting and configuring the compiler
1.4 rillig 1553:
1.154 rillig 1554: 6.4.1. Selecting the compiler
1.1 dsieger 1555:
1556: By default, pkgsrc will use GCC to build packages. This may be overridden by
1557: setting the following variables in /etc/mk.conf:
1558:
1559: PKGSRC_COMPILER:
1560:
1561: This is a list of values specifying the chain of compilers to invoke when
1562: building packages. Valid values are:
1563:
1.66 asau 1564: + ccc: Compaq C Compilers (Tru64)
1565:
1566: + ccache: compiler cache (chainable)
1567:
1568: + clang: Clang C and Objective-C compiler
1569:
1.42 asau 1570: + distcc: distributed C/C++ (chainable)
1.1 dsieger 1571:
1.66 asau 1572: + f2c: Fortran 77 to C compiler (chainable)
1573:
1574: + icc: Intel C++ Compiler (Linux)
1575:
1576: + ido: SGI IRIS Development Option cc (IRIX 5)
1.1 dsieger 1577:
1.42 asau 1578: + gcc: GNU C/C++ Compiler
1.1 dsieger 1579:
1.66 asau 1580: + hp: HP-UX C/aC++ compilers
1581:
1.42 asau 1582: + mipspro: Silicon Graphics, Inc. MIPSpro (n32/n64)
1.1 dsieger 1583:
1.66 asau 1584: + mipspro-ucode: Silicon Graphics, Inc. MIPSpro (o32)
1.1 dsieger 1585:
1.42 asau 1586: + sunpro: Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio
1.1 dsieger 1587:
1.118 sevan 1588: + xlc: IBM's XL C/C++ compiler suite
1.66 asau 1589:
1.1 dsieger 1590: The default is "gcc". You can use ccache and/or distcc with an appropriate
1591: PKGSRC_COMPILER setting, e.g. "ccache gcc". This variable should always be
1592: terminated with a value for a real compiler. Note that only one real
1593: compiler should be listed (e.g. "sunpro gcc" is not allowed).
1594:
1595: GCC_REQD:
1596:
1597: This specifies the minimum version of GCC to use when building packages. If
1598: the system GCC doesn't satisfy this requirement, then pkgsrc will build and
1599: install one of the GCC packages to use instead.
1600:
1.153 leot 1601: PYTHON_VERSION_DEFAULT:
1.114 maya 1602:
1603: Specifies which version of python to use when several options are
1604: available.
1605:
1606: PKGSRC_FORTRAN:
1607:
1.176 gutterid 1608: Specifies the Fortran compiler to use. The default is gfortran.
1.114 maya 1609:
1610: GFORTRAN_VERSION:
1611:
1612: If PKGSRC_FORTRAN= gfortran is used, this option specifies which version to
1613: use.
1614:
1.154 rillig 1615: 6.4.2. Additional flags to the compiler (CFLAGS)
1.1 dsieger 1616:
1617: If you wish to set the CFLAGS variable, please make sure to use the += operator
1618: instead of the = operator:
1619:
1620: CFLAGS+= -your -flags
1621:
1622: Using CFLAGS= (i.e. without the "+") may lead to problems with packages that
1.16 jnemeth 1623: need to add their own flags. You may want to take a look at the devel/cpuflags
1.24 wiz 1624: package if you're interested in optimization specifically for the current CPU.
1.1 dsieger 1625:
1.154 rillig 1626: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 1627:
1628: If you want to pass flags to the linker, both in the configure step and the
1629: build step, you can do this in two ways. Either set LDFLAGS or LIBS. The
1630: difference between the two is that LIBS will be appended to the command line,
1631: while LDFLAGS come earlier. LDFLAGS is pre-loaded with rpath settings for ELF
1632: machines depending on the setting of USE_IMAKE or the inclusion of mk/
1633: x11.buildlink3.mk. As with CFLAGS, if you do not wish to override these
1634: settings, use the += operator:
1635:
1636: LDFLAGS+= -your -linkerflags
1637:
1.154 rillig 1638: 6.5. Developer/advanced settings
1.1 dsieger 1639:
1640: * PKG_DEVELOPER: Run some sanity checks that package developers want:
1641:
1.42 asau 1642: + make sure patches apply with zero fuzz
1.1 dsieger 1643:
1.42 asau 1644: + run check-shlibs to see that all binaries will find their shared libs.
1.1 dsieger 1645:
1646: * PKG_DEBUG_LEVEL: The level of debugging output which is displayed whilst
1647: making and installing the package. The default value for this is 0, which
1648: will not display the commands as they are executed (normal, default, quiet
1649: operation); the value 1 will display all shell commands before their
1650: invocation, and the value 2 will display both the shell commands before
1.112 rillig 1651: their invocation, as well as their actual execution progress with set -x.
1.1 dsieger 1652:
1.154 rillig 1653: 6.6. Selecting Build Options
1.1 dsieger 1654:
1655: Some packages have build time options, usually to select between different
1656: dependencies, enable optional support for big dependencies or enable
1657: experimental features.
1658:
1659: To see which options, if any, a package supports, and which options are
1660: mutually exclusive, run make show-options, for example:
1661:
1662: The following options are supported by this package:
1663: ssl Enable SSL support.
1664: Exactly one of the following gecko options is required:
1665: firefox Use firefox as gecko rendering engine.
1666: mozilla Use mozilla as gecko rendering engine.
1667: At most one of the following database options may be selected:
1668: mysql Enable support for MySQL database.
1669: pgsql Enable support for PostgreSQL database.
1670:
1671: These options are enabled by default: firefox
1672: These options are currently enabled: mozilla ssl
1673:
1.4 rillig 1674: The following variables can be defined in mk.conf to select which options to
1675: enable for a package: PKG_DEFAULT_OPTIONS, which can be used to select or
1.1 dsieger 1676: disable options for all packages that support them, and PKG_OPTIONS.pkgbase,
1677: which can be used to select or disable options specifically for package pkgbase
1678: . Options listed in these variables are selected, options preceded by "-" are
1679: disabled. A few examples:
1680:
1.4 rillig 1681: $ grep "PKG.*OPTION" mk.conf
1.1 dsieger 1682: PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
1683: PKG_OPTIONS.kdebase= debug -sasl
1684: PKG_OPTIONS.apache= suexec
1685:
1.11 rillig 1686: It is important to note that options that were specifically suggested by the
1.19 snj 1687: package maintainer must be explicitly removed if you do not wish to include the
1688: option. If you are unsure you can view the current state with make show-options
1689: .
1.11 rillig 1690:
1.1 dsieger 1691: The following settings are consulted in the order given, and the last setting
1692: that selects or disables an option is used:
1693:
1694: 1. the default options as suggested by the package maintainer
1695:
1696: 2. the options implied by the settings of legacy variables (see below)
1697:
1698: 3. PKG_DEFAULT_OPTIONS
1699:
1700: 4. PKG_OPTIONS.pkgbase
1701:
1702: For groups of mutually exclusive options, the last option selected is used, all
1703: others are automatically disabled. If an option of the group is explicitly
1704: disabled, the previously selected option, if any, is used. It is an error if no
1705: option from a required group of options is selected, and building the package
1706: will fail.
1707:
1708: Before the options framework was introduced, build options were selected by
1.4 rillig 1709: setting a variable (often named USE_FOO) in mk.conf for each option. To ease
1710: transition to the options framework for the user, these legacy variables are
1711: converted to the appropriate options setting (PKG_OPTIONS.pkgbase)
1712: automatically. A warning is issued to prompt the user to update mk.conf to use
1713: the options framework directly. Support for the legacy variables will be
1.1 dsieger 1714: removed eventually.
1715:
1.154 rillig 1716: Chapter 7. Creating binary packages
1.1 dsieger 1717:
1718: Table of Contents
1719:
1.154 rillig 1720: 7.1. Building a single binary package
1721: 7.2. Settings for creation of binary packages
1.1 dsieger 1722:
1.154 rillig 1723: 7.1. Building a single binary package
1.1 dsieger 1724:
1725: Once you have built and installed a package, you can create a binary package
1726: which can be installed on another system with pkg_add(1). This saves having to
1727: build the same package on a group of hosts and wasting CPU time. It also
1728: provides a simple means for others to install your package, should you
1729: distribute it.
1730:
1731: To create a binary package, change into the appropriate directory in pkgsrc,
1732: and run make package:
1733:
1.112 rillig 1734: $ cd misc/figlet
1735: $ make package
1.1 dsieger 1736:
1737: This will build and install your package (if not already done), and then build
1738: a binary package from what was installed. You can then use the pkg_* tools to
1739: manipulate it. Binary packages are created by default in /usr/pkgsrc/packages,
1.207 leot 1740: in the form of a gzipped tar file. See Section C.2, "Packaging figlet" for a
1.1 dsieger 1741: continuation of the above misc/figlet example.
1742:
1.154 rillig 1743: See Chapter 23, Submitting and Committing for information on how to submit such
1.1 dsieger 1744: a binary package.
1745:
1.154 rillig 1746: 7.2. Settings for creation of binary packages
1.1 dsieger 1747:
1.184 rillig 1748: See Section 13.17, "Other helpful targets".
1.6 rillig 1749:
1.154 rillig 1750: Chapter 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 1751:
1752: Table of Contents
1753:
1.154 rillig 1754: 8.1. Preparations
1.180 rillig 1755: 8.2. Running a bulk build
1.6 rillig 1756:
1.154 rillig 1757: 8.2.1. Configuration
1.6 rillig 1758:
1.154 rillig 1759: 8.3. Requirements of a full bulk build
1.178 rillig 1760: 8.4. Bulk build variants
1761:
1.179 rillig 1762: 8.4.1. Detect unknown configure options
1763: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 1764: 8.4.3. Force compiler options only in the build phase
1765: 8.4.4. Use custom directories
1766: 8.4.5. Turn warnings into errors
1767: 8.4.6. Reject packages for which pkglint reports errors
1768: 8.4.7. Reject packages that contain forbidden strings
1769: 8.4.8. Reject packages whose self-test fails
1770: 8.4.9. Reject packages that use undefined shell variables
1771: 8.4.10. Turn off verbose logging
1.6 rillig 1772:
1.178 rillig 1773: 8.5. Creating a multiple CD-ROM packages collection
1774:
1775: 8.5.1. Example of cdpack
1.6 rillig 1776:
1.175 gutterid 1777: For a number of reasons, you may want to build binary packages for a large
1778: selected set of packages in pkgsrc, or even for all pkgsrc packages. For
1.71 wiz 1779: instance, when you have multiple machines that should run the same software, it
1780: is wasted time if they all build their packages themselves from source. Or you
1781: may want to build a list of packages you want and check them before deploying
1.175 gutterid 1782: onto production systems. There is a way of getting a set of binary packages:
1783: the bulk build system, or pbulk ("p" stands for "parallel"). This chapter
1784: describes how to set it up.
1.71 wiz 1785:
1.154 rillig 1786: 8.1. Preparations
1.71 wiz 1787:
1788: First of all, you have to decide whether you build all packages or a limited
1789: set of them. Full bulk builds usually consume a lot more resources, both space
1.175 gutterid 1790: and time, than builds for some practical sets of packages. A number of
1791: particularly heavy packages exist that are not actually interesting to a wide
1792: audience. (The approximate resource consumption for a full bulk build is given
1793: in section Section 8.3, "Requirements of a full bulk build".) For limited bulk
1794: builds you need to make a list of packages you want to build. Note that all
1795: their dependencies will be built, so you don't need to track them manually.
1.71 wiz 1796:
1797: During bulk builds various packages are installed and deinstalled in /usr/pkg
1798: (or whatever LOCALBASE is), so make sure that you don't need any package during
1.112 rillig 1799: the builds. Essentially, you should provide a fresh system, either a chroot
1.71 wiz 1800: environment or something even more restrictive, depending on what the operating
1801: system provides, or dedicate the whole physical machine. As a useful side
1802: effect this makes sure that bulk builds cannot break anything in your system.
1803: There have been numerous cases where certain packages tried to install files
1804: outside the LOCALBASE or wanted to edit some files in /etc.
1.6 rillig 1805:
1.180 rillig 1806: 8.2. Running a bulk build
1.6 rillig 1807:
1.180 rillig 1808: Running a bulk build works roughly as follows:
1.15 rillig 1809:
1810: * First, build the pbulk infrastructure in a fresh pkgsrc location.
1811:
1812: * Then, build each of the packages from a clean installation directory using
1813: the infrastructure.
1814:
1.154 rillig 1815: 8.2.1. Configuration
1.6 rillig 1816:
1.112 rillig 1817: To simplify configuration, we provide the helper script mk/pbulk/pbulk.sh.
1.6 rillig 1818:
1.68 asau 1819: In order to use it, prepare a clear system (real one, chroot environment, jail,
1820: zone, virtual machine). Configure network access to fetch distribution files.
1.112 rillig 1821: Create a user with name "pbulk".
1.68 asau 1822:
1823: Fetch and extract pkgsrc. Use a command like one of these:
1824:
1.151 sevan 1825: # (cd /usr && ftp -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1826: # (cd /usr && fetch -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1.72 wiz 1827: # (cd /usr && cvs -Q -z3 -d anoncvs@anoncvs.NetBSD.org:/cvsroot get -P pkgsrc)
1.68 asau 1828:
1829: Or any other way that fits (e.g., curl, wget).
1830:
1831: Deploy and configure pbulk tools, e.g.:
1832:
1.118 sevan 1833: # sh pbulk.sh -n # use native make, no bootstrap kit needed (for use on NetBSD)
1.68 asau 1834: # sh pbulk.sh -n -c mk.conf.frag # native, apply settings from given mk.conf fragment
1835: # sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build
1836:
1837: Note
1838:
1839: mk.conf.frag is a fragment of mk.conf that contains settings you want to apply
1840: to packages you build. For instance,
1841:
1.112 rillig 1842: PKG_DEVELOPER= yes # perform more checks
1843: X11_TYPE= modular # use pkgsrc X11
1844: SKIP_LICENSE_CHECK= yes # accept all licences (useful
1845: # when building all packages)
1.68 asau 1846:
1847: If configured for limited list, replace the list in /usr/pbulk/etc/pbulk.list
1.112 rillig 1848: with your list of packages, one per line without empty lines or comments. E.g.:
1.68 asau 1849:
1850: www/firefox
1851: mail/thunderbird
1852: misc/libreoffice4
1853:
1.69 asau 1854: At this point you can also review configuration in /usr/pbulk/etc and make
1855: final amendments, if wanted.
1856:
1.68 asau 1857: Start it:
1858:
1859: # /usr/pbulk/bin/bulkbuild
1860:
1861: After it finishes, you'll have /mnt filled with distribution files, binary
1862: packages, and reports, plain text summary in /mnt/bulklog/meta/report.txt
1863:
1864: Note
1865:
1866: The pbulk.sh script does not cover all possible use cases. While being ready to
1867: run, it serves as a good starting point to understand and build more complex
1868: setups. The script is kept small enough for better understanding.
1869:
1870: Note
1871:
1872: The pbulk.sh script supports running unprivileged bulk build and helps
1.205 wiz 1873: configuring distributed bulk builds. Distributed bulk builds support either
1874: building in worker chroots (each node is a path to a different chroot) that
1875: replicate the target system, including the pbulk prefix, or remote machines
1876: (each node is an IP address that must be accessible over SSH without a
1877: password).
1.15 rillig 1878:
1.154 rillig 1879: 8.3. Requirements of a full bulk build
1.71 wiz 1880:
1881: A complete bulk build requires lots of disk space. Some of the disk space can
1882: be read-only, some other must be writable. Some can be on remote filesystems
1883: (such as NFS) and some should be local. Some can be temporary filesystems,
1884: others must survive a sudden reboot.
1885:
1.205 wiz 1886: * 70 GB for the distfiles (read-write, remote, temporary)
1.71 wiz 1887:
1.205 wiz 1888: * 60 GB for the binary packages (read-write, remote, permanent)
1.71 wiz 1889:
1890: * 1 GB for the pkgsrc tree (read-only, remote, permanent)
1891:
1892: * 5 GB for LOCALBASE (read-write, local, temporary)
1893:
1894: * 10 GB for the log files (read-write, remote, permanent)
1895:
1896: * 5 GB for temporary files (read-write, local, temporary)
1897:
1.178 rillig 1898: 8.4. Bulk build variants
1899:
1900: To ensure that pkgsrc packages work in different configurations, it makes sense
1901: to run non-default bulk builds from time to time. This section lists some ideas
1902: for bulk builds that intentionally let packages fail if they don't follow the
1903: pkgsrc style.
1904:
1.179 rillig 1905: 8.4.1. Detect unknown configure options
1.178 rillig 1906:
1907: Add the following line to mk.conf.
1908:
1909: GNU_CONFIGURE_STRICT= yes
1910:
1911: When a package fails this additional check, the most common cause is that the
1912: configure option was valid for an older version of the package but does not
1913: apply anymore. In that case, just remove it.
1914:
1.179 rillig 1915: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.178 rillig 1916:
1917: The job of a compiler is not restricted to producing executable code, most
1.179 rillig 1918: compilers also detect typical programming mistakes. The pkgsrc compiler
1919: wrappers make it easy to force compiler options when the package is built. This
1920: can be used to find typical bugs across all packages that are in pkgsrc. By
1921: reporting these bugs upstream, the packages will be more reliable with the next
1922: updates.
1.178 rillig 1923:
1.179 rillig 1924: Add some of the following lines to mk.conf:
1.178 rillig 1925:
1926: CFLAGS+= -Werror=char-subscripts
1.179 rillig 1927: CFLAGS+= -Werror=implicit-function-declaration
1.178 rillig 1928:
1.179 rillig 1929: When a package fails to build using these stricter compiler options, document
1930: the circumstances in which the compiler produced the error message. This
1931: includes:
1.178 rillig 1932:
1933: * The platform (MACHINE_PLATFORM)
1934:
1935: * The source file
1936:
1937: * An excerpt of the code. GCC and Clang already do this as part of the
1938: diagnostic.
1939:
1.179 rillig 1940: * The exact error message from the compiler.
1.178 rillig 1941:
1.179 rillig 1942: If a package produces these error messages, but the package is fine, record
1943: this in your local mk.conf, like this, to skip this check in the next builds:
1.178 rillig 1944:
1.179 rillig 1945: .if ${PKGPATH} == category/package
1.178 rillig 1946: # Version ${VERSION} failed on ${MACHINE_PLATFORM}:
1947: # error message
1948: # code
1.179 rillig 1949: # Reason why the code does not need to be fixed.
1.178 rillig 1950: BUILDLINK_TRANSFORM+= rm:-Werror=char-subscripts
1.179 rillig 1951: .endif
1.178 rillig 1952:
1953: If the error messages from the compiler are valid and the code needs to be
1.179 rillig 1954: fixed, prepare a local patch (see LOCALPATCHES) and report the bug to the
1955: upstream authors of the package, providing them with the information you
1956: collected above.
1.178 rillig 1957:
1.179 rillig 1958: Patches that are not essential for the package to work should only be reported
1959: upstream but not committed to pkgsrc, to make future updates easier.
1960:
1.181 rillig 1961: 8.4.3. Force compiler options only in the build phase
1962:
1963: When adding custom compiler flags via CFLAGS, these apply to all phases of the
1964: package build process. Especially in the configure phase, adding -Werror leads
1965: to wrong decisions. The GNU configure scripts feed many small test programs to
1966: the C compiler to see whether certain headers are available, functions are
1967: defined in a library and programs can be run. In many cases these programs
1968: would not survive a strict compiler run with -Wall -Wextra -Werror.
1969:
1970: The pkgsrc infrastructure is flexible enough to support compiler options being
1971: added between the configure and build phases. It's a little more complicated
1972: than the other examples in this section but still easy enough.
1973:
1974: The basic idea is to use the pkgsrc compiler wrapper to inject the desired
1975: compiler options. The compiler wrapper's original task is to hide unwanted
1976: directories of include files and to normalize compiler options. It does this by
1977: wrapping the compiler command and rewriting the command line. To see this in
1978: action, run bmake patch in a package directory and examine the work/.cwrappers/
1979: config directory. It contains individual configurations for the C compiler and
1980: the related tools. The plan is to find a hook between the configure and build
1981: phases, and to modify these configuration files at that point.
1982:
1983: To find this hook, have a look at mk/build/build.mk, which contains among
1984: others the pre-build-checks-hook. The word checks doesn't quite fit, but the
1985: pre-build-hook sounds good enough.
1986:
1987: The code to be included in mk.conf is:
1988:
1989: # Just a few example options.
1990: BUILD_ONLY_CFLAGS= -Wall -Werror -O2 -DTEMPDIR='"/tmp"'
1991:
1992: .if ${BUILD_ONLY_CFLAGS:U:M*}
1993: pre-build-checks-hook: add-build-only-cflags
1994:
1995: add-build-only-cflags: .PHONY
1996: ${RUN} cd ${CWRAPPERS_CONFIG_DIR}; \
1997: ${TEST} ! -f ${.TARGET} || exit 0; \
1998: for flag in ${BUILD_ONLY_CFLAGS}; do \
1999: ${ECHO} "append=$$flag" >> cc; \
2000: done; \
2001: > ${.TARGET}
2002: .endif
2003:
2004: (When editing the mk.conf, make sure that the commands of the
2005: add-build-only-cflags target are indented with a tab, not with spaces.)
2006:
2007: The condition in the .if statement contains the :U modifier to prevent parse
2008: errors if the variable should be undefined, possibly because it is only defined
2009: for a subset of the packages. The :M* modifier ensures that there is at least
2010: one compiler option, to prevent a syntax error in the shell parser.
2011:
2012: The code around the ${.TARGET} variable ensures that the additional compiler
2013: options are only appended once, even if bmake build is run multiple times. To
2014: do this, it creates a marker file.
2015:
2016: To verify that this setup works, run bmake configure in a package directory. Up
2017: to now, everything works as usual. Examine the directory work/.cwrappers/config
2018: to see that the compiler options from BUILD_ONLY_CFLAGS are not yet added to
2019: the file cc. Examine the tail of the work/.work.log file to see that the normal
2020: compiler options are used.
2021:
2022: Now run bmake build. This will append the options to the file cc and will
2023: create the marker file in the same directory. After that, the build starts as
2024: usual, but with the added compiler options. Examine the tail of the file work
2025: /.work.log to see that the lines starting with [*] don't contain the compiler
2026: options, but the corresponding lines starting with <.> do end with these
2027: options.
2028:
2029: Building packages using this setup variant and fixing the resulting bugs is the
2030: same as in Section 8.4.2, "Detect classes of bugs by forcing compiler warnings"
2031: .
2032:
2033: 8.4.4. Use custom directories
1.178 rillig 2034:
2035: Some directories like PREFIX, VARBASE, PKG_SYSCONFDIR, PKGMANDIR, PKG_INFODIR
2036: can be configured in pkgsrc. Set these to arbitrary paths during bootstrap or
2037: afterwards in mk.conf.
2038:
2039: PREFIX= /a-random-uuid
2040: PKG_SYSCONFDIR= /a-random-uuid
2041: VARBASE= /a-random-uuid
2042: PKGMANDIR= a-random-uuid
2043: PKG_INFODIR= a-random-uuid
2044:
1.181 rillig 2045: 8.4.5. Turn warnings into errors
1.178 rillig 2046:
2047: When building a package, warnings are typically ignored since they just flow by
2048: and do not cause the build to fail immediately. To find these warnings,
2049: redefine them to errors in mk.conf.
2050:
2051: DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)"
2052: WARNING_MSG= ${FAIL_MSG} "(was warning)"
2053:
2054: (There are many more classes of warnings in pkgsrc, and most of them can be
2055: redefined with a simple definition like above.
2056:
1.179 rillig 2057: If a package suggests to add USE_TOOLS+=perl to the package Makefile, research
1.178 rillig 2058: whether the package actually needs Perl. If it does, add USE_TOOLS+=perl to the
2059: package Makefile, and if it doesn't, add TOOLS_BROKEN+=perl.
2060:
1.181 rillig 2061: 8.4.6. Reject packages for which pkglint reports errors
1.178 rillig 2062:
2063: Using pkglint as part of the regular build process is mostly a waste of time.
2064: If you want to fix some of the warnings, just run pkglint recursively on the
2065: whole pkgsrc tree. This will take a few minutes (up to 10), which is much
2066: faster than a complete bulk build.
2067:
1.181 rillig 2068: 8.4.7. Reject packages that contain forbidden strings
1.178 rillig 2069:
2070: To ensure that the binary packages don't contain references to the build
2071: directory, there is already CHECK_WRKREF. If that variable includes the item
2072: extra, it is possible to define additional patterns that must not appear in any
2073: installed file. This is specified in mk.conf.
2074:
2075: CHECK_WRKREF= extra
2076: CHECK_WRKREF_EXTRA_DIRS+= /usr/local
2077: CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg
2078: CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@
2079:
2080: The above patterns will probably generate many false positives, therefore the
2081: results need to be taken with a grain of salt.
2082:
1.181 rillig 2083: 8.4.8. Reject packages whose self-test fails
1.178 rillig 2084:
2085: To run the test suites that come with each package, add this line to mk.conf.
2086:
2087: PKGSRC_RUN_TEST= yes
2088:
2089: Be prepared that even the most basic packages fail this test. When doing a bulk
2090: build with this, it will often abort in the early phase where the packages are
2091: scanned for their dependencies since there are cyclic dependencies. There is
2092: still a lot to do in this area.
2093:
1.181 rillig 2094: 8.4.9. Reject packages that use undefined shell variables
1.178 rillig 2095:
2096: To catch typos in the shell snippets from the Makefile fragments, add the -u
2097: flag to most of the commands by adding this line to mk.conf.
2098:
2099: RUN= @set -eu;
2100:
1.181 rillig 2101: After that, ensure that none of the bulk build log files (even those for
2102: successfully built packages) contains the string parameter not set or whatever
2103: error message the command sh -ceu '$undefined' outputs.
2104:
1.178 rillig 2105: See mk/misc/common.mk for the existing definition.
2106:
1.181 rillig 2107: 8.4.10. Turn off verbose logging
1.178 rillig 2108:
2109: The build logs of a package are often quite long. This allows error messages or
2110: other interesting details to hide between the noise. To make the actual error
2111: message stand out more, add these lines to mk.conf.
2112:
2113: GNU_CONFIGURE_QUIET= yes
2114: MAKE_FLAGS+= -s
2115:
2116: The -s option works for both GNU Make and BSD Make. On exotic platforms with
2117: their own make, it may be a little different.
2118:
2119: 8.5. Creating a multiple CD-ROM packages collection
1.1 dsieger 2120:
2121: After your pkgsrc bulk-build has completed, you may wish to create a CD-ROM set
2122: of the resulting binary packages to assist in installing packages on other
2123: machines. The pkgtools/cdpack package provides a simple tool for creating the
2124: ISO 9660 images. cdpack arranges the packages on the CD-ROMs in a way that
2125: keeps all the dependencies for a given package on the same CD as that package.
2126:
1.178 rillig 2127: 8.5.1. Example of cdpack
1.1 dsieger 2128:
2129: Complete documentation for cdpack is found in the cdpack(1) man page. The
2130: following short example assumes that the binary packages are left in /usr/
2131: pkgsrc/packages/All and that sufficient disk space exists in /u2 to hold the
2132: ISO 9660 images.
2133:
2134: # mkdir /u2/images
2135: # pkg_add /usr/pkgsrc/packages/All/cdpack
2136: # cdpack /usr/pkgsrc/packages/All /u2/images
2137:
2138:
2139: If you wish to include a common set of files (COPYRIGHT, README, etc.) on each
2140: CD in the collection, then you need to create a directory which contains these
1.175 gutterid 2141: files, e.g.:
1.1 dsieger 2142:
2143: # mkdir /tmp/common
2144: # echo "This is a README" > /tmp/common/README
2145: # echo "Another file" > /tmp/common/COPYING
2146: # mkdir /tmp/common/bin
2147: # echo "#!/bin/sh" > /tmp/common/bin/myscript
2148: # echo "echo Hello world" >> /tmp/common/bin/myscript
2149: # chmod 755 /tmp/common/bin/myscript
2150:
2151:
2152: Now create the images:
2153:
2154: # cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images
2155:
2156: Each image will contain README, COPYING, and bin/myscript in their root
2157: directories.
2158:
1.154 rillig 2159: Chapter 9. Directory layout of the installed files
1.1 dsieger 2160:
2161: Table of Contents
2162:
1.154 rillig 2163: 9.1. File system layout in ${LOCALBASE}
2164: 9.2. File system layout in ${VARBASE}
1.1 dsieger 2165:
2166: The files that are installed by pkgsrc are organized in a way that is similar
2167: to what you find in the /usr directory of the base system. But some details are
2168: different. This is because pkgsrc initially came from FreeBSD and had adopted
2169: its file system hierarchy. Later it was largely influenced by NetBSD. But no
2170: matter which operating system you are using pkgsrc with, you can expect the
2171: same layout for pkgsrc.
2172:
2173: There are mainly four root directories for pkgsrc, which are all configurable
2174: in the bootstrap/bootstrap script. When pkgsrc has been installed as root, the
2175: default locations are:
2176:
2177: LOCALBASE= /usr/pkg
2178: PKG_SYSCONFBASE= /usr/pkg/etc
2179: VARBASE= /var
1.119 sevan 2180: PKG_DBDIR= /usr/pkg/pkgdb
1.1 dsieger 2181:
2182: In unprivileged mode (when pkgsrc has been installed as any other user), the
2183: default locations are:
2184:
2185: LOCALBASE= ${HOME}/pkg
2186: PKG_SYSCONFBASE= ${HOME}/pkg/etc
2187: VARBASE= ${HOME}/pkg/var
1.119 sevan 2188: PKG_DBDIR= ${HOME}/pkg/pkgdb
1.1 dsieger 2189:
2190: What these four directories are for, and what they look like is explained
2191: below.
2192:
1.25 wiz 2193: * LOCALBASE corresponds to the /usr directory in the base system. It is the "
2194: main" directory where the files are installed and contains the well-known
1.1 dsieger 2195: subdirectories like bin, include, lib, share and sbin.
2196:
2197: * VARBASE corresponds to /var in the base system. Some programs (especially
2198: games, network daemons) need write access to it during normal operation.
2199:
2200: * PKG_SYSCONFDIR corresponds to /etc in the base system. It contains
2201: configuration files of the packages, as well as pkgsrc's mk.conf itself.
2202:
1.154 rillig 2203: 9.1. File system layout in ${LOCALBASE}
1.1 dsieger 2204:
2205: The following directories exist in a typical pkgsrc installation in $
2206: {LOCALBASE}.
2207:
2208: bin
2209:
2210: Contains executable programs that are intended to be directly used by the
2211: end user.
2212:
2213: emul
2214:
2215: Contains files for the emulation layers of various other operating systems,
2216: especially for NetBSD.
2217:
2218: etc (the usual location of ${PKG_SYSCONFDIR})
2219:
2220: Contains the configuration files.
2221:
2222: include
2223:
2224: Contains headers for the C and C++ programming languages.
2225:
2226: info
2227:
2228: Contains GNU info files of various packages.
2229:
2230: lib
2231:
2232: Contains shared and static libraries.
2233:
2234: libdata
2235:
2236: Contains data files that don't change after installation. Other data files
2237: belong into ${VARBASE}.
2238:
2239: libexec
2240:
2241: Contains programs that are not intended to be used by end users, such as
2242: helper programs or network daemons.
2243:
2244: libexec/cgi-bin
2245:
2246: Contains programs that are intended to be executed as CGI scripts by a web
2247: server.
2248:
2249: man (the usual value of ${PKGMANDIR})
2250:
2251: Contains brief documentation in form of manual pages.
2252:
2253: sbin
2254:
2255: Contains programs that are intended to be used only by the super-user.
2256:
2257: share
2258:
2259: Contains platform-independent data files that don't change after
2260: installation.
2261:
2262: share/doc
2263:
2264: Contains documentation files provided by the packages.
2265:
2266: share/examples
2267:
2268: Contains example files provided by the packages. Among others, the original
2269: configuration files are saved here and copied to ${PKG_SYSCONFDIR} during
2270: installation.
2271:
2272: share/examples/rc.d
2273:
2274: Contains the original files for rc.d scripts.
2275:
2276: var (the usual location of ${VARBASE})
2277:
2278: Contains files that may be modified after installation.
2279:
1.154 rillig 2280: 9.2. File system layout in ${VARBASE}
1.1 dsieger 2281:
2282: db/pkg (the usual location of ${PKG_DBDIR})
2283:
2284: Contains information about the currently installed packages.
2285:
2286: games
2287:
2288: Contains highscore files.
2289:
2290: log
2291:
2292: Contains log files.
2293:
2294: run
2295:
2296: Contains informational files about daemons that are currently running.
2297:
1.154 rillig 2298: Chapter 10. Frequently Asked Questions
1.1 dsieger 2299:
2300: Table of Contents
2301:
1.154 rillig 2302: 10.1. Are there any mailing lists for pkg-related discussion?
2303: 10.2. Utilities for package management (pkgtools)
2304: 10.3. How to use pkgsrc as non-root
2305: 10.4. How to resume transfers when fetching distfiles?
2306: 10.5. How can I install/use modular X.org from pkgsrc?
2307: 10.6. How to fetch files from behind a firewall
2308: 10.7. How to fetch files from HTTPS sites
2309: 10.8. How do I tell make fetch to do passive FTP?
2310: 10.9. How to fetch all distfiles at once
2311: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
2312: 10.11. What does "Could not find bsd.own.mk" mean?
2313: 10.12. Using 'sudo' with pkgsrc
2314: 10.13. How do I change the location of configuration files?
2315: 10.14. Automated security checks
2316: 10.15. Why do some packages ignore my CFLAGS?
2317: 10.16. A package does not build. What shall I do?
2318: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.24 wiz 2319: conflicts" mean?
1.1 dsieger 2320:
2321: This section contains hints, tips & tricks on special things in pkgsrc that we
2322: didn't find a better place for in the previous chapters, and it contains items
2323: for both pkgsrc users and developers.
2324:
1.154 rillig 2325: 10.1. Are there any mailing lists for pkg-related discussion?
1.1 dsieger 2326:
2327: The following mailing lists may be of interest to pkgsrc users:
2328:
2329: * pkgsrc-users: This is a general purpose list for most issues regarding
2330: pkgsrc, regardless of platform, e.g. soliciting user help for pkgsrc
2331: configuration, unexpected build failures, using particular packages,
2332: upgrading pkgsrc installations, questions regarding the pkgsrc release
2333: branches, etc. General announcements or proposals for changes that impact
2334: the pkgsrc user community, e.g. major infrastructure changes, new features,
2335: package removals, etc., may also be posted.
2336:
2337: * pkgsrc-bulk: A list where the results of pkgsrc bulk builds are sent and
2338: discussed.
2339:
2340: * pkgsrc-changes: This list is for those who are interested in getting a
2341: commit message for every change committed to pkgsrc. It is also available
2342: in digest form, meaning one daily message containing all commit messages
2343: for changes to the package source tree in that 24 hour period.
2344:
2345: To subscribe, do:
2346:
2347: % echo subscribe listname | mail majordomo@NetBSD.org
2348:
1.174 leot 2349: Archives for all these mailing lists are available from https://
1.1 dsieger 2350: mail-index.NetBSD.org/.
2351:
1.154 rillig 2352: 10.2. Utilities for package management (pkgtools)
1.1 dsieger 2353:
2354: The directory pkgsrc/pkgtools contains a number of useful utilities for both
2355: users and developers of pkgsrc. This section attempts only to make the reader
1.121 sevan 2356: aware of some of the utilities and when they might be useful, and not to
2357: duplicate the documentation that comes with each package.
1.1 dsieger 2358:
2359: Utilities used by pkgsrc (automatically installed when needed):
2360:
2361: * pkgtools/x11-links: Symlinks for use by buildlink.
2362:
2363: OS tool augmentation (automatically installed when needed):
2364:
1.121 sevan 2365: * pkgtools/digest: Calculates various kinds of checksums (including SHA3).
1.1 dsieger 2366:
2367: * pkgtools/libnbcompat: Compatibility library for pkgsrc tools.
2368:
2369: * pkgtools/mtree: Installed on non-BSD systems due to lack of native mtree.
2370:
2371: * pkgtools/pkg_install: Up-to-date replacement for /usr/sbin/pkg_install, or
2372: for use on operating systems where pkg_install is not present.
2373:
2374: Utilities used by pkgsrc (not automatically installed):
2375:
2376: * pkgtools/pkg_tarup: Create a binary package from an already-installed
2377: package. Used by make replace to save the old package.
2378:
2379: * pkgtools/dfdisk: Adds extra functionality to pkgsrc, allowing it to fetch
2380: distfiles from multiple locations. It currently supports the following
2381: methods: multiple CD-ROMs and network FTP/HTTP connections.
2382:
2383: * devel/cpuflags: Determine the best compiler flags to optimise code for your
1.24 wiz 2384: current CPU and compiler.
1.1 dsieger 2385:
2386: Utilities for keeping track of installed packages, being up to date, etc:
2387:
1.65 wiz 2388: * pkgtools/pkgin: A package update tool similar to apt(1). Download, install,
2389: and upgrade binary packages easily.
2390:
1.1 dsieger 2391: * pkgtools/pkg_chk: Reports on packages whose installed versions do not match
2392: the latest pkgsrc entries.
2393:
2394: * pkgtools/pkgdep: Makes dependency graphs of packages, to aid in choosing a
2395: strategy for updating.
2396:
2397: * pkgtools/pkgdepgraph: Makes graphs from the output of pkgtools/pkgdep (uses
2398: graphviz).
2399:
1.12 weinem 2400: * pkgtools/pkglint: The pkglint(1) program checks a pkgsrc entry for errors.
2401:
2402: * pkgtools/lintpkgsrc: The lintpkgsrc(1) program does various checks on the
2403: complete pkgsrc system.
1.1 dsieger 2404:
2405: * pkgtools/pkgsurvey: Report what packages you have installed.
2406:
2407: Utilities for people maintaining or creating individual packages:
2408:
2409: * pkgtools/pkgdiff: Automate making and maintaining patches for a package
2410: (includes pkgdiff, pkgvi, mkpatches, etc.).
2411:
1.65 wiz 2412: * pkgtools/url2pkg: Aids in converting to pkgsrc.
1.1 dsieger 2413:
2414: Utilities for people maintaining pkgsrc (or: more obscure pkg utilities)
2415:
2416: * pkgtools/pkg_comp: Build packages in a chrooted area.
2417:
2418: * pkgtools/libkver: Spoof kernel version for chrooted cross builds.
2419:
1.154 rillig 2420: 10.3. How to use pkgsrc as non-root
1.1 dsieger 2421:
1.108 rillig 2422: To install packages from source as a non-root user, download pkgsrc as
1.154 rillig 2423: described in Chapter 3, Where to get pkgsrc and how to keep it up-to-date, cd
1.108 rillig 2424: into that directory and run the command ./bootstrap/bootstrap --unprivileged.
2425:
2426: This will install the binary part of pkgsrc to ~/pkg and put the pkgsrc
2427: configuration mk.conf into ~/pkg/etc.
2428:
2429: For more details, see mk/unprivileged.mk.
1.1 dsieger 2430:
1.154 rillig 2431: 10.4. How to resume transfers when fetching distfiles?
1.1 dsieger 2432:
2433: By default, resuming transfers in pkgsrc is disabled, but you can enable this
1.4 rillig 2434: feature by adding the option PKG_RESUME_TRANSFERS=YES into mk.conf. If, during
2435: a fetch step, an incomplete distfile is found, pkgsrc will try to resume it.
1.1 dsieger 2436:
1.61 wiz 2437: You can also use a different program than the platform default program by
2438: changing the FETCH_USING variable. You can specify the program by using of ftp,
2439: fetch, wget or curl. Alternatively, fetching can be disabled by using the value
2440: manual. A value of custom disables the system defaults and dependency tracking
2441: for the fetch program. In that case you have to provide FETCH_CMD,
2442: FETCH_BEFORE_ARGS, FETCH_RESUME_ARGS, FETCH_OUTPUT_ARGS, FETCH_AFTER_ARGS.
1.1 dsieger 2443:
1.16 jnemeth 2444: For example, if you want to use wget to download, you'll have to use something
2445: like:
1.1 dsieger 2446:
1.16 jnemeth 2447: FETCH_USING= wget
1.1 dsieger 2448:
1.154 rillig 2449: 10.5. How can I install/use modular X.org from pkgsrc?
1.1 dsieger 2450:
1.4 rillig 2451: If you want to use modular X.org from pkgsrc instead of your system's own X11
2452: (/usr/X11R6, /usr/openwin, ...) you will have to add the following line into
1.1 dsieger 2453: mk.conf:
2454:
1.4 rillig 2455: X11_TYPE=modular
1.1 dsieger 2456:
1.154 rillig 2457: 10.6. How to fetch files from behind a firewall
1.1 dsieger 2458:
2459: If you are sitting behind a firewall which does not allow direct connections to
2460: Internet hosts (i.e. non-NAT), you may specify the relevant proxy hosts. This
2461: is done using an environment variable in the form of a URL, e.g. in Amdahl, the
2462: machine "orpheus.amdahl.com" is one of the firewalls, and it uses port 80 as
2463: the proxy port number. So the proxy environment variables are:
2464:
2465: ftp_proxy=ftp://orpheus.amdahl.com:80/
2466: http_proxy=http://orpheus.amdahl.com:80/
2467:
1.154 rillig 2468: 10.7. How to fetch files from HTTPS sites
1.65 wiz 2469:
2470: Some fetch tools are not prepared to support HTTPS by default (for example, the
2471: one in NetBSD 6.0), or the one installed by the pkgsrc bootstrap (to avoid an
2472: openssl dependency that low in the dependency graph).
2473:
2474: Usually you won't notice, because distribution files are mirrored weekly to "
2475: ftp.NetBSD.org", but that might not be often enough if you are following
2476: pkgsrc-current. In that case, set FETCH_USING in your mk.conf file to "curl" or
2477: "wget", which are both compiled with HTTPS support by default. Of course, these
2478: tools need to be installed before you can use them this way.
2479:
1.154 rillig 2480: 10.8. How do I tell make fetch to do passive FTP?
1.1 dsieger 2481:
2482: This depends on which utility is used to retrieve distfiles. From bsd.pkg.mk,
2483: FETCH_CMD is assigned the first available command from the following list:
2484:
2485: * ${LOCALBASE}/bin/ftp
2486:
2487: * /usr/bin/ftp
2488:
2489: On a default NetBSD installation, this will be /usr/bin/ftp, which
2490: automatically tries passive connections first, and falls back to active
2491: connections if the server refuses to do passive. For the other tools, add the
1.4 rillig 2492: following to your mk.conf file: PASSIVE_FETCH=1.
1.1 dsieger 2493:
2494: Having that option present will prevent /usr/bin/ftp from falling back to
2495: active transfers.
2496:
1.154 rillig 2497: 10.9. How to fetch all distfiles at once
1.1 dsieger 2498:
2499: You would like to download all the distfiles in a single batch from work or
2500: university, where you can't run a make fetch. There is an archive of distfiles
2501: on ftp.NetBSD.org, but downloading the entire directory may not be appropriate.
2502:
2503: The answer here is to do a make fetch-list in /usr/pkgsrc or one of its
2504: subdirectories, carry the resulting list to your machine at work/school and use
2505: it there. If you don't have a NetBSD-compatible ftp(1) (like tnftp) at work,
2506: don't forget to set FETCH_CMD to something that fetches a URL:
2507:
2508: At home:
2509:
2510: % cd /usr/pkgsrc
2511: % make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh
2512: % scp /tmp/fetch.sh work:/tmp
2513:
2514: At work:
2515:
2516: % sh /tmp/fetch.sh
2517:
2518: then tar up /tmp/distfiles and take it home.
2519:
2520: If you have a machine running NetBSD, and you want to get all distfiles (even
2521: ones that aren't for your machine architecture), you can do so by using the
2522: above-mentioned make fetch-list approach, or fetch the distfiles directly by
2523: running:
2524:
2525: % make mirror-distfiles
2526:
2527: If you even decide to ignore NO_{SRC,BIN}_ON_{FTP,CDROM}, then you can get
2528: everything by running:
2529:
2530: % make fetch NO_SKIP=yes
2531:
1.154 rillig 2532: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
1.1 dsieger 2533:
2534: When compiling the pkgtools/pkg_install package, you get the error from make
2535: that it doesn't know how to make /usr/share/tmac/tmac.andoc? This indicates
2536: that you don't have installed the "text" set (nroff, ...) from the NetBSD base
2537: distribution on your machine. It is recommended to do that to format man pages.
2538:
2539: In the case of the pkgtools/pkg_install package, you can get away with setting
1.4 rillig 2540: NOMAN=YES either in the environment or in mk.conf.
1.1 dsieger 2541:
1.154 rillig 2542: 10.11. What does "Could not find bsd.own.mk" mean?
1.1 dsieger 2543:
2544: You didn't install the compiler set, comp.tgz, when you installed your NetBSD
2545: machine. Please get and install it, by extracting it in /:
2546:
2547: # cd /
2548: # tar --unlink -zxvpf .../comp.tgz
2549:
2550: comp.tgz is part of every NetBSD release. Get the one that corresponds to your
2551: release (determine via uname -r).
2552:
1.154 rillig 2553: 10.12. Using 'sudo' with pkgsrc
1.1 dsieger 2554:
2555: When installing packages as non-root user and using the just-in-time su(1)
2556: feature of pkgsrc, it can become annoying to type in the root password for each
2557: required package installed. To avoid this, the sudo package can be used, which
2558: does password caching over a limited time. To use it, install sudo (either as
1.4 rillig 2559: binary package or from security/sudo) and then put the following into your
2560: mk.conf, somewhere after the definition of the LOCALBASE variable:
1.1 dsieger 2561:
2562: .if exists(${LOCALBASE}/bin/sudo)
2563: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
2564: .endif
2565:
1.154 rillig 2566: 10.13. How do I change the location of configuration files?
1.1 dsieger 2567:
2568: As the system administrator, you can choose where configuration files are
2569: installed. The default settings make all these files go into ${PREFIX}/etc or
2570: some of its subdirectories; this may be suboptimal depending on your
2571: expectations (e.g., a read-only, NFS-exported PREFIX with a need of per-machine
2572: configuration of the provided packages).
2573:
2574: In order to change the defaults, you can modify the PKG_SYSCONFBASE variable
1.4 rillig 2575: (in mk.conf) to point to your preferred configuration directory; some common
2576: examples include /etc or /etc/pkg.
1.1 dsieger 2577:
2578: Furthermore, you can change this value on a per-package basis by setting the
2579: PKG_SYSCONFDIR.${PKG_SYSCONFVAR} variable. PKG_SYSCONFVAR's value usually
2580: matches the name of the package you would like to modify, that is, the contents
2581: of PKGBASE.
2582:
2583: Note that after changing these settings, you must rebuild and reinstall any
2584: affected packages.
2585:
1.154 rillig 2586: 10.14. Automated security checks
1.1 dsieger 2587:
2588: Please be aware that there can often be bugs in third-party software, and some
2589: of these bugs can leave a machine vulnerable to exploitation by attackers. In
2590: an effort to lessen the exposure, the NetBSD packages team maintains a database
2591: of known-exploits to packages which have at one time been included in pkgsrc.
2592: The database can be downloaded automatically, and a security audit of all
1.14 jmcneill 2593: packages installed on a system can take place. To do this, refer to the
2594: following two tools (installed as part of the pkgtools/pkg_install package):
1.1 dsieger 2595:
1.21 snj 2596: 1. pkg_admin fetch-pkg-vulnerabilities, an easy way to download a list of the
2597: security vulnerabilities information. This list is kept up to date by the
1.26 spz 2598: pkgsrc security team, and is distributed from the NetBSD ftp server:
1.1 dsieger 2599:
1.177 leot 2600: https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities
1.1 dsieger 2601:
1.21 snj 2602: 2. pkg_admin audit, an easy way to audit the current machine, checking each
1.24 wiz 2603: known vulnerability. If a vulnerable package is installed, it will be shown
2604: by output to stdout, including a description of the type of vulnerability,
2605: and a URL containing more information.
1.1 dsieger 2606:
1.202 nia 2607: Use of these tools is strongly recommended! See Section 5.1.6, "Checking for
1.121 sevan 2608: security vulnerabilities in installed packages" for instructions on how to
2609: automate checking and reporting.
2610:
2611: If this database is installed, pkgsrc builds will use it to perform a security
2612: check before building any package.
1.1 dsieger 2613:
1.154 rillig 2614: 10.15. Why do some packages ignore my CFLAGS?
1.1 dsieger 2615:
2616: When you add your own preferences to the CFLAGS variable in your mk.conf, these
2617: flags are passed in environment variables to the ./configure scripts and to
2618: make(1). Some package authors ignore the CFLAGS from the environment variable
2619: by overriding them in the Makefiles of their package.
2620:
2621: Currently there is no solution to this problem. If you really need the package
2622: to use your CFLAGS you should run make patch in the package directory and then
2623: inspect any Makefile and Makefile.in for whether they define CFLAGS explicitly.
2624: Usually you can remove these lines. But be aware that some "smart" programmers
2625: write so bad code that it only works for the specific combination of CFLAGS
2626: they have chosen.
2627:
1.172 rillig 2628: To find out where the CFLAGS are ignored, add the following lines to mk.conf:
2629:
2630: CPPFLAGS+= -Dpkgsrc___CPPFLAGS
2631: CFLAGS+= -Dpkgsrc___CFLAGS
2632: CXXFLAGS+= -Dpkgsrc___CXXFLAGS
2633:
2634: Then run bmake show-all-configure show-all-build to see whether the above flags
2635: are passed to the actual build commands in general.
2636:
2637: To find out whether the flags are passed to individual compiler commands, have
2638: a look at the file work/.work.log. In most cases, the flags from the original
2639: command lines (the lines starting with [*]) are passed unmodified to the actual
2640: compiler (the lines starting with <.>). If the flag is missing from the actual
2641: compiler command, it must have been removed by the pkgsrc compiler wrappers.
2642:
1.154 rillig 2643: 10.16. A package does not build. What shall I do?
1.1 dsieger 2644:
2645: 1. Make sure that your copy of pkgsrc is consistent. A case that occurs often
2646: is that people only update pkgsrc in parts, because of performance reasons.
2647: Since pkgsrc is one large system, not a collection of many small systems,
2648: there are sometimes changes that only work when the whole pkgsrc tree is
2649: updated.
2650:
1.25 wiz 2651: 2. Make sure that you don't have any CVS conflicts. Search for "<<<<<<" or "
2652: >>>>>>" in all your pkgsrc files.
1.1 dsieger 2653:
1.25 wiz 2654: 3. Make sure that you don't have old copies of the packages extracted. Run
1.1 dsieger 2655: make clean clean-depends to verify this.
2656:
1.108 rillig 2657: 4. If you are a package developer who wants to invest some work, have a look
1.154 rillig 2658: at Chapter 21, Making your package work.
1.108 rillig 2659:
2660: 5. If the problem still exists, write a mail to the pkgsrc-users mailing list.
1.1 dsieger 2661:
1.154 rillig 2662: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.1 dsieger 2663: conflicts" mean?
2664:
2665: You have modified a file from pkgsrc, and someone else has modified that same
2666: file afterwards in the CVS repository. Both changes are in the same region of
2667: the file, so when you updated pkgsrc, the cvs command marked the conflicting
2668: changes in the file. Because of these markers, the file is no longer a valid
2669: Makefile.
2670:
2671: Have a look at that file, and if you don't need your local changes anymore, you
2672: can remove that file and run cvs -q update -dP in that directory to download
2673: the current version.
2674:
2675: Part II. The pkgsrc developer's guide
2676:
2677: This part of the book deals with creating and modifying packages. It starts
2678: with a "HOWTO"-like guide on creating a new package. The remaining chapters are
2679: more like a reference manual for pkgsrc.
2680:
2681: Table of Contents
2682:
1.154 rillig 2683: 11. Getting help
1.184 rillig 2684: 12. Package components - files, directories and contents
1.1 dsieger 2685:
1.184 rillig 2686: 12.1. Makefile
2687: 12.2. distinfo
2688: 12.3. patches/*
1.1 dsieger 2689:
1.184 rillig 2690: 12.3.1. Structure of a single patch file
2691: 12.3.2. Creating patch files
2692: 12.3.3. Sources where the patch files come from
2693: 12.3.4. Patching guidelines
2694: 12.3.5. Feedback to the author
1.1 dsieger 2695:
1.184 rillig 2696: 12.4. Other mandatory files
2697: 12.5. Optional files
1.1 dsieger 2698:
1.184 rillig 2699: 12.5.1. Files affecting the binary package
2700: 12.5.2. Files affecting the build process
2701: 12.5.3. Files affecting nothing at all
1.1 dsieger 2702:
1.184 rillig 2703: 12.6. work*
2704: 12.7. files/*
1.1 dsieger 2705:
1.184 rillig 2706: 13. The build process
1.1 dsieger 2707:
1.184 rillig 2708: 13.1. Introduction
2709: 13.2. Program location
2710: 13.3. Directories used during the build process
2711: 13.4. Running a phase
2712: 13.5. The fetch phase
1.1 dsieger 2713:
1.184 rillig 2714: 13.5.1. What to fetch and where to get it from
2715: 13.5.2. How are the files fetched?
1.1 dsieger 2716:
1.184 rillig 2717: 13.6. The checksum phase
2718: 13.7. The extract phase
2719: 13.8. The patch phase
2720: 13.9. The tools phase
2721: 13.10. The wrapper phase
2722: 13.11. The configure phase
2723: 13.12. The build phase
2724: 13.13. The test phase
2725: 13.14. The install phase
2726: 13.15. The package phase
2727: 13.16. Cleaning up
2728: 13.17. Other helpful targets
1.1 dsieger 2729:
1.184 rillig 2730: 14. Creating a new pkgsrc package from scratch
1.1 dsieger 2731:
1.184 rillig 2732: 14.1. Common types of packages
1.1 dsieger 2733:
1.184 rillig 2734: 14.1.1. Perl modules
2735: 14.1.2. Python modules and programs
2736: 14.1.3. R packages
2737: 14.1.4. TeXlive packages
1.1 dsieger 2738:
1.184 rillig 2739: 14.2. Examples
1.1 dsieger 2740:
1.184 rillig 2741: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 2742:
1.184 rillig 2743: 15. Programming in Makefiles
1.1 dsieger 2744:
1.184 rillig 2745: 15.1. Caveats
2746: 15.2. Makefile variables
1.1 dsieger 2747:
1.184 rillig 2748: 15.2.1. Naming conventions
1.1 dsieger 2749:
1.184 rillig 2750: 15.3. Code snippets
1.1 dsieger 2751:
1.184 rillig 2752: 15.3.1. Adding things to a list
2753: 15.3.2. Echoing a string exactly as-is
2754: 15.3.3. Passing CFLAGS to GNU configure scripts
2755: 15.3.4. Handling possibly empty variables
1.1 dsieger 2756:
1.184 rillig 2757: 16. Options handling
1.1 dsieger 2758:
1.184 rillig 2759: 16.1. Global default options
2760: 16.2. Converting packages to use bsd.options.mk
2761: 16.3. Option Names
2762: 16.4. Determining the options of dependencies
1.1 dsieger 2763:
1.184 rillig 2764: 17. Tools needed for building or running
1.1 dsieger 2765:
1.184 rillig 2766: 17.1. Tools for pkgsrc builds
2767: 17.2. Tools needed by packages
2768: 17.3. Tools provided by platforms
1.1 dsieger 2769:
1.184 rillig 2770: 18. Buildlink methodology
1.1 dsieger 2771:
1.184 rillig 2772: 18.1. Converting packages to use buildlink3
2773: 18.2. Writing buildlink3.mk files
1.1 dsieger 2774:
1.184 rillig 2775: 18.2.1. Anatomy of a buildlink3.mk file
2776: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.
2777: pkg in buildlink3.mk files
1.1 dsieger 2778:
1.184 rillig 2779: 18.3. Writing builtin.mk files
1.1 dsieger 2780:
1.184 rillig 2781: 18.3.1. Anatomy of a builtin.mk file
2782: 18.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 2783:
1.184 rillig 2784: 19. PLIST issues
1.1 dsieger 2785:
1.184 rillig 2786: 19.1. RCS ID
2787: 19.2. Semi-automatic PLIST generation
2788: 19.3. Tweaking output of make print-PLIST
2789: 19.4. Variable substitution in PLIST
2790: 19.5. Man page compression
2791: 19.6. Changing PLIST source with PLIST_SRC
2792: 19.7. Platform-specific and differing PLISTs
2793: 19.8. Build-specific PLISTs
2794: 19.9. Sharing directories between packages
1.1 dsieger 2795:
1.184 rillig 2796: 20. The pkginstall framework
1.1 dsieger 2797:
1.184 rillig 2798: 20.1. Files and directories outside the installation prefix
1.1 dsieger 2799:
1.184 rillig 2800: 20.1.1. Directory manipulation
2801: 20.1.2. File manipulation
1.1 dsieger 2802:
1.184 rillig 2803: 20.2. Configuration files
1.1 dsieger 2804:
1.184 rillig 2805: 20.2.1. How PKG_SYSCONFDIR is set
2806: 20.2.2. Telling the software where configuration files are
2807: 20.2.3. Patching installations
2808: 20.2.4. Disabling handling of configuration files
1.1 dsieger 2809:
1.184 rillig 2810: 20.3. System startup scripts
1.1 dsieger 2811:
1.184 rillig 2812: 20.3.1. Disabling handling of system startup scripts
1.1 dsieger 2813:
1.184 rillig 2814: 20.4. System users and groups
2815: 20.5. System shells
1.1 dsieger 2816:
1.184 rillig 2817: 20.5.1. Disabling shell registration
1.1 dsieger 2818:
1.184 rillig 2819: 20.6. Fonts
1.1 dsieger 2820:
1.184 rillig 2821: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 2822:
1.154 rillig 2823: 21. Making your package work
1.1 dsieger 2824:
1.154 rillig 2825: 21.1. General operation
1.1 dsieger 2826:
1.154 rillig 2827: 21.1.1. How to pull in user-settable variables from mk.conf
2828: 21.1.2. User interaction
2829: 21.1.3. Handling licenses
2830: 21.1.4. Restricted packages
2831: 21.1.5. Handling dependencies
2832: 21.1.6. Handling conflicts with other packages
2833: 21.1.7. Packages that cannot or should not be built
2834: 21.1.8. Packages which should not be deleted, once installed
2835: 21.1.9. Handling packages with security problems
2836: 21.1.10. How to handle incrementing versions when fixing an existing
1.1 dsieger 2837: package
1.154 rillig 2838: 21.1.11. Substituting variable text in the package files (the SUBST
1.1 dsieger 2839: framework)
2840:
1.154 rillig 2841: 21.2. The fetch phase
1.1 dsieger 2842:
1.154 rillig 2843: 21.2.1. Packages whose distfiles aren't available for plain downloading
2844: 21.2.2. How to handle modified distfiles with the 'old' name
2845: 21.2.3. Packages hosted on github.com
2846:
2847: 21.3. The configure phase
2848:
2849: 21.3.1. Shared libraries - libtool
2850: 21.3.2. Using libtool on GNU packages that already support libtool
2851: 21.3.3. GNU Autoconf/Automake
2852:
2853: 21.4. Programming languages
2854:
2855: 21.4.1. C, C++, and Fortran
2856: 21.4.2. Java
1.205 wiz 2857: 21.4.3. Go
2858: 21.4.4. Packages containing Perl scripts
2859: 21.4.5. Packages containing shell scripts
2860: 21.4.6. Other programming languages
1.154 rillig 2861:
2862: 21.5. The build phase
2863:
2864: 21.5.1. Compiling C and C++ code conditionally
2865: 21.5.2. How to handle compiler bugs
1.172 rillig 2866: 21.5.3. No such file or directory
2867: 21.5.4. Undefined reference to "..."
2868: 21.5.5. Running out of memory
1.154 rillig 2869:
2870: 21.6. The install phase
2871:
2872: 21.6.1. Creating needed directories
2873: 21.6.2. Where to install documentation
2874: 21.6.3. Installing highscore files
2875: 21.6.4. Adding DESTDIR support to packages
2876: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 2877: 21.6.6. Packages installing Perl modules
1.154 rillig 2878: 21.6.7. Packages installing info files
2879: 21.6.8. Packages installing man pages
1.203 nia 2880: 21.6.9. Packages installing X11 fonts
2881: 21.6.10. Packages installing SGML or XML data
2882: 21.6.11. Packages installing extensions to the MIME database
2883: 21.6.12. Packages using intltool
2884: 21.6.13. Packages installing startup scripts
2885: 21.6.14. Packages installing TeX modules
2886: 21.6.15. Packages supporting running binaries in emulation
2887: 21.6.16. Packages installing hicolor icons
2888: 21.6.17. Packages installing desktop files
1.154 rillig 2889:
2890: 21.7. Marking packages as having problems
2891:
1.184 rillig 2892: 22. GNOME packaging and porting
2893:
2894: 22.1. Meta packages
2895: 22.2. Packaging a GNOME application
2896: 22.3. Updating GNOME to a newer version
2897: 22.4. Patching guidelines
2898:
1.154 rillig 2899: 23. Submitting and Committing
2900:
2901: 23.1. Submitting binary packages
2902: 23.2. Submitting source packages (for non-NetBSD-developers)
2903: 23.3. General notes when adding, updating, or removing packages
2904: 23.4. Commit Messages
2905: 23.5. Committing: Adding a package to CVS
2906: 23.6. Updating a package to a newer version
2907: 23.7. Renaming a package in pkgsrc
2908: 23.8. Moving a package in pkgsrc
2909:
2910: 24. Frequently Asked Questions
2911:
2912: Chapter 11. Getting help
2913:
2914: To get help when developing pkgsrc, the definitive source is this document, the
2915: pkgsrc guide. If you don't find anything here, there are alternatives:
2916:
2917: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
2918: Run bmake help topic=? to get help for any topic, such as a variable name
2919: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
2920: like strcasecmp or any other topic.
2921:
1.207 leot 2922: The available help topics are listed in Appendix E, Help topics.
1.154 rillig 2923:
1.163 rillig 2924: * To see the value of a single variable, run bmake show-var VARNAME=X.
2925:
2926: * To see the values of the most common variables, run bmake show-all. These
2927: variables are grouped by topic. To see the variables for a single topic,
2928: run bmake show-all-topic, for example bmake show-all-fetch.
2929:
1.154 rillig 2930: * The tech-pkg mailing list, to which you can subscribe and then ask your
2931: questions.
2932:
2933: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
2934: a specialized chat program such as XChat. Pick any user name and join the
2935: channel #pkgsrc.
1.1 dsieger 2936:
1.184 rillig 2937: Chapter 12. Package components - files, directories and contents
1.1 dsieger 2938:
2939: Table of Contents
2940:
1.184 rillig 2941: 12.1. Makefile
2942: 12.2. distinfo
2943: 12.3. patches/*
2944:
2945: 12.3.1. Structure of a single patch file
2946: 12.3.2. Creating patch files
2947: 12.3.3. Sources where the patch files come from
2948: 12.3.4. Patching guidelines
2949: 12.3.5. Feedback to the author
2950:
2951: 12.4. Other mandatory files
2952: 12.5. Optional files
2953:
2954: 12.5.1. Files affecting the binary package
2955: 12.5.2. Files affecting the build process
2956: 12.5.3. Files affecting nothing at all
1.1 dsieger 2957:
1.184 rillig 2958: 12.6. work*
2959: 12.7. files/*
1.1 dsieger 2960:
1.184 rillig 2961: Whenever you're preparing a package, there are a number of files involved which
2962: are described in the following sections.
1.1 dsieger 2963:
1.184 rillig 2964: 12.1. Makefile
1.1 dsieger 2965:
1.184 rillig 2966: Building, installation and creation of a binary package are all controlled by
2967: the package's Makefile. The Makefile describes various things about a package,
2968: for example from where to get it, how to configure, build, and install it.
1.1 dsieger 2969:
1.184 rillig 2970: A package Makefile contains several sections that describe the package.
1.1 dsieger 2971:
1.184 rillig 2972: In the first section there are the following variables, which should appear
2973: exactly in the order given here. The order and grouping of the variables is
2974: mostly historical and has no further meaning.
1.1 dsieger 2975:
1.184 rillig 2976: * DISTNAME is the basename of the distribution file to be downloaded from the
2977: package's website.
1.1 dsieger 2978:
1.184 rillig 2979: * PKGNAME is the name of the package, as used by pkgsrc. You need to provide
2980: it if DISTNAME (which is the default) is not a good name for the package in
2981: pkgsrc or DISTNAME is not provided (no distribution file is required).
2982: Usually it is the pkgsrc directory name together with the version number.
2983: It must match the regular expression ^[A-Za-z0-9][A-Za-z0-9-_.+]*$, that
2984: is, it starts with a letter or digit, and contains only letters, digits,
1.204 nia 2985: dashes, underscores, dots and plus signs. New packages should have entirely
2986: lower-case names, with the exception of some that must follow pre-existing
2987: conventions (e.g. R packages begin with R-). You can use the :tl variable
2988: modifier to lower-case the package name.
1.26 spz 2989:
1.184 rillig 2990: * CATEGORIES is a list of categories which the package fits in. You can
2991: choose any of the top-level directories of pkgsrc for it.
1.1 dsieger 2992:
1.184 rillig 2993: Currently the following values are available for CATEGORIES. If more than
2994: one is used, they need to be separated by spaces:
1.1 dsieger 2995:
1.184 rillig 2996: archivers cross geography meta-pkgs security
2997: audio databases graphics misc shells
2998: benchmarks devel ham multimedia sysutils
2999: biology editors inputmethod net textproc
3000: cad emulators lang news time
3001: chat finance mail parallel wm
3002: comms fonts math pkgtools www
3003: converters games mbone print x11
1.1 dsieger 3004:
1.184 rillig 3005: * MASTER_SITES, DYNAMIC_MASTER_SITES, DIST_SUBDIR, EXTRACT_SUFX and DISTFILES
3006: are discussed in detail in Section 13.5, "The fetch phase".
1.1 dsieger 3007:
1.184 rillig 3008: The second section contains information about separately downloaded patches, if
3009: any.
1.1 dsieger 3010:
1.184 rillig 3011: * PATCHFILES: Name(s) of additional files that contain distribution patches.
3012: There is no default. pkgsrc will look for them at PATCH_SITES. They will
3013: automatically be uncompressed before patching if the names end with .gz or
3014: .Z.
1.1 dsieger 3015:
1.184 rillig 3016: * PATCH_SITES: Primary location(s) for distribution patch files (see
3017: PATCHFILES above) if not found locally.
1.1 dsieger 3018:
1.184 rillig 3019: * PATCH_DIST_STRIP: an argument to patch(1) that sets the pathname strip
3020: count to help find the correct files to patch. It defaults to -p0.
1.1 dsieger 3021:
1.184 rillig 3022: The third section contains the following variables.
1.1 dsieger 3023:
1.184 rillig 3024: * MAINTAINER is the email address of the person who feels responsible for
3025: this package, and who is most likely to look at problems or questions
3026: regarding this package which have been reported with send-pr(1). Other
3027: developers may contact the MAINTAINER before making changes to the package,
3028: but are not required to do so. When packaging a new program, set MAINTAINER
3029: to yourself. If you really can't maintain the package for future updates,
3030: set it to <pkgsrc-users@NetBSD.org>.
1.1 dsieger 3031:
1.184 rillig 3032: * OWNER should be used instead of MAINTAINER when you do not want other
3033: developers to update or change the package without contacting you first. A
3034: package Makefile should contain one of MAINTAINER or OWNER, but not both.
1.1 dsieger 3035:
1.184 rillig 3036: * HOMEPAGE is a URL where users can find more information about the package.
1.1 dsieger 3037:
1.184 rillig 3038: * COMMENT is a one-line description of the package (should not include the
3039: package name).
1.1 dsieger 3040:
1.184 rillig 3041: * LICENSE indicates the license(s) applicable for the package. See
3042: Section 21.1.3, "Handling licenses" for further details.
1.1 dsieger 3043:
1.184 rillig 3044: Other variables that affect the build:
1.1 dsieger 3045:
1.184 rillig 3046: * WRKSRC: The directory where the interesting distribution files of the
3047: package are found. The default is ${WRKDIR}/${DISTNAME}, which works for
3048: most packages.
1.1 dsieger 3049:
1.184 rillig 3050: If a package doesn't create a subdirectory for itself (most GNU software
3051: does, for instance), but extracts itself in the current directory, you
3052: should set WRKSRC=${WRKDIR}.
1.1 dsieger 3053:
1.184 rillig 3054: If a package doesn't create a subdirectory with the name of DISTNAME but
3055: some different name, set WRKSRC to point to the proper name in ${WRKDIR},
3056: for example WRKSRC=${WRKDIR}/${DISTNAME}/unix. See lang/tcl and x11/tk for
3057: other examples.
1.17 imil 3058:
1.184 rillig 3059: The name of the working directory created by pkgsrc is taken from the
3060: WRKDIR_BASENAME variable. By default, its value is work. If you want to use
3061: the same pkgsrc tree for building different kinds of binary packages, you
3062: can change the variable according to your needs. Two other variables handle
3063: common cases of setting WRKDIR_BASENAME individually. If OBJHOSTNAME is
3064: defined in mk.conf, the first component of the host's name is attached to
3065: the directory name. If OBJMACHINE is defined, the platform name is
3066: attached, which might look like work.i386 or work.sparc.
1.17 imil 3067:
1.184 rillig 3068: Please pay attention to the following gotchas:
1.17 imil 3069:
1.184 rillig 3070: * Add MANCOMPRESSED if man pages are installed in compressed form by the
3071: package. For packages using BSD-style makefiles which honor MANZ, there is
3072: MANCOMPRESSED_IF_MANZ.
1.17 imil 3073:
1.184 rillig 3074: * Replace /usr/local with "${PREFIX}" in all files (see patches, below).
1.103 wiz 3075:
1.184 rillig 3076: * If the package installs any info files, see Section 21.6.7, "Packages
3077: installing info files".
1.103 wiz 3078:
1.184 rillig 3079: 12.2. distinfo
1.17 imil 3080:
1.184 rillig 3081: The distinfo file contains the message digest, or checksum, of each distfile
3082: needed for the package. This ensures that the distfiles retrieved from the
3083: Internet have not been corrupted during transfer or altered by a malign force
3084: to introduce a security hole. To provide maximum security, all distfiles are
3085: protected using three different message digest algorithms (SHA1, RMD160,
3086: SHA512), as well as the file size.
1.17 imil 3087:
1.184 rillig 3088: The distinfo file also contains the checksums for all the patches found in the
3089: patches directory (see Section 12.3, "patches/*"). These checksums ensure that
3090: patches are only applied intentionally and that they don't accidentally change,
3091: e.g. when merging different changes together. They also make sure that new
3092: patches are actually added to CVS and old ones are removed. Too see whether the
3093: patches and the distinfo file match, run pkglint after changing the patches.
1.17 imil 3094:
1.184 rillig 3095: To regenerate the distinfo file, use the make distinfo command.
1.17 imil 3096:
1.184 rillig 3097: Some packages have different sets of distfiles depending on the platform, for
3098: example lang/openjdk8. These are kept in the same distinfo file and care should
3099: be taken when upgrading such a package to ensure distfile information is not
3100: lost.
1.17 imil 3101:
1.184 rillig 3102: 12.3. patches/*
1.63 wiz 3103:
1.184 rillig 3104: Some packages don't work out-of-the box on the various platforms that are
3105: supported by pkgsrc. These packages need to be patched to make them work. The
3106: patch files can be found in the patches/ directory.
1.17 imil 3107:
1.184 rillig 3108: In the patch phase, these patches are applied to the files in WRKSRC directory
3109: after extracting them, in alphabetic order.
1.160 brook 3110:
1.184 rillig 3111: 12.3.1. Structure of a single patch file
1.160 brook 3112:
1.184 rillig 3113: The patch-* files should be in diff -bu format, and apply without a fuzz to
3114: avoid problems. (To force patches to apply with fuzz you can set
3115: PATCH_FUZZ_FACTOR=-F2). Furthermore, each patch should contain only changes for
3116: a single file, and no file should be patched by more than one patch file. This
3117: helps to keep future modifications simple.
1.160 brook 3118:
1.184 rillig 3119: Each patch file is structured as follows: In the first line, there is the RCS
3120: Id of the patch itself. The second line should be empty for aesthetic reasons.
3121: After that, there should be a comment for each change that the patch does.
3122: There are a number of standard cases:
1.160 brook 3123:
1.184 rillig 3124: * Patches for commonly known vulnerabilities should mention the vulnerability
3125: ID (CAN, CVE).
1.160 brook 3126:
1.184 rillig 3127: * Patches that change source code should mention the platform and other
3128: environment (for example, the compiler) that the patch is needed for.
1.160 brook 3129:
1.184 rillig 3130: The patch should be commented so that any developer who knows the code of the
3131: application can make some use of the patch. Special care should be taken for
3132: the upstream developers, since we generally want that they accept our patches,
3133: so we have less work in the future.
1.160 brook 3134:
1.184 rillig 3135: 12.3.2. Creating patch files
1.160 brook 3136:
1.184 rillig 3137: One important thing to mention is to pay attention that no RCS IDs get stored
3138: in the patch files, as these will cause problems when later checked into the
3139: NetBSD CVS tree. Use the pkgdiff command from the pkgtools/pkgdiff package to
3140: avoid these problems.
1.160 brook 3141:
1.184 rillig 3142: For even more automation, we recommend using mkpatches from the same package to
3143: make a whole set of patches. You just have to backup files before you edit them
3144: to filename.orig, e.g. with cp -p filename filename.orig or, easier, by using
3145: pkgvi again from the same package. If you upgrade a package this way, you can
3146: easily compare the new set of patches with the previously existing one with
3147: patchdiff. The files in patches are replaced by new files, so carefully check
3148: if you want to take all the changes.
1.160 brook 3149:
1.184 rillig 3150: When you have finished a package, remember to generate the checksums for the
3151: patch files by using the make makepatchsum command, see Section 12.2,
3152: "distinfo".
1.1 dsieger 3153:
1.184 rillig 3154: When adding a patch that corrects a problem in the distfile (rather than e.g.
3155: enforcing pkgsrc's view of where man pages should go), send the patch as a bug
3156: report to the maintainer. This benefits non-pkgsrc users of the package, and
3157: usually makes it possible to remove the patch in future version.
1.1 dsieger 3158:
1.184 rillig 3159: The file names of the patch files are usually of the form patch-
3160: path_to_file__with__underscores.c. Many packages still use the previous
3161: convention patch-[a-z][a-z], but new patches should be of the form containing
3162: the filename. mkpatches included in pkgtools/pkgdiff takes care of the name
3163: automatically.
1.1 dsieger 3164:
1.184 rillig 3165: 12.3.3. Sources where the patch files come from
1.1 dsieger 3166:
1.184 rillig 3167: If you want to share patches between multiple packages in pkgsrc, e.g. because
3168: they use the same distfiles, set PATCHDIR to the path where the patch files can
3169: be found, e.g.:
1.1 dsieger 3170:
1.184 rillig 3171: PATCHDIR= ../../editors/xemacs/patches
1.1 dsieger 3172:
1.184 rillig 3173: Patch files that are distributed by the author or other maintainers can be
3174: listed in PATCHFILES.
1.1 dsieger 3175:
1.184 rillig 3176: If it is desired to store any patches that should not be committed into pkgsrc,
3177: they can be kept outside the pkgsrc tree in the $LOCALPATCHES directory. The
3178: directory tree there is expected to have the same "category/package" structure
3179: as pkgsrc, and patches are expected to be stored inside these dirs (also known
3180: as $LOCALPATCHES/$PKGPATH). For example, if you want to keep a private patch
3181: for pkgsrc/graphics/png, keep it in $LOCALPATCHES/graphics/png/mypatch. All
3182: files in the named directory are expected to be patch files, and they are
3183: applied after pkgsrc patches are applied.
1.1 dsieger 3184:
1.184 rillig 3185: 12.3.4. Patching guidelines
1.1 dsieger 3186:
1.184 rillig 3187: When fixing a portability issue in the code do not use preprocessor magic to
3188: check for the current operating system nor platform. Doing so hurts portability
3189: to other platforms because the OS-specific details are not abstracted
3190: appropriately.
1.1 dsieger 3191:
1.184 rillig 3192: The general rule to follow is: instead of checking for the operating system the
3193: application is being built on, check for the specific features you need. For
3194: example, instead of assuming that kqueue is available under NetBSD and using
3195: the __NetBSD__ macro to conditionalize kqueue support, add a check that detects
1.198 leot 3196: kqueue itself -- yes, this generally involves patching the configure script.
1.184 rillig 3197: There is absolutely nothing that prevents some OSes from adopting interfaces
3198: from other OSes (e.g. Linux implementing kqueue), something that the above
3199: checks cannot take into account.
1.1 dsieger 3200:
1.184 rillig 3201: Of course, checking for features generally involves more work on the
3202: developer's side, but the resulting changes are cleaner and there are chances
3203: they will work on many other platforms. Not to mention that there are higher
3204: chances of being later integrated into the mainstream sources. Remember: It
3205: doesn't work unless it is right!
1.1 dsieger 3206:
1.184 rillig 3207: Some typical examples:
1.121 sevan 3208:
1.184 rillig 3209: Table 12.1. Patching examples
1.1 dsieger 3210:
1.184 rillig 3211: +-------------------------------------------------------------------------------------------+
3212: | Where | Incorrect | Correct |
3213: |---------+--------------------------+------------------------------------------------------|
3214: | |case ${target_os} in | |
3215: |configure|netbsd*) have_kvm=yes ;; |AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)|
3216: |script |*) have_kvm=no ;; | |
3217: | |esac | |
3218: |---------+--------------------------+------------------------------------------------------|
3219: |C source |#if defined(__NetBSD__) |#if defined(HAVE_SYS_EVENT_H) |
3220: |file |# include <sys/event.h> |# include <sys/event.h> |
3221: | |#endif |#endif |
3222: |---------+--------------------------+------------------------------------------------------|
3223: | |int |int |
3224: | |monitor_file(...) |monitor_file(...) |
3225: | |{ |{ |
3226: | |#if defined(__NetBSD__) |#if defined(HAVE_KQUEUE) |
3227: |C source | int fd = kqueue();| int fd = kqueue(); |
3228: |file | ... | ... |
3229: | |#else |#else |
3230: | | ... | ... |
3231: | |#endif |#endif |
3232: | |} |} |
3233: +-------------------------------------------------------------------------------------------+
1.1 dsieger 3234:
3235:
1.184 rillig 3236: 12.3.5. Feedback to the author
1.1 dsieger 3237:
1.184 rillig 3238: Always, always, always feed back any portability fixes or improvements you do
3239: to a package to the mainstream developers. This is the only way to get their
3240: attention on portability issues and to ensure that future versions can be built
3241: out-of-the box on NetBSD. Furthermore, any user that gets newer distfiles will
3242: get the fixes straight from the packaged code.
1.1 dsieger 3243:
1.184 rillig 3244: This generally involves cleaning up the patches (because sometimes the patches
3245: that are added to pkgsrc are quick hacks), filing bug reports in the
3246: appropriate trackers for the projects and working with the mainstream authors
3247: to accept your changes. It is extremely important that you do it so that the
3248: packages in pkgsrc are kept simple and thus further changes can be done without
3249: much hassle.
1.1 dsieger 3250:
1.184 rillig 3251: When you have done this, please add a URL to the upstream bug report to the
3252: patch comment.
1.1 dsieger 3253:
1.184 rillig 3254: Support the idea of free software!
1.1 dsieger 3255:
1.184 rillig 3256: 12.4. Other mandatory files
1.1 dsieger 3257:
1.184 rillig 3258: DESCR
1.1 dsieger 3259:
1.184 rillig 3260: A multi-line description of the piece of software. This should include any
3261: credits where they are due. Please bear in mind that others do not share
3262: your sense of humour (or spelling idiosyncrasies), and that others will
3263: read everything that you write here.
1.1 dsieger 3264:
1.184 rillig 3265: PLIST
1.1 dsieger 3266:
1.184 rillig 3267: This file governs the files that are installed on your system: all the
3268: binaries, manual pages, etc. There are other directives which may be
3269: entered in this file, to control the creation and deletion of directories,
3270: and the location of inserted files. See Chapter 19, PLIST issues for more
3271: information.
1.1 dsieger 3272:
1.184 rillig 3273: 12.5. Optional files
1.1 dsieger 3274:
1.184 rillig 3275: 12.5.1. Files affecting the binary package
1.1 dsieger 3276:
1.184 rillig 3277: INSTALL
1.1 dsieger 3278:
1.184 rillig 3279: This shell script is invoked twice by pkg_add(1). First time after package
3280: extraction and before files are moved in place, the second time after the
3281: files to install are moved in place. This can be used to do any custom
3282: procedures not possible with @exec commands in PLIST. See pkg_add(1) and
3283: pkg_create(1) for more information. See also Section 20.1, "Files and
3284: directories outside the installation prefix". Please note that you can
3285: modify variables in it easily by using FILES_SUBST in the package's
3286: Makefile:
1.1 dsieger 3287:
1.184 rillig 3288: FILES_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 3289:
1.184 rillig 3290: replaces "@SOMEVAR@" with "somevalue" in the INSTALL. By default,
3291: substitution is performed for PREFIX, LOCALBASE, X11BASE, VARBASE, and a
3292: few others, type make help topic=FILES_SUBST for a complete list.
1.1 dsieger 3293:
1.184 rillig 3294: DEINSTALL
1.1 dsieger 3295:
1.184 rillig 3296: This script is executed before and after any files are removed. It is this
3297: script's responsibility to clean up any additional messy details around the
3298: package's installation, since all pkg_delete knows is how to delete the
3299: files created in the original distribution. See pkg_delete(1) and
3300: pkg_create(1) for more information. The same methods to replace variables
3301: can be used as for the INSTALL file.
1.1 dsieger 3302:
1.184 rillig 3303: MESSAGE
1.1 dsieger 3304:
1.198 leot 3305: This file is displayed after installation of the package. While this was
3306: used often in the past, it has two problems: the display will be missed if
3307: many packages are intalled at once, and the person installing the package
3308: and the one using or configuring it may be different. It should therefore
3309: be used only in exceptional circumstances where lasting negative
3310: consequences would result from someone not reading it.
3311:
3312: MESSAGE should not be used for:
3313:
3314: + exhortations to read the documentation
3315:
3316: + reminders to install rc.d files and set variables
3317:
3318: + anything that should be explained in the installation/configuration
3319: documentation that should come with the package
3320:
3321: If the documentation provided by upstream needs enhancing, create e.g.
3322: files/README.pkgsrc and install it in the package's documentation
3323: directory.
3324:
3325: Note that MESSAGE is shown for all operating systems and all init systems.
3326: If a MESSAGE is necessary, it should be narrowed to only those operating
3327: systems and init systems to which it applies.
3328:
3329: Note that you can modify variables in it easily by using MESSAGE_SUBST in
3330: the package's Makefile:
1.1 dsieger 3331:
1.184 rillig 3332: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 3333:
1.184 rillig 3334: replaces "${SOMEVAR}" with "somevalue" in MESSAGE. By default, substitution
3335: is performed for PKGNAME, PKGBASE, PREFIX, LOCALBASE, X11BASE,
3336: PKG_SYSCONFDIR, ROOT_GROUP, and ROOT_USER.
1.1 dsieger 3337:
1.184 rillig 3338: You can display a different or additional files by setting the MESSAGE_SRC
3339: variable. Its default is MESSAGE, if the file exists.
1.1 dsieger 3340:
1.184 rillig 3341: ALTERNATIVES
1.1 dsieger 3342:
1.184 rillig 3343: This file is used by the alternatives framework. It creates, configures,
3344: and destroys generic wrappers used to run programs with similar interfaces.
3345: See pkg_alternatives(8) from pkgtools/pkg_alternatives for more
3346: information.
1.1 dsieger 3347:
1.184 rillig 3348: Each line of the file contains two filenames, first the wrapper and then
3349: the alternative provided by the package. Both paths are relative to PREFIX.
1.1 dsieger 3350:
1.184 rillig 3351: 12.5.2. Files affecting the build process
1.1 dsieger 3352:
1.184 rillig 3353: Makefile.common
1.1 dsieger 3354:
1.184 rillig 3355: This file contains arbitrary things that could also go into a Makefile, but
3356: its purpose is to be used by more than one package. This file should only
3357: be used when the packages that will use the file are known in advance. For
3358: other purposes it is often better to write a *.mk file and give it a good
3359: name that describes what it does.
1.1 dsieger 3360:
1.184 rillig 3361: buildlink3.mk
1.1 dsieger 3362:
1.184 rillig 3363: This file contains the dependency information for the buildlink3 framework
3364: (see Chapter 18, Buildlink methodology).
1.1 dsieger 3365:
1.184 rillig 3366: hacks.mk
1.1 dsieger 3367:
1.184 rillig 3368: This file contains workarounds for compiler bugs and similar things. It is
3369: included automatically by the pkgsrc infrastructure, so you don't need an
3370: extra .include line for it.
1.1 dsieger 3371:
1.184 rillig 3372: options.mk
1.1 dsieger 3373:
1.184 rillig 3374: This file contains the code for the package-specific options (see
3375: Chapter 16, Options handling) that can be selected by the user. If a
3376: package has only one or two options, it is equally acceptable to put the
3377: code directly into the Makefile.
1.1 dsieger 3378:
1.184 rillig 3379: 12.5.3. Files affecting nothing at all
1.1 dsieger 3380:
1.184 rillig 3381: README*
1.1 dsieger 3382:
1.184 rillig 3383: These files do not take place in the creation of a package and thus are
3384: purely informative to the package developer.
1.1 dsieger 3385:
1.184 rillig 3386: TODO
1.1 dsieger 3387:
1.184 rillig 3388: This file contains things that need to be done to make the package even
3389: better.
1.1 dsieger 3390:
1.184 rillig 3391: 12.6. work*
1.1 dsieger 3392:
1.184 rillig 3393: When you type make, the distribution files are unpacked into the directory
3394: denoted by WRKDIR. It can be removed by running make clean. Besides the
3395: sources, this directory is also used to keep various timestamp files. The
3396: directory gets removed completely on clean. The default is ${.CURDIR}/work or $
3397: {.CURDIR}/work.${MACHINE_ARCH} if OBJMACHINE is set.
1.1 dsieger 3398:
1.184 rillig 3399: 12.7. files/*
1.80 wiz 3400:
1.184 rillig 3401: If you have any files that you wish to be placed in the package prior to
3402: configuration or building, you can place these files here and use a ${CP}
3403: command in the "post-extract" target to achieve this.
1.1 dsieger 3404:
1.184 rillig 3405: If you want to share files in this way with other packages, set the FILESDIR
3406: variable to point to the other package's files directory, e.g.:
1.1 dsieger 3407:
1.184 rillig 3408: FILESDIR= ../../editors/xemacs/files
1.14 jmcneill 3409:
1.184 rillig 3410: Chapter 13. The build process
1.1 dsieger 3411:
1.184 rillig 3412: Table of Contents
1.1 dsieger 3413:
1.184 rillig 3414: 13.1. Introduction
3415: 13.2. Program location
3416: 13.3. Directories used during the build process
3417: 13.4. Running a phase
3418: 13.5. The fetch phase
3419:
3420: 13.5.1. What to fetch and where to get it from
3421: 13.5.2. How are the files fetched?
3422:
3423: 13.6. The checksum phase
3424: 13.7. The extract phase
3425: 13.8. The patch phase
3426: 13.9. The tools phase
3427: 13.10. The wrapper phase
3428: 13.11. The configure phase
3429: 13.12. The build phase
3430: 13.13. The test phase
3431: 13.14. The install phase
3432: 13.15. The package phase
3433: 13.16. Cleaning up
3434: 13.17. Other helpful targets
1.1 dsieger 3435:
1.184 rillig 3436: 13.1. Introduction
1.122 leot 3437:
1.184 rillig 3438: This chapter gives a detailed description on how a package is built. Building a
3439: package is separated into different phases (for example fetch, build, install),
3440: all of which are described in the following sections. Each phase is split into
3441: so-called stages, which take the name of the containing phase, prefixed by one
3442: of pre-, do- or post-. (Examples are pre-configure, post-build.) Most of the
3443: actual work is done in the do-* stages.
1.1 dsieger 3444:
1.184 rillig 3445: Never override the regular targets (like fetch), if you have to, override the
3446: do-* ones instead.
1.1 dsieger 3447:
1.184 rillig 3448: The basic steps for building a program are always the same. First the program's
3449: source (distfile) must be brought to the local system and then extracted. After
3450: any pkgsrc-specific patches to compile properly are applied, the software can
3451: be configured, then built (usually by compiling), and finally the generated
3452: binaries, etc. can be put into place on the system.
1.1 dsieger 3453:
1.184 rillig 3454: To get more details about what is happening at each step, you can set the
3455: PKG_VERBOSE variable, or the PATCH_DEBUG variable if you are just interested in
3456: more details about the patch step.
1.1 dsieger 3457:
1.184 rillig 3458: 13.2. Program location
1.1 dsieger 3459:
1.184 rillig 3460: Before outlining the process performed by the NetBSD package system in the next
3461: section, here's a brief discussion on where programs are installed, and which
3462: variables influence this.
1.1 dsieger 3463:
1.184 rillig 3464: The automatic variable PREFIX indicates where all files of the final program
3465: shall be installed. It is usually set to LOCALBASE (/usr/pkg), or CROSSBASE for
3466: pkgs in the cross category. The value of PREFIX needs to be put into the
3467: various places in the program's source where paths to these files are encoded.
3468: See Section 12.3, "patches/*" and Section 21.3.1, "Shared libraries - libtool"
3469: for more details.
1.1 dsieger 3470:
1.184 rillig 3471: When choosing which of these variables to use, follow the following rules:
1.1 dsieger 3472:
1.184 rillig 3473: * PREFIX always points to the location where the current pkg will be
3474: installed. When referring to a pkg's own installation path, use "${PREFIX}"
3475: .
1.1 dsieger 3476:
1.184 rillig 3477: * LOCALBASE is where all non-X11 pkgs are installed. If you need to construct
3478: a -I or -L argument to the compiler to find includes and libraries
3479: installed by another non-X11 pkg, use "${LOCALBASE}". The name LOCALBASE
3480: stems from FreeBSD, which installed all packages in /usr/local. As pkgsrc
3481: leaves /usr/local for the system administrator, this variable is a
3482: misnomer.
1.1 dsieger 3483:
1.184 rillig 3484: * X11BASE is where the actual X11 distribution (from xsrc, etc.) is
3485: installed. When looking for standard X11 includes (not those installed by a
3486: package), use "${X11BASE}".
1.1 dsieger 3487:
1.184 rillig 3488: * X11-based packages using imake must set USE_IMAKE to be installed correctly
3489: under LOCALBASE.
1.1 dsieger 3490:
1.184 rillig 3491: * Within ${PREFIX}, packages should install files according to hier(7), with
3492: the exception that manual pages go into ${PREFIX}/man, not ${PREFIX}/share/
3493: man.
1.1 dsieger 3494:
1.184 rillig 3495: 13.3. Directories used during the build process
1.2 rillig 3496:
1.184 rillig 3497: When building a package, various directories are used to store source files,
3498: temporary files, pkgsrc-internal files, and so on. These directories are
3499: explained here.
1.1 dsieger 3500:
1.184 rillig 3501: Some of the directory variables contain relative pathnames. There are two
3502: common base directories for these relative directories: PKGSRCDIR/PKGPATH is
3503: used for directories that are pkgsrc-specific. WRKSRC is used for directories
3504: inside the package itself.
1.1 dsieger 3505:
1.184 rillig 3506: PKGSRCDIR
1.1 dsieger 3507:
1.184 rillig 3508: This is an absolute pathname that points to the pkgsrc root directory.
3509: Generally, you don't need it.
1.1 dsieger 3510:
1.184 rillig 3511: PKGDIR
1.1 dsieger 3512:
1.184 rillig 3513: This is an absolute pathname that points to the current package.
1.1 dsieger 3514:
1.184 rillig 3515: PKGPATH
1.1 dsieger 3516:
1.184 rillig 3517: This is a pathname relative to PKGSRCDIR that points to the current
3518: package.
1.1 dsieger 3519:
1.184 rillig 3520: WRKDIR
1.1 dsieger 3521:
1.184 rillig 3522: This is an absolute pathname pointing to the directory where all work takes
3523: place. The distfiles are extracted to this directory. It also contains
3524: temporary directories and log files used by the various pkgsrc frameworks,
3525: like buildlink or the wrappers.
1.1 dsieger 3526:
1.184 rillig 3527: WRKSRC
1.1 dsieger 3528:
1.184 rillig 3529: This is an absolute pathname pointing to the directory where the distfiles
3530: are extracted. It is usually a direct subdirectory of WRKDIR, and often
3531: it's the only directory entry that isn't hidden. This variable may be
3532: changed by a package Makefile.
1.1 dsieger 3533:
1.184 rillig 3534: The CREATE_WRKDIR_SYMLINK definition takes either the value yes or no and
3535: defaults to no. It indicates whether a symbolic link to the WRKDIR is to be
3536: created in the pkgsrc entry's directory. If users would like to have their
3537: pkgsrc trees behave in a read-only manner, then the value of
3538: CREATE_WRKDIR_SYMLINK should be set to no.
1.1 dsieger 3539:
1.184 rillig 3540: 13.4. Running a phase
1.1 dsieger 3541:
1.184 rillig 3542: You can run a particular phase by typing make phase, where phase is the name of
3543: the phase. This will automatically run all phases that are required for this
3544: phase. The default phase is build, that is, when you run make without
3545: parameters in a package directory, the package will be built, but not
3546: installed.
1.1 dsieger 3547:
1.184 rillig 3548: 13.5. The fetch phase
1.1 dsieger 3549:
1.184 rillig 3550: The first step in building a package is to fetch the distribution files
3551: (distfiles) from the sites that are providing them. This is the task of the
3552: fetch phase.
1.25 wiz 3553:
1.184 rillig 3554: 13.5.1. What to fetch and where to get it from
1.1 dsieger 3555:
1.184 rillig 3556: In simple cases, MASTER_SITES defines all URLs from where the distfile, whose
3557: name is derived from the DISTNAME variable, is fetched. The more complicated
3558: cases are described below.
1.1 dsieger 3559:
1.184 rillig 3560: The variable DISTFILES specifies the list of distfiles that have to be fetched.
3561: Its value defaults to ${DEFAULT_DISTFILES} and its value is ${DISTNAME}$
3562: {EXTRACT_SUFX}, so that most packages don't need to define it at all.
3563: EXTRACT_SUFX is .tar.gz by default, but can be changed freely. Note that if
3564: your package requires additional distfiles to the default one, you cannot just
3565: append the additional filenames using the += operator, but you have write for
3566: example:
1.1 dsieger 3567:
1.184 rillig 3568: DISTFILES= ${DEFAULT_DISTFILES} additional-files.tar.gz
1.1 dsieger 3569:
1.184 rillig 3570: Each distfile is fetched from a list of sites, usually MASTER_SITES. If the
3571: package has multiple DISTFILES or multiple PATCHFILES from different sites, you
3572: can set SITES.distfile to the list of URLs where the file distfile (including
3573: the suffix) can be found.
1.1 dsieger 3574:
1.184 rillig 3575: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
3576: DISTFILES+= foo-file.tar.gz
3577: SITES.foo-file.tar.gz= \
3578: https://www.somewhere.com/somehow/ \
3579: https://www.somewhereelse.com/mirror/somehow/
1.1 dsieger 3580:
1.184 rillig 3581: When actually fetching the distfiles, each item from MASTER_SITES or SITES.*
3582: gets the name of each distfile appended to it, without an intermediate slash.
3583: Therefore, all site values have to end with a slash or other separator
3584: character. This allows for example to set MASTER_SITES to a URL of a CGI script
3585: that gets the name of the distfile as a parameter. In this case, the definition
3586: would look like:
1.1 dsieger 3587:
1.184 rillig 3588: MASTER_SITES= https://www.example.com/download.cgi?file=
1.1 dsieger 3589:
1.184 rillig 3590: The exception to this rule are URLs starting with a dash. In that case the URL
3591: is taken as is, fetched and the result stored under the name of the distfile.
3592: You can use this style for the case when the download URL style does not match
3593: the above common case. For example, if permanent download URL is a redirector
3594: to the real download URL, or the download file name is offered by an HTTP
3595: Content-Disposition header. In the following example, foo-1.0.0.tar.gz will be
3596: created instead of the default v1.0.0.tar.gz.
1.1 dsieger 3597:
1.184 rillig 3598: DISTNAME= foo-1.0.0
3599: MASTER_SITES= -https://www.example.com/archive/v1.0.0.tar.gz
1.29 wiz 3600:
1.184 rillig 3601: There are some predefined values for MASTER_SITES, which can be used in
3602: packages. The names of the variables should speak for themselves.
1.29 wiz 3603:
1.184 rillig 3604: MASTER_SITE_APACHE MASTER_SITE_BACKUP
3605: MASTER_SITE_CRATESIO MASTER_SITE_CYGWIN
3606: MASTER_SITE_DEBIAN MASTER_SITE_FREEBSD
3607: MASTER_SITE_FREEBSD_LOCAL MASTER_SITE_GENTOO
3608: MASTER_SITE_GITHUB MASTER_SITE_GNOME
3609: MASTER_SITE_GNU MASTER_SITE_GNUSTEP
3610: MASTER_SITE_HASKELL_HACKAGE MASTER_SITE_IFARCHIVE
3611: MASTER_SITE_KDE MASTER_SITE_MOZILLA
3612: MASTER_SITE_MOZILLA_ALL MASTER_SITE_MYSQL
3613: MASTER_SITE_NETLIB MASTER_SITE_OPENBSD
3614: MASTER_SITE_OPENOFFICE MASTER_SITE_OSDN
3615: MASTER_SITE_PERL_CPAN MASTER_SITE_PGSQL
3616: MASTER_SITE_PYPI MASTER_SITE_RUBYGEMS
3617: MASTER_SITE_R_CRAN MASTER_SITE_SOURCEFORGE
3618: MASTER_SITE_SUNSITE MASTER_SITE_SUSE
3619: MASTER_SITE_TEX_CTAN MASTER_SITE_XCONTRIB
3620: MASTER_SITE_XEMACS MASTER_SITE_XORG
1.1 dsieger 3621:
1.184 rillig 3622: Some explanations for the less self-explaining ones: MASTER_SITE_BACKUP
3623: contains backup sites for packages that are maintained in ftp://ftp.NetBSD.org/
3624: pub/pkgsrc/distfiles/${DIST_SUBDIR}. MASTER_SITE_LOCAL contains local package
3625: source distributions that are maintained in ftp://ftp.NetBSD.org/pub/pkgsrc/
3626: distfiles/LOCAL_PORTS/.
1.1 dsieger 3627:
1.184 rillig 3628: If you choose one of these predefined sites, you may want to specify a
3629: subdirectory of that site. Since these macros may expand to more than one
3630: actual site, you must use the following construct to specify a subdirectory:
1.1 dsieger 3631:
1.184 rillig 3632: MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/}
3633: MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.1 dsieger 3634:
1.184 rillig 3635: Note the trailing slash after the subdirectory name.
1.1 dsieger 3636:
1.184 rillig 3637: 13.5.2. How are the files fetched?
1.1 dsieger 3638:
1.184 rillig 3639: The fetch phase makes sure that all the distfiles exist in a local directory
3640: (DISTDIR, which can be set by the pkgsrc user). If the files do not exist, they
3641: are fetched using commands of the form
1.1 dsieger 3642:
1.184 rillig 3643: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 dsieger 3644:
1.184 rillig 3645: where ${site} varies through several possibilities in turn: first,
3646: MASTER_SITE_OVERRIDE is tried, then the sites specified in either SITES.file if
3647: defined, else MASTER_SITES or PATCH_SITES, as applies, then finally the value
3648: of MASTER_SITE_BACKUP. The order of all except the first and the last can be
3649: optionally sorted by the user, via setting either MASTER_SORT_RANDOM, and
3650: MASTER_SORT_AWK or MASTER_SORT_REGEX.
1.1 dsieger 3651:
1.184 rillig 3652: The specific command and arguments used depend on the FETCH_USING parameter.
3653: The example above is for FETCH_USING=custom.
1.66 asau 3654:
1.184 rillig 3655: The distfiles mirror run by the NetBSD Foundation uses the mirror-distfiles
3656: target to mirror the distfiles, if they are freely distributable. Packages
3657: setting NO_SRC_ON_FTP (usually to "${RESTRICTED}") will not have their
3658: distfiles mirrored.
1.1 dsieger 3659:
1.184 rillig 3660: 13.6. The checksum phase
1.1 dsieger 3661:
1.184 rillig 3662: After the distfile(s) are fetched, their checksum is generated and compared
3663: with the checksums stored in the distinfo file. If the checksums don't match,
3664: the build is aborted. This is to ensure the same distfile is used for building,
3665: and that the distfile wasn't changed, e.g. by some malign force, deliberately
3666: changed distfiles on the master distribution site or network lossage.
1.1 dsieger 3667:
1.184 rillig 3668: 13.7. The extract phase
1.1 dsieger 3669:
1.184 rillig 3670: When the distfiles are present on the local system, they need to be extracted,
3671: as they usually come in the form of some compressed archive format.
1.1 dsieger 3672:
1.184 rillig 3673: By default, all DISTFILES are extracted. If you only need some of them, you can
3674: set the EXTRACT_ONLY variable to the list of those files.
1.1 dsieger 3675:
1.184 rillig 3676: Extracting the files is usually done by a little program, mk/extract/extract,
3677: which already knows how to extract various archive formats, so most likely you
3678: will not need to change anything here. But if you need, the following variables
3679: may help you:
1.1 dsieger 3680:
1.184 rillig 3681: EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}
1.1 dsieger 3682:
1.184 rillig 3683: Use these variables to override the default options for an extract command,
3684: which are defined in mk/extract/extract.
1.1 dsieger 3685:
1.184 rillig 3686: EXTRACT_USING
1.1 dsieger 3687:
1.184 rillig 3688: This variable can be set to bsdtar, gtar, nbtar (which is the default
3689: value), pax, or an absolute pathname pointing to the command with which tar
3690: archives should be extracted. It is preferred to choose bsdtar over gtar if
3691: NetBSD's pax-as-tar is not good enough.
1.1 dsieger 3692:
1.184 rillig 3693: If the extract program doesn't serve your needs, you can also override the
3694: EXTRACT_CMD variable, which holds the command used for extracting the files.
3695: This command is executed in the ${WRKSRC} directory. During execution of this
3696: command, the shell variable extract_file holds the absolute pathname of the
3697: file that is going to be extracted.
1.1 dsieger 3698:
1.184 rillig 3699: And if that still does not suffice, you can override the do-extract target in
3700: the package Makefile.
1.1 dsieger 3701:
1.184 rillig 3702: 13.8. The patch phase
1.1 dsieger 3703:
1.184 rillig 3704: After extraction, all the patches named by the PATCHFILES, those present in the
3705: patches subdirectory of the package as well as in $LOCALPATCHES/$PKGPATH (e.g.
3706: /usr/local/patches/graphics/png) are applied. Patchfiles ending in .Z or .gz
3707: are uncompressed before they are applied, files ending in .orig or .rej are
3708: ignored. Any special options to patch(1) can be handed in PATCH_DIST_ARGS. See
3709: Section 12.3, "patches/*" for more details.
1.1 dsieger 3710:
1.184 rillig 3711: By default patch(1) is given special arguments to make it fail if the expected
3712: text from the patch context is not found in the patched file. If that happens,
3713: fix the patch file by comparing it with the actual text in the file to be
3714: patched.
1.1 dsieger 3715:
1.184 rillig 3716: 13.9. The tools phase
1.1 dsieger 3717:
1.184 rillig 3718: This is covered in Chapter 17, Tools needed for building or running.
1.1 dsieger 3719:
1.184 rillig 3720: 13.10. The wrapper phase
1.1 dsieger 3721:
1.184 rillig 3722: This phase creates wrapper programs for the compilers and linkers. The
3723: following variables can be used to tweak the wrappers.
1.1 dsieger 3724:
1.184 rillig 3725: ECHO_WRAPPER_MSG
1.1 dsieger 3726:
1.184 rillig 3727: The command used to print progress messages. Does nothing by default. Set
3728: to ${ECHO} to see the progress messages.
1.1 dsieger 3729:
1.184 rillig 3730: WRAPPER_DEBUG
1.1 dsieger 3731:
1.184 rillig 3732: This variable can be set to yes (default) or no, depending on whether you
3733: want additional information in the wrapper log file.
1.1 dsieger 3734:
1.184 rillig 3735: WRAPPER_UPDATE_CACHE
1.1 dsieger 3736:
1.184 rillig 3737: This variable can be set to yes or no, depending on whether the wrapper
3738: should use its cache, which will improve the speed. The default value is
3739: yes, but is forced to no if the platform does not support it.
1.1 dsieger 3740:
1.184 rillig 3741: WRAPPER_REORDER_CMDS
1.1 dsieger 3742:
1.184 rillig 3743: A list of reordering commands. A reordering command has the form reorder:l:
3744: lib1:lib2. It ensures that that -llib1 occurs before -llib2.
1.1 dsieger 3745:
1.184 rillig 3746: 13.11. The configure phase
1.1 dsieger 3747:
1.184 rillig 3748: Most pieces of software need information on the header files, system calls, and
3749: library routines which are available on the platform they run on. The process
3750: of determining this information is known as configuration, and is usually
3751: automated. In most cases, a script is supplied with the distfiles, and its
3752: invocation results in generation of header files, Makefiles, etc.
1.1 dsieger 3753:
1.184 rillig 3754: If the package contains a configure script, this can be invoked by setting
3755: HAS_CONFIGURE to "yes". If the configure script is a GNU autoconf script, you
1.187 rillig 3756: should set GNU_CONFIGURE to "yes" instead.
1.1 dsieger 3757:
1.187 rillig 3758: In the do-configure stage, a rough equivalent of the following command is run.
3759: See mk/configure/configure.mk, target do-configure-script for the exact
3760: definition.
3761:
3762: .for dir in ${CONFIGURE_DIRS}
3763: cd ${WRKSRC} && cd ${dir} \
3764: && env ${CONFIGURE_ENV} \
3765: ${CONFIG_SHELL} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
1.184 rillig 3766: .endfor
1.1 dsieger 3767:
1.184 rillig 3768: CONFIGURE_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In
3769: each of these directories, the configure script is run with the environment
3770: CONFIGURE_ENV and arguments CONFIGURE_ARGS. The variables CONFIGURE_ENV,
3771: CONFIGURE_SCRIPT (default: "./configure") and CONFIGURE_ARGS may all be changed
3772: by the package.
1.1 dsieger 3773:
1.184 rillig 3774: If the program uses the Perl way of configuration (mainly Perl modules, but not
3775: only), i.e. a file called Makefile.PL, it should include ../../lang/perl5/
3776: module.mk. To set any parameter for Makefile.PL use the MAKE_PARAMS variable
3777: (e.g., MAKE_PARAMS+=foo=bar
1.1 dsieger 3778:
1.184 rillig 3779: If the program uses an Imakefile for configuration, the appropriate steps can
3780: be invoked by setting USE_IMAKE to "yes". If you only need xmkmf, add it to
3781: USE_TOOLS. You can add variables to xmkmf's environment by adding them to the
3782: SCRIPTS_ENV variable.
1.1 dsieger 3783:
1.184 rillig 3784: If the program uses cmake for configuration, the appropriate steps can be
3785: invoked by setting USE_CMAKE to "yes". You can add variables to cmake's
3786: environment by adding them to the CONFIGURE_ENV variable and arguments to cmake
3787: by adding them to the CMAKE_ARGS variable. The top directory argument is given
3788: by the CMAKE_ARG_PATH variable, that defaults to "." (relative to
3789: CONFIGURE_DIRS)
1.1 dsieger 3790:
1.184 rillig 3791: If there is no configure step at all, set NO_CONFIGURE to "yes".
1.1 dsieger 3792:
1.184 rillig 3793: 13.12. The build phase
1.1 dsieger 3794:
1.187 rillig 3795: For building a package, a rough equivalent of the following code is executed;
3796: see mk/build/build.mk, target do-build for the exact definition.
1.154 rillig 3797:
1.187 rillig 3798: .for dir in ${BUILD_DIRS}
3799: cd ${WRKSRC} && cd ${dir} \
1.184 rillig 3800: && env ${MAKE_ENV} \
1.187 rillig 3801: ${MAKE_PROGRAM} ${MAKE_FLAGS} ${BUILD_MAKE_FLAGS} \
1.184 rillig 3802: -f ${MAKE_FILE} \
3803: ${BUILD_TARGET}
3804: .endfor
1.1 dsieger 3805:
1.184 rillig 3806: BUILD_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In each of
3807: these directories, MAKE_PROGRAM is run with the environment MAKE_ENV and
3808: arguments BUILD_MAKE_FLAGS. The variables MAKE_ENV, BUILD_MAKE_FLAGS, MAKE_FILE
3809: and BUILD_TARGET may all be changed by the package.
1.1 dsieger 3810:
1.184 rillig 3811: The default value of MAKE_PROGRAM is "gmake" if USE_TOOLS contains "gmake", "
3812: make" otherwise. The default value of MAKE_FILE is "Makefile", and BUILD_TARGET
3813: defaults to "all".
1.1 dsieger 3814:
1.184 rillig 3815: If there is no build step at all, set NO_BUILD to "yes".
1.1 dsieger 3816:
1.184 rillig 3817: 13.13. The test phase
1.1 dsieger 3818:
1.184 rillig 3819: [TODO]
1.1 dsieger 3820:
1.184 rillig 3821: 13.14. The install phase
1.1 dsieger 3822:
1.184 rillig 3823: Once the build stage has completed, the final step is to install the software
3824: in public directories, so users can access the programs and files.
1.1 dsieger 3825:
1.187 rillig 3826: In the install phase, a rough equivalent of the following code is executed; see
3827: mk/install/install.mk, target do-install for the exact definition.
3828: Additionally, before and after this code, several consistency checks are run
3829: against the files-to-be-installed, see mk/check/*.mk for details.
3830:
3831: .for dir in ${INSTALL_DIRS}
3832: cd ${WRKSRC} && cd ${dir} \
3833: && env ${INSTALL_ENV} ${MAKE_ENV} \
3834: ${MAKE_PROGRAM} ${MAKE_FLAGS} ${INSTALL_MAKE_FLAGS} \
3835: -f ${MAKE_FILE} ${INSTALL_TARGET}
1.184 rillig 3836: .endfor
1.1 dsieger 3837:
1.184 rillig 3838: The variable's meanings are analogous to the ones in the build phase.
3839: INSTALL_DIRS defaults to BUILD_DIRS. INSTALL_TARGET is "install" by default,
3840: plus "install.man" if USE_IMAKE is defined and NO_INSTALL_MANPAGES is not
3841: defined.
1.1 dsieger 3842:
1.184 rillig 3843: In the install phase, the following variables are useful. They are all
3844: variations of the install(1) command that have the owner, group and permissions
3845: preset. INSTALL is the plain install command. The specialized variants,
3846: together with their intended use, are:
1.1 dsieger 3847:
1.184 rillig 3848: INSTALL_PROGRAM_DIR
1.1 dsieger 3849:
1.184 rillig 3850: directories that contain binaries
1.1 dsieger 3851:
1.184 rillig 3852: INSTALL_SCRIPT_DIR
1.1 dsieger 3853:
1.184 rillig 3854: directories that contain scripts
1.1 dsieger 3855:
1.184 rillig 3856: INSTALL_LIB_DIR
1.1 dsieger 3857:
1.184 rillig 3858: directories that contain shared and static libraries
1.1 dsieger 3859:
1.184 rillig 3860: INSTALL_DATA_DIR
1.108 rillig 3861:
1.184 rillig 3862: directories that contain data files
1.108 rillig 3863:
1.184 rillig 3864: INSTALL_MAN_DIR
1.108 rillig 3865:
1.184 rillig 3866: directories that contain man pages
1.108 rillig 3867:
1.184 rillig 3868: INSTALL_GAME_DIR
1.108 rillig 3869:
1.184 rillig 3870: directories that contain data files for games
1.108 rillig 3871:
1.184 rillig 3872: INSTALL_PROGRAM
1.108 rillig 3873:
1.184 rillig 3874: binaries that can be stripped from debugging symbols
1.108 rillig 3875:
1.184 rillig 3876: INSTALL_SCRIPT
1.108 rillig 3877:
1.184 rillig 3878: binaries that cannot be stripped
1.108 rillig 3879:
1.184 rillig 3880: INSTALL_GAME
1.108 rillig 3881:
1.184 rillig 3882: game binaries
1.108 rillig 3883:
1.184 rillig 3884: INSTALL_LIB
1.108 rillig 3885:
1.184 rillig 3886: shared and static libraries
1.108 rillig 3887:
1.184 rillig 3888: INSTALL_DATA
1.108 rillig 3889:
1.184 rillig 3890: data files
1.1 dsieger 3891:
1.184 rillig 3892: INSTALL_GAME_DATA
1.1 dsieger 3893:
1.184 rillig 3894: data files for games
1.108 rillig 3895:
1.184 rillig 3896: INSTALL_MAN
1.108 rillig 3897:
1.184 rillig 3898: man pages
1.1 dsieger 3899:
1.184 rillig 3900: Some other variables are:
1.1 dsieger 3901:
1.184 rillig 3902: INSTALL_UNSTRIPPED
1.1 dsieger 3903:
1.184 rillig 3904: If set to yes, do not run strip(1) when installing binaries. Any debugging
3905: sections and symbols present in binaries will be preserved.
1.1 dsieger 3906:
1.184 rillig 3907: INSTALLATION_DIRS
1.1 dsieger 3908:
1.184 rillig 3909: A list of directories relative to PREFIX that are created by pkgsrc at the
3910: beginning of the install phase. The package is supposed to create all
3911: needed directories itself before installing files to it and list all other
3912: directories here.
1.1 dsieger 3913:
1.184 rillig 3914: In the rare cases that a package shouldn't install anything, set NO_INSTALL to
3915: "yes". This is mostly relevant for packages in the regress category.
1.1 dsieger 3916:
1.184 rillig 3917: 13.15. The package phase
1.121 sevan 3918:
1.184 rillig 3919: Once the install stage has completed, a binary package of the installed files
3920: can be built. These binary packages can be used for quick installation without
3921: previous compilation, e.g. by the make bin-install or by using pkg_add.
1.1 dsieger 3922:
1.184 rillig 3923: By default, the binary packages are created in ${PACKAGES}/All and symlinks are
3924: created in ${PACKAGES}/category, one for each category in the CATEGORIES
3925: variable. PACKAGES defaults to pkgsrc/packages.
1.1 dsieger 3926:
1.184 rillig 3927: 13.16. Cleaning up
1.1 dsieger 3928:
1.184 rillig 3929: Once you're finished with a package, you can clean the work directory by
3930: running make clean. If you want to clean the work directories of all
3931: dependencies too, use make clean-depends.
1.1 dsieger 3932:
1.184 rillig 3933: 13.17. Other helpful targets
1.1 dsieger 3934:
1.184 rillig 3935: pre/post-*
1.1 dsieger 3936:
1.184 rillig 3937: For any of the main targets described in the previous section (configure,
3938: build, install, etc.), two auxiliary targets exist with "pre-" and "post-"
3939: used as a prefix for the main target's name. These targets are invoked
3940: before and after the main target is called, allowing extra configuration or
3941: installation steps be performed from a package's Makefile, for example,
3942: which a program's configure script or install target omitted.
3943:
3944: About 5% of the pkgsrc packages define their custom post-extract target,
3945: another 5% define pre-configure, and 10% define post-install. The other pre
3946: /post-* targets are defined even less often.
1.1 dsieger 3947:
1.184 rillig 3948: do-*
1.182 leot 3949:
1.184 rillig 3950: Should one of the main targets do the wrong thing, and should there be no
3951: variable to fix this, you can redefine it with the do-* target. (Note that
3952: redefining the target itself instead of the do-* target is a bad idea, as
3953: the pre-* and post-* targets won't be called anymore, etc.)
1.1 dsieger 3954:
1.184 rillig 3955: About 15% of the pkgsrc packages override the default do-install, the other
3956: do-* targets are overridden even less often.
1.1 dsieger 3957:
1.184 rillig 3958: reinstall
1.1 dsieger 3959:
1.184 rillig 3960: If you did a make install and you noticed some file was not installed
3961: properly, you can repeat the installation with this target, which will
3962: ignore the "already installed" flag.
1.1 dsieger 3963:
1.184 rillig 3964: This is the default value of DEPENDS_TARGET except in the case of make
3965: update and make package, where the defaults are "package" and "update",
3966: respectively.
1.1 dsieger 3967:
1.184 rillig 3968: deinstall
1.1 dsieger 3969:
1.184 rillig 3970: This target does a pkg_delete(1) in the current directory, effectively
3971: de-installing the package. The following variables can be used to tune the
3972: behaviour:
1.1 dsieger 3973:
1.184 rillig 3974: PKG_VERBOSE
1.1 dsieger 3975:
1.184 rillig 3976: Add a "-v" to the pkg_delete(1) command.
1.1 dsieger 3977:
1.184 rillig 3978: DEINSTALLDEPENDS
1.1 dsieger 3979:
1.184 rillig 3980: Remove all packages that require (depend on) the given package. This
3981: can be used to remove any packages that may have been pulled in by a
3982: given package, e.g. if make deinstall DEINSTALLDEPENDS=1 is done in
3983: pkgsrc/x11/kde, this is likely to remove whole KDE. Works by adding "-R
3984: " to the pkg_delete(1) command line.
1.1 dsieger 3985:
1.184 rillig 3986: bin-install
1.1 dsieger 3987:
1.184 rillig 3988: Install a binary package from local disk and via FTP from a list of sites
3989: (see the BINPKG_SITES variable), and do a make package if no binary package
3990: is available anywhere. The arguments given to pkg_add can be set via
3991: BIN_INSTALL_FLAGS e.g., to do verbose operation, etc.
1.1 dsieger 3992:
1.184 rillig 3993: install-clean
1.1 dsieger 3994:
1.184 rillig 3995: This target removes the state files for the "install" and later phases so
3996: that the "install" target may be re-invoked. This can be used after editing
3997: the PLIST to install the package without rebuilding it.
1.1 dsieger 3998:
1.184 rillig 3999: build-clean
1.18 mishka 4000:
1.184 rillig 4001: This target removes the state files for the "build" and later phases so
4002: that the "build" target may be re-invoked.
1.18 mishka 4003:
1.184 rillig 4004: update
1.18 mishka 4005:
1.184 rillig 4006: This target causes the current package to be updated to the latest version.
4007: The package and all depending packages first get de-installed, then current
4008: versions of the corresponding packages get compiled and installed. This is
4009: similar to manually noting which packages are currently installed, then
4010: performing a series of make deinstall and make install (or whatever
4011: UPDATE_TARGET is set to) for these packages.
1.18 mishka 4012:
1.184 rillig 4013: You can use the "update" target to resume package updating in case a
4014: previous make update was interrupted for some reason. However, in this
4015: case, make sure you don't call make clean or otherwise remove the list of
4016: dependent packages in WRKDIR. Otherwise, you lose the ability to
4017: automatically update the current package along with the dependent packages
4018: you have installed.
1.121 sevan 4019:
1.184 rillig 4020: Resuming an interrupted make update will only work as long as the package
4021: tree remains unchanged. If the source code for one of the packages to be
4022: updated has been changed, resuming make update will most certainly fail!
1.1 dsieger 4023:
1.184 rillig 4024: The following variables can be used either on the command line or in
4025: mk.conf to alter the behaviour of make update:
1.1 dsieger 4026:
1.184 rillig 4027: UPDATE_TARGET
1.1 dsieger 4028:
1.184 rillig 4029: Install target to recursively use for the updated package and the
4030: dependent packages. Defaults to DEPENDS_TARGET if set, "install"
4031: otherwise for make update. Other good targets are "package" or "
4032: bin-install". Do not set this to "update" or you will get stuck in an
4033: endless loop!
1.1 dsieger 4034:
1.184 rillig 4035: NOCLEAN
1.1 dsieger 4036:
1.184 rillig 4037: Don't clean up after updating. Useful if you want to leave the work
4038: sources of the updated packages around for inspection or other
4039: purposes. Be sure you eventually clean up the source tree (see the "
4040: clean-update" target below) or you may run into troubles with old
4041: source code still lying around on your next make or make update.
1.1 dsieger 4042:
1.184 rillig 4043: REINSTALL
1.1 dsieger 4044:
1.184 rillig 4045: Deinstall each package before installing (making DEPENDS_TARGET). This
4046: may be necessary if the "clean-update" target (see below) was called
4047: after interrupting a running make update.
1.1 dsieger 4048:
1.184 rillig 4049: DEPENDS_TARGET
1.1 dsieger 4050:
1.184 rillig 4051: Allows you to disable recursion and hardcode the target for packages.
4052: The default is "update" for the update target, facilitating a recursive
4053: update of prerequisite packages. Only set DEPENDS_TARGET if you want to
4054: disable recursive updates. Use UPDATE_TARGET instead to just set a
4055: specific target for each package to be installed during make update
4056: (see above).
1.1 dsieger 4057:
1.184 rillig 4058: clean-update
1.1 dsieger 4059:
1.184 rillig 4060: Clean the source tree for all packages that would get updated if make
4061: update was called from the current directory. This target should not be
4062: used if the current package (or any of its depending packages) have already
4063: been de-installed (e.g., after calling make update) or you may lose some
4064: packages you intended to update. As a rule of thumb: only use this target
4065: before the first time you run make update and only if you have a dirty
4066: package tree (e.g., if you used NOCLEAN).
1.86 wiz 4067:
1.184 rillig 4068: If you are unsure about whether your tree is clean, you can either perform
4069: a make clean at the top of the tree, or use the following sequence of
4070: commands from the directory of the package you want to update (before
4071: running make update for the first time, otherwise you lose all the packages
4072: you wanted to update!):
1.86 wiz 4073:
1.184 rillig 4074: # make clean-update
4075: # make clean CLEANDEPENDS=YES
4076: # make update
1.86 wiz 4077:
4078:
1.184 rillig 4079: The following variables can be used either on the command line or in
4080: mk.conf to alter the behaviour of make clean-update:
1.86 wiz 4081:
1.184 rillig 4082: CLEAR_DIRLIST
1.86 wiz 4083:
1.184 rillig 4084: After make clean, do not reconstruct the list of directories to update
4085: for this package. Only use this if make update successfully installed
4086: all packages you wanted to update. Normally, this is done automatically
4087: on make update, but may have been suppressed by the NOCLEAN variable
4088: (see above).
1.1 dsieger 4089:
1.184 rillig 4090: replace
1.1 dsieger 4091:
1.184 rillig 4092: Update the installation of the current package. This differs from update in
4093: that it does not replace dependent packages. You will need to install
4094: pkgtools/pkg_tarup for this target to work.
1.1 dsieger 4095:
1.184 rillig 4096: Be careful when using this target! There are no guarantees that dependent
4097: packages will still work, in particular they will most certainly break if
4098: you make replace a library package whose shared library major version
4099: changed between your installed version and the new one. For this reason,
4100: this target is not officially supported and only recommended for advanced
4101: users.
1.1 dsieger 4102:
1.184 rillig 4103: info
1.1 dsieger 4104:
1.184 rillig 4105: This target invokes pkg_info(1) for the current package. You can use this
4106: to check which version of a package is installed.
1.86 wiz 4107:
1.184 rillig 4108: index
1.1 dsieger 4109:
1.184 rillig 4110: This is a top-level command, i.e. it should be used in the pkgsrc
4111: directory. It creates a database of all packages in the local pkgsrc tree,
4112: including dependencies, comment, maintainer, and some other useful
4113: information. Individual entries are created by running make describe in the
4114: packages' directories. This index file is saved as pkgsrc/INDEX. It can be
4115: displayed in verbose format by running make print-index. You can search in
4116: it with make search key=something. You can extract a list of all packages
4117: that depend on a particular one by running make show-deps PKG=somepackage.
1.1 dsieger 4118:
1.184 rillig 4119: Running this command takes a very long time, some hours even on fast
4120: machines!
1.1 dsieger 4121:
1.184 rillig 4122: readme
1.1 dsieger 4123:
1.199 nia 4124: This target generates a index.html file, which can be viewed using a
1.184 rillig 4125: browser such as www/firefox or www/links. The generated files contain
4126: references to any packages which are in the PACKAGES directory on the local
4127: host. The generated files can be made to refer to URLs based on
4128: FTP_PKG_URL_HOST and FTP_PKG_URL_DIR. For example, if I wanted to generate
1.199 nia 4129: index.html files which pointed to binary packages on the local machine, in
1.184 rillig 4130: the directory /usr/packages, set FTP_PKG_URL_HOST=file://localhost and
4131: FTP_PKG_URL_DIR=/usr/packages. The ${PACKAGES} directory and its
4132: subdirectories will be searched for all the binary packages.
1.1 dsieger 4133:
1.184 rillig 4134: The target can be run at the toplevel or in category directories, in which
4135: case it descends recursively.
1.1 dsieger 4136:
1.184 rillig 4137: readme-all
1.1 dsieger 4138:
1.184 rillig 4139: This is a top-level command, run it in pkgsrc. Use this target to create a
4140: file README-all.html which contains a list of all packages currently
4141: available in the NetBSD Packages Collection, together with the category
4142: they belong to and a short description. This file is compiled from the
1.199 nia 4143: pkgsrc/*/index.html files, so be sure to run this after a make readme.
1.1 dsieger 4144:
1.184 rillig 4145: cdrom-readme
1.1 dsieger 4146:
1.184 rillig 4147: This is very much the same as the "readme" target (see above), but is to be
4148: used when generating a pkgsrc tree to be written to a CD-ROM. This target
1.199 nia 4149: also produces index.html files, and can be made to refer to URLs based on
1.184 rillig 4150: CDROM_PKG_URL_HOST and CDROM_PKG_URL_DIR.
1.1 dsieger 4151:
1.184 rillig 4152: show-distfiles
1.1 dsieger 4153:
1.184 rillig 4154: This target shows which distfiles and patchfiles are needed to build the
4155: package (ALLFILES, which contains all DISTFILES and PATCHFILES, but not
4156: patches/*).
1.1 dsieger 4157:
1.184 rillig 4158: show-downlevel
1.1 dsieger 4159:
1.184 rillig 4160: This target shows nothing if the package is not installed. If a version of
4161: this package is installed, but is not the version provided in this version
4162: of pkgsrc, then a warning message is displayed. This target can be used to
4163: show which of your installed packages are downlevel, and so the old
4164: versions can be deleted, and the current ones added.
1.1 dsieger 4165:
1.184 rillig 4166: show-pkgsrc-dir
1.1 dsieger 4167:
1.184 rillig 4168: This target shows the directory in the pkgsrc hierarchy from which the
4169: package can be built and installed. This may not be the same directory as
4170: the one from which the package was installed. This target is intended to be
4171: used by people who may wish to upgrade many packages on a single host, and
4172: can be invoked from the top-level pkgsrc Makefile by using the "
4173: show-host-specific-pkgs" target.
1.1 dsieger 4174:
1.184 rillig 4175: show-installed-depends
1.1 dsieger 4176:
1.184 rillig 4177: This target shows which installed packages match the current package's
4178: DEPENDS. Useful if out of date dependencies are causing build problems.
1.1 dsieger 4179:
1.184 rillig 4180: print-build-depends-list
1.1 dsieger 4181:
1.184 rillig 4182: This target shows the list of packages that the current package depends on
4183: for building.
1.1 dsieger 4184:
1.184 rillig 4185: print-run-depends-list
1.1 dsieger 4186:
1.184 rillig 4187: This target shows the list of packages that the current package depends on
4188: for running.
1.1 dsieger 4189:
1.184 rillig 4190: check-shlibs
1.1 dsieger 4191:
1.184 rillig 4192: After a package is installed, check all its binaries and (on ELF platforms)
4193: shared libraries to see if they find the shared libs they need. Run by
4194: default if PKG_DEVELOPER is set in mk.conf.
1.1 dsieger 4195:
1.184 rillig 4196: print-PLIST
1.1 dsieger 4197:
1.184 rillig 4198: After a "make install" from a new or upgraded pkg, this prints out an
4199: attempt to generate a new PLIST from a find -newer work/.extract_done. An
4200: attempt is made to care for shared libs etc., but it is strongly
4201: recommended to review the result before putting it into PLIST. On upgrades,
4202: it's useful to diff the output of this command against an already existing
4203: PLIST file.
1.1 dsieger 4204:
1.184 rillig 4205: If the package installs files via tar(1) or other methods that don't update
4206: file access times, be sure to add these files manually to your PLIST, as
4207: the "find -newer" command used by this target won't catch them!
1.56 ryoon 4208:
1.184 rillig 4209: See Section 19.3, "Tweaking output of make print-PLIST" for more
4210: information on this target.
1.1 dsieger 4211:
1.184 rillig 4212: Chapter 14. Creating a new pkgsrc package from scratch
1.1 dsieger 4213:
1.184 rillig 4214: Table of Contents
1.1 dsieger 4215:
1.184 rillig 4216: 14.1. Common types of packages
1.1 dsieger 4217:
1.184 rillig 4218: 14.1.1. Perl modules
4219: 14.1.2. Python modules and programs
4220: 14.1.3. R packages
4221: 14.1.4. TeXlive packages
1.1 dsieger 4222:
1.184 rillig 4223: 14.2. Examples
1.1 dsieger 4224:
1.184 rillig 4225: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 4226:
1.184 rillig 4227: When you find a package that is not yet in pkgsrc, you most likely have a URL
4228: from where you can download the source code. Starting with this URL, creating a
4229: package involves only a few steps.
1.1 dsieger 4230:
1.184 rillig 4231: 1. In your mk.conf, set PKG_DEVELOPER=yes to enable the basic quality checks.
1.1 dsieger 4232:
1.184 rillig 4233: 2. Install the package meta-pkgs/pkg_developer, which among others will
4234: install the utilities url2pkg, pkglint, pkgvi and mkpatches:
1.1 dsieger 4235:
1.184 rillig 4236: $ cd /usr/pkgsrc
4237: $ (cd meta-pkgs/pkg_developer && bmake update)
1.1 dsieger 4238:
1.184 rillig 4239: 3. Choose one of the top-level directories as the category in which you want
4240: to place your package. You can also create a directory of your own (maybe
4241: called local). In that category directory, create another directory for
4242: your package and change into it:
1.1 dsieger 4243:
1.184 rillig 4244: $ mkdir category/package
4245: $ cd category/package
1.1 dsieger 4246:
1.184 rillig 4247: 4. Run the program url2pkg, which will ask you for a URL. Enter the URL of the
4248: distribution file (in most cases a .tar.gz file) and watch how the basic
4249: ingredients of your package are created automatically. The distribution
4250: file is extracted automatically to fill in some details in the Makefile
4251: that would otherwise have to be done manually:
1.1 dsieger 4252:
1.184 rillig 4253: $ url2pkg https://www.example.org/packages/package-1.0.tar.gz
1.1 dsieger 4254:
1.184 rillig 4255: 5. Examine the extracted files to determine the dependencies of your package.
4256: Ideally, this is mentioned in some README file, but things may differ. For
4257: each of these dependencies, look where it exists in pkgsrc, and if there is
4258: a file called buildlink3.mk in that directory, add a line to your package
4259: Makefile which includes that file just before the last line. If the
4260: buildlink3.mk file does not exist, it must be created first. The
4261: buildlink3.mk file makes sure that the package's include files and
4262: libraries are provided.
1.1 dsieger 4263:
1.184 rillig 4264: If you just need binaries from a package, add a DEPENDS line to the
4265: Makefile, which specifies the version of the dependency and where it can be
4266: found in pkgsrc. This line should be placed in the third paragraph. If the
4267: dependency is only needed for building the package, but not when using it,
4268: use TOOL_DEPENDS or BUILD_DEPENDS instead of DEPENDS. The difference
4269: between TOOL_DEPENDS and BUILD_DEPENDS occurs when cross-compiling:
4270: TOOL_DEPENDS are native packages, i.e. packages for the architecture where
4271: the package is built; BUILD_DEPENDS are target packages, i.e. packages for
4272: the architecture for which the package is built. There is also
4273: TEST_DEPENDS, which is used to specify a dependency used only for testing
4274: the resulting package built, using the upstream project's included test
4275: suite. Your package may then look like this:
1.1 dsieger 4276:
1.184 rillig 4277: [...]
1.1 dsieger 4278:
1.184 rillig 4279: TOOL_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt
4280: DEPENDS+= screen-[0-9]*:../../misc/screen
4281: DEPENDS+= screen>=4.0:../../misc/screen
1.1 dsieger 4282:
1.184 rillig 4283: [...]
1.1 dsieger 4284:
1.184 rillig 4285: .include "../../category/package/buildlink3.mk"
4286: .include "../../devel/glib2/buildlink3.mk"
4287: .include "../../mk/bsd.pkg.mk"
1.1 dsieger 4288:
1.184 rillig 4289: 6. Run pkglint to see what things still need to be done to make your package a
4290: "good" one. If you don't know what pkglint's warnings want to tell you, try
4291: pkglint --explain or pkglint -e, which outputs additional explanations.
1.1 dsieger 4292:
1.184 rillig 4293: 7. In many cases the package is not yet ready to build. You can find
4294: instructions for the most common cases in the next section, Section 14.1,
4295: "Common types of packages". After you have followed the instructions over
4296: there, you can hopefully continue here.
1.1 dsieger 4297:
1.184 rillig 4298: 8. Run bmake clean to clean the working directory from the extracted files.
4299: Besides these files, a lot of cache files and other system information has
4300: been saved in the working directory, which may become wrong after you
4301: edited the Makefile.
1.1 dsieger 4302:
1.184 rillig 4303: 9. Now, run bmake to build the package. For the various things that can go
4304: wrong in this phase, consult Chapter 21, Making your package work.
1.1 dsieger 4305:
1.184 rillig 4306: If the extracted files from the package need to be fixed, run multiple
4307: rounds of these commands:
1.1 dsieger 4308:
1.184 rillig 4309: $ make
4310: $ pkgvi ${WRKSRC}/some/file/that/does/not/compile
4311: $ mkpatches
4312: $ make mps
4313: $ make clean
1.1 dsieger 4314:
1.184 rillig 4315: 10. When the package builds fine, the next step is to install the package. Run
4316: bmake install and hope that everything works.
1.1 dsieger 4317:
1.184 rillig 4318: 11. Up to now, the file PLIST, which contains a list of the files that are
4319: installed by the package, is nearly empty. Run bmake print-PLIST >PLIST to
4320: generate a probably correct list. Check the file using your preferred text
4321: editor to see if the list of files looks plausible.
1.1 dsieger 4322:
1.184 rillig 4323: 12. Run pkglint again to see if the generated PLIST contains garbage or not.
1.1 dsieger 4324:
1.184 rillig 4325: 13. When you ran bmake install, the package had been registered in the database
4326: of installed files, but with an empty list of files. To fix this, run bmake
4327: deinstall and bmake install again. Now the package is registered with the
4328: list of files from PLIST.
1.48 wiz 4329:
1.184 rillig 4330: 14. Run bmake package to create a binary package from the set of installed
4331: files.
1.48 wiz 4332:
1.184 rillig 4333: 15. Run bmake clean update to run everything from above again in a single step,
4334: making sure that the PLIST is correct and the whole package is created as
4335: intended.
1.48 wiz 4336:
1.184 rillig 4337: 16. Run pkglint to see if there's anything left to do.
1.48 wiz 4338:
1.184 rillig 4339: 17. Commit the package to pkgsrc-wip or main pkgsrc; see Chapter 23, Submitting
4340: and Committing.
1.50 wiz 4341:
1.184 rillig 4342: 14.1. Common types of packages
1.1 dsieger 4343:
1.184 rillig 4344: 14.1.1. Perl modules
1.1 dsieger 4345:
1.184 rillig 4346: Simple Perl modules are handled automatically by url2pkg, including
4347: dependencies.
1.1 dsieger 4348:
1.184 rillig 4349: 14.1.2. Python modules and programs
1.1 dsieger 4350:
1.184 rillig 4351: Python modules and programs packages are easily created using a set of
4352: predefined variables.
1.1 dsieger 4353:
1.184 rillig 4354: If some Python versions are not supported by the software, set the
4355: PYTHON_VERSIONS_INCOMPATIBLE variable to the Python versions that are not
4356: supported, e.g.
1.1 dsieger 4357:
1.184 rillig 4358: PYTHON_VERSIONS_INCOMPATIBLE= 27
1.1 dsieger 4359:
1.184 rillig 4360: If the packaged software is a Python module, include one of ../../lang/python/
4361: egg.mk, ../../lang/python/distutils.mk, or ../../lang/python/extension.mk.
1.1 dsieger 4362:
1.184 rillig 4363: Most Python packages use either "distutils" or easy-setup/setuptools ("eggs").
4364: If the packaged software is using setuptools, you only need to include "../../
4365: lang/python/egg.mk". Otherwise, if the software uses "distutils", include "..
4366: /../lang/python/distutils.mk", so pkgsrc will use this framework. "distutils"
4367: uses a script called setup.py; if the "distutils" driver is not called
4368: setup.py, set the PYSETUP variable to the name of the script.
1.1 dsieger 4369:
1.184 rillig 4370: Either way, the package directory should be called "py-software" and PKGNAME
4371: should be set to "${PYPKGPREFIX}-${DISTNAME}", e.g.
1.1 dsieger 4372:
1.184 rillig 4373: DISTNAME= foopymodule-1.2.10
4374: PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
1.1 dsieger 4375:
1.184 rillig 4376: If it is an application, include "../../lang/python/application.mk". In order
4377: to correctly set the path to the Python interpreter, use the REPLACE_PYTHON
4378: variable and set it to the list of files (paths relative to WRKSRC) that must
4379: be corrected. For example:
1.1 dsieger 4380:
1.184 rillig 4381: REPLACE_PYTHON= *.py
1.1 dsieger 4382:
1.184 rillig 4383: Some Python modules have separate distributions for Python-2.x and Python-3.x
4384: support. In pkgsrc this is handled by the versioned_dependencies.mk file. Set
4385: PYTHON_VERSIONED_DEPENDENCIES to the list of packages that should be depended
4386: upon and include "../../lang/python/versioned_dependencies.mk", then the pkgsrc
4387: infrastructure will depend on the appropriate package version. For example:
1.1 dsieger 4388:
1.184 rillig 4389: PYTHON_VERSIONED_DEPENDENCIES=dialog
1.1 dsieger 4390:
1.184 rillig 4391: Look inside versioned_dependencies.mk for a list of supported packages.
1.1 dsieger 4392:
1.184 rillig 4393: 14.1.3. R packages
1.1 dsieger 4394:
1.184 rillig 4395: Simple R packages from CRAN are handled automatically by R2pkg, which is
4396: available in pkgtools/R2pkg. Individual packages (and optionally their
4397: dependencies) may be created and updated. R packages generally follow the same
4398: form, and most of the relevant information needed is contained in a DESCRIPTION
4399: file as part of each R package on CRAN. Consequently, R2pkg downloads that
4400: information and creates or updates a package in the canonical form. The
4401: resulting package should be reviewed for correctness.
1.1 dsieger 4402:
1.184 rillig 4403: 14.1.4. TeXlive packages
1.1 dsieger 4404:
1.184 rillig 4405: TeXlive packages from CTAN are handled automatically by texlive2pkg, which is
4406: available in pkgtools/texlive2pkg.
1.1 dsieger 4407:
1.184 rillig 4408: If the TeXlive package name is not known, it may be useful to search CTAN. A "
4409: Contained in" field on the package page typically identifies the basename of
4410: the package file in the TeXlive archive.
1.1 dsieger 4411:
1.184 rillig 4412: If the TeXlive package name is known, download the files from the TeXlive
4413: archive. For package foo, you will need to download foo.tar.xz. Most TeXlive
4414: packages also have associated documentation packages, so download
4415: foo.doc.tar.xz at the same time. These files should be placed in the
4416: appropriate category directory, which is often but not always print. Then run
4417: the following command in the category directory.
1.1 dsieger 4418:
1.184 rillig 4419: texlive2pkg foo.tar.xz foo.doc.tar.xz
1.1 dsieger 4420:
1.184 rillig 4421: This will create two packages, tex-foo and tex-foo-doc. Be sure to check that
4422: both packages are correct.
1.1 dsieger 4423:
1.184 rillig 4424: Finally, CTAN currently does not include version information in package
4425: filenames and changes their contents periodically when updates occur.
4426: Consequently, pkgsrc avoids downloading distfiles directly from CTAN and
4427: instead relies on the pkgsrc archives. For each new or updated TeXlive package,
4428: e.g., the main one and the corresponding documentation, upload the distfiles
4429: with the following command in each package directory.
1.1 dsieger 4430:
1.184 rillig 4431: make upload-distfiles
1.117 sevan 4432:
1.184 rillig 4433: 14.2. Examples
1.117 sevan 4434:
1.184 rillig 4435: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 4436:
1.184 rillig 4437: 14.2.1.1. The initial package
1.1 dsieger 4438:
1.184 rillig 4439: Looking at the file pkgsrc/doc/TODO, I saw that the "nvu" package has not yet
4440: been imported into pkgsrc. As the description says it has to do with the web,
4441: the obvious choice for the category is "www".
1.1 dsieger 4442:
1.184 rillig 4443: $ mkdir www/nvu
4444: $ cd www/nvu
1.1 dsieger 4445:
1.184 rillig 4446: The web site says that the sources are available as a tar file, so I fed that
4447: URL to the url2pkg program:
1.1 dsieger 4448:
1.184 rillig 4449: $ url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
1.1 dsieger 4450:
1.184 rillig 4451: My editor popped up, and I added a PKGNAME line below the DISTNAME line, as the
4452: package name should not have the word "sources" in it. I also filled in the
4453: MAINTAINER, HOMEPAGE and COMMENT fields. Then the package Makefile looked like
4454: that:
1.1 dsieger 4455:
1.184 rillig 4456: # $NetBSD $
4457: #
1.1 dsieger 4458:
1.184 rillig 4459: DISTNAME= nvu-1.0-sources
4460: PKGNAME= nvu-1.0
4461: CATEGORIES= www
4462: MASTER_SITES= http://cvs.nvu.com/download/
4463: EXTRACT_SUFX= .tar.bz2
1.1 dsieger 4464:
1.184 rillig 4465: MAINTAINER= rillig@NetBSD.org
4466: HOMEPAGE= http://cvs.nvu.com/
4467: COMMENT= Web Authoring System
1.1 dsieger 4468:
1.184 rillig 4469: # url2pkg-marker (please do not remove this line.)
4470: .include "../../mk/bsd.pkg.mk"
1.1 dsieger 4471:
1.184 rillig 4472: On the first line of output above, an artificial space has been added between
4473: NetBSD and $, this is a workaround to prevent CVS expanding to the filename of
4474: the guide.
1.1 dsieger 4475:
1.184 rillig 4476: Then, I quit the editor and watched pkgsrc downloading a large source archive:
1.1 dsieger 4477:
1.184 rillig 4478: url2pkg> Running "make makesum" ...
4479: => Required installed package digest>=20010302: digest-20060826 found
4480: => Fetching nvu-1.0-sources.tar.bz2
4481: Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
4482: 100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA
4483: 29687976 bytes retrieved in 03:12 (150.77 KB/s)
4484: url2pkg> Running "make extract" ...
4485: => Required installed package digest>=20010302: digest-20060826 found
4486: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
4487: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
4488: work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc
4489: ===> Installing dependencies for nvu-1.0
4490: ===> Overriding tools for nvu-1.0
4491: ===> Extracting for nvu-1.0
4492: url2pkg> Adjusting the Makefile.
1.1 dsieger 4493:
1.184 rillig 4494: Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
1.1 dsieger 4495:
1.184 rillig 4496: Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
1.1 dsieger 4497:
1.184 rillig 4498: 14.2.1.2. Fixing all kinds of problems to make the package work
1.1 dsieger 4499:
1.184 rillig 4500: Now that the package has been extracted, let's see what's inside it. The
4501: package has a README.txt, but that only says something about mozilla, so it's
4502: probably useless for seeing what dependencies this package has. But since there
4503: is a GNU configure script in the package, let's hope that it will complain
4504: about everything it needs.
1.1 dsieger 4505:
1.184 rillig 4506: $ bmake
4507: => Required installed package digest>=20010302: digest-20060826 found
4508: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
4509: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
4510: ===> Patching for nvu-1.0
4511: ===> Creating toolchain wrappers for nvu-1.0
4512: ===> Configuring for nvu-1.0
4513: [...]
4514: configure: error: Perl 5.004 or higher is required.
4515: [...]
4516: WARNING: Please add USE_TOOLS+=perl to the package Makefile.
4517: [...]
1.1 dsieger 4518:
1.184 rillig 4519: That worked quite well. So I opened the package Makefile in my editor, and
4520: since it already has a USE_TOOLS line, I just appended "perl" to it. Since the
4521: dependencies of the package have changed now, and since a perl wrapper is
4522: automatically installed in the "tools" phase, I need to build the package from
4523: scratch.
1.1 dsieger 4524:
1.184 rillig 4525: $ bmake clean
4526: ===> Cleaning for nvu-1.0
4527: $ bmake
4528: [...]
4529: *** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
4530: GNU Make. You will not be able to build Mozilla without GNU Make.
4531: [...]
1.1 dsieger 4532:
1.184 rillig 4533: So I added "gmake" to the USE_TOOLS line and tried again (from scratch).
1.1 dsieger 4534:
1.184 rillig 4535: [...]
4536: checking for GTK - version >= 1.2.0... no
4537: *** Could not run GTK test program, checking why...
4538: [...]
1.1 dsieger 4539:
1.184 rillig 4540: Now to the other dependencies. The first question is: Where is the GTK package
4541: hidden in pkgsrc?
1.1 dsieger 4542:
1.184 rillig 4543: $ echo ../../*/gtk*
4544: [many packages ...]
4545: $ echo ../../*/gtk
4546: ../../x11/gtk
4547: $ echo ../../*/gtk2
4548: ../../x11/gtk2
4549: $ echo ../../*/gtk2/bui*
4550: ../../x11/gtk2/buildlink3.mk
1.1 dsieger 4551:
1.184 rillig 4552: The first try was definitely too broad. The second one had exactly one result,
4553: which is very good. But there is one pitfall with GNOME packages. Before GNOME
4554: 2 had been released, there were already many GNOME 1 packages in pkgsrc. To be
4555: able to continue to use these packages, the GNOME 2 packages were imported as
4556: separate packages, and their names usually have a "2" appended. So I checked
4557: whether this was the case here, and indeed it was.
1.1 dsieger 4558:
1.184 rillig 4559: Since the GTK2 package has a buildlink3.mk file, adding the dependency is very
4560: easy. I just inserted an .include line before the last line of the package
4561: Makefile, so that it now looks like this:
1.1 dsieger 4562:
1.184 rillig 4563: [...]
4564: .include "../../x11/gtk2/buildlink3.mk"
4565: .include "../../mk/bsd.pkg.mk
1.1 dsieger 4566:
1.184 rillig 4567: After another bmake clean && bmake, the answer was:
1.108 rillig 4568:
1.184 rillig 4569: [...]
4570: checking for gtk-config... /home/roland/pkg/bin/gtk-config
4571: checking for GTK - version >= 1.2.0... no
4572: *** Could not run GTK test program, checking why...
4573: *** The test program failed to compile or link. See the file config.log for the
4574: *** exact error that occured. This usually means GTK was incorrectly installed
4575: *** or that you have moved GTK since it was installed. In the latter case, you
4576: *** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
4577: configure: error: Test for GTK failed.
4578: [...]
1.1 dsieger 4579:
1.184 rillig 4580: In this particular case, the assumption that "every package prefers GNOME 2"
4581: had been wrong. The first of the lines above told me that this package really
4582: wanted to have the GNOME 1 version of GTK. If the package had looked for GTK2,
4583: it would have looked for pkg-config instead of gtk-config. So I changed the x11
4584: /gtk2 to x11/gtk in the package Makefile, and tried again.
1.1 dsieger 4585:
1.184 rillig 4586: [...]
4587: cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...]
4588: In file included from xpidl.c:42:
4589: xpidl.h:53:24: libIDL/IDL.h: No such file or directory
4590: In file included from xpidl.c:42:
4591: xpidl.h:132: error: parse error before "IDL_ns"
4592: [...]
1.1 dsieger 4593:
1.184 rillig 4594: The package still does not find all of its dependencies. Now the question is:
4595: Which package provides the libIDL/IDL.h header file?
1.1 dsieger 4596:
1.184 rillig 4597: $ echo ../../*/*idl*
4598: ../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
4599: $ echo ../../*/*IDL*
4600: ../../net/libIDL
1.1 dsieger 4601:
1.184 rillig 4602: Let's take the one from the second try. So I included the ../../net/libIDL/
4603: buildlink3.mk file and tried again. But the error didn't change. After digging
4604: through some of the code, I concluded that the build process of the package was
4605: broken and couldn't have ever worked, but since the Mozilla source tree is
4606: quite large, I didn't want to fix it. So I added the following to the package
4607: Makefile and tried again:
1.1 dsieger 4608:
1.184 rillig 4609: CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
4610: BUILDLINK_TRANSFORM+= l:IDL:IDL-2
1.1 dsieger 4611:
1.184 rillig 4612: The latter line is needed because the package expects the library libIDL.so,
4613: but only libIDL-2.so is available. So I told the compiler wrapper to rewrite
4614: that on the fly.
1.1 dsieger 4615:
1.184 rillig 4616: The next problem was related to a recent change of the FreeType interface. I
4617: looked up in www/seamonkey which patch files were relevant for this issue and
4618: copied them to the patches directory. Then I retried, fixed the patches so that
4619: they applied cleanly and retried again. This time, everything worked.
1.1 dsieger 4620:
1.184 rillig 4621: 14.2.1.3. Installing the package
1.1 dsieger 4622:
1.184 rillig 4623: $ bmake CHECK_FILES=no install
4624: [...]
4625: $ bmake print-PLIST >PLIST
4626: $ bmake deinstall
4627: $ bmake install
1.1 dsieger 4628:
1.184 rillig 4629: Chapter 15. Programming in Makefiles
1.1 dsieger 4630:
1.184 rillig 4631: Table of Contents
1.1 dsieger 4632:
1.184 rillig 4633: 15.1. Caveats
4634: 15.2. Makefile variables
1.1 dsieger 4635:
1.184 rillig 4636: 15.2.1. Naming conventions
1.1 dsieger 4637:
1.184 rillig 4638: 15.3. Code snippets
1.1 dsieger 4639:
1.184 rillig 4640: 15.3.1. Adding things to a list
4641: 15.3.2. Echoing a string exactly as-is
4642: 15.3.3. Passing CFLAGS to GNU configure scripts
4643: 15.3.4. Handling possibly empty variables
1.1 dsieger 4644:
1.184 rillig 4645: Pkgsrc consists of many Makefile fragments, each of which forms a well-defined
4646: part of the pkgsrc system. Using the make(1) system as a programming language
4647: for a big system like pkgsrc requires some discipline to keep the code correct
4648: and understandable.
1.1 dsieger 4649:
1.184 rillig 4650: The basic ingredients for Makefile programming are variables and shell
4651: commands. Among these shell commands may even be more complex ones like awk(1)
4652: programs. To make sure that every shell command runs as intended it is
4653: necessary to quote all variables correctly when they are used.
1.1 dsieger 4654:
1.184 rillig 4655: This chapter describes some patterns that appear quite often in Makefiles,
4656: including the pitfalls that come along with them.
1.1 dsieger 4657:
1.184 rillig 4658: 15.1. Caveats
1.1 dsieger 4659:
1.184 rillig 4660: * When you are creating a file as a target of a rule, always write the data
4661: to a temporary file first and finally rename that file. Otherwise there
4662: might occur an error in the middle of generating the file, and when the
4663: user runs make(1) for the second time, the file exists and will not be
4664: regenerated properly. Example:
1.1 dsieger 4665:
1.184 rillig 4666: wrong:
4667: @echo "line 1" > ${.TARGET}
4668: @echo "line 2" >> ${.TARGET}
4669: @false
1.1 dsieger 4670:
1.184 rillig 4671: correct:
4672: @echo "line 1" > ${.TARGET}.tmp
4673: @echo "line 2" >> ${.TARGET}.tmp
4674: @false
4675: @mv ${.TARGET}.tmp ${.TARGET}
1.1 dsieger 4676:
1.184 rillig 4677: When you run make wrong twice, the file wrong will exist, although there
4678: was an error message in the first run. On the other hand, running make
4679: correct gives an error message twice, as expected.
1.1 dsieger 4680:
1.184 rillig 4681: You might remember that make(1) sometimes removes ${.TARGET} in case of
4682: error, but this only happens when it is interrupted, for example by
4683: pressing Ctrl+C. This does not happen when one of the commands fails (like
4684: false(1) above).
1.1 dsieger 4685:
1.184 rillig 4686: 15.2. Makefile variables
1.1 dsieger 4687:
1.184 rillig 4688: Makefile variables contain strings that can be processed using the five
4689: operators =, +=, ?=, := and !=, which are described in the make(1) man page.
1.1 dsieger 4690:
1.184 rillig 4691: When a variable's value is parsed from a Makefile, the hash character # and the
4692: backslash character \ are handled specially. If a backslash is the last
4693: character in a line, that backslash is removed from the line and the line
4694: continues with the next line of the file.
1.1 dsieger 4695:
1.184 rillig 4696: The # character starts a comment that reaches until the end of the line. To get
4697: an actual # character, such as in a URL, write \# instead.
1.1 dsieger 4698:
1.184 rillig 4699: The evaluation of variables either happens immediately or lazy. It happens
4700: immediately when the variable occurs on the right-hand side of the := or the !=
4701: operator, in a .if condition or a .for loop. In the other cases, it is
4702: evaluated lazily.
1.1 dsieger 4703:
1.184 rillig 4704: Some of the modifiers split the string into words and then operate on the
4705: words, others operate on the string as a whole. When a string is split into
4706: words, double quotes and single quotes are interpreted as delimiters, just like
4707: in sh(1).
1.1 dsieger 4708:
1.184 rillig 4709: 15.2.1. Naming conventions
1.1 dsieger 4710:
1.184 rillig 4711: * All variable names starting with an underscore are reserved for use by the
4712: pkgsrc infrastructure. They shall not be used by packages.
1.1 dsieger 4713:
1.184 rillig 4714: * In .for loops you should use lowercase variable names for the iteration
4715: variables.
1.1 dsieger 4716:
1.184 rillig 4717: * All list variables should have a plural name, such as PKG_OPTIONS or
4718: DISTFILES.
1.1 dsieger 4719:
1.184 rillig 4720: 15.3. Code snippets
1.1 dsieger 4721:
1.184 rillig 4722: 15.3.1. Adding things to a list
1.1 dsieger 4723:
1.184 rillig 4724: When adding a string that possibly contains whitespace or quotes to a list
4725: (example 1), it must be quoted using the :Q modifier.
1.1 dsieger 4726:
1.184 rillig 4727: When adding another list to a list (example 2), it must not be quoted, since
4728: its elements are already quoted.
1.1 dsieger 4729:
1.184 rillig 4730: STRING= foo * bar `date`
4731: LIST= # empty
4732: ANOTHER_LIST= a=b c=d
1.1 dsieger 4733:
1.184 rillig 4734: LIST+= ${STRING:Q} # 1
4735: LIST+= ${ANOTHER_LIST} # 2
1.1 dsieger 4736:
1.184 rillig 4737: 15.3.2. Echoing a string exactly as-is
1.1 dsieger 4738:
1.184 rillig 4739: Echoing a string containing special characters needs special work.
1.1 dsieger 4740:
1.184 rillig 4741: STRING= foo bar < > * `date` $$HOME ' "
4742: EXAMPLE_ENV= string=${STRING:Q} x=multiple\ quoted\ words
1.1 dsieger 4743:
1.184 rillig 4744: all:
4745: echo ${STRING} # 1
4746: echo ${STRING:Q} # 2
4747: printf '%s\n' ${STRING:Q}'' # 3
4748: env ${EXAMPLE_ENV} sh -c 'echo "$$string"; echo "$$x"' # 4
1.1 dsieger 4749:
1.184 rillig 4750: Example 1 leads to a syntax error in the shell, as the characters are just
4751: copied.
1.1 dsieger 4752:
1.184 rillig 4753: Example 2 quotes the string so that the shell interprets it correctly. But the
4754: echo command may additionally interpret strings with a leading dash or those
4755: containing backslashes.
1.1 dsieger 4756:
1.184 rillig 4757: Example 3 can handle arbitrary strings, since printf(1) only interprets the
4758: format string, but not the next argument. The trailing single quotes handle the
4759: case when the string is empty. In that case, the :Q modifier would result in an
4760: empty string too, which would then be skipped by the shell. For printf(1) this
4761: doesn't make a difference, but other programs may care.
1.1 dsieger 4762:
1.184 rillig 4763: In example 4, the EXAMPLE_ENV does not need to be quoted because the quoting
4764: has already been done when adding elements to the list.
1.1 dsieger 4765:
1.184 rillig 4766: 15.3.3. Passing CFLAGS to GNU configure scripts
1.1 dsieger 4767:
1.184 rillig 4768: When passing CFLAGS or similar variables to a GNU-style configure script
4769: (especially those that call other configure scripts), it must not have leading
4770: or trailing whitespace, since otherwise the configure script gets confused. To
4771: trim leading and trailing whitespace, use the :M modifier, as in the following
4772: example:
1.1 dsieger 4773:
1.184 rillig 4774: CPPFLAGS= # empty
4775: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX}\"
4776: CPPFLAGS+= ${MY_CPPFLAGS}
1.1 dsieger 4777:
1.184 rillig 4778: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
1.1 dsieger 4779:
1.184 rillig 4780: all:
4781: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
4782: echo x${CONFIGURE_ARGS:Q}x # properly trimmed
1.1 dsieger 4783:
1.184 rillig 4784: In this example, CPPFLAGS has both leading and trailing whitespace because the
4785: += operator always adds a space.
1.1 dsieger 4786:
1.184 rillig 4787: 15.3.4. Handling possibly empty variables
1.1 dsieger 4788:
1.184 rillig 4789: When a possibly empty variable is used in a shell program, it may lead to a
4790: syntax error.
1.1 dsieger 4791:
1.184 rillig 4792: EGFILES= # empty
1.1 dsieger 4793:
1.184 rillig 4794: install-examples: # produces a syntax error in the shell
4795: for egfile in ${EGFILES}; do \
4796: echo "Installing $$egfile"; \
4797: done
1.1 dsieger 4798:
1.184 rillig 4799: The shell only sees the text for egfile in ; do, since ${EGFILES} is replaced
4800: with an empty string by make(1). To fix this syntax error, use one of the
4801: snippets below.
1.1 dsieger 4802:
1.184 rillig 4803: EMPTY= # empty
1.1 dsieger 4804:
1.184 rillig 4805: install-examples:
4806: for egfile in ${EGFILES} ""; do \
4807: [ -n "$$egfile" ] || continue; \
4808: echo "Installing $$egfile"; \
4809: done
1.1 dsieger 4810:
1.184 rillig 4811: In this case, an empty string is appended to the iteration list (to prevent the
4812: syntax error) and filtered out later.
1.1 dsieger 4813:
1.184 rillig 4814: EGFILES= # empty
1.1 dsieger 4815:
1.184 rillig 4816: install-examples:
4817: .for egfile in ${EGFILES}
4818: echo "Installing ${egfile}"
4819: .endfor
1.1 dsieger 4820:
1.184 rillig 4821: If one of the filenames contains special characters, it should be enclosed in
4822: single or double quotes.
1.1 dsieger 4823:
1.184 rillig 4824: To have a shell command test whether a make variable is empty, use the
4825: following code: ${TEST} -z ${POSSIBLY_EMPTY:Q}"".
1.1 dsieger 4826:
1.184 rillig 4827: Chapter 16. Options handling
1.1 dsieger 4828:
4829: Table of Contents
4830:
1.184 rillig 4831: 16.1. Global default options
4832: 16.2. Converting packages to use bsd.options.mk
4833: 16.3. Option Names
4834: 16.4. Determining the options of dependencies
1.1 dsieger 4835:
4836: Many packages have the ability to be built to support different sets of
4837: features. bsd.options.mk is a framework in pkgsrc that provides generic
4838: handling of those options that determine different ways in which the packages
4839: can be built. It's possible for the user to specify exactly which sets of
4840: options will be built into a package or to allow a set of global default
4841: options apply.
4842:
1.7 rillig 4843: There are two broad classes of behaviors that one might want to control via
4844: options. One is whether some particular feature is enabled in a program that
4845: will be built anyway, often by including or not including a dependency on some
4846: other package. The other is whether or not an additional program will be built
4847: as part of the package. Generally, it is better to make a split package for
4848: such additional programs instead of using options, because it enables binary
4849: packages to be built which can then be added separately. For example, the foo
4850: package might have minimal dependencies (those packages without which foo
4851: doesn't make sense), and then the foo-gfoo package might include the GTK
4852: frontend program gfoo. This is better than including a gtk option to foo that
4853: adds gfoo, because either that option is default, in which case binary users
4854: can't get foo without gfoo, or not default, in which case they can't get gfoo.
4855: With split packages, they can install foo without having GTK, and later decide
4856: to install gfoo (pulling in GTK at that time). This is an advantage to source
4857: users too, avoiding the need for rebuilds.
4858:
4859: Plugins with widely varying dependencies should usually be split instead of
4860: options.
4861:
4862: It is often more work to maintain split packages, especially if the upstream
4863: package does not support this. The decision of split vs. option should be made
4864: based on the likelihood that users will want or object to the various pieces,
4865: the size of the dependencies that are included, and the amount of work.
4866:
4867: A further consideration is licensing. Non-free parts, or parts that depend on
4868: non-free dependencies (especially plugins) should almost always be split if
4869: feasible.
4870:
1.184 rillig 4871: 16.1. Global default options
1.1 dsieger 4872:
4873: Global default options are listed in PKG_DEFAULT_OPTIONS, which is a list of
4874: the options that should be built into every package if that option is
1.4 rillig 4875: supported. This variable should be set in mk.conf.
1.1 dsieger 4876:
1.184 rillig 4877: 16.2. Converting packages to use bsd.options.mk
1.1 dsieger 4878:
4879: The following example shows how bsd.options.mk should be used by the
4880: hypothetical ``wibble'' package, either in the package Makefile, or in a file,
4881: e.g. options.mk, that is included by the main package Makefile.
4882:
4883: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
4884: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
4885: PKG_OPTIONS_OPTIONAL_GROUPS= database
4886: PKG_OPTIONS_GROUP.database= mysql pgsql
4887: PKG_SUGGESTED_OPTIONS= wibble-foo
4888: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
4889: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
4890:
4891: .include "../../mk/bsd.prefs.mk"
4892:
4893: # this package was previously named wibble2
4894: .if defined(PKG_OPTIONS.wibble2)
4895: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
4896: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
4897: "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead."
4898: .endif
4899:
4900: .include "../../mk/bsd.options.mk"
4901:
4902: # Package-specific option-handling
4903:
4904: ###
4905: ### FOO support
4906: ###
4907: .if !empty(PKG_OPTIONS:Mwibble-foo)
4908: CONFIGURE_ARGS+= --enable-foo
4909: .endif
4910:
4911: ###
4912: ### LDAP support
4913: ###
4914: .if !empty(PKG_OPTIONS:Mldap)
4915: . include "../../databases/openldap-client/buildlink3.mk"
4916: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client}
4917: .endif
4918:
4919: ###
4920: ### database support
4921: ###
4922: .if !empty(PKG_OPTIONS:Mmysql)
4923: . include "../../mk/mysql.buildlink3.mk"
4924: .endif
4925: .if !empty(PKG_OPTIONS:Mpgsql)
4926: . include "../../mk/pgsql.buildlink3.mk"
4927: .endif
4928:
4929: The first section contains the information about which build options are
4930: supported by the package, and any default options settings if needed.
4931:
4932: 1. PKG_OPTIONS_VAR is the name of the make(1) variable that the user can set
4933: to override the default options. It should be set to PKG_OPTIONS.pkgbase.
4934: Do not set it to PKG_OPTIONS.${PKGBASE}, since PKGBASE is not defined at
4935: the point where the options are processed.
4936:
4937: 2. PKG_SUPPORTED_OPTIONS is a list of build options supported by the package.
4938:
4939: 3. PKG_OPTIONS_OPTIONAL_GROUPS is a list of names of groups of mutually
4940: exclusive options. The options in each group are listed in
4941: PKG_OPTIONS_GROUP.groupname. The most specific setting of any option from
4942: the group takes precedence over all other options in the group. Options
4943: from the groups will be automatically added to PKG_SUPPORTED_OPTIONS.
4944:
4945: 4. PKG_OPTIONS_REQUIRED_GROUPS is like PKG_OPTIONS_OPTIONAL_GROUPS, but
4946: building the packages will fail if no option from the group is selected.
4947:
4948: 5. PKG_OPTIONS_NONEMPTY_SETS is a list of names of sets of options. At least
4949: one option from each set must be selected. The options in each set are
4950: listed in PKG_OPTIONS_SET.setname. Options from the sets will be
4951: automatically added to PKG_SUPPORTED_OPTIONS. Building the package will
4952: fail if no option from the set is selected.
4953:
4954: 6. PKG_SUGGESTED_OPTIONS is a list of build options which are enabled by
4955: default.
4956:
4957: 7. PKG_OPTIONS_LEGACY_VARS is a list of "USE_VARIABLE:option" pairs that map
1.4 rillig 4958: legacy mk.conf variables to their option counterparts. Pairs should be
1.1 dsieger 4959: added with "+=" to keep the listing of global legacy variables. A warning
4960: will be issued if the user uses a legacy variable.
4961:
4962: 8. PKG_OPTIONS_LEGACY_OPTS is a list of "old-option:new-option" pairs that map
4963: options that have been renamed to their new counterparts. Pairs should be
4964: added with "+=" to keep the listing of global legacy options. A warning
4965: will be issued if the user uses a legacy option.
4966:
4967: 9. PKG_LEGACY_OPTIONS is a list of options implied by deprecated variables
4968: used. This can be used for cases that neither PKG_OPTIONS_LEGACY_VARS nor
4969: PKG_OPTIONS_LEGACY_OPTS can handle, e. g. when PKG_OPTIONS_VAR is renamed.
4970:
4971: 10. PKG_OPTIONS_DEPRECATED_WARNINGS is a list of warnings about deprecated
4972: variables or options used, and what to use instead.
4973:
4974: A package should never modify PKG_DEFAULT_OPTIONS or the variable named in
4975: PKG_OPTIONS_VAR. These are strictly user-settable. To suggest a default set of
4976: options, use PKG_SUGGESTED_OPTIONS.
4977:
4978: PKG_OPTIONS_VAR must be defined before including bsd.options.mk. If none of
4979: PKG_SUPPORTED_OPTIONS, PKG_OPTIONS_OPTIONAL_GROUPS, and
4980: PKG_OPTIONS_REQUIRED_GROUPS are defined (as can happen with platform-specific
4981: options if none of them is supported on the current platform), PKG_OPTIONS is
4982: set to the empty list and the package is otherwise treated as not using the
4983: options framework.
4984:
4985: After the inclusion of bsd.options.mk, the variable PKG_OPTIONS contains the
4986: list of selected build options, properly filtered to remove unsupported and
4987: duplicate options.
4988:
4989: The remaining sections contain the logic that is specific to each option. The
4990: correct way to check for an option is to check whether it is listed in
4991: PKG_OPTIONS:
4992:
4993: .if !empty(PKG_OPTIONS:Moption)
4994:
1.184 rillig 4995: 16.3. Option Names
1.1 dsieger 4996:
4997: Options that enable similar features in different packages (like optional
4998: support for a library) should use a common name in all packages that support it
4999: (like the name of the library). If another package already has an option with
5000: the same meaning, use the same name.
5001:
5002: Options that enable features specific to one package, where it's unlikely that
5003: another (unrelated) package has the same (or a similar) optional feature,
5004: should use a name prefixed with pkgname-.
5005:
5006: If a group of related packages share an optional feature specific to that
5007: group, prefix it with the name of the "main" package (e. g.
5008: djbware-errno-hack).
5009:
5010: For new options, add a line to mk/defaults/options.description. Lines have two
5011: fields, separated by tab. The first field is the option name, the second its
5012: description. The description should be a whole sentence (starting with an
5013: uppercase letter and ending with a period) that describes what enabling the
5014: option does. E. g. "Enable ispell support." The file is sorted by option names.
5015:
1.184 rillig 5016: 16.4. Determining the options of dependencies
1.7 rillig 5017:
5018: When writing buildlink3.mk files, it is often necessary to list different
5019: dependencies based on the options with which the package was built. For
5020: querying these options, the file pkgsrc/mk/pkg-build-options.mk should be used.
5021: A typical example looks like this:
5022:
5023: pkgbase := libpurple
5024: .include "../../mk/pkg-build-options.mk"
5025:
5026: .if !empty(PKG_BUILD_OPTIONS.libpurple:Mdbus)
5027: ...
5028: .endif
5029:
5030: Including pkg-build-options.mk here will set the variable
5031: PKG_BUILD_OPTIONS.libpurple to the build options of the libpurple package,
5032: which can then be queried like PKG_OPTIONS in the options.mk file. See the file
5033: pkg-build-options.mk for more details.
5034:
1.184 rillig 5035: Chapter 17. Tools needed for building or running
5036:
5037: Table of Contents
5038:
5039: 17.1. Tools for pkgsrc builds
5040: 17.2. Tools needed by packages
5041: 17.3. Tools provided by platforms
5042:
5043: The USE_TOOLS definition is used both internally by pkgsrc and also for
5044: individual packages to define what commands are needed for building a package
5045: (like TOOL_DEPENDS) or for later run-time of an installed packaged (such as
5046: DEPENDS). If the native system provides an adequate tool, then in many cases, a
5047: pkgsrc package will not be used.
5048:
5049: When building a package, the replacement tools are made available in a
5050: directory (as symlinks or wrapper scripts) that is early in the executable
5051: search path. Just like the buildlink system, this helps with consistent builds.
5052:
5053: A tool may be needed to help build a specific package. For example, perl, GNU
5054: make (gmake) or yacc may be needed.
5055:
5056: Also a tool may be needed, for example, because the native system's supplied
5057: tool may be inefficient for building a package with pkgsrc. For example, a
5058: package may need GNU awk, bison (instead of yacc) or a better sed.
5059:
5060: The tools used by a package can be listed by running make show-tools.
5061:
5062: 17.1. Tools for pkgsrc builds
5063:
5064: The default set of tools used by pkgsrc is defined in bsd.pkg.mk. This includes
5065: standard Unix tools, such as: cat, awk, chmod, test, and so on. These can be
5066: seen by running: make show-var VARNAME=USE_TOOLS.
5067:
5068: If a package needs a specific program to build then the USE_TOOLS variable can
5069: be used to define the tools needed.
5070:
5071: 17.2. Tools needed by packages
5072:
5073: In the following examples, the :run means that it is needed at run-time (and
5074: becomes a DEPENDS). The default is a build dependency which can be set with
5075: :build. (So in this example, it is the same as gmake:build and
5076: pkg-config:build.)
5077:
5078: USE_TOOLS+= gmake perl:run pkg-config
5079:
5080: When using the tools framework, a TOOLS_PATH.foo variable is defined which
5081: contains the full path to the appropriate tool. For example, TOOLS_PATH.bash
5082: could be "/bin/bash" on Linux systems.
5083:
5084: If you always need a pkgsrc version of the tool at run-time, then just use
5085: DEPENDS instead.
5086:
5087: 17.3. Tools provided by platforms
5088:
5089: When improving or porting pkgsrc to a new platform, have a look at (or create)
5090: the corresponding platform specific make file fragment under pkgsrc/mk/tools/
5091: tools.${OPSYS}.mk which defines the name of the common tools. For example:
5092:
5093: .if exists(/usr/bin/bzcat)
5094: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
5095: .elif exists(/usr/bin/bzip2)
5096: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
5097: .endif
5098:
5099: TOOLS_PLATFORM.true?= true # shell builtin
5100:
5101: Chapter 18. Buildlink methodology
1.1 dsieger 5102:
5103: Table of Contents
5104:
1.184 rillig 5105: 18.1. Converting packages to use buildlink3
5106: 18.2. Writing buildlink3.mk files
5107:
5108: 18.2.1. Anatomy of a buildlink3.mk file
5109: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
5110: buildlink3.mk files
5111:
5112: 18.3. Writing builtin.mk files
5113:
5114: 18.3.1. Anatomy of a builtin.mk file
5115: 18.3.2. Global preferences for native or pkgsrc software
5116:
5117: Buildlink is a framework in pkgsrc that controls what headers and libraries are
5118: seen by a package's configure and build processes. This is implemented in a two
5119: step process:
5120:
5121: 1. Symlink headers and libraries for dependencies into BUILDLINK_DIR, which by
5122: default is a subdirectory of WRKDIR.
5123:
5124: 2. Create wrapper scripts that are used in place of the normal compiler tools
5125: that translate -I${LOCALBASE}/include and -L${LOCALBASE}/lib into
5126: references to BUILDLINK_DIR. The wrapper scripts also make native compiler
5127: on some operating systems look like GCC, so that packages that expect GCC
5128: won't require modifications to build with those native compilers.
5129:
5130: This normalizes the environment in which a package is built so that the package
5131: may be built consistently despite what other software may be installed. Please
5132: note that the normal system header and library paths, e.g. /usr/include, /usr/
5133: lib, etc., are always searched -- buildlink3 is designed to insulate the
5134: package build from non-system-supplied software.
5135:
5136: 18.1. Converting packages to use buildlink3
1.1 dsieger 5137:
1.184 rillig 5138: The process of converting packages to use the buildlink3 framework ("bl3ifying"
5139: ) is fairly straightforward. The things to keep in mind are:
1.1 dsieger 5140:
1.184 rillig 5141: 1. Ensure that the build always calls the wrapper scripts instead of the
5142: actual toolchain. Some packages are tricky, and the only way to know for
5143: sure is the check ${WRKDIR}/.work.log to see if the wrappers are being
5144: invoked.
1.1 dsieger 5145:
1.184 rillig 5146: 2. Don't override PREFIX from within the package Makefile, e.g. Java VMs,
5147: standalone shells, etc., because the code to symlink files into $
5148: {BUILDLINK_DIR} looks for files relative to "pkg_info -qp pkgname".
1.1 dsieger 5149:
1.184 rillig 5150: 3. Remember that only the buildlink3.mk files that you list in a package's
5151: Makefile are added as dependencies for that package.
1.1 dsieger 5152:
1.184 rillig 5153: If a dependency on a particular package is required for its libraries and
5154: headers, then we replace:
1.1 dsieger 5155:
1.184 rillig 5156: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 dsieger 5157:
1.184 rillig 5158: with
1.1 dsieger 5159:
1.184 rillig 5160: .include "../../category/foo/buildlink3.mk"
1.1 dsieger 5161:
1.184 rillig 5162: The buildlink3.mk files usually define the required dependencies. If you need a
5163: newer version of the dependency when using buildlink3.mk files, then you can
5164: define it in your Makefile; for example:
1.1 dsieger 5165:
1.184 rillig 5166: BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0
5167: .include "../../category/foo/buildlink3.mk"
1.1 dsieger 5168:
1.184 rillig 5169: There are several buildlink3.mk files in pkgsrc/mk that handle special package
5170: issues:
1.1 dsieger 5171:
1.184 rillig 5172: * bdb.buildlink3.mk chooses either the native or a pkgsrc Berkeley DB
5173: implementation based on the values of BDB_ACCEPTED and BDB_DEFAULT.
1.1 dsieger 5174:
1.184 rillig 5175: * curses.buildlink3.mk: If the system comes with neither Curses nor NCurses,
5176: this will take care to install the devel/ncurses package.
1.1 dsieger 5177:
1.184 rillig 5178: * krb5.buildlink3.mk uses the value of KRB5_ACCEPTED to choose between adding
5179: a dependency on Heimdal or MIT-krb5 for packages that require a Kerberos 5
5180: implementation.
1.1 dsieger 5181:
1.184 rillig 5182: * motif.buildlink3.mk checks for a system-provided Motif installation or adds
5183: a dependency on x11/lesstif or x11/motif. The user can set MOTIF_TYPE to "
5184: dt", "lesstif" or "motif" to choose which Motif version will be used.
1.1 dsieger 5185:
1.184 rillig 5186: * readline.buildlink3.mk checks for a system-provided GNU readline or
5187: editline (libedit) installation, or adds a dependency on devel/readline,
5188: devel/editline. The user can set READLINE_DEFAULT to choose readline
5189: implementation. If your package really needs GNU readline library, its
5190: Makefile should include devel/readline/buildlink3.mk instead of
5191: readline.buildlink3.mk.
1.1 dsieger 5192:
1.184 rillig 5193: * oss.buildlink3.mk defines several variables that may be used by packages
5194: that use the Open Sound System (OSS) API.
1.1 dsieger 5195:
1.184 rillig 5196: * pgsql.buildlink3.mk will accept any of the Postgres versions in the
5197: variable PGSQL_VERSIONS_ACCEPTED and default to the version
5198: PGSQL_VERSION_DEFAULT. See the file for more information.
1.1 dsieger 5199:
1.184 rillig 5200: * pthread.buildlink3.mk uses the value of PTHREAD_OPTS and checks for native
5201: pthreads or adds a dependency on devel/pth as needed.
1.1 dsieger 5202:
1.184 rillig 5203: * xaw.buildlink3.mk uses the value of XAW_TYPE to choose a particular Athena
5204: widgets library.
1.1 dsieger 5205:
1.184 rillig 5206: The comments in those buildlink3.mk files provide a more complete description
5207: of how to use them properly.
1.1 dsieger 5208:
1.184 rillig 5209: 18.2. Writing buildlink3.mk files
1.1 dsieger 5210:
1.184 rillig 5211: A package's buildlink3.mk file is included by Makefiles to indicate the need to
5212: compile and link against header files and libraries provided by the package. A
5213: buildlink3.mk file should always provide enough information to add the correct
5214: type of dependency relationship and include any other buildlink3.mk files that
5215: it needs to find headers and libraries that it needs in turn.
1.1 dsieger 5216:
1.184 rillig 5217: To generate an initial buildlink3.mk file for further editing, Rene Hexel's
5218: pkgtools/createbuildlink package is highly recommended. For most packages, the
5219: following command will generate a good starting point for buildlink3.mk files:
1.1 dsieger 5220:
1.184 rillig 5221: % cd pkgsrc/category/pkgdir
5222: % createbuildlink >buildlink3.mk
1.1 dsieger 5223:
5224:
1.184 rillig 5225: 18.2.1. Anatomy of a buildlink3.mk file
1.1 dsieger 5226:
1.184 rillig 5227: The following real-life example buildlink3.mk is taken from pkgsrc/graphics/
5228: tiff:
1.14 jmcneill 5229:
1.184 rillig 5230: # $NetBSD: buildlink3.mk,v 1.16 2009/03/20 19:24:45 joerg Exp $
1.1 dsieger 5231:
1.184 rillig 5232: BUILDLINK_TREE+= tiff
1.1 dsieger 5233:
1.184 rillig 5234: .if !defined(TIFF_BUILDLINK3_MK)
5235: TIFF_BUILDLINK3_MK:=
1.1 dsieger 5236:
1.184 rillig 5237: BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1
5238: BUILDLINK_ABI_DEPENDS.tiff+= tiff>=3.7.2nb1
5239: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
1.1 dsieger 5240:
1.184 rillig 5241: .include "../../devel/zlib/buildlink3.mk"
5242: .include "../../graphics/jpeg/buildlink3.mk"
5243: .endif # TIFF_BUILDLINK3_MK
1.1 dsieger 5244:
1.184 rillig 5245: BUILDLINK_TREE+= -tiff
1.1 dsieger 5246:
1.184 rillig 5247: The header and footer manipulate BUILDLINK_TREE, which is common across all
5248: buildlink3.mk files and is used to track the dependency tree.
1.1 dsieger 5249:
1.184 rillig 5250: The main section is protected from multiple inclusion and controls how the
5251: dependency on pkg is added. Several important variables are set in the section:
1.1 dsieger 5252:
1.185 wiz 5253: * BUILDLINK_API_DEPENDS.pkg is the dependency version recorded in the
1.184 rillig 5254: installed package; this should always be set using += to ensure that we're
5255: appending to any pre-existing list of values. This variable should be set
1.185 wiz 5256: to the last version of the package that had an backwards-incompatible API
1.184 rillig 5257: change.
1.1 dsieger 5258:
1.184 rillig 5259: * BUILDLINK_PKGSRCDIR.pkg is the location of the pkg pkgsrc directory.
1.1 dsieger 5260:
1.184 rillig 5261: * BUILDLINK_DEPMETHOD.pkg (not shown above) controls whether we use
5262: BUILD_DEPENDS or DEPENDS to add the dependency on pkg. The build dependency
5263: is selected by setting BUILDLINK_DEPMETHOD.pkg to "build". By default, the
5264: full dependency is used.
1.1 dsieger 5265:
1.184 rillig 5266: * BUILDLINK_INCDIRS.pkg and BUILDLINK_LIBDIRS.pkg (not shown above) are lists
5267: of subdirectories of ${BUILDLINK_PREFIX.pkg} to add to the header and
5268: library search paths. These default to "include" and "lib" respectively.
1.1 dsieger 5269:
1.184 rillig 5270: * BUILDLINK_CPPFLAGS.pkg (not shown above) is the list of preprocessor flags
5271: to add to CPPFLAGS, which are passed on to the configure and build phases.
5272: The "-I" option should be avoided and instead be handled using
5273: BUILDLINK_INCDIRS.pkg as above.
1.66 asau 5274:
1.184 rillig 5275: The following variables are all optionally defined within this second section
5276: (protected against multiple inclusion) and control which package files are
5277: symlinked into ${BUILDLINK_DIR} and how their names are transformed during the
5278: symlinking:
1.23 jakllsch 5279:
1.184 rillig 5280: * BUILDLINK_FILES.pkg (not shown above) is a shell glob pattern relative to $
5281: {BUILDLINK_PREFIX.pkg} to be symlinked into ${BUILDLINK_DIR}, e.g. include/
5282: *.h.
1.1 dsieger 5283:
1.184 rillig 5284: * BUILDLINK_FILES_CMD.pkg (not shown above) is a shell pipeline that outputs
5285: to stdout a list of files relative to ${BUILDLINK_PREFIX.pkg}. The
5286: resulting files are to be symlinked into ${BUILDLINK_DIR}. By default, this
5287: takes the +CONTENTS of a pkg and filters it through $
5288: {BUILDLINK_CONTENTS_FILTER.pkg}.
1.1 dsieger 5289:
1.184 rillig 5290: * BUILDLINK_CONTENTS_FILTER.pkg (not shown above) is a filter command that
5291: filters +CONTENTS input into a list of files relative to $
5292: {BUILDLINK_PREFIX.pkg} on stdout. By default, BUILDLINK_CONTENTS_FILTER.pkg
5293: outputs the contents of the include and lib directories in the package
5294: +CONTENTS.
1.1 dsieger 5295:
1.184 rillig 5296: * BUILDLINK_FNAME_TRANSFORM.pkg (not shown above) is a list of sed arguments
5297: used to transform the name of the source filename into a destination
5298: filename, e.g. -e "s|/curses.h|/ncurses.h|g".
1.1 dsieger 5299:
1.184 rillig 5300: This section can additionally include any buildlink3.mk needed for pkg's
5301: library dependencies. Including these buildlink3.mk files means that the
5302: headers and libraries for these dependencies are also symlinked into $
5303: {BUILDLINK_DIR} whenever the pkg buildlink3.mk file is included. Dependencies
5304: are only added for directly include buildlink3.mk files.
1.1 dsieger 5305:
1.184 rillig 5306: When providing a buildlink3.mk and including other buildlink3.mk files in it,
5307: please only add necessary ones, i.e., those whose libraries or header files are
5308: automatically exposed when the package is use.
1.1 dsieger 5309:
1.184 rillig 5310: In particular, if only an executable (bin/foo) is linked against a library,
5311: that library does not need to be propagated in the buildlink3.mk file.
1.1 dsieger 5312:
1.184 rillig 5313: The following steps should help you decide if a buildlink3.mk file needs to be
5314: included:
1.1 dsieger 5315:
1.184 rillig 5316: * Look at the installed header files: What headers do they include? The
5317: packages providing these files must be buildlinked.
1.1 dsieger 5318:
1.184 rillig 5319: * Run ldd on all installed libraries and look against what other libraries
5320: they link. Some of the packages providing these probably need to be
5321: buildlinked; however, it's not automatic, since e.g. GTK on some systems
5322: pulls in the X libraries, so they will show up in the ldd output, while on
5323: others (like OS X) it won't. ldd output can thus only be used as a hint.
1.1 dsieger 5324:
1.184 rillig 5325: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
5326: buildlink3.mk files
1.16 jnemeth 5327:
1.185 wiz 5328: Both variables set lower bounds for a version of this package. The two
5329: variables differ in that one describes source compatibility (API) and the other
5330: binary compatibility (ABI). The difference is that a change in the API breaks
5331: compilation of programs while changes in the ABI stop compiled programs from
5332: running.
5333:
5334: The BUILDLINK_API_DEPENDS.pkg variable in a buildlink3.mk should be changed
5335: very rarely. (One possible scenario: If all packages using this package need a
5336: higher version than defined in the buildlink3.mk, BUILDLINK_API_DEPENDS.pkg
5337: could be updated to that higher version.)
5338:
5339: On the other hand, changes to BUILDLINK_ABI_DEPENDS.pkg are more common. The
5340: variable will need to be updated every time the major version of one of its
5341: shared libraries is changed, or any other change where a binary built against
5342: the previous version of the package will not run against the new version any
5343: longer.
5344:
5345: In such a case, the package's BUILDLINK_ABI_DEPENDS.pkg must be increased to
5346: require the new package version. Then the PKGREVISION of all packages foo that
5347: depend on this package need to be increased, and if they have buildlink3.mk
5348: files, BUILDLINK_ABI_DEPENDS.foo in their buildlink3.mk files must be increased
5349: to the new version as well. This is required so that a package will pull in the
5350: versions of the packages that use the new ABI and that the packages'
5351: PKGREVISIONs uniquely identify the packages built against the new ABI. The
5352: pkgtools/revbump package can help with these updates.
1.1 dsieger 5353:
1.184 rillig 5354: See Section 21.1.5, "Handling dependencies" for more information about
1.185 wiz 5355: dependencies on other packages, including the BUILDLINK_API_DEPENDS
5356: definitions.
1.1 dsieger 5357:
1.184 rillig 5358: Please take careful consideration before adjusting BUILDLINK_API_DEPENDS.pkg or
1.185 wiz 5359: BUILDLINK_ABI_DEPENDS.pkg in a buildlink3.mk file as we don't want to cause
5360: unneeded package deletions and rebuilds. In many cases, new versions of
5361: packages work just fine with older dependencies.
1.1 dsieger 5362:
1.184 rillig 5363: Also it is not needed to set BUILDLINK_ABI_DEPENDS.pkg when it is identical to
5364: BUILDLINK_API_DEPENDS.pkg.
1.1 dsieger 5365:
1.184 rillig 5366: 18.3. Writing builtin.mk files
1.1 dsieger 5367:
1.184 rillig 5368: Some packages in pkgsrc install headers and libraries that coincide with
5369: headers and libraries present in the base system. Aside from a buildlink3.mk
5370: file, these packages should also include a builtin.mk file that includes the
5371: necessary checks to decide whether using the built-in software or the pkgsrc
5372: software is appropriate.
1.1 dsieger 5373:
1.184 rillig 5374: The only requirements of a builtin.mk file for pkg are:
1.1 dsieger 5375:
1.184 rillig 5376: 1. It should set USE_BUILTIN.pkg to either "yes" or "no" after it is included.
1.1 dsieger 5377:
1.184 rillig 5378: 2. It should not override any USE_BUILTIN.pkg which is already set before the
5379: builtin.mk file is included.
1.1 dsieger 5380:
1.184 rillig 5381: 3. It should be written to allow multiple inclusion. This is very important
5382: and takes careful attention to Makefile coding.
1.1 dsieger 5383:
1.184 rillig 5384: 18.3.1. Anatomy of a builtin.mk file
1.1 dsieger 5385:
1.184 rillig 5386: The following is the recommended template for builtin.mk files:
1.1 dsieger 5387:
1.184 rillig 5388: .if !defined(IS_BUILTIN.foo)
5389: #
5390: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
5391: # genuinely exists in the system or not.
5392: #
5393: IS_BUILTIN.foo?= no
1.1 dsieger 5394:
1.184 rillig 5395: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
5396: # version can be determined.
5397: #
5398: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
5399: BUILTIN_PKG.foo?= foo-1.0
5400: . endif
5401: .endif # IS_BUILTIN.foo
1.1 dsieger 5402:
1.184 rillig 5403: .if !defined(USE_BUILTIN.foo)
5404: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
5405: . if defined(BUILTIN_PKG.foo)
5406: . for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
5407: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
5408: USE_BUILTIN.foo!= \
5409: ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \
5410: && ${ECHO} "yes" || ${ECHO} "no"
5411: . endif
5412: . endfor
5413: . endif
5414: .endif # USE_BUILTIN.foo
1.1 dsieger 5415:
1.184 rillig 5416: CHECK_BUILTIN.foo?= no
5417: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
5418: #
5419: # Here we place code that depends on whether USE_BUILTIN.foo is set to
5420: # "yes" or "no".
5421: #
5422: .endif # CHECK_BUILTIN.foo
1.1 dsieger 5423:
1.184 rillig 5424: The first section sets IS_BUILTIN.pkg depending on if pkg really exists in the
5425: base system. This should not be a base system software with similar
5426: functionality to pkg; it should only be "yes" if the actual package is included
5427: as part of the base system. This variable is only used internally within the
5428: builtin.mk file.
1.1 dsieger 5429:
1.184 rillig 5430: The second section sets BUILTIN_PKG.pkg to the version of pkg in the base
5431: system if it exists (if IS_BUILTIN.pkg is "yes"). This variable is only used
5432: internally within the builtin.mk file.
1.1 dsieger 5433:
1.184 rillig 5434: The third section sets USE_BUILTIN.pkg and is required in all builtin.mk files.
5435: The code in this section must make the determination whether the built-in
5436: software is adequate to satisfy the dependencies listed in
5437: BUILDLINK_API_DEPENDS.pkg. This is typically done by comparing BUILTIN_PKG.pkg
5438: against each of the dependencies in BUILDLINK_API_DEPENDS.pkg. USE_BUILTIN.pkg
5439: must be set to the correct value by the end of the builtin.mk file. Note that
5440: USE_BUILTIN.pkg may be "yes" even if IS_BUILTIN.pkg is "no" because we may make
5441: the determination that the built-in version of the software is similar enough
5442: to be used as a replacement.
1.1 dsieger 5443:
1.184 rillig 5444: The last section is guarded by CHECK_BUILTIN.pkg, and includes code that uses
5445: the value of USE_BUILTIN.pkg set in the previous section. This typically
5446: includes, e.g., adding additional dependency restrictions and listing
5447: additional files to symlink into ${BUILDLINK_DIR} (via BUILDLINK_FILES.pkg).
1.1 dsieger 5448:
1.184 rillig 5449: 18.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 5450:
1.184 rillig 5451: When building packages, it's possible to choose whether to set a global
5452: preference for using either the built-in (native) version or the pkgsrc version
5453: of software to satisfy a dependency. This is controlled by setting
5454: PREFER_PKGSRC and PREFER_NATIVE. These variables take values of either "yes", "
5455: no", or a list of packages. PREFER_PKGSRC tells pkgsrc to use the pkgsrc
5456: versions of software, while PREFER_NATIVE tells pkgsrc to use the built-in
5457: versions. Preferences are determined by the most specific instance of the
5458: package in either PREFER_PKGSRC or PREFER_NATIVE. If a package is specified in
5459: neither or in both variables, then PREFER_PKGSRC has precedence over
5460: PREFER_NATIVE. For example, to require using pkgsrc versions of software for
5461: all but the most basic bits on a NetBSD system, you can set:
1.1 dsieger 5462:
1.184 rillig 5463: PREFER_PKGSRC= yes
5464: PREFER_NATIVE= getopt skey tcp_wrappers
1.1 dsieger 5465:
1.184 rillig 5466: A package must have a builtin.mk file to be listed in PREFER_NATIVE, otherwise
5467: it is simply ignored in that list.
1.1 dsieger 5468:
1.191 bacon 5469: PREFER_PKGSRC and PREFER_NATIVE should be set during bootstrap to ensure that
5470: the bootstrap process does not use inapropriate native tools as dependencies
5471: for core packages.
5472:
5473: # ./bootstrap --prefer-pkgsrc yes --prefer-native openssl
5474:
5475: Switching between settings globally at a later date can introduce complications
5476: with dependency resolution. This is caused by packages built with the opposite
5477: preference being installed alongside each other. Hence, any changes to these
5478: variables after bootstrap will necessitate rebuilding all packages depending on
5479: one whose preference has been changed. This is not trivial and should be
5480: avoided.
5481:
5482: When using pkgsrc on Linux systems, there is high risk of "leakage", where
5483: programs installed by pkgsrc may inadvertently use a command or library not
5484: installed by pkgsrc, e.g. those installed by yum or apt. Such foreign
5485: dependencies may be installed, removed, or upgraded to a version incompatible
5486: with the pkgsrc package at any time, causing pkgsrc packages to subsequently
5487: malfunction. Pkgsrc cannot prevent this, as it has no control over other
5488: package managers. Another potential problem is that under Redhat Enterprise and
5489: related Linux systems, yum packages are only patched and never upgraded, so
5490: eventually they may become too outdated for use by pkgsrc. Even intentionally
5491: using foreign dependencies, not considered leakage, can lead to these problems,
5492: so it is generally discouraged. In order to minimize such problems,
5493: PREFER_PKGSRC defaults to "yes" on Linux systems. This ensures that pkgsrc is
5494: aware of any changes to dependency packages and can rebuild or upgrade the
5495: entire dependency tree as needed. This default can be overridden by setting
5496: --prefer-pkgsrc to "no" or a list of packages, or by setting --prefer-native to
5497: "yes".
1.1 dsieger 5498:
1.184 rillig 5499: Chapter 19. PLIST issues
1.1 dsieger 5500:
1.184 rillig 5501: Table of Contents
1.1 dsieger 5502:
1.184 rillig 5503: 19.1. RCS ID
5504: 19.2. Semi-automatic PLIST generation
5505: 19.3. Tweaking output of make print-PLIST
5506: 19.4. Variable substitution in PLIST
5507: 19.5. Man page compression
5508: 19.6. Changing PLIST source with PLIST_SRC
5509: 19.7. Platform-specific and differing PLISTs
5510: 19.8. Build-specific PLISTs
5511: 19.9. Sharing directories between packages
1.1 dsieger 5512:
1.184 rillig 5513: The PLIST file contains a package's "packing list", i.e. a list of files that
5514: belong to the package (relative to the ${PREFIX} directory it's been installed
5515: in) plus some additional statements - see the pkg_create(1) man page for a full
5516: list. This chapter addresses some issues that need attention when dealing with
5517: the PLIST file (or files, see below!).
1.1 dsieger 5518:
1.184 rillig 5519: 19.1. RCS ID
1.1 dsieger 5520:
1.184 rillig 5521: Be sure to add a RCS ID line as the first thing in any PLIST file you write:
1.1 dsieger 5522:
1.184 rillig 5523: @comment $NetBSD $
1.1 dsieger 5524:
1.184 rillig 5525: An artificial space has been added between NetBSD and $, this is a workaround
5526: here to prevent CVS expanding to the filename of the guide. When adding the RCS
5527: ID the space should be omitted.
1.38 wiz 5528:
1.184 rillig 5529: 19.2. Semi-automatic PLIST generation
1.1 dsieger 5530:
1.184 rillig 5531: You can use the make print-PLIST command to output a PLIST that matches any new
5532: files since the package was extracted. See Section 13.17, "Other helpful
5533: targets" for more information on this target.
1.11 rillig 5534:
1.184 rillig 5535: 19.3. Tweaking output of make print-PLIST
1.1 dsieger 5536:
1.184 rillig 5537: The PRINT_PLIST_AWK variable takes a set of AWK patterns and actions that are
5538: used to filter the output of print-PLIST. You can append any chunk of AWK
5539: scripting you like to it, but be careful with quoting.
1.1 dsieger 5540:
1.184 rillig 5541: For example, to get all files inside the libdata/foo directory removed from the
5542: resulting PLIST:
1.1 dsieger 5543:
1.184 rillig 5544: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 dsieger 5545:
1.185 wiz 5546: The PRINT_PLIST_AWK transformations are evaluated after the file list and
5547: directory list are sorted. EARLY_PRINT_PLIST_AWK is like PRINT_PLIST_AWK except
5548: it operates before the file list and directory list are sorted.
5549:
1.184 rillig 5550: 19.4. Variable substitution in PLIST
1.1 dsieger 5551:
1.184 rillig 5552: A number of variables are substituted automatically in PLISTs when a package is
5553: installed on a system. This includes the following variables:
1.1 dsieger 5554:
1.184 rillig 5555: ${MACHINE_ARCH}, ${MACHINE_GNU_ARCH}
1.1 dsieger 5556:
1.184 rillig 5557: Some packages like emacs and perl embed information about which
5558: architecture they were built on into the pathnames where they install their
5559: files. To handle this case, PLIST will be preprocessed before actually
5560: used, and the symbol "${MACHINE_ARCH}" will be replaced by what uname -p
5561: gives. The same is done if the string ${MACHINE_GNU_ARCH} is embedded in
5562: PLIST somewhere - use this on packages that have GNU autoconf-created
5563: configure scripts.
1.1 dsieger 5564:
1.184 rillig 5565: Legacy note
1.1 dsieger 5566:
1.184 rillig 5567: There used to be a symbol "$ARCH" that was replaced by the output of uname
5568: -m, but that's no longer supported and has been removed.
1.1 dsieger 5569:
1.184 rillig 5570: ${OPSYS}, ${LOWER_OPSYS}, ${OS_VERSION}
1.1 dsieger 5571:
1.184 rillig 5572: Some packages want to embed the OS name and version into some paths. To do
5573: this, use these variables in the PLIST:
1.1 dsieger 5574:
1.184 rillig 5575: + ${OPSYS} - output of "uname -s"
1.1 dsieger 5576:
1.184 rillig 5577: + ${LOWER_OPSYS} - lowercase common name (eg. "solaris")
1.1 dsieger 5578:
1.184 rillig 5579: + ${OS_VERSION} - "uname -r"
1.1 dsieger 5580:
1.184 rillig 5581: For a list of values which are replaced by default, the output of make help
5582: topic=PLIST_SUBST as well as searching the pkgsrc/mk directory with grep for
5583: PLIST_SUBST should help.
1.1 dsieger 5584:
1.184 rillig 5585: If you want to change other variables not listed above, you can add variables
5586: and their expansions to this variable in the following way, similar to
5587: MESSAGE_SUBST (see Section 12.5, "Optional files"):
1.1 dsieger 5588:
1.184 rillig 5589: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 5590:
1.184 rillig 5591: This replaces all occurrences of "${SOMEVAR}" in the PLIST with "somevalue".
1.1 dsieger 5592:
1.184 rillig 5593: The PLIST_VARS variable can be used to simplify the common case of
5594: conditionally including some PLIST entries. It can be done by adding
5595: PLIST_VARS+=foo and setting the corresponding PLIST.foo variable to yes if the
5596: entry should be included. This will substitute "${PLIST.foo}" in the PLIST with
5597: either """" or ""@comment "". For example, in Makefile:
1.1 dsieger 5598:
1.184 rillig 5599: PLIST_VARS+= foo
5600: .if condition
5601: PLIST.foo= yes
5602: .else
1.1 dsieger 5603:
1.184 rillig 5604: And then in PLIST:
1.1 dsieger 5605:
1.184 rillig 5606: @comment $NetBSD $
5607: bin/bar
5608: man/man1/bar.1
5609: ${PLIST.foo}bin/foo
5610: ${PLIST.foo}man/man1/foo.1
5611: ${PLIST.foo}share/bar/foo.data
1.1 dsieger 5612:
1.184 rillig 5613: An artificial space has been added between NetBSD and $, this is a workaround
5614: here to prevent CVS expanding to the filename of the guide. When adding the RCS
1.195 gutterid 5615: ID the space should be omitted.
1.1 dsieger 5616:
1.184 rillig 5617: 19.5. Man page compression
1.1 dsieger 5618:
1.184 rillig 5619: Man pages should be installed in compressed form if MANZ is set (in
5620: bsd.own.mk), and uncompressed otherwise. To handle this in the PLIST file, the
5621: suffix ".gz" is appended/removed automatically for man pages according to MANZ
5622: and MANCOMPRESSED being set or not, see above for details. This modification of
5623: the PLIST file is done on a copy of it, not PLIST itself.
1.100 leot 5624:
1.184 rillig 5625: 19.6. Changing PLIST source with PLIST_SRC
1.100 leot 5626:
1.184 rillig 5627: To use one or more files as source for the PLIST used in generating the binary
5628: package, set the variable PLIST_SRC to the names of that file(s). The files are
5629: later concatenated using cat(1), and the order of things is important. The
5630: default for PLIST_SRC is ${PKGDIR}/PLIST.
1.1 dsieger 5631:
1.184 rillig 5632: 19.7. Platform-specific and differing PLISTs
1.1 dsieger 5633:
1.184 rillig 5634: Some packages decide to install a different set of files based on the operating
5635: system being used. These differences can be automatically handled by using the
5636: following files:
1.1 dsieger 5637:
1.184 rillig 5638: * PLIST.common
1.1 dsieger 5639:
1.184 rillig 5640: * PLIST.${OPSYS}
1.1 dsieger 5641:
1.184 rillig 5642: * PLIST.${MACHINE_ARCH}
1.1 dsieger 5643:
1.184 rillig 5644: * PLIST.${OPSYS}-${MACHINE_ARCH}
1.1 dsieger 5645:
1.184 rillig 5646: * PLIST.common_end
1.1 dsieger 5647:
1.184 rillig 5648: 19.8. Build-specific PLISTs
1.1 dsieger 5649:
1.184 rillig 5650: Some packages decide to generate hard-to-guess file names during installation
5651: that are hard to wire down.
1.1 dsieger 5652:
1.184 rillig 5653: In such cases, you can set the GENERATE_PLIST variable to shell code terminated
5654: (with a semicolon) that will output PLIST entries which will be appended to the
5655: PLIST
1.1 dsieger 5656:
1.184 rillig 5657: You can find one example in editors/xemacs:
1.1 dsieger 5658:
1.184 rillig 5659: GENERATE_PLIST+= ${ECHO} bin/${DISTNAME}-`${WRKSRC}/src/xemacs -sd`.dmp ;
1.1 dsieger 5660:
1.184 rillig 5661: which will append something like bin/xemacs-21.4.23-54e8ea71.dmp to the PLIST.
1.1 dsieger 5662:
1.184 rillig 5663: 19.9. Sharing directories between packages
1.1 dsieger 5664:
1.184 rillig 5665: A "shared directory" is a directory where multiple (and unrelated) packages
5666: install files. These directories were problematic because you had to add
5667: special tricks in the PLIST to conditionally remove them, or have some
5668: centralized package handle them.
1.106 tnn 5669:
1.184 rillig 5670: In pkgsrc, it is now easy: Each package should create directories and install
5671: files as needed; pkg_delete will remove any directories left empty after
5672: uninstalling a package.
1.106 tnn 5673:
1.184 rillig 5674: If a package needs an empty directory to work, create the directory during
5675: installation as usual, and also add an entry to the PLIST:
1.1 dsieger 5676:
1.184 rillig 5677: @pkgdir path/to/empty/directory
1.1 dsieger 5678:
1.184 rillig 5679: or take a look at MAKE_DIRS and OWN_DIRS.
1.1 dsieger 5680:
1.184 rillig 5681: Chapter 20. The pkginstall framework
1.1 dsieger 5682:
1.184 rillig 5683: Table of Contents
1.1 dsieger 5684:
1.184 rillig 5685: 20.1. Files and directories outside the installation prefix
1.1 dsieger 5686:
1.184 rillig 5687: 20.1.1. Directory manipulation
5688: 20.1.2. File manipulation
1.1 dsieger 5689:
1.184 rillig 5690: 20.2. Configuration files
1.1 dsieger 5691:
1.184 rillig 5692: 20.2.1. How PKG_SYSCONFDIR is set
5693: 20.2.2. Telling the software where configuration files are
5694: 20.2.3. Patching installations
5695: 20.2.4. Disabling handling of configuration files
1.1 dsieger 5696:
1.184 rillig 5697: 20.3. System startup scripts
1.1 dsieger 5698:
1.184 rillig 5699: 20.3.1. Disabling handling of system startup scripts
1.1 dsieger 5700:
1.184 rillig 5701: 20.4. System users and groups
5702: 20.5. System shells
1.1 dsieger 5703:
1.184 rillig 5704: 20.5.1. Disabling shell registration
1.1 dsieger 5705:
1.184 rillig 5706: 20.6. Fonts
1.1 dsieger 5707:
1.184 rillig 5708: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 5709:
1.184 rillig 5710: This chapter describes the framework known as pkginstall, whose key features
5711: are:
1.1 dsieger 5712:
1.184 rillig 5713: * Generic installation and manipulation of directories and files outside the
5714: pkgsrc-handled tree, LOCALBASE.
1.1 dsieger 5715:
1.184 rillig 5716: * Automatic handling of configuration files during installation, provided
5717: that packages are correctly designed.
1.1 dsieger 5718:
1.184 rillig 5719: * Generation and installation of system startup scripts.
1.1 dsieger 5720:
1.184 rillig 5721: * Registration of system users and groups.
1.1 dsieger 5722:
1.184 rillig 5723: * Registration of system shells.
1.1 dsieger 5724:
1.184 rillig 5725: * Automatic updating of fonts databases.
1.1 dsieger 5726:
1.184 rillig 5727: The following sections inspect each of the above points in detail.
1.1 dsieger 5728:
1.184 rillig 5729: You may be thinking that many of the things described here could be easily done
5730: with simple code in the package's post-installation target (post-install). This
5731: is incorrect, as the code in them is only executed when building from source.
5732: Machines using binary packages could not benefit from it at all (as the code
5733: itself could be unavailable). Therefore, the only way to achieve any of the
5734: items described above is by means of the installation scripts, which are
5735: automatically generated by pkginstall.
1.1 dsieger 5736:
1.184 rillig 5737: 20.1. Files and directories outside the installation prefix
1.95 wiz 5738:
1.184 rillig 5739: As you already know, the PLIST file holds a list of files and directories that
5740: belong to a package. The names used in it are relative to the installation
5741: prefix (${PREFIX}), which means that it cannot register files outside this
5742: directory (absolute path names are not allowed). Despite this restriction, some
5743: packages need to install files outside this location; e.g., under ${VARBASE} or
5744: ${PKG_SYSCONFDIR}. The only way to achieve this is to create such files during
5745: installation time by using installation scripts.
1.95 wiz 5746:
1.184 rillig 5747: The generic installation scripts are shell scripts that can contain arbitrary
5748: code. The list of scripts to execute is taken from the INSTALL_FILE variable,
5749: which defaults to INSTALL. A similar variable exists for package removal
5750: (DEINSTALL_FILE, whose default is DEINSTALL). These scripts can run arbitrary
5751: commands, so they have the potential to create and manage files anywhere in the
5752: file system.
1.95 wiz 5753:
1.184 rillig 5754: Using these general installation files is not recommended, but may be needed in
5755: some special cases. One reason for avoiding them is that the user has to trust
5756: the packager that there is no unwanted or simply erroneous code included in the
5757: installation script. Also, previously there were many similar scripts for the
5758: same functionality, and fixing a common error involved finding and changing all
5759: of them.
1.95 wiz 5760:
1.184 rillig 5761: The pkginstall framework offers another, standardized way. It provides generic
5762: scripts to abstract the manipulation of such files and directories based on
5763: variables set in the package's Makefile. The rest of this section describes
5764: these variables.
1.1 dsieger 5765:
1.184 rillig 5766: 20.1.1. Directory manipulation
1.1 dsieger 5767:
1.184 rillig 5768: The following variables can be set to request the creation of directories
5769: anywhere in the file system:
1.1 dsieger 5770:
1.184 rillig 5771: * MAKE_DIRS and OWN_DIRS contain a list of directories that should be created
5772: and should attempt to be destroyed by the installation scripts. The
5773: difference between the two is that the latter prompts the administrator to
5774: remove any directories that may be left after deinstallation (because they
5775: were not empty), while the former does not. Example:
1.1 dsieger 5776:
1.184 rillig 5777: MAKE_DIRS+= ${VARBASE}/foo/private
1.1 dsieger 5778:
1.184 rillig 5779: * MAKE_DIRS_PERMS and OWN_DIRS_PERMS contain a list of tuples describing
5780: which directories should be created and should attempt to be destroyed by
5781: the installation scripts. Each tuple holds the following values, separated
5782: by spaces: the directory name, its owner, its group and its numerical mode.
5783: For example:
1.1 dsieger 5784:
1.184 rillig 5785: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private \
5786: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 5787:
1.184 rillig 5788: The difference between the two is exactly the same as their non-PERMS
5789: counterparts.
1.1 dsieger 5790:
1.184 rillig 5791: 20.1.2. File manipulation
1.1 dsieger 5792:
1.184 rillig 5793: Creating non-empty files outside the installation prefix is tricky because the
5794: PLIST forces all files to be inside it. To overcome this problem, the only
5795: solution is to extract the file in the known place (i.e., inside the
5796: installation prefix) and copy it to the appropriate location during
5797: installation (done by the installation scripts generated by pkginstall). We
5798: will call the former the master file in the following paragraphs, which
5799: describe the variables that can be used to automatically and consistently
5800: handle files outside the installation prefix:
1.1 dsieger 5801:
1.184 rillig 5802: * CONF_FILES and REQD_FILES are pairs of master and target files. During
5803: installation time, the master file is copied to the target one if and only
5804: if the latter does not exist. Upon deinstallation, the target file is
5805: removed provided that it was not modified by the installation.
1.1 dsieger 5806:
1.184 rillig 5807: The difference between the two is that the latter prompts the administrator
5808: to remove any files that may be left after deinstallation (because they
5809: were not empty), while the former does not.
1.1 dsieger 5810:
1.184 rillig 5811: * CONF_FILES_PERMS and REQD_FILES_PERMS contain tuples describing master
5812: files as well as their target locations. For each of them, it also
5813: specifies their owner, their group and their numeric permissions, in this
5814: order. For example:
1.1 dsieger 5815:
1.184 rillig 5816: REQD_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile \
5817: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 5818:
1.184 rillig 5819: The difference between the two is exactly the same as their non-PERMS
5820: counterparts.
1.1 dsieger 5821:
1.184 rillig 5822: 20.2. Configuration files
1.1 dsieger 5823:
1.184 rillig 5824: Configuration files are special in the sense that they are installed in their
5825: own specific directory, PKG_SYSCONFDIR, and need special treatment during
5826: installation (most of which is automated by pkginstall). The main concept you
5827: must bear in mind is that files marked as configuration files are automatically
5828: copied to the right place (somewhere inside PKG_SYSCONFDIR) during installation
5829: if and only if they didn't exist before. Similarly, they will not be removed if
5830: they have local modifications. This ensures that administrators never lose any
5831: custom changes they may have made.
1.1 dsieger 5832:
1.184 rillig 5833: 20.2.1. How PKG_SYSCONFDIR is set
1.1 dsieger 5834:
1.184 rillig 5835: As said before, the PKG_SYSCONFDIR variable specifies where configuration files
5836: shall be installed. Its contents are set based upon the following variables:
1.1 dsieger 5837:
1.184 rillig 5838: * PKG_SYSCONFBASE: The configuration's root directory. Defaults to ${PREFIX}/
5839: etc although it may be overridden by the user to point to his preferred
5840: location (e.g., /etc, /etc/pkg, etc.). Packages must not use it directly.
1.1 dsieger 5841:
1.184 rillig 5842: * PKG_SYSCONFSUBDIR: A subdirectory of PKG_SYSCONFBASE under which the
5843: configuration files for the package being built shall be installed. The
5844: definition of this variable only makes sense in the package's Makefile
5845: (i.e., it is not user-customizable).
1.1 dsieger 5846:
1.184 rillig 5847: As an example, consider the Apache package, www/apache24, which places its
5848: configuration files under the httpd/ subdirectory of PKG_SYSCONFBASE. This
5849: should be set in the package Makefile.
1.1 dsieger 5850:
1.184 rillig 5851: * PKG_SYSCONFVAR: Specifies the name of the variable that holds this
5852: package's configuration directory (if different from PKG_SYSCONFBASE). It
5853: defaults to PKGBASE's value, and is always prefixed with PKG_SYSCONFDIR.
1.1 dsieger 5854:
1.184 rillig 5855: * PKG_SYSCONFDIR.${PKG_SYSCONFVAR}: Holds the directory where the
5856: configuration files for the package identified by PKG_SYSCONFVAR's shall be
5857: placed.
1.1 dsieger 5858:
1.184 rillig 5859: Based on the above variables, pkginstall determines the value of
5860: PKG_SYSCONFDIR, which is the only variable that can be used within a package to
5861: refer to its configuration directory. The algorithm used to set its value is
5862: basically the following:
1.1 dsieger 5863:
1.184 rillig 5864: 1. If PKG_SYSCONFDIR.${PKG_SYSCONFVAR} is set, its value is used.
1.1 dsieger 5865:
1.184 rillig 5866: 2. If the previous variable is not defined but PKG_SYSCONFSUBDIR is set in the
5867: package's Makefile, the resulting value is ${PKG_SYSCONFBASE}/$
5868: {PKG_SYSCONFSUBDIR}.
1.1 dsieger 5869:
1.184 rillig 5870: 3. Otherwise, it is set to ${PKG_SYSCONFBASE}.
1.1 dsieger 5871:
1.184 rillig 5872: It is worth mentioning that ${PKG_SYSCONFDIR} is automatically added to
5873: OWN_DIRS. See Section 20.1.1, "Directory manipulation" what this means. This
5874: does not apply to subdirectories of ${PKG_SYSCONFDIR}, they still have to be
5875: created with OWN_DIRS or MAKE_DIRS.
1.1 dsieger 5876:
1.184 rillig 5877: 20.2.2. Telling the software where configuration files are
1.1 dsieger 5878:
1.184 rillig 5879: Given that pkgsrc (and users!) expect configuration files to be in a known
5880: place, you need to teach each package where it shall install its files. In some
5881: cases you will have to patch the package Makefiles to achieve it. If you are
5882: lucky, though, it may be as easy as passing an extra flag to the configuration
5883: script; this is the case of GNU Autoconf- generated files:
1.1 dsieger 5884:
1.184 rillig 5885: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.1 dsieger 5886:
1.184 rillig 5887: Note that this specifies where the package has to look for its configuration
5888: files, not where they will be originally installed (although the difference is
5889: never explicit, unfortunately).
1.1 dsieger 5890:
1.184 rillig 5891: 20.2.3. Patching installations
1.1 dsieger 5892:
1.184 rillig 5893: As said before, pkginstall automatically handles configuration files. This
5894: means that the packages themselves must not touch the contents of $
5895: {PKG_SYSCONFDIR} directly. Bad news is that many software installation scripts
5896: will, out of the box, mess with the contents of that directory. So what is the
5897: correct procedure to fix this issue?
1.1 dsieger 5898:
1.184 rillig 5899: You must teach the package (usually by manually patching it) to install any
5900: configuration files under the examples hierarchy, share/examples/${PKGBASE}/.
5901: This way, the PLIST registers them and the administrator always has the
5902: original copies available.
1.1 dsieger 5903:
1.184 rillig 5904: Once the required configuration files are in place (i.e., under the examples
5905: hierarchy), the pkginstall framework can use them as master copies during the
5906: package installation to update what is in ${PKG_SYSCONFDIR}. To achieve this,
5907: the variables CONF_FILES and CONF_FILES_PERMS are used. Check out
5908: Section 20.1.2, "File manipulation" for information about their syntax and
5909: their purpose. Here is an example, taken from the mail/mutt package:
1.1 dsieger 5910:
1.184 rillig 5911: EGDIR= ${PREFIX}/share/doc/mutt/samples
5912: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.1 dsieger 5913:
1.184 rillig 5914: Note that the EGDIR variable is specific to that package and has no meaning
5915: outside it.
1.1 dsieger 5916:
1.184 rillig 5917: 20.2.4. Disabling handling of configuration files
1.1 dsieger 5918:
1.184 rillig 5919: The automatic copying of config files can be toggled by setting the environment
5920: variable PKG_CONFIG prior to package installation.
1.1 dsieger 5921:
1.184 rillig 5922: 20.3. System startup scripts
1.1 dsieger 5923:
1.184 rillig 5924: System startup scripts are special files because they must be installed in a
5925: place known by the underlying OS, usually outside the installation prefix.
5926: Therefore, the same rules described in Section 20.1, "Files and directories
5927: outside the installation prefix" apply, and the same solutions can be used.
5928: However, pkginstall provides a special mechanism to handle these files.
1.1 dsieger 5929:
1.184 rillig 5930: In order to provide system startup scripts, the package has to:
1.1 dsieger 5931:
1.184 rillig 5932: 1. Store the script inside ${FILESDIR}, with the .sh suffix appended.
5933: Considering the print/cups package as an example, it has a cupsd.sh in its
5934: files directory.
1.95 wiz 5935:
1.184 rillig 5936: 2. Tell pkginstall to handle it, appending the name of the script, without its
5937: extension, to the RCD_SCRIPTS variable. Continuing the previous example:
1.95 wiz 5938:
1.184 rillig 5939: RCD_SCRIPTS+= cupsd
1.95 wiz 5940:
1.184 rillig 5941: Once this is done, pkginstall will do the following steps for each script in an
5942: automated fashion:
1.95 wiz 5943:
1.184 rillig 5944: 1. Process the file found in the files directory applying all the
5945: substitutions described in the FILES_SUBST variable.
1.1 dsieger 5946:
1.184 rillig 5947: 2. Copy the script from the files directory to the examples hierarchy, $
5948: {PREFIX}/share/examples/rc.d/. Note that this master file must be
5949: explicitly registered in the PLIST.
1.1 dsieger 5950:
1.184 rillig 5951: 3. Add code to the installation scripts to copy the startup script from the
5952: examples hierarchy into the system-wide startup scripts directory.
1.1 dsieger 5953:
1.184 rillig 5954: 20.3.1. Disabling handling of system startup scripts
1.1 dsieger 5955:
1.184 rillig 5956: The automatic copying of config files can be toggled by setting the environment
5957: variable PKG_RCD_SCRIPTS prior to package installation. Note that the scripts
5958: will be always copied inside the examples hierarchy, ${PREFIX}/share/examples/
5959: rc.d/, no matter what the value of this variable is.
1.1 dsieger 5960:
1.184 rillig 5961: 20.4. System users and groups
1.1 dsieger 5962:
1.184 rillig 5963: If a package needs to create special users and/or groups during installation,
5964: it can do so by using the pkginstall framework.
1.1 dsieger 5965:
1.184 rillig 5966: Users can be created by adding entries to the PKG_USERS variable. Each entry
5967: has the following syntax:
1.1 dsieger 5968:
1.184 rillig 5969: user:group
1.1 dsieger 5970:
1.184 rillig 5971: Further specification of user details may be done by setting per-user
5972: variables. PKG_UID.user is the numeric UID for the user. PKG_GECOS.user is the
5973: user's description or comment. PKG_HOME.user is the user's home directory, and
5974: defaults to /nonexistent if not specified. PKG_SHELL.user is the user's shell,
5975: and defaults to /sbin/nologin if not specified.
1.1 dsieger 5976:
1.184 rillig 5977: Similarly, groups can be created by adding entries to the PKG_GROUPS variable,
5978: whose syntax is:
1.1 dsieger 5979:
1.184 rillig 5980: group
1.1 dsieger 5981:
1.184 rillig 5982: The numeric GID of the group may be set by defining PKG_GID.group.
1.1 dsieger 5983:
1.184 rillig 5984: If a package needs to create the users and groups at an earlier stage, then it
5985: can set USERGROUP_PHASE to either configure,build, or pre-install to indicate
5986: the phase before which the users and groups are created. In this case, the
5987: numeric UIDs and GIDs of the created users and groups are automatically
5988: hardcoded into the final installation scripts.
1.1 dsieger 5989:
1.184 rillig 5990: 20.5. System shells
1.1 dsieger 5991:
1.184 rillig 5992: Packages that install system shells should register them in the shell database,
5993: /etc/shells, to make things easier to the administrator. This must be done from
5994: the installation scripts to keep binary packages working on any system.
5995: pkginstall provides an easy way to accomplish this task.
1.1 dsieger 5996:
1.184 rillig 5997: When a package provides a shell interpreter, it has to set the PKG_SHELL
5998: variable to its absolute file name. This will add some hooks to the
5999: installation scripts to handle it. Consider the following example, taken from
6000: shells/zsh:
1.1 dsieger 6001:
1.184 rillig 6002: PKG_SHELL= ${PREFIX}/bin/zsh
1.1 dsieger 6003:
1.184 rillig 6004: 20.5.1. Disabling shell registration
1.1 dsieger 6005:
1.184 rillig 6006: The automatic registration of shell interpreters can be disabled by the
6007: administrator by setting the PKG_REGISTER_SHELLS environment variable to NO.
1.1 dsieger 6008:
1.184 rillig 6009: 20.6. Fonts
1.1 dsieger 6010:
1.184 rillig 6011: Packages that install X11 fonts should update the database files that index the
6012: fonts within each fonts directory. This can easily be accomplished within the
6013: pkginstall framework.
1.1 dsieger 6014:
1.184 rillig 6015: When a package installs X11 fonts, it must list the directories in which fonts
6016: are installed in the FONTS_DIRS.type variables, where type can be one of "ttf",
6017: "type1" or "x11". This will add hooks to the installation scripts to run the
6018: appropriate commands to update the fonts database files within each of those
6019: directories. For convenience, if the directory path is relative, it is taken to
6020: be relative to the package's installation prefix. Consider the following
6021: example, taken from fonts/dbz-ttf:
1.1 dsieger 6022:
1.184 rillig 6023: FONTS_DIRS.ttf= ${PREFIX}/share/fonts/X11/TTF
1.1 dsieger 6024:
1.184 rillig 6025: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 6026:
1.184 rillig 6027: The automatic update of fonts databases can be disabled by the administrator by
6028: setting the PKG_UPDATE_FONTS_DB environment variable to NO.
1.1 dsieger 6029:
1.154 rillig 6030: Chapter 21. Making your package work
1.1 dsieger 6031:
6032: Table of Contents
6033:
1.154 rillig 6034: 21.1. General operation
1.1 dsieger 6035:
1.154 rillig 6036: 21.1.1. How to pull in user-settable variables from mk.conf
6037: 21.1.2. User interaction
6038: 21.1.3. Handling licenses
6039: 21.1.4. Restricted packages
6040: 21.1.5. Handling dependencies
6041: 21.1.6. Handling conflicts with other packages
6042: 21.1.7. Packages that cannot or should not be built
6043: 21.1.8. Packages which should not be deleted, once installed
6044: 21.1.9. Handling packages with security problems
6045: 21.1.10. How to handle incrementing versions when fixing an existing
1.1 dsieger 6046: package
1.154 rillig 6047: 21.1.11. Substituting variable text in the package files (the SUBST
1.1 dsieger 6048: framework)
6049:
1.154 rillig 6050: 21.2. The fetch phase
1.1 dsieger 6051:
1.154 rillig 6052: 21.2.1. Packages whose distfiles aren't available for plain downloading
6053: 21.2.2. How to handle modified distfiles with the 'old' name
6054: 21.2.3. Packages hosted on github.com
6055:
6056: 21.3. The configure phase
6057:
6058: 21.3.1. Shared libraries - libtool
6059: 21.3.2. Using libtool on GNU packages that already support libtool
6060: 21.3.3. GNU Autoconf/Automake
6061:
6062: 21.4. Programming languages
6063:
6064: 21.4.1. C, C++, and Fortran
6065: 21.4.2. Java
1.205 wiz 6066: 21.4.3. Go
6067: 21.4.4. Packages containing Perl scripts
6068: 21.4.5. Packages containing shell scripts
6069: 21.4.6. Other programming languages
1.154 rillig 6070:
6071: 21.5. The build phase
6072:
6073: 21.5.1. Compiling C and C++ code conditionally
6074: 21.5.2. How to handle compiler bugs
1.172 rillig 6075: 21.5.3. No such file or directory
6076: 21.5.4. Undefined reference to "..."
6077: 21.5.5. Running out of memory
1.154 rillig 6078:
6079: 21.6. The install phase
6080:
6081: 21.6.1. Creating needed directories
6082: 21.6.2. Where to install documentation
6083: 21.6.3. Installing highscore files
6084: 21.6.4. Adding DESTDIR support to packages
6085: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 6086: 21.6.6. Packages installing Perl modules
1.154 rillig 6087: 21.6.7. Packages installing info files
6088: 21.6.8. Packages installing man pages
1.203 nia 6089: 21.6.9. Packages installing X11 fonts
6090: 21.6.10. Packages installing SGML or XML data
6091: 21.6.11. Packages installing extensions to the MIME database
6092: 21.6.12. Packages using intltool
6093: 21.6.13. Packages installing startup scripts
6094: 21.6.14. Packages installing TeX modules
6095: 21.6.15. Packages supporting running binaries in emulation
6096: 21.6.16. Packages installing hicolor icons
6097: 21.6.17. Packages installing desktop files
1.1 dsieger 6098:
1.154 rillig 6099: 21.7. Marking packages as having problems
1.1 dsieger 6100:
1.154 rillig 6101: 21.1. General operation
1.1 dsieger 6102:
6103: One appealing feature of pkgsrc is that it runs on many different platforms. As
6104: a result, it is important to ensure, where possible, that packages in pkgsrc
6105: are portable. This chapter mentions some particular details you should pay
6106: attention to while working on pkgsrc.
6107:
1.154 rillig 6108: 21.1.1. How to pull in user-settable variables from mk.conf
1.1 dsieger 6109:
6110: The pkgsrc user can configure pkgsrc by overriding several variables in the
1.4 rillig 6111: file pointed to by MAKECONF, which is mk.conf by default. When you want to use
6112: those variables in the preprocessor directives of make(1) (for example .if or
6113: .for), you need to include the file ../../mk/bsd.prefs.mk before, which in turn
6114: loads the user preferences.
1.1 dsieger 6115:
6116: But note that some variables may not be completely defined after ../../mk/
6117: bsd.prefs.mk has been included, as they may contain references to variables
1.108 rillig 6118: that are not yet defined. In shell commands (the lines in Makefile that are
6119: indented with a tab) this is no problem, since variables are only expanded when
6120: they are used. But in the preprocessor directives mentioned above and in
6121: dependency lines (of the form target: dependencies) the variables are expanded
6122: at load time.
1.1 dsieger 6123:
6124: Note
6125:
1.108 rillig 6126: To check whether a variable can be used at load time, run pkglint -Wall on your
6127: package.
1.1 dsieger 6128:
1.154 rillig 6129: 21.1.2. User interaction
1.1 dsieger 6130:
6131: Occasionally, packages require interaction from the user, and this can be in a
6132: number of ways:
6133:
6134: * When fetching the distfiles, some packages require user interaction such as
6135: entering username/password or accepting a license on a web page.
6136:
6137: * When extracting the distfiles, some packages may ask for passwords.
6138:
6139: * help to configure the package before it is built
6140:
6141: * help during the build process
6142:
6143: * help during the installation of a package
6144:
1.108 rillig 6145: A package can set the INTERACTIVE_STAGE variable to define which stages need
6146: interaction. This should be done in the package's Makefile, e.g.:
1.1 dsieger 6147:
6148: INTERACTIVE_STAGE= configure install
6149:
6150: The user can then decide to skip this package by setting the BATCH variable.
1.108 rillig 6151: Packages that require interaction are also excluded from bulk builds.
1.1 dsieger 6152:
1.154 rillig 6153: 21.1.3. Handling licenses
1.1 dsieger 6154:
6155: Authors of software can choose the licence under which software can be copied.
1.111 sevan 6156: The Free Software Foundation has declared some licenses "Free", and the Open
6157: Source Initiative has a definition of "Open Source".
6158:
6159: By default, pkgsrc allows packages with Free or Open Source licenses to be
6160: built. To allow packages with other licenses to be built as well, the pkgsrc
6161: user needs to add these licenses to the ACCEPTABLE_LICENSES variable in mk.conf
6162: . Note that this variable only affects which packages may be built, while the
6163: license terms often also restrict the actual use of the package and its
6164: redistribution.
1.1 dsieger 6165:
6166: One might want to only install packages with a BSD license, or the GPL, and not
1.20 jnemeth 6167: the other. The free licenses are added to the default ACCEPTABLE_LICENSES
1.111 sevan 6168: variable. The pkgsrc user can override the default by setting the
6169: ACCEPTABLE_LICENSES variable with "=" instead of "+=". The licenses accepted by
6170: default are defined in the DEFAULT_ACCEPTABLE_LICENSES variable in the file
6171: pkgsrc/mk/license.mk.
1.1 dsieger 6172:
6173: The license tag mechanism is intended to address copyright-related issues
6174: surrounding building, installing and using a package, and not to address
1.20 jnemeth 6175: redistribution issues (see RESTRICTED and NO_SRC_ON_FTP, etc.). Packages with
6176: redistribution restrictions should set these tags.
1.1 dsieger 6177:
6178: Denoting that a package may be copied according to a particular license is done
6179: by placing the license in pkgsrc/licenses and setting the LICENSE variable to a
6180: string identifying the license, e.g. in graphics/xv:
6181:
6182: LICENSE= xv-license
6183:
6184: When trying to build, the user will get a notice that the package is covered by
6185: a license which has not been placed in the ACCEPTABLE_LICENSES variable:
6186:
6187: % make
6188: ===> xv-3.10anb9 has an unacceptable license: xv-license.
6189: ===> To view the license, enter "/usr/bin/make show-license".
6190: ===> To indicate acceptance, add this line to your /etc/mk.conf:
6191: ===> ACCEPTABLE_LICENSES+=xv-license
6192: *** Error code 1
6193:
6194: The license can be viewed with make show-license, and if the user so chooses,
1.4 rillig 6195: the line printed above can be added to mk.conf to convey to pkgsrc that it
1.1 dsieger 6196: should not in the future fail because of that license:
6197:
6198: ACCEPTABLE_LICENSES+=xv-license
6199:
1.111 sevan 6200: The use of LICENSE=shareware, LICENSE=no-commercial-use, and similar language
6201: is deprecated because it does not crisply refer to a particular license text.
6202: Another problem with such usage is that it does not enable a user to tell
6203: pkgsrc to proceed for a single package without also telling pkgsrc to proceed
6204: for all packages with that tag.
6205:
1.154 rillig 6206: 21.1.3.1. Adding a package with a new license
1.1 dsieger 6207:
1.49 rodent 6208: When adding a package with a new license, the following steps are required:
6209:
1.111 sevan 6210: 1. Check whether the license qualifies as Free or Open Source by referencing
6211: Various Licenses and Comments about Them and Licenses by Name | Open Source
6212: Initiative. If this is the case, the filename in pkgsrc/licenses/ does not
6213: need the -license suffix, and the license name should be added to:
1.49 rodent 6214:
6215: + DEFAULT_ACCEPTABLE_LICENSES in pkgsrc/mk/license.mk
6216:
6217: + default_acceptable_licenses in pkgsrc/pkgtools/pkg_install/files/lib/
6218: license.c
6219:
6220: 2. The license text should be added to pkgsrc/licenses for displaying. A list
6221: of known licenses can be seen in this directory.
1.1 dsieger 6222:
1.154 rillig 6223: 21.1.3.2. Change to the license
1.1 dsieger 6224:
1.111 sevan 6225: When the license changes (in a way other than formatting), make sure that the
6226: new license has a different name (e.g., append the version number if it exists,
6227: or the date). Just because a user told pkgsrc to build programs under a
6228: previous version of a license does not mean that pkgsrc should build programs
6229: under the new licenses. The higher-level point is that pkgsrc does not evaluate
6230: licenses for reasonableness; the only test is a mechanistic test of whether a
6231: particular text has been approved by either of two bodies (FSF or OSI).
1.1 dsieger 6232:
1.154 rillig 6233: 21.1.4. Restricted packages
1.1 dsieger 6234:
1.111 sevan 6235: Some licenses restrict how software may be re-distributed. By declaring the
6236: restrictions, package tools can automatically refrain from e.g. placing binary
6237: packages on FTP sites.
6238:
6239: There are four possible restrictions, which are the cross product of sources
6240: (distfiles) and binaries not being placed on FTP sites and CD-ROMs. Because
6241: this is rarely the exact language in any license, and because non-Free licenses
6242: tend to be different from each other, pkgsrc adopts a definition of FTP and
6243: CD-ROM. "FTP" means making the source or binary file available over the
6244: Internet at no charge. "CD-ROM" means making the source or binary available on
6245: some kind of media, together with other source and binary packages, which is
6246: sold for a distribution charge.
1.1 dsieger 6247:
6248: In order to encode these restrictions, the package system defines five make
6249: variables that can be set to note these restrictions:
6250:
6251: * RESTRICTED
6252:
6253: This variable should be set whenever a restriction exists (regardless of
6254: its kind). Set this variable to a string containing the reason for the
6255: restriction. It should be understood that those wanting to understand the
6256: restriction will have to read the license, and perhaps seek advice of
6257: counsel.
6258:
6259: * NO_BIN_ON_CDROM
6260:
6261: Binaries may not be placed on CD-ROM containing other binary packages, for
6262: which a distribution charge may be made. In this case, set this variable to
6263: ${RESTRICTED}.
6264:
6265: * NO_BIN_ON_FTP
6266:
6267: Binaries may not made available on the Internet without charge. In this
6268: case, set this variable to ${RESTRICTED}. If this variable is set, binary
6269: packages will not be included on ftp.NetBSD.org.
6270:
6271: * NO_SRC_ON_CDROM
6272:
6273: Distfiles may not be placed on CD-ROM, together with other distfiles, for
6274: which a fee may be charged. In this case, set this variable to $
6275: {RESTRICTED}.
6276:
6277: * NO_SRC_ON_FTP
6278:
6279: Distfiles may not made available via FTP at no charge. In this case, set
6280: this variable to ${RESTRICTED}. If this variable is set, the distfile(s)
6281: will not be mirrored on ftp.NetBSD.org.
6282:
1.111 sevan 6283: Please note that packages will be removed from pkgsrc when the distfiles are
1.33 wiz 6284: not distributable and cannot be obtained for a period of one full quarter
1.111 sevan 6285: branch. Packages with manual/interactive fetch must have a maintainer and it is
6286: his/her responsibility to ensure this.
1.33 wiz 6287:
1.154 rillig 6288: 21.1.5. Handling dependencies
1.1 dsieger 6289:
1.175 gutterid 6290: Your package may depend on some other package being present, and there are
6291: various ways of expressing this dependency. pkgsrc supports the DEPENDS,
6292: BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS definitions, the USE_TOOLS
6293: definition, as well as dependencies via buildlink3.mk, which is the preferred
6294: way to handle dependencies, and which uses the variables named above. See
1.184 rillig 6295: Chapter 18, Buildlink methodology for more information.
1.175 gutterid 6296:
6297: The basic difference is that the DEPENDS definition registers that
6298: pre-requisite in the binary package so it will be pulled in when the binary
6299: package is later installed, whilst the BUILD_DEPENDS, TOOL_DEPENDS, and
6300: TEST_DEPENDS definitions do not, marking a dependency that is only needed for
1.184 rillig 6301: building or testing the resulting package. See also Chapter 14, Creating a new
1.175 gutterid 6302: pkgsrc package from scratch for more information.
6303:
6304: This means that if you only need a package present whilst you are building or
6305: testing, it should be noted as a TOOL_DEPENDS, BUILD_DEPENDS, or TEST_DEPENDS.
6306: When cross-compiling, TOOL_DEPENDS are native packages, i.e. packages for the
6307: architecture where the package is built; BUILD_DEPENDS are target packages,
6308: i.e., packages for the architecture for which the package is built.
1.1 dsieger 6309:
1.175 gutterid 6310: The format for a DEPENDS, BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS
6311: definition is:
1.1 dsieger 6312:
6313: <pre-req-package-name>:../../<category>/<pre-req-package>
6314:
6315: Please note that the "pre-req-package-name" may include any of the wildcard
6316: version numbers recognized by pkg_info(1).
6317:
1.55 wiz 6318: 1. If your package needs another package's binaries or libraries to build and
1.1 dsieger 6319: run, and if that package has a buildlink3.mk file available, use it:
6320:
6321: .include "../../graphics/jpeg/buildlink3.mk"
6322:
1.55 wiz 6323: 2. If your package needs another package's binaries or libraries only for
6324: building, and if that package has a buildlink3.mk file available, use it:
6325:
6326: .include "../../graphics/jpeg/buildlink3.mk"
6327:
6328: but set BUILDLINK_DEPMETHOD.jpeg?=build to make it a build dependency only.
6329: This case is rather rare.
6330:
6331: 3. If your package needs binaries from another package to build, use the
1.156 leot 6332: TOOL_DEPENDS definition:
6333:
6334: TOOL_DEPENDS+= itstool-[0-9]*:../../textproc/itstool
1.1 dsieger 6335:
1.156 leot 6336: 4. If your package needs static libraries to link against, header files to
6337: include, etc. from another package to build, use the BUILD_DEPENDS
6338: definition.
1.1 dsieger 6339:
1.156 leot 6340: 5. If your package needs a library with which to link and there is no
1.26 spz 6341: buildlink3.mk file available, create one. Using DEPENDS won't be sufficient
6342: because the include files and libraries will be hidden from the compiler.
1.1 dsieger 6343:
1.156 leot 6344: 6. If your package needs some executable to be able to run correctly and if
1.26 spz 6345: there's no buildlink3.mk file, this is specified using the DEPENDS
6346: variable. The print/lyx package needs to be able to execute the latex
1.129 wiz 6347: binary from the tex-latex-bin package when it runs, and that is specified:
1.1 dsieger 6348:
1.129 wiz 6349: DEPENDS+= tex-latex-bin-[0-9]*:../../print/tex-latex-bin
1.1 dsieger 6350:
1.175 gutterid 6351: 7. If your package includes a test suite that has extra dependencies only
6352: required for this purpose (frequently this can be run as a "make test"
6353: target), use the TEST_DEPENDS variable.
6354:
6355: 8. You can use wildcards in package dependencies. Note that such wildcard
1.26 spz 6356: dependencies are retained when creating binary packages. The dependency is
6357: checked when installing the binary package and any package which matches
6358: the pattern will be used. Wildcard dependencies should be used with care.
1.1 dsieger 6359:
6360: The "-[0-9]*" should be used instead of "-*" to avoid potentially ambiguous
6361: matches such as "tk-postgresql" matching a "tk-*" DEPENDS.
6362:
6363: Wildcards can also be used to specify that a package will only build
6364: against a certain minimum version of a pre-requisite:
6365:
1.26 spz 6366: DEPENDS+= ImageMagick>=6.0:../../graphics/ImageMagick
1.1 dsieger 6367:
1.26 spz 6368: This means that the package will build using version 6.0 of ImageMagick or
6369: newer. Such a dependency may be warranted if, for example, the command line
6370: options of an executable have changed.
6371:
1.183 wiz 6372: If you need to depend on minimum versions of libraries, set
6373: BUILDLINK_API_DEPENDS.pkg to the appropriate pattern before including its
6374: buildlink3.mk file, e.g.
6375:
6376: BUILDLINK_API_DEPENDS.jpeg+= jpeg>=9.0
6377: .include "../../graphics/jpeg/buildlink3.mk"
1.1 dsieger 6378:
6379: For security fixes, please update the package vulnerabilities file. See
1.154 rillig 6380: Section 21.1.9, "Handling packages with security problems" for more
1.1 dsieger 6381: information.
6382:
6383: If your package needs files from another package to build, add the relevant
6384: distribution files to DISTFILES, so they will be extracted automatically. See
6385: the print/ghostscript package for an example. (It relies on the jpeg sources
6386: being present in source form during the build.)
6387:
1.154 rillig 6388: 21.1.6. Handling conflicts with other packages
1.1 dsieger 6389:
6390: Your package may conflict with other packages a user might already have
6391: installed on his system, e.g. if your package installs the same set of files as
1.80 wiz 6392: another package in the pkgsrc tree or has the same PKGNAME.
1.1 dsieger 6393:
1.142 leot 6394: For example, x11/libXaw3d and x11/Xaw-Xpm install the same shared library, thus
6395: you set in pkgsrc/x11/libXaw3d/Makefile:
1.1 dsieger 6396:
1.142 leot 6397: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 dsieger 6398:
6399:
1.142 leot 6400: and in pkgsrc/x11/Xaw-Xpm/Makefile:
1.1 dsieger 6401:
1.142 leot 6402: CONFLICTS= libXaw3d-[0-9]*
1.1 dsieger 6403:
1.142 leot 6404:
6405: pkg_add(1) is able to detect attempts to install packages that conflict with
6406: existing packages and abort. However, in many situations this is too late in
6407: the process. Binary package managers will not know about the conflict until
6408: they attempt to install the package after already downloading it and all its
6409: dependencies. Users may also waste time building a package and its dependencies
6410: only to find out at the end that it conflicts with another package they have
6411: installed.
6412:
6413: To avoid these issues CONFLICTS entries should be added in all cases where it
6414: is known that packages conflict with each other. These CONFLICTS entries are
6415: exported in pkg_summary(5) files and consumed by binary package managers to
6416: inform users that packages cannot be installed onto the target system.
1.1 dsieger 6417:
1.154 rillig 6418: 21.1.7. Packages that cannot or should not be built
1.1 dsieger 6419:
6420: There are several reasons why a package might be instructed to not build under
6421: certain circumstances. If the package builds and runs on most platforms, the
1.83 dholland 6422: exceptions should be noted with BROKEN_ON_PLATFORM. If the package builds and
6423: runs on a small handful of platforms, set BROKEN_EXCEPT_ON_PLATFORM instead.
6424: Both BROKEN_ON_PLATFORM and BROKEN_EXCEPT_ON_PLATFORM are OS triples
6425: (OS-version-platform) that can use glob-style wildcards.
6426:
1.114 maya 6427: If a package is not appropriate for some platforms (as opposed to merely
1.83 dholland 6428: broken), a different set of variables should be used as this affects failure
6429: reporting and statistics. If the package is appropriate for most platforms, the
6430: exceptions should be noted with NOT_FOR_PLATFORM. If the package is appropriate
6431: for only a small handful of platforms (often exactly one), set
6432: ONLY_FOR_PLATFORM instead. Both ONLY_FOR_PLATFORM and NOT_FOR_PLATFORM are OS
6433: triples (OS-version-platform) that can use glob-style wildcards.
1.1 dsieger 6434:
6435: Some packages are tightly bound to a specific version of an operating system,
6436: e.g. LKMs or sysutils/lsof. Such binary packages are not backwards compatible
6437: with other versions of the OS, and should be uploaded to a version specific
6438: directory on the FTP server. Mark these packages by setting OSVERSION_SPECIFIC
6439: to "yes". This variable is not currently used by any of the package system
6440: internals, but may be used in the future.
6441:
6442: If the package should be skipped (for example, because it provides
6443: functionality already provided by the system), set PKG_SKIP_REASON to a
6444: descriptive message. If the package should fail because some preconditions are
6445: not met, set PKG_FAIL_REASON to a descriptive message.
6446:
1.154 rillig 6447: 21.1.8. Packages which should not be deleted, once installed
1.1 dsieger 6448:
6449: To ensure that a package may not be deleted, once it has been installed, the
6450: PKG_PRESERVE definition should be set in the package Makefile. This will be
1.25 wiz 6451: carried into any binary package that is made from this pkgsrc entry. A "
6452: preserved" package will not be deleted using pkg_delete(1) unless the "-f"
1.1 dsieger 6453: option is used.
6454:
1.154 rillig 6455: 21.1.9. Handling packages with security problems
1.1 dsieger 6456:
6457: When a vulnerability is found, this should be noted in localsrc/security/
1.205 wiz 6458: advisories/pkg-vulnerabilities. Entries in that file consist of three parts:
6459:
6460: * package version pattern
6461:
6462: * type of vulnerability (please cut'n'paste an existing one where possible)
6463:
6464: * URL providing additional information about the issue
6465:
6466: For the package version pattern please always use `<' to mark an upper bound
6467: (not `<='!). This will avoid possible problems due unrelated PKGREVISION bumps
6468: not related to security fixes. Lower bounds can be added too, using '>' or '>=
1.206 wiz 6469: '. For example, "foo>=1<1.2" would mark versions 1.0 (included) to 1.2
1.205 wiz 6470: (excluded) of "foo" as affected by the security issue.
6471:
6472: Entries should always be added at the bottom of the file.
6473:
6474: When fixing packages, please modify the upper bound of the corresponding entry.
6475: To continue the previous example, if a fix was backported to version 1.1nb2,
1.206 wiz 6476: change the previous pattern to "foo>=1<1.1nb2".
1.205 wiz 6477:
6478: To locally test a package version pattern against a PKGNAME you can use the
6479: pkg_admin pmatch command.
6480:
6481: The URL should be as permanent as possible and provide as much information
6482: about the issue as possible. CVE entries are preferred.
6483:
6484: After committing that file, ask pkgsrc-security@NetBSD.org to update the file
6485: on ftp.NetBSD.org.
1.1 dsieger 6486:
6487: After fixing the vulnerability by a patch, its PKGREVISION should be increased
6488: (this is of course not necessary if the problem is fixed by using a newer
1.32 wiz 6489: release of the software), and the pattern in the pkg-vulnerabilities file must
6490: be updated.
1.1 dsieger 6491:
6492: Also, if the fix should be applied to the stable pkgsrc branch, be sure to
6493: submit a pullup request!
6494:
6495: Binary packages already on ftp.NetBSD.org will be handled semi-automatically by
6496: a weekly cron job.
6497:
1.205 wiz 6498: In case a security issue is disputed, please contact
6499: pkgsrc-security@NetBSD.org.
6500:
1.154 rillig 6501: 21.1.10. How to handle incrementing versions when fixing an existing package
1.1 dsieger 6502:
6503: When making fixes to an existing package it can be useful to change the version
6504: number in PKGNAME. To avoid conflicting with future versions by the original
6505: author, a "nb1", "nb2", ... suffix can be used on package versions by setting
6506: PKGREVISION=1 (2, ...). The "nb" is treated like a "." by the package tools.
6507: e.g.
6508:
6509: DISTNAME= foo-17.42
6510: PKGREVISION= 9
6511:
6512: will result in a PKGNAME of "foo-17.42nb9". If you want to use the original
6513: value of PKGNAME without the "nbX" suffix, e.g. for setting DIST_SUBDIR, use
6514: PKGNAME_NOREV.
6515:
6516: When a new release of the package is released, the PKGREVISION should be
6517: removed, e.g. on a new minor release of the above package, things should be
6518: like:
6519:
6520: DISTNAME= foo-17.43
6521:
6522: PKGREVISION should be incremented for any non-trivial change in the resulting
6523: binary package. Without a PKGREVISION bump, someone with the previous version
6524: installed has no way of knowing that their package is out of date. Thus,
6525: changes without increasing PKGREVISION are essentially labeled "this is so
6526: trivial that no reasonable person would want to upgrade", and this is the rough
6527: test for when increasing PKGREVISION is appropriate. Examples of changes that
6528: do not merit increasing PKGREVISION are:
6529:
1.14 jmcneill 6530: * Changing HOMEPAGE, MAINTAINER, OWNER, or comments in Makefile.
1.1 dsieger 6531:
6532: * Changing build variables if the resulting binary package is the same.
6533:
6534: * Changing DESCR.
6535:
6536: * Adding PKG_OPTIONS if the default options don't change.
6537:
6538: Examples of changes that do merit an increase to PKGREVISION include:
6539:
6540: * Security fixes
6541:
6542: * Changes or additions to a patch file
6543:
6544: * Changes to the PLIST
6545:
1.12 weinem 6546: * A dependency is changed or renamed.
6547:
1.1 dsieger 6548: PKGREVISION must also be incremented when dependencies have ABI changes.
6549:
1.154 rillig 6550: 21.1.11. Substituting variable text in the package files (the SUBST framework)
1.1 dsieger 6551:
1.180 rillig 6552: When you want to replace the same text in multiple files, or multiple times in
6553: the same file, it is cumbersome to maintain a patch file for this. This is
6554: where the SUBST framework steps in. It provides an easy-to-use interface for
6555: replacing text in files. It just needs the following information:
1.172 rillig 6556:
1.180 rillig 6557: * In which phase of the package build cycle should the replacement happen?
1.172 rillig 6558:
1.180 rillig 6559: * In which files should the replacement happen?
1.172 rillig 6560:
6561: * Which text should be replaced with what?
6562:
1.180 rillig 6563: This information is encoded in a block of SUBST variables. A minimal example
6564: is:
6565:
6566: SUBST_CLASSES+= paths
6567: SUBST_STAGE.paths= pre-configure
6568: SUBST_FILES.paths= src/*.c
6569: SUBST_SED.paths= -e 's,/usr/local,${PREFIX},g'
6570:
6571: Translated into English, it means: In the pre-configure stage (that is, after
6572: applying the patches from the patches/ directory and before running the
6573: configure script and the portability check), replace the text /usr/local with
6574: the content of the variable PREFIX.
6575:
6576: Each SUBST block starts by appending an identifier to SUBST_CLASSES (note the +
6577: =). This identifier can be chosen freely by the package. If there should ever
6578: be duplicate identifiers, the pkgsrc infrastructure will catch this and fail
6579: early, so don't worry about name collisions.
6580:
6581: Except for SUBST_CLASSES, all variables in a SUBST block are parameterized
6582: using this identifier. In the remainder of this section, these parameterized
6583: variables are written as SUBST_STAGE.*.
6584:
6585: SUBST_CLASSES+= paths
6586: SUBST_STAGE.paths= pre-configure
6587: SUBST_MESSAGE.paths= Fixing absolute paths.
6588: SUBST_FILES.paths= src/*.c
6589: SUBST_FILES.paths+= scripts/*.sh
6590: SUBST_SED.paths= -e 's,"/usr/local,"${PREFIX},g'
6591: SUBST_SED.paths+= -e 's,"/var/log,"${VARBASE}/log,g'
6592: SUBST_VARS.paths= LOCALBASE PREFIX PKGVERSION
6593:
6594: To get a complete picture about the SUBST substitutions, run bmake
6595: show-all-subst. If something doesn't work as expected, run pkglint on the
6596: package, which detects several typical mistakes surrounding the SUBST blocks.
6597: For any questions that might remain after this, have a look at mk/subst.mk.
6598:
6599: 21.1.11.1. Choosing the time where the substitutions happen
6600:
6601: The SUBST_STAGE.* is one of {pre,do,post}-
6602: {extract,patch,configure,build,test,install}. Of these, pre-configure is used
6603: most often, by far. The most popular stages are, in chronological order:
6604:
6605: post-extract
6606:
6607: The substitutions are applied immediately after the distfiles are
6608: extracted. Running bmake extract on the package will leave no traces of the
6609: original files.
6610:
6611: When the substitution applies to files for which there is also a patch in
6612: the patches/ directory, this means that the patches will be computed based
6613: on the result of the substitution. When these patches are sent to the
6614: upstream maintainer later, to be fixed in the upstream package, these
6615: patches may no longer match what the upstream author is used to. Because of
6616: this, pre-configure is often a better choice.
6617:
6618: pre-configure
6619:
6620: The substitutions are applied after the patches from the patches/
6621: directory. This makes it possible to run bmake patch on the package, after
6622: which the patches can be edited using the tools pkgvi and mkpatches from
6623: the pkgtools/pkgdiff package.
6624:
6625: When updating the patches, it is helpful to explicitly separate the bmake
6626: patch from the bmake configure, and to only edit the patches between these
6627: commands. Otherwise the substitutions from the SUBST block will end up in
6628: the patch file. When this happens in really obvious ways, pkglint will
6629: complain about patches that contain a hard-coded /usr/pkg instead of the
6630: correct and intended @PREFIX@, but it can only detect these really obvious
6631: cases.
6632:
6633: do-configure
6634:
6635: This stage should only be used if the package defines a pre-configure
6636: action itself, and the substitution must happen after that. Typical
6637: examples are packages that use the pre-configure stage to regenerate the
6638: GNU configure script from configure.ac.
6639:
6640: post-configure
6641:
6642: This stage is used to fix up any mistakes by the configure stage.
6643:
6644: pre-build
6645:
6646: This stage should only be used for substitutions that are clearly related
6647: to building the package, not for fixing the configuration. Substitutions
6648: for pathnames (such as replacing /usr/local with ${PREFIX}) or user names
6649: (such as replacing @MY_USER@ with the actual username) belong in
6650: pre-configure or post-configure instead.
6651:
6652: post-build
6653:
6654: Just as with pre-build, this stage should only be used for substitutions
6655: that are clearly related to building the package, not for fixing the
6656: configuration. Substitutions for pathnames (such as replacing /usr/local
6657: with ${PREFIX}) or user names (such as replacing @MY_USER@ with the actual
6658: username) belong in pre-configure or post-configure instead.
6659:
6660: A typical use is to update pkg-config files to include the rpath compiler
6661: options.
6662:
6663: pre-install
6664:
6665: In general, the install phase should be as simple as possible. As with the
6666: pre-build and post-build stages, it should not be used to fix pathnames or
6667: user names, these belong in pre-configure instead. There are only few
6668: legitimate use cases for applying substitutions in this stage.
6669:
1.181 rillig 6670: 21.1.11.2. Choosing the files where the substitutions happen
1.180 rillig 6671:
6672: The SUBST_FILES.* variable contains a list of filename patterns. These patterns
6673: are relative to WRKSRC since that is where most substitutions happen. A typical
6674: example is:
6675:
6676: SUBST_FILES.path= Makefile */Makefile */*/Makefile *.[ch]
6677:
6678: The above patterns, especially the last, are quite broad. The SUBST
6679: implementation checks that each filename pattern that is mentioned here has an
6680: effect. For example, if none of the */*/Makefile files contains the patterns to
6681: be found and substituted, that filename pattern is redundant and should be left
1.181 rillig 6682: out. By default, the SUBST framework will complain with an error message. If
6683: the text to be substituted occurs in some of the files from a single pattern,
6684: but not in all of them, that is totally ok, and the SUBST framework will only
6685: print an INFO message for those files.
1.180 rillig 6686:
6687: If there is a good reason for having redundant filename patterns, set
1.181 rillig 6688: SUBST_NOOP_OK.* to yes.
1.180 rillig 6689:
6690: Another popular way of choosing the files for the substitutions is via a shell
6691: command, like this:
6692:
1.181 rillig 6693: C_FILES_CMD= cd ${WRKSRC} && ${FIND} . -name '*.c'
1.180 rillig 6694: SUBST_FILES.path= ${C_FILES_CMD:sh}
6695:
6696: The variable name C_FILES_CMD in this example is freely chosen and independent
6697: of the SUBST framework.
6698:
6699: In this variant, the SUBST_FILES.* variable lists each file individually.
6700: Thereby chances are higher that there are filename patterns in which no
6701: substitution happens. Since the SUBST framework cannot know whether the
6702: filename patterns in SUBST_FILES.* have been explicitly listed in the Makefile
6703: (where any redundant filename pattern would be suspicious) or been generated by
6704: a shell command (in which redundant filename patterns are more likely and to be
6705: expected), it will complain about these redundant filename patterns. Therefore,
6706: SUBST blocks that use a shell command to generate the list of filename patterns
6707: often need to set SUBST_NOOP_OK.* to yes.
6708:
6709: 21.1.11.3. Choosing what to substitute
6710:
6711: In most cases, the substitutions are given using one or more sed(1) commands,
6712: like this:
6713:
6714: SUBST_SED.path= -e 's|/usr/local|${PREFIX}|g'
6715:
6716: Each of the sed commands needs to be preceded by the -e option and should be
6717: specified on a line of its own, to avoid hiding short sed commands at the end
6718: of a line.
6719:
6720: Since the sed commands often contain shell metacharacters as the separator (the
6721: | in the above example), it is common to enclose them in single quotes.
6722:
6723: A common substitution is to replace placeholders of the form @VARNAME@ with
6724: their pkgsrc counterpart variable ${VARNAME}. A typical example is:
6725:
6726: SUBST_VARS.path= PREFIX
6727:
1.181 rillig 6728: This type of substitutions is typically done by the GNU configure scripts
6729: during the do-configure stage, but in some cases these need to be overridden.
6730: The same pattern is also used when a package defines patches that replace
6731: previously hard-coded paths like /usr/local with a @PREFIX@ placeholder first,
6732: which then gets substituted by the actual ${PREFIX} in the pre-configure stage.
6733: In many of these cases, it works equally well to just use the SUBST framework
6734: to directly replace /usr/local with ${PREFIX}, thereby omitting the
6735: intermediate patch file.
1.180 rillig 6736:
6737: If the above is not flexible enough, it is possible to not use sed at all for
6738: the substitution but to specify an entirely different command, like this:
6739:
6740: SUBST_FILTER_CMD.path= LC_ALL=C ${TR} -d '\r'
1.1 dsieger 6741:
1.180 rillig 6742: This is used for the few remaining packages in which the distributed files use
6743: Windows-style line endings that need to be converted to UNIX-style line
6744: endings.
1.1 dsieger 6745:
1.180 rillig 6746: 21.1.11.4. Other SUBST variables
1.172 rillig 6747:
1.180 rillig 6748: When a SUBST block is applied during a package build, a message is logged. The
6749: default message is fine for most purposes but can be overridden by setting
6750: SUBST_MESSAGE.* to an individual message.
1.1 dsieger 6751:
1.154 rillig 6752: 21.2. The fetch phase
1.1 dsieger 6753:
1.154 rillig 6754: 21.2.1. Packages whose distfiles aren't available for plain downloading
1.1 dsieger 6755:
6756: If you need to download from a dynamic URL you can set DYNAMIC_MASTER_SITES and
6757: a make fetch will call files/getsite.sh with the name of each file to download
6758: as an argument, expecting it to output the URL of the directory from which to
6759: download it. graphics/ns-cult3d is an example of this usage.
6760:
6761: If the download can't be automated, because the user must submit personal
6762: information to apply for a password, or must pay for the source, or whatever,
6763: you can set FETCH_MESSAGE to a list of lines that are displayed to the user
6764: before aborting the build. Example:
6765:
6766: FETCH_MESSAGE= "Please download the files"
6767: FETCH_MESSAGE+= " "${DISTFILES:Q}
6768: FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"."
6769:
1.154 rillig 6770: 21.2.2. How to handle modified distfiles with the 'old' name
1.1 dsieger 6771:
6772: Sometimes authors of a software package make some modifications after the
6773: software was released, and they put up a new distfile without changing the
6774: package's version number. If a package is already in pkgsrc at that time, the
6775: checksum will no longer match. The contents of the new distfile should be
6776: compared against the old one before changing anything, to make sure the
6777: distfile was really updated on purpose, and that no trojan horse or so crept
6778: in. Please mention that the distfiles were compared and what was found in your
1.54 rodent 6779: commit message.
6780:
6781: Then, the correct way to work around this is to set DIST_SUBDIR to a unique
1.109 wiz 6782: directory name, usually based on PKGNAME_NOREV (but take care with python or
6783: ruby packages, where PKGNAME includes a variable prefix). All DISTFILES and
6784: PATCHFILES for this package will be put in that subdirectory of the local
1.154 rillig 6785: distfiles directory. (See Section 21.1.10, "How to handle incrementing versions
1.109 wiz 6786: when fixing an existing package" for more details.) In case this happens more
6787: often, PKGNAME can be used (thus including the nbX suffix) or a date stamp can
6788: be appended, like ${PKGNAME_NOREV}-YYYYMMDD.
1.54 rodent 6789:
6790: DIST_SUBDIR is also used when a distfile's name does not contain a version and
6791: the distfile is apt to change. In cases where the likelihood of this is very
6792: small, DIST_SUBDIR might not be required. Additionally, DIST_SUBDIR must not be
6793: removed unless the distfile name changes, even if a package is being moved or
6794: renamed.
6795:
6796: Do not forget regenerating the distinfo file after that, since it contains the
6797: DIST_SUBDIR path in the filenames. Also, increase the PKGREVISION if the
6798: installed package is different. Furthermore, a mail to the package's authors
6799: seems appropriate telling them that changing distfiles after releases without
6800: changing the file names is not good practice.
1.1 dsieger 6801:
1.154 rillig 6802: 21.2.3. Packages hosted on github.com
1.88 tnn 6803:
1.90 tnn 6804: Helper methods exist for packages hosted on github.com which will often have
6805: distfile names that clash with other packages, for example 1.0.tar.gz. Use one
6806: of the three recipes from below:
1.88 tnn 6807:
1.154 rillig 6808: 21.2.3.1. Fetch based on a tagged release
1.88 tnn 6809:
1.189 bacon 6810: If your distfile URL looks similar to https://github.com/username/example/
6811: archive/v1.0.zip, then you are packaging a tagged release.
1.88 tnn 6812:
1.189 bacon 6813: DISTNAME= example-1.0
1.90 tnn 6814: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
1.189 bacon 6815: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
1.90 tnn 6816: GITHUB_TAG= v${PKGVERSION_NOREV}
1.88 tnn 6817: EXTRACT_SUFX= .zip
6818:
1.189 bacon 6819: 21.2.3.2. Fetch based on a specific commit before the first release
6820:
6821: If your distfile looks similar to https://github.com/username/example/archive/
6822: 988881adc9fc3655077dc2d4d757d480b5ea0e11 and is from a commit before the first
6823: release, then set the package version to 0.0.0.N, where N is the number of
6824: commits to the repository, and set GITHUB_TAG to the commit hash. This will
6825: (almost) ensure that the first tagged release will have a version greater than
6826: this one so that package upgrades will function properly.
6827:
6828: DISTNAME= example-0.0.0.347
6829: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6830: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
6831: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
6832:
6833: 21.2.3.3. Fetch based on a specific commit after a release
1.88 tnn 6834:
1.189 bacon 6835: If your distfile looks similar to https://github.com/username/example/archive/
6836: 988881adc9fc3655077dc2d4d757d480b5ea0e11 and is from a commit after a release,
6837: then include the last release version and the commit count since that release
6838: in the package version and set GITHUB_TAG to the commit hash. The latest
6839: release and commit count are shown in the output of "git describe --tags":
6840:
6841: # git clone https://github.com/username/example
6842: # cd example
6843: # git describe --tags
6844: 1.2.3-5-g988881a
1.88 tnn 6845:
1.189 bacon 6846: DISTNAME= example-1.2.3.5
6847: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6848: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
1.90 tnn 6849: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
1.88 tnn 6850:
1.189 bacon 6851: 21.2.3.4. Fetch based on release
1.88 tnn 6852:
1.189 bacon 6853: If your distfile URL looks similar to https://github.com/username/example/
6854: releases/download/rel-1.6/offensive-1.6.zip, then you are packaging a release.
1.88 tnn 6855:
1.90 tnn 6856: DISTNAME= offensive-1.6
1.88 tnn 6857: PKGNAME= ${DISTNAME:S/offensive/proper/}
1.90 tnn 6858: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
1.189 bacon 6859: GITHUB_PROJECT= example
1.90 tnn 6860: GITHUB_RELEASE= rel-${PKGVERSION_NOREV} # usually just set this to ${DISTNAME}
6861: EXTRACT_SUFX= .zip
1.88 tnn 6862:
1.154 rillig 6863: 21.3. The configure phase
1.1 dsieger 6864:
1.154 rillig 6865: 21.3.1. Shared libraries - libtool
1.1 dsieger 6866:
6867: pkgsrc supports many different machines, with different object formats like
6868: a.out and ELF, and varying abilities to do shared library and dynamic loading
6869: at all. To accompany this, varying commands and options have to be passed to
6870: the compiler, linker, etc. to get the Right Thing, which can be pretty annoying
6871: especially if you don't have all the machines at your hand to test things. The
6872: devel/libtool pkg can help here, as it just "knows" how to build both static
6873: and dynamic libraries from a set of source files, thus being
6874: platform-independent.
6875:
6876: Here's how to use libtool in a package in seven simple steps:
6877:
6878: 1. Add USE_LIBTOOL=yes to the package Makefile.
6879:
6880: 2. For library objects, use "${LIBTOOL} --mode=compile ${CC}" in place of "$
6881: {CC}". You could even add it to the definition of CC, if only libraries are
6882: being built in a given Makefile. This one command will build both PIC and
6883: non-PIC library objects, so you need not have separate shared and
6884: non-shared library rules.
6885:
6886: 3. For the linking of the library, remove any "ar", "ranlib", and "ld
6887: -Bshareable" commands, and instead use:
6888:
6889: ${LIBTOOL} --mode=link \
6890: ${CC} -o ${.TARGET:.a=.la} \
6891: ${OBJS:.o=.lo} \
6892: -rpath ${PREFIX}/lib \
6893: -version-info major:minor
6894:
6895: Note that the library is changed to have a .la extension, and the objects
6896: are changed to have a .lo extension. Change OBJS as necessary. This
6897: automatically creates all of the .a, .so.major.minor, and ELF symlinks (if
6898: necessary) in the build directory. Be sure to include "-version-info",
6899: especially when major and minor are zero, as libtool will otherwise strip
6900: off the shared library version.
6901:
6902: From the libtool manual:
6903:
6904: So, libtool library versions are described by three integers:
6905:
6906: CURRENT
6907: The most recent interface number that this library implements.
6908:
6909: REVISION
6910: The implementation number of the CURRENT interface.
6911:
6912: AGE
6913: The difference between the newest and oldest interfaces that
6914: this library implements. In other words, the library implements
6915: all the interface numbers in the range from number `CURRENT -
6916: AGE' to `CURRENT'.
6917:
6918: If two libraries have identical CURRENT and AGE numbers, then the
6919: dynamic linker chooses the library with the greater REVISION number.
6920:
6921: The "-release" option will produce different results for a.out and ELF
1.25 wiz 6922: (excluding symlinks) in only one case. An ELF library of the form "
6923: libfoo-release.so.x.y" will have a symlink of "libfoo.so.x.y" on an a.out
1.1 dsieger 6924: platform. This is handled automatically.
6925:
6926: The "-rpath argument" is the install directory of the library being built.
6927:
6928: In the PLIST, include only the .la file, the other files will be added
6929: automatically.
6930:
6931: 4. When linking shared object (.so) files, i.e. files that are loaded via
6932: dlopen(3), NOT shared libraries, use "-module -avoid-version" to prevent
6933: them getting version tacked on.
6934:
6935: The PLIST file gets the foo.so entry.
6936:
6937: 5. When linking programs that depend on these libraries before they are
6938: installed, preface the cc(1) or ld(1) line with "${LIBTOOL} --mode=link",
6939: and it will find the correct libraries (static or shared), but please be
6940: aware that libtool will not allow you to specify a relative path in -L
6941: (such as "-L../somelib"), because it expects you to change that argument to
6942: be the .la file. e.g.
6943:
6944: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
6945:
6946: should be changed to:
6947:
6948: ${LIBTOOL} --mode=link ${CC} -o someprog ../somelib/somelib.la
6949:
6950: and it will do the right thing with the libraries.
6951:
6952: 6. When installing libraries, preface the install(1) or cp(1) command with "$
6953: {LIBTOOL} --mode=install", and change the library name to .la. e.g.
6954:
1.23 jakllsch 6955: ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 dsieger 6956:
6957: This will install the static .a, shared library, any needed symlinks, and
6958: run ldconfig(8).
6959:
6960: 7. In your PLIST, include only the .la file (this is a change from previous
6961: behaviour).
6962:
1.154 rillig 6963: 21.3.2. Using libtool on GNU packages that already support libtool
1.1 dsieger 6964:
6965: Add USE_LIBTOOL=yes to the package Makefile. This will override the package's
6966: own libtool in most cases. For older libtool using packages, libtool is made by
6967: ltconfig script during the do-configure step; you can check the libtool script
6968: location by doing make configure; find work*/ -name libtool.
6969:
6970: LIBTOOL_OVERRIDE specifies which libtool scripts, relative to WRKSRC, to
6971: override. By default, it is set to "libtool */libtool */*/libtool". If this
6972: does not match the location of the package's libtool script(s), set it as
6973: appropriate.
6974:
6975: If you do not need *.a static libraries built and installed, then use
6976: SHLIBTOOL_OVERRIDE instead.
6977:
6978: If your package makes use of the platform-independent library for loading
6979: dynamic shared objects, that comes with libtool (libltdl), you should include
6980: devel/libltdl/buildlink3.mk.
6981:
6982: Some packages use libtool incorrectly so that the package may not work or build
6983: in some circumstances. Some of the more common errors are:
6984:
6985: * The inclusion of a shared object (-module) as a dependent library in an
6986: executable or library. This in itself isn't a problem if one of two things
6987: has been done:
6988:
6989: 1. The shared object is named correctly, i.e. libfoo.la, not foo.la
6990:
6991: 2. The -dlopen option is used when linking an executable.
6992:
6993: * The use of libltdl without the correct calls to initialisation routines.
6994: The function lt_dlinit() should be called and the macro
6995: LTDL_SET_PRELOADED_SYMBOLS included in executables.
6996:
1.154 rillig 6997: 21.3.3. GNU Autoconf/Automake
1.1 dsieger 6998:
6999: If a package needs GNU autoconf or automake to be executed to regenerate the
7000: configure script and Makefile.in makefile templates, then they should be
7001: executed in a pre-configure target.
7002:
7003: For packages that need only autoconf:
7004:
7005: AUTOCONF_REQD= 2.50 # if default version is not good enough
7006: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
7007: ...
7008:
7009: pre-configure:
7010: cd ${WRKSRC} && autoconf
7011:
7012: ...
7013:
7014: and for packages that need automake and autoconf:
7015:
7016: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
7017: USE_TOOLS+= automake # use "automake14" for automake-1.4
7018: ...
7019:
7020: pre-configure:
7021: set -e; cd ${WRKSRC}; \
7022: aclocal; autoheader; automake -a --foreign -i; autoconf
7023:
7024: ...
7025:
7026: Packages which use GNU Automake will almost certainly require GNU Make.
7027:
7028: There are times when the configure process makes additional changes to the
7029: generated files, which then causes the build process to try to re-execute the
7030: automake sequence. This is prevented by touching various files in the configure
7031: stage. If this causes problems with your package you can set AUTOMAKE_OVERRIDE=
7032: NO in the package Makefile.
7033:
1.154 rillig 7034: 21.4. Programming languages
1.1 dsieger 7035:
1.154 rillig 7036: 21.4.1. C, C++, and Fortran
1.1 dsieger 7037:
7038: Compilers for the C, C++, and Fortran languages comes with the NetBSD base
7039: system. By default, pkgsrc assumes that a package is written in C and will hide
1.184 rillig 7040: all other compilers (via the wrapper framework, see Chapter 18, Buildlink
1.1 dsieger 7041: methodology).
7042:
7043: To declare which language's compiler a package needs, set the USE_LANGUAGES
7044: variable. Allowed values currently are "c", "c++", and "fortran" (and any
7045: combination). The default is "c". Packages using GNU configure scripts, even if
7046: written in C++, usually need a C compiler for the configure phase.
7047:
1.154 rillig 7048: 21.4.2. Java
1.1 dsieger 7049:
7050: If a program is written in Java, use the Java framework in pkgsrc. The package
7051: must include ../../mk/java-vm.mk. This Makefile fragment provides the following
7052: variables:
7053:
7054: * USE_JAVA defines if a build dependency on the JDK is added. If USE_JAVA is
7055: set to "run", then there is only a runtime dependency on the JDK. The
7056: default is "yes", which also adds a build dependency on the JDK.
7057:
7058: * Set USE_JAVA2 to declare that a package needs a Java2 implementation. The
7059: supported values are "yes", "1.4", and "1.5". "yes" accepts any Java2
7060: implementation, "1.4" insists on versions 1.4 or above, and "1.5" only
7061: accepts versions 1.5 or above. This variable is not set by default.
7062:
1.25 wiz 7063: * PKG_JAVA_HOME is automatically set to the runtime location of the used Java
7064: implementation dependency. It may be used to set JAVA_HOME to a good value
7065: if the program needs this variable to be defined.
7066:
1.205 wiz 7067: 21.4.3. Go
7068:
7069: If a program is written in Go and has any dependencies on other Go modules,
7070: have the package include ../../lang/go/go-module.mk.
7071:
7072: 1. Generate a list of those dependencies with make clean && make patch && make
7073: show-go-modules > go-modules.mk.
7074:
7075: 2. Prepend
7076:
7077: .include
7078: "go-modules.mk"
7079:
7080: to any other
7081:
7082: .include
7083:
7084: s.
7085:
7086: 3. Incorporate these modules in distinfo with make makesum.
7087:
7088: 21.4.4. Packages containing Perl scripts
1.1 dsieger 7089:
1.203 nia 7090: If your package contains interpreted Perl scripts, add "perl" to the USE_TOOLS
1.1 dsieger 7091: variable and set REPLACE_PERL to ensure that the proper interpreter path is
7092: set. REPLACE_PERL should contain a list of scripts, relative to WRKSRC, that
1.74 wiz 7093: you want adjusted. Every occurrence of */bin/perl in a she-bang line will be
1.210 ! gutterid 7094: replaced with the full path to the Perl executable.
1.1 dsieger 7095:
1.210 ! gutterid 7096: If a particular version of Perl is needed, set the PERL5_REQD variable to the
1.1 dsieger 7097: version number. The default is "5.0".
7098:
1.203 nia 7099: See Section 21.6.6, "Packages installing Perl modules" for information about
1.210 ! gutterid 7100: handling Perl modules.
! 7101:
! 7102: There is also the REPLACE_PERL6 variable for the language now known as Raku.
1.1 dsieger 7103:
1.205 wiz 7104: 21.4.5. Packages containing shell scripts
1.41 wiz 7105:
7106: REPLACE_SH, REPLACE_BASH, REPLACE_CSH, and REPLACE_KSH can be used to replace
1.195 gutterid 7107: shell hash bangs in files. Please use the appropriate one, preferring
7108: REPLACE_SH in case this shell is sufficient. Each should contain a list of
7109: scripts, relative to WRKSRC, that you want adjusted. Every occurrence of the
7110: matching shell in a she-bang line will be replaced with the full path to the
7111: shell executable. When using REPLACE_BASH, don't forget to add bash to
7112: USE_TOOLS.
1.41 wiz 7113:
1.205 wiz 7114: 21.4.6. Other programming languages
1.1 dsieger 7115:
1.210 ! gutterid 7116: There are further similar REPLACE variables available, e.g., REPLACE_AWK for
! 7117: packages containing awk scripts, and REPLACE_R for R. These two, like the
! 7118: others noted above, are defined centrally in mk/configure/
! 7119: replace-interpreter.mk. Other languages define these variables within their own
! 7120: dedicated part of the tree, e.g., PHP defines REPLACE_PHP in lang/php/
! 7121: phpversion.mk, and Python defines REPLACE_PYTHON in lang/python/application.mk.
! 7122: For other languages, consult the mk files found within their specific
! 7123: directories (the naming convention varies).
! 7124:
! 7125: Currently, special handling for other languages varies in pkgsrc. If a compiler
! 7126: package provides a buildlink3.mk file, include that, otherwise just add a
! 7127: (build) dependency on the appropriate compiler package.
1.1 dsieger 7128:
1.154 rillig 7129: 21.5. The build phase
1.1 dsieger 7130:
7131: The most common failures when building a package are that some platforms do not
7132: provide certain header files, functions or libraries, or they provide the
7133: functions in a library that the original package author didn't know. To work
7134: around this, you can rewrite the source code in most cases so that it does not
7135: use the missing functions or provides a replacement function.
7136:
1.154 rillig 7137: 21.5.1. Compiling C and C++ code conditionally
1.1 dsieger 7138:
7139: If a package already comes with a GNU configure script, the preferred way to
7140: fix the build failure is to change the configure script, not the code. In the
7141: other cases, you can utilize the C preprocessor, which defines certain macros
7142: depending on the operating system and hardware architecture it compiles for.
7143: These macros can be queried using for example #if defined(__i386). Almost every
7144: operating system, hardware architecture and compiler has its own macro. For
7145: example, if the macros __GNUC__, __i386__ and __NetBSD__ are all defined, you
7146: know that you are using NetBSD on an i386 compatible CPU, and your compiler is
7147: GCC.
7148:
7149: The list of the following macros for hardware and operating system depends on
7150: the compiler that is used. For example, if you want to conditionally compile
7151: code on Solaris, don't use __sun__, as the SunPro compiler does not define it.
7152: Use __sun instead.
7153:
1.154 rillig 7154: 21.5.1.1. C preprocessor macros to identify the operating system
1.1 dsieger 7155:
7156: To distinguish between 4.4 BSD-derived systems and the rest of the world, you
7157: should use the following code.
7158:
7159: #include <sys/param.h>
7160: #if (defined(BSD) && BSD >= 199306)
7161: /* BSD-specific code goes here */
7162: #else
7163: /* non-BSD-specific code goes here */
7164: #endif
7165:
7166: If this distinction is not fine enough, you can also test for the following
7167: macros.
7168:
1.46 obache 7169: Cygwin __CYGWIN__
7170: DragonFly __DragonFly__
1.1 dsieger 7171: FreeBSD __FreeBSD__
1.46 obache 7172: Haiku __HAIKU__
1.1 dsieger 7173: Interix __INTERIX
7174: IRIX __sgi (TODO: get a definite source for this)
7175: Linux linux, __linux, __linux__
1.83 dholland 7176: Mac OS X __APPLE__
1.46 obache 7177: MirBSD __MirBSD__ (__OpenBSD__ is also defined)
7178: Minix3 __minix
1.1 dsieger 7179: NetBSD __NetBSD__
7180: OpenBSD __OpenBSD__
7181: Solaris sun, __sun
7182:
1.154 rillig 7183: 21.5.1.2. C preprocessor macros to identify the hardware architecture
1.1 dsieger 7184:
7185: i386 i386, __i386, __i386__
7186: MIPS __mips
7187: SPARC sparc, __sparc
7188:
1.154 rillig 7189: 21.5.1.3. C preprocessor macros to identify the compiler
1.1 dsieger 7190:
7191: GCC __GNUC__ (major version), __GNUC_MINOR__
7192: MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41)
7193: SunPro __SUNPRO_C (0x570 for Sun C 5.7)
7194: SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8)
7195:
1.154 rillig 7196: 21.5.2. How to handle compiler bugs
1.1 dsieger 7197:
7198: Some source files trigger bugs in the compiler, based on combinations of
7199: compiler version and architecture and almost always relation to optimisation
7200: being enabled. Common symptoms are gcc internal errors or never finishing
7201: compiling a file.
7202:
7203: Typically, a workaround involves testing the MACHINE_ARCH and compiler version,
1.87 tnn 7204: disabling optimisation for that combination of file, MACHINE_ARCH and compiler.
7205:
7206: This used to be a big problem in the past, but is rarely needed now as compiler
7207: technology has matured. If you still need to add a compiler specific
7208: workaround, please do so in the file hacks.mk and describe the symptom and
7209: compiler version as detailed as possible.
1.1 dsieger 7210:
1.172 rillig 7211: 21.5.3. No such file or directory
7212:
7213: Compilation sometimes fails with an error message like this:
7214:
7215: .../x11/gtk3/work/gtk+-3.24.12/gdk/gdktypes.h:35:10:
7216: fatal error: pango/pango.h: No such file or directory
7217:
7218: The proper way to fix this problem depends on the type of the header, which is
7219: described in the following sections.
7220:
7221: 21.5.3.1. Headers from other packages
7222:
7223: If the header name looks like it comes from a different package, that other
7224: package should be included via the buildlink3 framework.
7225:
7226: First, look whether the header is somewhere in the buildlink3 directory below
7227: WRKDIR. In the above case of the missing Pango header:
7228:
7229: $ find work/.buildlink/ -print | grep -F pango/pango.h
7230:
7231: In the case of Pango, the output is:
7232:
7233: work/.buildlink/include/pango-1.0/pango/pango.h
7234:
7235: If the pango/pango.h file were placed directly in the .buildlink directory, it
7236: would have been found automatically. There is an extra pango-1.0 path component
7237: though, which means that the compiler command line must contain an option of
7238: the form -I${BUILDLINK3_PREFIX.pango}/include/pango-1.0. In most cases this
7239: option is generated by the configure script, which can be examined using:
7240:
7241: $ $ grep -o '[-]I[^[:space:]]*/pango[^[:space:]]*' work/*/Makefile
7242: -I/usr/pkg/include/pango-1.0
7243: -I/usr/pkg/include/pango-1.0
7244: -I/usr/pkg/include/pango-1.0
7245: -I/usr/pkg/include/pango-1.0
7246: -I/usr/pkg/include/pango-1.0
7247:
7248: This looks good. These options are transformed by the buildlink wrapper to
7249: refer to the correct path inside work/.buildlink.
7250:
7251: Since the compilation fails though, examine the compiler command lines in work
7252: /.work.log to see whether the -I option is included in the particular command
7253: line.
7254:
7255: To further analyze the situation, run bmake build-env, which sets up an
7256: interactive, realistic environment including all the pkgsrc wrapper commands
7257: and environment variables. From there, try to compile some simple example
7258: programs that use the header.
7259:
7260: 21.5.3.2. Headers generated during the build
7261:
7262: If the name of the header seems to come from the package itself, and if the
7263: build is run with parallel jobs, the package may have some undeclared
7264: dependencies between the .c and the .h files, and a C file is compiled before
7265: its required header is generated.
7266:
7267: To see whether the build runs with parallel jobs, run bmake show-all-build |
7268: grep JOBS. Its output looks like this:
7269:
7270: usr MAKE_JOBS= 7
7271: pkg MAKE_JOBS_SAFE # undefined
7272: def _MAKE_JOBS_N= 7
7273:
7274: In this case the pkgsrc user has asked pkgsrc to build packages with 7 jobs in
7275: parallel (MAKE_JOBS). The package could have disabled parallel builds by
7276: setting MAKE_JOBS_SAFE to no, but in this case it hasn't.
7277:
7278: To see whether the build failure is caused by parallel builds, first save the
7279: exact error message and a bit of context, maybe you need it later for reporting
7280: a bug. Next, run:
7281:
7282: MAKE_JOBS_SAFE=no bmake clean build
7283:
7284: If that succeeds, file a bug report against the pkgsrc package, including the
7285: exact error message and the contents of your mk.conf file.
7286:
1.173 rillig 7287: 21.5.3.3. Symlinks
7288:
7289: Pkgsrc does not work reliably if any of LOCALBASE, VARBASE or WRKDIR contains a
7290: symlink. Since 2019Q2, the pkgsrc bootstrap program prevents installing pkgsrc
7291: in symlink-based directories. Existing pkgsrc installations are not checked for
7292: symlinks though.
7293:
7294: The "No such file or directory" error messages are a typical symptom of
7295: symlinks, and it's quite difficult to find out that this is the actual cause.
7296:
7297: 21.5.3.4. Stale working directories
7298:
7299: When building a hierarchy of packages, it may happen that one package is built
7300: and then pkgsrc is updated. This situation can provoke various hard to diagnose
7301: build errors. To clean up the situation:
7302:
7303: $ (cd ../../ && test -f mk/bsd.pkg.mk && rm -rf */*/work)
7304:
7305: (The test for bsd.pkg.mk just prevents running this command in the wrong
7306: directory.)
7307:
7308: If you have set WRKOBJDIR in mk.conf, remove that directory as well.
7309:
7310: 21.5.3.5. Other possible reasons
7311:
7312: On platforms other than BSD, third-party packages are installed in /usr/
7313: include, together with the base system. This means that pkgsrc cannot
7314: distinguish between headers provided by the base system (which it needs) and
7315: headers from third-party packages (which are often included in pkgsrc as well).
7316: This can lead to subtle version mismatches.
7317:
7318: In pkgsrc installations that have been active for several years, it may happen
7319: that some files are manually deleted. To exclude this unlikely reason, run
7320: pkg_admin check.
7321:
7322: It may help to run pkg_admin rebuild-tree to check/fix dependencies.
7323:
7324: If all of the above doesn't help, see Chapter 2, Getting help for contact
7325: information. Be prepared to describe what you have tried so far and what any
7326: error messages were.
7327:
1.172 rillig 7328: 21.5.4. Undefined reference to "..."
1.1 dsieger 7329:
7330: This error message often means that a package did not link to a shared library
7331: it needs. The following functions are known to cause this error message over
7332: and over.
7333:
7334: +-----------------------------------------------------+
7335: | Function |Library |Affected platforms|
7336: |-------------------------+--------+------------------|
7337: |accept, bind, connect |-lsocket|Solaris |
7338: |-------------------------+--------+------------------|
7339: |crypt |-lcrypt |DragonFly, NetBSD |
7340: |-------------------------+--------+------------------|
7341: |dlopen, dlsym |-ldl |Linux |
7342: |-------------------------+--------+------------------|
7343: |gethost* |-lnsl |Solaris |
7344: |-------------------------+--------+------------------|
7345: |inet_aton |-lresolv|Solaris |
7346: |-------------------------+--------+------------------|
7347: |nanosleep, sem_*, timer_*|-lrt |Solaris |
7348: |-------------------------+--------+------------------|
7349: |openpty |-lutil |Linux |
7350: +-----------------------------------------------------+
7351:
7352: To fix these linker errors, it is often sufficient to say LIBS.OperatingSystem+
7353: = -lfoo to the package Makefile and then say bmake clean; bmake.
7354:
1.172 rillig 7355: 21.5.4.1. Special issue: The SunPro compiler
1.1 dsieger 7356:
7357: When you are using the SunPro compiler, there is another possibility. That
7358: compiler cannot handle the following code:
7359:
7360: extern int extern_func(int);
7361:
7362: static inline int
7363: inline_func(int x)
7364: {
7365: return extern_func(x);
7366: }
7367:
7368: int main(void)
7369: {
7370: return 0;
7371: }
7372:
7373: It generates the code for inline_func even if that function is never used. This
7374: code then refers to extern_func, which can usually not be resolved. To solve
7375: this problem you can try to tell the package to disable inlining of functions.
7376:
1.172 rillig 7377: 21.5.5. Running out of memory
1.1 dsieger 7378:
7379: Sometimes packages fail to build because the compiler runs into an operating
7380: system specific soft limit. With the UNLIMIT_RESOURCES variable pkgsrc can be
1.94 wiz 7381: told to unlimit the resources. Currently, the allowed values are any
7382: combination of "cputime", "datasize", "memorysize", and "stacksize". Setting
7383: this variable is similar to running the shell builtin ulimit command to raise
7384: the maximum data segment size or maximum stack size of a process, respectively,
7385: to their hard limits.
1.1 dsieger 7386:
1.154 rillig 7387: 21.6. The install phase
1.1 dsieger 7388:
1.154 rillig 7389: 21.6.1. Creating needed directories
1.1 dsieger 7390:
7391: The BSD-compatible install supplied with some operating systems cannot create
7392: more than one directory at a time. As such, you should call ${INSTALL_*_DIR}
7393: like this:
7394:
7395: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
7396: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
7397:
7398: You can also just append "dir1 dir2" to the INSTALLATION_DIRS variable, which
7399: will automatically do the right thing.
7400:
1.154 rillig 7401: 21.6.2. Where to install documentation
1.1 dsieger 7402:
7403: In general, documentation should be installed into ${PREFIX}/share/doc/$
7404: {PKGBASE} or ${PREFIX}/share/doc/${PKGNAME} (the latter includes the version
7405: number of the package).
7406:
7407: Many modern packages using GNU autoconf allow to set the directory where HTML
7408: documentation is installed with the "--with-html-dir" option. Sometimes using
7409: this flag is needed because otherwise the documentation ends up in ${PREFIX}/
7410: share/doc/html or other places.
7411:
7412: An exception to the above is that library API documentation generated with the
7413: textproc/gtk-doc tools, for use by special browsers (devhelp) should be left at
7414: their default location, which is ${PREFIX}/share/gtk-doc. Such documentation
7415: can be recognized from files ending in .devhelp or .devhelp2. (It is also
7416: acceptable to install such files in ${PREFIX}/share/doc/${PKGBASE} or ${PREFIX}
7417: /share/doc/${PKGNAME}; the .devhelp* file must be directly in that directory
7418: then, no additional subdirectory level is allowed in this case. This is usually
7419: achieved by using "--with-html-dir=${PREFIX}/share/doc". ${PREFIX}/share/
7420: gtk-doc is preferred though.)
7421:
1.154 rillig 7422: 21.6.3. Installing highscore files
1.1 dsieger 7423:
7424: Certain packages, most of them in the games category, install a score file that
7425: allows all users on the system to record their highscores. In order for this to
7426: work, the binaries need to be installed setgid and the score files owned by the
1.36 wiz 7427: appropriate group and/or owner (traditionally the "games" user/group). Set
7428: USE_GAMESGROUP to yes to support this. The following variables, documented in
7429: more detail in mk/defaults/mk.conf, control this behaviour: GAMEDATAMODE,
1.100 leot 7430: GAMEDIRMODE, GAMES_GROUP, GAMEMODE, GAME_USER. Other useful variables are:
7431: GAMEDIR_PERMS, GAMEDATA_PERMS and SETGID_GAMES_PERMS.
7432:
7433: An example that illustrates some of the variables described above is games/
7434: moon-buggy. OWN_DIRS_PERMS is used to properly set directory permissions of the
7435: directory where the scorefile is saved, REQD_FILES_PERMS is used to create a
7436: dummy scorefile (mbscore) with the proper permissions and SPECIAL_PERMS is used
7437: to install setgid the game binary:
7438:
7439: USE_GAMESGROUP= yes
7440:
7441: BUILD_DEFS+= VARBASE
7442:
7443: OWN_DIRS_PERMS+= ${VARBASE}/games/moon-buggy ${GAMEDIR_PERMS}
7444: REQD_FILES_PERMS+= /dev/null ${VARBASE}/games/moon-buggy/mbscore ${GAMEDATA_PERMS}
7445: SPECIAL_PERMS+= ${PREFIX}/bin/moon-buggy ${SETGID_GAMES_PERMS}
7446:
7447: Various INSTALL_* variables are also available: INSTALL_GAME to install setgid
7448: game binaries, INSTALL_GAME_DIR to install game directories that are needed to
7449: be accessed by setgid games and INSTALL_GAME_DATA to install scorefiles.
1.1 dsieger 7450:
1.14 jmcneill 7451: A package should therefore never hard code file ownership or access permissions
1.100 leot 7452: but rely on *_PERMS as described above or alternatively on INSTALL_GAME,
7453: INSTALL_GAME_DATA and INSTALL_GAME_DIR to set these correctly.
1.1 dsieger 7454:
1.154 rillig 7455: 21.6.4. Adding DESTDIR support to packages
1.4 rillig 7456:
1.14 jmcneill 7457: DESTDIR support means that a package installs into a staging directory, not the
7458: final location of the files. Then a binary package is created which can be used
7459: for installation as usual. There are two ways: Either the package must install
1.25 wiz 7460: as root ("destdir") or the package can install as non-root user ("user-destdir"
7461: ).
1.14 jmcneill 7462:
1.113 leot 7463: * PKG_DESTDIR_SUPPORT has to be set to "destdir" or "user-destdir". By
7464: default PKG_DESTDIR_SUPPORT is set to "user-destdir" to help catching more
7465: potential packaging problems. If bsd.prefs.mk is included in the Makefile,
7466: PKG_DESTDIR_SUPPORT needs to be set before the inclusion.
1.14 jmcneill 7467:
1.4 rillig 7468: * All installation operations have to be prefixed with ${DESTDIR}.
7469:
7470: * automake gets this DESTDIR mostly right automatically. Many manual rules
7471: and pre/post-install often are incorrect; fix them.
7472:
1.17 imil 7473: * If files are installed with special owner/group use SPECIAL_PERMS.
1.4 rillig 7474:
7475: * In general, packages should support UNPRIVILEGED to be able to use DESTDIR.
7476:
1.154 rillig 7477: 21.6.5. Packages with hardcoded paths to other interpreters
1.1 dsieger 7478:
7479: Your package may also contain scripts with hardcoded paths to other
1.203 nia 7480: interpreters besides (or as well as) Perl. To correct the full pathname to the
1.1 dsieger 7481: script interpreter, you need to set the following definitions in your Makefile
7482: (we shall use tclsh in this example):
7483:
7484: REPLACE_INTERPRETER+= tcl
7485: REPLACE.tcl.old= .*/bin/tclsh
7486: REPLACE.tcl.new= ${PREFIX}/bin/tclsh
7487: REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
7488: # relative to ${WRKSRC}, just as in REPLACE_PERL
7489:
7490: Note
7491:
7492: Before March 2006, these variables were called _REPLACE.* and _REPLACE_FILES.*.
7493:
1.203 nia 7494: 21.6.6. Packages installing Perl modules
1.1 dsieger 7495:
7496: Makefiles of packages providing perl5 modules should include the Makefile
7497: fragment ../../lang/perl5/module.mk. It provides a do-configure target for the
7498: standard perl configuration for such modules as well as various hooks to tune
7499: this configuration. See comments in this file for details.
7500:
7501: Perl5 modules will install into different places depending on the version of
7502: perl used during the build process. To address this, pkgsrc will append lines
7503: to the PLIST corresponding to the files listed in the installed .packlist file
7504: generated by most perl5 modules. This is invoked by defining PERL5_PACKLIST to
1.48 wiz 7505: a space-separated list of packlist files relative to PERL5_PACKLIST_DIR
7506: (PERL5_INSTALLVENDORARCH by default), e.g.:
1.1 dsieger 7507:
1.48 wiz 7508: PERL5_PACKLIST= auto/Pg/.packlist
1.1 dsieger 7509:
1.48 wiz 7510: The perl5 config variables installarchlib, installscript, installvendorbin,
7511: installvendorscript, installvendorarch, installvendorlib, installvendorman1dir,
7512: and installvendorman3dir represent those locations in which components of perl5
7513: modules may be installed, provided as variable with uppercase and prefixed with
7514: PERL5_, e.g. PERL5_INSTALLARCHLIB and may be used by perl5 packages that don't
7515: have a packlist. These variables are also substituted for in the PLIST as
7516: uppercase prefixed with PERL5_SUB_.
1.1 dsieger 7517:
1.154 rillig 7518: 21.6.7. Packages installing info files
1.1 dsieger 7519:
7520: Some packages install info files or use the "makeinfo" or "install-info"
7521: commands. INFO_FILES should be defined in the package Makefile so that INSTALL
7522: and DEINSTALL scripts will be generated to handle registration of the info
7523: files in the Info directory file. The "install-info" command used for the info
7524: files registration is either provided by the system, or by a special purpose
7525: package automatically added as dependency if needed.
7526:
7527: PKGINFODIR is the directory under ${PREFIX} where info files are primarily
7528: located. PKGINFODIR defaults to "info" and can be overridden by the user.
7529:
7530: The info files for the package should be listed in the package PLIST; however
7531: any split info files need not be listed.
7532:
7533: A package which needs the "makeinfo" command at build time must add "makeinfo"
7534: to USE_TOOLS in its Makefile. If a minimum version of the "makeinfo" command is
7535: needed it should be noted with the TEXINFO_REQD variable in the package
7536: Makefile. By default, a minimum version of 3.12 is required. If the system does
7537: not provide a makeinfo command or if it does not match the required minimum, a
7538: build dependency on the devel/gtexinfo package will be added automatically.
7539:
7540: The build and installation process of the software provided by the package
7541: should not use the install-info command as the registration of info files is
1.25 wiz 7542: the task of the package INSTALL script, and it must use the appropriate
1.1 dsieger 7543: makeinfo command.
7544:
7545: To achieve this goal, the pkgsrc infrastructure creates overriding scripts for
7546: the install-info and makeinfo commands in a directory listed early in PATH.
7547:
7548: The script overriding install-info has no effect except the logging of a
7549: message. The script overriding makeinfo logs a message and according to the
7550: value of TEXINFO_REQD either runs the appropriate makeinfo command or exit on
7551: error.
7552:
1.154 rillig 7553: 21.6.8. Packages installing man pages
1.1 dsieger 7554:
7555: All packages that install manual pages should install them into the same
7556: directory, so that there is one common place to look for them. In pkgsrc, this
7557: place is ${PREFIX}/${PKGMANDIR}, and this expression should be used in
1.25 wiz 7558: packages. The default for PKGMANDIR is "man". Another often-used value is "
7559: share/man".
1.1 dsieger 7560:
7561: Note
7562:
7563: The support for a custom PKGMANDIR is far from complete.
7564:
7565: The PLIST files can just use man/ as the top level directory for the man page
7566: file entries, and the pkgsrc framework will convert as needed. In all other
7567: places, the correct PKGMANDIR must be used.
7568:
7569: Packages that are configured with GNU_CONFIGURE set as "yes", by default will
7570: use the ./configure --mandir switch to set where the man pages should be
7571: installed. The path is GNU_CONFIGURE_MANDIR which defaults to ${PREFIX}/$
7572: {PKGMANDIR}.
7573:
7574: Packages that use GNU_CONFIGURE but do not use --mandir, can set
7575: CONFIGURE_HAS_MANDIR to "no". Or if the ./configure script uses a non-standard
7576: use of --mandir, you can set GNU_CONFIGURE_MANDIR as needed.
7577:
1.184 rillig 7578: See Section 19.5, "Man page compression" for information on installation of
1.1 dsieger 7579: compressed manual pages.
7580:
1.203 nia 7581: 21.6.9. Packages installing X11 fonts
1.1 dsieger 7582:
7583: If a package installs font files, you will need to rebuild the fonts database
7584: in the directory where they get installed at installation and deinstallation
7585: time. This can be automatically done by using the pkginstall framework.
7586:
7587: You can list the directories where fonts are installed in the FONTS_DIRS.type
7588: variables, where type can be one of "ttf", "type1" or "x11". Also make sure
7589: that the database file fonts.dir is not listed in the PLIST.
7590:
7591: Note that you should not create new directories for fonts; instead use the
7592: standard ones to avoid that the user needs to manually configure his X server
7593: to find them.
7594:
1.203 nia 7595: 21.6.10. Packages installing SGML or XML data
1.1 dsieger 7596:
7597: If a package installs SGML or XML data files that need to be registered in
7598: system-wide catalogs (like DTDs, sub-catalogs, etc.), you need to take some
7599: extra steps:
7600:
7601: 1. Include ../../textproc/xmlcatmgr/catalogs.mk in your Makefile, which takes
7602: care of registering those files in system-wide catalogs at installation and
7603: deinstallation time.
7604:
7605: 2. Set SGML_CATALOGS to the full path of any SGML catalogs installed by the
7606: package.
7607:
7608: 3. Set XML_CATALOGS to the full path of any XML catalogs installed by the
7609: package.
7610:
7611: 4. Set SGML_ENTRIES to individual entries to be added to the SGML catalog.
7612: These come in groups of three strings; see xmlcatmgr(1) for more
7613: information (specifically, arguments recognized by the 'add' action). Note
7614: that you will normally not use this variable.
7615:
7616: 5. Set XML_ENTRIES to individual entries to be added to the XML catalog. These
7617: come in groups of three strings; see xmlcatmgr(1) for more information
7618: (specifically, arguments recognized by the 'add' action). Note that you
7619: will normally not use this variable.
7620:
1.203 nia 7621: 21.6.11. Packages installing extensions to the MIME database
1.1 dsieger 7622:
7623: If a package provides extensions to the MIME database by installing .xml files
7624: inside ${PREFIX}/share/mime/packages, you need to take some extra steps to
7625: ensure that the database is kept consistent with respect to these new files:
7626:
7627: 1. Include ../../databases/shared-mime-info/mimedb.mk (avoid using the
7628: buildlink3.mk file from this same directory, which is reserved for
7629: inclusion from other buildlink3.mk files). It takes care of rebuilding the
7630: MIME database at installation and deinstallation time, and disallows any
7631: access to it directly from the package.
7632:
1.25 wiz 7633: 2. Check the PLIST and remove any entries under the share/mime directory,
1.1 dsieger 7634: except for files saved under share/mime/packages. The former are handled
7635: automatically by the update-mime-database program, but the latter are
7636: package-dependent and must be removed by the package that installed them in
7637: the first place.
7638:
7639: 3. Remove any share/mime/* directories from the PLIST. They will be handled by
7640: the shared-mime-info package.
7641:
1.203 nia 7642: 21.6.12. Packages using intltool
1.1 dsieger 7643:
7644: If a package uses intltool during its build, add intltool to the USE_TOOLS,
7645: which forces it to use the intltool package provided by pkgsrc, instead of the
7646: one bundled with the distribution file.
7647:
7648: This tracks intltool's build-time dependencies and uses the latest available
7649: version; this way, the package benefits of any bug fixes that may have appeared
7650: since it was released.
7651:
1.203 nia 7652: 21.6.13. Packages installing startup scripts
1.1 dsieger 7653:
7654: If a package contains a rc.d script, it won't be copied into the startup
7655: directory by default, but you can enable it, by adding the option
1.4 rillig 7656: PKG_RCD_SCRIPTS=YES in mk.conf. This option will copy the scripts into /etc/
7657: rc.d when a package is installed, and it will automatically remove the scripts
7658: when the package is deinstalled.
1.1 dsieger 7659:
1.203 nia 7660: 21.6.14. Packages installing TeX modules
1.1 dsieger 7661:
7662: If a package installs TeX packages into the texmf tree, the ls-R database of
7663: the tree needs to be updated.
7664:
7665: Note
7666:
1.23 jakllsch 7667: Except the main TeX packages such as kpathsea, packages should install files
7668: into ${PREFIX}/share/texmf-dist, not ${PREFIX}/share/texmf.
1.1 dsieger 7669:
1.23 jakllsch 7670: 1. Include ../../print/kpathsea/texmf.mk. This takes care of rebuilding the
7671: ls-R database at installation and deinstallation time.
1.1 dsieger 7672:
1.23 jakllsch 7673: 2. If your package installs files into a texmf tree other than the one at $
7674: {PREFIX}/share/texmf-dist, set TEX_TEXMF_DIRS to the list of all texmf
7675: trees that need database update.
1.1 dsieger 7676:
7677: If your package also installs font map files that need to be registered
1.30 dholland 7678: using updmap, include ../../print/tex-tetex/map.mk and set TEX_MAP_FILES
7679: and/or TEX_MIXEDMAP_FILES to the list of all such font map files. Then
7680: updmap will be run automatically at installation/deinstallation to enable/
7681: disable font map files for TeX output drivers.
1.1 dsieger 7682:
7683: 3. Make sure that none of ls-R databases are included in PLIST, as they will
1.30 dholland 7684: be removed only by the kpathsea package.
1.1 dsieger 7685:
1.203 nia 7686: 21.6.15. Packages supporting running binaries in emulation
1.1 dsieger 7687:
7688: There are some packages that provide libraries and executables for running
7689: binaries from a one operating system on a different one (if the latter supports
7690: it). One example is running Linux binaries on NetBSD.
7691:
7692: The pkgtools/rpm2pkg helps in extracting and packaging Linux rpm packages.
7693:
7694: The CHECK_SHLIBS can be set to no to avoid the check-shlibs target, which tests
7695: if all libraries for each installed executable can be found by the dynamic
7696: linker. Since the standard dynamic linker is run, this fails for emulation
7697: packages, because the libraries used by the emulation are not in the standard
7698: directories.
7699:
1.203 nia 7700: 21.6.16. Packages installing hicolor icons
1.1 dsieger 7701:
7702: If a package installs images under the share/icons/hicolor and/or updates the
7703: share/icons/hicolor/icon-theme.cache database, you need to take some extra
7704: steps to make sure that the shared theme directory is handled appropriately and
7705: that the cache database is rebuilt:
7706:
7707: 1. Include ../../graphics/hicolor-icon-theme/buildlink3.mk.
7708:
7709: 2. Check the PLIST and remove the entry that refers to the theme cache.
7710:
7711: 3. Ensure that the PLIST does not remove the shared icon directories from the
7712: share/icons/hicolor hierarchy because they will be handled automatically.
7713:
7714: The best way to verify that the PLIST is correct with respect to the last two
7715: points is to regenerate it using make print-PLIST.
7716:
1.203 nia 7717: 21.6.17. Packages installing desktop files
1.1 dsieger 7718:
7719: If a package installs .desktop files under share/applications and these include
1.54 rodent 7720: MIME information (MimeType key), you need to take extra steps to ensure that
7721: they are registered into the MIME database:
1.1 dsieger 7722:
7723: 1. Include ../../sysutils/desktop-file-utils/desktopdb.mk.
7724:
7725: 2. Check the PLIST and remove the entry that refers to the share/applications/
7726: mimeinfo.cache file. It will be handled automatically.
7727:
7728: The best way to verify that the PLIST is correct with respect to the last point
7729: is to regenerate it using make print-PLIST.
7730:
1.154 rillig 7731: 21.7. Marking packages as having problems
1.1 dsieger 7732:
1.23 jakllsch 7733: In some cases one does not have the time to solve a problem immediately. In
7734: this case, one can plainly mark a package as broken. For this, one just sets
7735: the variable BROKEN to the reason why the package is broken (similar to the
1.162 rillig 7736: PKG_FAIL_REASON variable). A user trying to build the package will immediately
7737: be shown this message, and the build will not be even tried.
1.1 dsieger 7738:
1.23 jakllsch 7739: BROKEN packages are removed from pkgsrc in irregular intervals.
1.1 dsieger 7740:
1.184 rillig 7741: Chapter 22. GNOME packaging and porting
7742:
7743: Table of Contents
7744:
7745: 22.1. Meta packages
7746: 22.2. Packaging a GNOME application
7747: 22.3. Updating GNOME to a newer version
7748: 22.4. Patching guidelines
7749:
7750: Quoting GNOME's web site:
7751:
7752: The GNOME project provides two things: The GNOME desktop environment, an
7753: intuitive and attractive desktop for users, and the GNOME development
7754: platform, an extensive framework for building applications that integrate
7755: into the rest of the desktop.
7756:
7757: pkgsrc provides a seamless way to automatically build and install a complete
7758: GNOME environment under many different platforms. We can say with confidence
7759: that pkgsrc is one of the most advanced build and packaging systems for GNOME
7760: due to its included technologies buildlink3, the wrappers and tools framework
7761: and automatic configuration file management. Lots of efforts are put into
7762: achieving a completely clean deinstallation of installed software components.
7763:
7764: Given that pkgsrc is NetBSD's official packaging system, the above also means
7765: that great efforts are put into making GNOME work under this operating system.
7766:
7767: This chapter is aimed at pkgsrc developers and other people interested in
7768: helping our GNOME porting and packaging efforts. It provides instructions on
7769: how to manage the existing packages and some important information regarding
7770: their internals.
7771:
7772: We need your help!
7773:
7774: Should you have some spare cycles to devote to NetBSD, pkgsrc and GNOME and are
7775: willing to learn new exciting stuff, please jump straight to the pending work
7776: list! There is still a long way to go to get a fully-functional GNOME desktop
7777: under NetBSD and we need your help to achieve it!
7778:
7779: 22.1. Meta packages
7780:
7781: pkgsrc includes three GNOME-related meta packages:
7782:
7783: * meta-pkgs/gnome-base: Provides the core GNOME desktop environment. It only
7784: includes the necessary bits to get it to boot correctly, although it may
7785: lack important functionality for daily operation. The idea behind this
7786: package is to let end users build their own configurations on top of this
7787: one, first installing this meta package to achieve a functional setup and
7788: then adding individual applications.
7789:
7790: * meta-pkgs/gnome: Provides a complete installation of the GNOME platform and
7791: desktop as defined by the GNOME project; this is based on the components
7792: distributed in the platform/x.y/x.y.z/sources and desktop/x.y/x.y.z/sources
7793: directories of the official FTP server. Developer-only tools found in those
7794: directories are not installed unless required by some other component to
7795: work properly. Similarly, packages from the bindings set (bindings/x.y/
7796: x.y.z/sources) are not pulled in unless required as a dependency for an
7797: end-user component. This package "extends" meta-pkgs/gnome-base.
7798:
7799: * meta-pkgs/gnome-devel: Installs all the tools required to build a GNOME
7800: component when fetched from the CVS repository. These are required to let
7801: the autogen.sh scripts work appropriately.
7802:
7803: In all these packages, the DEPENDS lines are sorted in a way that eases
7804: updates: a package may depend on other packages listed before it but not on any
7805: listed after it. It is very important to keep this order to ease updates so...
7806: do not change it to alphabetical sorting!
7807:
7808: 22.2. Packaging a GNOME application
7809:
7810: Almost all GNOME applications are written in C and use a common set of tools as
7811: their build system. Things get different with the new bindings to other
7812: languages (such as Python), but the following will give you a general idea on
7813: the minimum required tools:
7814:
7815: * Almost all GNOME applications use the GNU Autotools as their build system.
7816: As a general rule you will need to tell this to your package:
7817:
7818: GNU_CONFIGURE=yes
7819: USE_LIBTOOL=yes
7820: USE_TOOLS+=gmake
7821:
7822: * If the package uses pkg-config to detect dependencies, add this tool to the
7823: list of required utilities:
7824:
7825: USE_TOOLS+=pkg-config
7826:
7827: Also use pkgtools/verifypc at the end of the build process to ensure that
7828: you did not miss to specify any dependency in your package and that the
7829: version requirements are all correct.
7830:
7831: * If the package uses intltool, be sure to add intltool to the USE_TOOLS to
7832: handle dependencies and to force the package to use the latest available
7833: version.
7834:
7835: * If the package uses gtk-doc (a documentation generation utility), do not
7836: add a dependency on it. The tool is rather big and the distfile should come
7837: with pregenerated documentation anyway; if it does not, it is a bug that
7838: you ought to report. For such packages you should disable gtk-doc (unless
7839: it is the default):
7840:
7841: CONFIGURE_ARGS+=--disable-gtk-doc
7842:
7843: The default location of installed HTML files (share/gtk-doc/<package-name>)
7844: is correct and should not be changed unless the package insists on
7845: installing them somewhere else. Otherwise programs as devhelp will not be
7846: able to open them. You can do that with an entry similar to:
1.1 dsieger 7847:
1.184 rillig 7848: CONFIGURE_ARGS+=--with-html-dir=${PREFIX}/share/gtk-doc/...
1.1 dsieger 7849:
1.184 rillig 7850: GNOME uses multiple shared directories and files under the installation prefix
7851: to maintain databases. In this context, shared means that those exact same
7852: directories and files are used among several different packages, leading to
7853: conflicts in the PLIST. pkgsrc currently includes functionality to handle the
7854: most common cases, so you have to forget about using @unexec ${RMDIR} lines in
7855: your file lists and omitting shared files from them. If you find yourself doing
7856: those, your package is most likely incorrect.
1.1 dsieger 7857:
1.184 rillig 7858: The following table lists the common situations that result in using shared
7859: directories or files. For each of them, the appropriate solution is given.
7860: After applying the solution be sure to regenerate the package's file list with
7861: make print-PLIST and ensure it is correct.
1.1 dsieger 7862:
1.184 rillig 7863: Table 22.1. PLIST handling for GNOME packages
1.1 dsieger 7864:
1.184 rillig 7865: +-----------------------------------------------------------------------------+
7866: | If the package... | Then... |
7867: |-------------------------------------------+---------------------------------|
1.203 nia 7868: |Installs icons under the share/icons/ |See Section 21.6.16, "Packages |
7869: |hicolor hierarchy or updates share/icons/ |installing hicolor icons". |
1.184 rillig 7870: |hicolor/icon-theme.cache. | |
7871: |-------------------------------------------+---------------------------------|
1.203 nia 7872: | |See Section 21.6.11, "Packages |
1.184 rillig 7873: |Installs files under share/mime/packages. |installing extensions to the MIME|
7874: | |database". |
7875: |-------------------------------------------+---------------------------------|
1.203 nia 7876: |Installs .desktop files under share/ |See Section 21.6.17, "Packages |
1.184 rillig 7877: |applications and these include MIME |installing desktop files". |
7878: |information. | |
7879: +-----------------------------------------------------------------------------+
1.1 dsieger 7880:
7881:
1.184 rillig 7882: 22.3. Updating GNOME to a newer version
1.1 dsieger 7883:
1.184 rillig 7884: When seeing GNOME as a whole, there are two kinds of updates:
1.1 dsieger 7885:
1.184 rillig 7886: Major update
1.1 dsieger 7887:
1.184 rillig 7888: Given that there is still a very long way for GNOME 3 (if it ever appears),
7889: we consider a major update one that goes from a 2.X version to a 2.Y one,
7890: where Y is even and greater than X. These are hard to achieve because they
7891: introduce lots of changes in the components' code and almost all GNOME
7892: distfiles are updated to newer versions. Some of them can even break API
7893: and ABI compatibility with the previous major version series. As a result,
7894: the update needs to be done all at once to minimize breakage.
1.1 dsieger 7895:
1.184 rillig 7896: A major update typically consists of around 80 package updates and the
7897: addition of some new ones.
1.1 dsieger 7898:
1.184 rillig 7899: Minor update
1.1 dsieger 7900:
1.184 rillig 7901: We consider a minor update one that goes from a 2.A.X version to a 2.A.Y
7902: one where Y is greater than X. These are easy to achieve because they do
7903: not update all GNOME components, can be done in an incremental way and do
7904: not break API nor ABI compatibility.
1.1 dsieger 7905:
1.184 rillig 7906: A minor update typically consists of around 50 package updates, although
7907: the numbers here may vary a lot.
1.1 dsieger 7908:
1.184 rillig 7909: In order to update the GNOME components in pkgsrc to a new stable release
7910: (either major or minor), the following steps should be followed:
1.1 dsieger 7911:
1.184 rillig 7912: 1. Get a list of all the tarballs that form the new release by using the
7913: following commands. These will leave the full list of the components'
7914: distfiles into the list.txt file:
1.1 dsieger 7915:
1.184 rillig 7916: % echo ls "*.tar.bz2" | \
7917: ftp -V ftp://ftp.gnome.org/pub/gnome/platform/x.y/x.y.z/sources/ | \
7918: awk '{ print $9 }' >list.txt
7919: % echo ls "*.tar.bz2" | \
7920: ftp -V ftp://ftp.gnome.org/pub/gnome/desktop/x.y/x.y.z/sources/ | \
7921: awk '{ print $9 }' >>list.txt
1.1 dsieger 7922:
1.184 rillig 7923: 2. Open each meta package's Makefile and bump their version to the release you
7924: are updating them to. The three meta packages should be always consistent
7925: with versioning. Obviously remove any PKGREVISIONs that might be in them.
1.1 dsieger 7926:
1.184 rillig 7927: 3. For each meta package, update all its DEPENDS lines to match the latest
7928: versions as shown by the above commands. Do not list any newer version
7929: (even if found in the FTP) because the meta packages are supposed to list
7930: the exact versions that form a specific GNOME release. Exceptions are
7931: permitted here if a newer version solves a serious issue in the overall
7932: desktop experience; these typically come in the form of a revision bump in
7933: pkgsrc, not in newer versions from the developers.
1.1 dsieger 7934:
1.184 rillig 7935: Packages not listed in the list.txt file should be updated to the latest
7936: version available (if found in pkgsrc). This is the case, for example, of
7937: the dependencies on the GNU Autotools in the meta-pkgs/gnome-devel meta
7938: package.
1.1 dsieger 7939:
1.184 rillig 7940: 4. Generate a patch from the modified meta packages and extract the list of
7941: "new" lines. This will provide you an outline on what packages need to be
7942: updated in pkgsrc and in what order:
1.1 dsieger 7943:
1.184 rillig 7944: % cvs diff -u gnome-devel gnome-base gnome | grep '^+D' >todo.txt
1.1 dsieger 7945:
1.184 rillig 7946: 5. For major desktop updates it is recommended to zap all your installed
7947: packages and start over from scratch at this point.
1.1 dsieger 7948:
1.184 rillig 7949: 6. Now comes the longest step by far: iterate over the contents of todo.txt
7950: and update the packages listed in it in order. For major desktop updates
7951: none of these should be committed until the entire set is completed because
7952: there are chances of breaking not-yet-updated packages.
1.1 dsieger 7953:
1.184 rillig 7954: 7. Once the packages are up to date and working, commit them to the tree one
7955: by one with appropriate log messages. At the end, commit the three meta
7956: package updates and all the corresponding changes to the doc/CHANGES-<YEAR>
7957: and pkgsrc/doc/TODO files.
1.1 dsieger 7958:
1.184 rillig 7959: 22.4. Patching guidelines
1.1 dsieger 7960:
1.184 rillig 7961: GNOME is a very big component in pkgsrc which approaches 100 packages. Please,
7962: it is very important that you always, always, always feed back any portability
7963: fixes you do to a GNOME package to the mainstream developers (see
7964: Section 12.3.5, "Feedback to the author"). This is the only way to get their
7965: attention on portability issues and to ensure that future versions can be built
7966: out-of-the box on NetBSD. The less custom patches in pkgsrc, the easier further
7967: updates are. Those developers in charge of issuing major GNOME updates will be
7968: grateful if you do that.
1.1 dsieger 7969:
1.200 cirnatda 7970: The most common places to report bugs are the GNOME's GitLab and the
7971: freedesktop.org's GitLab. Not all components use these to track bugs, but most
7972: of them do. Do not be short on your reports: always provide detailed
1.184 rillig 7973: explanations of the current failure, how it can be improved to achieve maximum
1.200 cirnatda 7974: portability and, if at all possible, provide a patch against the main Git
7975: branch. The more verbose you are, the higher chances of your patch being
7976: accepted.
1.1 dsieger 7977:
1.184 rillig 7978: Also, please avoid using preprocessor magic to fix portability issues. While
7979: the FreeBSD GNOME people are doing a great job in porting GNOME to their
7980: operating system, the official GNOME sources are now plagued by conditionals
7981: that check for __FreeBSD__ and similar macros. This hurts portability. Please
7982: see our patching guidelines (Section 12.3.4, "Patching guidelines") for more
7983: details.
1.1 dsieger 7984:
1.154 rillig 7985: Chapter 23. Submitting and Committing
1.1 dsieger 7986:
7987: Table of Contents
7988:
1.154 rillig 7989: 23.1. Submitting binary packages
7990: 23.2. Submitting source packages (for non-NetBSD-developers)
7991: 23.3. General notes when adding, updating, or removing packages
7992: 23.4. Commit Messages
7993: 23.5. Committing: Adding a package to CVS
7994: 23.6. Updating a package to a newer version
7995: 23.7. Renaming a package in pkgsrc
7996: 23.8. Moving a package in pkgsrc
1.1 dsieger 7997:
1.154 rillig 7998: 23.1. Submitting binary packages
1.1 dsieger 7999:
8000: Our policy is that we accept binaries only from pkgsrc developers to guarantee
8001: that the packages don't contain any trojan horses etc. This is not to annoy
8002: anyone but rather to protect our users! You're still free to put up your
8003: home-made binary packages and tell the world where to get them. NetBSD
1.154 rillig 8004: developers doing bulk builds and wanting to upload them please see Chapter 8,
1.66 asau 8005: Creating binary packages for everything in pkgsrc (bulk builds).
1.1 dsieger 8006:
1.154 rillig 8007: 23.2. Submitting source packages (for non-NetBSD-developers)
1.1 dsieger 8008:
8009: First, check that your package is complete, compiles and runs well; see
1.184 rillig 8010: Chapter 14, Creating a new pkgsrc package from scratch and the rest of this
8011: document. Next, generate an uuencoded gzipped tar(1) archive that contains all
8012: files that make up the package. Finally, send this package to the pkgsrc bug
8013: tracking system, either with the send-pr(1) command, or if you don't have that,
8014: go to the web page https://www.NetBSD.org/support/send-pr.html, which contains
8015: some instructions and a link to a form where you can submit packages. The
8016: sysutils/gtk-send-pr package is also available as a substitute for either of
8017: the above two tools.
1.1 dsieger 8018:
8019: In the form of the problem report, the category should be "pkg", the synopsis
8020: should include the package name and version number, and the description field
8021: should contain a short description of your package (contents of the COMMENT
1.25 wiz 8022: variable or DESCR file are OK). The uuencoded package data should go into the "
8023: fix" field.
1.1 dsieger 8024:
8025: If you want to submit several packages, please send a separate PR for each one,
8026: it's easier for us to track things that way.
8027:
8028: Alternatively, you can also import new packages into pkgsrc-wip ("pkgsrc
1.174 leot 8029: work-in-progress"); see the homepage at https://pkgsrc.org/wip/ for details.
1.1 dsieger 8030:
1.154 rillig 8031: 23.3. General notes when adding, updating, or removing packages
1.1 dsieger 8032:
8033: Please note all package additions, updates, moves, and removals in pkgsrc/doc/
8034: CHANGES-YYYY. It's very important to keep this file up to date and conforming
8035: to the existing format, because it will be used by scripts to automatically
8036: update pages on www.NetBSD.org and other sites. Additionally, check the pkgsrc/
8037: doc/TODO file and remove the entry for the package you updated or removed, in
8038: case it was mentioned there.
8039:
8040: When the PKGREVISION of a package is bumped, the change should appear in pkgsrc
8041: /doc/CHANGES-YYYY if it is security related or otherwise relevant. Mass bumps
8042: that result from a dependency being updated should not be mentioned. In all
8043: other cases it's the developer's decision.
8044:
8045: There is a make target that helps in creating proper CHANGES-YYYY entries: make
8046: changes-entry. It uses the optional CTYPE and NETBSD_LOGIN_NAME variables. The
8047: general usage is to first make sure that your CHANGES-YYYY file is up-to-date
8048: (to avoid having to resolve conflicts later-on) and then to cd to the package
8049: directory. For package updates, make changes-entry is enough. For new packages,
8050: or package moves or removals, set the CTYPE variable on the command line to
1.4 rillig 8051: "Added", "Moved", or "Removed". You can set NETBSD_LOGIN_NAME in mk.conf if
1.23 jakllsch 8052: your local login name is not the same as your NetBSD login name. The target
8053: also automatically removes possibly existing entries for the package in the
8054: TODO file. Don't forget to commit the changes, e.g. by using make
1.66 asau 8055: commit-changes-entry! If you are not using a checkout directly from
1.23 jakllsch 8056: cvs.NetBSD.org, but e.g. a local copy of the repository, you can set
8057: USE_NETBSD_REPO=yes. This makes the cvs commands use the main repository.
1.1 dsieger 8058:
1.154 rillig 8059: 23.4. Commit Messages
1.130 wiz 8060:
8061: For several years, there have been mirrors of pkgsrc in fossil, git, and hg.
8062: Standard practise when using these tools is to make the first line of a commit
8063: message function as a summary that can be read without the rest, such as is
8064: commonly done with "git log --oneline". For this reason, we have the following
8065: guidelines for pkgsrc commit messages:
8066:
1.131 wiz 8067: * Start the commit message with a line that explains the big picture in 65
1.130 wiz 8068: characters or less. When a commit is for one package, include the name of
8069: the package. For updates, include the version to which it is updated.
8070:
8071: * Leave the next line empty.
8072:
8073: * Then come the details for the commit (changes in that package, reason for a
8074: change) and any relevant PRs. Wrap this section.
8075:
8076: Here is an example:
8077:
8078: libxslt: update to 1.0.30
8079:
8080: Changes since 1.0.29:
8081: ...
8082:
8083:
8084: Here is another example:
8085:
8086: mk/bsd.pkg.mk: enable SSP by default on NetBSD
8087:
8088: (rationale)
8089:
8090:
8091: Commit messages are final: no "cvs admin" is allowed on the pkgsrc repository
8092: to change commit messages.
8093:
1.154 rillig 8094: 23.5. Committing: Adding a package to CVS
1.1 dsieger 8095:
8096: This section is only of interest for pkgsrc developers with write access to the
1.34 wiz 8097: pkgsrc repository.
8098:
8099: When the package is finished, "cvs add" the files. Start by adding the
8100: directory and then files in the directory. Don't forget to add the new package
8101: to the category's Makefile. Make sure you don't forget any files; you can check
8102: by running "cvs status". An example:
8103:
8104: $ cd .../pkgsrc/category
8105: $ cvs add pkgname
8106: $ cd pkgname
8107: $ cvs add DESCR Makefile PLIST distinfo buildlink3.mk patches
8108: $ cvs add patches/p*
8109: $ cvs status | less
1.35 wiz 8110: $ cvs commit
1.34 wiz 8111: $ cd ..
8112: $ vi Makefile # add SUBDIRS+=pkgname line
1.35 wiz 8113: $ cvs commit Makefile
1.66 asau 8114: $ cd pkgname
1.73 jnemeth 8115: $ make CTYPE=Added commit-changes-entry
1.1 dsieger 8116:
8117: The commit message of the initial import should include part of the DESCR file,
8118: so people reading the mailing lists know what the package is/does.
8119:
1.34 wiz 8120: Also mention the new package in pkgsrc/doc/CHANGES-20xx.
8121:
8122: Previously, "cvs import" was suggested, but it was much easier to get wrong
8123: than "cvs add".
1.1 dsieger 8124:
1.154 rillig 8125: 23.6. Updating a package to a newer version
1.1 dsieger 8126:
8127: Please always put a concise, appropriate and relevant summary of the changes
8128: between old and new versions into the commit log when updating a package. There
8129: are various reasons for this:
8130:
8131: * A URL is volatile, and can change over time. It may go away completely or
8132: its information may be overwritten by newer information.
8133:
8134: * Having the change information between old and new versions in our CVS
8135: repository is very useful for people who use either cvs or anoncvs.
8136:
8137: * Having the change information between old and new versions in our CVS
8138: repository is very useful for people who read the pkgsrc-changes mailing
8139: list, so that they can make tactical decisions about when to upgrade the
8140: package.
8141:
8142: Please also recognize that, just because a new version of a package has been
8143: released, it should not automatically be upgraded in the CVS repository. We
8144: prefer to be conservative in the packages that are included in pkgsrc -
8145: development or beta packages are not really the best thing for most places in
8146: which pkgsrc is used. Please use your judgement about what should go into
8147: pkgsrc, and bear in mind that stability is to be preferred above new and
8148: possibly untested features.
8149:
1.154 rillig 8150: 23.7. Renaming a package in pkgsrc
1.21 snj 8151:
8152: Renaming packages is not recommended.
8153:
1.175 gutterid 8154: When renaming packages, be sure to fix any references to the old name in other
1.21 snj 8155: Makefiles, options, buildlink files, etc.
8156:
1.175 gutterid 8157: Also, when renaming a package, please add the package name and version pattern
1.167 leot 8158: (s) of the previous package to SUPERSEDES. This may be repeated for multiple
8159: renames. The new package would be an exact replacement. Example:
8160:
8161: SUPERSEDES+= p5-IO-Compress-Zlib<2.017
8162: SUPERSEDES+= optcomp-[0-9]*
1.21 snj 8163:
8164: Note that "successor" in the CHANGES-YYYY file doesn't necessarily mean that it
8165: supersedes, as that successor may not be an exact replacement but is a
8166: suggestion for the replaced functionality.
8167:
1.154 rillig 8168: 23.8. Moving a package in pkgsrc
1.21 snj 8169:
8170: It is preferred that packages are not renamed or moved, but if needed please
8171: follow these steps.
1.1 dsieger 8172:
8173: 1. Make a copy of the directory somewhere else.
8174:
8175: 2. Remove all CVS dirs.
8176:
8177: Alternatively to the first two steps you can also do:
8178:
8179: % cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package
8180:
8181: and use that for further work.
8182:
1.25 wiz 8183: 3. Fix CATEGORIES and any DEPENDS paths that just did "../package" instead of
1.1 dsieger 8184: "../../category/package".
8185:
1.21 snj 8186: 4. In the modified package's Makefile, consider setting PREV_PKGPATH to the
8187: previous category/package pathname. The PREV_PKGPATH can be used by tools
8188: for doing an update using pkgsrc building; for example, it can search the
8189: pkg_summary(5) database for PREV_PKGPATH (if no SUPERSEDES) and then use
8190: the corresponding new PKGPATH for that moved package. Note that it may have
8191: multiple matches, so the tool should also check on the PKGBASE too. The
8192: PREV_PKGPATH probably has no value unless SUPERSEDES is not set, i.e.
8193: PKGBASE stays the same.
8194:
8195: 5. cvs import the modified package in the new place.
1.1 dsieger 8196:
1.21 snj 8197: 6. Check if any package depends on it:
1.1 dsieger 8198:
8199: % cd /usr/pkgsrc
8200: % grep /package */*/Makefile* */*/buildlink*
8201:
1.21 snj 8202: 7. Fix paths in packages from step 5 to point to new location.
1.1 dsieger 8203:
1.21 snj 8204: 8. cvs rm (-f) the package at the old location.
1.1 dsieger 8205:
1.21 snj 8206: 9. Remove from oldcategory/Makefile.
1.1 dsieger 8207:
1.21 snj 8208: 10. Add to newcategory/Makefile.
1.1 dsieger 8209:
1.21 snj 8210: 11. Commit the changed and removed files:
1.1 dsieger 8211:
8212: % cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile
8213:
8214: (and any packages from step 5, of course).
8215:
1.154 rillig 8216: Chapter 24. Frequently Asked Questions
1.1 dsieger 8217:
8218: This section contains the answers to questions that may arise when you are
8219: writing a package. If you don't find your question answered here, first have a
8220: look in the other chapters, and if you still don't have the answer, ask on the
8221: pkgsrc-users mailing list.
8222:
1.154 rillig 8223: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
8224: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
8225: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
8226: 24.4. What is the difference between BUILDLINK_LDFLAGS, BUILDLINK_LDADD and
1.1 dsieger 8227: BUILDLINK_LIBS?
1.154 rillig 8228: 24.5. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
8229: 24.6. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.1 dsieger 8230: the := inside it.
1.154 rillig 8231: 24.7. Which mailing lists are there for package developers?
8232: 24.8. Where is the pkgsrc documentation?
8233: 24.9. I have a little time to kill. What shall I do?
1.1 dsieger 8234:
1.154 rillig 8235: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
1.1 dsieger 8236:
8237: MAKEFLAGS are the flags passed to the pkgsrc-internal invocations of make
8238: (1), while MAKE_FLAGS are the flags that are passed to the MAKE_PROGRAM
8239: when building the package. [FIXME: What is .MAKEFLAGS for?]
8240:
1.154 rillig 8241: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
1.1 dsieger 8242:
8243: MAKE is the path to the make(1) program that is used in the pkgsrc
8244: infrastructure. GMAKE is the path to GNU Make, but you need to say
8245: USE_TOOLS+=gmake to use that. MAKE_PROGRAM is the path to the Make
8246: program that is used for building the package.
8247:
1.154 rillig 8248: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
1.1 dsieger 8249:
8250: CC is the path to the real C compiler, which can be configured by the
8251: pkgsrc user. PKG_CC is the path to the compiler wrapper. PKGSRC_COMPILER
8252: is not a path to a compiler, but the type of compiler that should be
8253: used. See mk/compiler.mk for more information about the latter variable.
8254:
1.154 rillig 8255: 24.4. What is the difference between BUILDLINK_LDFLAGS, BUILDLINK_LDADD and
1.1 dsieger 8256: BUILDLINK_LIBS?
8257:
8258: [FIXME]
8259:
1.154 rillig 8260: 24.5. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
1.1 dsieger 8261:
1.25 wiz 8262: For optimization reasons, some variables are only available in the "
8263: wrapper" phase and later. To "simulate" the wrapper phase, append
1.1 dsieger 8264: PKG_PHASE=wrapper to the above command.
8265:
1.154 rillig 8266: 24.6. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.1 dsieger 8267: the := inside it.
8268:
1.108 rillig 8269: The := is not really an assignment operator, although it looks like it.
8270: Instead, it is a degenerate form of ${LIST:old_string=new_string}, which
8271: is documented in the make(1) man page and which is commonly used in the
8272: form ${SRCS:.c=.o}. In the case of MASTER_SITE_*, old_string is the empty
8273: string and new_string is package/. That's where the : and the = fall
8274: together.
1.1 dsieger 8275:
1.154 rillig 8276: 24.7. Which mailing lists are there for package developers?
1.1 dsieger 8277:
8278: tech-pkg
8279:
8280: This is a list for technical discussions related to pkgsrc
8281: development, e.g. soliciting feedback for changes to pkgsrc
8282: infrastructure, proposed new features, questions related to porting
8283: pkgsrc to a new platform, advice for maintaining a package, patches
8284: that affect many packages, help requests moved from pkgsrc-users when
8285: an infrastructure bug is found, etc.
8286:
8287: pkgsrc-bugs
8288:
8289: All bug reports in category "pkg" sent with send-pr(1) appear here.
8290: Please do not report your bugs here directly; use one of the other
8291: mailing lists.
8292:
1.154 rillig 8293: 24.8. Where is the pkgsrc documentation?
1.1 dsieger 8294:
8295: There are many places where you can find documentation about pkgsrc:
8296:
8297: * The pkgsrc guide (this document) is a collection of chapters that
8298: explain large parts of pkgsrc, but some chapters tend to be outdated.
8299: Which ones they are is hard to say.
8300:
1.174 leot 8301: * On the mailing list archives (see https://mail-index.NetBSD.org/),
8302: you can find discussions about certain features, announcements of new
1.1 dsieger 8303: parts of the pkgsrc infrastructure and sometimes even announcements
8304: that a certain feature has been marked as obsolete. The benefit here
8305: is that each message has a date appended to it.
8306:
8307: * Many of the files in the mk/ directory start with a comment that
8308: describes the purpose of the file and how it can be used by the
8309: pkgsrc user and package authors. An easy way to find this
8310: documentation is to run bmake help.
8311:
8312: * The CVS log messages are a rich source of information, but they tend
8313: to be highly abbreviated, especially for actions that occur often.
8314: Some contain a detailed description of what has changed, but they are
8315: geared towards the other pkgsrc developers, not towards an average
8316: pkgsrc user. They also only document changes, so if you don't know
8317: what has been before, these messages may not be worth too much to
8318: you.
8319:
8320: * Some parts of pkgsrc are only "implicitly documented", that is the
8321: documentation exists only in the mind of the developer who wrote the
8322: code. To get this information, use the cvs annotate command to see
8323: who has written it and ask on the tech-pkg mailing list, so that
8324: others can find your questions later (see above). To be sure that the
8325: developer in charge reads the mail, you may CC him or her.
8326:
1.154 rillig 8327: 24.9. I have a little time to kill. What shall I do?
1.1 dsieger 8328:
8329: This is not really an FAQ yet, but here's the answer anyway.
8330:
8331: * Run pkg_chk -N (from the pkgtools/pkg_chk package). It will tell you
8332: about newer versions of installed packages that are available, but
8333: not yet updated in pkgsrc.
8334:
1.198 leot 8335: * Browse pkgsrc/doc/TODO -- it contains a list of suggested new
8336: packages and a list of cleanups and enhancements for pkgsrc that
8337: would be nice to have.
1.1 dsieger 8338:
1.71 wiz 8339: * Review packages for which review was requested on the tech-pkg
8340: mailing list.
1.1 dsieger 8341:
8342: Part III. The pkgsrc infrastructure internals
8343:
8344: This part of the guide deals with everything from the infrastructure that is
8345: behind the interfaces described in the developer's guide. A casual package
8346: maintainer should not need anything from this part.
8347:
8348: Table of Contents
8349:
1.184 rillig 8350: 25. Design of the pkgsrc infrastructure
1.1 dsieger 8351:
1.184 rillig 8352: 25.1. The meaning of variable definitions
8353: 25.2. Avoiding problems before they arise
8354: 25.3. Variable evaluation
1.1 dsieger 8355:
1.184 rillig 8356: 25.3.1. At load time
8357: 25.3.2. At runtime
1.1 dsieger 8358:
1.184 rillig 8359: 25.4. How can variables be specified?
8360: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8361:
1.184 rillig 8362: 25.5.1. Procedures with parameters
8363: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8364:
1.184 rillig 8365: 25.6. The order in which files are loaded
1.1 dsieger 8366:
1.184 rillig 8367: 25.6.1. The order in bsd.prefs.mk
8368: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8369:
1.184 rillig 8370: 26. Regression tests
1.1 dsieger 8371:
1.184 rillig 8372: 26.1. Running the regression tests
8373: 26.2. Adding a new regression test
1.1 dsieger 8374:
1.184 rillig 8375: 26.2.1. Overridable functions
8376: 26.2.2. Helper functions
1.1 dsieger 8377:
1.184 rillig 8378: 27. Porting pkgsrc
1.1 dsieger 8379:
1.184 rillig 8380: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8381:
1.184 rillig 8382: Chapter 25. Design of the pkgsrc infrastructure
1.1 dsieger 8383:
8384: Table of Contents
8385:
1.184 rillig 8386: 25.1. The meaning of variable definitions
8387: 25.2. Avoiding problems before they arise
8388: 25.3. Variable evaluation
1.1 dsieger 8389:
1.184 rillig 8390: 25.3.1. At load time
8391: 25.3.2. At runtime
1.1 dsieger 8392:
1.184 rillig 8393: 25.4. How can variables be specified?
8394: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8395:
1.184 rillig 8396: 25.5.1. Procedures with parameters
8397: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8398:
1.184 rillig 8399: 25.6. The order in which files are loaded
1.1 dsieger 8400:
1.184 rillig 8401: 25.6.1. The order in bsd.prefs.mk
8402: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8403:
8404: The pkgsrc infrastructure consists of many small Makefile fragments. Each such
8405: fragment needs a properly specified interface. This chapter explains how such
8406: an interface looks like.
8407:
1.184 rillig 8408: 25.1. The meaning of variable definitions
1.1 dsieger 8409:
8410: Whenever a variable is defined in the pkgsrc infrastructure, the location and
8411: the way of definition provide much information about the intended use of that
8412: variable. Additionally, more documentation may be found in a header comment or
8413: in this pkgsrc guide.
8414:
8415: A special file is mk/defaults/mk.conf, which lists all variables that are
8416: intended to be user-defined. They are either defined using the ?= operator or
8417: they are left undefined because defining them to anything would effectively
8418: mean "yes". All these variables may be overridden by the pkgsrc user in the
8419: MAKECONF file.
8420:
8421: Outside this file, the following conventions apply: Variables that are defined
8422: using the ?= operator may be overridden by a package.
8423:
8424: Variables that are defined using the = operator may be used read-only at
8425: run-time.
8426:
8427: Variables whose name starts with an underscore must not be accessed outside the
8428: pkgsrc infrastructure at all. They may change without further notice.
8429:
8430: Note
8431:
8432: These conventions are currently not applied consistently to the complete pkgsrc
8433: infrastructure.
8434:
1.184 rillig 8435: 25.2. Avoiding problems before they arise
1.1 dsieger 8436:
8437: All variables that contain lists of things should default to being empty. Two
8438: examples that do not follow this rule are USE_LANGUAGES and DISTFILES. These
8439: variables cannot simply be modified using the += operator in package Makefiles
8440: (or other files included by them), since there is no guarantee whether the
8441: variable is already set or not, and what its value is. In the case of
8442: DISTFILES, the packages "know" the default value and just define it as in the
8443: following example.
8444:
8445: DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
8446:
8447: Because of the selection of this default value, the same value appears in many
8448: package Makefiles. Similarly for USE_LANGUAGES, but in this case the default
8449: value ("c") is so short that it doesn't stand out. Nevertheless it is mentioned
8450: in many files.
8451:
1.184 rillig 8452: 25.3. Variable evaluation
1.1 dsieger 8453:
1.184 rillig 8454: 25.3.1. At load time
1.1 dsieger 8455:
8456: Variable evaluation takes place either at load time or at runtime, depending on
8457: the context in which they occur. The contexts where variables are evaluated at
8458: load time are:
8459:
8460: * The right hand side of the := and != operators,
8461:
8462: * Make directives like .if or .for,
8463:
8464: * Dependency lines.
8465:
8466: A special exception are references to the iteration variables of .for loops,
8467: which are expanded inline, no matter in which context they appear.
8468:
8469: As the values of variables may change during load time, care must be taken not
8470: to evaluate them by accident. Typical examples for variables that should not be
8471: evaluated at load time are DEPENDS and CONFIGURE_ARGS. To make the effect more
8472: clear, here is an example:
8473:
8474: CONFIGURE_ARGS= # none
8475: CFLAGS= -O
8476: CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
8477:
8478: CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
8479:
8480: CFLAGS+= -Wall
8481:
8482: This code shows how the use of the := operator can quickly lead to unexpected
8483: results. The first paragraph is fairly common code. The second paragraph
8484: evaluates the CONFIGURE_ARGS variable, which results in CFLAGS=-O. In the third
8485: paragraph, the -Wall is appended to the CFLAGS, but this addition will not
8486: appear in CONFIGURE_ARGS. In actual code, the three paragraphs from above
8487: typically occur in completely unrelated files.
8488:
1.184 rillig 8489: 25.3.2. At runtime
1.1 dsieger 8490:
8491: After all the files have been loaded, the values of the variables cannot be
8492: changed anymore. Variables that are used in the shell commands are expanded at
8493: this point.
8494:
1.184 rillig 8495: 25.4. How can variables be specified?
1.1 dsieger 8496:
8497: There are many ways in which the definition and use of a variable can be
8498: restricted in order to detect bugs and violations of the (mostly unwritten)
1.108 rillig 8499: policies. A package can be checked with pkglint -Wall to see whether it meets
8500: these rules.
1.1 dsieger 8501:
1.184 rillig 8502: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8503:
8504: Most of the .mk files fall into one of the following classes. Cases where a
8505: file falls into more than one class should be avoided as it often leads to
8506: subtle bugs.
8507:
1.184 rillig 8508: 25.5.1. Procedures with parameters
1.1 dsieger 8509:
8510: In a traditional imperative programming language some of the .mk files could be
1.198 leot 8511: described as procedures. They take some input parameters and--after
8512: inclusion--provide a result in output parameters. Since all variables in
1.23 jakllsch 8513: Makefiles have global scope care must be taken not to use parameter names that
8514: have already another meaning. For example, PKGNAME is a bad choice for a
8515: parameter name.
1.1 dsieger 8516:
8517: Procedures are completely evaluated at preprocessing time. That is, when
8518: calling a procedure all input parameters must be completely resolvable. For
8519: example, CONFIGURE_ARGS should never be an input parameter since it is very
8520: likely that further text will be added after calling the procedure, which would
8521: effectively apply the procedure to only a part of the variable. Also,
1.108 rillig 8522: references to other variables will be modified after calling the procedure.
1.1 dsieger 8523:
8524: A procedure can declare its output parameters either as suitable for use in
8525: preprocessing directives or as only available at runtime. The latter
8526: alternative is for variables that contain references to other runtime
8527: variables.
8528:
8529: Procedures shall be written such that it is possible to call the procedure more
8530: than once. That is, the file must not contain multiple-inclusion guards.
8531:
8532: Examples for procedures are mk/bsd.options.mk and mk/buildlink3/bsd.builtin.mk.
8533: To express that the parameters are evaluated at load time, they should be
8534: assigned using the := operator, which should be used only for this purpose.
8535:
1.184 rillig 8536: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8537:
8538: Action files take some input parameters and may define runtime variables. They
8539: shall not define loadtime variables. There are action files that are included
8540: implicitly by the pkgsrc infrastructure, while other must be included
8541: explicitly.
8542:
8543: An example for action files is mk/subst.mk.
8544:
1.184 rillig 8545: 25.6. The order in which files are loaded
1.1 dsieger 8546:
8547: Package Makefiles usually consist of a set of variable definitions, and include
8548: the file ../../mk/bsd.pkg.mk in the very last line. Before that, they may also
8549: include various other *.mk files if they need to query the availability of
8550: certain features like the type of compiler or the X11 implementation. Due to
8551: the heavy use of preprocessor directives like .if and .for, the order in which
8552: the files are loaded matters.
8553:
8554: This section describes at which point the various files are loaded and gives
8555: reasons for that order.
8556:
1.184 rillig 8557: 25.6.1. The order in bsd.prefs.mk
1.1 dsieger 8558:
8559: The very first action in bsd.prefs.mk is to define some essential variables
8560: like OPSYS, OS_VERSION and MACHINE_ARCH.
8561:
1.4 rillig 8562: Then, the user settings are loaded from the file specified in MAKECONF, which
8563: is usually mk.conf. After that, those variables that have not been overridden
8564: by the user are loaded from mk/defaults/mk.conf.
1.1 dsieger 8565:
8566: After the user settings, the system settings and platform settings are loaded,
8567: which may override the user settings.
8568:
8569: Then, the tool definitions are loaded. The tool wrappers are not yet in effect.
8570: This only happens when building a package, so the proper variables must be used
8571: instead of the direct tool names.
8572:
8573: As the last steps, some essential variables from the wrapper and the package
8574: system flavor are loaded, as well as the variables that have been cached in
8575: earlier phases of a package build.
8576:
1.184 rillig 8577: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8578:
8579: First, bsd.prefs.mk is loaded.
8580:
8581: Then, the various *-vars.mk files are loaded, which fill default values for
8582: those variables that have not been defined by the package. These variables may
8583: later be used even in unrelated files.
8584:
8585: Then, the file bsd.pkg.error.mk provides the target error-check that is added
8586: as a special dependency to all other targets that use DELAYED_ERROR_MSG or
8587: DELAYED_WARNING_MSG.
8588:
8589: Then, the package-specific hacks from hacks.mk are included.
8590:
8591: Then, various other files follow. Most of them don't have any dependencies on
8592: what they need to have included before or after them, though some do.
8593:
8594: The code to check PKG_FAIL_REASON and PKG_SKIP_REASON is then executed, which
8595: restricts the use of these variables to all the files that have been included
8596: before. Appearances in later files will be silently ignored.
8597:
8598: Then, the files for the main targets are included, in the order of later
8599: execution, though the actual order should not matter.
8600:
8601: At last, some more files are included that don't set any interesting variables
8602: but rather just define make targets to be executed.
8603:
1.184 rillig 8604: Chapter 26. Regression tests
1.1 dsieger 8605:
8606: Table of Contents
8607:
1.184 rillig 8608: 26.1. Running the regression tests
8609: 26.2. Adding a new regression test
1.1 dsieger 8610:
1.184 rillig 8611: 26.2.1. Overridable functions
8612: 26.2.2. Helper functions
1.1 dsieger 8613:
8614: The pkgsrc infrastructure consists of a large codebase, and there are many
8615: corners where every little bit of a file is well thought out, making pkgsrc
8616: likely to fail as soon as anything is changed near those parts. To prevent most
8617: changes from breaking anything, a suite of regression tests should go along
8618: with every important part of the pkgsrc infrastructure. This chapter describes
8619: how regression tests work in pkgsrc and how you can add new tests.
8620:
1.184 rillig 8621: 26.1. Running the regression tests
1.1 dsieger 8622:
1.25 wiz 8623: You first need to install the pkgtools/pkg_regress package, which provides the
1.1 dsieger 8624: pkg_regress command. Then you can simply run that command, which will run all
1.168 rillig 8625: tests in the regress/ directory.
1.1 dsieger 8626:
1.184 rillig 8627: 26.2. Adding a new regression test
1.1 dsieger 8628:
1.168 rillig 8629: Every directory in the regress/ directory that contains a file called spec is
1.1 dsieger 8630: considered a regression test. This file is a shell program that is included by
8631: the pkg_regress command. The following functions can be overridden to suit your
8632: needs.
8633:
1.184 rillig 8634: 26.2.1. Overridable functions
1.1 dsieger 8635:
1.108 rillig 8636: These functions do not take any parameters. Although they are called in "set -e
1.168 rillig 8637: " mode, they don't stop at the first failing command. See this Stack Overflow
1.108 rillig 8638: question for details.
1.1 dsieger 8639:
1.108 rillig 8640: do_setup
1.1 dsieger 8641:
8642: This function prepares the environment for the test. By default it does
8643: nothing.
8644:
1.108 rillig 8645: do_test
1.1 dsieger 8646:
8647: This function runs the actual test. By default, it calls TEST_MAKE with the
8648: arguments MAKEARGS_TEST and writes its output including error messages into
8649: the file TEST_OUTFILE.
8650:
1.108 rillig 8651: When defining this function, make sure that all output that needs to be
8652: checked is written to the correct output file. Example:
8653:
8654: do_test() {
8655: echo "Example output"
8656: } 1>$TEST_OUTFILE 2>&1
8657:
8658: check_result
1.1 dsieger 8659:
8660: This function is run after the test and is typically used to compare the
8661: actual output from the one that is expected. It can make use of the various
1.108 rillig 8662: helper functions from the next section. Example:
8663:
8664: check_result() {
8665: exit_status 0
8666: output_require "Example"
8667: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
8668: output_prohibit "no such file or directory"
1.169 rillig 8669: regress_fail "expected $expected but got $actual for input $input"
1.108 rillig 8670: }
1.1 dsieger 8671:
1.108 rillig 8672: do_cleanup
1.1 dsieger 8673:
8674: This function cleans everything up after the test has been run. By default
8675: it does nothing.
8676:
1.184 rillig 8677: 26.2.2. Helper functions
1.1 dsieger 8678:
1.168 rillig 8679: regress_fail message...
8680:
8681: This function makes the test fail with the given error message.
8682:
1.108 rillig 8683: exit_status expected
1.1 dsieger 8684:
1.108 rillig 8685: This function compares the exitcode of the do_test function with its first
8686: parameter. If they differ, the test will fail.
1.1 dsieger 8687:
1.108 rillig 8688: output_require regex...
1.1 dsieger 8689:
8690: This function checks for each of its parameters if the output from do_test
1.108 rillig 8691: matches the extended regular expression. If it does not, the test will
8692: fail. Example:
8693:
8694: output_require "looks fine"
8695: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
1.1 dsieger 8696:
1.177 leot 8697: output_prohibit regex...
1.1 dsieger 8698:
8699: This function checks for each of its parameters if the output from do_test
8700: () does not match the extended regular expression. If any of the regular
8701: expressions matches, the test will fail.
8702:
1.184 rillig 8703: Chapter 27. Porting pkgsrc
1.1 dsieger 8704:
8705: Table of Contents
8706:
1.184 rillig 8707: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8708:
8709: The pkgsrc system has already been ported to many operating systems, hardware
8710: architectures and compilers. This chapter explains the necessary steps to make
8711: pkgsrc even more portable.
8712:
1.184 rillig 8713: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8714:
8715: To port pkgsrc to a new operating system (called MyOS in this example), you
8716: need to touch the following files:
8717:
8718: pkgtools/bootstrap-mk-files/files/mods/MyOS.sys.mk
8719:
8720: This file contains some basic definitions, for example the name of the C
8721: compiler.
8722:
8723: mk/bsd.prefs.mk
8724:
8725: Insert code that defines the variables OPSYS, OS_VERSION, LOWER_OS_VERSION,
8726: LOWER_VENDOR, MACHINE_ARCH, OBJECT_FMT, APPEND_ELF, and the other variables
8727: that appear in this file.
8728:
8729: mk/platform/MyOS.mk
8730:
8731: This file contains the platform-specific definitions that are used by
8732: pkgsrc. Start by copying one of the other files and edit it to your needs.
8733:
8734: mk/tools/tools.MyOS.mk
8735:
8736: This file defines the paths to all the tools that are needed by one or the
8737: other package in pkgsrc, as well as by pkgsrc itself. Find out where these
8738: tools are on your platform and add them.
8739:
8740: Now, you should be able to build some basic packages, like lang/perl5, shells/
8741: bash.
8742:
8743: Appendix A. A simple example package: bison
8744:
8745: Table of Contents
8746:
8747: A.1. files
8748:
8749: A.1.1. Makefile
8750: A.1.2. DESCR
8751: A.1.3. PLIST
8752: A.1.4. Checking a package with pkglint
8753:
8754: A.2. Steps for building, installing, packaging
8755:
8756: We checked to find a piece of software that wasn't in the packages collection,
1.25 wiz 8757: and picked GNU bison. Quite why someone would want to have bison when Berkeley
1.1 dsieger 8758: yacc is already present in the tree is beyond us, but it's useful for the
8759: purposes of this exercise.
8760:
8761: A.1. files
8762:
8763: A.1.1. Makefile
8764:
1.2 rillig 8765: # $NetBSD$
1.1 dsieger 8766: #
8767:
8768: DISTNAME= bison-1.25
8769: CATEGORIES= devel
1.171 rillig 8770: MASTER_SITES= ${MASTER_SITE_GNU:=bison/}
1.1 dsieger 8771:
1.30 dholland 8772: MAINTAINER= pkgsrc-users@NetBSD.org
1.174 leot 8773: HOMEPAGE= https://www.gnu.org/software/bison/bison.html
1.1 dsieger 8774: COMMENT= GNU yacc clone
8775:
8776: GNU_CONFIGURE= yes
1.47 wiz 8777: INFO_FILES= yes
1.1 dsieger 8778:
8779: .include "../../mk/bsd.pkg.mk"
8780:
8781: A.1.2. DESCR
8782:
8783: GNU version of yacc. Can make re-entrant parsers, and numerous other
8784: improvements. Why you would want this when Berkeley yacc(1) is part
8785: of the NetBSD source tree is beyond me.
8786:
8787: A.1.3. PLIST
8788:
1.2 rillig 8789: @comment $NetBSD$
1.1 dsieger 8790: bin/bison
8791: man/man1/bison.1.gz
8792: share/bison.simple
8793: share/bison.hairy
8794:
8795: A.1.4. Checking a package with pkglint
8796:
8797: The NetBSD package system comes with pkgtools/pkglint which helps to check the
8798: contents of these files. After installation it is quite easy to use, just
1.171 rillig 8799: change to the directory of the package you wish to examine and run pkglint:
1.1 dsieger 8800:
8801: $ pkglint
1.171 rillig 8802: ERROR: Makefile: Each package must define its LICENSE.
8803: WARN: Makefile:9: HOMEPAGE should migrate from http to https.
8804: NOTE: PLIST:3: The .gz extension is unnecessary for manual pages.
8805: WARN: PLIST:5: "share/bison.hairy" should be sorted before "share/bison.simple".
8806: 1 error, 2 warnings and 1 note found.
8807: (Run "pkglint -e" to show explanations.)
8808: (Run "pkglint -fs" to show what can be fixed automatically.)
1.172 rillig 8809: (Run "pkglint -F" to automatically fix some issues.)
1.1 dsieger 8810:
8811: Depending on the supplied command line arguments (see pkglint(1)), more checks
1.170 rillig 8812: will be performed. Use e.g. pkglint -Wall for a very thorough check.
1.1 dsieger 8813:
8814: A.2. Steps for building, installing, packaging
8815:
8816: Create the directory where the package lives, plus any auxiliary directories:
8817:
8818: # cd /usr/pkgsrc/lang
8819: # mkdir bison
8820: # cd bison
8821: # mkdir patches
8822:
1.184 rillig 8823: Create Makefile, DESCR and PLIST (see Chapter 12, Package components - files,
1.1 dsieger 8824: directories and contents) then continue with fetching the distfile:
8825:
8826: # make fetch
8827: >> bison-1.25.tar.gz doesn't seem to exist on this system.
8828: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
8829: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8830: ftp: Error retrieving file: 500 Internal error
8831:
8832: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
8833: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8834: ftp: Error retrieving file: 500 Internal error
8835:
8836: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
8837: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8838: Successfully retrieved file.
8839:
8840: Generate the checksum of the distfile into distinfo:
8841:
8842: # make makedistinfo
8843:
8844: Now compile:
8845:
8846: # make
8847: >> Checksum OK for bison-1.25.tar.gz.
8848: ===> Extracting for bison-1.25
8849: ===> Patching for bison-1.25
8850: ===> Ignoring empty patch directory
8851: ===> Configuring for bison-1.25
8852: creating cache ./config.cache
8853: checking for gcc... cc
8854: checking whether we are using GNU C... yes
8855: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
8856: checking how to run the C preprocessor... cc -E
8857: checking for minix/config.h... no
8858: checking for POSIXized ISC... no
8859: checking whether cross-compiling... no
8860: checking for ANSI C header files... yes
8861: checking for string.h... yes
8862: checking for stdlib.h... yes
8863: checking for memory.h... yes
8864: checking for working const... yes
8865: checking for working alloca.h... no
8866: checking for alloca... yes
8867: checking for strerror... yes
8868: updating cache ./config.cache
8869: creating ./config.status
8870: creating Makefile
8871: ===> Building for bison-1.25
8872: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g LR0.c
8873: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g allocate.c
8874: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g closure.c
8875: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g conflicts.c
8876: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g derives.c
8877: 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
8878: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getargs.c
8879: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g gram.c
8880: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lalr.c
8881: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lex.c
8882: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g main.c
8883: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g nullable.c
8884: 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
8885: 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
8886: 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
8887: 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
8888: 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
8889: 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
8890: 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
8891: 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
8892: 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
8893: 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
8894: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
8895: rm -f bison.s1
8896: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
8897:
8898: Everything seems OK, so install the files:
8899:
8900: # make install
8901: >> Checksum OK for bison-1.25.tar.gz.
8902: ===> Installing for bison-1.25
8903: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
8904: rm -f /usr/pkg/bin/bison
8905: cd /usr/pkg/share; rm -f bison.simple bison.hairy
8906: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
8907: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
8908: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
8909: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
8910: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
8911: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
8912: ===> Registering installation for bison-1.25
8913:
8914: You can now use bison, and also - if you decide so - remove it with pkg_delete
8915: bison. Should you decide that you want a binary package, do this now:
8916:
8917: # make package
8918: >> Checksum OK for bison-1.25.tar.gz.
8919: ===> Building package for bison-1.25
8920: Creating package bison-1.25.tgz
8921: Registering depends:.
8922: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
8923:
8924: Now that you don't need the source and object files any more, clean up:
8925:
8926: # make clean
8927: ===> Cleaning for bison-1.25
8928:
1.207 leot 8929: Appendix B. Security hardening
8930:
8931: Table of Contents
8932:
8933: B.1. Mechanisms
8934:
8935: B.1.1. Enabled by default
8936: B.1.2. Not enabled by default
8937:
8938: B.2. Caveats
8939:
8940: B.2.1. Problems with PKGSRC_MKPIE
8941: B.2.2. Problems with PKGSRC_USE_FORTIFY
8942: B.2.3. Problems with PKGSRC_USE_RELRO
8943: B.2.4. Problems with PKGSRC_USE_SSP
8944:
8945: B.3. Auditing the system
8946:
8947: B.3.1. Checking for PIE
8948: B.3.2. Checking for partial RELRO
8949: B.3.3. Checking for full RELRO
8950: B.3.4. Checking for SSP
8951:
8952: A number of mechanisms are available in pkgsrc to improve the security of the
8953: resulting system. This page describes the mechanisms, and gives hints about
8954: detecting and fixing problems.
8955:
8956: Mechanisms can be enabled individually in mk.conf, and are individually
8957: described below.
8958:
8959: Typically, a feature will cause some programs to fail to build or work when
8960: first enabled. This can be due to latent problems in the program, and can be
8961: due to other reasons. After enough testing to have confidence that user
8962: problems will be quite rare, individual mechanisms will be enabled by default.
8963:
8964: For each mechanism, see the Caveats section below for an explanation of what
8965: might go wrong at compile time and at run time, and how to notice and address
8966: these problems.
8967:
8968: B.1. Mechanisms
8969:
8970: B.1.1. Enabled by default
8971:
8972: B.1.1.1. PKGSRC_USE_FORTIFY
8973:
8974: This allows substitute wrappers to be used for some commonly used library
8975: functions that do not have built-in bounds checking - but could in some cases.
8976:
8977: Two mitigation levels are available:
8978:
8979: * "weak" only enables checks at compile-time.
8980:
8981: * "strong" enables checks at compile-time and runtime.
8982:
8983: "strong" has been enabled by default since pkgsrc-2017Q3.
8984:
8985: B.1.1.2. PKGSRC_USE_SSP
8986:
8987: This enables a stack-smashing protection mitigation. It is done by adding a
8988: guard variable to functions with vulnerable objects. The guards are initialized
8989: when a function is entered and then checked when the function exits. The guard
8990: check will fail and the program forcibly exited if the variable was modified in
8991: the meantime. This can happen in case of buffer overflows or memory corruption,
8992: and therefore exposing these bugs.
8993:
8994: Different mitigation levels are available:
8995:
8996: * "yes", which will only protect functions considered vulnerable by the
8997: compiler;
8998:
8999: * "all", which will protect every function;
9000:
9001: * "strong", the default, which will apply a better balance between the two
9002: settings above.
9003:
9004: This mitigation is supported by both GCC and clang. It may be supported in
9005: additional compilers, possibly under a different name. It is particularly
9006: useful for unsafe programming languages, such as C/C++.
9007:
9008: * "yes" is enabled by default where known supported since pkgsrc-2017Q3.
9009:
9010: * "strong" is enabled by default where known supported since pkgsrc-2021Q4.
9011:
9012: More details can be found here:
9013:
9014: * Buffer overflow protection on Wikipedia
9015:
9016: B.1.1.3. PKGSRC_MKPIE
9017:
9018: This requests the creation of PIE (Position Independent Executables) for all
9019: executables. The PIE mechanism is normally used for shared libraries, so that
9020: they can be loaded at differing addresses at runtime. PIE itself does not have
9021: useful security properties; however, it is necessary to fully leverage some,
9022: such as ASLR. Some operating systems support Address Space Layout Randomization
9023: (ASLR), which causes different addresses to be used each time a program is run.
9024: This makes it more difficult for an attacker to guess addresses and thus makes
9025: exploits harder to construct. With PIE, ASLR can really be applied to the
9026: entire program, instead of the stack and heap only.
9027:
9028: PIE executables will only be built for toolchains that are known to support
9029: PIE. Currently, this means NetBSD on x86, ARM, SPARC64, m68k, and MIPS.
9030:
9031: PKGSRC_MKPIE was enabled by default after the pkgsrc-2021Q3 branch.
9032:
1.210 ! gutterid 9033: B.1.2. Not enabled by default
! 9034:
! 9035: B.1.2.1. PKGSRC_MKREPRO
! 9036:
! 9037: With this option, pkgsrc will try to build packages reproducibly. This allows
! 9038: packages built from the same tree and with the same options, to produce
! 9039: identical results bit by bit. This option should be combined with ASLR and
! 9040: PKGSRC_MKPIE to avoid predictable address offsets for attackers attempting to
! 9041: exploit security vulnerabilities.
! 9042:
! 9043: More details can be found here:
! 9044:
! 9045: * Reproducible Builds - a set of software development practices that create
! 9046: an independently-verifiable path from source to binary code
! 9047:
! 9048: More work likely needs to be done before pkgsrc is fully reproducible.
! 9049:
! 9050: B.1.2.2. PKGSRC_USE_RELRO
1.207 leot 9051:
9052: This also makes the exploitation of some security vulnerabilities more
9053: difficult in some cases.
9054:
9055: Two different mitigation levels are available:
9056:
9057: * partial: the ELF sections are reordered so that internal data sections
9058: precede the program's own data sections, and non-PLT GOT is read-only;
9059:
9060: * full: in addition to partial RELRO, every relocation is performed
9061: immediately when starting the program (with a slight performance impact),
9062: allowing the entire GOT to be read-only.
9063:
9064: This is currently supported by GCC. Many software distributions now enable this
1.210 ! gutterid 9065: feature by default, at the "partial" level. However, it cannot yet be enforced
! 9066: globally in pkgsrc through cwrappers.
1.207 leot 9067:
9068: More details can be found here:
9069:
9070: * Hardening ELF binaries using Relocation Read-Only (RELRO)
9071:
1.210 ! gutterid 9072: B.1.2.3. PKGSRC_USE_STACK_CHECK
1.207 leot 9073:
9074: This uses -fstack-check with GCC for another stack protection mitigation.
9075:
9076: It asks the compiler to generate code verifying that it does not corrupt the
9077: stack. According to GCC's manual page, this is really only useful for
9078: multi-threaded programs.
9079:
9080: B.2. Caveats
9081:
9082: B.2.1. Problems with PKGSRC_MKPIE
9083:
9084: B.2.1.1. Packages failing to build
9085:
9086: A number of packages may fail to build with this option enabled. The failures
9087: are often related to the absence of the -fPIC compilation flag when building
9088: libraries or executables (or ideally -fPIE in the latter case). This flag is
9089: added to the CFLAGS already, but requires the package to actually support it.
9090:
9091: B.2.1.1.1. How to fix
9092:
9093: These instructions are meant as a reference only; they likely need to be
9094: adapted for many packages individually.
9095:
9096: For packages using Makefiles:
9097:
9098: MAKE_FLAGS+= CFLAGS=${CFLAGS:Q}
9099: MAKE_FLAGS+= LDFLAGS=${LDFLAGS:Q}
9100:
9101: For packages using Imakefiles:
9102:
9103: MAKE_FLAGS+= CCOPTIONS=${CFLAGS:Q}
9104: MAKE_FLAGS+= LOCAL_LDFLAGS=${LDFLAGS:Q}
9105:
9106: B.2.1.2. Run-time crashes
9107:
9108: Some programs may fail to run, or crash at random times once built as PIE. Two
9109: scenarios are essentially possible. This is nearly always due to a bug in the
9110: program being exposed due to ASLR.
9111:
9112: B.2.1.3. Disabling PKGSRC_MKPIE on a per-package basis
9113:
9114: Ideally, packages should be fixed for compatibility with MKPIE. However, in
9115: some cases this is very difficult, due to complex build systems, packages using
9116: non-standard toolchains, or programming languages with odd bootstrapping
9117: mechanisms.
9118:
9119: To disable PKGSRC_MKPIE on a per-package basis, set MKPIE_SUPPORTED= no in the
9120: package's Makefile before bsd.prefs.mk is included.
9121:
9122: B.2.2. Problems with PKGSRC_USE_FORTIFY
9123:
9124: B.2.2.1. Packages failing to build
9125:
9126: This feature makes use of pre-processing directives to look for hardened,
9127: alternative implementations of essential library calls. Some programs may fail
9128: to build as a result; this usually happens for those trying too hard to be
9129: portable, or otherwise abusing definitions in the standard library.
9130:
9131: B.2.2.2. Run-time crashes
9132:
9133: This feature may cause some programs to crash, usually indicating an actual bug
9134: in the program. The fix will typically involve patching the original program's
9135: source code.
9136:
9137: B.2.2.3. Optimization is required
9138:
9139: At least in the case of GCC, FORTIFY will only be applied if optimization is
9140: applied while compiling. This means that the CFLAGS should also contain -O, -O2
9141: or another optimization level. This cannot easily be applied globally, as some
9142: packages may require specific optimization levels.
9143:
9144: B.2.2.4. Disabling FORTIFY on a per-package basis
9145:
9146: Note
9147:
9148: FORTIFY should not be disabled to work around runtime crashes in the program!
9149: This is a very bad idea and will expose you to security vulnerabilities.
9150:
9151: To disable FORTIFY on a per-package basis, set the following in the package's
9152: Makefile before bsd.prefs.mk is included:
9153:
9154: FORTIFY_SUPPORTED= no
9155:
9156: B.2.3. Problems with PKGSRC_USE_RELRO
9157:
9158: B.2.3.1. Performance impact
9159:
9160: For better protection, full RELRO requires every symbol to be resolved when the
9161: program starts, rather than simply when required at run-time. This will have
9162: more impact on programs using a lot of symbols, or linked to libraries exposing
9163: a lot of symbols. Therefore, daemons or programs otherwise running in
9164: background are affected only when started. Programs loading plug-ins at
9165: run-time are affected when loading the plug-ins.
9166:
9167: The impact is not expected to be noticeable on modern hardware, except in some
9168: cases for big programs.
9169:
9170: B.2.3.2. Run-time crashes
9171:
9172: Some programs handle plug-ins and dependencies in a way that conflicts with
9173: RELRO: for instance, with an initialization routine listing any other plug-in
9174: required. With full RELRO, the missing symbols are resolved before the
9175: initialization routine can run, and the dynamic loader will not be able to find
9176: them directly and abort as a result. Unfortunately, this is how Xorg loads its
9177: drivers. Partial RELRO can be applied instead in this case.
9178:
9179: B.2.3.3. Disabling RELRO on a per-package basis
9180:
9181: To disable RELRO on a per-package basis, set the following in the package's
9182: Makefile before bsd.prefs.mk is included:
9183:
9184: RELRO_SUPPORTED= no
9185:
1.209 nia 9186: It is also possible to at most enable partial RELRO, by setting RELRO_SUPPORTED
9187: to partial.
9188:
1.207 leot 9189: B.2.4. Problems with PKGSRC_USE_SSP
9190:
9191: B.2.4.1. Packages failing to build
9192:
9193: The stack-smashing protection provided by this option does not work for some
9194: programs. The most common situation in which this happens is when the program
9195: allocates variables on the stack, with the size determined at run-time.
9196:
9197: B.2.4.2. Run-time crashes
9198:
9199: Again, this feature may cause some programs to crash via a SIGABRT, usually
9200: indicating an actual bug in the program.
9201:
9202: On NetBSD LOG_CRIT level syslog messages are sent and - by default - appended
9203: to /var/log/messages, e.g.:
9204:
9205: Jan 6 15:42:51 hostname -: hostname program - - - buffer overflow detected; terminated
9206:
9207: (where hostname is the hostname(1) and program is the basename(1) of the
9208: program crashed).
9209:
9210: Patching the original program is then required.
9211:
9212: Rebuilding the package via:
9213:
9214: % env CFLAGS=-g INSTALL_UNSTRIPPED=yes make replace
9215:
9216: and inspecting the backtrace of the coredump via the debugger should point out
9217: the problematic call by inspecting the frame calling the _chk() (SSP) function.
9218:
9219: B.2.4.3. Performance impact
9220:
9221: The compiler emits extra code when using this feature: a check for buffer
9222: overflows is performed when entering and exiting functions, requiring an extra
9223: variable on the stack. The level of protection can otherwise be adjusted to
9224: affect only those functions considered more sensitive by the compiler (with
9225: -fstack-protector instead of -fstack-protector-all).
9226:
9227: The impact is not expected to be noticeable on modern hardware. However,
9228: programs with a hard requirement to run at the fastest possible speed should
9229: avoid using this feature, or using libraries built with this feature.
9230:
9231: B.2.4.4. Disabling SSP on a per-package basis
9232:
9233: Note
9234:
9235: SSP should not be disabled to work around runtime crashes in the program! This
9236: is a very bad idea and will expose you to security vulnerabilities.
9237:
9238: To disable SSP on a per-package basis, set the following in the package's
9239: Makefile before bsd.prefs.mk is included:
9240:
9241: SSP_SUPPORTED= no
9242:
9243: B.3. Auditing the system
9244:
9245: The illusion of security is worse than having no security at all. This section
9246: lists a number of ways to ensure the security features requested are actually
9247: effective.
9248:
9249: These instructions were obtained and tested on a system derived from NetBSD 7
9250: (amd64). YMMV.
9251:
9252: B.3.1. Checking for PIE
9253:
9254: The ELF executable type in use changes for binaries built as PIE; without:
9255:
9256: $ file /path/to/bin/ary
9257: /path/to/bin/ary: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for NetBSD 7.0, not stripped
9258:
9259: as opposed to the following binary, built as PIE:
9260:
9261: $ file /path/to/pie/bin/ary
9262: /path/to/pie/bin/ary: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for NetBSD 7.0, not stripped
9263:
9264: The latter result is then what is expected.
9265:
9266: B.3.2. Checking for partial RELRO
9267:
9268: The following command should list a section called RELRO:
9269:
9270: $ objdump -p /path/to/bin/ary
9271:
9272: /path/to/bin/ary: file format elf64-x86-64
9273:
9274: Program Header:
9275: [...]
9276: RELRO off 0x0000000000000d78 vaddr 0x0000000000600d78 paddr 0x0000000000600d78 align 2**0
9277:
9278: This check is now performed automatically if PKG_DEVELOPER is set and RELRO is
9279: enabled.
9280:
9281: B.3.3. Checking for full RELRO
9282:
9283: The dynamic loader will apply RELRO immediately when detecting the presence of
9284: the BIND_NOW flag:
9285:
9286: $ objdump -x /path/to/bin/ary
9287:
9288: /path/to/bin/ary: file format elf64-x86-64
9289:
9290: Dynamic Section:
9291: [...]
9292: BIND_NOW 0x0000000000000000
9293:
9294: This has to be combined with partial RELRO (see above) to be fully efficient.
9295:
9296: This check is now performed automatically (where supported) if PKG_DEVELOPER is
9297: set.
9298:
9299: B.3.4. Checking for SSP
9300:
1.208 nia 9301: Note
9302:
9303: Checking for SSP using this method only works where the operating system uses
9304: libssp. libssp is not used on recent NetBSD/FreeBSD/Linux versions.
9305:
1.207 leot 9306: Building objects, binaries and libraries with SSP will affect the presence of
9307: additional symbols in the resulting file:
9308:
9309: $ nm /path/to/bin/ary
9310: [...]
9311: U __stack_chk_fail
9312: 0000000000600ea0 B __stack_chk_guard
9313:
9314: This is an indicator that the program was indeed built with support for SSP.
9315:
9316: This check is now performed automatically (where supported) if PKG_DEVELOPER is
9317: set and SSP is enabled.
9318:
9319: Appendix C. Build logs
1.1 dsieger 9320:
9321: Table of Contents
9322:
1.207 leot 9323: C.1. Building figlet
9324: C.2. Packaging figlet
1.1 dsieger 9325:
1.207 leot 9326: C.1. Building figlet
1.1 dsieger 9327:
9328: # make
9329: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9330: => figlet221.tar.gz doesn't seem to exist on this system.
9331: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
9332: => [172219 bytes]
9333: Connected to ftp.plig.net.
9334: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
9335: 331 Guest login ok, send your complete e-mail address as password.
9336: 230-You are user #5 of 500 simultaneous users allowed.
9337: 230-
9338: 230- ___ _ _ _
9339: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
9340: 230- | _| _| . |_| . | | | . |_| . | _| . |
9341: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
9342: 230- |_| |_| |___| |___|
9343: 230-
9344: 230-** Welcome to ftp.plig.org **
9345: 230-
9346: 230-Please note that all transfers from this FTP site are logged. If you
9347: 230-do not like this, please disconnect now.
9348: 230-
1.19 snj 9349: 230-This archive is available via
1.1 dsieger 9350: 230-
9351: 230-HTTP: http://ftp.plig.org/
9352: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
9353: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
9354: 230-
9355: 230-Please email comments, bug reports and requests for packages to be
9356: 230-mirrored to ftp-admin@plig.org.
9357: 230-
9358: 230-
9359: 230 Logged in anonymously.
9360: Remote system type is UNIX.
9361: Using binary mode to transfer files.
9362: 200 Type okay.
9363: 250 "/pub" is new cwd.
9364: 250-"/pub/figlet" is new cwd.
9365: 250-
9366: 250-Welcome to the figlet archive at ftp.figlet.org
9367: 250-
9368: 250- ftp://ftp.figlet.org/pub/figlet/
9369: 250-
9370: 250-The official FIGlet web page is:
9371: 250- http://www.figlet.org/
9372: 250-
9373: 250-If you have questions, please mailto:info@figlet.org. If you want to
9374: 250-contribute a font or something else, you can email us.
9375: 250
9376: 250 "/pub/figlet/program" is new cwd.
9377: 250 "/pub/figlet/program/unix" is new cwd.
9378: local: figlet221.tar.gz remote: figlet221.tar.gz
9379: 502 Unimplemented command.
9380: 227 Entering Passive Mode (195,40,6,41,246,104)
9381: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
9382: 38% |************** | 65800 64.16 KB/s 00:01 ETA
9383: 226 Transfer completed.
9384: 172219 bytes received in 00:02 (75.99 KB/s)
9385: 221 Goodbye.
9386: => Checksum OK for figlet221.tar.gz.
9387: ===> Extracting for figlet-2.2.1nb2
9388: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
9389: ===> Patching for figlet-2.2.1nb2
9390: ===> Applying pkgsrc patches for figlet-2.2.1nb2
9391: ===> Overriding tools for figlet-2.2.1nb2
9392: ===> Creating toolchain wrappers for figlet-2.2.1nb2
9393: ===> Configuring for figlet-2.2.1nb2
9394: ===> Building for figlet-2.2.1nb2
9395: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
9396: chmod a+x figlet
9397: gcc -O2 -o chkfont chkfont.c
9398: => Unwrapping files-to-be-installed.
9399: #
9400: # make install
9401: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9402: ===> Installing for figlet-2.2.1nb2
9403: install -d -o root -g wheel -m 755 /usr/pkg/bin
9404: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
9405: mkdir -p /usr/pkg/share/figlet
9406: cp figlet /usr/pkg/bin
9407: cp chkfont /usr/pkg/bin
9408: chmod 555 figlist showfigfonts
9409: cp figlist /usr/pkg/bin
9410: cp showfigfonts /usr/pkg/bin
9411: cp fonts/*.flf /usr/pkg/share/figlet
9412: cp fonts/*.flc /usr/pkg/share/figlet
9413: cp figlet.6 /usr/pkg/man/man6
9414: ===> Registering installation for figlet-2.2.1nb2
9415: #
9416:
1.207 leot 9417: C.2. Packaging figlet
1.1 dsieger 9418:
9419: # make package
9420: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9421: ===> Packaging figlet-2.2.1nb2
9422: ===> Building binary package for figlet-2.2.1nb2
9423: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
9424: Using SrcDir value of /usr/pkg
9425: Registering depends:.
9426: #
9427:
1.207 leot 9428: Appendix D. Directory layout of the pkgsrc FTP server
1.1 dsieger 9429:
9430: Table of Contents
9431:
1.207 leot 9432: D.1. distfiles: The distributed source files
9433: D.2. misc: Miscellaneous things
9434: D.3. packages: Binary packages
9435: D.4. reports: Bulk build reports
9436: D.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 9437:
9438: As in other big projects, the directory layout of pkgsrc is quite complex for
9439: newbies. This chapter explains where you find things on the FTP server. The
9440: base directory on ftp.NetBSD.org is /pub/pkgsrc/. On other servers it may be
9441: different, but inside this directory, everything should look the same, no
9442: matter on which server you are. This directory contains some subdirectories,
9443: which are explained below.
9444:
1.207 leot 9445: D.1. distfiles: The distributed source files
1.1 dsieger 9446:
9447: The directory distfiles contains lots of archive files from all pkgsrc
9448: packages, which are mirrored here. The subdirectories are called after their
9449: package names and are used when the distributed files have names that don't
9450: explicitly contain a version number or are otherwise too generic (for example
9451: release.tar.gz).
9452:
1.207 leot 9453: D.2. misc: Miscellaneous things
1.1 dsieger 9454:
9455: This directory contains things that individual pkgsrc developers find worth
9456: publishing.
9457:
1.207 leot 9458: D.3. packages: Binary packages
1.1 dsieger 9459:
1.3 rillig 9460: This directory contains binary packages for the various platforms that are
9461: supported by pkgsrc. Each subdirectory is of the form OPSYS/ARCH/OSVERSION_TAG.
9462: The meaning of these variables is:
9463:
9464: * OPSYS is the name of the operating system for which the packages have been
1.9 rillig 9465: built. The name is taken from the output of the uname command, so it may
9466: differ from the one you are used to hear.
1.3 rillig 9467:
1.8 rillig 9468: * ARCH is the hardware architecture of the platform for which the packages
1.10 hubertf 9469: have been built. It also includes the ABI (Application Binary Interface)
9470: for platforms that have several of them.
1.3 rillig 9471:
1.8 rillig 9472: * OSVERSION is the version of the operating system. For version numbers that
9473: change often (for example NetBSD-current), the often-changing part should
9474: be replaced with an x, for example 4.99.x.
1.3 rillig 9475:
1.23 jakllsch 9476: * TAG is either 20xxQy for a stable branch, or head for packages built from
1.8 rillig 9477: the HEAD branch. The latter should only be used when the packages are
9478: updated on a regular basis. Otherwise the date from checking out pkgsrc
9479: should be appended, for example head_20071015.
1.3 rillig 9480:
9481: The rationale for exactly this scheme is that the pkgsrc users looking for
9482: binary packages can quickly click through the directories on the server and
9483: find the best binary packages for their machines. Since they usually know the
9484: operating system and the hardware architecture, OPSYS and ARCH are placed
9485: first. After these choices, they can select the best combination of OSVERSION
9486: and TAG together, since it is usually the case that packages stay compatible
9487: between different version of the operating system.
9488:
9489: In each of these directories, there is a whole binary packages collection for a
9490: specific platform. It has a directory called All which contains all binary
9491: packages. Besides that, there are various category directories that contain
9492: symbolic links to the real binary packages.
1.1 dsieger 9493:
1.207 leot 9494: D.4. reports: Bulk build reports
1.8 rillig 9495:
9496: Here are the reports from bulk builds, for those who want to fix packages that
9497: didn't build on some of the platforms. The structure of subdirectories should
1.207 leot 9498: look like the one in Section D.3, "packages: Binary packages".
1.8 rillig 9499:
1.207 leot 9500: D.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 9501:
9502: These directories contain the "real" pkgsrc, that is the files that define how
9503: to create binary packages from source archives.
9504:
1.149 leot 9505: Each of the current, stable and pkgsrc-20xxQy directories share the same
9506: structure. They each contain a pkgsrc directory and pkgsrc.tar.{bz,gz,xz} file.
9507:
1.1 dsieger 9508: The directory pkgsrc contains a snapshot of the CVS repository, which is
1.149 leot 9509: updated regularly. The file pkgsrc.tar.{bz,gz,xz} contains the same as the
9510: directory, ready to be downloaded as a whole.
1.1 dsieger 9511:
1.149 leot 9512: The current directory contains files related to the HEAD branch of the CVS
9513: repository. In this directory there is an additional file called
9514: pkgsrc-readmes.tar.{bz,gz,xz} that contains all pkgsrc READMEs with information
9515: about categories and packages.
9516:
9517: The stable directory is a symlink to the latest pkgsrc-20xxQy.
9518:
9519: The pkgsrc-20xxQy. directories contain files related to the -20xxQy stable
9520: branch of the CVS repository. In these directories there is an additional file
9521: called pkgsrc-20xxQy.tar.{bz,gz,xz}, which contains the state of pkgsrc when it
9522: was branched.
1.148 leot 9523:
1.207 leot 9524: Appendix E. Help topics
1.154 rillig 9525:
9526: The following list contains all help topics that are available when running
9527: bmake help topic=:index.
9528:
1.210 ! gutterid 9529: #! -lintl
! 9530: 32bit 64bit
! 9531: ABI ACCEPTABLE_LICENSES
! 9532: ACROREAD_FONTPATH ADDITIONAL
! 9533: AFAIK AIX
! 9534: ALLOW_VULNERABLE_PACKAGES ALL_ENV
! 9535: ALTERNATIVES_SRC AMANDA_TMP
! 9536: AMANDA_USER AMANDA_VAR
! 9537: APACHE_GROUP APACHE_MODULE_NAME
! 9538: APACHE_MODULE_SRC APACHE_MODULE_SRCDIR
! 9539: APACHE_PKG_PREFIX APACHE_SUEXEC_CONFIGURE_ARGS
! 9540: APACHE_SUEXEC_DOCROOT APACHE_USER
! 9541: APPEND_ABI APPEND_ELF
! 9542: ARLA_CACHE AUDIT_PACKAGES_FLAGS
! 9543: AUTOCONF_REQD AUTOMAKE_OVERRIDE
! 9544: AUTOMAKE_REQD AUTO_MKDIRS
! 9545: BDB185_DEFAULT BDBBASE
! 9546: BDB_ACCEPTED BDB_DEFAULT
! 9547: BDB_LIBS BDB_TYPE
! 9548: BINCIMAP_GROUP BINCIMAP_USER
! 9549: BIND_DIR BIND_GROUP
! 9550: BIND_USER BINOWN
! 9551: BINPKG_SITES BIN_INSTALL_FLAGS
! 9552: BISON_PKGDATADIR BLAS
! 9553: BLAS_ACCEPTED BLAS_C_INTERFACE
! 9554: BLAS_INCLUDES BLAS_INDEX64
! 9555: BLAS_LIBS BLAS_TYPE
! 9556: BOOTSTRAP_DEPENDS BOOTSTRAP_SETUPTOOLS
! 9557: BROKEN BROKEN_EXCEPT_ON_PLATFORM
! 9558: BROKEN_ON_PLATFORM BSDSRCDIR
! 9559: BSDXSRCDIR BSD_MAKE_ENV
! 9560: BUILDLINK_AUTO_DIRS BUILDLINK_AUTO_VARS
! 9561: BUILDLINK_CFLAGS BUILDLINK_CONTENTS_FILTER
! 9562: BUILDLINK_CPPFLAGS BUILDLINK_FILES
! 9563: BUILDLINK_FILES_CMD BUILDLINK_FNAME_TRANSFORM
! 9564: BUILDLINK_LDFLAGS BUILDLINK_LIBS
! 9565: BUILDLINK_OPSYS_SUPPORT_PTHREAD BUILDLINK_PKGNAME
! 9566: BUILDLINK_PREFIX BUILDLINK_RPATHDIRS
! 9567: BUILDLINK_TREE BUILD_DEFS
! 9568: BUILD_DEFS_EFFECTS BUILD_DEPENDS
! 9569: BUILD_DIRS BUILD_ENV_SHELL
! 9570: BUILD_MAKE_CMD BUILD_MAKE_FLAGS
! 9571: BUILD_TARGET BUILTIN_FIND_FILES
! 9572: BUILTIN_FIND_FILES_VAR BUILTIN_FIND_GREP
! 9573: BUILTIN_FIND_HEADERS BUILTIN_FIND_HEADERS_VAR
! 9574: BUILTIN_FIND_PKGCONFIG BUILTIN_FIND_PKGCONFIG_VAR
! 9575: BUILTIN_PKG BUILTIN_TEST_CURSES_DEFINES
! 9576: BUILTIN_TEST_CURSES_FUNCS BUILTIN_VERSION_SCRIPT
! 9577: BUILTIN_X11_TYPE BUILTIN_X11_VERSION
! 9578: CACTI_GROUP CACTI_USER
! 9579: CANNA_GROUP CANNA_USER
! 9580: CAT CBLAS_LIBS
! 9581: CCACHE_BASE CCACHE_DIR
! 9582: CCACHE_LOGFILE CC_VERSION
! 9583: CC_VERSION_STRING CDRECORD_CONF
! 9584: CDROM_PKG_URL_DIR CDROM_PKG_URL_HOST
! 9585: CHECK_COMPILER CHECK_FAKEHOME
! 9586: CHECK_FILES CHECK_FILES_SKIP
! 9587: CHECK_FILES_STRICT CHECK_HEADERS
! 9588: CHECK_HEADERS_SKIP CHECK_INTERPRETER
! 9589: CHECK_INTERPRETER_SKIP CHECK_PERMS
! 9590: CHECK_PERMS_AUTOFIX CHECK_PERMS_SKIP
! 9591: CHECK_PORTABILITY CHECK_PORTABILITY_EXPERIMENTAL
! 9592: CHECK_PORTABILITY_SKIP CHECK_RELRO
! 9593: CHECK_RELRO_SKIP CHECK_RELRO_SUPPORTED
! 9594: CHECK_SHLIBS CHECK_SHLIBS_SKIP
! 9595: CHECK_SHLIBS_SUPPORTED CHECK_SHLIBS_TOXIC
! 9596: CHECK_SSP CHECK_SSP_SKIP
! 9597: CHECK_SSP_SUPPORTED CHECK_STRIPPED
! 9598: CHECK_STRIPPED_SKIP CHECK_WRKREF
! 9599: CHECK_WRKREF_EXTRA_DIRS CHECK_WRKREF_SKIP
! 9600: CLAMAV_DBDIR CLAMAV_GROUP
! 9601: CLAMAV_USER CLANGBASE
! 9602: CLEANDEPENDS CMAKE_DEPENDENCIES_REWRITE
! 9603: CMAKE_INSTALL_NAME_DIR CMAKE_INSTALL_PREFIX
! 9604: CMAKE_MODULE_PATH_OVERRIDE CMAKE_PKGSRC_BUILD_FLAGS
! 9605: CMAKE_PREFIX_PATH CMAKE_USE_GNU_INSTALL_DIRS
! 9606: COMPILER_RPATH_FLAG COMPILER_USE_SYMLINKS
! 9607: CONFIGURE_ARGS CONFIGURE_DIRS
! 9608: CONFIGURE_ENV CONFIGURE_ENV_SHELL
! 9609: CONFIGURE_HAS_INFODIR CONFIGURE_HAS_MANDIR
! 9610: CONFIGURE_SCRIPT CONFIG_SHELL
! 9611: CONFIG_SHELL_FLAGS CONF_FILES
! 9612: CONF_FILES_MODE CONF_FILES_PERMS
! 9613: CONSERVER_DEFAULTHOST CONSERVER_DEFAULTPORT
! 9614: CP CPP
! 9615: CPP_PRECOMP_FLAGS CREATE_WRKDIR_SYMLINK
! 9616: CROSSBASE CTFCONVERT
! 9617: CTF_FILES_SKIP CTF_SUPPORTED
! 9618: CTYPE CUPS_GROUP
! 9619: CUPS_SYSTEM_GROUPS CUPS_USER
! 9620: CURSES_DEFAULT CURSES_TYPE
! 9621: CXX CYRUS_GROUP
! 9622: CYRUS_IDLE CYRUS_USER
! 9623: DAEMONTOOLS_GROUP DAEMONTOOLS_LOG_USER
! 9624: DARWIN_NO_SYSTEM_LIBS DARWIN_REQUIRES_FILTER
! 9625: DBUS_GROUP DBUS_USER
! 9626: DEFANG_GROUP DEFANG_USER
! 9627: DEFAULT_ACCEPTABLE_LICENSES DEFAULT_DISTFILES
! 9628: DEFAULT_IRC_SERVER DEFAULT_SERIAL_DEVICE
! 9629: DEF_UMASK DEINSTALLDEPENDS
! 9630: DEINSTALL_SRC DEINSTALL_TEMPLATES
! 9631: DELAYED_ERROR_MSG DELAYED_WARNING_MSG
! 9632: DEPENDS DEPENDS_TARGET
! 9633: DEPENDS_TYPE DESTDIR
! 9634: DESTDIR_VARNAME DIALER_GROUP
! 9635: DIGEST_REQD DISTDIR
! 9636: DISTFILES DISTINFO_FILE
! 9637: DISTNAME DIST_PATH
! 9638: DIST_SUBDIR DJBDNS_AXFR_USER
! 9639: DJBDNS_CACHE_USER DJBDNS_DJBDNS_GROUP
! 9640: DJBDNS_LOG_USER DJBDNS_RBL_USER
! 9641: DJBDNS_TINY_USER DLOPEN_REQUIRE_PTHREADS
! 9642: DL_AUTO_VARS DL_CFLAGS
! 9643: DL_LDFLAGS DL_LIBS
! 9644: DNS DOCOWN
! 9645: DOWNLOADED_DISTFILE DT_LAYOUT
! 9646: DYNAMIC_SITES_CMD DYNAMIC_SITES_SCRIPT
! 9647: ECHO ECHO_N
! 9648: ELK_GUI EMACS_TYPE
! 9649: EMULDIR EMULSUBDIR
! 9650: EMULSUBDIRSLASH EMUL_ARCH
! 9651: EMUL_DISTRO EMUL_EXEC_FMT
! 9652: EMUL_IS_NATIVE EMUL_MODULES
! 9653: EMUL_OPSYS EMUL_PKG_FMT
! 9654: EMUL_PLATFORM EMUL_PLATFORMS
! 9655: EMUL_PREFER EMUL_REQD
! 9656: EMUL_TYPE ERROR_MSG
! 9657: EXIM_GROUP EXIM_USER
! 9658: EXPORT_SYMBOLS_LDFLAGS EXTRACTOR
! 9659: EXTRACT_CMD EXTRACT_CMD_DEFAULT
! 9660: EXTRACT_DIR EXTRACT_ELEMENTS
! 9661: EXTRACT_ENV EXTRACT_ONLY
! 9662: EXTRACT_OPTS EXTRACT_SUFX
! 9663: EXTRACT_USING FAIL
! 9664: FAILOVER_FETCH FAIL_MSG
! 9665: FAKE_NCURSES FAM
! 9666: FAM_ACCEPTED FAM_DEFAULT
! 9667: FAM_SERVER FCPATH
! 9668: FEATURE_CPPFLAGS FEATURE_LDFLAGS
! 9669: FEATURE_LIBS FETCH_AFTER_ARGS
! 9670: FETCH_BEFORE_ARGS FETCH_CMD
! 9671: FETCH_OUTPUT_ARGS FETCH_PROXY
! 9672: FETCH_RESUME_ARGS FETCH_TIMEOUT
! 9673: FETCH_USE_IPV4_ONLY FETCH_USING
! 9674: FILES_SUBST FILES_SUBST_SED
! 9675: FIX_SYSTEM_HEADERS FLUXBOX_USE_GNOME
! 9676: FLUXBOX_USE_KDE FLUXBOX_USE_XFT
! 9677: FLUXBOX_USE_XINERAMA FONTS_DIRS
! 9678: FONTS_VERBOSE FOO_HACKS_MK
! 9679: FOX_USE_XUNICODE FREEWNN_GROUP
! 9680: FREEWNN_USER FTP_PKG_URL_DIR
! 9681: FTP_PKG_URL_HOST GAMEDATAMODE
! 9682: GAMEDATA_PERMS GAMEDIRMODE
! 9683: GAMEDIR_PERMS GAMEGRP
! 9684: GAMEMODE GAMEOWN
! 9685: GAMES_GROUP GAMES_USER
! 9686: GCC GCCBASE
! 9687: GCC_REQD GCC_VERSION_SUFFIX
! 9688: GEM_BUILD GEM_CLEANBUILD
! 9689: GEM_CLEANBUILD_EXTENSIONS GEM_DOCDIR
! 9690: GEM_EXTSDIR GEM_HOME
! 9691: GEM_KEEPBUILD GEM_LIBDIR
! 9692: GEM_NAME GEM_PATH
! 9693: GEM_PLUGINSDIR GEM_SPECFILE
! 9694: GENERATE_PLIST GHC
! 9695: GHOSTSCRIPT_REQD GITHUB_PROJECT
! 9696: GITHUB_RELEASE GITHUB_SUBMODULES
! 9697: GITHUB_TAG GITHUB_TYPE
! 9698: GNU GNU_CONFIGURE
! 9699: GNU_CONFIGURE_INFODIR GNU_CONFIGURE_MANDIR
! 9700: GNU_CONFIGURE_QUIET GNU_CONFIGURE_STRICT
! 9701: GODEP_REDIRECTS GO_BUILD_PATTERN
! 9702: GO_DEPS GO_DIST_BASE
! 9703: GO_EXTRA_MOD_DIRS GO_MODULE_FILES
! 9704: GO_SRCPATH GO_VERSION_DEFAULT
! 9705: GROUP_SPECIFIC_PKGS GRUB_NETWORK_CARDS
! 9706: GRUB_PRESET_COMMAND GRUB_SCAN_ARGS
! 9707: GZIP HASKELL_ENABLE_HADDOCK_DOCUMENTATION
! 9708: HASKELL_ENABLE_LIBRARY_PROFILING HASKELL_ENABLE_SHARED_LIBRARY
! 9709: HASKELL_OPTIMIZATION_LEVEL HAS_CONFIGURE
! 9710: HEADER_TEMPLATES HOMEPAGE
! 9711: HOST_PKGTOOLS_ARGS HOST_SPECIFIC_PKGS
! 9712: HOWL_GROUP HOWL_USER
! 9713: ICCBASE ICECAST_CHROOTDIR
! 9714: ICON_THEMES IDOBASE
! 9715: IGNORE_CCACHE IGNORE_INFO_DIRS
! 9716: IGNORE_INTERACTIVE_FETCH IMAKE
! 9717: IMAKEOPTS IMAKE_MAKE
! 9718: IMAKE_MANINSTALL IMAP_UW_CCLIENT_MBOX_FMT
! 9719: IMDICTDIR INCOMPAT_CURSES
! 9720: INFO_DIR INFO_FILES
! 9721: INFO_FILES_VERBOSE INFO_MSG
! 9722: INIT_SYSTEM INN_DATA_DIR
! 9723: INN_GROUP INN_USER
! 9724: INSTALLATION_DIRS INSTALLATION_DIRS_FROM_PLIST
! 9725: INSTALL_ENV INSTALL_SH_OVERRIDE
! 9726: INSTALL_SRC INSTALL_TEMPLATES
! 9727: INSTALL_UNSTRIPPED IRCD_HYBRID_IRC_GROUP
! 9728: IRCD_HYBRID_IRC_USER IRCD_HYBRID_MAXCONN
! 9729: IRCD_HYBRID_NICLEN IRCD_HYBRID_SYSLOG_EVENTS
! 9730: IRCD_HYBRID_SYSLOG_FACILITY IRCD_HYBRID_TOPICLEN
! 9731: IRIX IRRD_USE_PGP
! 9732: JABBERD_GROUP JABBERD_LOGDIR
! 9733: JABBERD_PIDDIR JABBERD_SPOOLDIR
! 9734: JABBERD_USER JAKARTA_HOME
! 9735: JAVA_BINPREFIX JAVA_CLASSPATH
! 9736: JAVA_HOME JAVA_LD_LIBRARY_PATH
! 9737: JAVA_NAME JAVA_UNLIMIT
! 9738: JAVA_WRAPPERS JPEG_ACCEPTED
! 9739: JPEG_DEFAULT KERBEROS
! 9740: KERMIT_SUID_UUCP KJS_USE_PCRE
! 9741: KNEWS_DOMAIN_FILE KNEWS_DOMAIN_NAME
! 9742: KRB5_ACCEPTED KRB5_DEFAULT
! 9743: LANGUAGES LAPACKE_LIBS
! 9744: LAPACK_LIBS LATEX2HTML_ICONPATH
! 9745: LDCONFIG_ADD_CMD LDCONFIG_REMOVE_CMD
! 9746: LEAFNODE_DATA_DIR LEAFNODE_GROUP
! 9747: LEAFNODE_USER LIBDVDCSS_HOMEPAGE
! 9748: LIBDVDCSS_MASTER_SITES LIBRSVG_TYPE
! 9749: LIBTOOL LIBTOOLIZE_PLIST
! 9750: LIBTOOL_M4_OVERRIDE LIBUSB_TYPE
! 9751: LICENSE LINKER_RPATH_FLAG
! 9752: LINK_RPATH_FLAG LINUX_LOCALES
! 9753: LOCALBASE LOCALBASE_LOCKTYPE
! 9754: LOCALPATCHES LOVE_DATA
! 9755: LOVE_GAME LOVE_VERSION
! 9756: LP32PLATFORMS LP64PLATFORMS
! 9757: MACHINE_PLATFORM MAILAGENT_DOMAIN
! 9758: MAILAGENT_EMAIL MAILAGENT_FQDN
! 9759: MAILAGENT_ORGANIZATION MAJORDOMO_HOMEDIR
! 9760: MAKEINFO_ARGS MAKE_DIRS
! 9761: MAKE_DIRS_PERMS MAKE_ENV
! 9762: MAKE_FILE MAKE_FLAGS
! 9763: MAKE_JOBS MAKE_JOBS_SAFE
! 9764: MAKE_PROGRAM MANCOMPRESSED_IF_MANZ
! 9765: MANINSTALL MANZ
! 9766: MASTER_SITES MASTER_SITE_BACKUP
! 9767: MASTER_SITE_LOCAL MASTER_SITE_MOZILLA
! 9768: MASTER_SITE_OVERRIDE MASTER_SITE_PERL_CPAN
! 9769: MASTER_SORT MASTER_SORT_RANDOM
! 9770: MASTER_SORT_REGEX MECAB_CHARSET
! 9771: MEDIATOMB_GROUP MEDIATOMB_USER
! 9772: MIPSPROBASE MIREDO_GROUP
! 9773: MIREDO_USER MISSING_FEATURES
! 9774: MKDIR MKPIE_SUPPORTED
! 9775: MLDONKEY_GROUP MLDONKEY_HOME
! 9776: MLDONKEY_USER MONOTONE_GROUP
! 9777: MONOTONE_USER MOTIFBASE
! 9778: MOTIF_TYPE MOTIF_TYPE_DEFAULT
! 9779: MPI_TYPE MSGFMT_STRIP_MSGCTXT
! 9780: MSGFMT_STRIP_MSGID_PLURAL MTOOLS_ENABLE_FLOPPYD
! 9781: MV MYSQL_CHARSET
! 9782: MYSQL_DATADIR MYSQL_EXTRA_CHARSET
! 9783: MYSQL_GROUP MYSQL_USER
! 9784: MYSQL_VERSION MYSQL_VERSIONS_ACCEPTED
! 9785: MYSQL_VERSIONS_ALL MYSQL_VERSION_DEFAULT
! 9786: NAGIOSCMD_GROUP NAGIOSDIR
! 9787: NAGIOS_GROUP NAGIOS_USER
! 9788: NATIVE_APPEND_ABI NATIVE_APPEND_ELF
! 9789: NATIVE_EXEC_FMT NATIVE_MACHINE_PLATFORM
! 9790: NATIVE_OBJECT_FMT NBPAX_PROGRAM_PREFIX
! 9791: NETBSD_LOGIN_NAME NMH_EDITOR
! 9792: NMH_MTA NMH_PAGER
! 9793: NOLOGIN NOTE
! 9794: NOT_FOR_PLATFORM NOT_PAX_ASLR_SAFE
! 9795: NOT_PAX_MPROTECT_SAFE NO_BUILD
! 9796: NO_CHECKSUM NO_CONFIGURE
! 9797: NO_SKIP NS_PREFERRED
! 9798: NULLMAILER_GROUP NULLMAILER_USER
! 9799: OASIS OASIS_BUILD_ARGS
! 9800: OBJHOSTNAME OBJMACHINE
! 9801: OCAML_FINDLIB_DIRS OCAML_FINDLIB_REGISTER
! 9802: OCAML_FINDLIB_REGISTER_VERBOSE OCAML_SITELIBDIR
! 9803: OCAML_TOPKG_DOCDIR OCAML_USE_DUNE
! 9804: OCAML_USE_FINDLIB OCAML_USE_JBUILDER
! 9805: OCAML_USE_OASIS OCAML_USE_OASIS_DYNRUN
! 9806: OCAML_USE_OPAM OCAML_USE_OPT_COMPILER
! 9807: OCAML_USE_TOPKG OMF
! 9808: ONLY_FOR_COMPILER ONLY_FOR_PLATFORM
! 9809: OPENSSH_CHROOT OPENSSH_GROUP
! 9810: OPENSSH_USER OPSYS
! 9811: OPSYS_EMULDIR OS
! 9812: OSS_TYPE OSX
! 9813: OSX_TOLERATE_SDK_SKEW OS_VARIANT
! 9814: OS_VERSION OTF_FONTS_DIR
! 9815: OVERRIDE_DIRDEPTH OVERRIDE_GEMSPEC
! 9816: OVERRIDE_GNU_CONFIG_SCRIPTS OWN_DIRS
! 9817: OWN_DIRS_PERMS P4GROUP
! 9818: P4PORT P4ROOT
! 9819: P4USER PACKAGES
! 9820: PALMOS_DEFAULT_SDK PAMBASE
! 9821: PAM_DEFAULT PAPERSIZE
! 9822: PASSIVE_FETCH PATCHDIR
! 9823: PATCHFILES PATCH_ARGS
! 9824: PATCH_DEBUG PATCH_DIST_ARGS
! 9825: PATCH_DIST_CAT PATCH_DIST_STRIP
! 9826: PATCH_FUZZ_FACTOR PATCH_STRIP
! 9827: PATH PCCBASE
! 9828: PEAR_CMD PEAR_LIB
! 9829: PEAR_PACKAGE_XML PERL5
! 9830: PERL5_CONFIGURE PERL5_CONFIGURE_DIRS
! 9831: PERL5_LDFLAGS PERL5_LICENSE
! 9832: PERL5_MODULE_TYPE PERL5_PACKLIST
! 9833: PERL5_PACKLIST_DIR PERL5_PERLBASE
! 9834: PERL5_SITEBASE PERL5_USE_PACKLIST
! 9835: PERL5_VENDORBASE PFCTL
! 9836: PFVAR_H PF_VERSION
! 9837: PGGROUP PGHOME
! 9838: PGPKGSRCDIR PGSQL_TYPE
! 9839: PGSQL_VERSION PGSQL_VERSIONS_ACCEPTED
! 9840: PGSQL_VERSION_DEFAULT PGUSER
! 9841: PG_LIB_EXT PHP
! 9842: PHPCOMMON_MK PHPPKGSRCDIR
! 9843: PHP_BASE_VERS PHP_CHECK_INSTALLED
! 9844: PHP_EXTENSION_DIR PHP_INITIAL_TEENY
! 9845: PHP_PKG_PREFIX PHP_VERSION
! 9846: PHP_VERSIONS_ACCEPTED PHP_VERSIONS_INCOMPATIBLE
! 9847: PHP_VERSION_DEFAULT PHP_VERSION_REQD
! 9848: PILRC_USE_GTK PKGCONFIG_BASE
! 9849: PKGCONFIG_FILE PKGCONFIG_OVERRIDE
! 9850: PKGCONFIG_OVERRIDE_STAGE PKGDIR
! 9851: PKGGNUDIR PKGINFODIR
! 9852: PKGLOCALEDIR PKGMANDIR
! 9853: PKGNAME PKGNAME_REQD
! 9854: PKGPATH PKGREVISION
! 9855: PKGSRC_BLAS_TYPES PKGSRC_CHANGES
! 9856: PKGSRC_COMPILER PKGSRC_KEEP_BIN_PKGS
! 9857: PKGSRC_LOCKTYPE PKGSRC_MAKE_ENV
! 9858: PKGSRC_MESSAGE_RECIPIENTS PKGSRC_MKPIE
! 9859: PKGSRC_MKREPRO PKGSRC_RUN_TEST
! 9860: PKGSRC_SETENV PKGSRC_SLEEPSECS
! 9861: PKGSRC_TODO PKGSRC_USE_CTF
! 9862: PKGSRC_USE_FORTIFY PKGSRC_USE_RELRO
! 9863: PKGSRC_USE_SSP PKGSRC_USE_STACK_CHECK
! 9864: PKGTASKS_DATAFILE PKGTOOLS_ARGS
! 9865: PKGTOOLS_ENV PKG_ALTERNATIVES
! 9866: PKG_APACHE PKG_APACHE_ACCEPTED
! 9867: PKG_APACHE_DEFAULT PKG_BEST_EXISTS
! 9868: PKG_BUILD_OPTIONS PKG_COMPRESSION
! 9869: PKG_CONFIG PKG_CONFIG_PERMS
! 9870: PKG_CREATE_USERGROUP PKG_DB_TMPDIR
! 9871: PKG_DEBUG_LEVEL PKG_DEFAULT_OPTIONS
! 9872: PKG_DESTDIR_SUPPORT PKG_DEVELOPER
! 9873: PKG_DISABLED_OPTIONS PKG_FATAL_ERRORS
! 9874: PKG_FC PKG_FILELIST_CMD
! 9875: PKG_GECOS PKG_GID
! 9876: PKG_GROUPS PKG_GROUPS_VARS
! 9877: PKG_HOME PKG_INIT_SCRIPTS
! 9878: PKG_JAVA_HOME PKG_JVM
! 9879: PKG_JVMS_ACCEPTED PKG_JVM_DEFAULT
! 9880: PKG_LEGACY_OPTIONS PKG_LIBTOOL
! 9881: PKG_OPTIONS PKG_OPTIONS_DEPRECATED_WARNINGS
! 9882: PKG_OPTIONS_LEGACY_OPTS PKG_OPTIONS_LEGACY_VARS
! 9883: PKG_OPTIONS_NONEMPTY_SETS PKG_OPTIONS_OPTIONAL_GROUPS
! 9884: PKG_OPTIONS_REQUIRED_GROUPS PKG_OPTIONS_VAR
! 9885: PKG_PHP PKG_PHP_MAJOR_VERS
! 9886: PKG_PHP_VERSION PKG_RCD_SCRIPTS
! 9887: PKG_REFCOUNT_DBDIR PKG_REGISTER_SHELLS
! 9888: PKG_RESUME_TRANSFERS PKG_SHELL
! 9889: PKG_SUGGESTED_OPTIONS PKG_SUPPORTED_OPTIONS
! 9890: PKG_SYSCONFBASE PKG_SYSCONFBASEDIR
! 9891: PKG_SYSCONFDIR PKG_SYSCONFDIR_PERMS
! 9892: PKG_SYSCONFSUBDIR PKG_SYSCONFVAR
! 9893: PKG_TOOLS_BIN PKG_UID
! 9894: PKG_UPDATE_FONTS_DB PKG_USERS
! 9895: PKG_USERS_VARS PKG_VERBOSE
! 9896: PLEASE PLIST
! 9897: PLIST_AWK PLIST_AWK_ENV
! 9898: PLIST_SRC PLIST_SUBST
! 9899: PLIST_TYPE PLIST_VARS
! 9900: POPTOP_USE_MPPE POSSIBLE_GFORTRAN_VERSION
! 9901: POST_FETCH_HOOK PREFER
! 9902: PREFER_NATIVE PREFER_NATIVE_PTHREADS
! 9903: PREFER_PKGSRC PREFIX
! 9904: PREPEND_PATH PRE_ROOT_CMD
! 9905: PRIVILEGED_STAGES PS
! 9906: PTHREAD_AUTO_VARS PTHREAD_CFLAGS
! 9907: PTHREAD_LDFLAGS PTHREAD_LIBS
! 9908: PTHREAD_OPTS PTHREAD_TYPE
! 9909: PVM_SSH PYPKGPREFIX
! 9910: PYTHON_FOR_BUILD_ONLY PYTHON_SELF_CONFLICT
! 9911: PYTHON_VERSIONED_DEPENDENCIES PYTHON_VERSIONS_ACCEPTED
! 9912: PYTHON_VERSIONS_INCOMPATIBLE PYTHON_VERSION_DEFAULT
! 9913: PYTHON_VERSION_REQD PYVERSSUFFIX
! 9914: PY_NO_EGG QMAILDIR
! 9915: QMAIL_ALIAS_USER QMAIL_DAEMON_USER
! 9916: QMAIL_LOG_USER QMAIL_NOFILES_GROUP
! 9917: QMAIL_PASSWD_USER QMAIL_QMAIL_GROUP
! 9918: QMAIL_QUEUE_DIR QMAIL_QUEUE_EXTRA
! 9919: QMAIL_QUEUE_USER QMAIL_REMOTE_USER
! 9920: QMAIL_ROOT_USER QMAIL_SEND_USER
! 9921: QPOPPER_FAC QPOPPER_SPOOL_DIR
! 9922: QPOPPER_USER RAKE_NAME
! 9923: RASMOL_DEPTH RCD_SCRIPTS
! 9924: RCD_SCRIPTS_DIR RCD_SCRIPTS_EXAMPLEDIR
! 9925: RCD_SCRIPTS_MODE RCD_SCRIPTS_SHELL
! 9926: RCD_SCRIPT_SRC RDOC
! 9927: READLINE_DEFAULT READLINE_TYPE
! 9928: REAL_ROOT_GROUP REAL_ROOT_USER
! 9929: RECURSIVE_MAKE RELAY_CTRL_DIR
! 9930: RELRO_SUPPORTED REPLACE_AWK
! 9931: REPLACE_BASH REPLACE_CSH
! 9932: REPLACE_KSH REPLACE_PERL
! 9933: REPLACE_PERL6 REPLACE_PHP
! 9934: REPLACE_PYTHON REPLACE_R
! 9935: REPLACE_RUBY REPLACE_RUBY_DIRS
! 9936: REPLACE_RUBY_PAT REPLACE_SH
! 9937: REPLACE_TEXLUA REQD_DIRS
! 9938: REQD_DIRS_PERMS REQD_FILES
! 9939: REQD_FILES_MODE REQD_FILES_PERMS
! 9940: RESOLV_AUTO_VARS RESOLV_LDFLAGS
! 9941: RESOLV_LIBS RM
! 9942: ROOT_CMD ROOT_GROUP
! 9943: ROOT_USER RPCGEN
! 9944: RPM RPM2PKG_PLIST
! 9945: RPM2PKG_PREFIX RPM2PKG_STAGE
! 9946: RPM2PKG_STRIP RPM2PKG_SUBPREFIX
! 9947: RPMFILES RPMIGNOREPATH
! 9948: RPM_DB_PREFIX RSSH_CVS_PATH
! 9949: RSSH_RDIST_PATH RSSH_RSYNC_PATH
! 9950: RSSH_SCP_PATH RSSH_SFTP_SERVER_PATH
! 9951: RUBY RUBYGEM
! 9952: RUBYGEM_NAME RUBYGEM_OPTIONS
! 9953: RUBYGEM_VERBOSE RUBY_ABI_VERSION
! 9954: RUBY_ARCH RUBY_ARCHINC
! 9955: RUBY_ARCHLIB RUBY_BASE
! 9956: RUBY_BASERIDIR RUBY_BUILD_DOCUMENT
! 9957: RUBY_DLEXT RUBY_DOC
! 9958: RUBY_DYNAMIC_DIRS RUBY_EG
! 9959: RUBY_ENCODING_ARG RUBY_EXTCONF
! 9960: RUBY_EXTCONF_CHECK RUBY_EXTCONF_DEBUG
! 9961: RUBY_EXTCONF_MAKEFILE RUBY_GEM_BASE
! 9962: RUBY_INC RUBY_LIB
! 9963: RUBY_LIB_BASE RUBY_NAME
! 9964: RUBY_NOVERSION RUBY_PKGPREFIX
! 9965: RUBY_RAILS RUBY_RAILS52_VERSION
! 9966: RUBY_RAILS60_VERSION RUBY_RAILS61_VERSION
! 9967: RUBY_RAILS_ACCEPTED RUBY_RAILS_DEFAULT
! 9968: RUBY_RAILS_REQD RUBY_RAILS_STRICT_DEP
! 9969: RUBY_RIDIR RUBY_SETUP
! 9970: RUBY_SHLIB RUBY_SHLIBALIAS
! 9971: RUBY_SHLIBVER RUBY_SIMPLE_INSTALL
! 9972: RUBY_SITEARCHLIB RUBY_SITELIB
! 9973: RUBY_SITELIB_BASE RUBY_SITERIDIR
! 9974: RUBY_SLEXT RUBY_SRCDIR
! 9975: RUBY_STATICLIB RUBY_SUFFIX
! 9976: RUBY_SYSRIDIR RUBY_USE_PTHREAD
! 9977: RUBY_VENDORARCHLIB RUBY_VENDORLIB
! 9978: RUBY_VENDORLIB_BASE RUBY_VER
! 9979: RUBY_VERSION RUBY_VERSIONS_ACCEPTED
! 9980: RUBY_VERSIONS_INCOMPATIBLE RUBY_VERSION_DEFAULT
! 9981: RUBY_VERSION_REQD RUBY_VER_DIR
! 9982: RUN RUN_LDCONFIG
! 9983: SAWFISH_THEMES SCO
! 9984: SCREWS_GROUP SCREWS_USER
! 9985: SCRIPTS_ENV SCROLLKEEPER_DATADIR
! 9986: SCROLLKEEPER_REBUILDDB SCROLLKEEPER_UPDATEDB
! 9987: SDIST_PAWD SERIAL_DEVICES
! 9988: SETGIDGAME SETGID_GAMES_PERMS
! 9989: SETUID_ROOT_PERMS SH
! 9990: SHLIB SIGN_PACKAGES
! 9991: SILC_CLIENT_WITH_PERL SITE_SPECIFIC_PKGS
! 9992: SKIP_DEPENDS SMF_INSTANCES
! 9993: SMF_MANIFEST SMF_METHODS
! 9994: SMF_METHOD_SHELL SMF_METHOD_SRC
! 9995: SMF_NAME SMF_PREFIX
! 9996: SMF_SRCDIR SNIPROXY_GROUP
! 9997: SNIPROXY_USER SOURCE_BUFFSIZE
! 9998: SPECIAL_PERMS SPECIFIC_PKGS
! 9999: SSH_SUID SSP_SUPPORTED
! 10000: SSYNC_PAWD STEP_MSG
! 10001: STRIP STRIP_DBG
! 10002: STRIP_DEBUG STRIP_DEBUG_SUPPORTED
! 10003: STRIP_FILES_SKIP SU
! 10004: SUBDIR SUBST
! 10005: SUBST_CLASSES SUBST_FILES
! 10006: SUBST_FILTER_CMD SUBST_MESSAGE
! 10007: SUBST_NOOP_OK SUBST_SED
! 10008: SUBST_SHOW_DIFF SUBST_SKIP_TEXT_CHECK
! 10009: SUBST_STAGE SUBST_VARS
! 10010: SUNWSPROBASE SUSE_PREFER
! 10011: SU_CMD SYSCONFBASE
! 10012: TBL TERMCAP_TYPE
! 10013: TERMINFO_DEFAULT TERMINFO_TYPE
! 10014: TEST TEST_DEPENDS
! 10015: TEST_DIRS TEST_ENV
! 10016: TEST_ENV_SHELL TEST_MAKE_CMD
! 10017: TEST_MAKE_FLAGS TEST_TARGET
! 10018: TEXLIVE_IGNORE_PATTERNS TEXLIVE_REV
! 10019: TEXLIVE_UNVERSIONED TEXMFSITE
! 10020: TEX_FORMATS TEX_HYPHEN_DAT
! 10021: TEX_HYPHEN_DEF TEX_TEXMF_DIRS
! 10022: THTTPD_LOG_FACILITY TINYDYN_USER
! 10023: TO TOOLS_ALIASES
! 10024: TOOLS_ALWAYS_WRAP TOOLS_ARGS
! 10025: TOOLS_BROKEN TOOLS_CMD
! 10026: TOOLS_CMDLINE_SED TOOLS_CREATE
! 10027: TOOLS_DIR TOOLS_FAIL
! 10028: TOOLS_GNU_MISSING TOOLS_LDCONFIG
! 10029: TOOLS_NOOP TOOLS_PATH
! 10030: TOOLS_SCRIPT TOOL_DEPENDS
! 10031: TTF_FONTS_DIR TYPE
! 10032: UAC_REQD_EXECS UCSPI_SSL_GROUP
! 10033: UCSPI_SSL_USER UNLIMIT_RESOURCES
! 10034: UNPRIVILEGED UNPRIVILEGED_GROUP
! 10035: UNPRIVILEGED_GROUPS UNPRIVILEGED_USER
! 10036: UNWRAP_FILES UNWRAP_PATTERNS
! 10037: UPDATE_GEMSPEC UPDATE_TARGET
! 10038: URI USERGROUP_PHASE
! 10039: USERPPP_GROUP USER_SPECIFIC_PKGS
! 10040: USE_ABI_DEPENDS USE_APR
! 10041: USE_BSD_MAKEFILE USE_BUILTIN
! 10042: USE_CROSS_COMPILE USE_CURSES
! 10043: USE_CWRAPPERS USE_DB185
! 10044: USE_FEATURES USE_GAMESGROUP
! 10045: USE_GCC_RUNTIME USE_IMAKE
! 10046: USE_JAVA USE_JAVA2
! 10047: USE_LANGUAGES USE_LIBTOOL
! 10048: USE_NATIVE_GCC USE_NETBSD_REPO
! 10049: USE_PKGSRC_GCC USE_PKGSRC_GCC_RUNTIME
! 10050: USE_PKGTASKS USE_PKG_ADMIN_DIGEST
! 10051: USE_RUBY_EXTCONF USE_RUBY_INSTALL
! 10052: USE_RUBY_SETUP USE_RUBY_SETUP_PKG
! 10053: USE_TOOLS UUCP_GROUP
! 10054: UUCP_USER VARBASE
! 10055: VARNAME VIM_EXTRA_OPTS
! 10056: WARNING_MSG WCALC_CGIDIR
! 10057: WCALC_CGIPATH WCALC_HTMLDIR
! 10058: WCALC_HTMLPATH WDM_MANAGERS
! 10059: WRAPPER_CC WRAPPER_REORDER_CMDS
! 10060: WRKDIR WRKDIR_BASENAME
! 10061: WRKDIR_LOCKTYPE WRKLOG
! 10062: WRKOBJDIR WRKSRC
! 10063: X10_PORT X11
! 10064: X11BASE X11_PKGSRCDIR
! 10065: X11_TYPE X509_CERTIFICATE
! 10066: X509_KEY XAW_TYPE
! 10067: XLOCK_DEFAULT_MODE XMKMF
! 10068: XMKMF_FLAGS XXX
! 10069: YES ZSH_STATIC
! 10070: __stdc__ _vargroups
! 10071: accept acquire-localbase-lock
! 10072: acquire-lock add
! 10073: administrator alloca
! 10074: alternatives aslr
! 10075: asprintf atlas
! 10076: autoconf automake
! 10077: autoreconf awk
! 10078: bash big-endian
! 10079: bin-install bind
! 10080: binpkg-list blas
! 10081: bootstrap-depends broken
! 10082: broken_on_platform bsd
! 10083: bsd.prog.mk build
! 10084: build-env buildlink-directories
! 10085: buildlink-oss-soundcard-h c
! 10086: c++ ccache
! 10087: cce cdefs
! 10088: ceil changes
! 10089: changes-entry changes-entry-noupdate
! 10090: check check-clean
! 10091: check-files check-files-clean
! 10092: check-vulnerable checksum
! 10093: checksum-phase clean
! 10094: clean-depends cleandir
! 10095: commit commit-changes-entry
! 10096: compact compiler
! 10097: conf config.guess
! 10098: config.sub configuration
! 10099: configure configure-env
! 10100: configure-help configure_args
! 10101: connect cos
! 10102: cputime create-usergroup
! 10103: csh ctf
! 10104: debug declaration
! 10105: declare defined
! 10106: depend dependencies
! 10107: depends depends-checksum
! 10108: depends-fetch deps
! 10109: describe destdir
! 10110: disable distclean
! 10111: distinfo dl
! 10112: dlopen do-build
! 10113: do-buildlink do-clean
! 10114: do-configure do-configure-post-hook
! 10115: do-extract do-fetch
! 10116: emul emul-distinfo
! 10117: emul-fetch emulation
! 10118: emulator enable
! 10119: endian enomem
! 10120: err errx
! 10121: etc exp
! 10122: extract-rpm fabs
! 10123: feature features
! 10124: fetch fetch-list
! 10125: follows forbids
! 10126: form format
! 10127: fortify fortify_source
! 10128: friend fts
! 10129: fts_close fts_open
! 10130: fts_read fts_set
! 10131: gcc gethostbyaddr
! 10132: gethostbyname gethostbyname2
! 10133: getopt_long getprogname
! 10134: getservbyname getservbyport
! 10135: getservent gettext
! 10136: github glob
! 10137: gnu gnu_configure_strict
! 10138: go go-deps
! 10139: golang guess-license
! 10140: hashbang heimdal
! 10141: help imake
! 10142: increment inet_aton
! 10143: interp interpreter
! 10144: intl ip4
! 10145: ip6 ipv4
! 10146: ipv6 iso
! 10147: kerberos krb
! 10148: krb5 ksh
! 10149: lapack latex
! 10150: libintl_bindtextdomain libintl_gettext
! 10151: libintl_textdomain libnbcompat
! 10152: libs libtool
! 10153: licence license
! 10154: lintl little-endian
! 10155: lock locking
! 10156: lvalue make
! 10157: makesum memory
! 10158: meta meta-package
! 10159: meta_package mit-krb5
! 10160: mk.conf mkl
! 10161: mount mprotect
! 10162: mremap nb
! 10163: nbcompat netlib
! 10164: obstack obstack_ptr_grow
! 10165: occurs only
! 10166: openblas options
! 10167: options.mk order
! 10168: override override-intltool
! 10169: override-message-intltool package
! 10170: parallel path
! 10171: pax paxctl
! 10172: pbulk-index pc
! 10173: perl perl5
! 10174: perms php
! 10175: pkg-build-options pkg-config
! 10176: pkg_build_options platform
! 10177: plist post-extract
! 10178: post-fetch post-wrapper
! 10179: pre-build-checks-hook pre-configure
! 10180: pre-configure-checks-hook pre-extract
! 10181: pre-fetch print-go-deps
! 10182: print-plist print-summary-data
! 10183: privileged-install-hook pypi
! 10184: python readme-all
! 10185: recv recvfrom
! 10186: regcomp release-localbase-lock
! 10187: release-lock relro
! 10188: rename reorder
! 10189: replace replace_interpreter
! 10190: reproducible resolv
! 10191: root ruby
! 10192: send sendfile
! 10193: sendto setenv
! 10194: setgid setprogname
! 10195: setuid sh
! 10196: shebang show
! 10197: show-all show-build-defs
! 10198: show-depends show-deps
! 10199: show-distfiles show-downlevel
! 10200: show-subdir-var show-tools
! 10201: show-var show-vars
! 10202: snprintf socket
! 10203: ssp st_mode
! 10204: stage-install strcasestr
! 10205: strict strip
! 10206: strndup strnlen
! 10207: strsep subst
! 10208: substitutions sun
! 10209: sunpro sunwspro
! 10210: symlink test
! 10211: test-env tex
! 10212: texlive tmp
! 10213: tool tools
! 10214: tools-libtool-m4-override type
! 10215: ulimit undefined
! 10216: undo-replace unlimit
! 10217: unprivileged unprivileged-install-hook
! 10218: unstripped update
! 10219: upload upload-distfiles
! 10220: use_tools user
! 10221: utimes vasprintf
! 10222: verbose vsnprintf
! 10223: warn warning
! 10224: warnings warnx
! 10225: wattr_off wattr_on
! 10226: work wrapper
! 10227: wrkdir
1.154 rillig 10228:
1.207 leot 10229: Appendix F. Editing guidelines for the pkgsrc guide
1.1 dsieger 10230:
10231: Table of Contents
10232:
1.207 leot 10233: F.1. Make targets
10234: F.2. Procedure
1.1 dsieger 10235:
10236: This section contains information on editing the pkgsrc guide itself.
10237:
1.207 leot 10238: F.1. Make targets
1.1 dsieger 10239:
10240: The pkgsrc guide's source code is stored in pkgsrc/doc/guide/files, and several
10241: files are created from it:
10242:
10243: * pkgsrc/doc/pkgsrc.txt
10244:
10245: * pkgsrc/doc/pkgsrc.html
10246:
1.174 leot 10247: * https://www.NetBSD.org/docs/pkgsrc/
1.1 dsieger 10248:
1.174 leot 10249: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.pdf: The PDF version of the
10250: pkgsrc guide.
1.1 dsieger 10251:
1.174 leot 10252: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.ps: PostScript version of the
1.2 rillig 10253: pkgsrc guide.
1.1 dsieger 10254:
1.207 leot 10255: F.2. Procedure
1.1 dsieger 10256:
10257: The procedure to edit the pkgsrc guide is:
10258:
1.190 bacon 10259: 1. Make sure you have checked out the htdocs repository into a sibling
10260: directory of your pkgsrc directory. You will need the ability to commit
10261: from both pkgsrc and htdocs.
10262:
10263: 2. Make sure you have the packages needed to regenerate the pkgsrc guide (and
1.46 obache 10264: other XML-based NetBSD documentation) installed. These are automatically
10265: installed when you install the meta-pkgs/pkgsrc-guide-tools package.
1.1 dsieger 10266:
1.190 bacon 10267: 3. Run cd doc/guide to get to the right directory. All further steps will take
1.1 dsieger 10268: place here.
10269:
1.190 bacon 10270: 4. Edit the XML file(s) in files/.
1.1 dsieger 10271:
1.190 bacon 10272: 5. Run bmake to check the pkgsrc guide for valid XML and to build the final
1.1 dsieger 10273: output files. If you get any errors at this stage, you can just edit the
10274: files, as there are only symbolic links in the working directory, pointing
10275: to the files in files/.
10276:
1.190 bacon 10277: 6. (cd files && cvs commit)
1.1 dsieger 10278:
1.190 bacon 10279: 7. Run bmake clean && bmake to regenerate the output files with the proper RCS
1.1 dsieger 10280: Ids.
10281:
1.190 bacon 10282: 8. Run bmake regen to install and commit the files in both pkgsrc/doc and
1.1 dsieger 10283: htdocs.
10284:
10285: Note
10286:
10287: If you have added, removed or renamed some chapters, you need to
10288: synchronize them using cvs add or cvs delete in the htdocs directory.
10289:
CVSweb <webmaster@jp.NetBSD.org>