Annotation of htdocs/docs/pkgsrc/pkgsrc.txt, revision 1.207
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
7094: replaced with the full path to the perl executable.
1.1 dsieger 7095:
7096: If a particular version of perl is needed, set the PERL5_REQD variable to the
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.1 dsieger 7100: handling perl modules.
7101:
1.205 wiz 7102: 21.4.5. Packages containing shell scripts
1.41 wiz 7103:
7104: REPLACE_SH, REPLACE_BASH, REPLACE_CSH, and REPLACE_KSH can be used to replace
1.195 gutterid 7105: shell hash bangs in files. Please use the appropriate one, preferring
7106: REPLACE_SH in case this shell is sufficient. Each should contain a list of
7107: scripts, relative to WRKSRC, that you want adjusted. Every occurrence of the
7108: matching shell in a she-bang line will be replaced with the full path to the
7109: shell executable. When using REPLACE_BASH, don't forget to add bash to
7110: USE_TOOLS.
1.41 wiz 7111:
1.205 wiz 7112: 21.4.6. Other programming languages
1.1 dsieger 7113:
7114: Currently, there is no special handling for other languages in pkgsrc. If a
7115: compiler package provides a buildlink3.mk file, include that, otherwise just
7116: add a (build) dependency on the appropriate compiler package.
7117:
1.154 rillig 7118: 21.5. The build phase
1.1 dsieger 7119:
7120: The most common failures when building a package are that some platforms do not
7121: provide certain header files, functions or libraries, or they provide the
7122: functions in a library that the original package author didn't know. To work
7123: around this, you can rewrite the source code in most cases so that it does not
7124: use the missing functions or provides a replacement function.
7125:
1.154 rillig 7126: 21.5.1. Compiling C and C++ code conditionally
1.1 dsieger 7127:
7128: If a package already comes with a GNU configure script, the preferred way to
7129: fix the build failure is to change the configure script, not the code. In the
7130: other cases, you can utilize the C preprocessor, which defines certain macros
7131: depending on the operating system and hardware architecture it compiles for.
7132: These macros can be queried using for example #if defined(__i386). Almost every
7133: operating system, hardware architecture and compiler has its own macro. For
7134: example, if the macros __GNUC__, __i386__ and __NetBSD__ are all defined, you
7135: know that you are using NetBSD on an i386 compatible CPU, and your compiler is
7136: GCC.
7137:
7138: The list of the following macros for hardware and operating system depends on
7139: the compiler that is used. For example, if you want to conditionally compile
7140: code on Solaris, don't use __sun__, as the SunPro compiler does not define it.
7141: Use __sun instead.
7142:
1.154 rillig 7143: 21.5.1.1. C preprocessor macros to identify the operating system
1.1 dsieger 7144:
7145: To distinguish between 4.4 BSD-derived systems and the rest of the world, you
7146: should use the following code.
7147:
7148: #include <sys/param.h>
7149: #if (defined(BSD) && BSD >= 199306)
7150: /* BSD-specific code goes here */
7151: #else
7152: /* non-BSD-specific code goes here */
7153: #endif
7154:
7155: If this distinction is not fine enough, you can also test for the following
7156: macros.
7157:
1.46 obache 7158: Cygwin __CYGWIN__
7159: DragonFly __DragonFly__
1.1 dsieger 7160: FreeBSD __FreeBSD__
1.46 obache 7161: Haiku __HAIKU__
1.1 dsieger 7162: Interix __INTERIX
7163: IRIX __sgi (TODO: get a definite source for this)
7164: Linux linux, __linux, __linux__
1.83 dholland 7165: Mac OS X __APPLE__
1.46 obache 7166: MirBSD __MirBSD__ (__OpenBSD__ is also defined)
7167: Minix3 __minix
1.1 dsieger 7168: NetBSD __NetBSD__
7169: OpenBSD __OpenBSD__
7170: Solaris sun, __sun
7171:
1.154 rillig 7172: 21.5.1.2. C preprocessor macros to identify the hardware architecture
1.1 dsieger 7173:
7174: i386 i386, __i386, __i386__
7175: MIPS __mips
7176: SPARC sparc, __sparc
7177:
1.154 rillig 7178: 21.5.1.3. C preprocessor macros to identify the compiler
1.1 dsieger 7179:
7180: GCC __GNUC__ (major version), __GNUC_MINOR__
7181: MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41)
7182: SunPro __SUNPRO_C (0x570 for Sun C 5.7)
7183: SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8)
7184:
1.154 rillig 7185: 21.5.2. How to handle compiler bugs
1.1 dsieger 7186:
7187: Some source files trigger bugs in the compiler, based on combinations of
7188: compiler version and architecture and almost always relation to optimisation
7189: being enabled. Common symptoms are gcc internal errors or never finishing
7190: compiling a file.
7191:
7192: Typically, a workaround involves testing the MACHINE_ARCH and compiler version,
1.87 tnn 7193: disabling optimisation for that combination of file, MACHINE_ARCH and compiler.
7194:
7195: This used to be a big problem in the past, but is rarely needed now as compiler
7196: technology has matured. If you still need to add a compiler specific
7197: workaround, please do so in the file hacks.mk and describe the symptom and
7198: compiler version as detailed as possible.
1.1 dsieger 7199:
1.172 rillig 7200: 21.5.3. No such file or directory
7201:
7202: Compilation sometimes fails with an error message like this:
7203:
7204: .../x11/gtk3/work/gtk+-3.24.12/gdk/gdktypes.h:35:10:
7205: fatal error: pango/pango.h: No such file or directory
7206:
7207: The proper way to fix this problem depends on the type of the header, which is
7208: described in the following sections.
7209:
7210: 21.5.3.1. Headers from other packages
7211:
7212: If the header name looks like it comes from a different package, that other
7213: package should be included via the buildlink3 framework.
7214:
7215: First, look whether the header is somewhere in the buildlink3 directory below
7216: WRKDIR. In the above case of the missing Pango header:
7217:
7218: $ find work/.buildlink/ -print | grep -F pango/pango.h
7219:
7220: In the case of Pango, the output is:
7221:
7222: work/.buildlink/include/pango-1.0/pango/pango.h
7223:
7224: If the pango/pango.h file were placed directly in the .buildlink directory, it
7225: would have been found automatically. There is an extra pango-1.0 path component
7226: though, which means that the compiler command line must contain an option of
7227: the form -I${BUILDLINK3_PREFIX.pango}/include/pango-1.0. In most cases this
7228: option is generated by the configure script, which can be examined using:
7229:
7230: $ $ grep -o '[-]I[^[:space:]]*/pango[^[:space:]]*' work/*/Makefile
7231: -I/usr/pkg/include/pango-1.0
7232: -I/usr/pkg/include/pango-1.0
7233: -I/usr/pkg/include/pango-1.0
7234: -I/usr/pkg/include/pango-1.0
7235: -I/usr/pkg/include/pango-1.0
7236:
7237: This looks good. These options are transformed by the buildlink wrapper to
7238: refer to the correct path inside work/.buildlink.
7239:
7240: Since the compilation fails though, examine the compiler command lines in work
7241: /.work.log to see whether the -I option is included in the particular command
7242: line.
7243:
7244: To further analyze the situation, run bmake build-env, which sets up an
7245: interactive, realistic environment including all the pkgsrc wrapper commands
7246: and environment variables. From there, try to compile some simple example
7247: programs that use the header.
7248:
7249: 21.5.3.2. Headers generated during the build
7250:
7251: If the name of the header seems to come from the package itself, and if the
7252: build is run with parallel jobs, the package may have some undeclared
7253: dependencies between the .c and the .h files, and a C file is compiled before
7254: its required header is generated.
7255:
7256: To see whether the build runs with parallel jobs, run bmake show-all-build |
7257: grep JOBS. Its output looks like this:
7258:
7259: usr MAKE_JOBS= 7
7260: pkg MAKE_JOBS_SAFE # undefined
7261: def _MAKE_JOBS_N= 7
7262:
7263: In this case the pkgsrc user has asked pkgsrc to build packages with 7 jobs in
7264: parallel (MAKE_JOBS). The package could have disabled parallel builds by
7265: setting MAKE_JOBS_SAFE to no, but in this case it hasn't.
7266:
7267: To see whether the build failure is caused by parallel builds, first save the
7268: exact error message and a bit of context, maybe you need it later for reporting
7269: a bug. Next, run:
7270:
7271: MAKE_JOBS_SAFE=no bmake clean build
7272:
7273: If that succeeds, file a bug report against the pkgsrc package, including the
7274: exact error message and the contents of your mk.conf file.
7275:
1.173 rillig 7276: 21.5.3.3. Symlinks
7277:
7278: Pkgsrc does not work reliably if any of LOCALBASE, VARBASE or WRKDIR contains a
7279: symlink. Since 2019Q2, the pkgsrc bootstrap program prevents installing pkgsrc
7280: in symlink-based directories. Existing pkgsrc installations are not checked for
7281: symlinks though.
7282:
7283: The "No such file or directory" error messages are a typical symptom of
7284: symlinks, and it's quite difficult to find out that this is the actual cause.
7285:
7286: 21.5.3.4. Stale working directories
7287:
7288: When building a hierarchy of packages, it may happen that one package is built
7289: and then pkgsrc is updated. This situation can provoke various hard to diagnose
7290: build errors. To clean up the situation:
7291:
7292: $ (cd ../../ && test -f mk/bsd.pkg.mk && rm -rf */*/work)
7293:
7294: (The test for bsd.pkg.mk just prevents running this command in the wrong
7295: directory.)
7296:
7297: If you have set WRKOBJDIR in mk.conf, remove that directory as well.
7298:
7299: 21.5.3.5. Other possible reasons
7300:
7301: On platforms other than BSD, third-party packages are installed in /usr/
7302: include, together with the base system. This means that pkgsrc cannot
7303: distinguish between headers provided by the base system (which it needs) and
7304: headers from third-party packages (which are often included in pkgsrc as well).
7305: This can lead to subtle version mismatches.
7306:
7307: In pkgsrc installations that have been active for several years, it may happen
7308: that some files are manually deleted. To exclude this unlikely reason, run
7309: pkg_admin check.
7310:
7311: It may help to run pkg_admin rebuild-tree to check/fix dependencies.
7312:
7313: If all of the above doesn't help, see Chapter 2, Getting help for contact
7314: information. Be prepared to describe what you have tried so far and what any
7315: error messages were.
7316:
1.172 rillig 7317: 21.5.4. Undefined reference to "..."
1.1 dsieger 7318:
7319: This error message often means that a package did not link to a shared library
7320: it needs. The following functions are known to cause this error message over
7321: and over.
7322:
7323: +-----------------------------------------------------+
7324: | Function |Library |Affected platforms|
7325: |-------------------------+--------+------------------|
7326: |accept, bind, connect |-lsocket|Solaris |
7327: |-------------------------+--------+------------------|
7328: |crypt |-lcrypt |DragonFly, NetBSD |
7329: |-------------------------+--------+------------------|
7330: |dlopen, dlsym |-ldl |Linux |
7331: |-------------------------+--------+------------------|
7332: |gethost* |-lnsl |Solaris |
7333: |-------------------------+--------+------------------|
7334: |inet_aton |-lresolv|Solaris |
7335: |-------------------------+--------+------------------|
7336: |nanosleep, sem_*, timer_*|-lrt |Solaris |
7337: |-------------------------+--------+------------------|
7338: |openpty |-lutil |Linux |
7339: +-----------------------------------------------------+
7340:
7341: To fix these linker errors, it is often sufficient to say LIBS.OperatingSystem+
7342: = -lfoo to the package Makefile and then say bmake clean; bmake.
7343:
1.172 rillig 7344: 21.5.4.1. Special issue: The SunPro compiler
1.1 dsieger 7345:
7346: When you are using the SunPro compiler, there is another possibility. That
7347: compiler cannot handle the following code:
7348:
7349: extern int extern_func(int);
7350:
7351: static inline int
7352: inline_func(int x)
7353: {
7354: return extern_func(x);
7355: }
7356:
7357: int main(void)
7358: {
7359: return 0;
7360: }
7361:
7362: It generates the code for inline_func even if that function is never used. This
7363: code then refers to extern_func, which can usually not be resolved. To solve
7364: this problem you can try to tell the package to disable inlining of functions.
7365:
1.172 rillig 7366: 21.5.5. Running out of memory
1.1 dsieger 7367:
7368: Sometimes packages fail to build because the compiler runs into an operating
7369: system specific soft limit. With the UNLIMIT_RESOURCES variable pkgsrc can be
1.94 wiz 7370: told to unlimit the resources. Currently, the allowed values are any
7371: combination of "cputime", "datasize", "memorysize", and "stacksize". Setting
7372: this variable is similar to running the shell builtin ulimit command to raise
7373: the maximum data segment size or maximum stack size of a process, respectively,
7374: to their hard limits.
1.1 dsieger 7375:
1.154 rillig 7376: 21.6. The install phase
1.1 dsieger 7377:
1.154 rillig 7378: 21.6.1. Creating needed directories
1.1 dsieger 7379:
7380: The BSD-compatible install supplied with some operating systems cannot create
7381: more than one directory at a time. As such, you should call ${INSTALL_*_DIR}
7382: like this:
7383:
7384: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
7385: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
7386:
7387: You can also just append "dir1 dir2" to the INSTALLATION_DIRS variable, which
7388: will automatically do the right thing.
7389:
1.154 rillig 7390: 21.6.2. Where to install documentation
1.1 dsieger 7391:
7392: In general, documentation should be installed into ${PREFIX}/share/doc/$
7393: {PKGBASE} or ${PREFIX}/share/doc/${PKGNAME} (the latter includes the version
7394: number of the package).
7395:
7396: Many modern packages using GNU autoconf allow to set the directory where HTML
7397: documentation is installed with the "--with-html-dir" option. Sometimes using
7398: this flag is needed because otherwise the documentation ends up in ${PREFIX}/
7399: share/doc/html or other places.
7400:
7401: An exception to the above is that library API documentation generated with the
7402: textproc/gtk-doc tools, for use by special browsers (devhelp) should be left at
7403: their default location, which is ${PREFIX}/share/gtk-doc. Such documentation
7404: can be recognized from files ending in .devhelp or .devhelp2. (It is also
7405: acceptable to install such files in ${PREFIX}/share/doc/${PKGBASE} or ${PREFIX}
7406: /share/doc/${PKGNAME}; the .devhelp* file must be directly in that directory
7407: then, no additional subdirectory level is allowed in this case. This is usually
7408: achieved by using "--with-html-dir=${PREFIX}/share/doc". ${PREFIX}/share/
7409: gtk-doc is preferred though.)
7410:
1.154 rillig 7411: 21.6.3. Installing highscore files
1.1 dsieger 7412:
7413: Certain packages, most of them in the games category, install a score file that
7414: allows all users on the system to record their highscores. In order for this to
7415: work, the binaries need to be installed setgid and the score files owned by the
1.36 wiz 7416: appropriate group and/or owner (traditionally the "games" user/group). Set
7417: USE_GAMESGROUP to yes to support this. The following variables, documented in
7418: more detail in mk/defaults/mk.conf, control this behaviour: GAMEDATAMODE,
1.100 leot 7419: GAMEDIRMODE, GAMES_GROUP, GAMEMODE, GAME_USER. Other useful variables are:
7420: GAMEDIR_PERMS, GAMEDATA_PERMS and SETGID_GAMES_PERMS.
7421:
7422: An example that illustrates some of the variables described above is games/
7423: moon-buggy. OWN_DIRS_PERMS is used to properly set directory permissions of the
7424: directory where the scorefile is saved, REQD_FILES_PERMS is used to create a
7425: dummy scorefile (mbscore) with the proper permissions and SPECIAL_PERMS is used
7426: to install setgid the game binary:
7427:
7428: USE_GAMESGROUP= yes
7429:
7430: BUILD_DEFS+= VARBASE
7431:
7432: OWN_DIRS_PERMS+= ${VARBASE}/games/moon-buggy ${GAMEDIR_PERMS}
7433: REQD_FILES_PERMS+= /dev/null ${VARBASE}/games/moon-buggy/mbscore ${GAMEDATA_PERMS}
7434: SPECIAL_PERMS+= ${PREFIX}/bin/moon-buggy ${SETGID_GAMES_PERMS}
7435:
7436: Various INSTALL_* variables are also available: INSTALL_GAME to install setgid
7437: game binaries, INSTALL_GAME_DIR to install game directories that are needed to
7438: be accessed by setgid games and INSTALL_GAME_DATA to install scorefiles.
1.1 dsieger 7439:
1.14 jmcneill 7440: A package should therefore never hard code file ownership or access permissions
1.100 leot 7441: but rely on *_PERMS as described above or alternatively on INSTALL_GAME,
7442: INSTALL_GAME_DATA and INSTALL_GAME_DIR to set these correctly.
1.1 dsieger 7443:
1.154 rillig 7444: 21.6.4. Adding DESTDIR support to packages
1.4 rillig 7445:
1.14 jmcneill 7446: DESTDIR support means that a package installs into a staging directory, not the
7447: final location of the files. Then a binary package is created which can be used
7448: for installation as usual. There are two ways: Either the package must install
1.25 wiz 7449: as root ("destdir") or the package can install as non-root user ("user-destdir"
7450: ).
1.14 jmcneill 7451:
1.113 leot 7452: * PKG_DESTDIR_SUPPORT has to be set to "destdir" or "user-destdir". By
7453: default PKG_DESTDIR_SUPPORT is set to "user-destdir" to help catching more
7454: potential packaging problems. If bsd.prefs.mk is included in the Makefile,
7455: PKG_DESTDIR_SUPPORT needs to be set before the inclusion.
1.14 jmcneill 7456:
1.4 rillig 7457: * All installation operations have to be prefixed with ${DESTDIR}.
7458:
7459: * automake gets this DESTDIR mostly right automatically. Many manual rules
7460: and pre/post-install often are incorrect; fix them.
7461:
1.17 imil 7462: * If files are installed with special owner/group use SPECIAL_PERMS.
1.4 rillig 7463:
7464: * In general, packages should support UNPRIVILEGED to be able to use DESTDIR.
7465:
1.154 rillig 7466: 21.6.5. Packages with hardcoded paths to other interpreters
1.1 dsieger 7467:
7468: Your package may also contain scripts with hardcoded paths to other
1.203 nia 7469: interpreters besides (or as well as) Perl. To correct the full pathname to the
1.1 dsieger 7470: script interpreter, you need to set the following definitions in your Makefile
7471: (we shall use tclsh in this example):
7472:
7473: REPLACE_INTERPRETER+= tcl
7474: REPLACE.tcl.old= .*/bin/tclsh
7475: REPLACE.tcl.new= ${PREFIX}/bin/tclsh
7476: REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
7477: # relative to ${WRKSRC}, just as in REPLACE_PERL
7478:
7479: Note
7480:
7481: Before March 2006, these variables were called _REPLACE.* and _REPLACE_FILES.*.
7482:
1.203 nia 7483: 21.6.6. Packages installing Perl modules
1.1 dsieger 7484:
7485: Makefiles of packages providing perl5 modules should include the Makefile
7486: fragment ../../lang/perl5/module.mk. It provides a do-configure target for the
7487: standard perl configuration for such modules as well as various hooks to tune
7488: this configuration. See comments in this file for details.
7489:
7490: Perl5 modules will install into different places depending on the version of
7491: perl used during the build process. To address this, pkgsrc will append lines
7492: to the PLIST corresponding to the files listed in the installed .packlist file
7493: generated by most perl5 modules. This is invoked by defining PERL5_PACKLIST to
1.48 wiz 7494: a space-separated list of packlist files relative to PERL5_PACKLIST_DIR
7495: (PERL5_INSTALLVENDORARCH by default), e.g.:
1.1 dsieger 7496:
1.48 wiz 7497: PERL5_PACKLIST= auto/Pg/.packlist
1.1 dsieger 7498:
1.48 wiz 7499: The perl5 config variables installarchlib, installscript, installvendorbin,
7500: installvendorscript, installvendorarch, installvendorlib, installvendorman1dir,
7501: and installvendorman3dir represent those locations in which components of perl5
7502: modules may be installed, provided as variable with uppercase and prefixed with
7503: PERL5_, e.g. PERL5_INSTALLARCHLIB and may be used by perl5 packages that don't
7504: have a packlist. These variables are also substituted for in the PLIST as
7505: uppercase prefixed with PERL5_SUB_.
1.1 dsieger 7506:
1.154 rillig 7507: 21.6.7. Packages installing info files
1.1 dsieger 7508:
7509: Some packages install info files or use the "makeinfo" or "install-info"
7510: commands. INFO_FILES should be defined in the package Makefile so that INSTALL
7511: and DEINSTALL scripts will be generated to handle registration of the info
7512: files in the Info directory file. The "install-info" command used for the info
7513: files registration is either provided by the system, or by a special purpose
7514: package automatically added as dependency if needed.
7515:
7516: PKGINFODIR is the directory under ${PREFIX} where info files are primarily
7517: located. PKGINFODIR defaults to "info" and can be overridden by the user.
7518:
7519: The info files for the package should be listed in the package PLIST; however
7520: any split info files need not be listed.
7521:
7522: A package which needs the "makeinfo" command at build time must add "makeinfo"
7523: to USE_TOOLS in its Makefile. If a minimum version of the "makeinfo" command is
7524: needed it should be noted with the TEXINFO_REQD variable in the package
7525: Makefile. By default, a minimum version of 3.12 is required. If the system does
7526: not provide a makeinfo command or if it does not match the required minimum, a
7527: build dependency on the devel/gtexinfo package will be added automatically.
7528:
7529: The build and installation process of the software provided by the package
7530: should not use the install-info command as the registration of info files is
1.25 wiz 7531: the task of the package INSTALL script, and it must use the appropriate
1.1 dsieger 7532: makeinfo command.
7533:
7534: To achieve this goal, the pkgsrc infrastructure creates overriding scripts for
7535: the install-info and makeinfo commands in a directory listed early in PATH.
7536:
7537: The script overriding install-info has no effect except the logging of a
7538: message. The script overriding makeinfo logs a message and according to the
7539: value of TEXINFO_REQD either runs the appropriate makeinfo command or exit on
7540: error.
7541:
1.154 rillig 7542: 21.6.8. Packages installing man pages
1.1 dsieger 7543:
7544: All packages that install manual pages should install them into the same
7545: directory, so that there is one common place to look for them. In pkgsrc, this
7546: place is ${PREFIX}/${PKGMANDIR}, and this expression should be used in
1.25 wiz 7547: packages. The default for PKGMANDIR is "man". Another often-used value is "
7548: share/man".
1.1 dsieger 7549:
7550: Note
7551:
7552: The support for a custom PKGMANDIR is far from complete.
7553:
7554: The PLIST files can just use man/ as the top level directory for the man page
7555: file entries, and the pkgsrc framework will convert as needed. In all other
7556: places, the correct PKGMANDIR must be used.
7557:
7558: Packages that are configured with GNU_CONFIGURE set as "yes", by default will
7559: use the ./configure --mandir switch to set where the man pages should be
7560: installed. The path is GNU_CONFIGURE_MANDIR which defaults to ${PREFIX}/$
7561: {PKGMANDIR}.
7562:
7563: Packages that use GNU_CONFIGURE but do not use --mandir, can set
7564: CONFIGURE_HAS_MANDIR to "no". Or if the ./configure script uses a non-standard
7565: use of --mandir, you can set GNU_CONFIGURE_MANDIR as needed.
7566:
1.184 rillig 7567: See Section 19.5, "Man page compression" for information on installation of
1.1 dsieger 7568: compressed manual pages.
7569:
1.203 nia 7570: 21.6.9. Packages installing X11 fonts
1.1 dsieger 7571:
7572: If a package installs font files, you will need to rebuild the fonts database
7573: in the directory where they get installed at installation and deinstallation
7574: time. This can be automatically done by using the pkginstall framework.
7575:
7576: You can list the directories where fonts are installed in the FONTS_DIRS.type
7577: variables, where type can be one of "ttf", "type1" or "x11". Also make sure
7578: that the database file fonts.dir is not listed in the PLIST.
7579:
7580: Note that you should not create new directories for fonts; instead use the
7581: standard ones to avoid that the user needs to manually configure his X server
7582: to find them.
7583:
1.203 nia 7584: 21.6.10. Packages installing SGML or XML data
1.1 dsieger 7585:
7586: If a package installs SGML or XML data files that need to be registered in
7587: system-wide catalogs (like DTDs, sub-catalogs, etc.), you need to take some
7588: extra steps:
7589:
7590: 1. Include ../../textproc/xmlcatmgr/catalogs.mk in your Makefile, which takes
7591: care of registering those files in system-wide catalogs at installation and
7592: deinstallation time.
7593:
7594: 2. Set SGML_CATALOGS to the full path of any SGML catalogs installed by the
7595: package.
7596:
7597: 3. Set XML_CATALOGS to the full path of any XML catalogs installed by the
7598: package.
7599:
7600: 4. Set SGML_ENTRIES to individual entries to be added to the SGML catalog.
7601: These come in groups of three strings; see xmlcatmgr(1) for more
7602: information (specifically, arguments recognized by the 'add' action). Note
7603: that you will normally not use this variable.
7604:
7605: 5. Set XML_ENTRIES to individual entries to be added to the XML catalog. These
7606: come in groups of three strings; see xmlcatmgr(1) for more information
7607: (specifically, arguments recognized by the 'add' action). Note that you
7608: will normally not use this variable.
7609:
1.203 nia 7610: 21.6.11. Packages installing extensions to the MIME database
1.1 dsieger 7611:
7612: If a package provides extensions to the MIME database by installing .xml files
7613: inside ${PREFIX}/share/mime/packages, you need to take some extra steps to
7614: ensure that the database is kept consistent with respect to these new files:
7615:
7616: 1. Include ../../databases/shared-mime-info/mimedb.mk (avoid using the
7617: buildlink3.mk file from this same directory, which is reserved for
7618: inclusion from other buildlink3.mk files). It takes care of rebuilding the
7619: MIME database at installation and deinstallation time, and disallows any
7620: access to it directly from the package.
7621:
1.25 wiz 7622: 2. Check the PLIST and remove any entries under the share/mime directory,
1.1 dsieger 7623: except for files saved under share/mime/packages. The former are handled
7624: automatically by the update-mime-database program, but the latter are
7625: package-dependent and must be removed by the package that installed them in
7626: the first place.
7627:
7628: 3. Remove any share/mime/* directories from the PLIST. They will be handled by
7629: the shared-mime-info package.
7630:
1.203 nia 7631: 21.6.12. Packages using intltool
1.1 dsieger 7632:
7633: If a package uses intltool during its build, add intltool to the USE_TOOLS,
7634: which forces it to use the intltool package provided by pkgsrc, instead of the
7635: one bundled with the distribution file.
7636:
7637: This tracks intltool's build-time dependencies and uses the latest available
7638: version; this way, the package benefits of any bug fixes that may have appeared
7639: since it was released.
7640:
1.203 nia 7641: 21.6.13. Packages installing startup scripts
1.1 dsieger 7642:
7643: If a package contains a rc.d script, it won't be copied into the startup
7644: directory by default, but you can enable it, by adding the option
1.4 rillig 7645: PKG_RCD_SCRIPTS=YES in mk.conf. This option will copy the scripts into /etc/
7646: rc.d when a package is installed, and it will automatically remove the scripts
7647: when the package is deinstalled.
1.1 dsieger 7648:
1.203 nia 7649: 21.6.14. Packages installing TeX modules
1.1 dsieger 7650:
7651: If a package installs TeX packages into the texmf tree, the ls-R database of
7652: the tree needs to be updated.
7653:
7654: Note
7655:
1.23 jakllsch 7656: Except the main TeX packages such as kpathsea, packages should install files
7657: into ${PREFIX}/share/texmf-dist, not ${PREFIX}/share/texmf.
1.1 dsieger 7658:
1.23 jakllsch 7659: 1. Include ../../print/kpathsea/texmf.mk. This takes care of rebuilding the
7660: ls-R database at installation and deinstallation time.
1.1 dsieger 7661:
1.23 jakllsch 7662: 2. If your package installs files into a texmf tree other than the one at $
7663: {PREFIX}/share/texmf-dist, set TEX_TEXMF_DIRS to the list of all texmf
7664: trees that need database update.
1.1 dsieger 7665:
7666: If your package also installs font map files that need to be registered
1.30 dholland 7667: using updmap, include ../../print/tex-tetex/map.mk and set TEX_MAP_FILES
7668: and/or TEX_MIXEDMAP_FILES to the list of all such font map files. Then
7669: updmap will be run automatically at installation/deinstallation to enable/
7670: disable font map files for TeX output drivers.
1.1 dsieger 7671:
7672: 3. Make sure that none of ls-R databases are included in PLIST, as they will
1.30 dholland 7673: be removed only by the kpathsea package.
1.1 dsieger 7674:
1.203 nia 7675: 21.6.15. Packages supporting running binaries in emulation
1.1 dsieger 7676:
7677: There are some packages that provide libraries and executables for running
7678: binaries from a one operating system on a different one (if the latter supports
7679: it). One example is running Linux binaries on NetBSD.
7680:
7681: The pkgtools/rpm2pkg helps in extracting and packaging Linux rpm packages.
7682:
7683: The CHECK_SHLIBS can be set to no to avoid the check-shlibs target, which tests
7684: if all libraries for each installed executable can be found by the dynamic
7685: linker. Since the standard dynamic linker is run, this fails for emulation
7686: packages, because the libraries used by the emulation are not in the standard
7687: directories.
7688:
1.203 nia 7689: 21.6.16. Packages installing hicolor icons
1.1 dsieger 7690:
7691: If a package installs images under the share/icons/hicolor and/or updates the
7692: share/icons/hicolor/icon-theme.cache database, you need to take some extra
7693: steps to make sure that the shared theme directory is handled appropriately and
7694: that the cache database is rebuilt:
7695:
7696: 1. Include ../../graphics/hicolor-icon-theme/buildlink3.mk.
7697:
7698: 2. Check the PLIST and remove the entry that refers to the theme cache.
7699:
7700: 3. Ensure that the PLIST does not remove the shared icon directories from the
7701: share/icons/hicolor hierarchy because they will be handled automatically.
7702:
7703: The best way to verify that the PLIST is correct with respect to the last two
7704: points is to regenerate it using make print-PLIST.
7705:
1.203 nia 7706: 21.6.17. Packages installing desktop files
1.1 dsieger 7707:
7708: If a package installs .desktop files under share/applications and these include
1.54 rodent 7709: MIME information (MimeType key), you need to take extra steps to ensure that
7710: they are registered into the MIME database:
1.1 dsieger 7711:
7712: 1. Include ../../sysutils/desktop-file-utils/desktopdb.mk.
7713:
7714: 2. Check the PLIST and remove the entry that refers to the share/applications/
7715: mimeinfo.cache file. It will be handled automatically.
7716:
7717: The best way to verify that the PLIST is correct with respect to the last point
7718: is to regenerate it using make print-PLIST.
7719:
1.154 rillig 7720: 21.7. Marking packages as having problems
1.1 dsieger 7721:
1.23 jakllsch 7722: In some cases one does not have the time to solve a problem immediately. In
7723: this case, one can plainly mark a package as broken. For this, one just sets
7724: the variable BROKEN to the reason why the package is broken (similar to the
1.162 rillig 7725: PKG_FAIL_REASON variable). A user trying to build the package will immediately
7726: be shown this message, and the build will not be even tried.
1.1 dsieger 7727:
1.23 jakllsch 7728: BROKEN packages are removed from pkgsrc in irregular intervals.
1.1 dsieger 7729:
1.184 rillig 7730: Chapter 22. GNOME packaging and porting
7731:
7732: Table of Contents
7733:
7734: 22.1. Meta packages
7735: 22.2. Packaging a GNOME application
7736: 22.3. Updating GNOME to a newer version
7737: 22.4. Patching guidelines
7738:
7739: Quoting GNOME's web site:
7740:
7741: The GNOME project provides two things: The GNOME desktop environment, an
7742: intuitive and attractive desktop for users, and the GNOME development
7743: platform, an extensive framework for building applications that integrate
7744: into the rest of the desktop.
7745:
7746: pkgsrc provides a seamless way to automatically build and install a complete
7747: GNOME environment under many different platforms. We can say with confidence
7748: that pkgsrc is one of the most advanced build and packaging systems for GNOME
7749: due to its included technologies buildlink3, the wrappers and tools framework
7750: and automatic configuration file management. Lots of efforts are put into
7751: achieving a completely clean deinstallation of installed software components.
7752:
7753: Given that pkgsrc is NetBSD's official packaging system, the above also means
7754: that great efforts are put into making GNOME work under this operating system.
7755:
7756: This chapter is aimed at pkgsrc developers and other people interested in
7757: helping our GNOME porting and packaging efforts. It provides instructions on
7758: how to manage the existing packages and some important information regarding
7759: their internals.
7760:
7761: We need your help!
7762:
7763: Should you have some spare cycles to devote to NetBSD, pkgsrc and GNOME and are
7764: willing to learn new exciting stuff, please jump straight to the pending work
7765: list! There is still a long way to go to get a fully-functional GNOME desktop
7766: under NetBSD and we need your help to achieve it!
7767:
7768: 22.1. Meta packages
7769:
7770: pkgsrc includes three GNOME-related meta packages:
7771:
7772: * meta-pkgs/gnome-base: Provides the core GNOME desktop environment. It only
7773: includes the necessary bits to get it to boot correctly, although it may
7774: lack important functionality for daily operation. The idea behind this
7775: package is to let end users build their own configurations on top of this
7776: one, first installing this meta package to achieve a functional setup and
7777: then adding individual applications.
7778:
7779: * meta-pkgs/gnome: Provides a complete installation of the GNOME platform and
7780: desktop as defined by the GNOME project; this is based on the components
7781: distributed in the platform/x.y/x.y.z/sources and desktop/x.y/x.y.z/sources
7782: directories of the official FTP server. Developer-only tools found in those
7783: directories are not installed unless required by some other component to
7784: work properly. Similarly, packages from the bindings set (bindings/x.y/
7785: x.y.z/sources) are not pulled in unless required as a dependency for an
7786: end-user component. This package "extends" meta-pkgs/gnome-base.
7787:
7788: * meta-pkgs/gnome-devel: Installs all the tools required to build a GNOME
7789: component when fetched from the CVS repository. These are required to let
7790: the autogen.sh scripts work appropriately.
7791:
7792: In all these packages, the DEPENDS lines are sorted in a way that eases
7793: updates: a package may depend on other packages listed before it but not on any
7794: listed after it. It is very important to keep this order to ease updates so...
7795: do not change it to alphabetical sorting!
7796:
7797: 22.2. Packaging a GNOME application
7798:
7799: Almost all GNOME applications are written in C and use a common set of tools as
7800: their build system. Things get different with the new bindings to other
7801: languages (such as Python), but the following will give you a general idea on
7802: the minimum required tools:
7803:
7804: * Almost all GNOME applications use the GNU Autotools as their build system.
7805: As a general rule you will need to tell this to your package:
7806:
7807: GNU_CONFIGURE=yes
7808: USE_LIBTOOL=yes
7809: USE_TOOLS+=gmake
7810:
7811: * If the package uses pkg-config to detect dependencies, add this tool to the
7812: list of required utilities:
7813:
7814: USE_TOOLS+=pkg-config
7815:
7816: Also use pkgtools/verifypc at the end of the build process to ensure that
7817: you did not miss to specify any dependency in your package and that the
7818: version requirements are all correct.
7819:
7820: * If the package uses intltool, be sure to add intltool to the USE_TOOLS to
7821: handle dependencies and to force the package to use the latest available
7822: version.
7823:
7824: * If the package uses gtk-doc (a documentation generation utility), do not
7825: add a dependency on it. The tool is rather big and the distfile should come
7826: with pregenerated documentation anyway; if it does not, it is a bug that
7827: you ought to report. For such packages you should disable gtk-doc (unless
7828: it is the default):
7829:
7830: CONFIGURE_ARGS+=--disable-gtk-doc
7831:
7832: The default location of installed HTML files (share/gtk-doc/<package-name>)
7833: is correct and should not be changed unless the package insists on
7834: installing them somewhere else. Otherwise programs as devhelp will not be
7835: able to open them. You can do that with an entry similar to:
1.1 dsieger 7836:
1.184 rillig 7837: CONFIGURE_ARGS+=--with-html-dir=${PREFIX}/share/gtk-doc/...
1.1 dsieger 7838:
1.184 rillig 7839: GNOME uses multiple shared directories and files under the installation prefix
7840: to maintain databases. In this context, shared means that those exact same
7841: directories and files are used among several different packages, leading to
7842: conflicts in the PLIST. pkgsrc currently includes functionality to handle the
7843: most common cases, so you have to forget about using @unexec ${RMDIR} lines in
7844: your file lists and omitting shared files from them. If you find yourself doing
7845: those, your package is most likely incorrect.
1.1 dsieger 7846:
1.184 rillig 7847: The following table lists the common situations that result in using shared
7848: directories or files. For each of them, the appropriate solution is given.
7849: After applying the solution be sure to regenerate the package's file list with
7850: make print-PLIST and ensure it is correct.
1.1 dsieger 7851:
1.184 rillig 7852: Table 22.1. PLIST handling for GNOME packages
1.1 dsieger 7853:
1.184 rillig 7854: +-----------------------------------------------------------------------------+
7855: | If the package... | Then... |
7856: |-------------------------------------------+---------------------------------|
1.203 nia 7857: |Installs icons under the share/icons/ |See Section 21.6.16, "Packages |
7858: |hicolor hierarchy or updates share/icons/ |installing hicolor icons". |
1.184 rillig 7859: |hicolor/icon-theme.cache. | |
7860: |-------------------------------------------+---------------------------------|
1.203 nia 7861: | |See Section 21.6.11, "Packages |
1.184 rillig 7862: |Installs files under share/mime/packages. |installing extensions to the MIME|
7863: | |database". |
7864: |-------------------------------------------+---------------------------------|
1.203 nia 7865: |Installs .desktop files under share/ |See Section 21.6.17, "Packages |
1.184 rillig 7866: |applications and these include MIME |installing desktop files". |
7867: |information. | |
7868: +-----------------------------------------------------------------------------+
1.1 dsieger 7869:
7870:
1.184 rillig 7871: 22.3. Updating GNOME to a newer version
1.1 dsieger 7872:
1.184 rillig 7873: When seeing GNOME as a whole, there are two kinds of updates:
1.1 dsieger 7874:
1.184 rillig 7875: Major update
1.1 dsieger 7876:
1.184 rillig 7877: Given that there is still a very long way for GNOME 3 (if it ever appears),
7878: we consider a major update one that goes from a 2.X version to a 2.Y one,
7879: where Y is even and greater than X. These are hard to achieve because they
7880: introduce lots of changes in the components' code and almost all GNOME
7881: distfiles are updated to newer versions. Some of them can even break API
7882: and ABI compatibility with the previous major version series. As a result,
7883: the update needs to be done all at once to minimize breakage.
1.1 dsieger 7884:
1.184 rillig 7885: A major update typically consists of around 80 package updates and the
7886: addition of some new ones.
1.1 dsieger 7887:
1.184 rillig 7888: Minor update
1.1 dsieger 7889:
1.184 rillig 7890: We consider a minor update one that goes from a 2.A.X version to a 2.A.Y
7891: one where Y is greater than X. These are easy to achieve because they do
7892: not update all GNOME components, can be done in an incremental way and do
7893: not break API nor ABI compatibility.
1.1 dsieger 7894:
1.184 rillig 7895: A minor update typically consists of around 50 package updates, although
7896: the numbers here may vary a lot.
1.1 dsieger 7897:
1.184 rillig 7898: In order to update the GNOME components in pkgsrc to a new stable release
7899: (either major or minor), the following steps should be followed:
1.1 dsieger 7900:
1.184 rillig 7901: 1. Get a list of all the tarballs that form the new release by using the
7902: following commands. These will leave the full list of the components'
7903: distfiles into the list.txt file:
1.1 dsieger 7904:
1.184 rillig 7905: % echo ls "*.tar.bz2" | \
7906: ftp -V ftp://ftp.gnome.org/pub/gnome/platform/x.y/x.y.z/sources/ | \
7907: awk '{ print $9 }' >list.txt
7908: % echo ls "*.tar.bz2" | \
7909: ftp -V ftp://ftp.gnome.org/pub/gnome/desktop/x.y/x.y.z/sources/ | \
7910: awk '{ print $9 }' >>list.txt
1.1 dsieger 7911:
1.184 rillig 7912: 2. Open each meta package's Makefile and bump their version to the release you
7913: are updating them to. The three meta packages should be always consistent
7914: with versioning. Obviously remove any PKGREVISIONs that might be in them.
1.1 dsieger 7915:
1.184 rillig 7916: 3. For each meta package, update all its DEPENDS lines to match the latest
7917: versions as shown by the above commands. Do not list any newer version
7918: (even if found in the FTP) because the meta packages are supposed to list
7919: the exact versions that form a specific GNOME release. Exceptions are
7920: permitted here if a newer version solves a serious issue in the overall
7921: desktop experience; these typically come in the form of a revision bump in
7922: pkgsrc, not in newer versions from the developers.
1.1 dsieger 7923:
1.184 rillig 7924: Packages not listed in the list.txt file should be updated to the latest
7925: version available (if found in pkgsrc). This is the case, for example, of
7926: the dependencies on the GNU Autotools in the meta-pkgs/gnome-devel meta
7927: package.
1.1 dsieger 7928:
1.184 rillig 7929: 4. Generate a patch from the modified meta packages and extract the list of
7930: "new" lines. This will provide you an outline on what packages need to be
7931: updated in pkgsrc and in what order:
1.1 dsieger 7932:
1.184 rillig 7933: % cvs diff -u gnome-devel gnome-base gnome | grep '^+D' >todo.txt
1.1 dsieger 7934:
1.184 rillig 7935: 5. For major desktop updates it is recommended to zap all your installed
7936: packages and start over from scratch at this point.
1.1 dsieger 7937:
1.184 rillig 7938: 6. Now comes the longest step by far: iterate over the contents of todo.txt
7939: and update the packages listed in it in order. For major desktop updates
7940: none of these should be committed until the entire set is completed because
7941: there are chances of breaking not-yet-updated packages.
1.1 dsieger 7942:
1.184 rillig 7943: 7. Once the packages are up to date and working, commit them to the tree one
7944: by one with appropriate log messages. At the end, commit the three meta
7945: package updates and all the corresponding changes to the doc/CHANGES-<YEAR>
7946: and pkgsrc/doc/TODO files.
1.1 dsieger 7947:
1.184 rillig 7948: 22.4. Patching guidelines
1.1 dsieger 7949:
1.184 rillig 7950: GNOME is a very big component in pkgsrc which approaches 100 packages. Please,
7951: it is very important that you always, always, always feed back any portability
7952: fixes you do to a GNOME package to the mainstream developers (see
7953: Section 12.3.5, "Feedback to the author"). This is the only way to get their
7954: attention on portability issues and to ensure that future versions can be built
7955: out-of-the box on NetBSD. The less custom patches in pkgsrc, the easier further
7956: updates are. Those developers in charge of issuing major GNOME updates will be
7957: grateful if you do that.
1.1 dsieger 7958:
1.200 cirnatda 7959: The most common places to report bugs are the GNOME's GitLab and the
7960: freedesktop.org's GitLab. Not all components use these to track bugs, but most
7961: of them do. Do not be short on your reports: always provide detailed
1.184 rillig 7962: explanations of the current failure, how it can be improved to achieve maximum
1.200 cirnatda 7963: portability and, if at all possible, provide a patch against the main Git
7964: branch. The more verbose you are, the higher chances of your patch being
7965: accepted.
1.1 dsieger 7966:
1.184 rillig 7967: Also, please avoid using preprocessor magic to fix portability issues. While
7968: the FreeBSD GNOME people are doing a great job in porting GNOME to their
7969: operating system, the official GNOME sources are now plagued by conditionals
7970: that check for __FreeBSD__ and similar macros. This hurts portability. Please
7971: see our patching guidelines (Section 12.3.4, "Patching guidelines") for more
7972: details.
1.1 dsieger 7973:
1.154 rillig 7974: Chapter 23. Submitting and Committing
1.1 dsieger 7975:
7976: Table of Contents
7977:
1.154 rillig 7978: 23.1. Submitting binary packages
7979: 23.2. Submitting source packages (for non-NetBSD-developers)
7980: 23.3. General notes when adding, updating, or removing packages
7981: 23.4. Commit Messages
7982: 23.5. Committing: Adding a package to CVS
7983: 23.6. Updating a package to a newer version
7984: 23.7. Renaming a package in pkgsrc
7985: 23.8. Moving a package in pkgsrc
1.1 dsieger 7986:
1.154 rillig 7987: 23.1. Submitting binary packages
1.1 dsieger 7988:
7989: Our policy is that we accept binaries only from pkgsrc developers to guarantee
7990: that the packages don't contain any trojan horses etc. This is not to annoy
7991: anyone but rather to protect our users! You're still free to put up your
7992: home-made binary packages and tell the world where to get them. NetBSD
1.154 rillig 7993: developers doing bulk builds and wanting to upload them please see Chapter 8,
1.66 asau 7994: Creating binary packages for everything in pkgsrc (bulk builds).
1.1 dsieger 7995:
1.154 rillig 7996: 23.2. Submitting source packages (for non-NetBSD-developers)
1.1 dsieger 7997:
7998: First, check that your package is complete, compiles and runs well; see
1.184 rillig 7999: Chapter 14, Creating a new pkgsrc package from scratch and the rest of this
8000: document. Next, generate an uuencoded gzipped tar(1) archive that contains all
8001: files that make up the package. Finally, send this package to the pkgsrc bug
8002: tracking system, either with the send-pr(1) command, or if you don't have that,
8003: go to the web page https://www.NetBSD.org/support/send-pr.html, which contains
8004: some instructions and a link to a form where you can submit packages. The
8005: sysutils/gtk-send-pr package is also available as a substitute for either of
8006: the above two tools.
1.1 dsieger 8007:
8008: In the form of the problem report, the category should be "pkg", the synopsis
8009: should include the package name and version number, and the description field
8010: should contain a short description of your package (contents of the COMMENT
1.25 wiz 8011: variable or DESCR file are OK). The uuencoded package data should go into the "
8012: fix" field.
1.1 dsieger 8013:
8014: If you want to submit several packages, please send a separate PR for each one,
8015: it's easier for us to track things that way.
8016:
8017: Alternatively, you can also import new packages into pkgsrc-wip ("pkgsrc
1.174 leot 8018: work-in-progress"); see the homepage at https://pkgsrc.org/wip/ for details.
1.1 dsieger 8019:
1.154 rillig 8020: 23.3. General notes when adding, updating, or removing packages
1.1 dsieger 8021:
8022: Please note all package additions, updates, moves, and removals in pkgsrc/doc/
8023: CHANGES-YYYY. It's very important to keep this file up to date and conforming
8024: to the existing format, because it will be used by scripts to automatically
8025: update pages on www.NetBSD.org and other sites. Additionally, check the pkgsrc/
8026: doc/TODO file and remove the entry for the package you updated or removed, in
8027: case it was mentioned there.
8028:
8029: When the PKGREVISION of a package is bumped, the change should appear in pkgsrc
8030: /doc/CHANGES-YYYY if it is security related or otherwise relevant. Mass bumps
8031: that result from a dependency being updated should not be mentioned. In all
8032: other cases it's the developer's decision.
8033:
8034: There is a make target that helps in creating proper CHANGES-YYYY entries: make
8035: changes-entry. It uses the optional CTYPE and NETBSD_LOGIN_NAME variables. The
8036: general usage is to first make sure that your CHANGES-YYYY file is up-to-date
8037: (to avoid having to resolve conflicts later-on) and then to cd to the package
8038: directory. For package updates, make changes-entry is enough. For new packages,
8039: or package moves or removals, set the CTYPE variable on the command line to
1.4 rillig 8040: "Added", "Moved", or "Removed". You can set NETBSD_LOGIN_NAME in mk.conf if
1.23 jakllsch 8041: your local login name is not the same as your NetBSD login name. The target
8042: also automatically removes possibly existing entries for the package in the
8043: TODO file. Don't forget to commit the changes, e.g. by using make
1.66 asau 8044: commit-changes-entry! If you are not using a checkout directly from
1.23 jakllsch 8045: cvs.NetBSD.org, but e.g. a local copy of the repository, you can set
8046: USE_NETBSD_REPO=yes. This makes the cvs commands use the main repository.
1.1 dsieger 8047:
1.154 rillig 8048: 23.4. Commit Messages
1.130 wiz 8049:
8050: For several years, there have been mirrors of pkgsrc in fossil, git, and hg.
8051: Standard practise when using these tools is to make the first line of a commit
8052: message function as a summary that can be read without the rest, such as is
8053: commonly done with "git log --oneline". For this reason, we have the following
8054: guidelines for pkgsrc commit messages:
8055:
1.131 wiz 8056: * Start the commit message with a line that explains the big picture in 65
1.130 wiz 8057: characters or less. When a commit is for one package, include the name of
8058: the package. For updates, include the version to which it is updated.
8059:
8060: * Leave the next line empty.
8061:
8062: * Then come the details for the commit (changes in that package, reason for a
8063: change) and any relevant PRs. Wrap this section.
8064:
8065: Here is an example:
8066:
8067: libxslt: update to 1.0.30
8068:
8069: Changes since 1.0.29:
8070: ...
8071:
8072:
8073: Here is another example:
8074:
8075: mk/bsd.pkg.mk: enable SSP by default on NetBSD
8076:
8077: (rationale)
8078:
8079:
8080: Commit messages are final: no "cvs admin" is allowed on the pkgsrc repository
8081: to change commit messages.
8082:
1.154 rillig 8083: 23.5. Committing: Adding a package to CVS
1.1 dsieger 8084:
8085: This section is only of interest for pkgsrc developers with write access to the
1.34 wiz 8086: pkgsrc repository.
8087:
8088: When the package is finished, "cvs add" the files. Start by adding the
8089: directory and then files in the directory. Don't forget to add the new package
8090: to the category's Makefile. Make sure you don't forget any files; you can check
8091: by running "cvs status". An example:
8092:
8093: $ cd .../pkgsrc/category
8094: $ cvs add pkgname
8095: $ cd pkgname
8096: $ cvs add DESCR Makefile PLIST distinfo buildlink3.mk patches
8097: $ cvs add patches/p*
8098: $ cvs status | less
1.35 wiz 8099: $ cvs commit
1.34 wiz 8100: $ cd ..
8101: $ vi Makefile # add SUBDIRS+=pkgname line
1.35 wiz 8102: $ cvs commit Makefile
1.66 asau 8103: $ cd pkgname
1.73 jnemeth 8104: $ make CTYPE=Added commit-changes-entry
1.1 dsieger 8105:
8106: The commit message of the initial import should include part of the DESCR file,
8107: so people reading the mailing lists know what the package is/does.
8108:
1.34 wiz 8109: Also mention the new package in pkgsrc/doc/CHANGES-20xx.
8110:
8111: Previously, "cvs import" was suggested, but it was much easier to get wrong
8112: than "cvs add".
1.1 dsieger 8113:
1.154 rillig 8114: 23.6. Updating a package to a newer version
1.1 dsieger 8115:
8116: Please always put a concise, appropriate and relevant summary of the changes
8117: between old and new versions into the commit log when updating a package. There
8118: are various reasons for this:
8119:
8120: * A URL is volatile, and can change over time. It may go away completely or
8121: its information may be overwritten by newer information.
8122:
8123: * Having the change information between old and new versions in our CVS
8124: repository is very useful for people who use either cvs or anoncvs.
8125:
8126: * Having the change information between old and new versions in our CVS
8127: repository is very useful for people who read the pkgsrc-changes mailing
8128: list, so that they can make tactical decisions about when to upgrade the
8129: package.
8130:
8131: Please also recognize that, just because a new version of a package has been
8132: released, it should not automatically be upgraded in the CVS repository. We
8133: prefer to be conservative in the packages that are included in pkgsrc -
8134: development or beta packages are not really the best thing for most places in
8135: which pkgsrc is used. Please use your judgement about what should go into
8136: pkgsrc, and bear in mind that stability is to be preferred above new and
8137: possibly untested features.
8138:
1.154 rillig 8139: 23.7. Renaming a package in pkgsrc
1.21 snj 8140:
8141: Renaming packages is not recommended.
8142:
1.175 gutterid 8143: When renaming packages, be sure to fix any references to the old name in other
1.21 snj 8144: Makefiles, options, buildlink files, etc.
8145:
1.175 gutterid 8146: Also, when renaming a package, please add the package name and version pattern
1.167 leot 8147: (s) of the previous package to SUPERSEDES. This may be repeated for multiple
8148: renames. The new package would be an exact replacement. Example:
8149:
8150: SUPERSEDES+= p5-IO-Compress-Zlib<2.017
8151: SUPERSEDES+= optcomp-[0-9]*
1.21 snj 8152:
8153: Note that "successor" in the CHANGES-YYYY file doesn't necessarily mean that it
8154: supersedes, as that successor may not be an exact replacement but is a
8155: suggestion for the replaced functionality.
8156:
1.154 rillig 8157: 23.8. Moving a package in pkgsrc
1.21 snj 8158:
8159: It is preferred that packages are not renamed or moved, but if needed please
8160: follow these steps.
1.1 dsieger 8161:
8162: 1. Make a copy of the directory somewhere else.
8163:
8164: 2. Remove all CVS dirs.
8165:
8166: Alternatively to the first two steps you can also do:
8167:
8168: % cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package
8169:
8170: and use that for further work.
8171:
1.25 wiz 8172: 3. Fix CATEGORIES and any DEPENDS paths that just did "../package" instead of
1.1 dsieger 8173: "../../category/package".
8174:
1.21 snj 8175: 4. In the modified package's Makefile, consider setting PREV_PKGPATH to the
8176: previous category/package pathname. The PREV_PKGPATH can be used by tools
8177: for doing an update using pkgsrc building; for example, it can search the
8178: pkg_summary(5) database for PREV_PKGPATH (if no SUPERSEDES) and then use
8179: the corresponding new PKGPATH for that moved package. Note that it may have
8180: multiple matches, so the tool should also check on the PKGBASE too. The
8181: PREV_PKGPATH probably has no value unless SUPERSEDES is not set, i.e.
8182: PKGBASE stays the same.
8183:
8184: 5. cvs import the modified package in the new place.
1.1 dsieger 8185:
1.21 snj 8186: 6. Check if any package depends on it:
1.1 dsieger 8187:
8188: % cd /usr/pkgsrc
8189: % grep /package */*/Makefile* */*/buildlink*
8190:
1.21 snj 8191: 7. Fix paths in packages from step 5 to point to new location.
1.1 dsieger 8192:
1.21 snj 8193: 8. cvs rm (-f) the package at the old location.
1.1 dsieger 8194:
1.21 snj 8195: 9. Remove from oldcategory/Makefile.
1.1 dsieger 8196:
1.21 snj 8197: 10. Add to newcategory/Makefile.
1.1 dsieger 8198:
1.21 snj 8199: 11. Commit the changed and removed files:
1.1 dsieger 8200:
8201: % cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile
8202:
8203: (and any packages from step 5, of course).
8204:
1.154 rillig 8205: Chapter 24. Frequently Asked Questions
1.1 dsieger 8206:
8207: This section contains the answers to questions that may arise when you are
8208: writing a package. If you don't find your question answered here, first have a
8209: look in the other chapters, and if you still don't have the answer, ask on the
8210: pkgsrc-users mailing list.
8211:
1.154 rillig 8212: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
8213: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
8214: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
8215: 24.4. What is the difference between BUILDLINK_LDFLAGS, BUILDLINK_LDADD and
1.1 dsieger 8216: BUILDLINK_LIBS?
1.154 rillig 8217: 24.5. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
8218: 24.6. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.1 dsieger 8219: the := inside it.
1.154 rillig 8220: 24.7. Which mailing lists are there for package developers?
8221: 24.8. Where is the pkgsrc documentation?
8222: 24.9. I have a little time to kill. What shall I do?
1.1 dsieger 8223:
1.154 rillig 8224: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
1.1 dsieger 8225:
8226: MAKEFLAGS are the flags passed to the pkgsrc-internal invocations of make
8227: (1), while MAKE_FLAGS are the flags that are passed to the MAKE_PROGRAM
8228: when building the package. [FIXME: What is .MAKEFLAGS for?]
8229:
1.154 rillig 8230: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
1.1 dsieger 8231:
8232: MAKE is the path to the make(1) program that is used in the pkgsrc
8233: infrastructure. GMAKE is the path to GNU Make, but you need to say
8234: USE_TOOLS+=gmake to use that. MAKE_PROGRAM is the path to the Make
8235: program that is used for building the package.
8236:
1.154 rillig 8237: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
1.1 dsieger 8238:
8239: CC is the path to the real C compiler, which can be configured by the
8240: pkgsrc user. PKG_CC is the path to the compiler wrapper. PKGSRC_COMPILER
8241: is not a path to a compiler, but the type of compiler that should be
8242: used. See mk/compiler.mk for more information about the latter variable.
8243:
1.154 rillig 8244: 24.4. What is the difference between BUILDLINK_LDFLAGS, BUILDLINK_LDADD and
1.1 dsieger 8245: BUILDLINK_LIBS?
8246:
8247: [FIXME]
8248:
1.154 rillig 8249: 24.5. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
1.1 dsieger 8250:
1.25 wiz 8251: For optimization reasons, some variables are only available in the "
8252: wrapper" phase and later. To "simulate" the wrapper phase, append
1.1 dsieger 8253: PKG_PHASE=wrapper to the above command.
8254:
1.154 rillig 8255: 24.6. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.1 dsieger 8256: the := inside it.
8257:
1.108 rillig 8258: The := is not really an assignment operator, although it looks like it.
8259: Instead, it is a degenerate form of ${LIST:old_string=new_string}, which
8260: is documented in the make(1) man page and which is commonly used in the
8261: form ${SRCS:.c=.o}. In the case of MASTER_SITE_*, old_string is the empty
8262: string and new_string is package/. That's where the : and the = fall
8263: together.
1.1 dsieger 8264:
1.154 rillig 8265: 24.7. Which mailing lists are there for package developers?
1.1 dsieger 8266:
8267: tech-pkg
8268:
8269: This is a list for technical discussions related to pkgsrc
8270: development, e.g. soliciting feedback for changes to pkgsrc
8271: infrastructure, proposed new features, questions related to porting
8272: pkgsrc to a new platform, advice for maintaining a package, patches
8273: that affect many packages, help requests moved from pkgsrc-users when
8274: an infrastructure bug is found, etc.
8275:
8276: pkgsrc-bugs
8277:
8278: All bug reports in category "pkg" sent with send-pr(1) appear here.
8279: Please do not report your bugs here directly; use one of the other
8280: mailing lists.
8281:
1.154 rillig 8282: 24.8. Where is the pkgsrc documentation?
1.1 dsieger 8283:
8284: There are many places where you can find documentation about pkgsrc:
8285:
8286: * The pkgsrc guide (this document) is a collection of chapters that
8287: explain large parts of pkgsrc, but some chapters tend to be outdated.
8288: Which ones they are is hard to say.
8289:
1.174 leot 8290: * On the mailing list archives (see https://mail-index.NetBSD.org/),
8291: you can find discussions about certain features, announcements of new
1.1 dsieger 8292: parts of the pkgsrc infrastructure and sometimes even announcements
8293: that a certain feature has been marked as obsolete. The benefit here
8294: is that each message has a date appended to it.
8295:
8296: * Many of the files in the mk/ directory start with a comment that
8297: describes the purpose of the file and how it can be used by the
8298: pkgsrc user and package authors. An easy way to find this
8299: documentation is to run bmake help.
8300:
8301: * The CVS log messages are a rich source of information, but they tend
8302: to be highly abbreviated, especially for actions that occur often.
8303: Some contain a detailed description of what has changed, but they are
8304: geared towards the other pkgsrc developers, not towards an average
8305: pkgsrc user. They also only document changes, so if you don't know
8306: what has been before, these messages may not be worth too much to
8307: you.
8308:
8309: * Some parts of pkgsrc are only "implicitly documented", that is the
8310: documentation exists only in the mind of the developer who wrote the
8311: code. To get this information, use the cvs annotate command to see
8312: who has written it and ask on the tech-pkg mailing list, so that
8313: others can find your questions later (see above). To be sure that the
8314: developer in charge reads the mail, you may CC him or her.
8315:
1.154 rillig 8316: 24.9. I have a little time to kill. What shall I do?
1.1 dsieger 8317:
8318: This is not really an FAQ yet, but here's the answer anyway.
8319:
8320: * Run pkg_chk -N (from the pkgtools/pkg_chk package). It will tell you
8321: about newer versions of installed packages that are available, but
8322: not yet updated in pkgsrc.
8323:
1.198 leot 8324: * Browse pkgsrc/doc/TODO -- it contains a list of suggested new
8325: packages and a list of cleanups and enhancements for pkgsrc that
8326: would be nice to have.
1.1 dsieger 8327:
1.71 wiz 8328: * Review packages for which review was requested on the tech-pkg
8329: mailing list.
1.1 dsieger 8330:
8331: Part III. The pkgsrc infrastructure internals
8332:
8333: This part of the guide deals with everything from the infrastructure that is
8334: behind the interfaces described in the developer's guide. A casual package
8335: maintainer should not need anything from this part.
8336:
8337: Table of Contents
8338:
1.184 rillig 8339: 25. Design of the pkgsrc infrastructure
1.1 dsieger 8340:
1.184 rillig 8341: 25.1. The meaning of variable definitions
8342: 25.2. Avoiding problems before they arise
8343: 25.3. Variable evaluation
1.1 dsieger 8344:
1.184 rillig 8345: 25.3.1. At load time
8346: 25.3.2. At runtime
1.1 dsieger 8347:
1.184 rillig 8348: 25.4. How can variables be specified?
8349: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8350:
1.184 rillig 8351: 25.5.1. Procedures with parameters
8352: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8353:
1.184 rillig 8354: 25.6. The order in which files are loaded
1.1 dsieger 8355:
1.184 rillig 8356: 25.6.1. The order in bsd.prefs.mk
8357: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8358:
1.184 rillig 8359: 26. Regression tests
1.1 dsieger 8360:
1.184 rillig 8361: 26.1. Running the regression tests
8362: 26.2. Adding a new regression test
1.1 dsieger 8363:
1.184 rillig 8364: 26.2.1. Overridable functions
8365: 26.2.2. Helper functions
1.1 dsieger 8366:
1.184 rillig 8367: 27. Porting pkgsrc
1.1 dsieger 8368:
1.184 rillig 8369: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8370:
1.184 rillig 8371: Chapter 25. Design of the pkgsrc infrastructure
1.1 dsieger 8372:
8373: Table of Contents
8374:
1.184 rillig 8375: 25.1. The meaning of variable definitions
8376: 25.2. Avoiding problems before they arise
8377: 25.3. Variable evaluation
1.1 dsieger 8378:
1.184 rillig 8379: 25.3.1. At load time
8380: 25.3.2. At runtime
1.1 dsieger 8381:
1.184 rillig 8382: 25.4. How can variables be specified?
8383: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8384:
1.184 rillig 8385: 25.5.1. Procedures with parameters
8386: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8387:
1.184 rillig 8388: 25.6. The order in which files are loaded
1.1 dsieger 8389:
1.184 rillig 8390: 25.6.1. The order in bsd.prefs.mk
8391: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8392:
8393: The pkgsrc infrastructure consists of many small Makefile fragments. Each such
8394: fragment needs a properly specified interface. This chapter explains how such
8395: an interface looks like.
8396:
1.184 rillig 8397: 25.1. The meaning of variable definitions
1.1 dsieger 8398:
8399: Whenever a variable is defined in the pkgsrc infrastructure, the location and
8400: the way of definition provide much information about the intended use of that
8401: variable. Additionally, more documentation may be found in a header comment or
8402: in this pkgsrc guide.
8403:
8404: A special file is mk/defaults/mk.conf, which lists all variables that are
8405: intended to be user-defined. They are either defined using the ?= operator or
8406: they are left undefined because defining them to anything would effectively
8407: mean "yes". All these variables may be overridden by the pkgsrc user in the
8408: MAKECONF file.
8409:
8410: Outside this file, the following conventions apply: Variables that are defined
8411: using the ?= operator may be overridden by a package.
8412:
8413: Variables that are defined using the = operator may be used read-only at
8414: run-time.
8415:
8416: Variables whose name starts with an underscore must not be accessed outside the
8417: pkgsrc infrastructure at all. They may change without further notice.
8418:
8419: Note
8420:
8421: These conventions are currently not applied consistently to the complete pkgsrc
8422: infrastructure.
8423:
1.184 rillig 8424: 25.2. Avoiding problems before they arise
1.1 dsieger 8425:
8426: All variables that contain lists of things should default to being empty. Two
8427: examples that do not follow this rule are USE_LANGUAGES and DISTFILES. These
8428: variables cannot simply be modified using the += operator in package Makefiles
8429: (or other files included by them), since there is no guarantee whether the
8430: variable is already set or not, and what its value is. In the case of
8431: DISTFILES, the packages "know" the default value and just define it as in the
8432: following example.
8433:
8434: DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
8435:
8436: Because of the selection of this default value, the same value appears in many
8437: package Makefiles. Similarly for USE_LANGUAGES, but in this case the default
8438: value ("c") is so short that it doesn't stand out. Nevertheless it is mentioned
8439: in many files.
8440:
1.184 rillig 8441: 25.3. Variable evaluation
1.1 dsieger 8442:
1.184 rillig 8443: 25.3.1. At load time
1.1 dsieger 8444:
8445: Variable evaluation takes place either at load time or at runtime, depending on
8446: the context in which they occur. The contexts where variables are evaluated at
8447: load time are:
8448:
8449: * The right hand side of the := and != operators,
8450:
8451: * Make directives like .if or .for,
8452:
8453: * Dependency lines.
8454:
8455: A special exception are references to the iteration variables of .for loops,
8456: which are expanded inline, no matter in which context they appear.
8457:
8458: As the values of variables may change during load time, care must be taken not
8459: to evaluate them by accident. Typical examples for variables that should not be
8460: evaluated at load time are DEPENDS and CONFIGURE_ARGS. To make the effect more
8461: clear, here is an example:
8462:
8463: CONFIGURE_ARGS= # none
8464: CFLAGS= -O
8465: CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
8466:
8467: CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
8468:
8469: CFLAGS+= -Wall
8470:
8471: This code shows how the use of the := operator can quickly lead to unexpected
8472: results. The first paragraph is fairly common code. The second paragraph
8473: evaluates the CONFIGURE_ARGS variable, which results in CFLAGS=-O. In the third
8474: paragraph, the -Wall is appended to the CFLAGS, but this addition will not
8475: appear in CONFIGURE_ARGS. In actual code, the three paragraphs from above
8476: typically occur in completely unrelated files.
8477:
1.184 rillig 8478: 25.3.2. At runtime
1.1 dsieger 8479:
8480: After all the files have been loaded, the values of the variables cannot be
8481: changed anymore. Variables that are used in the shell commands are expanded at
8482: this point.
8483:
1.184 rillig 8484: 25.4. How can variables be specified?
1.1 dsieger 8485:
8486: There are many ways in which the definition and use of a variable can be
8487: restricted in order to detect bugs and violations of the (mostly unwritten)
1.108 rillig 8488: policies. A package can be checked with pkglint -Wall to see whether it meets
8489: these rules.
1.1 dsieger 8490:
1.184 rillig 8491: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8492:
8493: Most of the .mk files fall into one of the following classes. Cases where a
8494: file falls into more than one class should be avoided as it often leads to
8495: subtle bugs.
8496:
1.184 rillig 8497: 25.5.1. Procedures with parameters
1.1 dsieger 8498:
8499: In a traditional imperative programming language some of the .mk files could be
1.198 leot 8500: described as procedures. They take some input parameters and--after
8501: inclusion--provide a result in output parameters. Since all variables in
1.23 jakllsch 8502: Makefiles have global scope care must be taken not to use parameter names that
8503: have already another meaning. For example, PKGNAME is a bad choice for a
8504: parameter name.
1.1 dsieger 8505:
8506: Procedures are completely evaluated at preprocessing time. That is, when
8507: calling a procedure all input parameters must be completely resolvable. For
8508: example, CONFIGURE_ARGS should never be an input parameter since it is very
8509: likely that further text will be added after calling the procedure, which would
8510: effectively apply the procedure to only a part of the variable. Also,
1.108 rillig 8511: references to other variables will be modified after calling the procedure.
1.1 dsieger 8512:
8513: A procedure can declare its output parameters either as suitable for use in
8514: preprocessing directives or as only available at runtime. The latter
8515: alternative is for variables that contain references to other runtime
8516: variables.
8517:
8518: Procedures shall be written such that it is possible to call the procedure more
8519: than once. That is, the file must not contain multiple-inclusion guards.
8520:
8521: Examples for procedures are mk/bsd.options.mk and mk/buildlink3/bsd.builtin.mk.
8522: To express that the parameters are evaluated at load time, they should be
8523: assigned using the := operator, which should be used only for this purpose.
8524:
1.184 rillig 8525: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8526:
8527: Action files take some input parameters and may define runtime variables. They
8528: shall not define loadtime variables. There are action files that are included
8529: implicitly by the pkgsrc infrastructure, while other must be included
8530: explicitly.
8531:
8532: An example for action files is mk/subst.mk.
8533:
1.184 rillig 8534: 25.6. The order in which files are loaded
1.1 dsieger 8535:
8536: Package Makefiles usually consist of a set of variable definitions, and include
8537: the file ../../mk/bsd.pkg.mk in the very last line. Before that, they may also
8538: include various other *.mk files if they need to query the availability of
8539: certain features like the type of compiler or the X11 implementation. Due to
8540: the heavy use of preprocessor directives like .if and .for, the order in which
8541: the files are loaded matters.
8542:
8543: This section describes at which point the various files are loaded and gives
8544: reasons for that order.
8545:
1.184 rillig 8546: 25.6.1. The order in bsd.prefs.mk
1.1 dsieger 8547:
8548: The very first action in bsd.prefs.mk is to define some essential variables
8549: like OPSYS, OS_VERSION and MACHINE_ARCH.
8550:
1.4 rillig 8551: Then, the user settings are loaded from the file specified in MAKECONF, which
8552: is usually mk.conf. After that, those variables that have not been overridden
8553: by the user are loaded from mk/defaults/mk.conf.
1.1 dsieger 8554:
8555: After the user settings, the system settings and platform settings are loaded,
8556: which may override the user settings.
8557:
8558: Then, the tool definitions are loaded. The tool wrappers are not yet in effect.
8559: This only happens when building a package, so the proper variables must be used
8560: instead of the direct tool names.
8561:
8562: As the last steps, some essential variables from the wrapper and the package
8563: system flavor are loaded, as well as the variables that have been cached in
8564: earlier phases of a package build.
8565:
1.184 rillig 8566: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8567:
8568: First, bsd.prefs.mk is loaded.
8569:
8570: Then, the various *-vars.mk files are loaded, which fill default values for
8571: those variables that have not been defined by the package. These variables may
8572: later be used even in unrelated files.
8573:
8574: Then, the file bsd.pkg.error.mk provides the target error-check that is added
8575: as a special dependency to all other targets that use DELAYED_ERROR_MSG or
8576: DELAYED_WARNING_MSG.
8577:
8578: Then, the package-specific hacks from hacks.mk are included.
8579:
8580: Then, various other files follow. Most of them don't have any dependencies on
8581: what they need to have included before or after them, though some do.
8582:
8583: The code to check PKG_FAIL_REASON and PKG_SKIP_REASON is then executed, which
8584: restricts the use of these variables to all the files that have been included
8585: before. Appearances in later files will be silently ignored.
8586:
8587: Then, the files for the main targets are included, in the order of later
8588: execution, though the actual order should not matter.
8589:
8590: At last, some more files are included that don't set any interesting variables
8591: but rather just define make targets to be executed.
8592:
1.184 rillig 8593: Chapter 26. Regression tests
1.1 dsieger 8594:
8595: Table of Contents
8596:
1.184 rillig 8597: 26.1. Running the regression tests
8598: 26.2. Adding a new regression test
1.1 dsieger 8599:
1.184 rillig 8600: 26.2.1. Overridable functions
8601: 26.2.2. Helper functions
1.1 dsieger 8602:
8603: The pkgsrc infrastructure consists of a large codebase, and there are many
8604: corners where every little bit of a file is well thought out, making pkgsrc
8605: likely to fail as soon as anything is changed near those parts. To prevent most
8606: changes from breaking anything, a suite of regression tests should go along
8607: with every important part of the pkgsrc infrastructure. This chapter describes
8608: how regression tests work in pkgsrc and how you can add new tests.
8609:
1.184 rillig 8610: 26.1. Running the regression tests
1.1 dsieger 8611:
1.25 wiz 8612: You first need to install the pkgtools/pkg_regress package, which provides the
1.1 dsieger 8613: pkg_regress command. Then you can simply run that command, which will run all
1.168 rillig 8614: tests in the regress/ directory.
1.1 dsieger 8615:
1.184 rillig 8616: 26.2. Adding a new regression test
1.1 dsieger 8617:
1.168 rillig 8618: Every directory in the regress/ directory that contains a file called spec is
1.1 dsieger 8619: considered a regression test. This file is a shell program that is included by
8620: the pkg_regress command. The following functions can be overridden to suit your
8621: needs.
8622:
1.184 rillig 8623: 26.2.1. Overridable functions
1.1 dsieger 8624:
1.108 rillig 8625: These functions do not take any parameters. Although they are called in "set -e
1.168 rillig 8626: " mode, they don't stop at the first failing command. See this Stack Overflow
1.108 rillig 8627: question for details.
1.1 dsieger 8628:
1.108 rillig 8629: do_setup
1.1 dsieger 8630:
8631: This function prepares the environment for the test. By default it does
8632: nothing.
8633:
1.108 rillig 8634: do_test
1.1 dsieger 8635:
8636: This function runs the actual test. By default, it calls TEST_MAKE with the
8637: arguments MAKEARGS_TEST and writes its output including error messages into
8638: the file TEST_OUTFILE.
8639:
1.108 rillig 8640: When defining this function, make sure that all output that needs to be
8641: checked is written to the correct output file. Example:
8642:
8643: do_test() {
8644: echo "Example output"
8645: } 1>$TEST_OUTFILE 2>&1
8646:
8647: check_result
1.1 dsieger 8648:
8649: This function is run after the test and is typically used to compare the
8650: actual output from the one that is expected. It can make use of the various
1.108 rillig 8651: helper functions from the next section. Example:
8652:
8653: check_result() {
8654: exit_status 0
8655: output_require "Example"
8656: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
8657: output_prohibit "no such file or directory"
1.169 rillig 8658: regress_fail "expected $expected but got $actual for input $input"
1.108 rillig 8659: }
1.1 dsieger 8660:
1.108 rillig 8661: do_cleanup
1.1 dsieger 8662:
8663: This function cleans everything up after the test has been run. By default
8664: it does nothing.
8665:
1.184 rillig 8666: 26.2.2. Helper functions
1.1 dsieger 8667:
1.168 rillig 8668: regress_fail message...
8669:
8670: This function makes the test fail with the given error message.
8671:
1.108 rillig 8672: exit_status expected
1.1 dsieger 8673:
1.108 rillig 8674: This function compares the exitcode of the do_test function with its first
8675: parameter. If they differ, the test will fail.
1.1 dsieger 8676:
1.108 rillig 8677: output_require regex...
1.1 dsieger 8678:
8679: This function checks for each of its parameters if the output from do_test
1.108 rillig 8680: matches the extended regular expression. If it does not, the test will
8681: fail. Example:
8682:
8683: output_require "looks fine"
8684: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
1.1 dsieger 8685:
1.177 leot 8686: output_prohibit regex...
1.1 dsieger 8687:
8688: This function checks for each of its parameters if the output from do_test
8689: () does not match the extended regular expression. If any of the regular
8690: expressions matches, the test will fail.
8691:
1.184 rillig 8692: Chapter 27. Porting pkgsrc
1.1 dsieger 8693:
8694: Table of Contents
8695:
1.184 rillig 8696: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8697:
8698: The pkgsrc system has already been ported to many operating systems, hardware
8699: architectures and compilers. This chapter explains the necessary steps to make
8700: pkgsrc even more portable.
8701:
1.184 rillig 8702: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8703:
8704: To port pkgsrc to a new operating system (called MyOS in this example), you
8705: need to touch the following files:
8706:
8707: pkgtools/bootstrap-mk-files/files/mods/MyOS.sys.mk
8708:
8709: This file contains some basic definitions, for example the name of the C
8710: compiler.
8711:
8712: mk/bsd.prefs.mk
8713:
8714: Insert code that defines the variables OPSYS, OS_VERSION, LOWER_OS_VERSION,
8715: LOWER_VENDOR, MACHINE_ARCH, OBJECT_FMT, APPEND_ELF, and the other variables
8716: that appear in this file.
8717:
8718: mk/platform/MyOS.mk
8719:
8720: This file contains the platform-specific definitions that are used by
8721: pkgsrc. Start by copying one of the other files and edit it to your needs.
8722:
8723: mk/tools/tools.MyOS.mk
8724:
8725: This file defines the paths to all the tools that are needed by one or the
8726: other package in pkgsrc, as well as by pkgsrc itself. Find out where these
8727: tools are on your platform and add them.
8728:
8729: Now, you should be able to build some basic packages, like lang/perl5, shells/
8730: bash.
8731:
8732: Appendix A. A simple example package: bison
8733:
8734: Table of Contents
8735:
8736: A.1. files
8737:
8738: A.1.1. Makefile
8739: A.1.2. DESCR
8740: A.1.3. PLIST
8741: A.1.4. Checking a package with pkglint
8742:
8743: A.2. Steps for building, installing, packaging
8744:
8745: We checked to find a piece of software that wasn't in the packages collection,
1.25 wiz 8746: and picked GNU bison. Quite why someone would want to have bison when Berkeley
1.1 dsieger 8747: yacc is already present in the tree is beyond us, but it's useful for the
8748: purposes of this exercise.
8749:
8750: A.1. files
8751:
8752: A.1.1. Makefile
8753:
1.2 rillig 8754: # $NetBSD$
1.1 dsieger 8755: #
8756:
8757: DISTNAME= bison-1.25
8758: CATEGORIES= devel
1.171 rillig 8759: MASTER_SITES= ${MASTER_SITE_GNU:=bison/}
1.1 dsieger 8760:
1.30 dholland 8761: MAINTAINER= pkgsrc-users@NetBSD.org
1.174 leot 8762: HOMEPAGE= https://www.gnu.org/software/bison/bison.html
1.1 dsieger 8763: COMMENT= GNU yacc clone
8764:
8765: GNU_CONFIGURE= yes
1.47 wiz 8766: INFO_FILES= yes
1.1 dsieger 8767:
8768: .include "../../mk/bsd.pkg.mk"
8769:
8770: A.1.2. DESCR
8771:
8772: GNU version of yacc. Can make re-entrant parsers, and numerous other
8773: improvements. Why you would want this when Berkeley yacc(1) is part
8774: of the NetBSD source tree is beyond me.
8775:
8776: A.1.3. PLIST
8777:
1.2 rillig 8778: @comment $NetBSD$
1.1 dsieger 8779: bin/bison
8780: man/man1/bison.1.gz
8781: share/bison.simple
8782: share/bison.hairy
8783:
8784: A.1.4. Checking a package with pkglint
8785:
8786: The NetBSD package system comes with pkgtools/pkglint which helps to check the
8787: contents of these files. After installation it is quite easy to use, just
1.171 rillig 8788: change to the directory of the package you wish to examine and run pkglint:
1.1 dsieger 8789:
8790: $ pkglint
1.171 rillig 8791: ERROR: Makefile: Each package must define its LICENSE.
8792: WARN: Makefile:9: HOMEPAGE should migrate from http to https.
8793: NOTE: PLIST:3: The .gz extension is unnecessary for manual pages.
8794: WARN: PLIST:5: "share/bison.hairy" should be sorted before "share/bison.simple".
8795: 1 error, 2 warnings and 1 note found.
8796: (Run "pkglint -e" to show explanations.)
8797: (Run "pkglint -fs" to show what can be fixed automatically.)
1.172 rillig 8798: (Run "pkglint -F" to automatically fix some issues.)
1.1 dsieger 8799:
8800: Depending on the supplied command line arguments (see pkglint(1)), more checks
1.170 rillig 8801: will be performed. Use e.g. pkglint -Wall for a very thorough check.
1.1 dsieger 8802:
8803: A.2. Steps for building, installing, packaging
8804:
8805: Create the directory where the package lives, plus any auxiliary directories:
8806:
8807: # cd /usr/pkgsrc/lang
8808: # mkdir bison
8809: # cd bison
8810: # mkdir patches
8811:
1.184 rillig 8812: Create Makefile, DESCR and PLIST (see Chapter 12, Package components - files,
1.1 dsieger 8813: directories and contents) then continue with fetching the distfile:
8814:
8815: # make fetch
8816: >> bison-1.25.tar.gz doesn't seem to exist on this system.
8817: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
8818: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8819: ftp: Error retrieving file: 500 Internal error
8820:
8821: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
8822: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8823: ftp: Error retrieving file: 500 Internal error
8824:
8825: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
8826: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8827: Successfully retrieved file.
8828:
8829: Generate the checksum of the distfile into distinfo:
8830:
8831: # make makedistinfo
8832:
8833: Now compile:
8834:
8835: # make
8836: >> Checksum OK for bison-1.25.tar.gz.
8837: ===> Extracting for bison-1.25
8838: ===> Patching for bison-1.25
8839: ===> Ignoring empty patch directory
8840: ===> Configuring for bison-1.25
8841: creating cache ./config.cache
8842: checking for gcc... cc
8843: checking whether we are using GNU C... yes
8844: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
8845: checking how to run the C preprocessor... cc -E
8846: checking for minix/config.h... no
8847: checking for POSIXized ISC... no
8848: checking whether cross-compiling... no
8849: checking for ANSI C header files... yes
8850: checking for string.h... yes
8851: checking for stdlib.h... yes
8852: checking for memory.h... yes
8853: checking for working const... yes
8854: checking for working alloca.h... no
8855: checking for alloca... yes
8856: checking for strerror... yes
8857: updating cache ./config.cache
8858: creating ./config.status
8859: creating Makefile
8860: ===> Building for bison-1.25
8861: 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
8862: 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
8863: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g closure.c
8864: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g conflicts.c
8865: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g derives.c
8866: 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
8867: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getargs.c
8868: 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
8869: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lalr.c
8870: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lex.c
8871: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g main.c
8872: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g nullable.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 output.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 print.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 reader.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 reduce.c
8877: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g symtab.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 warshall.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 version.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 getopt.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 getopt1.c
8882: 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
8883: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
8884: rm -f bison.s1
8885: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
8886:
8887: Everything seems OK, so install the files:
8888:
8889: # make install
8890: >> Checksum OK for bison-1.25.tar.gz.
8891: ===> Installing for bison-1.25
8892: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
8893: rm -f /usr/pkg/bin/bison
8894: cd /usr/pkg/share; rm -f bison.simple bison.hairy
8895: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
8896: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
8897: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
8898: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
8899: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
8900: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
8901: ===> Registering installation for bison-1.25
8902:
8903: You can now use bison, and also - if you decide so - remove it with pkg_delete
8904: bison. Should you decide that you want a binary package, do this now:
8905:
8906: # make package
8907: >> Checksum OK for bison-1.25.tar.gz.
8908: ===> Building package for bison-1.25
8909: Creating package bison-1.25.tgz
8910: Registering depends:.
8911: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
8912:
8913: Now that you don't need the source and object files any more, clean up:
8914:
8915: # make clean
8916: ===> Cleaning for bison-1.25
8917:
1.207 ! leot 8918: Appendix B. Security hardening
! 8919:
! 8920: Table of Contents
! 8921:
! 8922: B.1. Mechanisms
! 8923:
! 8924: B.1.1. Enabled by default
! 8925: B.1.2. Not enabled by default
! 8926:
! 8927: B.2. Caveats
! 8928:
! 8929: B.2.1. Problems with PKGSRC_MKPIE
! 8930: B.2.2. Problems with PKGSRC_USE_FORTIFY
! 8931: B.2.3. Problems with PKGSRC_USE_RELRO
! 8932: B.2.4. Problems with PKGSRC_USE_SSP
! 8933:
! 8934: B.3. Auditing the system
! 8935:
! 8936: B.3.1. Checking for PIE
! 8937: B.3.2. Checking for partial RELRO
! 8938: B.3.3. Checking for full RELRO
! 8939: B.3.4. Checking for SSP
! 8940:
! 8941: A number of mechanisms are available in pkgsrc to improve the security of the
! 8942: resulting system. This page describes the mechanisms, and gives hints about
! 8943: detecting and fixing problems.
! 8944:
! 8945: Mechanisms can be enabled individually in mk.conf, and are individually
! 8946: described below.
! 8947:
! 8948: Typically, a feature will cause some programs to fail to build or work when
! 8949: first enabled. This can be due to latent problems in the program, and can be
! 8950: due to other reasons. After enough testing to have confidence that user
! 8951: problems will be quite rare, individual mechanisms will be enabled by default.
! 8952:
! 8953: For each mechanism, see the Caveats section below for an explanation of what
! 8954: might go wrong at compile time and at run time, and how to notice and address
! 8955: these problems.
! 8956:
! 8957: B.1. Mechanisms
! 8958:
! 8959: B.1.1. Enabled by default
! 8960:
! 8961: B.1.1.1. PKGSRC_USE_FORTIFY
! 8962:
! 8963: This allows substitute wrappers to be used for some commonly used library
! 8964: functions that do not have built-in bounds checking - but could in some cases.
! 8965:
! 8966: Two mitigation levels are available:
! 8967:
! 8968: * "weak" only enables checks at compile-time.
! 8969:
! 8970: * "strong" enables checks at compile-time and runtime.
! 8971:
! 8972: "strong" has been enabled by default since pkgsrc-2017Q3.
! 8973:
! 8974: B.1.1.2. PKGSRC_USE_SSP
! 8975:
! 8976: This enables a stack-smashing protection mitigation. It is done by adding a
! 8977: guard variable to functions with vulnerable objects. The guards are initialized
! 8978: when a function is entered and then checked when the function exits. The guard
! 8979: check will fail and the program forcibly exited if the variable was modified in
! 8980: the meantime. This can happen in case of buffer overflows or memory corruption,
! 8981: and therefore exposing these bugs.
! 8982:
! 8983: Different mitigation levels are available:
! 8984:
! 8985: * "yes", which will only protect functions considered vulnerable by the
! 8986: compiler;
! 8987:
! 8988: * "all", which will protect every function;
! 8989:
! 8990: * "strong", the default, which will apply a better balance between the two
! 8991: settings above.
! 8992:
! 8993: This mitigation is supported by both GCC and clang. It may be supported in
! 8994: additional compilers, possibly under a different name. It is particularly
! 8995: useful for unsafe programming languages, such as C/C++.
! 8996:
! 8997: * "yes" is enabled by default where known supported since pkgsrc-2017Q3.
! 8998:
! 8999: * "strong" is enabled by default where known supported since pkgsrc-2021Q4.
! 9000:
! 9001: More details can be found here:
! 9002:
! 9003: * Buffer overflow protection on Wikipedia
! 9004:
! 9005: B.1.1.3. PKGSRC_MKPIE
! 9006:
! 9007: This requests the creation of PIE (Position Independent Executables) for all
! 9008: executables. The PIE mechanism is normally used for shared libraries, so that
! 9009: they can be loaded at differing addresses at runtime. PIE itself does not have
! 9010: useful security properties; however, it is necessary to fully leverage some,
! 9011: such as ASLR. Some operating systems support Address Space Layout Randomization
! 9012: (ASLR), which causes different addresses to be used each time a program is run.
! 9013: This makes it more difficult for an attacker to guess addresses and thus makes
! 9014: exploits harder to construct. With PIE, ASLR can really be applied to the
! 9015: entire program, instead of the stack and heap only.
! 9016:
! 9017: PIE executables will only be built for toolchains that are known to support
! 9018: PIE. Currently, this means NetBSD on x86, ARM, SPARC64, m68k, and MIPS.
! 9019:
! 9020: PKGSRC_MKPIE was enabled by default after the pkgsrc-2021Q3 branch.
! 9021:
! 9022: B.1.1.4. PKGSRC_USE_RELRO
! 9023:
! 9024: This also makes the exploitation of some security vulnerabilities more
! 9025: difficult in some cases.
! 9026:
! 9027: Two different mitigation levels are available:
! 9028:
! 9029: * partial: the ELF sections are reordered so that internal data sections
! 9030: precede the program's own data sections, and non-PLT GOT is read-only;
! 9031:
! 9032: * full: in addition to partial RELRO, every relocation is performed
! 9033: immediately when starting the program (with a slight performance impact),
! 9034: allowing the entire GOT to be read-only.
! 9035:
! 9036: This is currently supported by GCC. Many software distributions now enable this
! 9037: feature by default, at the "partial" level.
! 9038:
! 9039: More details can be found here:
! 9040:
! 9041: * Hardening ELF binaries using Relocation Read-Only (RELRO)
! 9042:
! 9043: B.1.2. Not enabled by default
! 9044:
! 9045: B.1.2.1. PKGSRC_MKREPRO
! 9046:
! 9047: With this option, pkgsrc will try to build packages reproducibly. This allows
! 9048: packages built from the same tree and with the same options, to produce
! 9049: identical results bit by bit. This option should be combined with ASLR and
! 9050: PKGSRC_MKPIE to avoid predictable address offsets for attackers attempting to
! 9051: exploit security vulnerabilities.
! 9052:
! 9053: More details can be found here:
! 9054:
! 9055: * Reproducible Builds - a set of software development practices that create
! 9056: an independently-verifiable path from source to binary code
! 9057:
! 9058: More work likely needs to be done before pkgsrc is fully reproducible.
! 9059:
! 9060: B.1.2.2. PKGSRC_USE_STACK_CHECK
! 9061:
! 9062: This uses -fstack-check with GCC for another stack protection mitigation.
! 9063:
! 9064: It asks the compiler to generate code verifying that it does not corrupt the
! 9065: stack. According to GCC's manual page, this is really only useful for
! 9066: multi-threaded programs.
! 9067:
! 9068: B.2. Caveats
! 9069:
! 9070: B.2.1. Problems with PKGSRC_MKPIE
! 9071:
! 9072: B.2.1.1. Packages failing to build
! 9073:
! 9074: A number of packages may fail to build with this option enabled. The failures
! 9075: are often related to the absence of the -fPIC compilation flag when building
! 9076: libraries or executables (or ideally -fPIE in the latter case). This flag is
! 9077: added to the CFLAGS already, but requires the package to actually support it.
! 9078:
! 9079: B.2.1.1.1. How to fix
! 9080:
! 9081: These instructions are meant as a reference only; they likely need to be
! 9082: adapted for many packages individually.
! 9083:
! 9084: For packages using Makefiles:
! 9085:
! 9086: MAKE_FLAGS+= CFLAGS=${CFLAGS:Q}
! 9087: MAKE_FLAGS+= LDFLAGS=${LDFLAGS:Q}
! 9088:
! 9089: For packages using Imakefiles:
! 9090:
! 9091: MAKE_FLAGS+= CCOPTIONS=${CFLAGS:Q}
! 9092: MAKE_FLAGS+= LOCAL_LDFLAGS=${LDFLAGS:Q}
! 9093:
! 9094: B.2.1.2. Run-time crashes
! 9095:
! 9096: Some programs may fail to run, or crash at random times once built as PIE. Two
! 9097: scenarios are essentially possible. This is nearly always due to a bug in the
! 9098: program being exposed due to ASLR.
! 9099:
! 9100: B.2.1.3. Disabling PKGSRC_MKPIE on a per-package basis
! 9101:
! 9102: Ideally, packages should be fixed for compatibility with MKPIE. However, in
! 9103: some cases this is very difficult, due to complex build systems, packages using
! 9104: non-standard toolchains, or programming languages with odd bootstrapping
! 9105: mechanisms.
! 9106:
! 9107: To disable PKGSRC_MKPIE on a per-package basis, set MKPIE_SUPPORTED= no in the
! 9108: package's Makefile before bsd.prefs.mk is included.
! 9109:
! 9110: B.2.2. Problems with PKGSRC_USE_FORTIFY
! 9111:
! 9112: B.2.2.1. Packages failing to build
! 9113:
! 9114: This feature makes use of pre-processing directives to look for hardened,
! 9115: alternative implementations of essential library calls. Some programs may fail
! 9116: to build as a result; this usually happens for those trying too hard to be
! 9117: portable, or otherwise abusing definitions in the standard library.
! 9118:
! 9119: B.2.2.2. Run-time crashes
! 9120:
! 9121: This feature may cause some programs to crash, usually indicating an actual bug
! 9122: in the program. The fix will typically involve patching the original program's
! 9123: source code.
! 9124:
! 9125: B.2.2.3. Optimization is required
! 9126:
! 9127: At least in the case of GCC, FORTIFY will only be applied if optimization is
! 9128: applied while compiling. This means that the CFLAGS should also contain -O, -O2
! 9129: or another optimization level. This cannot easily be applied globally, as some
! 9130: packages may require specific optimization levels.
! 9131:
! 9132: B.2.2.4. Disabling FORTIFY on a per-package basis
! 9133:
! 9134: Note
! 9135:
! 9136: FORTIFY should not be disabled to work around runtime crashes in the program!
! 9137: This is a very bad idea and will expose you to security vulnerabilities.
! 9138:
! 9139: To disable FORTIFY on a per-package basis, set the following in the package's
! 9140: Makefile before bsd.prefs.mk is included:
! 9141:
! 9142: FORTIFY_SUPPORTED= no
! 9143:
! 9144: B.2.3. Problems with PKGSRC_USE_RELRO
! 9145:
! 9146: B.2.3.1. Performance impact
! 9147:
! 9148: For better protection, full RELRO requires every symbol to be resolved when the
! 9149: program starts, rather than simply when required at run-time. This will have
! 9150: more impact on programs using a lot of symbols, or linked to libraries exposing
! 9151: a lot of symbols. Therefore, daemons or programs otherwise running in
! 9152: background are affected only when started. Programs loading plug-ins at
! 9153: run-time are affected when loading the plug-ins.
! 9154:
! 9155: The impact is not expected to be noticeable on modern hardware, except in some
! 9156: cases for big programs.
! 9157:
! 9158: B.2.3.2. Run-time crashes
! 9159:
! 9160: Some programs handle plug-ins and dependencies in a way that conflicts with
! 9161: RELRO: for instance, with an initialization routine listing any other plug-in
! 9162: required. With full RELRO, the missing symbols are resolved before the
! 9163: initialization routine can run, and the dynamic loader will not be able to find
! 9164: them directly and abort as a result. Unfortunately, this is how Xorg loads its
! 9165: drivers. Partial RELRO can be applied instead in this case.
! 9166:
! 9167: B.2.3.3. Disabling RELRO on a per-package basis
! 9168:
! 9169: To disable RELRO on a per-package basis, set the following in the package's
! 9170: Makefile before bsd.prefs.mk is included:
! 9171:
! 9172: RELRO_SUPPORTED= no
! 9173:
! 9174: B.2.4. Problems with PKGSRC_USE_SSP
! 9175:
! 9176: B.2.4.1. Packages failing to build
! 9177:
! 9178: The stack-smashing protection provided by this option does not work for some
! 9179: programs. The most common situation in which this happens is when the program
! 9180: allocates variables on the stack, with the size determined at run-time.
! 9181:
! 9182: B.2.4.2. Run-time crashes
! 9183:
! 9184: Again, this feature may cause some programs to crash via a SIGABRT, usually
! 9185: indicating an actual bug in the program.
! 9186:
! 9187: On NetBSD LOG_CRIT level syslog messages are sent and - by default - appended
! 9188: to /var/log/messages, e.g.:
! 9189:
! 9190: Jan 6 15:42:51 hostname -: hostname program - - - buffer overflow detected; terminated
! 9191:
! 9192: (where hostname is the hostname(1) and program is the basename(1) of the
! 9193: program crashed).
! 9194:
! 9195: Patching the original program is then required.
! 9196:
! 9197: Rebuilding the package via:
! 9198:
! 9199: % env CFLAGS=-g INSTALL_UNSTRIPPED=yes make replace
! 9200:
! 9201: and inspecting the backtrace of the coredump via the debugger should point out
! 9202: the problematic call by inspecting the frame calling the _chk() (SSP) function.
! 9203:
! 9204: B.2.4.3. Performance impact
! 9205:
! 9206: The compiler emits extra code when using this feature: a check for buffer
! 9207: overflows is performed when entering and exiting functions, requiring an extra
! 9208: variable on the stack. The level of protection can otherwise be adjusted to
! 9209: affect only those functions considered more sensitive by the compiler (with
! 9210: -fstack-protector instead of -fstack-protector-all).
! 9211:
! 9212: The impact is not expected to be noticeable on modern hardware. However,
! 9213: programs with a hard requirement to run at the fastest possible speed should
! 9214: avoid using this feature, or using libraries built with this feature.
! 9215:
! 9216: B.2.4.4. Disabling SSP on a per-package basis
! 9217:
! 9218: Note
! 9219:
! 9220: SSP should not be disabled to work around runtime crashes in the program! This
! 9221: is a very bad idea and will expose you to security vulnerabilities.
! 9222:
! 9223: To disable SSP on a per-package basis, set the following in the package's
! 9224: Makefile before bsd.prefs.mk is included:
! 9225:
! 9226: SSP_SUPPORTED= no
! 9227:
! 9228: B.3. Auditing the system
! 9229:
! 9230: The illusion of security is worse than having no security at all. This section
! 9231: lists a number of ways to ensure the security features requested are actually
! 9232: effective.
! 9233:
! 9234: These instructions were obtained and tested on a system derived from NetBSD 7
! 9235: (amd64). YMMV.
! 9236:
! 9237: B.3.1. Checking for PIE
! 9238:
! 9239: The ELF executable type in use changes for binaries built as PIE; without:
! 9240:
! 9241: $ file /path/to/bin/ary
! 9242: /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
! 9243:
! 9244: as opposed to the following binary, built as PIE:
! 9245:
! 9246: $ file /path/to/pie/bin/ary
! 9247: /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
! 9248:
! 9249: The latter result is then what is expected.
! 9250:
! 9251: B.3.2. Checking for partial RELRO
! 9252:
! 9253: The following command should list a section called RELRO:
! 9254:
! 9255: $ objdump -p /path/to/bin/ary
! 9256:
! 9257: /path/to/bin/ary: file format elf64-x86-64
! 9258:
! 9259: Program Header:
! 9260: [...]
! 9261: RELRO off 0x0000000000000d78 vaddr 0x0000000000600d78 paddr 0x0000000000600d78 align 2**0
! 9262:
! 9263: This check is now performed automatically if PKG_DEVELOPER is set and RELRO is
! 9264: enabled.
! 9265:
! 9266: B.3.3. Checking for full RELRO
! 9267:
! 9268: The dynamic loader will apply RELRO immediately when detecting the presence of
! 9269: the BIND_NOW flag:
! 9270:
! 9271: $ objdump -x /path/to/bin/ary
! 9272:
! 9273: /path/to/bin/ary: file format elf64-x86-64
! 9274:
! 9275: Dynamic Section:
! 9276: [...]
! 9277: BIND_NOW 0x0000000000000000
! 9278:
! 9279: This has to be combined with partial RELRO (see above) to be fully efficient.
! 9280:
! 9281: This check is now performed automatically (where supported) if PKG_DEVELOPER is
! 9282: set.
! 9283:
! 9284: B.3.4. Checking for SSP
! 9285:
! 9286: Building objects, binaries and libraries with SSP will affect the presence of
! 9287: additional symbols in the resulting file:
! 9288:
! 9289: $ nm /path/to/bin/ary
! 9290: [...]
! 9291: U __stack_chk_fail
! 9292: 0000000000600ea0 B __stack_chk_guard
! 9293:
! 9294: This is an indicator that the program was indeed built with support for SSP.
! 9295:
! 9296: This check is now performed automatically (where supported) if PKG_DEVELOPER is
! 9297: set and SSP is enabled.
! 9298:
! 9299: Appendix C. Build logs
1.1 dsieger 9300:
9301: Table of Contents
9302:
1.207 ! leot 9303: C.1. Building figlet
! 9304: C.2. Packaging figlet
1.1 dsieger 9305:
1.207 ! leot 9306: C.1. Building figlet
1.1 dsieger 9307:
9308: # make
9309: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9310: => figlet221.tar.gz doesn't seem to exist on this system.
9311: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
9312: => [172219 bytes]
9313: Connected to ftp.plig.net.
9314: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
9315: 331 Guest login ok, send your complete e-mail address as password.
9316: 230-You are user #5 of 500 simultaneous users allowed.
9317: 230-
9318: 230- ___ _ _ _
9319: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
9320: 230- | _| _| . |_| . | | | . |_| . | _| . |
9321: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
9322: 230- |_| |_| |___| |___|
9323: 230-
9324: 230-** Welcome to ftp.plig.org **
9325: 230-
9326: 230-Please note that all transfers from this FTP site are logged. If you
9327: 230-do not like this, please disconnect now.
9328: 230-
1.19 snj 9329: 230-This archive is available via
1.1 dsieger 9330: 230-
9331: 230-HTTP: http://ftp.plig.org/
9332: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
9333: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
9334: 230-
9335: 230-Please email comments, bug reports and requests for packages to be
9336: 230-mirrored to ftp-admin@plig.org.
9337: 230-
9338: 230-
9339: 230 Logged in anonymously.
9340: Remote system type is UNIX.
9341: Using binary mode to transfer files.
9342: 200 Type okay.
9343: 250 "/pub" is new cwd.
9344: 250-"/pub/figlet" is new cwd.
9345: 250-
9346: 250-Welcome to the figlet archive at ftp.figlet.org
9347: 250-
9348: 250- ftp://ftp.figlet.org/pub/figlet/
9349: 250-
9350: 250-The official FIGlet web page is:
9351: 250- http://www.figlet.org/
9352: 250-
9353: 250-If you have questions, please mailto:info@figlet.org. If you want to
9354: 250-contribute a font or something else, you can email us.
9355: 250
9356: 250 "/pub/figlet/program" is new cwd.
9357: 250 "/pub/figlet/program/unix" is new cwd.
9358: local: figlet221.tar.gz remote: figlet221.tar.gz
9359: 502 Unimplemented command.
9360: 227 Entering Passive Mode (195,40,6,41,246,104)
9361: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
9362: 38% |************** | 65800 64.16 KB/s 00:01 ETA
9363: 226 Transfer completed.
9364: 172219 bytes received in 00:02 (75.99 KB/s)
9365: 221 Goodbye.
9366: => Checksum OK for figlet221.tar.gz.
9367: ===> Extracting for figlet-2.2.1nb2
9368: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
9369: ===> Patching for figlet-2.2.1nb2
9370: ===> Applying pkgsrc patches for figlet-2.2.1nb2
9371: ===> Overriding tools for figlet-2.2.1nb2
9372: ===> Creating toolchain wrappers for figlet-2.2.1nb2
9373: ===> Configuring for figlet-2.2.1nb2
9374: ===> Building for figlet-2.2.1nb2
9375: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
9376: chmod a+x figlet
9377: gcc -O2 -o chkfont chkfont.c
9378: => Unwrapping files-to-be-installed.
9379: #
9380: # make install
9381: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9382: ===> Installing for figlet-2.2.1nb2
9383: install -d -o root -g wheel -m 755 /usr/pkg/bin
9384: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
9385: mkdir -p /usr/pkg/share/figlet
9386: cp figlet /usr/pkg/bin
9387: cp chkfont /usr/pkg/bin
9388: chmod 555 figlist showfigfonts
9389: cp figlist /usr/pkg/bin
9390: cp showfigfonts /usr/pkg/bin
9391: cp fonts/*.flf /usr/pkg/share/figlet
9392: cp fonts/*.flc /usr/pkg/share/figlet
9393: cp figlet.6 /usr/pkg/man/man6
9394: ===> Registering installation for figlet-2.2.1nb2
9395: #
9396:
1.207 ! leot 9397: C.2. Packaging figlet
1.1 dsieger 9398:
9399: # make package
9400: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9401: ===> Packaging figlet-2.2.1nb2
9402: ===> Building binary package for figlet-2.2.1nb2
9403: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
9404: Using SrcDir value of /usr/pkg
9405: Registering depends:.
9406: #
9407:
1.207 ! leot 9408: Appendix D. Directory layout of the pkgsrc FTP server
1.1 dsieger 9409:
9410: Table of Contents
9411:
1.207 ! leot 9412: D.1. distfiles: The distributed source files
! 9413: D.2. misc: Miscellaneous things
! 9414: D.3. packages: Binary packages
! 9415: D.4. reports: Bulk build reports
! 9416: D.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 9417:
9418: As in other big projects, the directory layout of pkgsrc is quite complex for
9419: newbies. This chapter explains where you find things on the FTP server. The
9420: base directory on ftp.NetBSD.org is /pub/pkgsrc/. On other servers it may be
9421: different, but inside this directory, everything should look the same, no
9422: matter on which server you are. This directory contains some subdirectories,
9423: which are explained below.
9424:
1.207 ! leot 9425: D.1. distfiles: The distributed source files
1.1 dsieger 9426:
9427: The directory distfiles contains lots of archive files from all pkgsrc
9428: packages, which are mirrored here. The subdirectories are called after their
9429: package names and are used when the distributed files have names that don't
9430: explicitly contain a version number or are otherwise too generic (for example
9431: release.tar.gz).
9432:
1.207 ! leot 9433: D.2. misc: Miscellaneous things
1.1 dsieger 9434:
9435: This directory contains things that individual pkgsrc developers find worth
9436: publishing.
9437:
1.207 ! leot 9438: D.3. packages: Binary packages
1.1 dsieger 9439:
1.3 rillig 9440: This directory contains binary packages for the various platforms that are
9441: supported by pkgsrc. Each subdirectory is of the form OPSYS/ARCH/OSVERSION_TAG.
9442: The meaning of these variables is:
9443:
9444: * OPSYS is the name of the operating system for which the packages have been
1.9 rillig 9445: built. The name is taken from the output of the uname command, so it may
9446: differ from the one you are used to hear.
1.3 rillig 9447:
1.8 rillig 9448: * ARCH is the hardware architecture of the platform for which the packages
1.10 hubertf 9449: have been built. It also includes the ABI (Application Binary Interface)
9450: for platforms that have several of them.
1.3 rillig 9451:
1.8 rillig 9452: * OSVERSION is the version of the operating system. For version numbers that
9453: change often (for example NetBSD-current), the often-changing part should
9454: be replaced with an x, for example 4.99.x.
1.3 rillig 9455:
1.23 jakllsch 9456: * TAG is either 20xxQy for a stable branch, or head for packages built from
1.8 rillig 9457: the HEAD branch. The latter should only be used when the packages are
9458: updated on a regular basis. Otherwise the date from checking out pkgsrc
9459: should be appended, for example head_20071015.
1.3 rillig 9460:
9461: The rationale for exactly this scheme is that the pkgsrc users looking for
9462: binary packages can quickly click through the directories on the server and
9463: find the best binary packages for their machines. Since they usually know the
9464: operating system and the hardware architecture, OPSYS and ARCH are placed
9465: first. After these choices, they can select the best combination of OSVERSION
9466: and TAG together, since it is usually the case that packages stay compatible
9467: between different version of the operating system.
9468:
9469: In each of these directories, there is a whole binary packages collection for a
9470: specific platform. It has a directory called All which contains all binary
9471: packages. Besides that, there are various category directories that contain
9472: symbolic links to the real binary packages.
1.1 dsieger 9473:
1.207 ! leot 9474: D.4. reports: Bulk build reports
1.8 rillig 9475:
9476: Here are the reports from bulk builds, for those who want to fix packages that
9477: didn't build on some of the platforms. The structure of subdirectories should
1.207 ! leot 9478: look like the one in Section D.3, "packages: Binary packages".
1.8 rillig 9479:
1.207 ! leot 9480: D.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 9481:
9482: These directories contain the "real" pkgsrc, that is the files that define how
9483: to create binary packages from source archives.
9484:
1.149 leot 9485: Each of the current, stable and pkgsrc-20xxQy directories share the same
9486: structure. They each contain a pkgsrc directory and pkgsrc.tar.{bz,gz,xz} file.
9487:
1.1 dsieger 9488: The directory pkgsrc contains a snapshot of the CVS repository, which is
1.149 leot 9489: updated regularly. The file pkgsrc.tar.{bz,gz,xz} contains the same as the
9490: directory, ready to be downloaded as a whole.
1.1 dsieger 9491:
1.149 leot 9492: The current directory contains files related to the HEAD branch of the CVS
9493: repository. In this directory there is an additional file called
9494: pkgsrc-readmes.tar.{bz,gz,xz} that contains all pkgsrc READMEs with information
9495: about categories and packages.
9496:
9497: The stable directory is a symlink to the latest pkgsrc-20xxQy.
9498:
9499: The pkgsrc-20xxQy. directories contain files related to the -20xxQy stable
9500: branch of the CVS repository. In these directories there is an additional file
9501: called pkgsrc-20xxQy.tar.{bz,gz,xz}, which contains the state of pkgsrc when it
9502: was branched.
1.148 leot 9503:
1.207 ! leot 9504: Appendix E. Help topics
1.154 rillig 9505:
9506: The following list contains all help topics that are available when running
9507: bmake help topic=:index.
9508:
1.205 wiz 9509: #! -lintl
9510: 32bit 64bit
9511: ABI ACCEPTABLE_LICENSES
9512: ACROREAD_FONTPATH ADDITIONAL
9513: AFAIK AIX
9514: ALLOW_VULNERABLE_PACKAGES ALL_ENV
9515: ALSA_PC ALTERNATIVES_SRC
9516: AMANDA_TMP AMANDA_USER
9517: AMANDA_VAR APACHE_GROUP
9518: APACHE_MODULE_NAME APACHE_MODULE_SRC
9519: APACHE_MODULE_SRCDIR APACHE_PKG_PREFIX
9520: APACHE_SUEXEC_CONFIGURE_ARGS APACHE_SUEXEC_DOCROOT
9521: APACHE_USER APPEND_ABI
9522: APPEND_ELF ARLA_CACHE
9523: AUDIT_PACKAGES_FLAGS AUTOCONF_REQD
9524: AUTOMAKE_OVERRIDE AUTOMAKE_REQD
9525: AUTO_MKDIRS BDB185_DEFAULT
9526: BDBBASE BDB_ACCEPTED
9527: BDB_DEFAULT BDB_LIBS
9528: BDB_TYPE BINCIMAP_GROUP
9529: BINCIMAP_USER BIND_DIR
9530: BIND_GROUP BIND_USER
9531: BINOWN BINPKG_SITES
9532: BIN_INSTALL_FLAGS BISON_PKGDATADIR
9533: BLAS BLAS_ACCEPTED
9534: BLAS_C_INTERFACE BLAS_INCLUDES
9535: BLAS_INDEX64 BLAS_LIBS
9536: BLAS_TYPE BOOTSTRAP_DEPENDS
9537: BOOTSTRAP_SETUPTOOLS BROKEN
9538: BROKEN_EXCEPT_ON_PLATFORM BROKEN_ON_PLATFORM
9539: BSDSRCDIR BSDXSRCDIR
9540: BSD_MAKE_ENV BUILDLINK_AUTO_DIRS
9541: BUILDLINK_AUTO_VARS BUILDLINK_CFLAGS
9542: BUILDLINK_CONTENTS_FILTER BUILDLINK_CPPFLAGS
9543: BUILDLINK_DEPMETHOD BUILDLINK_FILES
9544: BUILDLINK_FILES_CMD BUILDLINK_FNAME_TRANSFORM
9545: BUILDLINK_LDFLAGS BUILDLINK_LIBS
9546: BUILDLINK_OPSYS_SUPPORT_PTHREAD BUILDLINK_PKGNAME
9547: BUILDLINK_PREFIX BUILDLINK_RPATHDIRS
9548: BUILDLINK_TREE BUILD_DEFS
9549: BUILD_DEFS_EFFECTS BUILD_DEPENDS
9550: BUILD_DIRS BUILD_ENV_SHELL
9551: BUILD_MAKE_CMD BUILD_MAKE_FLAGS
9552: BUILD_TARGET BUILTIN_FIND_FILES
9553: BUILTIN_FIND_FILES_VAR BUILTIN_FIND_GREP
9554: BUILTIN_FIND_HEADERS BUILTIN_FIND_HEADERS_VAR
9555: BUILTIN_FIND_PKGCONFIG BUILTIN_FIND_PKGCONFIG_VAR
9556: BUILTIN_PKG BUILTIN_TEST_CURSES_DEFINES
9557: BUILTIN_TEST_CURSES_FUNCS BUILTIN_VERSION_SCRIPT
9558: BUILTIN_X11_TYPE BUILTIN_X11_VERSION
9559: CACTI_GROUP CACTI_USER
9560: CANNA_GROUP CANNA_USER
9561: CAT CBLAS_LIBS
9562: CCACHE_BASE CCACHE_DIR
9563: CCACHE_LOGFILE CC_VERSION
9564: CC_VERSION_STRING CDRECORD_CONF
9565: CDROM_PKG_URL_DIR CDROM_PKG_URL_HOST
9566: CHECKOUT_DATE CHECK_COMPILER
9567: CHECK_FAKEHOME CHECK_FILES
9568: CHECK_FILES_SKIP CHECK_FILES_STRICT
9569: CHECK_HEADERS CHECK_HEADERS_SKIP
9570: CHECK_INTERPRETER CHECK_INTERPRETER_SKIP
9571: CHECK_PERMS CHECK_PERMS_AUTOFIX
9572: CHECK_PERMS_SKIP CHECK_PORTABILITY
9573: CHECK_PORTABILITY_EXPERIMENTAL CHECK_PORTABILITY_SKIP
9574: CHECK_RELRO CHECK_RELRO_SKIP
9575: CHECK_RELRO_SUPPORTED CHECK_SHLIBS
9576: CHECK_SHLIBS_BLACKLIST CHECK_SHLIBS_SKIP
9577: CHECK_SHLIBS_SUPPORTED CHECK_SSP
9578: CHECK_SSP_SKIP CHECK_SSP_SUPPORTED
9579: CHECK_STRIPPED CHECK_STRIPPED_SKIP
9580: CHECK_WRKREF CHECK_WRKREF_EXTRA_DIRS
9581: CHECK_WRKREF_SKIP CLAMAV_DBDIR
9582: CLAMAV_GROUP CLAMAV_USER
9583: CLANGBASE CLEANDEPENDS
9584: CMAKE_DEPENDENCIES_REWRITE CMAKE_INSTALL_NAME_DIR
9585: CMAKE_INSTALL_PREFIX CMAKE_MODULE_PATH_OVERRIDE
9586: CMAKE_PKGSRC_BUILD_FLAGS CMAKE_PREFIX_PATH
9587: CMAKE_USE_GNU_INSTALL_DIRS COMMON_LISP_DOCFILES
9588: COMMON_LISP_EXAMPLES COMMON_LISP_EXTRAFILES
9589: COMMON_LISP_PACKAGES COMMON_LISP_SYSTEM
9590: COMPILER_RPATH_FLAG COMPILER_USE_SYMLINKS
9591: CONFIGURE_ARGS CONFIGURE_DIRS
9592: CONFIGURE_ENV CONFIGURE_ENV_SHELL
9593: CONFIGURE_HAS_INFODIR CONFIGURE_HAS_MANDIR
9594: CONFIGURE_SCRIPT CONFIG_SHELL
9595: CONFIG_SHELL_FLAGS CONF_FILES
9596: CONF_FILES_MODE CONF_FILES_PERMS
9597: CONSERVER_DEFAULTHOST CONSERVER_DEFAULTPORT
9598: CP CPP
9599: CPP_PRECOMP_FLAGS CREATE_WRKDIR_SYMLINK
9600: CROSSBASE CTFCONVERT
9601: CTF_FILES_SKIP CTF_SUPPORTED
9602: CTYPE CUPS_GROUP
9603: CUPS_SYSTEM_GROUPS CUPS_USER
9604: CURSES_DEFAULT CURSES_TYPE
9605: CVS_EXTRACTDIR CVS_MODULE
9606: CVS_PROJECT CVS_REPOSITORIES
9607: CVS_ROOT CVS_ROOT_GNU
9608: CVS_ROOT_NONGNU CVS_ROOT_SOURCEFORGE
9609: CVS_TAG CXX
9610: CYRUS_GROUP CYRUS_IDLE
9611: CYRUS_USER DAEMONTOOLS_GROUP
9612: DAEMONTOOLS_LOG_USER DARWIN_NO_SYSTEM_LIBS
9613: DARWIN_REQUIRES_FILTER DBUS_GROUP
9614: DBUS_USER DEFANG_GROUP
9615: DEFANG_USER DEFAULT_ACCEPTABLE_LICENSES
9616: DEFAULT_DISTFILES DEFAULT_IRC_SERVER
9617: DEFAULT_SERIAL_DEVICE DEF_UMASK
9618: DEINSTALLDEPENDS DEINSTALL_SRC
9619: DEINSTALL_TEMPLATES DELAYED_ERROR_MSG
9620: DELAYED_WARNING_MSG DEPENDS
9621: DEPENDS_TARGET DEPENDS_TYPE
9622: DESTDIR DESTDIR_VARNAME
9623: DIALER_GROUP DIGEST_REQD
9624: DISTDIR DISTFILES
9625: DISTINFO_FILE DISTNAME
9626: DIST_PATH DIST_SUBDIR
9627: DJBDNS_AXFR_USER DJBDNS_CACHE_USER
9628: DJBDNS_DJBDNS_GROUP DJBDNS_LOG_USER
9629: DJBDNS_RBL_USER DJBDNS_TINY_USER
9630: DLOPEN_REQUIRE_PTHREADS DL_AUTO_VARS
9631: DL_CFLAGS DL_LDFLAGS
9632: DL_LIBS DNS
9633: DOCOWN DOWNLOADED_DISTFILE
9634: DT_LAYOUT DYNAMIC_SITES_CMD
9635: DYNAMIC_SITES_SCRIPT ECHO
9636: ECHO_N ELK_GUI
9637: EMACS_TYPE EMULDIR
9638: EMULSUBDIR EMULSUBDIRSLASH
9639: EMUL_ARCH EMUL_DISTRO
9640: EMUL_EXEC_FMT EMUL_IS_NATIVE
9641: EMUL_MODULES EMUL_OPSYS
9642: EMUL_PKG_FMT EMUL_PLATFORM
9643: EMUL_PLATFORMS EMUL_PREFER
9644: EMUL_REQD EMUL_TYPE
9645: ERROR_MSG EXIM_GROUP
9646: EXIM_USER EXPORT_SYMBOLS_LDFLAGS
9647: EXTRACTOR EXTRACT_CMD
9648: EXTRACT_CMD_DEFAULT EXTRACT_DIR
9649: EXTRACT_ELEMENTS EXTRACT_ENV
9650: EXTRACT_ONLY EXTRACT_OPTS
9651: EXTRACT_SUFX EXTRACT_USING
9652: FAIL FAILOVER_FETCH
9653: FAIL_MSG FAKE_NCURSES
9654: FAM FAM_ACCEPTED
9655: FAM_DEFAULT FAM_SERVER
9656: FCPATH FEATURE_CPPFLAGS
9657: FEATURE_LDFLAGS FEATURE_LIBS
9658: FETCH_AFTER_ARGS FETCH_BEFORE_ARGS
9659: FETCH_CMD FETCH_OUTPUT_ARGS
9660: FETCH_PROXY FETCH_RESUME_ARGS
9661: FETCH_TIMEOUT FETCH_USE_IPV4_ONLY
9662: FETCH_USING FILES_SUBST
9663: FILES_SUBST_SED FIX_SYSTEM_HEADERS
9664: FLUXBOX_USE_GNOME FLUXBOX_USE_KDE
9665: FLUXBOX_USE_XFT FLUXBOX_USE_XINERAMA
9666: FONTDIR FONTS_DIRS
9667: FONTS_VERBOSE FOO_HACKS_MK
9668: FOSSIL_EXTRACTDIR FOSSIL_REPO
9669: FOSSIL_REPOSITORIES FOSSIL_VERSION
9670: FOX_USE_XUNICODE FREEWNN_GROUP
9671: FREEWNN_USER FTP_PKG_URL_DIR
9672: FTP_PKG_URL_HOST GAMEDATAMODE
9673: GAMEDATA_PERMS GAMEDIRMODE
9674: GAMEDIR_PERMS GAMEGRP
9675: GAMEMODE GAMEOWN
9676: GAMES_GROUP GAMES_USER
9677: GCC GCCBASE
9678: GCC_REQD GCC_VERSION_SUFFIX
9679: GEM_BUILD GEM_CLEANBUILD
9680: GEM_CLEANBUILD_EXTENSIONS GEM_DOCDIR
9681: GEM_EXTSDIR GEM_HOME
9682: GEM_KEEPBUILD GEM_LIBDIR
9683: GEM_NAME GEM_PATH
9684: GEM_PLUGINSDIR GEM_SPECFILE
9685: GENERATE_PLIST GHC
9686: GHOSTSCRIPT_REQD GITHUB_PROJECT
9687: GITHUB_RELEASE GITHUB_SUBMODULES
9688: GITHUB_TAG GITHUB_TYPE
9689: GITLAB_PROJECT GITLAB_TAG
9690: GITLAB_TYPE GIT_BRANCH
9691: GIT_ENV GIT_EXTRACTDIR
9692: GIT_REPO GIT_REPOSITORIES
9693: GIT_REVISION GIT_TAG
9694: GNU GNU_CONFIGURE
9695: GNU_CONFIGURE_INFODIR GNU_CONFIGURE_MANDIR
9696: GNU_CONFIGURE_QUIET GNU_CONFIGURE_STRICT
9697: GODEP_REDIRECTS GO_BUILD_PATTERN
9698: GO_DEPS GO_DIST_BASE
9699: GO_MODULE_FILES GO_SRCPATH
9700: GO_VERSION_DEFAULT GROUP_SPECIFIC_PKGS
9701: GRUB_NETWORK_CARDS GRUB_PRESET_COMMAND
9702: GRUB_SCAN_ARGS GZIP
9703: HASKELL_COMPILER HASKELL_ENABLE_HADDOCK_DOCUMENTATION
9704: HASKELL_ENABLE_LIBRARY_PROFILING HASKELL_ENABLE_SHARED_LIBRARY
9705: HASKELL_OPTIMIZATION_LEVEL HAS_CONFIGURE
9706: HEADER_TEMPLATES HG_REPO
9707: HG_REPOSITORIES HG_TAG
9708: HOMEPAGE HOST_PKGTOOLS_ARGS
9709: HOST_SPECIFIC_PKGS HOWL_GROUP
9710: HOWL_USER ICCBASE
9711: ICECAST_CHROOTDIR ICON_THEMES
9712: IDOBASE IGNORE_CCACHE
9713: IGNORE_INFO_DIRS IGNORE_INTERACTIVE_FETCH
9714: IMAKE IMAKEOPTS
9715: IMAKE_MAKE IMAKE_MANINSTALL
9716: IMAP_UW_CCLIENT_MBOX_FMT IMDICTDIR
9717: INCOMPAT_CURSES INFO_DIR
9718: INFO_FILES INFO_FILES_VERBOSE
9719: INFO_MSG INIT_SYSTEM
9720: INN_DATA_DIR INN_GROUP
9721: INN_USER INSTALLATION_DIRS
9722: INSTALLATION_DIRS_FROM_PLIST INSTALL_ENV
9723: INSTALL_SH_OVERRIDE INSTALL_SRC
9724: INSTALL_TEMPLATES INSTALL_UNSTRIPPED
9725: IRCD_HYBRID_IRC_GROUP IRCD_HYBRID_IRC_USER
9726: IRCD_HYBRID_MAXCONN IRCD_HYBRID_NICLEN
9727: IRCD_HYBRID_SYSLOG_EVENTS IRCD_HYBRID_SYSLOG_FACILITY
9728: IRCD_HYBRID_TOPICLEN IRIX
9729: IRRD_USE_PGP JABBERD_GROUP
9730: JABBERD_LOGDIR JABBERD_PIDDIR
9731: JABBERD_SPOOLDIR JABBERD_USER
9732: JAKARTA_HOME JAVA_APP_PATH
9733: JAVA_APP_TARGETS JAVA_BINPREFIX
9734: JAVA_CLASSPATH JAVA_HOME
9735: JAVA_LD_LIBRARY_PATH JAVA_NAME
9736: JAVA_UNLIMIT JAVA_WRAPPERS
9737: JPEG_ACCEPTED JPEG_DEFAULT
9738: KERBEROS KERMIT_SUID_UUCP
9739: KJS_USE_PCRE KNEWS_DOMAIN_FILE
9740: KNEWS_DOMAIN_NAME KRB5_ACCEPTED
9741: KRB5_DEFAULT LANGUAGES
9742: LAPACKE_LIBS LAPACK_LIBS
9743: LATEX2HTML_ICONPATH LDCONFIG_ADD_CMD
9744: LDCONFIG_REMOVE_CMD LEAFNODE_DATA_DIR
9745: LEAFNODE_GROUP LEAFNODE_USER
9746: LIBDVDCSS_HOMEPAGE LIBDVDCSS_MASTER_SITES
9747: LIBRSVG_TYPE LIBTOOL
9748: LIBTOOLIZE_PLIST LIBTOOL_M4_OVERRIDE
9749: LIBUSB_TYPE LICENSE
9750: LINKER_RPATH_FLAG LINK_RPATH_FLAG
9751: LINUX_BASE_NODEPS LINUX_BASE_PREFERRED
9752: LINUX_BASE_REQUIRED 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: MAJOR_OS_VERSION MAKEINFO_ARGS
9761: MAKE_DIRS MAKE_DIRS_PERMS
9762: MAKE_ENV MAKE_FILE
9763: MAKE_FLAGS MAKE_JOBS
9764: MAKE_JOBS_SAFE MAKE_PROGRAM
9765: MANCOMPRESSED_IF_MANZ MANINSTALL
9766: MANZ MASTER_SITES
9767: MASTER_SITE_BACKUP MASTER_SITE_LOCAL
9768: MASTER_SITE_MOZILLA MASTER_SITE_OVERRIDE
9769: MASTER_SITE_PERL_CPAN MASTER_SORT
9770: MASTER_SORT_RANDOM MASTER_SORT_REGEX
9771: MECAB_CHARSET MEDIATOMB_GROUP
9772: MEDIATOMB_USER MIPSPROBASE
9773: MIREDO_GROUP MIREDO_USER
9774: MISSING_FEATURES MKDIR
1.207 ! leot 9775: MKPIE_SUPPORTED MLDONKEY_GROUP
! 9776: MLDONKEY_HOME MLDONKEY_USER
! 9777: MONOTONE_GROUP MONOTONE_USER
! 9778: MOTIFBASE MOTIF_TYPE
! 9779: MOTIF_TYPE_DEFAULT MPI_TYPE
! 9780: MSGFMT_STRIP_MSGCTXT MSGFMT_STRIP_MSGID_PLURAL
! 9781: MTOOLS_ENABLE_FLOPPYD MUST
! 9782: MV MYSQL_CHARSET
! 9783: MYSQL_DATADIR MYSQL_EXTRA_CHARSET
! 9784: MYSQL_GROUP MYSQL_USER
! 9785: MYSQL_VERSION MYSQL_VERSIONS_ACCEPTED
! 9786: MYSQL_VERSIONS_ALL MYSQL_VERSION_DEFAULT
! 9787: NAGIOSCMD_GROUP NAGIOSDIR
! 9788: NAGIOS_GROUP NAGIOS_USER
! 9789: NATIVE_APPEND_ABI NATIVE_APPEND_ELF
! 9790: NATIVE_EXEC_FMT NATIVE_MACHINE_PLATFORM
! 9791: NATIVE_OBJECT_FMT NBPAX_PROGRAM_PREFIX
! 9792: NETBSD_LOGIN_NAME NMH_EDITOR
! 9793: NMH_MTA NMH_PAGER
! 9794: NOLOGIN NOTE
! 9795: NOT_FOR_PLATFORM NOT_PAX_ASLR_SAFE
! 9796: NOT_PAX_MPROTECT_SAFE NO_BUILD
! 9797: NO_CHECKSUM NO_CONFIGURE
! 9798: NO_SKIP NS_PREFERRED
! 9799: NULLMAILER_GROUP NULLMAILER_USER
! 9800: OASIS OASIS_BUILD_ARGS
! 9801: OBJHOSTNAME OBJMACHINE
! 9802: OCAML_FINDLIB_DIRS OCAML_FINDLIB_REGISTER
! 9803: OCAML_FINDLIB_REGISTER_VERBOSE OCAML_SITELIBDIR
! 9804: OCAML_TOPKG_DOCDIR OCAML_USE_DUNE
! 9805: OCAML_USE_FINDLIB OCAML_USE_JBUILDER
! 9806: OCAML_USE_OASIS OCAML_USE_OASIS_DYNRUN
! 9807: OCAML_USE_OPAM OCAML_USE_OPT_COMPILER
! 9808: OCAML_USE_TOPKG OMF
! 9809: ONLY_FOR_COMPILER ONLY_FOR_PLATFORM
! 9810: OPENSSH_CHROOT OPENSSH_GROUP
! 9811: OPENSSH_USER OPSYS
! 9812: OPSYS_EMULDIR OS
! 9813: OSS_TYPE OSX
! 9814: OSX_TOLERATE_SDK_SKEW OS_HAVE_ALSA
! 9815: OS_HAVE_RCD OS_VARIANT
! 9816: OS_VERSION OTF_FONTS_DIR
! 9817: OVERRIDE_DIRDEPTH OVERRIDE_GEMSPEC
! 9818: OVERRIDE_GNU_CONFIG_SCRIPTS OVERRIDE_ROCKSPEC
! 9819: OWN_DIRS OWN_DIRS_PERMS
! 9820: P4GROUP P4PORT
! 9821: P4ROOT P4USER
! 9822: PACKAGES PALMOS_DEFAULT_SDK
! 9823: PAMBASE PAM_DEFAULT
! 9824: PAPERSIZE PASSIVE_FETCH
! 9825: PATCHDIR PATCHFILES
! 9826: PATCH_ARGS PATCH_DEBUG
! 9827: PATCH_DIST_ARGS PATCH_DIST_CAT
! 9828: PATCH_DIST_STRIP PATCH_FUZZ_FACTOR
! 9829: PATCH_STRIP PATH
! 9830: PCCBASE PEAR
! 9831: PEAR_CHANNEL PEAR_CHANNEL_ALIAS
! 9832: PEAR_CHANNEL_VERSION PEAR_CMD
! 9833: PEAR_LIB PEAR_PACKAGE_XML
! 9834: PERL5 PERL5_CONFIGURE
! 9835: PERL5_CONFIGURE_DIRS PERL5_LDFLAGS
! 9836: PERL5_LICENSE PERL5_MODULE_TYPE
! 9837: PERL5_PACKLIST PERL5_PACKLIST_DIR
! 9838: PERL5_PERLBASE PERL5_SITEBASE
! 9839: PERL5_USE_PACKLIST PERL5_VENDORBASE
! 9840: PFCTL PFVAR_H
! 9841: PF_VERSION PGGROUP
! 9842: PGHOME PGPKGSRCDIR
! 9843: PGSQL_TYPE PGSQL_VERSION
! 9844: PGSQL_VERSIONS_ACCEPTED PGSQL_VERSION_DEFAULT
! 9845: PGUSER PG_LIB_EXT
! 9846: PHP PHPCOMMON_MK
! 9847: PHPPKGSRCDIR PHP_BASE_VERS
! 9848: PHP_CHECK_INSTALLED PHP_EXTENSION_DIR
! 9849: PHP_INITIAL_TEENY PHP_PKG_PREFIX
! 9850: PHP_VERSION PHP_VERSIONS_ACCEPTED
! 9851: PHP_VERSIONS_INCOMPATIBLE PHP_VERSION_DEFAULT
! 9852: PHP_VERSION_REQD PILRC_USE_GTK
! 9853: PKGCONFIG_BASE PKGCONFIG_FILE
! 9854: PKGCONFIG_OVERRIDE PKGCONFIG_OVERRIDE_STAGE
! 9855: PKGDIR PKGGNUDIR
! 9856: PKGINFODIR PKGLOCALEDIR
! 9857: PKGMANDIR PKGNAME
! 9858: PKGNAME_REQD PKGPATH
! 9859: PKGREVISION PKGSRC_BLAS_TYPES
! 9860: PKGSRC_CHANGES PKGSRC_COMPILER
! 9861: PKGSRC_KEEP_BIN_PKGS PKGSRC_LOCKTYPE
! 9862: PKGSRC_MAKE_ENV PKGSRC_MESSAGE_RECIPIENTS
! 9863: PKGSRC_MKPIE PKGSRC_MKREPRO
! 9864: PKGSRC_RUN_TEST PKGSRC_SETENV
! 9865: PKGSRC_SLEEPSECS PKGSRC_TODO
! 9866: PKGSRC_USE_CTF PKGSRC_USE_FORTIFY
! 9867: PKGSRC_USE_RELRO PKGSRC_USE_SSP
! 9868: PKGSRC_USE_STACK_CHECK PKGTASKS_DATAFILE
! 9869: PKGTOOLS_ARGS PKGTOOLS_ENV
! 9870: PKG_ALTERNATIVES PKG_APACHE
! 9871: PKG_APACHE_ACCEPTED PKG_APACHE_DEFAULT
! 9872: PKG_BEST_EXISTS PKG_BUILD_OPTIONS
! 9873: PKG_COMPRESSION PKG_CONFIG
! 9874: PKG_CONFIG_PERMS PKG_CREATE_USERGROUP
! 9875: PKG_DB_TMPDIR PKG_DEBUG_LEVEL
! 9876: PKG_DEFAULT_OPTIONS PKG_DESTDIR_SUPPORT
! 9877: PKG_DEVELOPER PKG_DISABLED_OPTIONS
! 9878: PKG_FATAL_ERRORS PKG_FC
! 9879: PKG_FILELIST_CMD PKG_GECOS
! 9880: PKG_GID PKG_GROUPS
! 9881: PKG_GROUPS_VARS PKG_HOME
! 9882: PKG_INIT_SCRIPTS PKG_JAVA_HOME
! 9883: PKG_JVM PKG_JVMS_ACCEPTED
! 9884: PKG_JVM_DEFAULT PKG_LEGACY_OPTIONS
! 9885: PKG_LIBTOOL PKG_OPTIONS
! 9886: PKG_OPTIONS_DEPRECATED_WARNINGS PKG_OPTIONS_LEGACY_OPTS
! 9887: PKG_OPTIONS_LEGACY_VARS PKG_OPTIONS_NONEMPTY_SETS
! 9888: PKG_OPTIONS_OPTIONAL_GROUPS PKG_OPTIONS_REQUIRED_GROUPS
! 9889: PKG_OPTIONS_VAR PKG_PHP
! 9890: PKG_PHP_MAJOR_VERS PKG_PHP_VERSION
! 9891: PKG_RCD_SCRIPTS PKG_REFCOUNT_DBDIR
! 9892: PKG_REGISTER_SHELLS PKG_RESUME_TRANSFERS
! 9893: PKG_SHELL PKG_SUGGESTED_OPTIONS
! 9894: PKG_SUPPORTED_OPTIONS PKG_SYSCONFBASE
! 9895: PKG_SYSCONFBASEDIR PKG_SYSCONFDIR
! 9896: PKG_SYSCONFDIR_PERMS PKG_SYSCONFSUBDIR
! 9897: PKG_SYSCONFVAR PKG_TOOLS_BIN
! 9898: PKG_UID PKG_UPDATE_FONTS_DB
! 9899: PKG_USERS PKG_USERS_VARS
! 9900: PKG_VERBOSE PLEASE
! 9901: PLIST PLIST_AWK
! 9902: PLIST_AWK_ENV PLIST_SRC
! 9903: PLIST_SUBST PLIST_TYPE
! 9904: PLIST_VARS POPTOP_USE_MPPE
! 9905: POSSIBLE_GFORTRAN_VERSION POST_FETCH_HOOK
! 9906: PREFER PREFER_NATIVE
! 9907: PREFER_NATIVE_PTHREADS PREFER_PKGSRC
! 9908: PREFIX PREPEND_PATH
! 9909: PRE_ROOT_CMD PRIVILEGED_STAGES
! 9910: PS PTHREAD_AUTO_VARS
! 9911: PTHREAD_CFLAGS PTHREAD_LDFLAGS
! 9912: PTHREAD_LIBS PTHREAD_OPTS
! 9913: PTHREAD_TYPE PVM_SSH
! 9914: PYPKGPREFIX PYTHON_FOR_BUILD_ONLY
! 9915: PYTHON_SELF_CONFLICT PYTHON_VERSIONED_DEPENDENCIES
! 9916: PYTHON_VERSIONS_ACCEPTED PYTHON_VERSIONS_INCOMPATIBLE
! 9917: PYTHON_VERSION_DEFAULT PYTHON_VERSION_REQD
! 9918: PYVERSSUFFIX PY_NO_EGG
! 9919: QMAILDIR QMAIL_ALIAS_USER
! 9920: QMAIL_DAEMON_USER QMAIL_LOG_USER
! 9921: QMAIL_NOFILES_GROUP QMAIL_PASSWD_USER
! 9922: QMAIL_QMAIL_GROUP QMAIL_QUEUE_DIR
! 9923: QMAIL_QUEUE_EXTRA QMAIL_QUEUE_USER
! 9924: QMAIL_REMOTE_USER QMAIL_ROOT_USER
! 9925: QMAIL_SEND_USER QPOPPER_FAC
! 9926: QPOPPER_SPOOL_DIR QPOPPER_USER
! 9927: RAKE_NAME RASMOL_DEPTH
! 9928: RCD_DIR RCD_ORDER
! 9929: RCD_SCRIPTS RCD_SCRIPTS_DIR
! 9930: RCD_SCRIPTS_EXAMPLEDIR RCD_SCRIPTS_MODE
! 9931: RCD_SCRIPTS_SHELL RCD_SCRIPT_SRC
! 9932: RCD_SUBR RDOC
! 9933: READLINE_DEFAULT READLINE_TYPE
! 9934: REAL_ROOT_GROUP REAL_ROOT_USER
! 9935: RECURSIVE_MAKE RELAY_CTRL_DIR
! 9936: RELRO_SUPPORTED REPLACE_AWK
! 9937: REPLACE_BASH REPLACE_CSH
! 9938: REPLACE_KSH REPLACE_PERL
! 9939: REPLACE_PERL6 REPLACE_PHP
! 9940: REPLACE_PYTHON REPLACE_R
1.205 wiz 9941: REPLACE_RUBY REPLACE_RUBY_DIRS
9942: REPLACE_RUBY_PAT REPLACE_SH
9943: REPLACE_TEXLUA REQD_DIRS
9944: REQD_DIRS_PERMS REQD_FILES
9945: REQD_FILES_MODE REQD_FILES_PERMS
9946: RESOLV_AUTO_VARS RESOLV_LDFLAGS
9947: RESOLV_LIBS RM
9948: ROCKSPEC_NAME ROCKSPEC_SPECFILE
9949: ROOT_CMD ROOT_GROUP
9950: ROOT_USER RPCGEN
9951: RPM RPM2PKG_PLIST
9952: RPM2PKG_PREFIX RPM2PKG_STAGE
9953: RPM2PKG_STRIP RPM2PKG_SUBPREFIX
9954: RPMFILES RPMIGNOREPATH
9955: RPM_DB_PREFIX RSSH_CVS_PATH
9956: RSSH_RDIST_PATH RSSH_RSYNC_PATH
9957: RSSH_SCP_PATH RSSH_SFTP_SERVER_PATH
9958: RUBY RUBYGEM
9959: RUBYGEM_NAME RUBYGEM_OPTIONS
9960: RUBYGEM_VERBOSE RUBY_ABI_VERSION
9961: RUBY_ARCH RUBY_ARCHINC
9962: RUBY_ARCHLIB RUBY_BASE
9963: RUBY_BASERIDIR RUBY_BUILD_DOCUMENT
9964: RUBY_DLEXT RUBY_DOC
9965: RUBY_DYNAMIC_DIRS RUBY_EG
9966: RUBY_ENCODING_ARG RUBY_EXTCONF
9967: RUBY_EXTCONF_CHECK RUBY_EXTCONF_DEBUG
9968: RUBY_EXTCONF_MAKEFILE RUBY_GEM_BASE
9969: RUBY_INC RUBY_LIB
9970: RUBY_LIB_BASE RUBY_NAME
9971: RUBY_NOVERSION RUBY_PKGPREFIX
9972: RUBY_RAILS RUBY_RAILS52_VERSION
9973: RUBY_RAILS60_VERSION RUBY_RAILS61_VERSION
9974: RUBY_RAILS_ACCEPTED RUBY_RAILS_DEFAULT
9975: RUBY_RAILS_REQD RUBY_RAILS_STRICT_DEP
9976: RUBY_RIDIR RUBY_SETUP
9977: RUBY_SHLIB RUBY_SHLIBALIAS
9978: RUBY_SHLIBVER RUBY_SIMPLE_INSTALL
9979: RUBY_SITEARCHLIB RUBY_SITELIB
9980: RUBY_SITELIB_BASE RUBY_SITERIDIR
9981: RUBY_SLEXT RUBY_SRCDIR
9982: RUBY_STATICLIB RUBY_SUFFIX
9983: RUBY_SYSRIDIR RUBY_USE_PTHREAD
9984: RUBY_VENDORARCHLIB RUBY_VENDORLIB
9985: RUBY_VENDORLIB_BASE RUBY_VER
9986: RUBY_VERSION RUBY_VERSIONS_ACCEPTED
9987: RUBY_VERSIONS_INCOMPATIBLE RUBY_VERSION_DEFAULT
9988: RUBY_VERSION_REQD RUBY_VER_DIR
9989: RUN RUN_LDCONFIG
9990: SAWFISH_THEMES SCO
9991: SCREWS_GROUP SCREWS_USER
9992: SCRIPTS_ENV SCROLLKEEPER_DATADIR
9993: SCROLLKEEPER_REBUILDDB SCROLLKEEPER_UPDATEDB
9994: SDIST_PAWD SERIAL_DEVICES
9995: SETGIDGAME SETGID_GAMES_PERMS
9996: SETUID_ROOT_PERMS SH
9997: SHLIB SHORTNAME
9998: SIGN_PACKAGES SILC_CLIENT_WITH_PERL
9999: SITE_SPECIFIC_PKGS SKIP_DEPENDS
10000: SMF_INSTANCES SMF_MANIFEST
10001: SMF_METHODS SMF_METHOD_SHELL
10002: SMF_METHOD_SRC SMF_NAME
10003: SMF_PREFIX SMF_SRCDIR
10004: SNIPROXY_GROUP SNIPROXY_USER
10005: SOURCE_BUFFSIZE SPECIAL_PERMS
10006: SPECIFIC_PKGS SSH_SUID
10007: SSP_SUPPORTED SSYNC_PAWD
10008: STEP_MSG STRIP
10009: STRIP_DBG STRIP_DEBUG
10010: STRIP_DEBUG_SUPPORTED STRIP_FILES_SKIP
10011: SU SUBDIR
10012: SUBST SUBST_CLASSES
10013: SUBST_FILES SUBST_FILTER_CMD
10014: SUBST_MESSAGE SUBST_NOOP_OK
10015: SUBST_SED SUBST_SHOW_DIFF
10016: SUBST_SKIP_TEXT_CHECK SUBST_STAGE
10017: SUBST_VARS SUNWSPROBASE
10018: SUSE_PREFER SU_CMD
10019: SVN_EXTRACTDIR SVN_REPO
10020: SVN_REPOSITORIES SVN_REVISION
10021: SYSCONFBASE TBL
10022: TERMCAP_TYPE TERMINFO_DEFAULT
10023: TERMINFO_TYPE TEST
10024: TEST_DEPENDS TEST_DIRS
10025: TEST_ENV TEST_ENV_SHELL
10026: TEST_MAKE_CMD TEST_MAKE_FLAGS
10027: TEST_TARGET TEXLIVE_IGNORE_PATTERNS
10028: TEXLIVE_REV TEXLIVE_UNVERSIONED
10029: TEXMFSITE TEX_FORMATS
10030: TEX_HYPHEN_DAT TEX_HYPHEN_DEF
10031: TEX_TEXMF_DIRS THTTPD_LOG_FACILITY
10032: TINYDYN_USER TO
10033: TOOLS_ALIASES TOOLS_ALWAYS_WRAP
10034: TOOLS_ARGS TOOLS_BROKEN
10035: TOOLS_CMD TOOLS_CMDLINE_SED
10036: TOOLS_CREATE TOOLS_DIR
10037: TOOLS_FAIL TOOLS_GNU_MISSING
10038: TOOLS_LDCONFIG TOOLS_NOOP
10039: TOOLS_PATH TOOLS_SCRIPT
10040: TOOL_DEPENDS TTF_FONTDIR
10041: TTF_FONTS_DIR TYPE
10042: UAC_REQD_EXECS UCSPI_SSL_GROUP
10043: UCSPI_SSL_USER UNLIMIT_RESOURCES
10044: UNPRIVILEGED UNPRIVILEGED_GROUP
10045: UNPRIVILEGED_GROUPS UNPRIVILEGED_USER
10046: UNWRAP_FILES UNWRAP_PATTERNS
10047: UPDATE_GEMSPEC UPDATE_TARGET
10048: URI USERGROUP_PHASE
10049: USERPPP_GROUP USER_SPECIFIC_PKGS
10050: USE_ABI_DEPENDS USE_APR
10051: USE_BSD_MAKEFILE USE_BUILTIN
10052: USE_CROSS_COMPILE USE_CURSES
10053: USE_CWRAPPERS USE_DB185
10054: USE_FEATURES USE_GAMESGROUP
10055: USE_GCC_RUNTIME USE_IMAKE
10056: USE_JAVA USE_JAVA2
10057: USE_LANGUAGES USE_LIBTOOL
10058: USE_NATIVE_GCC USE_NETBSD_REPO
10059: USE_PKGSRC_GCC USE_PKGSRC_GCC_RUNTIME
10060: USE_PKGTASKS USE_PKG_ADMIN_DIGEST
10061: USE_RUBY_EXTCONF USE_RUBY_INSTALL
10062: USE_RUBY_SETUP USE_RUBY_SETUP_PKG
10063: USE_TOOLS UUCP_GROUP
10064: UUCP_USER VARBASE
10065: VARNAME VIM_EXTRA_OPTS
10066: WARNING_MSG WCALC_CGIDIR
10067: WCALC_CGIPATH WCALC_HTMLDIR
10068: WCALC_HTMLPATH WDM_MANAGERS
10069: WRAPPER_CC WRAPPER_REORDER_CMDS
10070: WRKDIR WRKDIR_BASENAME
10071: WRKDIR_LOCKTYPE WRKLOG
10072: WRKOBJDIR WRKSRC
10073: X10_PORT X11
10074: X11BASE X11_PKGSRCDIR
10075: X11_TYPE X509_CERTIFICATE
10076: X509_KEY XAW_TYPE
10077: XLOCK_DEFAULT_MODE XMKMF
10078: XMKMF_FLAGS XXX
10079: XXXX YES
10080: ZSH_STATIC __stdc__
10081: _vargroups accept
10082: acquire-localbase-lock acquire-lock
10083: add administrator
10084: alloca alternatives
10085: aslr asprintf
10086: atlas autoconf
10087: automake autoreconf
10088: awk bash
10089: big-endian bin-install
10090: bind binpkg-list
10091: blas bootstrap-depends
10092: broken broken_on_platform
10093: bsd bsd.prog.mk
10094: build build-env
10095: buildlink-directories buildlink-oss-soundcard-h
10096: c c++
10097: ccache cce
10098: cdefs ceil
10099: changes changes-entry
10100: changes-entry-noupdate check
10101: check-clean check-files
10102: check-files-clean check-vulnerable
10103: checksum checksum-phase
10104: clean clean-depends
10105: cleandir commit
10106: commit-changes-entry compact
10107: compiler conf
10108: config.guess config.sub
10109: configuration configure
10110: configure-env configure-help
10111: configure_args connect
10112: cos cputime
10113: create-usergroup csh
10114: ctf cvs
10115: debug declaration
10116: declare defined
10117: depend dependencies
10118: depends depends-checksum
10119: depends-fetch deps
10120: describe destdir
10121: disable distclean
10122: distinfo dl
10123: dlopen do-build
10124: do-buildlink do-clean
10125: do-configure do-configure-post-hook
10126: do-extract do-fetch
10127: do-install emul
10128: emul-distinfo emul-fetch
10129: emulation emulator
10130: enable endian
10131: endif enomem
10132: err errx
10133: etc exp
10134: extract-rpm fabs
10135: feature features
10136: fetch fetch-list
10137: follows forbids
10138: form format
10139: fortify fortify_source
10140: fossil friend
10141: fts fts_close
10142: fts_open fts_read
10143: fts_set gcc
10144: gethostbyaddr gethostbyname
10145: gethostbyname2 getopt_long
10146: getprogname getservbyname
10147: getservbyport getservent
10148: gettext git
10149: github gitlab
10150: glob gnu
10151: gnu_configure_strict go
10152: go-deps golang
10153: guess-license hashbang
10154: heimdal help
10155: hg imake
10156: increment inet_aton
10157: interp interpreter
10158: intl ip4
10159: ip6 ipv4
10160: ipv6 iso
10161: kerberos krb
10162: krb5 ksh
10163: lapack latex
10164: libintl_bindtextdomain libintl_gettext
10165: libintl_textdomain libnbcompat
10166: libs libtool
10167: licence license
10168: lintl little-endian
10169: lock locking
10170: lvalue make
10171: makesum memory
10172: mercurial meta
10173: meta-package meta_package
10174: mit-krb5 mk.conf
10175: mkl mount
10176: mprotect mremap
10177: nb nbcompat
10178: netlib obstack
10179: obstack_ptr_grow occurs
10180: only openblas
10181: options options.mk
10182: order override
10183: override-intltool override-message-intltool
10184: package parallel
10185: path pax
10186: paxctl pbulk-index
10187: pc perl
10188: perl5 perms
10189: php pkg-build-options
10190: pkg-config pkg_build_options
10191: platform plist
10192: post-extract post-fetch
10193: post-wrapper pre-build-checks-hook
10194: pre-configure pre-configure-checks-hook
10195: pre-extract pre-fetch
10196: print-go-deps print-plist
10197: print-summary-data privileged-install-hook
10198: pypi python
10199: readme-all recv
10200: recvfrom regcomp
10201: release-localbase-lock release-lock
10202: relro rename
10203: reorder replace
10204: replace_interpreter reproducible
10205: resolv root
10206: ruby send
10207: sendfile sendto
10208: setenv setgid
10209: setprogname setuid
10210: sh shebang
10211: show show-all
10212: show-build-defs show-depends
10213: show-deps show-distfiles
10214: show-downlevel show-subdir-var
10215: show-tools show-var
10216: show-vars snprintf
10217: socket ssp
10218: st_mode stage-install
10219: strcasestr strict
10220: strip strndup
10221: strnlen strsep
10222: subst substitutions
10223: subversion sun
10224: sunpro sunwspro
10225: svn symlink
10226: test test-env
10227: tex texlive
10228: tmp tool
10229: tools tools-libtool-m4-override
10230: type ulimit
10231: undefined undo-replace
10232: unlimit unprivileged
10233: unprivileged-install-hook unstripped
10234: update upload
10235: upload-distfiles use_tools
10236: user utimes
10237: vasprintf verbose
10238: vsnprintf warn
10239: warning warnings
10240: warnx wattr_off
10241: wattr_on work
10242: wrapper wrkdir
1.154 rillig 10243:
1.207 ! leot 10244: Appendix F. Editing guidelines for the pkgsrc guide
1.1 dsieger 10245:
10246: Table of Contents
10247:
1.207 ! leot 10248: F.1. Make targets
! 10249: F.2. Procedure
1.1 dsieger 10250:
10251: This section contains information on editing the pkgsrc guide itself.
10252:
1.207 ! leot 10253: F.1. Make targets
1.1 dsieger 10254:
10255: The pkgsrc guide's source code is stored in pkgsrc/doc/guide/files, and several
10256: files are created from it:
10257:
10258: * pkgsrc/doc/pkgsrc.txt
10259:
10260: * pkgsrc/doc/pkgsrc.html
10261:
1.174 leot 10262: * https://www.NetBSD.org/docs/pkgsrc/
1.1 dsieger 10263:
1.174 leot 10264: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.pdf: The PDF version of the
10265: pkgsrc guide.
1.1 dsieger 10266:
1.174 leot 10267: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.ps: PostScript version of the
1.2 rillig 10268: pkgsrc guide.
1.1 dsieger 10269:
1.207 ! leot 10270: F.2. Procedure
1.1 dsieger 10271:
10272: The procedure to edit the pkgsrc guide is:
10273:
1.190 bacon 10274: 1. Make sure you have checked out the htdocs repository into a sibling
10275: directory of your pkgsrc directory. You will need the ability to commit
10276: from both pkgsrc and htdocs.
10277:
10278: 2. Make sure you have the packages needed to regenerate the pkgsrc guide (and
1.46 obache 10279: other XML-based NetBSD documentation) installed. These are automatically
10280: installed when you install the meta-pkgs/pkgsrc-guide-tools package.
1.1 dsieger 10281:
1.190 bacon 10282: 3. Run cd doc/guide to get to the right directory. All further steps will take
1.1 dsieger 10283: place here.
10284:
1.190 bacon 10285: 4. Edit the XML file(s) in files/.
1.1 dsieger 10286:
1.190 bacon 10287: 5. Run bmake to check the pkgsrc guide for valid XML and to build the final
1.1 dsieger 10288: output files. If you get any errors at this stage, you can just edit the
10289: files, as there are only symbolic links in the working directory, pointing
10290: to the files in files/.
10291:
1.190 bacon 10292: 6. (cd files && cvs commit)
1.1 dsieger 10293:
1.190 bacon 10294: 7. Run bmake clean && bmake to regenerate the output files with the proper RCS
1.1 dsieger 10295: Ids.
10296:
1.190 bacon 10297: 8. Run bmake regen to install and commit the files in both pkgsrc/doc and
1.1 dsieger 10298: htdocs.
10299:
10300: Note
10301:
10302: If you have added, removed or renamed some chapters, you need to
10303: synchronize them using cvs add or cvs delete in the htdocs directory.
10304:
CVSweb <webmaster@jp.NetBSD.org>