Annotation of htdocs/docs/pkgsrc/pkgsrc.txt, revision 1.202
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.196 jnemeth 17: $NetBSD: pkgsrc.xml,v 1.39 2021/01/02 08:32:15 jnemeth Exp $
1.1 dsieger 18:
19: Abstract
20:
21: pkgsrc is a centralized package management system for Unix-like operating
22: systems. This guide provides information for users and developers of pkgsrc. It
23: covers installation of binary and source packages, creation of binary and
24: source packages and a high-level overview about the infrastructure.
25:
26: -------------------------------------------------------------------------------
27:
28: Table of Contents
29:
30: 1. What is pkgsrc?
31:
32: 1.1. Introduction
33:
34: 1.1.1. Why pkgsrc?
35: 1.1.2. Supported platforms
36:
37: 1.2. Overview
38: 1.3. Terminology
39:
40: 1.3.1. Roles involved in pkgsrc
41:
42: 1.4. Typography
43:
44: I. The pkgsrc user's guide
45:
1.154 rillig 46: 2. Getting help
47: 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 48:
1.154 rillig 49: 3.1. Getting pkgsrc for the first time
1.1 dsieger 50:
1.154 rillig 51: 3.1.1. As tar archive
52: 3.1.2. Via anonymous CVS
1.1 dsieger 53:
1.154 rillig 54: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 55:
1.154 rillig 56: 3.2.1. Via tar files
57: 3.2.2. Via CVS
1.1 dsieger 58:
1.154 rillig 59: 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 60:
1.154 rillig 61: 4.1. Binary distribution
62: 4.2. Bootstrapping pkgsrc
1.1 dsieger 63:
1.154 rillig 64: 5. Using pkgsrc
1.1 dsieger 65:
1.154 rillig 66: 5.1. Using binary packages
1.1 dsieger 67:
1.154 rillig 68: 5.1.1. Finding binary packages
69: 5.1.2. Installing binary packages
1.202 ! nia 70: 5.1.3. Updating packages
! 71: 5.1.4. Deinstalling packages
! 72: 5.1.5. Getting information about installed packages
! 73: 5.1.6. Checking for security vulnerabilities in installed packages
! 74: 5.1.7. Finding if newer versions of your installed packages are in
1.1 dsieger 75: pkgsrc
1.202 ! nia 76: 5.1.8. Other administrative functions
1.1 dsieger 77:
1.154 rillig 78: 5.2. Building packages from source
1.1 dsieger 79:
1.154 rillig 80: 5.2.1. Requirements
81: 5.2.2. Fetching distfiles
82: 5.2.3. How to build and install
1.1 dsieger 83:
1.154 rillig 84: 6. Configuring pkgsrc
1.1 dsieger 85:
1.154 rillig 86: 6.1. General configuration
87: 6.2. Variables affecting the build process
88: 6.3. Variables affecting the installation process
89: 6.4. Selecting and configuring the compiler
1.1 dsieger 90:
1.154 rillig 91: 6.4.1. Selecting the compiler
92: 6.4.2. Additional flags to the compiler (CFLAGS)
93: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 94:
1.154 rillig 95: 6.5. Developer/advanced settings
96: 6.6. Selecting Build Options
1.1 dsieger 97:
1.154 rillig 98: 7. Creating binary packages
1.1 dsieger 99:
1.154 rillig 100: 7.1. Building a single binary package
101: 7.2. Settings for creation of binary packages
1.1 dsieger 102:
1.154 rillig 103: 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 104:
1.154 rillig 105: 8.1. Preparations
1.180 rillig 106: 8.2. Running a bulk build
1.6 rillig 107:
1.154 rillig 108: 8.2.1. Configuration
1.6 rillig 109:
1.154 rillig 110: 8.3. Requirements of a full bulk build
1.178 rillig 111: 8.4. Bulk build variants
1.6 rillig 112:
1.179 rillig 113: 8.4.1. Detect unknown configure options
114: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 115: 8.4.3. Force compiler options only in the build phase
116: 8.4.4. Use custom directories
117: 8.4.5. Turn warnings into errors
118: 8.4.6. Reject packages for which pkglint reports errors
119: 8.4.7. Reject packages that contain forbidden strings
120: 8.4.8. Reject packages whose self-test fails
121: 8.4.9. Reject packages that use undefined shell variables
122: 8.4.10. Turn off verbose logging
1.178 rillig 123:
124: 8.5. Creating a multiple CD-ROM packages collection
125:
126: 8.5.1. Example of cdpack
1.6 rillig 127:
1.154 rillig 128: 9. Directory layout of the installed files
1.6 rillig 129:
1.154 rillig 130: 9.1. File system layout in ${LOCALBASE}
131: 9.2. File system layout in ${VARBASE}
1.6 rillig 132:
1.154 rillig 133: 10. Frequently Asked Questions
1.6 rillig 134:
1.154 rillig 135: 10.1. Are there any mailing lists for pkg-related discussion?
136: 10.2. Utilities for package management (pkgtools)
137: 10.3. How to use pkgsrc as non-root
138: 10.4. How to resume transfers when fetching distfiles?
139: 10.5. How can I install/use modular X.org from pkgsrc?
140: 10.6. How to fetch files from behind a firewall
141: 10.7. How to fetch files from HTTPS sites
142: 10.8. How do I tell make fetch to do passive FTP?
143: 10.9. How to fetch all distfiles at once
144: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc"
1.24 wiz 145: mean?
1.154 rillig 146: 10.11. What does "Could not find bsd.own.mk" mean?
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
332: 21.4.3. Packages containing perl scripts
333: 21.4.4. Packages containing shell scripts
334: 21.4.5. Other programming languages
335:
336: 21.5. The build phase
337:
338: 21.5.1. Compiling C and C++ code conditionally
339: 21.5.2. How to handle compiler bugs
1.172 rillig 340: 21.5.3. No such file or directory
341: 21.5.4. Undefined reference to "..."
342: 21.5.5. Running out of memory
1.154 rillig 343:
344: 21.6. The install phase
345:
346: 21.6.1. Creating needed directories
347: 21.6.2. Where to install documentation
348: 21.6.3. Installing highscore files
349: 21.6.4. Adding DESTDIR support to packages
350: 21.6.5. Packages with hardcoded paths to other interpreters
351: 21.6.6. Packages installing perl modules
352: 21.6.7. Packages installing info files
353: 21.6.8. Packages installing man pages
354: 21.6.9. Packages installing GConf data files
355: 21.6.10. Packages installing scrollkeeper/rarian data files
356: 21.6.11. Packages installing X11 fonts
357: 21.6.12. Packages installing GTK2 modules
358: 21.6.13. Packages installing SGML or XML data
359: 21.6.14. Packages installing extensions to the MIME database
360: 21.6.15. Packages using intltool
361: 21.6.16. Packages installing startup scripts
362: 21.6.17. Packages installing TeX modules
363: 21.6.18. Packages supporting running binaries in emulation
364: 21.6.19. Packages installing hicolor theme icons
365: 21.6.20. Packages installing desktop files
366:
367: 21.7. Marking packages as having problems
368:
1.184 rillig 369: 22. GNOME packaging and porting
370:
371: 22.1. Meta packages
372: 22.2. Packaging a GNOME application
373: 22.3. Updating GNOME to a newer version
374: 22.4. Patching guidelines
375:
1.154 rillig 376: 23. Submitting and Committing
377:
378: 23.1. Submitting binary packages
379: 23.2. Submitting source packages (for non-NetBSD-developers)
380: 23.3. General notes when adding, updating, or removing packages
381: 23.4. Commit Messages
382: 23.5. Committing: Adding a package to CVS
383: 23.6. Updating a package to a newer version
384: 23.7. Renaming a package in pkgsrc
385: 23.8. Moving a package in pkgsrc
386:
387: 24. Frequently Asked Questions
1.1 dsieger 388:
389: III. The pkgsrc infrastructure internals
390:
1.184 rillig 391: 25. Design of the pkgsrc infrastructure
1.1 dsieger 392:
1.184 rillig 393: 25.1. The meaning of variable definitions
394: 25.2. Avoiding problems before they arise
395: 25.3. Variable evaluation
1.1 dsieger 396:
1.184 rillig 397: 25.3.1. At load time
398: 25.3.2. At runtime
1.1 dsieger 399:
1.184 rillig 400: 25.4. How can variables be specified?
401: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 402:
1.184 rillig 403: 25.5.1. Procedures with parameters
404: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 405:
1.184 rillig 406: 25.6. The order in which files are loaded
1.1 dsieger 407:
1.184 rillig 408: 25.6.1. The order in bsd.prefs.mk
409: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 410:
1.184 rillig 411: 26. Regression tests
1.1 dsieger 412:
1.184 rillig 413: 26.1. Running the regression tests
414: 26.2. Adding a new regression test
1.1 dsieger 415:
1.184 rillig 416: 26.2.1. Overridable functions
417: 26.2.2. Helper functions
1.1 dsieger 418:
1.184 rillig 419: 27. Porting pkgsrc
1.1 dsieger 420:
1.184 rillig 421: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 422:
423: A. A simple example package: bison
424:
425: A.1. files
426:
427: A.1.1. Makefile
428: A.1.2. DESCR
429: A.1.3. PLIST
430: A.1.4. Checking a package with pkglint
431:
432: A.2. Steps for building, installing, packaging
433:
434: B. Build logs
435:
436: B.1. Building figlet
437: B.2. Packaging figlet
438:
439: C. Directory layout of the pkgsrc FTP server
440:
1.23 jakllsch 441: C.1. distfiles: The distributed source files
442: C.2. misc: Miscellaneous things
443: C.3. packages: Binary packages
444: C.4. reports: Bulk build reports
1.148 leot 445: C.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 446:
1.154 rillig 447: D. Help topics
448: E. Editing guidelines for the pkgsrc guide
1.1 dsieger 449:
1.154 rillig 450: E.1. Make targets
451: E.2. Procedure
1.1 dsieger 452:
453: List of Tables
454:
455: 1.1. Platforms supported by pkgsrc
1.184 rillig 456: 12.1. Patching examples
457: 22.1. PLIST handling for GNOME packages
1.1 dsieger 458:
459: Chapter 1. What is pkgsrc?
460:
461: Table of Contents
462:
463: 1.1. Introduction
464:
465: 1.1.1. Why pkgsrc?
466: 1.1.2. Supported platforms
467:
468: 1.2. Overview
469: 1.3. Terminology
470:
471: 1.3.1. Roles involved in pkgsrc
472:
473: 1.4. Typography
474:
475: 1.1. Introduction
476:
477: There is a lot of software freely available for Unix-based systems, which is
478: usually available in form of the source code. Before such software can be used,
479: it needs to be configured to the local system, compiled and installed, and this
480: is exactly what The NetBSD Packages Collection (pkgsrc) does. pkgsrc also has
481: some basic commands to handle binary packages, so that not every user has to
482: build the packages for himself, which is a time-costly task.
483:
484: pkgsrc currently contains several thousand packages, including:
485:
1.104 sevan 486: * www/apache24 - The Apache web server
1.1 dsieger 487:
488: * www/firefox - The Firefox web browser
489:
490: * meta-pkgs/gnome - The GNOME Desktop Environment
491:
1.102 ryoon 492: * meta-pkgs/kde4 - The K Desktop Environment
1.1 dsieger 493:
1.108 rillig 494: ? just to name a few.
1.1 dsieger 495:
496: pkgsrc has built-in support for handling varying dependencies, such as pthreads
497: and X11, and extended features such as IPv6 support on a range of platforms.
498:
499: 1.1.1. Why pkgsrc?
500:
501: pkgsrc provides the following key features:
502:
503: * Easy building of software from source as well as the creation and
504: installation of binary packages. The source and latest patches are
505: retrieved from a master or mirror download site, checksum verified, then
506: built on your system. Support for binary-only distributions is available
507: for both native platforms and NetBSD emulated platforms.
508:
509: * All packages are installed in a consistent directory tree, including
510: binaries, libraries, man pages and other documentation.
511:
1.104 sevan 512: * Tracking of package dependencies automatically, including when performing
513: updates, to ensure required packages are installed. The configuration files
514: of various packages are handled automatically during updates, so local
515: changes are preserved.
1.1 dsieger 516:
517: * Like NetBSD, pkgsrc is designed with portability in mind and consists of
518: highly portable code. This allows the greatest speed of development when
1.26 spz 519: porting to a new platform. This portability also ensures that pkgsrc is
1.1 dsieger 520: consistent across all platforms.
521:
522: * The installation prefix, acceptable software licenses, international
523: encryption requirements and build-time options for a large number of
524: packages are all set in a simple, central configuration file.
525:
526: * The entire source (not including the distribution files) is freely
527: available under a BSD license, so you may extend and adapt pkgsrc to your
528: needs. Support for local packages and patches is available right out of the
529: box, so you can configure it specifically for your environment.
530:
531: The following principles are basic to pkgsrc:
532:
1.198 leot 533: * "It should only work if it's right." -- That means, if a package contains
1.1 dsieger 534: bugs, it's better to find them and to complain about them rather than to
535: just install the package and hope that it works. There are numerous checks
1.175 gutterid 536: in pkgsrc that try to find such bugs: static analysis tools (pkgtools/
1.1 dsieger 537: pkglint), build-time checks (portability of shell scripts), and
538: post-installation checks (installed files, references to shared libraries,
539: script interpreters).
540:
1.198 leot 541: * "If it works, it should work everywhere" -- Like NetBSD has been ported to
1.1 dsieger 542: many hardware architectures, pkgsrc has been ported to many operating
543: systems. Care is taken that packages behave the same on all platforms.
544:
545: 1.1.2. Supported platforms
546:
547: pkgsrc consists of both a source distribution and a binary distribution for
548: these operating systems. After retrieving the required source or binaries, you
549: can be up and running with pkgsrc in just minutes!
550:
551: pkgsrc was derived from FreeBSD's ports system, and initially developed for
552: NetBSD only. Since then, pkgsrc has grown a lot, and now supports the following
553: platforms:
554:
555: Table 1.1. Platforms supported by pkgsrc
556:
1.92 sevan 557: +-----------------------------------------------------------------------------+
558: | Platform | Date Support | Notes |
559: | | Added | |
560: |--------------------------------------+---------------+----------------------|
561: |NetBSD | Aug 1997 | |
562: |--------------------------------------+---------------+----------------------|
563: |Solaris | Mar 1999 |README.Solaris |
564: |--------------------------------------+---------------+----------------------|
565: |Linux | Jun 1999 |README.Linux |
566: |--------------------------------------+---------------+----------------------|
1.191 bacon 567: |Darwin / Mac OS X / OS X / macOS | Oct 2001 |README.macOS |
1.92 sevan 568: |--------------------------------------+---------------+----------------------|
569: |FreeBSD | Nov 2002 |README.FreeBSD |
570: |--------------------------------------+---------------+----------------------|
571: |OpenBSD | Nov 2002 |README.OpenBSD |
572: |--------------------------------------+---------------+----------------------|
573: |IRIX | Dec 2002 |README.IRIX |
574: | | |README.IRIX5.3 |
575: |--------------------------------------+---------------+----------------------|
576: |BSD/OS | Dec 2003 | |
577: |--------------------------------------+---------------+----------------------|
578: |AIX | Dec 2003 |README.AIX |
579: |--------------------------------------+---------------+----------------------|
580: |Interix (Microsoft Windows Services | Mar 2004 |README.Interix |
581: |for Unix) | | |
582: |--------------------------------------+---------------+----------------------|
583: |DragonFlyBSD | Oct 2004 | |
584: |--------------------------------------+---------------+----------------------|
585: |OSF/1 | Nov 2004 |README.OSF1 |
586: |--------------------------------------+---------------+----------------------|
587: |HP-UX | Apr 2007 |README.HPUX |
588: |--------------------------------------+---------------+----------------------|
589: |Haiku | Sep 2010 |README.Haiku |
590: |--------------------------------------+---------------+----------------------|
591: |MirBSD | Jan 2011 | |
592: |--------------------------------------+---------------+----------------------|
593: |Minix3 | Nov 2011 |README.Minix3 |
594: |--------------------------------------+---------------+----------------------|
595: |Cygwin | Mar 2013 |README.Cygwin |
596: |--------------------------------------+---------------+----------------------|
597: |GNU/kFreeBSD | Jul 2013 |README.GNUkFreeBSD |
1.104 sevan 598: |--------------------------------------+---------------+----------------------|
599: |Bitrig | Jun 2014 |README.Bitrig |
1.92 sevan 600: +-----------------------------------------------------------------------------+
1.1 dsieger 601:
602:
603: 1.2. Overview
604:
605: This document is divided into three parts. The first, The pkgsrc user's guide,
606: describes how one can use one of the packages in the Package Collection, either
607: by installing a precompiled binary package, or by building one's own copy using
608: the NetBSD package system. The second part, The pkgsrc developer's guide,
609: explains how to prepare a package so it can be easily built by other NetBSD
610: users without knowing about the package's building details. The third part, The
611: pkgsrc infrastructure internals is intended for those who want to understand
612: how pkgsrc is implemented.
613:
614: This document is available in various formats: HTML, PDF, PS, TXT.
615:
616: 1.3. Terminology
617:
618: There has been a lot of talk about "ports", "packages", etc. so far. Here is a
619: description of all the terminology used within this document.
620:
621: Package
622:
623: A set of files and building instructions that describe what's necessary to
624: build a certain piece of software using pkgsrc. Packages are traditionally
1.123 wiz 625: stored under /usr/pkgsrc, but may be stored in any location, referred to as
626: PKGSRCDIR.
1.1 dsieger 627:
628: The NetBSD package system
629:
630: This is the former name of "pkgsrc". It is part of the NetBSD operating
631: system and can be bootstrapped to run on non-NetBSD operating systems as
632: well. It handles building (compiling), installing, and removing of
633: packages.
634:
635: Distfile
636:
637: This term describes the file or files that are provided by the author of
638: the piece of software to distribute his work. All the changes necessary to
639: build on NetBSD are reflected in the corresponding package. Usually the
640: distfile is in the form of a compressed tar-archive, but other types are
641: possible, too. Distfiles are usually stored below /usr/pkgsrc/distfiles.
642:
643: Port
644:
645: This is the term used by FreeBSD and OpenBSD people for what we call a
646: package. In NetBSD terminology, "port" refers to a different architecture.
647:
648: Precompiled/binary package
649:
650: A set of binaries built with pkgsrc from a distfile and stuffed together in
651: a single .tgz file so it can be installed on machines of the same machine
652: architecture without the need to recompile. Packages are usually generated
653: in /usr/pkgsrc/packages; there is also an archive on ftp.NetBSD.org.
654:
655: Sometimes, this is referred to by the term "package" too, especially in the
656: context of precompiled packages.
657:
658: Program
659:
660: The piece of software to be installed which will be constructed from all
661: the files in the distfile by the actions defined in the corresponding
662: package.
663:
664: 1.3.1. Roles involved in pkgsrc
665:
666: pkgsrc users
667:
668: The pkgsrc users are people who use the packages provided by pkgsrc.
669: Typically they are system administrators. The people using the software
670: that is inside the packages (maybe called "end users") are not covered by
671: the pkgsrc guide.
672:
673: There are two kinds of pkgsrc users: Some only want to install pre-built
674: binary packages. Others build the pkgsrc packages from source, either for
675: installing them directly or for building binary packages themselves. For
676: pkgsrc users Part I, "The pkgsrc user's guide" should provide all necessary
677: documentation.
678:
679: package maintainers
680:
681: A package maintainer creates packages as described in Part II, "The pkgsrc
682: developer's guide".
683:
684: infrastructure developers
685:
686: These people are involved in all those files that live in the mk/ directory
687: and below. Only these people should need to read through Part III, "The
688: pkgsrc infrastructure internals", though others might be curious, too.
689:
690: 1.4. Typography
691:
692: When giving examples for commands, shell prompts are used to show if the
693: command should/can be issued as root, or if "normal" user privileges are
1.115 sevan 694: sufficient. We use a # for root's shell prompt, a % for users' shell prompt,
695: assuming they use the C-shell or tcsh and a $ for bourne shell and derivatives.
1.1 dsieger 696:
697: Part I. The pkgsrc user's guide
698:
699: Table of Contents
700:
1.154 rillig 701: 2. Getting help
702: 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 703:
1.154 rillig 704: 3.1. Getting pkgsrc for the first time
1.1 dsieger 705:
1.154 rillig 706: 3.1.1. As tar archive
707: 3.1.2. Via anonymous CVS
1.1 dsieger 708:
1.154 rillig 709: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 710:
1.154 rillig 711: 3.2.1. Via tar files
712: 3.2.2. Via CVS
1.1 dsieger 713:
1.154 rillig 714: 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 715:
1.154 rillig 716: 4.1. Binary distribution
717: 4.2. Bootstrapping pkgsrc
1.1 dsieger 718:
1.154 rillig 719: 5. Using pkgsrc
1.1 dsieger 720:
1.154 rillig 721: 5.1. Using binary packages
1.1 dsieger 722:
1.154 rillig 723: 5.1.1. Finding binary packages
724: 5.1.2. Installing binary packages
1.202 ! nia 725: 5.1.3. Updating packages
! 726: 5.1.4. Deinstalling packages
! 727: 5.1.5. Getting information about installed packages
! 728: 5.1.6. Checking for security vulnerabilities in installed packages
! 729: 5.1.7. Finding if newer versions of your installed packages are in
1.1 dsieger 730: pkgsrc
1.202 ! nia 731: 5.1.8. Other administrative functions
1.1 dsieger 732:
1.154 rillig 733: 5.2. Building packages from source
1.1 dsieger 734:
1.154 rillig 735: 5.2.1. Requirements
736: 5.2.2. Fetching distfiles
737: 5.2.3. How to build and install
1.1 dsieger 738:
1.154 rillig 739: 6. Configuring pkgsrc
1.1 dsieger 740:
1.154 rillig 741: 6.1. General configuration
742: 6.2. Variables affecting the build process
743: 6.3. Variables affecting the installation process
744: 6.4. Selecting and configuring the compiler
1.1 dsieger 745:
1.154 rillig 746: 6.4.1. Selecting the compiler
747: 6.4.2. Additional flags to the compiler (CFLAGS)
748: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 749:
1.154 rillig 750: 6.5. Developer/advanced settings
751: 6.6. Selecting Build Options
1.1 dsieger 752:
1.154 rillig 753: 7. Creating binary packages
1.1 dsieger 754:
1.154 rillig 755: 7.1. Building a single binary package
756: 7.2. Settings for creation of binary packages
1.1 dsieger 757:
1.154 rillig 758: 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 759:
1.154 rillig 760: 8.1. Preparations
1.180 rillig 761: 8.2. Running a bulk build
1.6 rillig 762:
1.154 rillig 763: 8.2.1. Configuration
1.6 rillig 764:
1.154 rillig 765: 8.3. Requirements of a full bulk build
1.178 rillig 766: 8.4. Bulk build variants
767:
1.179 rillig 768: 8.4.1. Detect unknown configure options
769: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 770: 8.4.3. Force compiler options only in the build phase
771: 8.4.4. Use custom directories
772: 8.4.5. Turn warnings into errors
773: 8.4.6. Reject packages for which pkglint reports errors
774: 8.4.7. Reject packages that contain forbidden strings
775: 8.4.8. Reject packages whose self-test fails
776: 8.4.9. Reject packages that use undefined shell variables
777: 8.4.10. Turn off verbose logging
1.6 rillig 778:
1.178 rillig 779: 8.5. Creating a multiple CD-ROM packages collection
780:
781: 8.5.1. Example of cdpack
1.6 rillig 782:
1.154 rillig 783: 9. Directory layout of the installed files
1.6 rillig 784:
1.154 rillig 785: 9.1. File system layout in ${LOCALBASE}
786: 9.2. File system layout in ${VARBASE}
1.6 rillig 787:
1.154 rillig 788: 10. Frequently Asked Questions
1.6 rillig 789:
1.154 rillig 790: 10.1. Are there any mailing lists for pkg-related discussion?
791: 10.2. Utilities for package management (pkgtools)
792: 10.3. How to use pkgsrc as non-root
793: 10.4. How to resume transfers when fetching distfiles?
794: 10.5. How can I install/use modular X.org from pkgsrc?
795: 10.6. How to fetch files from behind a firewall
796: 10.7. How to fetch files from HTTPS sites
797: 10.8. How do I tell make fetch to do passive FTP?
798: 10.9. How to fetch all distfiles at once
799: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
800: 10.11. What does "Could not find bsd.own.mk" mean?
801: 10.12. Using 'sudo' with pkgsrc
802: 10.13. How do I change the location of configuration files?
803: 10.14. Automated security checks
804: 10.15. Why do some packages ignore my CFLAGS?
805: 10.16. A package does not build. What shall I do?
806: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.24 wiz 807: conflicts" mean?
1.1 dsieger 808:
1.154 rillig 809: Chapter 2. Getting help
810:
811: To get help when using pkgsrc, the definitive source is this document, the
812: pkgsrc guide. If you don't find anything here, there are alternatives:
813:
814: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
815: Run bmake help topic=? to get help for any topic, such as a variable name
816: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
817: like strcasecmp or any other topic.
818:
819: The available help topics are listed in Appendix D, Help topics.
820:
1.163 rillig 821: * To see the value of a single variable, run bmake show-var VARNAME=X.
822:
823: * To see the values of the most common variables, run bmake show-all. These
824: variables are grouped by topic. To see the variables for a single topic,
825: run bmake show-all-topic, for example bmake show-all-fetch.
826:
1.154 rillig 827: * The pkgsrc-users mailing list, to which you can subscribe and then ask your
828: questions.
829:
830: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
831: a specialized chat program such as XChat. Pick any user name and join the
832: channel #pkgsrc.
833:
834: Chapter 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 835:
836: Table of Contents
837:
1.154 rillig 838: 3.1. Getting pkgsrc for the first time
1.1 dsieger 839:
1.154 rillig 840: 3.1.1. As tar archive
841: 3.1.2. Via anonymous CVS
1.1 dsieger 842:
1.154 rillig 843: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 844:
1.154 rillig 845: 3.2.1. Via tar files
846: 3.2.2. Via CVS
1.1 dsieger 847:
848: Before you download and extract the files, you need to decide where you want to
849: extract them. When using pkgsrc as root user, pkgsrc is usually installed in /
850: usr/pkgsrc. You are though free to install the sources and binary packages
851: wherever you want in your filesystem, provided that the pathname does not
852: contain white-space or other characters that are interpreted specially by the
853: shell and some other programs. A safe bet is to use only letters, digits,
854: underscores and dashes.
855:
1.154 rillig 856: 3.1. Getting pkgsrc for the first time
1.1 dsieger 857:
1.25 wiz 858: Before you download any pkgsrc files, you should decide whether you want the
1.1 dsieger 859: current branch or the stable branch. The latter is forked on a quarterly basis
860: from the current branch and only gets modified for security updates. The names
861: of the stable branches are built from the year and the quarter, for example
1.198 leot 862: 2021Q1.
1.1 dsieger 863:
864: The second step is to decide how you want to download pkgsrc. You can get it as
1.24 wiz 865: a tar file or via CVS. Both ways are described here.
1.1 dsieger 866:
1.52 asau 867: Note that tar archive contains CVS working copy. Thus you can switch to using
868: CVS at any later time.
1.1 dsieger 869:
1.154 rillig 870: 3.1.1. As tar archive
1.52 asau 871:
1.151 sevan 872: The primary download location for all pkgsrc files is https://cdn.NetBSD.org/
873: pub/pkgsrc/ or ftp://ftp.NetBSD.org/pub/pkgsrc/ (it points to the same
874: location). There are a number of subdirectories for different purposes, which
875: are described in detail in Appendix C, Directory layout of the pkgsrc FTP
876: server.
1.1 dsieger 877:
1.52 asau 878: The tar archive for the current branch is in the directory current and is
1.118 sevan 879: called pkgsrc.tar.gz. It is autogenerated weekly.
1.52 asau 880:
881: To save download time we provide bzip2- and xz-compressed archives which are
882: published at pkgsrc.tar.bz2 and pkgsrc.tar.xz respectively.
883:
884: You can fetch the same files using FTP.
1.1 dsieger 885:
1.198 leot 886: The tar file for the stable branch 2021Q1 is in the directory pkgsrc-2021Q1 and
1.59 jnemeth 887: is also called pkgsrc.tar.gz.
1.1 dsieger 888:
1.136 leot 889: To download the latest pkgsrc stable tarball, run:
1.12 weinem 890:
1.198 leot 891: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2021Q1/pkgsrc.tar.gz
1.12 weinem 892:
1.78 snj 893: If you prefer, you can also fetch it using "wget", "curl", or your web browser.
1.52 asau 894:
1.12 weinem 895: Then, extract it with:
896:
1.78 snj 897: $ tar -xzf pkgsrc.tar.gz -C /usr
1.12 weinem 898:
899: This will create the directory pkgsrc/ in /usr/ and all the package source will
900: be stored under /usr/pkgsrc/.
901:
902: To download pkgsrc-current, run:
903:
904: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz
1.1 dsieger 905:
1.154 rillig 906: 3.1.2. Via anonymous CVS
1.1 dsieger 907:
1.24 wiz 908: To fetch a specific pkgsrc stable branch, run:
1.1 dsieger 909:
1.198 leot 910: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2021Q1 -P pkgsrc
1.13 weinem 911:
1.24 wiz 912: This will create the directory pkgsrc/ in your /usr/ directory and all the
913: package source will be stored under /usr/pkgsrc/.
914:
915: To fetch the pkgsrc current branch, run:
1.1 dsieger 916:
1.40 wiz 917: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 918:
1.30 dholland 919: Refer to the list of available mirrors to choose a faster CVS mirror, if
920: needed.
1.1 dsieger 921:
1.24 wiz 922: If you get error messages from rsh, you need to set CVS_RSH variable. E.g.:
1.1 dsieger 923:
1.40 wiz 924: $ cd /usr && env CVS_RSH=ssh cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 925:
1.24 wiz 926: Refer to documentation on your command shell how to set CVS_RSH=ssh
927: permanently. For Bourne shells, you can set it in your .profile or better
928: globally in /etc/profile:
929:
930: # set CVS remote shell command
931: CVS_RSH=ssh
932: export CVS_RSH
1.12 weinem 933:
1.13 weinem 934: By default, CVS doesn't do things like most people would expect it to do. But
935: there is a way to convince CVS, by creating a file called .cvsrc in your home
1.12 weinem 936: directory and saving the following lines to it. This file will save you lots of
937: headache and some bug reports, so we strongly recommend it. You can find an
938: explanation of this file in the CVS documentation.
1.2 rillig 939:
940: # recommended CVS configuration file from the pkgsrc guide
1.155 sevan 941: cvs -q
1.2 rillig 942: checkout -P
1.4 rillig 943: update -dP
944: diff -upN
1.2 rillig 945: rdiff -u
1.24 wiz 946: release -d
1.1 dsieger 947:
1.154 rillig 948: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 949:
950: The preferred way to keep pkgsrc up-to-date is via CVS (which also works if you
951: have first installed it via a tar file). It saves bandwidth and hard disk
952: activity, compared to downloading the tar file again.
953:
1.154 rillig 954: 3.2.1. Via tar files
1.1 dsieger 955:
956: Warning
957:
958: When updating from a tar file, you first need to completely remove the old
959: pkgsrc directory. Otherwise those files that have been removed from pkgsrc in
960: the mean time will not be removed on your local disk, resulting in
961: inconsistencies. When removing the old files, any changes that you have done to
962: the pkgsrc files will be lost after updating. Therefore updating via CVS is
963: strongly recommended.
964:
965: Note that by default the distfiles and the binary packages are saved in the
966: pkgsrc tree, so don't forget to rescue them before updating. You can also
1.78 snj 967: configure pkgsrc to store distfiles and packages in directories outside the
1.154 rillig 968: pkgsrc tree by setting the DISTDIR and PACKAGES variables. See Chapter 6,
1.78 snj 969: Configuring pkgsrc for the details.
1.1 dsieger 970:
971: To update pkgsrc from a tar file, download the tar file as explained above.
972: Then, make sure that you have not made any changes to the files in the pkgsrc
973: directory. Remove the pkgsrc directory and extract the new tar file. Done.
974:
1.154 rillig 975: 3.2.2. Via CVS
1.1 dsieger 976:
1.26 spz 977: To update pkgsrc via CVS, change to the pkgsrc directory and run cvs:
1.12 weinem 978:
1.26 spz 979: $ cd /usr/pkgsrc && cvs update -dP
980:
981: If you get error messages from rsh, you need to set CVS_RSH variable as
982: described above. E.g.:
983:
984: $ cd /usr/pkgsrc && env CVS_RSH=ssh cvs up -dP
1.1 dsieger 985:
1.154 rillig 986: 3.2.2.1. Switching between different pkgsrc branches
1.1 dsieger 987:
988: When updating pkgsrc, the CVS program keeps track of the branch you selected.
989: But if you, for whatever reason, want to switch from the stable branch to the
990: current one, you can do it by adding the option "-A" after the "update"
1.25 wiz 991: keyword. To switch from the current branch back to the stable branch, add the "
1.198 leot 992: -rpkgsrc-2021Q1" option.
1.1 dsieger 993:
1.154 rillig 994: 3.2.2.2. What happens to my changes when updating?
1.1 dsieger 995:
996: When you update pkgsrc, the CVS program will only touch those files that are
997: registered in the CVS repository. That means that any packages that you created
998: on your own will stay unmodified. If you change files that are managed by CVS,
999: later updates will try to merge your changes with those that have been done by
1000: others. See the CVS manual, chapter "update" for details.
1001:
1.154 rillig 1002: Chapter 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 1003:
1004: Table of Contents
1005:
1.154 rillig 1006: 4.1. Binary distribution
1007: 4.2. Bootstrapping pkgsrc
1.1 dsieger 1008:
1.154 rillig 1009: 4.1. Binary distribution
1.1 dsieger 1010:
1.154 rillig 1011: See Section 5.1, "Using binary packages".
1.1 dsieger 1012:
1.154 rillig 1013: 4.2. Bootstrapping pkgsrc
1.1 dsieger 1014:
1.44 asau 1015: pkgsrc can be bootstrapped for use in two different modes: privileged and
1016: unprivileged one. In unprivileged mode in contrast to privileged one all
1.45 asau 1017: programs are installed under one particular user and cannot utilise privileged
1.44 asau 1018: operations (packages don't create special users and all special file
1019: permissions like setuid are ignored).
1020:
1.1 dsieger 1021: Installing the bootstrap kit from source should be as simple as:
1022:
1.60 asau 1023: # env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 1024: # cd pkgsrc/bootstrap
1025: # ./bootstrap
1026:
1027:
1.44 asau 1028: To bootstrap in unprivileged mode pass "--unprivileged" flag to bootstrap
1029:
1030: By default, in privileged mode pkgsrc uses /usr/pkg for prefix where programs
1.118 sevan 1031: will be installed in, and /usr/pkg/pkgdb for the package database directory
1032: where pkgsrc will do its internal bookkeeping, /var is used as varbase, where
1.44 asau 1033: packages install their persistent data. In unprivileged mode pkgsrc uses ~/pkg
1.118 sevan 1034: for prefix, ~/pkg/pkgdb for the package database, and ~/pkg/var for varbase.
1.44 asau 1035:
1036: You can change default layout using command-line arguments. Run "./bootstrap
1037: --help" to get details.
1.1 dsieger 1038:
1039: Note
1040:
1041: The bootstrap installs a bmake tool. Use this bmake when building via pkgsrc.
1042: For examples in this guide, use bmake instead of "make".
1043:
1.44 asau 1044: Note
1045:
1046: It is possible to bootstrap multiple instances of pkgsrc using non-intersecting
1047: directories. Use bmake corresponding to the installation you're working with to
1048: build and install packages.
1049:
1.154 rillig 1050: Chapter 5. Using pkgsrc
1.1 dsieger 1051:
1052: Table of Contents
1053:
1.154 rillig 1054: 5.1. Using binary packages
1.1 dsieger 1055:
1.154 rillig 1056: 5.1.1. Finding binary packages
1057: 5.1.2. Installing binary packages
1.202 ! nia 1058: 5.1.3. Updating packages
! 1059: 5.1.4. Deinstalling packages
! 1060: 5.1.5. Getting information about installed packages
! 1061: 5.1.6. Checking for security vulnerabilities in installed packages
! 1062: 5.1.7. Finding if newer versions of your installed packages are in pkgsrc
! 1063: 5.1.8. Other administrative functions
1.154 rillig 1064:
1065: 5.2. Building packages from source
1066:
1067: 5.2.1. Requirements
1068: 5.2.2. Fetching distfiles
1069: 5.2.3. How to build and install
1.1 dsieger 1070:
1071: Basically, there are two ways of using pkgsrc. The first is to only install the
1072: package tools and to use binary packages that someone else has prepared. This
1073: is the "pkg" in pkgsrc. The second way is to install the "src" of pkgsrc, too.
1074: Then you are able to build your own packages, and you can still use binary
1075: packages from someone else.
1076:
1.154 rillig 1077: 5.1. Using binary packages
1.1 dsieger 1078:
1.151 sevan 1079: On the cdn.NetBSD.org site and mirrors, there are collections of binary
1.9 rillig 1080: packages, ready to be installed. These binary packages have been built using
1081: the default settings for the directories, that is:
1082:
1083: * /usr/pkg for LOCALBASE, where most of the files are installed,
1084:
1085: * /usr/pkg/etc for configuration files,
1086:
1087: * /var for VARBASE, where those files are installed that may change after
1088: installation.
1089:
1090: If you cannot use these directories for whatever reasons (maybe because you're
1091: not root), you cannot use these binary packages, but have to build the packages
1.154 rillig 1092: yourself, which is explained in Section 4.2, "Bootstrapping pkgsrc".
1.1 dsieger 1093:
1.154 rillig 1094: 5.1.1. Finding binary packages
1.1 dsieger 1095:
1.5 weinem 1096: To install binary packages, you first need to know from where to get them. The
1.202 ! nia 1097: first place where you should look is on the main pkgsrc CDN in the directory /
! 1098: pub/pkgsrc/packages.
1.5 weinem 1099:
1100: This directory contains binary packages for multiple platforms. First, select
1101: your operating system. (Ignore the directories with version numbers attached to
1102: it, they just exist for legacy reasons.) Then, select your hardware
1103: architecture, and in the third step, the OS version and the "version" of
1.9 rillig 1104: pkgsrc.
1105:
1106: In this directory, you often find a file called bootstrap.tar.gz which contains
1107: the package management tools. If the file is missing, it is likely that your
1108: operating system already provides those tools. Download the file and extract it
1109: in the / directory. It will create the directories /usr/pkg (containing the
1.118 sevan 1110: tools for managing binary packages and the database of installed packages).
1.1 dsieger 1111:
1.154 rillig 1112: 5.1.2. Installing binary packages
1.1 dsieger 1113:
1.85 wiz 1114: In the directory from the last section, there is a subdirectory called All/,
1.9 rillig 1115: which contains all the binary packages that are available for the platform,
1.202 ! nia 1116: excluding those that may not be distributed via HTTP or FTP.
1.9 rillig 1117:
1118: To install packages directly from an FTP or HTTP server, run the following
1119: commands in a Bourne-compatible shell (be sure to su to root first):
1120:
1.202 ! nia 1121: # PATH="/usr/pkg/sbin:/usr/pkg/bin:$PATH"
! 1122: # PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages"
1.169 rillig 1123: # PKG_PATH="$PKG_PATH/OPSYS/ARCH/VERSIONS/All/"
1.9 rillig 1124: # export PATH PKG_PATH
1.202 ! nia 1125: # pkg_add pkgin
1.9 rillig 1126:
1127: Instead of URLs, you can also use local paths, for example if you are
1128: installing from a set of CDROMs, DVDs or an NFS-mounted repository. If you want
1129: to install packages from multiple sources, you can separate them by a semicolon
1130: in PKG_PATH.
1131:
1132: After these preparations, installing a package is very easy:
1133:
1.202 ! nia 1134: # pkgin search nginx
! 1135: nginx-1.19.6 Lightweight HTTP server and mail proxy server
! 1136: nginx-1.18.0nb8 Lightweight HTTP server and mail proxy server
! 1137: # pkgin install zsh nginx-1.19.6 vim
1.1 dsieger 1138:
1.202 ! nia 1139: Note that pkgin is a user-friendly frontend to the pkg_* tools.
1.1 dsieger 1140:
1.202 ! nia 1141: Any prerequisite packages needed to run the package in question will be
! 1142: installed, too, assuming they are present in the repository.
1.1 dsieger 1143:
1144: After you've installed packages, be sure to have /usr/pkg/bin and /usr/pkg/sbin
1145: in your PATH so you can actually start the just installed program.
1146:
1.202 ! nia 1147: 5.1.3. Updating packages
1.1 dsieger 1148:
1.202 ! nia 1149: To update binary packages, it is recommended that you use pkgin upgrade. This
! 1150: will compare the remote package repository to your locally installed packages
! 1151: and safely replace any older packages.
1.1 dsieger 1152:
1.202 ! nia 1153: Note that pkgsrc is released as quarterly branches. If you are updating to a
! 1154: newer quarterly branch of pkgsrc, you may need to adjust the repository in /usr
! 1155: /pkg/etc/pkgin/repositories.conf.
1.1 dsieger 1156:
1.202 ! nia 1157: 5.1.4. Deinstalling packages
1.1 dsieger 1158:
1.202 ! nia 1159: To deinstall a package, it does not matter whether it was installed from source
! 1160: code or from a binary package. Neither the pkgin or the pkg_delete command need
! 1161: to know.
1.1 dsieger 1162:
1.202 ! nia 1163: To delete a package, you can just run pkgin remove package-name. The package
! 1164: name can be given with or without version number.
1.1 dsieger 1165:
1.202 ! nia 1166: 5.1.5. Getting information about installed packages
1.1 dsieger 1167:
1168: The pkg_info shows information about installed packages or binary package
1.202 ! nia 1169: files. As with other management tools, it works with packages installed from
! 1170: source or binaries.
1.1 dsieger 1171:
1.202 ! nia 1172: 5.1.6. Checking for security vulnerabilities in installed packages
1.1 dsieger 1173:
1.202 ! nia 1174: The pkgsrc Security Team and Packages Groups maintain a list of known
1.164 leot 1175: vulnerabilities to packages which are (or have been) included in pkgsrc. The
1.202 ! nia 1176: list is available from the NetBSD CDN at https://cdn.NetBSD.org/pub/NetBSD/
1.179 rillig 1177: packages/vulns/pkg-vulnerabilities.
1.1 dsieger 1178:
1.202 ! nia 1179: Please note that not every "vulnerability" with a CVE assignment is exploitable
! 1180: in every configuration. Some bugs are marked as active simply because an fix
! 1181: was not marked as such. Operating system specific hardening and mitigation
! 1182: features may also reduce the impact of bugs.
! 1183:
1.23 jakllsch 1184: Through pkg_admin fetch-pkg-vulnerabilities, this list can be downloaded
1185: automatically, and a security audit of all packages installed on a system can
1186: take place.
1187:
1188: There are two components to auditing. The first step, pkg_admin
1189: fetch-pkg-vulnerabilities, is for downloading the list of vulnerabilities from
1190: the NetBSD FTP site. The second step, pkg_admin audit, checks to see if any of
1191: your installed packages are vulnerable. If a package is vulnerable, you will
1192: see output similar to the following:
1.1 dsieger 1193:
1194: Package samba-2.0.9 has a local-root-shell vulnerability, see
1.174 leot 1195: https://www.samba.org/samba/whatsnew/macroexploit.html
1.1 dsieger 1196:
1.23 jakllsch 1197: You may wish to have the vulnerabilities file downloaded daily so that it
1198: remains current. This may be done by adding an appropriate entry to the root
1199: users crontab(5) entry. For example the entry
1200:
1.121 sevan 1201: # Download vulnerabilities file
1.118 sevan 1202: 0 3 * * * /usr/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities >/dev/null 2>&1
1.121 sevan 1203: # Audit the installed packages and email results to root
1204: 9 3 * * * /usr/pkg/sbin/pkg_admin audit |mail -s "Installed package audit result" \
1205: root >/dev/null 2>&1
1.118 sevan 1206:
1207:
1208: will update the vulnerability list every day at 3AM, followed by an audit at
1209: 3:09AM. The result of the audit are then emailed to root. On NetBSD this may be
1210: accomplished instead by adding the following line to /etc/daily.conf:
1211:
1212: fetch_pkg_vulnerabilities=YES
1213:
1.23 jakllsch 1214:
1.118 sevan 1215: to fetch the vulnerability list from the daily security script. The system is
1216: set to audit the packages by default but can be set explicitly, if desired (not
1.123 wiz 1217: required), by adding the following line to /etc/security.conf:
1.23 jakllsch 1218:
1.118 sevan 1219: check_pkg_vulnerabilities=YES
1.23 jakllsch 1220:
1221:
1.118 sevan 1222: see daily.conf(5) and security.conf(5) for more details.
1.1 dsieger 1223:
1.202 ! nia 1224: 5.1.7. Finding if newer versions of your installed packages are in pkgsrc
1.1 dsieger 1225:
1.12 weinem 1226: Install pkgtools/lintpkgsrc and run lintpkgsrc with the "-i" argument to check
1.202 ! nia 1227: if any packages are stale, e.g.
1.1 dsieger 1228:
1229: % lintpkgsrc -i
1230: ...
1231: Version mismatch: 'tcsh' 6.09.00 vs 6.10.00
1232:
1233:
1.202 ! nia 1234: 5.1.8. Other administrative functions
1.1 dsieger 1235:
1236: The pkg_admin executes various administrative functions on the package system.
1237:
1.154 rillig 1238: 5.2. Building packages from source
1.1 dsieger 1239:
1240: After obtaining pkgsrc, the pkgsrc directory now contains a set of packages,
1.25 wiz 1241: organized into categories. You can browse the online index of packages, or run
1.1 dsieger 1242: make readme from the pkgsrc directory to build local README.html files for all
1243: packages, viewable with any web browser such as www/lynx or www/firefox.
1244:
1245: The default prefix for installed packages is /usr/pkg. If you wish to change
1246: this, you should do so by setting LOCALBASE in mk.conf. You should not try to
1247: use multiple different LOCALBASE definitions on the same system (inside a
1248: chroot is an exception).
1249:
1250: The rest of this chapter assumes that the package is already in pkgsrc. If it
1251: is not, see Part II, "The pkgsrc developer's guide" for instructions how to
1252: create your own packages.
1253:
1.154 rillig 1254: 5.2.1. Requirements
1.1 dsieger 1255:
1256: To build packages from source, you need a working C compiler. On NetBSD, you
1257: need to install the "comp" and the "text" distribution sets. If you want to
1258: build X11-related packages, the "xbase" and "xcomp" distribution sets are
1259: required, too.
1260:
1.154 rillig 1261: 5.2.2. Fetching distfiles
1.1 dsieger 1262:
1263: The first step for building a package is downloading the distfiles (i.e. the
1264: unmodified source). If they have not yet been downloaded, pkgsrc will fetch
1265: them automatically.
1266:
1267: If you have all files that you need in the distfiles directory, you don't need
1268: to connect. If the distfiles are on CD-ROM, you can mount the CD-ROM on /cdrom
1269: and add:
1270:
1271: DISTDIR=/cdrom/pkgsrc/distfiles
1272:
1273: to your mk.conf.
1274:
1275: By default a list of distribution sites will be randomly intermixed to prevent
1276: huge load on servers which holding popular packages (for example,
1277: SourceForge.net mirrors). Thus, every time when you need to fetch yet another
1278: distfile all the mirrors will be tried in new (random) order. You can turn this
1279: feature off by setting MASTER_SORT_RANDOM=NO (for PKG_DEVELOPERs it's already
1280: disabled).
1281:
1282: You can overwrite some of the major distribution sites to fit to sites that are
1283: close to your own. By setting one or two variables you can modify the order in
1284: which the master sites are accessed. MASTER_SORT contains a whitespace
1285: delimited list of domain suffixes. MASTER_SORT_REGEX is even more flexible, it
1286: contains a whitespace delimited list of regular expressions. It has higher
1287: priority than MASTER_SORT. Have a look at pkgsrc/mk/defaults/mk.conf to find
1288: some examples. This may save some of your bandwidth and time.
1289:
1290: You can change these settings either in your shell's environment, or, if you
1.4 rillig 1291: want to keep the settings, by editing the mk.conf file, and adding the
1.1 dsieger 1292: definitions there.
1293:
1.132 wiz 1294: If a package depends on many other packages (such as meta-pkgs/kde4), the build
1.1 dsieger 1295: process may alternate between periods of downloading source, and compiling. To
1296: ensure you have all the source downloaded initially you can run the command:
1297:
1298: % make fetch-list | sh
1299:
1300: which will output and run a set of shell commands to fetch the necessary files
1301: into the distfiles directory. You can also choose to download the files
1302: manually.
1303:
1.154 rillig 1304: 5.2.3. How to build and install
1.1 dsieger 1305:
1306: Once the software has downloaded, any patches will be applied, then it will be
1307: compiled for you. This may take some time depending on your computer, and how
1308: many other packages the software depends on and their compile time.
1309:
1310: Note
1311:
1312: If using bootstrap or pkgsrc on a non-NetBSD system, use the pkgsrc bmake
1313: command instead of "make" in the examples in this guide.
1314:
1315: For example, type
1316:
1317: % cd misc/figlet
1318: % make
1319:
1320:
1321: at the shell prompt to build the various components of the package.
1322:
1323: The next stage is to actually install the newly compiled program onto your
1324: system. Do this by entering:
1325:
1326: % make install
1327:
1328:
1329: while you are still in the directory for whatever package you are installing.
1330:
1331: Installing the package on your system may require you to be root. However,
1332: pkgsrc has a just-in-time-su feature, which allows you to only become root for
1333: the actual installation step.
1334:
1335: That's it, the software should now be installed and setup for use. You can now
1336: enter:
1337:
1338: % make clean
1339:
1340:
1341: to remove the compiled files in the work directory, as you shouldn't need them
1342: any more. If other packages were also added to your system (dependencies) to
1343: allow your program to compile, you can tidy these up also with the command:
1344:
1345: % make clean-depends
1346:
1347:
1348: Taking the figlet utility as an example, we can install it on our system by
1349: building as shown in Appendix B, Build logs.
1350:
1351: The program is installed under the default root of the packages tree - /usr/
1352: pkg. Should this not conform to your tastes, set the LOCALBASE variable in your
1353: environment, and it will use that value as the root of your packages tree. So,
1354: to use /usr/local, set LOCALBASE=/usr/local in your environment. Please note
1355: that you should use a directory which is dedicated to packages and not shared
1356: with other programs (i.e., do not try and use LOCALBASE=/usr). Also, you should
1357: not try to add any of your own files or directories (such as src/, obj/, or
1358: pkgsrc/) below the LOCALBASE tree. This is to prevent possible conflicts
1359: between programs and other files installed by the package system and whatever
1360: else may have been installed there.
1361:
1.4 rillig 1362: Some packages look in mk.conf to alter some configuration options at build
1.1 dsieger 1363: time. Have a look at pkgsrc/mk/defaults/mk.conf to get an overview of what will
1364: be set there by default. Environment variables such as LOCALBASE can be set in
1.4 rillig 1365: mk.conf to save having to remember to set them each time you want to use
1.1 dsieger 1366: pkgsrc.
1367:
1368: Occasionally, people want to "look under the covers" to see what is going on
1369: when a package is building or being installed. This may be for debugging
1370: purposes, or out of simple curiosity. A number of utility values have been
1371: added to help with this.
1372:
1373: 1. If you invoke the make(1) command with PKG_DEBUG_LEVEL=2, then a huge
1374: amount of information will be displayed. For example,
1375:
1376: make patch PKG_DEBUG_LEVEL=2
1377:
1.25 wiz 1378: will show all the commands that are invoked, up to and including the "patch
1379: " stage.
1.1 dsieger 1380:
1381: 2. If you want to know the value of a certain make(1) definition, then the
1382: VARNAME definition should be used, in conjunction with the show-var target.
1383: e.g. to show the expansion of the make(1) variable LOCALBASE:
1384:
1385: % make show-var VARNAME=LOCALBASE
1386: /usr/pkg
1387: %
1388:
1389:
1390: If you want to install a binary package that you've either created yourself
1391: (see next section), that you put into pkgsrc/packages manually or that is
1392: located on a remote FTP server, you can use the "bin-install" target. This
1393: target will install a binary package - if available - via pkg_add(1), else do a
1394: make package. The list of remote FTP sites searched is kept in the variable
1395: BINPKG_SITES, which defaults to ftp.NetBSD.org. Any flags that should be added
1396: to pkg_add(1) can be put into BIN_INSTALL_FLAGS. See pkgsrc/mk/defaults/mk.conf
1397: for more details.
1398:
1399: A final word of warning: If you set up a system that has a non-standard setting
1400: for LOCALBASE, be sure to set that before any packages are installed, as you
1401: cannot use several directories for the same purpose. Doing so will result in
1402: pkgsrc not being able to properly detect your installed packages, and fail
1403: miserably. Note also that precompiled binary packages are usually built with
1404: the default LOCALBASE of /usr/pkg, and that you should not install any if you
1405: use a non-standard LOCALBASE.
1406:
1.154 rillig 1407: Chapter 6. Configuring pkgsrc
1.1 dsieger 1408:
1409: Table of Contents
1410:
1.154 rillig 1411: 6.1. General configuration
1412: 6.2. Variables affecting the build process
1413: 6.3. Variables affecting the installation process
1414: 6.4. Selecting and configuring the compiler
1415:
1416: 6.4.1. Selecting the compiler
1417: 6.4.2. Additional flags to the compiler (CFLAGS)
1418: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 1419:
1.154 rillig 1420: 6.5. Developer/advanced settings
1421: 6.6. Selecting Build Options
1.1 dsieger 1422:
1423: The whole pkgsrc system is configured in a single file, usually called mk.conf.
1424: In which directory pkgsrc looks for that file depends on the installation. On
1425: NetBSD, when you use make(1) from the base system, it is in the directory /etc
1426: /. In all other cases the default location is ${PREFIX}/etc/, depending on
1427: where you told the bootstrap program to install the binary packages.
1428:
1429: The format of the configuration file is that of the usual BSD-style Makefiles.
1430: The whole pkgsrc configuration is done by setting variables in this file. Note
1431: that you can define all kinds of variables, and no special error checking (for
1.112 rillig 1432: example for spelling mistakes) takes place.
1.1 dsieger 1433:
1.154 rillig 1434: 6.1. General configuration
1.1 dsieger 1435:
1.112 rillig 1436: The following variables apply to all pkgsrc packages. A complete list of the
1437: variables that can be configured by the user is available in mk/defaults/
1438: mk.conf, together with some comments that describe each variable's intent.
1.1 dsieger 1439:
1440: * LOCALBASE: Where packages will be installed. The default is /usr/pkg. Do
1441: not mix binary packages with different LOCALBASEs!
1442:
1443: * CROSSBASE: Where "cross" category packages will be installed. The default
1444: is ${LOCALBASE}/cross.
1445:
1.84 wiz 1446: * X11BASE: Where X11 is installed on the system. The default is /usr/X11R7.
1.1 dsieger 1447:
1448: * DISTDIR: Where to store the downloaded copies of the original source
1449: distributions used for building pkgsrc packages. The default is $
1450: {PKGSRCDIR}/distfiles.
1451:
1452: * PKG_DBDIR: Where the database about installed packages is stored. The
1.118 sevan 1453: default is /usr/pkg/pkgdb.
1.1 dsieger 1454:
1455: * MASTER_SITE_OVERRIDE: If set, override the packages' MASTER_SITES with this
1456: value.
1457:
1458: * MASTER_SITE_BACKUP: Backup location(s) for distribution files and patch
1459: files if not found locally or in ${MASTER_SITES} or ${PATCH_SITES}
1.118 sevan 1460: respectively. The defaults is ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/$
1.1 dsieger 1461: {DIST_SUBDIR}/.
1462:
1463: * BINPKG_SITES: List of sites carrying binary pkgs. rel and arch are replaced
1464: with OS release ("2.0", etc.) and architecture ("mipsel", etc.).
1465:
1.23 jakllsch 1466: * ACCEPTABLE_LICENSES: List of acceptable licenses. License names are
1467: case-sensitive. Whenever you try to build a package whose license is not in
1468: this list, you will get an error message. If the license condition is
1469: simple enough, the error message will include specific instructions on how
1470: to change this variable.
1.1 dsieger 1471:
1.154 rillig 1472: 6.2. Variables affecting the build process
1.1 dsieger 1473:
1474: * PACKAGES: The top level directory for the binary packages. The default is $
1475: {PKGSRCDIR}/packages.
1476:
1477: * WRKOBJDIR: The top level directory where, if defined, the separate working
1478: directories will get created, and symbolically linked to from ${WRKDIR}
1479: (see below). This is useful for building packages on several architectures,
1480: then ${PKGSRCDIR} can be NFS-mounted while ${WRKOBJDIR} is local to every
1481: architecture. (It should be noted that PKGSRCDIR should not be set by the
1.198 leot 1482: user -- it is an internal definition which refers to the root of the pkgsrc
1.1 dsieger 1483: tree. It is possible to have many pkgsrc tree instances.)
1484:
1485: * LOCALPATCHES: Directory for local patches that aren't part of pkgsrc. See
1.184 rillig 1486: Section 12.3, "patches/*" for more information.
1.1 dsieger 1487:
1488: * PKGMAKECONF: Location of the mk.conf file used by a package's BSD-style
1489: Makefile. If this is not set, MAKECONF is set to /dev/null to avoid picking
1490: up settings used by builds in /usr/src.
1491:
1.154 rillig 1492: 6.3. Variables affecting the installation process
1.1 dsieger 1493:
1.198 leot 1494: * PKGSRC_KEEP_BIN_PKGS: By default, binary packages of built packages are
1.150 leot 1495: preserved in ${PACKAGES}/All. Setting this variable to "no" prevents this.
1.1 dsieger 1496:
1.107 jnemeth 1497: Packages have to support installation into a subdirectory of WRKDIR. This
1498: allows a package to be built, before the actual filesystem is touched. DESTDIR
1499: support exists in two variations:
1.4 rillig 1500:
1501: * Basic DESTDIR support means that the package installation and packaging is
1502: still run as root.
1503:
1504: * Full DESTDIR support can run the complete build, installation and packaging
1505: as normal user. Root privileges are only needed to add packages.
1506:
1507: With basic DESTDIR support, make clean needs to be run as root.
1508:
1.17 imil 1509: Considering the foo/bar package, DESTDIR full support can be tested using the
1510: following commands
1511:
1512: $ id
1513: uid=1000(myusername) gid=100(users) groups=100(users),0(wheel)
1514: $ mkdir $HOME/packages
1515: $ cd $PKGSRCDIR/foo/bar
1516:
1517: Verify DESTDIR full support, no root privileges should be needed
1518:
1.66 asau 1519: $ make stage-install
1.17 imil 1520:
1521: Create a package without root privileges
1522:
1.66 asau 1523: $ make PACKAGES=$HOME/packages package
1.17 imil 1524:
1525: For the following command, you must be able to gain root privileges using su(1)
1526:
1.66 asau 1527: $ make PACKAGES=$HOME/packages install
1.17 imil 1528:
1529: Then, as a simple user
1530:
1531: $ make clean
1532:
1.154 rillig 1533: 6.4. Selecting and configuring the compiler
1.4 rillig 1534:
1.154 rillig 1535: 6.4.1. Selecting the compiler
1.1 dsieger 1536:
1537: By default, pkgsrc will use GCC to build packages. This may be overridden by
1538: setting the following variables in /etc/mk.conf:
1539:
1540: PKGSRC_COMPILER:
1541:
1542: This is a list of values specifying the chain of compilers to invoke when
1543: building packages. Valid values are:
1544:
1.66 asau 1545: + ccc: Compaq C Compilers (Tru64)
1546:
1547: + ccache: compiler cache (chainable)
1548:
1549: + clang: Clang C and Objective-C compiler
1550:
1.42 asau 1551: + distcc: distributed C/C++ (chainable)
1.1 dsieger 1552:
1.66 asau 1553: + f2c: Fortran 77 to C compiler (chainable)
1554:
1555: + icc: Intel C++ Compiler (Linux)
1556:
1557: + ido: SGI IRIS Development Option cc (IRIX 5)
1.1 dsieger 1558:
1.42 asau 1559: + gcc: GNU C/C++ Compiler
1.1 dsieger 1560:
1.66 asau 1561: + hp: HP-UX C/aC++ compilers
1562:
1.42 asau 1563: + mipspro: Silicon Graphics, Inc. MIPSpro (n32/n64)
1.1 dsieger 1564:
1.66 asau 1565: + mipspro-ucode: Silicon Graphics, Inc. MIPSpro (o32)
1.1 dsieger 1566:
1.42 asau 1567: + sunpro: Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio
1.1 dsieger 1568:
1.118 sevan 1569: + xlc: IBM's XL C/C++ compiler suite
1.66 asau 1570:
1.1 dsieger 1571: The default is "gcc". You can use ccache and/or distcc with an appropriate
1572: PKGSRC_COMPILER setting, e.g. "ccache gcc". This variable should always be
1573: terminated with a value for a real compiler. Note that only one real
1574: compiler should be listed (e.g. "sunpro gcc" is not allowed).
1575:
1576: GCC_REQD:
1577:
1578: This specifies the minimum version of GCC to use when building packages. If
1579: the system GCC doesn't satisfy this requirement, then pkgsrc will build and
1580: install one of the GCC packages to use instead.
1581:
1.153 leot 1582: PYTHON_VERSION_DEFAULT:
1.114 maya 1583:
1584: Specifies which version of python to use when several options are
1585: available.
1586:
1587: PKGSRC_FORTRAN:
1588:
1.176 gutterid 1589: Specifies the Fortran compiler to use. The default is gfortran.
1.114 maya 1590:
1591: GFORTRAN_VERSION:
1592:
1593: If PKGSRC_FORTRAN= gfortran is used, this option specifies which version to
1594: use.
1595:
1.154 rillig 1596: 6.4.2. Additional flags to the compiler (CFLAGS)
1.1 dsieger 1597:
1598: If you wish to set the CFLAGS variable, please make sure to use the += operator
1599: instead of the = operator:
1600:
1601: CFLAGS+= -your -flags
1602:
1603: Using CFLAGS= (i.e. without the "+") may lead to problems with packages that
1.16 jnemeth 1604: need to add their own flags. You may want to take a look at the devel/cpuflags
1.24 wiz 1605: package if you're interested in optimization specifically for the current CPU.
1.1 dsieger 1606:
1.154 rillig 1607: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 1608:
1609: If you want to pass flags to the linker, both in the configure step and the
1610: build step, you can do this in two ways. Either set LDFLAGS or LIBS. The
1611: difference between the two is that LIBS will be appended to the command line,
1612: while LDFLAGS come earlier. LDFLAGS is pre-loaded with rpath settings for ELF
1613: machines depending on the setting of USE_IMAKE or the inclusion of mk/
1614: x11.buildlink3.mk. As with CFLAGS, if you do not wish to override these
1615: settings, use the += operator:
1616:
1617: LDFLAGS+= -your -linkerflags
1618:
1.154 rillig 1619: 6.5. Developer/advanced settings
1.1 dsieger 1620:
1621: * PKG_DEVELOPER: Run some sanity checks that package developers want:
1622:
1.42 asau 1623: + make sure patches apply with zero fuzz
1.1 dsieger 1624:
1.42 asau 1625: + run check-shlibs to see that all binaries will find their shared libs.
1.1 dsieger 1626:
1627: * PKG_DEBUG_LEVEL: The level of debugging output which is displayed whilst
1628: making and installing the package. The default value for this is 0, which
1629: will not display the commands as they are executed (normal, default, quiet
1630: operation); the value 1 will display all shell commands before their
1631: invocation, and the value 2 will display both the shell commands before
1.112 rillig 1632: their invocation, as well as their actual execution progress with set -x.
1.1 dsieger 1633:
1.154 rillig 1634: 6.6. Selecting Build Options
1.1 dsieger 1635:
1636: Some packages have build time options, usually to select between different
1637: dependencies, enable optional support for big dependencies or enable
1638: experimental features.
1639:
1640: To see which options, if any, a package supports, and which options are
1641: mutually exclusive, run make show-options, for example:
1642:
1643: The following options are supported by this package:
1644: ssl Enable SSL support.
1645: Exactly one of the following gecko options is required:
1646: firefox Use firefox as gecko rendering engine.
1647: mozilla Use mozilla as gecko rendering engine.
1648: At most one of the following database options may be selected:
1649: mysql Enable support for MySQL database.
1650: pgsql Enable support for PostgreSQL database.
1651:
1652: These options are enabled by default: firefox
1653: These options are currently enabled: mozilla ssl
1654:
1.4 rillig 1655: The following variables can be defined in mk.conf to select which options to
1656: enable for a package: PKG_DEFAULT_OPTIONS, which can be used to select or
1.1 dsieger 1657: disable options for all packages that support them, and PKG_OPTIONS.pkgbase,
1658: which can be used to select or disable options specifically for package pkgbase
1659: . Options listed in these variables are selected, options preceded by "-" are
1660: disabled. A few examples:
1661:
1.4 rillig 1662: $ grep "PKG.*OPTION" mk.conf
1.1 dsieger 1663: PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
1664: PKG_OPTIONS.kdebase= debug -sasl
1665: PKG_OPTIONS.apache= suexec
1666:
1.11 rillig 1667: It is important to note that options that were specifically suggested by the
1.19 snj 1668: package maintainer must be explicitly removed if you do not wish to include the
1669: option. If you are unsure you can view the current state with make show-options
1670: .
1.11 rillig 1671:
1.1 dsieger 1672: The following settings are consulted in the order given, and the last setting
1673: that selects or disables an option is used:
1674:
1675: 1. the default options as suggested by the package maintainer
1676:
1677: 2. the options implied by the settings of legacy variables (see below)
1678:
1679: 3. PKG_DEFAULT_OPTIONS
1680:
1681: 4. PKG_OPTIONS.pkgbase
1682:
1683: For groups of mutually exclusive options, the last option selected is used, all
1684: others are automatically disabled. If an option of the group is explicitly
1685: disabled, the previously selected option, if any, is used. It is an error if no
1686: option from a required group of options is selected, and building the package
1687: will fail.
1688:
1689: Before the options framework was introduced, build options were selected by
1.4 rillig 1690: setting a variable (often named USE_FOO) in mk.conf for each option. To ease
1691: transition to the options framework for the user, these legacy variables are
1692: converted to the appropriate options setting (PKG_OPTIONS.pkgbase)
1693: automatically. A warning is issued to prompt the user to update mk.conf to use
1694: the options framework directly. Support for the legacy variables will be
1.1 dsieger 1695: removed eventually.
1696:
1.154 rillig 1697: Chapter 7. Creating binary packages
1.1 dsieger 1698:
1699: Table of Contents
1700:
1.154 rillig 1701: 7.1. Building a single binary package
1702: 7.2. Settings for creation of binary packages
1.1 dsieger 1703:
1.154 rillig 1704: 7.1. Building a single binary package
1.1 dsieger 1705:
1706: Once you have built and installed a package, you can create a binary package
1707: which can be installed on another system with pkg_add(1). This saves having to
1708: build the same package on a group of hosts and wasting CPU time. It also
1709: provides a simple means for others to install your package, should you
1710: distribute it.
1711:
1712: To create a binary package, change into the appropriate directory in pkgsrc,
1713: and run make package:
1714:
1.112 rillig 1715: $ cd misc/figlet
1716: $ make package
1.1 dsieger 1717:
1718: This will build and install your package (if not already done), and then build
1719: a binary package from what was installed. You can then use the pkg_* tools to
1720: manipulate it. Binary packages are created by default in /usr/pkgsrc/packages,
1721: in the form of a gzipped tar file. See Section B.2, "Packaging figlet" for a
1722: continuation of the above misc/figlet example.
1723:
1.154 rillig 1724: See Chapter 23, Submitting and Committing for information on how to submit such
1.1 dsieger 1725: a binary package.
1726:
1.154 rillig 1727: 7.2. Settings for creation of binary packages
1.1 dsieger 1728:
1.184 rillig 1729: See Section 13.17, "Other helpful targets".
1.6 rillig 1730:
1.154 rillig 1731: Chapter 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 1732:
1733: Table of Contents
1734:
1.154 rillig 1735: 8.1. Preparations
1.180 rillig 1736: 8.2. Running a bulk build
1.6 rillig 1737:
1.154 rillig 1738: 8.2.1. Configuration
1.6 rillig 1739:
1.154 rillig 1740: 8.3. Requirements of a full bulk build
1.178 rillig 1741: 8.4. Bulk build variants
1742:
1.179 rillig 1743: 8.4.1. Detect unknown configure options
1744: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 1745: 8.4.3. Force compiler options only in the build phase
1746: 8.4.4. Use custom directories
1747: 8.4.5. Turn warnings into errors
1748: 8.4.6. Reject packages for which pkglint reports errors
1749: 8.4.7. Reject packages that contain forbidden strings
1750: 8.4.8. Reject packages whose self-test fails
1751: 8.4.9. Reject packages that use undefined shell variables
1752: 8.4.10. Turn off verbose logging
1.6 rillig 1753:
1.178 rillig 1754: 8.5. Creating a multiple CD-ROM packages collection
1755:
1756: 8.5.1. Example of cdpack
1.6 rillig 1757:
1.175 gutterid 1758: For a number of reasons, you may want to build binary packages for a large
1759: selected set of packages in pkgsrc, or even for all pkgsrc packages. For
1.71 wiz 1760: instance, when you have multiple machines that should run the same software, it
1761: is wasted time if they all build their packages themselves from source. Or you
1762: may want to build a list of packages you want and check them before deploying
1.175 gutterid 1763: onto production systems. There is a way of getting a set of binary packages:
1764: the bulk build system, or pbulk ("p" stands for "parallel"). This chapter
1765: describes how to set it up.
1.71 wiz 1766:
1.154 rillig 1767: 8.1. Preparations
1.71 wiz 1768:
1769: First of all, you have to decide whether you build all packages or a limited
1770: set of them. Full bulk builds usually consume a lot more resources, both space
1.175 gutterid 1771: and time, than builds for some practical sets of packages. A number of
1772: particularly heavy packages exist that are not actually interesting to a wide
1773: audience. (The approximate resource consumption for a full bulk build is given
1774: in section Section 8.3, "Requirements of a full bulk build".) For limited bulk
1775: builds you need to make a list of packages you want to build. Note that all
1776: their dependencies will be built, so you don't need to track them manually.
1.71 wiz 1777:
1778: During bulk builds various packages are installed and deinstalled in /usr/pkg
1779: (or whatever LOCALBASE is), so make sure that you don't need any package during
1.112 rillig 1780: the builds. Essentially, you should provide a fresh system, either a chroot
1.71 wiz 1781: environment or something even more restrictive, depending on what the operating
1782: system provides, or dedicate the whole physical machine. As a useful side
1783: effect this makes sure that bulk builds cannot break anything in your system.
1784: There have been numerous cases where certain packages tried to install files
1785: outside the LOCALBASE or wanted to edit some files in /etc.
1.6 rillig 1786:
1.180 rillig 1787: 8.2. Running a bulk build
1.6 rillig 1788:
1.180 rillig 1789: Running a bulk build works roughly as follows:
1.15 rillig 1790:
1791: * First, build the pbulk infrastructure in a fresh pkgsrc location.
1792:
1793: * Then, build each of the packages from a clean installation directory using
1794: the infrastructure.
1795:
1.154 rillig 1796: 8.2.1. Configuration
1.6 rillig 1797:
1.112 rillig 1798: To simplify configuration, we provide the helper script mk/pbulk/pbulk.sh.
1.6 rillig 1799:
1.68 asau 1800: In order to use it, prepare a clear system (real one, chroot environment, jail,
1801: zone, virtual machine). Configure network access to fetch distribution files.
1.112 rillig 1802: Create a user with name "pbulk".
1.68 asau 1803:
1804: Fetch and extract pkgsrc. Use a command like one of these:
1805:
1.151 sevan 1806: # (cd /usr && ftp -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1807: # (cd /usr && fetch -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1.72 wiz 1808: # (cd /usr && cvs -Q -z3 -d anoncvs@anoncvs.NetBSD.org:/cvsroot get -P pkgsrc)
1.68 asau 1809:
1810: Or any other way that fits (e.g., curl, wget).
1811:
1812: Deploy and configure pbulk tools, e.g.:
1813:
1.118 sevan 1814: # sh pbulk.sh -n # use native make, no bootstrap kit needed (for use on NetBSD)
1.68 asau 1815: # sh pbulk.sh -n -c mk.conf.frag # native, apply settings from given mk.conf fragment
1816: # sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build
1817:
1818: Note
1819:
1820: mk.conf.frag is a fragment of mk.conf that contains settings you want to apply
1821: to packages you build. For instance,
1822:
1.112 rillig 1823: PKG_DEVELOPER= yes # perform more checks
1824: X11_TYPE= modular # use pkgsrc X11
1825: SKIP_LICENSE_CHECK= yes # accept all licences (useful
1826: # when building all packages)
1.68 asau 1827:
1828: If configured for limited list, replace the list in /usr/pbulk/etc/pbulk.list
1.112 rillig 1829: with your list of packages, one per line without empty lines or comments. E.g.:
1.68 asau 1830:
1831: www/firefox
1832: mail/thunderbird
1833: misc/libreoffice4
1834:
1.69 asau 1835: At this point you can also review configuration in /usr/pbulk/etc and make
1836: final amendments, if wanted.
1837:
1.68 asau 1838: Start it:
1839:
1840: # /usr/pbulk/bin/bulkbuild
1841:
1842: After it finishes, you'll have /mnt filled with distribution files, binary
1843: packages, and reports, plain text summary in /mnt/bulklog/meta/report.txt
1844:
1845: Note
1846:
1847: The pbulk.sh script does not cover all possible use cases. While being ready to
1848: run, it serves as a good starting point to understand and build more complex
1849: setups. The script is kept small enough for better understanding.
1850:
1851: Note
1852:
1853: The pbulk.sh script supports running unprivileged bulk build and helps
1854: configuring distributed bulk builds.
1.15 rillig 1855:
1.154 rillig 1856: 8.3. Requirements of a full bulk build
1.71 wiz 1857:
1858: A complete bulk build requires lots of disk space. Some of the disk space can
1859: be read-only, some other must be writable. Some can be on remote filesystems
1860: (such as NFS) and some should be local. Some can be temporary filesystems,
1861: others must survive a sudden reboot.
1862:
1863: * 40 GB for the distfiles (read-write, remote, temporary)
1864:
1865: * 30 GB for the binary packages (read-write, remote, permanent)
1866:
1867: * 1 GB for the pkgsrc tree (read-only, remote, permanent)
1868:
1869: * 5 GB for LOCALBASE (read-write, local, temporary)
1870:
1871: * 10 GB for the log files (read-write, remote, permanent)
1872:
1873: * 5 GB for temporary files (read-write, local, temporary)
1874:
1.178 rillig 1875: 8.4. Bulk build variants
1876:
1877: To ensure that pkgsrc packages work in different configurations, it makes sense
1878: to run non-default bulk builds from time to time. This section lists some ideas
1879: for bulk builds that intentionally let packages fail if they don't follow the
1880: pkgsrc style.
1881:
1.179 rillig 1882: 8.4.1. Detect unknown configure options
1.178 rillig 1883:
1884: Add the following line to mk.conf.
1885:
1886: GNU_CONFIGURE_STRICT= yes
1887:
1888: When a package fails this additional check, the most common cause is that the
1889: configure option was valid for an older version of the package but does not
1890: apply anymore. In that case, just remove it.
1891:
1.179 rillig 1892: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.178 rillig 1893:
1894: The job of a compiler is not restricted to producing executable code, most
1.179 rillig 1895: compilers also detect typical programming mistakes. The pkgsrc compiler
1896: wrappers make it easy to force compiler options when the package is built. This
1897: can be used to find typical bugs across all packages that are in pkgsrc. By
1898: reporting these bugs upstream, the packages will be more reliable with the next
1899: updates.
1.178 rillig 1900:
1.179 rillig 1901: Add some of the following lines to mk.conf:
1.178 rillig 1902:
1903: CFLAGS+= -Werror=char-subscripts
1.179 rillig 1904: CFLAGS+= -Werror=implicit-function-declaration
1.178 rillig 1905:
1.179 rillig 1906: When a package fails to build using these stricter compiler options, document
1907: the circumstances in which the compiler produced the error message. This
1908: includes:
1.178 rillig 1909:
1910: * The platform (MACHINE_PLATFORM)
1911:
1912: * The source file
1913:
1914: * An excerpt of the code. GCC and Clang already do this as part of the
1915: diagnostic.
1916:
1.179 rillig 1917: * The exact error message from the compiler.
1.178 rillig 1918:
1.179 rillig 1919: If a package produces these error messages, but the package is fine, record
1920: this in your local mk.conf, like this, to skip this check in the next builds:
1.178 rillig 1921:
1.179 rillig 1922: .if ${PKGPATH} == category/package
1.178 rillig 1923: # Version ${VERSION} failed on ${MACHINE_PLATFORM}:
1924: # error message
1925: # code
1.179 rillig 1926: # Reason why the code does not need to be fixed.
1.178 rillig 1927: BUILDLINK_TRANSFORM+= rm:-Werror=char-subscripts
1.179 rillig 1928: .endif
1.178 rillig 1929:
1930: If the error messages from the compiler are valid and the code needs to be
1.179 rillig 1931: fixed, prepare a local patch (see LOCALPATCHES) and report the bug to the
1932: upstream authors of the package, providing them with the information you
1933: collected above.
1.178 rillig 1934:
1.179 rillig 1935: Patches that are not essential for the package to work should only be reported
1936: upstream but not committed to pkgsrc, to make future updates easier.
1937:
1.181 rillig 1938: 8.4.3. Force compiler options only in the build phase
1939:
1940: When adding custom compiler flags via CFLAGS, these apply to all phases of the
1941: package build process. Especially in the configure phase, adding -Werror leads
1942: to wrong decisions. The GNU configure scripts feed many small test programs to
1943: the C compiler to see whether certain headers are available, functions are
1944: defined in a library and programs can be run. In many cases these programs
1945: would not survive a strict compiler run with -Wall -Wextra -Werror.
1946:
1947: The pkgsrc infrastructure is flexible enough to support compiler options being
1948: added between the configure and build phases. It's a little more complicated
1949: than the other examples in this section but still easy enough.
1950:
1951: The basic idea is to use the pkgsrc compiler wrapper to inject the desired
1952: compiler options. The compiler wrapper's original task is to hide unwanted
1953: directories of include files and to normalize compiler options. It does this by
1954: wrapping the compiler command and rewriting the command line. To see this in
1955: action, run bmake patch in a package directory and examine the work/.cwrappers/
1956: config directory. It contains individual configurations for the C compiler and
1957: the related tools. The plan is to find a hook between the configure and build
1958: phases, and to modify these configuration files at that point.
1959:
1960: To find this hook, have a look at mk/build/build.mk, which contains among
1961: others the pre-build-checks-hook. The word checks doesn't quite fit, but the
1962: pre-build-hook sounds good enough.
1963:
1964: The code to be included in mk.conf is:
1965:
1966: # Just a few example options.
1967: BUILD_ONLY_CFLAGS= -Wall -Werror -O2 -DTEMPDIR='"/tmp"'
1968:
1969: .if ${BUILD_ONLY_CFLAGS:U:M*}
1970: pre-build-checks-hook: add-build-only-cflags
1971:
1972: add-build-only-cflags: .PHONY
1973: ${RUN} cd ${CWRAPPERS_CONFIG_DIR}; \
1974: ${TEST} ! -f ${.TARGET} || exit 0; \
1975: for flag in ${BUILD_ONLY_CFLAGS}; do \
1976: ${ECHO} "append=$$flag" >> cc; \
1977: done; \
1978: > ${.TARGET}
1979: .endif
1980:
1981: (When editing the mk.conf, make sure that the commands of the
1982: add-build-only-cflags target are indented with a tab, not with spaces.)
1983:
1984: The condition in the .if statement contains the :U modifier to prevent parse
1985: errors if the variable should be undefined, possibly because it is only defined
1986: for a subset of the packages. The :M* modifier ensures that there is at least
1987: one compiler option, to prevent a syntax error in the shell parser.
1988:
1989: The code around the ${.TARGET} variable ensures that the additional compiler
1990: options are only appended once, even if bmake build is run multiple times. To
1991: do this, it creates a marker file.
1992:
1993: To verify that this setup works, run bmake configure in a package directory. Up
1994: to now, everything works as usual. Examine the directory work/.cwrappers/config
1995: to see that the compiler options from BUILD_ONLY_CFLAGS are not yet added to
1996: the file cc. Examine the tail of the work/.work.log file to see that the normal
1997: compiler options are used.
1998:
1999: Now run bmake build. This will append the options to the file cc and will
2000: create the marker file in the same directory. After that, the build starts as
2001: usual, but with the added compiler options. Examine the tail of the file work
2002: /.work.log to see that the lines starting with [*] don't contain the compiler
2003: options, but the corresponding lines starting with <.> do end with these
2004: options.
2005:
2006: Building packages using this setup variant and fixing the resulting bugs is the
2007: same as in Section 8.4.2, "Detect classes of bugs by forcing compiler warnings"
2008: .
2009:
2010: 8.4.4. Use custom directories
1.178 rillig 2011:
2012: Some directories like PREFIX, VARBASE, PKG_SYSCONFDIR, PKGMANDIR, PKG_INFODIR
2013: can be configured in pkgsrc. Set these to arbitrary paths during bootstrap or
2014: afterwards in mk.conf.
2015:
2016: PREFIX= /a-random-uuid
2017: PKG_SYSCONFDIR= /a-random-uuid
2018: VARBASE= /a-random-uuid
2019: PKGMANDIR= a-random-uuid
2020: PKG_INFODIR= a-random-uuid
2021:
1.181 rillig 2022: 8.4.5. Turn warnings into errors
1.178 rillig 2023:
2024: When building a package, warnings are typically ignored since they just flow by
2025: and do not cause the build to fail immediately. To find these warnings,
2026: redefine them to errors in mk.conf.
2027:
2028: DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)"
2029: WARNING_MSG= ${FAIL_MSG} "(was warning)"
2030:
2031: (There are many more classes of warnings in pkgsrc, and most of them can be
2032: redefined with a simple definition like above.
2033:
1.179 rillig 2034: If a package suggests to add USE_TOOLS+=perl to the package Makefile, research
1.178 rillig 2035: whether the package actually needs Perl. If it does, add USE_TOOLS+=perl to the
2036: package Makefile, and if it doesn't, add TOOLS_BROKEN+=perl.
2037:
1.181 rillig 2038: 8.4.6. Reject packages for which pkglint reports errors
1.178 rillig 2039:
2040: Using pkglint as part of the regular build process is mostly a waste of time.
2041: If you want to fix some of the warnings, just run pkglint recursively on the
2042: whole pkgsrc tree. This will take a few minutes (up to 10), which is much
2043: faster than a complete bulk build.
2044:
1.181 rillig 2045: 8.4.7. Reject packages that contain forbidden strings
1.178 rillig 2046:
2047: To ensure that the binary packages don't contain references to the build
2048: directory, there is already CHECK_WRKREF. If that variable includes the item
2049: extra, it is possible to define additional patterns that must not appear in any
2050: installed file. This is specified in mk.conf.
2051:
2052: CHECK_WRKREF= extra
2053: CHECK_WRKREF_EXTRA_DIRS+= /usr/local
2054: CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg
2055: CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@
2056:
2057: The above patterns will probably generate many false positives, therefore the
2058: results need to be taken with a grain of salt.
2059:
1.181 rillig 2060: 8.4.8. Reject packages whose self-test fails
1.178 rillig 2061:
2062: To run the test suites that come with each package, add this line to mk.conf.
2063:
2064: PKGSRC_RUN_TEST= yes
2065:
2066: Be prepared that even the most basic packages fail this test. When doing a bulk
2067: build with this, it will often abort in the early phase where the packages are
2068: scanned for their dependencies since there are cyclic dependencies. There is
2069: still a lot to do in this area.
2070:
1.181 rillig 2071: 8.4.9. Reject packages that use undefined shell variables
1.178 rillig 2072:
2073: To catch typos in the shell snippets from the Makefile fragments, add the -u
2074: flag to most of the commands by adding this line to mk.conf.
2075:
2076: RUN= @set -eu;
2077:
1.181 rillig 2078: After that, ensure that none of the bulk build log files (even those for
2079: successfully built packages) contains the string parameter not set or whatever
2080: error message the command sh -ceu '$undefined' outputs.
2081:
1.178 rillig 2082: See mk/misc/common.mk for the existing definition.
2083:
1.181 rillig 2084: 8.4.10. Turn off verbose logging
1.178 rillig 2085:
2086: The build logs of a package are often quite long. This allows error messages or
2087: other interesting details to hide between the noise. To make the actual error
2088: message stand out more, add these lines to mk.conf.
2089:
2090: GNU_CONFIGURE_QUIET= yes
2091: MAKE_FLAGS+= -s
2092:
2093: The -s option works for both GNU Make and BSD Make. On exotic platforms with
2094: their own make, it may be a little different.
2095:
2096: 8.5. Creating a multiple CD-ROM packages collection
1.1 dsieger 2097:
2098: After your pkgsrc bulk-build has completed, you may wish to create a CD-ROM set
2099: of the resulting binary packages to assist in installing packages on other
2100: machines. The pkgtools/cdpack package provides a simple tool for creating the
2101: ISO 9660 images. cdpack arranges the packages on the CD-ROMs in a way that
2102: keeps all the dependencies for a given package on the same CD as that package.
2103:
1.178 rillig 2104: 8.5.1. Example of cdpack
1.1 dsieger 2105:
2106: Complete documentation for cdpack is found in the cdpack(1) man page. The
2107: following short example assumes that the binary packages are left in /usr/
2108: pkgsrc/packages/All and that sufficient disk space exists in /u2 to hold the
2109: ISO 9660 images.
2110:
2111: # mkdir /u2/images
2112: # pkg_add /usr/pkgsrc/packages/All/cdpack
2113: # cdpack /usr/pkgsrc/packages/All /u2/images
2114:
2115:
2116: If you wish to include a common set of files (COPYRIGHT, README, etc.) on each
2117: CD in the collection, then you need to create a directory which contains these
1.175 gutterid 2118: files, e.g.:
1.1 dsieger 2119:
2120: # mkdir /tmp/common
2121: # echo "This is a README" > /tmp/common/README
2122: # echo "Another file" > /tmp/common/COPYING
2123: # mkdir /tmp/common/bin
2124: # echo "#!/bin/sh" > /tmp/common/bin/myscript
2125: # echo "echo Hello world" >> /tmp/common/bin/myscript
2126: # chmod 755 /tmp/common/bin/myscript
2127:
2128:
2129: Now create the images:
2130:
2131: # cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images
2132:
2133: Each image will contain README, COPYING, and bin/myscript in their root
2134: directories.
2135:
1.154 rillig 2136: Chapter 9. Directory layout of the installed files
1.1 dsieger 2137:
2138: Table of Contents
2139:
1.154 rillig 2140: 9.1. File system layout in ${LOCALBASE}
2141: 9.2. File system layout in ${VARBASE}
1.1 dsieger 2142:
2143: The files that are installed by pkgsrc are organized in a way that is similar
2144: to what you find in the /usr directory of the base system. But some details are
2145: different. This is because pkgsrc initially came from FreeBSD and had adopted
2146: its file system hierarchy. Later it was largely influenced by NetBSD. But no
2147: matter which operating system you are using pkgsrc with, you can expect the
2148: same layout for pkgsrc.
2149:
2150: There are mainly four root directories for pkgsrc, which are all configurable
2151: in the bootstrap/bootstrap script. When pkgsrc has been installed as root, the
2152: default locations are:
2153:
2154: LOCALBASE= /usr/pkg
2155: PKG_SYSCONFBASE= /usr/pkg/etc
2156: VARBASE= /var
1.119 sevan 2157: PKG_DBDIR= /usr/pkg/pkgdb
1.1 dsieger 2158:
2159: In unprivileged mode (when pkgsrc has been installed as any other user), the
2160: default locations are:
2161:
2162: LOCALBASE= ${HOME}/pkg
2163: PKG_SYSCONFBASE= ${HOME}/pkg/etc
2164: VARBASE= ${HOME}/pkg/var
1.119 sevan 2165: PKG_DBDIR= ${HOME}/pkg/pkgdb
1.1 dsieger 2166:
2167: What these four directories are for, and what they look like is explained
2168: below.
2169:
1.25 wiz 2170: * LOCALBASE corresponds to the /usr directory in the base system. It is the "
2171: main" directory where the files are installed and contains the well-known
1.1 dsieger 2172: subdirectories like bin, include, lib, share and sbin.
2173:
2174: * VARBASE corresponds to /var in the base system. Some programs (especially
2175: games, network daemons) need write access to it during normal operation.
2176:
2177: * PKG_SYSCONFDIR corresponds to /etc in the base system. It contains
2178: configuration files of the packages, as well as pkgsrc's mk.conf itself.
2179:
1.154 rillig 2180: 9.1. File system layout in ${LOCALBASE}
1.1 dsieger 2181:
2182: The following directories exist in a typical pkgsrc installation in $
2183: {LOCALBASE}.
2184:
2185: bin
2186:
2187: Contains executable programs that are intended to be directly used by the
2188: end user.
2189:
2190: emul
2191:
2192: Contains files for the emulation layers of various other operating systems,
2193: especially for NetBSD.
2194:
2195: etc (the usual location of ${PKG_SYSCONFDIR})
2196:
2197: Contains the configuration files.
2198:
2199: include
2200:
2201: Contains headers for the C and C++ programming languages.
2202:
2203: info
2204:
2205: Contains GNU info files of various packages.
2206:
2207: lib
2208:
2209: Contains shared and static libraries.
2210:
2211: libdata
2212:
2213: Contains data files that don't change after installation. Other data files
2214: belong into ${VARBASE}.
2215:
2216: libexec
2217:
2218: Contains programs that are not intended to be used by end users, such as
2219: helper programs or network daemons.
2220:
2221: libexec/cgi-bin
2222:
2223: Contains programs that are intended to be executed as CGI scripts by a web
2224: server.
2225:
2226: man (the usual value of ${PKGMANDIR})
2227:
2228: Contains brief documentation in form of manual pages.
2229:
2230: sbin
2231:
2232: Contains programs that are intended to be used only by the super-user.
2233:
2234: share
2235:
2236: Contains platform-independent data files that don't change after
2237: installation.
2238:
2239: share/doc
2240:
2241: Contains documentation files provided by the packages.
2242:
2243: share/examples
2244:
2245: Contains example files provided by the packages. Among others, the original
2246: configuration files are saved here and copied to ${PKG_SYSCONFDIR} during
2247: installation.
2248:
2249: share/examples/rc.d
2250:
2251: Contains the original files for rc.d scripts.
2252:
2253: var (the usual location of ${VARBASE})
2254:
2255: Contains files that may be modified after installation.
2256:
1.154 rillig 2257: 9.2. File system layout in ${VARBASE}
1.1 dsieger 2258:
2259: db/pkg (the usual location of ${PKG_DBDIR})
2260:
2261: Contains information about the currently installed packages.
2262:
2263: games
2264:
2265: Contains highscore files.
2266:
2267: log
2268:
2269: Contains log files.
2270:
2271: run
2272:
2273: Contains informational files about daemons that are currently running.
2274:
1.154 rillig 2275: Chapter 10. Frequently Asked Questions
1.1 dsieger 2276:
2277: Table of Contents
2278:
1.154 rillig 2279: 10.1. Are there any mailing lists for pkg-related discussion?
2280: 10.2. Utilities for package management (pkgtools)
2281: 10.3. How to use pkgsrc as non-root
2282: 10.4. How to resume transfers when fetching distfiles?
2283: 10.5. How can I install/use modular X.org from pkgsrc?
2284: 10.6. How to fetch files from behind a firewall
2285: 10.7. How to fetch files from HTTPS sites
2286: 10.8. How do I tell make fetch to do passive FTP?
2287: 10.9. How to fetch all distfiles at once
2288: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
2289: 10.11. What does "Could not find bsd.own.mk" mean?
2290: 10.12. Using 'sudo' with pkgsrc
2291: 10.13. How do I change the location of configuration files?
2292: 10.14. Automated security checks
2293: 10.15. Why do some packages ignore my CFLAGS?
2294: 10.16. A package does not build. What shall I do?
2295: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.24 wiz 2296: conflicts" mean?
1.1 dsieger 2297:
2298: This section contains hints, tips & tricks on special things in pkgsrc that we
2299: didn't find a better place for in the previous chapters, and it contains items
2300: for both pkgsrc users and developers.
2301:
1.154 rillig 2302: 10.1. Are there any mailing lists for pkg-related discussion?
1.1 dsieger 2303:
2304: The following mailing lists may be of interest to pkgsrc users:
2305:
2306: * pkgsrc-users: This is a general purpose list for most issues regarding
2307: pkgsrc, regardless of platform, e.g. soliciting user help for pkgsrc
2308: configuration, unexpected build failures, using particular packages,
2309: upgrading pkgsrc installations, questions regarding the pkgsrc release
2310: branches, etc. General announcements or proposals for changes that impact
2311: the pkgsrc user community, e.g. major infrastructure changes, new features,
2312: package removals, etc., may also be posted.
2313:
2314: * pkgsrc-bulk: A list where the results of pkgsrc bulk builds are sent and
2315: discussed.
2316:
2317: * pkgsrc-changes: This list is for those who are interested in getting a
2318: commit message for every change committed to pkgsrc. It is also available
2319: in digest form, meaning one daily message containing all commit messages
2320: for changes to the package source tree in that 24 hour period.
2321:
2322: To subscribe, do:
2323:
2324: % echo subscribe listname | mail majordomo@NetBSD.org
2325:
1.174 leot 2326: Archives for all these mailing lists are available from https://
1.1 dsieger 2327: mail-index.NetBSD.org/.
2328:
1.154 rillig 2329: 10.2. Utilities for package management (pkgtools)
1.1 dsieger 2330:
2331: The directory pkgsrc/pkgtools contains a number of useful utilities for both
2332: users and developers of pkgsrc. This section attempts only to make the reader
1.121 sevan 2333: aware of some of the utilities and when they might be useful, and not to
2334: duplicate the documentation that comes with each package.
1.1 dsieger 2335:
2336: Utilities used by pkgsrc (automatically installed when needed):
2337:
2338: * pkgtools/x11-links: Symlinks for use by buildlink.
2339:
2340: OS tool augmentation (automatically installed when needed):
2341:
1.121 sevan 2342: * pkgtools/digest: Calculates various kinds of checksums (including SHA3).
1.1 dsieger 2343:
2344: * pkgtools/libnbcompat: Compatibility library for pkgsrc tools.
2345:
2346: * pkgtools/mtree: Installed on non-BSD systems due to lack of native mtree.
2347:
2348: * pkgtools/pkg_install: Up-to-date replacement for /usr/sbin/pkg_install, or
2349: for use on operating systems where pkg_install is not present.
2350:
2351: Utilities used by pkgsrc (not automatically installed):
2352:
2353: * pkgtools/pkg_tarup: Create a binary package from an already-installed
2354: package. Used by make replace to save the old package.
2355:
2356: * pkgtools/dfdisk: Adds extra functionality to pkgsrc, allowing it to fetch
2357: distfiles from multiple locations. It currently supports the following
2358: methods: multiple CD-ROMs and network FTP/HTTP connections.
2359:
2360: * devel/cpuflags: Determine the best compiler flags to optimise code for your
1.24 wiz 2361: current CPU and compiler.
1.1 dsieger 2362:
2363: Utilities for keeping track of installed packages, being up to date, etc:
2364:
1.65 wiz 2365: * pkgtools/pkgin: A package update tool similar to apt(1). Download, install,
2366: and upgrade binary packages easily.
2367:
1.1 dsieger 2368: * pkgtools/pkg_chk: Reports on packages whose installed versions do not match
2369: the latest pkgsrc entries.
2370:
2371: * pkgtools/pkgdep: Makes dependency graphs of packages, to aid in choosing a
2372: strategy for updating.
2373:
2374: * pkgtools/pkgdepgraph: Makes graphs from the output of pkgtools/pkgdep (uses
2375: graphviz).
2376:
1.12 weinem 2377: * pkgtools/pkglint: The pkglint(1) program checks a pkgsrc entry for errors.
2378:
2379: * pkgtools/lintpkgsrc: The lintpkgsrc(1) program does various checks on the
2380: complete pkgsrc system.
1.1 dsieger 2381:
2382: * pkgtools/pkgsurvey: Report what packages you have installed.
2383:
2384: Utilities for people maintaining or creating individual packages:
2385:
2386: * pkgtools/pkgdiff: Automate making and maintaining patches for a package
2387: (includes pkgdiff, pkgvi, mkpatches, etc.).
2388:
1.65 wiz 2389: * pkgtools/url2pkg: Aids in converting to pkgsrc.
1.1 dsieger 2390:
2391: Utilities for people maintaining pkgsrc (or: more obscure pkg utilities)
2392:
2393: * pkgtools/pkg_comp: Build packages in a chrooted area.
2394:
2395: * pkgtools/libkver: Spoof kernel version for chrooted cross builds.
2396:
1.154 rillig 2397: 10.3. How to use pkgsrc as non-root
1.1 dsieger 2398:
1.108 rillig 2399: To install packages from source as a non-root user, download pkgsrc as
1.154 rillig 2400: described in Chapter 3, Where to get pkgsrc and how to keep it up-to-date, cd
1.108 rillig 2401: into that directory and run the command ./bootstrap/bootstrap --unprivileged.
2402:
2403: This will install the binary part of pkgsrc to ~/pkg and put the pkgsrc
2404: configuration mk.conf into ~/pkg/etc.
2405:
2406: For more details, see mk/unprivileged.mk.
1.1 dsieger 2407:
1.154 rillig 2408: 10.4. How to resume transfers when fetching distfiles?
1.1 dsieger 2409:
2410: By default, resuming transfers in pkgsrc is disabled, but you can enable this
1.4 rillig 2411: feature by adding the option PKG_RESUME_TRANSFERS=YES into mk.conf. If, during
2412: a fetch step, an incomplete distfile is found, pkgsrc will try to resume it.
1.1 dsieger 2413:
1.61 wiz 2414: You can also use a different program than the platform default program by
2415: changing the FETCH_USING variable. You can specify the program by using of ftp,
2416: fetch, wget or curl. Alternatively, fetching can be disabled by using the value
2417: manual. A value of custom disables the system defaults and dependency tracking
2418: for the fetch program. In that case you have to provide FETCH_CMD,
2419: FETCH_BEFORE_ARGS, FETCH_RESUME_ARGS, FETCH_OUTPUT_ARGS, FETCH_AFTER_ARGS.
1.1 dsieger 2420:
1.16 jnemeth 2421: For example, if you want to use wget to download, you'll have to use something
2422: like:
1.1 dsieger 2423:
1.16 jnemeth 2424: FETCH_USING= wget
1.1 dsieger 2425:
1.154 rillig 2426: 10.5. How can I install/use modular X.org from pkgsrc?
1.1 dsieger 2427:
1.4 rillig 2428: If you want to use modular X.org from pkgsrc instead of your system's own X11
2429: (/usr/X11R6, /usr/openwin, ...) you will have to add the following line into
1.1 dsieger 2430: mk.conf:
2431:
1.4 rillig 2432: X11_TYPE=modular
1.1 dsieger 2433:
1.154 rillig 2434: 10.6. How to fetch files from behind a firewall
1.1 dsieger 2435:
2436: If you are sitting behind a firewall which does not allow direct connections to
2437: Internet hosts (i.e. non-NAT), you may specify the relevant proxy hosts. This
2438: is done using an environment variable in the form of a URL, e.g. in Amdahl, the
2439: machine "orpheus.amdahl.com" is one of the firewalls, and it uses port 80 as
2440: the proxy port number. So the proxy environment variables are:
2441:
2442: ftp_proxy=ftp://orpheus.amdahl.com:80/
2443: http_proxy=http://orpheus.amdahl.com:80/
2444:
1.154 rillig 2445: 10.7. How to fetch files from HTTPS sites
1.65 wiz 2446:
2447: Some fetch tools are not prepared to support HTTPS by default (for example, the
2448: one in NetBSD 6.0), or the one installed by the pkgsrc bootstrap (to avoid an
2449: openssl dependency that low in the dependency graph).
2450:
2451: Usually you won't notice, because distribution files are mirrored weekly to "
2452: ftp.NetBSD.org", but that might not be often enough if you are following
2453: pkgsrc-current. In that case, set FETCH_USING in your mk.conf file to "curl" or
2454: "wget", which are both compiled with HTTPS support by default. Of course, these
2455: tools need to be installed before you can use them this way.
2456:
1.154 rillig 2457: 10.8. How do I tell make fetch to do passive FTP?
1.1 dsieger 2458:
2459: This depends on which utility is used to retrieve distfiles. From bsd.pkg.mk,
2460: FETCH_CMD is assigned the first available command from the following list:
2461:
2462: * ${LOCALBASE}/bin/ftp
2463:
2464: * /usr/bin/ftp
2465:
2466: On a default NetBSD installation, this will be /usr/bin/ftp, which
2467: automatically tries passive connections first, and falls back to active
2468: connections if the server refuses to do passive. For the other tools, add the
1.4 rillig 2469: following to your mk.conf file: PASSIVE_FETCH=1.
1.1 dsieger 2470:
2471: Having that option present will prevent /usr/bin/ftp from falling back to
2472: active transfers.
2473:
1.154 rillig 2474: 10.9. How to fetch all distfiles at once
1.1 dsieger 2475:
2476: You would like to download all the distfiles in a single batch from work or
2477: university, where you can't run a make fetch. There is an archive of distfiles
2478: on ftp.NetBSD.org, but downloading the entire directory may not be appropriate.
2479:
2480: The answer here is to do a make fetch-list in /usr/pkgsrc or one of its
2481: subdirectories, carry the resulting list to your machine at work/school and use
2482: it there. If you don't have a NetBSD-compatible ftp(1) (like tnftp) at work,
2483: don't forget to set FETCH_CMD to something that fetches a URL:
2484:
2485: At home:
2486:
2487: % cd /usr/pkgsrc
2488: % make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh
2489: % scp /tmp/fetch.sh work:/tmp
2490:
2491: At work:
2492:
2493: % sh /tmp/fetch.sh
2494:
2495: then tar up /tmp/distfiles and take it home.
2496:
2497: If you have a machine running NetBSD, and you want to get all distfiles (even
2498: ones that aren't for your machine architecture), you can do so by using the
2499: above-mentioned make fetch-list approach, or fetch the distfiles directly by
2500: running:
2501:
2502: % make mirror-distfiles
2503:
2504: If you even decide to ignore NO_{SRC,BIN}_ON_{FTP,CDROM}, then you can get
2505: everything by running:
2506:
2507: % make fetch NO_SKIP=yes
2508:
1.154 rillig 2509: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
1.1 dsieger 2510:
2511: When compiling the pkgtools/pkg_install package, you get the error from make
2512: that it doesn't know how to make /usr/share/tmac/tmac.andoc? This indicates
2513: that you don't have installed the "text" set (nroff, ...) from the NetBSD base
2514: distribution on your machine. It is recommended to do that to format man pages.
2515:
2516: In the case of the pkgtools/pkg_install package, you can get away with setting
1.4 rillig 2517: NOMAN=YES either in the environment or in mk.conf.
1.1 dsieger 2518:
1.154 rillig 2519: 10.11. What does "Could not find bsd.own.mk" mean?
1.1 dsieger 2520:
2521: You didn't install the compiler set, comp.tgz, when you installed your NetBSD
2522: machine. Please get and install it, by extracting it in /:
2523:
2524: # cd /
2525: # tar --unlink -zxvpf .../comp.tgz
2526:
2527: comp.tgz is part of every NetBSD release. Get the one that corresponds to your
2528: release (determine via uname -r).
2529:
1.154 rillig 2530: 10.12. Using 'sudo' with pkgsrc
1.1 dsieger 2531:
2532: When installing packages as non-root user and using the just-in-time su(1)
2533: feature of pkgsrc, it can become annoying to type in the root password for each
2534: required package installed. To avoid this, the sudo package can be used, which
2535: does password caching over a limited time. To use it, install sudo (either as
1.4 rillig 2536: binary package or from security/sudo) and then put the following into your
2537: mk.conf, somewhere after the definition of the LOCALBASE variable:
1.1 dsieger 2538:
2539: .if exists(${LOCALBASE}/bin/sudo)
2540: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
2541: .endif
2542:
1.154 rillig 2543: 10.13. How do I change the location of configuration files?
1.1 dsieger 2544:
2545: As the system administrator, you can choose where configuration files are
2546: installed. The default settings make all these files go into ${PREFIX}/etc or
2547: some of its subdirectories; this may be suboptimal depending on your
2548: expectations (e.g., a read-only, NFS-exported PREFIX with a need of per-machine
2549: configuration of the provided packages).
2550:
2551: In order to change the defaults, you can modify the PKG_SYSCONFBASE variable
1.4 rillig 2552: (in mk.conf) to point to your preferred configuration directory; some common
2553: examples include /etc or /etc/pkg.
1.1 dsieger 2554:
2555: Furthermore, you can change this value on a per-package basis by setting the
2556: PKG_SYSCONFDIR.${PKG_SYSCONFVAR} variable. PKG_SYSCONFVAR's value usually
2557: matches the name of the package you would like to modify, that is, the contents
2558: of PKGBASE.
2559:
2560: Note that after changing these settings, you must rebuild and reinstall any
2561: affected packages.
2562:
1.154 rillig 2563: 10.14. Automated security checks
1.1 dsieger 2564:
2565: Please be aware that there can often be bugs in third-party software, and some
2566: of these bugs can leave a machine vulnerable to exploitation by attackers. In
2567: an effort to lessen the exposure, the NetBSD packages team maintains a database
2568: of known-exploits to packages which have at one time been included in pkgsrc.
2569: The database can be downloaded automatically, and a security audit of all
1.14 jmcneill 2570: packages installed on a system can take place. To do this, refer to the
2571: following two tools (installed as part of the pkgtools/pkg_install package):
1.1 dsieger 2572:
1.21 snj 2573: 1. pkg_admin fetch-pkg-vulnerabilities, an easy way to download a list of the
2574: security vulnerabilities information. This list is kept up to date by the
1.26 spz 2575: pkgsrc security team, and is distributed from the NetBSD ftp server:
1.1 dsieger 2576:
1.177 leot 2577: https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities
1.1 dsieger 2578:
1.21 snj 2579: 2. pkg_admin audit, an easy way to audit the current machine, checking each
1.24 wiz 2580: known vulnerability. If a vulnerable package is installed, it will be shown
2581: by output to stdout, including a description of the type of vulnerability,
2582: and a URL containing more information.
1.1 dsieger 2583:
1.202 ! nia 2584: Use of these tools is strongly recommended! See Section 5.1.6, "Checking for
1.121 sevan 2585: security vulnerabilities in installed packages" for instructions on how to
2586: automate checking and reporting.
2587:
2588: If this database is installed, pkgsrc builds will use it to perform a security
2589: check before building any package.
1.1 dsieger 2590:
1.154 rillig 2591: 10.15. Why do some packages ignore my CFLAGS?
1.1 dsieger 2592:
2593: When you add your own preferences to the CFLAGS variable in your mk.conf, these
2594: flags are passed in environment variables to the ./configure scripts and to
2595: make(1). Some package authors ignore the CFLAGS from the environment variable
2596: by overriding them in the Makefiles of their package.
2597:
2598: Currently there is no solution to this problem. If you really need the package
2599: to use your CFLAGS you should run make patch in the package directory and then
2600: inspect any Makefile and Makefile.in for whether they define CFLAGS explicitly.
2601: Usually you can remove these lines. But be aware that some "smart" programmers
2602: write so bad code that it only works for the specific combination of CFLAGS
2603: they have chosen.
2604:
1.172 rillig 2605: To find out where the CFLAGS are ignored, add the following lines to mk.conf:
2606:
2607: CPPFLAGS+= -Dpkgsrc___CPPFLAGS
2608: CFLAGS+= -Dpkgsrc___CFLAGS
2609: CXXFLAGS+= -Dpkgsrc___CXXFLAGS
2610:
2611: Then run bmake show-all-configure show-all-build to see whether the above flags
2612: are passed to the actual build commands in general.
2613:
2614: To find out whether the flags are passed to individual compiler commands, have
2615: a look at the file work/.work.log. In most cases, the flags from the original
2616: command lines (the lines starting with [*]) are passed unmodified to the actual
2617: compiler (the lines starting with <.>). If the flag is missing from the actual
2618: compiler command, it must have been removed by the pkgsrc compiler wrappers.
2619:
1.154 rillig 2620: 10.16. A package does not build. What shall I do?
1.1 dsieger 2621:
2622: 1. Make sure that your copy of pkgsrc is consistent. A case that occurs often
2623: is that people only update pkgsrc in parts, because of performance reasons.
2624: Since pkgsrc is one large system, not a collection of many small systems,
2625: there are sometimes changes that only work when the whole pkgsrc tree is
2626: updated.
2627:
1.25 wiz 2628: 2. Make sure that you don't have any CVS conflicts. Search for "<<<<<<" or "
2629: >>>>>>" in all your pkgsrc files.
1.1 dsieger 2630:
1.25 wiz 2631: 3. Make sure that you don't have old copies of the packages extracted. Run
1.1 dsieger 2632: make clean clean-depends to verify this.
2633:
1.108 rillig 2634: 4. If you are a package developer who wants to invest some work, have a look
1.154 rillig 2635: at Chapter 21, Making your package work.
1.108 rillig 2636:
2637: 5. If the problem still exists, write a mail to the pkgsrc-users mailing list.
1.1 dsieger 2638:
1.154 rillig 2639: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.1 dsieger 2640: conflicts" mean?
2641:
2642: You have modified a file from pkgsrc, and someone else has modified that same
2643: file afterwards in the CVS repository. Both changes are in the same region of
2644: the file, so when you updated pkgsrc, the cvs command marked the conflicting
2645: changes in the file. Because of these markers, the file is no longer a valid
2646: Makefile.
2647:
2648: Have a look at that file, and if you don't need your local changes anymore, you
2649: can remove that file and run cvs -q update -dP in that directory to download
2650: the current version.
2651:
2652: Part II. The pkgsrc developer's guide
2653:
2654: This part of the book deals with creating and modifying packages. It starts
2655: with a "HOWTO"-like guide on creating a new package. The remaining chapters are
2656: more like a reference manual for pkgsrc.
2657:
2658: Table of Contents
2659:
1.154 rillig 2660: 11. Getting help
1.184 rillig 2661: 12. Package components - files, directories and contents
1.1 dsieger 2662:
1.184 rillig 2663: 12.1. Makefile
2664: 12.2. distinfo
2665: 12.3. patches/*
1.1 dsieger 2666:
1.184 rillig 2667: 12.3.1. Structure of a single patch file
2668: 12.3.2. Creating patch files
2669: 12.3.3. Sources where the patch files come from
2670: 12.3.4. Patching guidelines
2671: 12.3.5. Feedback to the author
1.1 dsieger 2672:
1.184 rillig 2673: 12.4. Other mandatory files
2674: 12.5. Optional files
1.1 dsieger 2675:
1.184 rillig 2676: 12.5.1. Files affecting the binary package
2677: 12.5.2. Files affecting the build process
2678: 12.5.3. Files affecting nothing at all
1.1 dsieger 2679:
1.184 rillig 2680: 12.6. work*
2681: 12.7. files/*
1.1 dsieger 2682:
1.184 rillig 2683: 13. The build process
1.1 dsieger 2684:
1.184 rillig 2685: 13.1. Introduction
2686: 13.2. Program location
2687: 13.3. Directories used during the build process
2688: 13.4. Running a phase
2689: 13.5. The fetch phase
1.1 dsieger 2690:
1.184 rillig 2691: 13.5.1. What to fetch and where to get it from
2692: 13.5.2. How are the files fetched?
1.1 dsieger 2693:
1.184 rillig 2694: 13.6. The checksum phase
2695: 13.7. The extract phase
2696: 13.8. The patch phase
2697: 13.9. The tools phase
2698: 13.10. The wrapper phase
2699: 13.11. The configure phase
2700: 13.12. The build phase
2701: 13.13. The test phase
2702: 13.14. The install phase
2703: 13.15. The package phase
2704: 13.16. Cleaning up
2705: 13.17. Other helpful targets
1.1 dsieger 2706:
1.184 rillig 2707: 14. Creating a new pkgsrc package from scratch
1.1 dsieger 2708:
1.184 rillig 2709: 14.1. Common types of packages
1.1 dsieger 2710:
1.184 rillig 2711: 14.1.1. Perl modules
2712: 14.1.2. Python modules and programs
2713: 14.1.3. R packages
2714: 14.1.4. TeXlive packages
1.1 dsieger 2715:
1.184 rillig 2716: 14.2. Examples
1.1 dsieger 2717:
1.184 rillig 2718: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 2719:
1.184 rillig 2720: 15. Programming in Makefiles
1.1 dsieger 2721:
1.184 rillig 2722: 15.1. Caveats
2723: 15.2. Makefile variables
1.1 dsieger 2724:
1.184 rillig 2725: 15.2.1. Naming conventions
1.1 dsieger 2726:
1.184 rillig 2727: 15.3. Code snippets
1.1 dsieger 2728:
1.184 rillig 2729: 15.3.1. Adding things to a list
2730: 15.3.2. Echoing a string exactly as-is
2731: 15.3.3. Passing CFLAGS to GNU configure scripts
2732: 15.3.4. Handling possibly empty variables
1.1 dsieger 2733:
1.184 rillig 2734: 16. Options handling
1.1 dsieger 2735:
1.184 rillig 2736: 16.1. Global default options
2737: 16.2. Converting packages to use bsd.options.mk
2738: 16.3. Option Names
2739: 16.4. Determining the options of dependencies
1.1 dsieger 2740:
1.184 rillig 2741: 17. Tools needed for building or running
1.1 dsieger 2742:
1.184 rillig 2743: 17.1. Tools for pkgsrc builds
2744: 17.2. Tools needed by packages
2745: 17.3. Tools provided by platforms
1.1 dsieger 2746:
1.184 rillig 2747: 18. Buildlink methodology
1.1 dsieger 2748:
1.184 rillig 2749: 18.1. Converting packages to use buildlink3
2750: 18.2. Writing buildlink3.mk files
1.1 dsieger 2751:
1.184 rillig 2752: 18.2.1. Anatomy of a buildlink3.mk file
2753: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.
2754: pkg in buildlink3.mk files
1.1 dsieger 2755:
1.184 rillig 2756: 18.3. Writing builtin.mk files
1.1 dsieger 2757:
1.184 rillig 2758: 18.3.1. Anatomy of a builtin.mk file
2759: 18.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 2760:
1.184 rillig 2761: 19. PLIST issues
1.1 dsieger 2762:
1.184 rillig 2763: 19.1. RCS ID
2764: 19.2. Semi-automatic PLIST generation
2765: 19.3. Tweaking output of make print-PLIST
2766: 19.4. Variable substitution in PLIST
2767: 19.5. Man page compression
2768: 19.6. Changing PLIST source with PLIST_SRC
2769: 19.7. Platform-specific and differing PLISTs
2770: 19.8. Build-specific PLISTs
2771: 19.9. Sharing directories between packages
1.1 dsieger 2772:
1.184 rillig 2773: 20. The pkginstall framework
1.1 dsieger 2774:
1.184 rillig 2775: 20.1. Files and directories outside the installation prefix
1.1 dsieger 2776:
1.184 rillig 2777: 20.1.1. Directory manipulation
2778: 20.1.2. File manipulation
1.1 dsieger 2779:
1.184 rillig 2780: 20.2. Configuration files
1.1 dsieger 2781:
1.184 rillig 2782: 20.2.1. How PKG_SYSCONFDIR is set
2783: 20.2.2. Telling the software where configuration files are
2784: 20.2.3. Patching installations
2785: 20.2.4. Disabling handling of configuration files
1.1 dsieger 2786:
1.184 rillig 2787: 20.3. System startup scripts
1.1 dsieger 2788:
1.184 rillig 2789: 20.3.1. Disabling handling of system startup scripts
1.1 dsieger 2790:
1.184 rillig 2791: 20.4. System users and groups
2792: 20.5. System shells
1.1 dsieger 2793:
1.184 rillig 2794: 20.5.1. Disabling shell registration
1.1 dsieger 2795:
1.184 rillig 2796: 20.6. Fonts
1.1 dsieger 2797:
1.184 rillig 2798: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 2799:
1.154 rillig 2800: 21. Making your package work
1.1 dsieger 2801:
1.154 rillig 2802: 21.1. General operation
1.1 dsieger 2803:
1.154 rillig 2804: 21.1.1. How to pull in user-settable variables from mk.conf
2805: 21.1.2. User interaction
2806: 21.1.3. Handling licenses
2807: 21.1.4. Restricted packages
2808: 21.1.5. Handling dependencies
2809: 21.1.6. Handling conflicts with other packages
2810: 21.1.7. Packages that cannot or should not be built
2811: 21.1.8. Packages which should not be deleted, once installed
2812: 21.1.9. Handling packages with security problems
2813: 21.1.10. How to handle incrementing versions when fixing an existing
1.1 dsieger 2814: package
1.154 rillig 2815: 21.1.11. Substituting variable text in the package files (the SUBST
1.1 dsieger 2816: framework)
2817:
1.154 rillig 2818: 21.2. The fetch phase
1.1 dsieger 2819:
1.154 rillig 2820: 21.2.1. Packages whose distfiles aren't available for plain downloading
2821: 21.2.2. How to handle modified distfiles with the 'old' name
2822: 21.2.3. Packages hosted on github.com
2823:
2824: 21.3. The configure phase
2825:
2826: 21.3.1. Shared libraries - libtool
2827: 21.3.2. Using libtool on GNU packages that already support libtool
2828: 21.3.3. GNU Autoconf/Automake
2829:
2830: 21.4. Programming languages
2831:
2832: 21.4.1. C, C++, and Fortran
2833: 21.4.2. Java
2834: 21.4.3. Packages containing perl scripts
2835: 21.4.4. Packages containing shell scripts
2836: 21.4.5. Other programming languages
2837:
2838: 21.5. The build phase
2839:
2840: 21.5.1. Compiling C and C++ code conditionally
2841: 21.5.2. How to handle compiler bugs
1.172 rillig 2842: 21.5.3. No such file or directory
2843: 21.5.4. Undefined reference to "..."
2844: 21.5.5. Running out of memory
1.154 rillig 2845:
2846: 21.6. The install phase
2847:
2848: 21.6.1. Creating needed directories
2849: 21.6.2. Where to install documentation
2850: 21.6.3. Installing highscore files
2851: 21.6.4. Adding DESTDIR support to packages
2852: 21.6.5. Packages with hardcoded paths to other interpreters
2853: 21.6.6. Packages installing perl modules
2854: 21.6.7. Packages installing info files
2855: 21.6.8. Packages installing man pages
2856: 21.6.9. Packages installing GConf data files
2857: 21.6.10. Packages installing scrollkeeper/rarian data files
2858: 21.6.11. Packages installing X11 fonts
2859: 21.6.12. Packages installing GTK2 modules
2860: 21.6.13. Packages installing SGML or XML data
2861: 21.6.14. Packages installing extensions to the MIME database
2862: 21.6.15. Packages using intltool
2863: 21.6.16. Packages installing startup scripts
2864: 21.6.17. Packages installing TeX modules
2865: 21.6.18. Packages supporting running binaries in emulation
2866: 21.6.19. Packages installing hicolor theme icons
2867: 21.6.20. Packages installing desktop files
2868:
2869: 21.7. Marking packages as having problems
2870:
1.184 rillig 2871: 22. GNOME packaging and porting
2872:
2873: 22.1. Meta packages
2874: 22.2. Packaging a GNOME application
2875: 22.3. Updating GNOME to a newer version
2876: 22.4. Patching guidelines
2877:
1.154 rillig 2878: 23. Submitting and Committing
2879:
2880: 23.1. Submitting binary packages
2881: 23.2. Submitting source packages (for non-NetBSD-developers)
2882: 23.3. General notes when adding, updating, or removing packages
2883: 23.4. Commit Messages
2884: 23.5. Committing: Adding a package to CVS
2885: 23.6. Updating a package to a newer version
2886: 23.7. Renaming a package in pkgsrc
2887: 23.8. Moving a package in pkgsrc
2888:
2889: 24. Frequently Asked Questions
2890:
2891: Chapter 11. Getting help
2892:
2893: To get help when developing pkgsrc, the definitive source is this document, the
2894: pkgsrc guide. If you don't find anything here, there are alternatives:
2895:
2896: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
2897: Run bmake help topic=? to get help for any topic, such as a variable name
2898: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
2899: like strcasecmp or any other topic.
2900:
2901: The available help topics are listed in Appendix D, Help topics.
2902:
1.163 rillig 2903: * To see the value of a single variable, run bmake show-var VARNAME=X.
2904:
2905: * To see the values of the most common variables, run bmake show-all. These
2906: variables are grouped by topic. To see the variables for a single topic,
2907: run bmake show-all-topic, for example bmake show-all-fetch.
2908:
1.154 rillig 2909: * The tech-pkg mailing list, to which you can subscribe and then ask your
2910: questions.
2911:
2912: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
2913: a specialized chat program such as XChat. Pick any user name and join the
2914: channel #pkgsrc.
1.1 dsieger 2915:
1.184 rillig 2916: Chapter 12. Package components - files, directories and contents
1.1 dsieger 2917:
2918: Table of Contents
2919:
1.184 rillig 2920: 12.1. Makefile
2921: 12.2. distinfo
2922: 12.3. patches/*
2923:
2924: 12.3.1. Structure of a single patch file
2925: 12.3.2. Creating patch files
2926: 12.3.3. Sources where the patch files come from
2927: 12.3.4. Patching guidelines
2928: 12.3.5. Feedback to the author
2929:
2930: 12.4. Other mandatory files
2931: 12.5. Optional files
2932:
2933: 12.5.1. Files affecting the binary package
2934: 12.5.2. Files affecting the build process
2935: 12.5.3. Files affecting nothing at all
1.1 dsieger 2936:
1.184 rillig 2937: 12.6. work*
2938: 12.7. files/*
1.1 dsieger 2939:
1.184 rillig 2940: Whenever you're preparing a package, there are a number of files involved which
2941: are described in the following sections.
1.1 dsieger 2942:
1.184 rillig 2943: 12.1. Makefile
1.1 dsieger 2944:
1.184 rillig 2945: Building, installation and creation of a binary package are all controlled by
2946: the package's Makefile. The Makefile describes various things about a package,
2947: for example from where to get it, how to configure, build, and install it.
1.1 dsieger 2948:
1.184 rillig 2949: A package Makefile contains several sections that describe the package.
1.1 dsieger 2950:
1.184 rillig 2951: In the first section there are the following variables, which should appear
2952: exactly in the order given here. The order and grouping of the variables is
2953: mostly historical and has no further meaning.
1.1 dsieger 2954:
1.184 rillig 2955: * DISTNAME is the basename of the distribution file to be downloaded from the
2956: package's website.
1.1 dsieger 2957:
1.184 rillig 2958: * PKGNAME is the name of the package, as used by pkgsrc. You need to provide
2959: it if DISTNAME (which is the default) is not a good name for the package in
2960: pkgsrc or DISTNAME is not provided (no distribution file is required).
2961: Usually it is the pkgsrc directory name together with the version number.
2962: It must match the regular expression ^[A-Za-z0-9][A-Za-z0-9-_.+]*$, that
2963: is, it starts with a letter or digit, and contains only letters, digits,
2964: dashes, underscores, dots and plus signs.
1.26 spz 2965:
1.184 rillig 2966: * CATEGORIES is a list of categories which the package fits in. You can
2967: choose any of the top-level directories of pkgsrc for it.
1.1 dsieger 2968:
1.184 rillig 2969: Currently the following values are available for CATEGORIES. If more than
2970: one is used, they need to be separated by spaces:
1.1 dsieger 2971:
1.184 rillig 2972: archivers cross geography meta-pkgs security
2973: audio databases graphics misc shells
2974: benchmarks devel ham multimedia sysutils
2975: biology editors inputmethod net textproc
2976: cad emulators lang news time
2977: chat finance mail parallel wm
2978: comms fonts math pkgtools www
2979: converters games mbone print x11
1.1 dsieger 2980:
1.184 rillig 2981: * MASTER_SITES, DYNAMIC_MASTER_SITES, DIST_SUBDIR, EXTRACT_SUFX and DISTFILES
2982: are discussed in detail in Section 13.5, "The fetch phase".
1.1 dsieger 2983:
1.184 rillig 2984: The second section contains information about separately downloaded patches, if
2985: any.
1.1 dsieger 2986:
1.184 rillig 2987: * PATCHFILES: Name(s) of additional files that contain distribution patches.
2988: There is no default. pkgsrc will look for them at PATCH_SITES. They will
2989: automatically be uncompressed before patching if the names end with .gz or
2990: .Z.
1.1 dsieger 2991:
1.184 rillig 2992: * PATCH_SITES: Primary location(s) for distribution patch files (see
2993: PATCHFILES above) if not found locally.
1.1 dsieger 2994:
1.184 rillig 2995: * PATCH_DIST_STRIP: an argument to patch(1) that sets the pathname strip
2996: count to help find the correct files to patch. It defaults to -p0.
1.1 dsieger 2997:
1.184 rillig 2998: The third section contains the following variables.
1.1 dsieger 2999:
1.184 rillig 3000: * MAINTAINER is the email address of the person who feels responsible for
3001: this package, and who is most likely to look at problems or questions
3002: regarding this package which have been reported with send-pr(1). Other
3003: developers may contact the MAINTAINER before making changes to the package,
3004: but are not required to do so. When packaging a new program, set MAINTAINER
3005: to yourself. If you really can't maintain the package for future updates,
3006: set it to <pkgsrc-users@NetBSD.org>.
1.1 dsieger 3007:
1.184 rillig 3008: * OWNER should be used instead of MAINTAINER when you do not want other
3009: developers to update or change the package without contacting you first. A
3010: package Makefile should contain one of MAINTAINER or OWNER, but not both.
1.1 dsieger 3011:
1.184 rillig 3012: * HOMEPAGE is a URL where users can find more information about the package.
1.1 dsieger 3013:
1.184 rillig 3014: * COMMENT is a one-line description of the package (should not include the
3015: package name).
1.1 dsieger 3016:
1.184 rillig 3017: * LICENSE indicates the license(s) applicable for the package. See
3018: Section 21.1.3, "Handling licenses" for further details.
1.1 dsieger 3019:
1.184 rillig 3020: Other variables that affect the build:
1.1 dsieger 3021:
1.184 rillig 3022: * WRKSRC: The directory where the interesting distribution files of the
3023: package are found. The default is ${WRKDIR}/${DISTNAME}, which works for
3024: most packages.
1.1 dsieger 3025:
1.184 rillig 3026: If a package doesn't create a subdirectory for itself (most GNU software
3027: does, for instance), but extracts itself in the current directory, you
3028: should set WRKSRC=${WRKDIR}.
1.1 dsieger 3029:
1.184 rillig 3030: If a package doesn't create a subdirectory with the name of DISTNAME but
3031: some different name, set WRKSRC to point to the proper name in ${WRKDIR},
3032: for example WRKSRC=${WRKDIR}/${DISTNAME}/unix. See lang/tcl and x11/tk for
3033: other examples.
1.17 imil 3034:
1.184 rillig 3035: The name of the working directory created by pkgsrc is taken from the
3036: WRKDIR_BASENAME variable. By default, its value is work. If you want to use
3037: the same pkgsrc tree for building different kinds of binary packages, you
3038: can change the variable according to your needs. Two other variables handle
3039: common cases of setting WRKDIR_BASENAME individually. If OBJHOSTNAME is
3040: defined in mk.conf, the first component of the host's name is attached to
3041: the directory name. If OBJMACHINE is defined, the platform name is
3042: attached, which might look like work.i386 or work.sparc.
1.17 imil 3043:
1.184 rillig 3044: Please pay attention to the following gotchas:
1.17 imil 3045:
1.184 rillig 3046: * Add MANCOMPRESSED if man pages are installed in compressed form by the
3047: package. For packages using BSD-style makefiles which honor MANZ, there is
3048: MANCOMPRESSED_IF_MANZ.
1.17 imil 3049:
1.184 rillig 3050: * Replace /usr/local with "${PREFIX}" in all files (see patches, below).
1.103 wiz 3051:
1.184 rillig 3052: * If the package installs any info files, see Section 21.6.7, "Packages
3053: installing info files".
1.103 wiz 3054:
1.184 rillig 3055: 12.2. distinfo
1.17 imil 3056:
1.184 rillig 3057: The distinfo file contains the message digest, or checksum, of each distfile
3058: needed for the package. This ensures that the distfiles retrieved from the
3059: Internet have not been corrupted during transfer or altered by a malign force
3060: to introduce a security hole. To provide maximum security, all distfiles are
3061: protected using three different message digest algorithms (SHA1, RMD160,
3062: SHA512), as well as the file size.
1.17 imil 3063:
1.184 rillig 3064: The distinfo file also contains the checksums for all the patches found in the
3065: patches directory (see Section 12.3, "patches/*"). These checksums ensure that
3066: patches are only applied intentionally and that they don't accidentally change,
3067: e.g. when merging different changes together. They also make sure that new
3068: patches are actually added to CVS and old ones are removed. Too see whether the
3069: patches and the distinfo file match, run pkglint after changing the patches.
1.17 imil 3070:
1.184 rillig 3071: To regenerate the distinfo file, use the make distinfo command.
1.17 imil 3072:
1.184 rillig 3073: Some packages have different sets of distfiles depending on the platform, for
3074: example lang/openjdk8. These are kept in the same distinfo file and care should
3075: be taken when upgrading such a package to ensure distfile information is not
3076: lost.
1.17 imil 3077:
1.184 rillig 3078: 12.3. patches/*
1.63 wiz 3079:
1.184 rillig 3080: Some packages don't work out-of-the box on the various platforms that are
3081: supported by pkgsrc. These packages need to be patched to make them work. The
3082: patch files can be found in the patches/ directory.
1.17 imil 3083:
1.184 rillig 3084: In the patch phase, these patches are applied to the files in WRKSRC directory
3085: after extracting them, in alphabetic order.
1.160 brook 3086:
1.184 rillig 3087: 12.3.1. Structure of a single patch file
1.160 brook 3088:
1.184 rillig 3089: The patch-* files should be in diff -bu format, and apply without a fuzz to
3090: avoid problems. (To force patches to apply with fuzz you can set
3091: PATCH_FUZZ_FACTOR=-F2). Furthermore, each patch should contain only changes for
3092: a single file, and no file should be patched by more than one patch file. This
3093: helps to keep future modifications simple.
1.160 brook 3094:
1.184 rillig 3095: Each patch file is structured as follows: In the first line, there is the RCS
3096: Id of the patch itself. The second line should be empty for aesthetic reasons.
3097: After that, there should be a comment for each change that the patch does.
3098: There are a number of standard cases:
1.160 brook 3099:
1.184 rillig 3100: * Patches for commonly known vulnerabilities should mention the vulnerability
3101: ID (CAN, CVE).
1.160 brook 3102:
1.184 rillig 3103: * Patches that change source code should mention the platform and other
3104: environment (for example, the compiler) that the patch is needed for.
1.160 brook 3105:
1.184 rillig 3106: The patch should be commented so that any developer who knows the code of the
3107: application can make some use of the patch. Special care should be taken for
3108: the upstream developers, since we generally want that they accept our patches,
3109: so we have less work in the future.
1.160 brook 3110:
1.184 rillig 3111: 12.3.2. Creating patch files
1.160 brook 3112:
1.184 rillig 3113: One important thing to mention is to pay attention that no RCS IDs get stored
3114: in the patch files, as these will cause problems when later checked into the
3115: NetBSD CVS tree. Use the pkgdiff command from the pkgtools/pkgdiff package to
3116: avoid these problems.
1.160 brook 3117:
1.184 rillig 3118: For even more automation, we recommend using mkpatches from the same package to
3119: make a whole set of patches. You just have to backup files before you edit them
3120: to filename.orig, e.g. with cp -p filename filename.orig or, easier, by using
3121: pkgvi again from the same package. If you upgrade a package this way, you can
3122: easily compare the new set of patches with the previously existing one with
3123: patchdiff. The files in patches are replaced by new files, so carefully check
3124: if you want to take all the changes.
1.160 brook 3125:
1.184 rillig 3126: When you have finished a package, remember to generate the checksums for the
3127: patch files by using the make makepatchsum command, see Section 12.2,
3128: "distinfo".
1.1 dsieger 3129:
1.184 rillig 3130: When adding a patch that corrects a problem in the distfile (rather than e.g.
3131: enforcing pkgsrc's view of where man pages should go), send the patch as a bug
3132: report to the maintainer. This benefits non-pkgsrc users of the package, and
3133: usually makes it possible to remove the patch in future version.
1.1 dsieger 3134:
1.184 rillig 3135: The file names of the patch files are usually of the form patch-
3136: path_to_file__with__underscores.c. Many packages still use the previous
3137: convention patch-[a-z][a-z], but new patches should be of the form containing
3138: the filename. mkpatches included in pkgtools/pkgdiff takes care of the name
3139: automatically.
1.1 dsieger 3140:
1.184 rillig 3141: 12.3.3. Sources where the patch files come from
1.1 dsieger 3142:
1.184 rillig 3143: If you want to share patches between multiple packages in pkgsrc, e.g. because
3144: they use the same distfiles, set PATCHDIR to the path where the patch files can
3145: be found, e.g.:
1.1 dsieger 3146:
1.184 rillig 3147: PATCHDIR= ../../editors/xemacs/patches
1.1 dsieger 3148:
1.184 rillig 3149: Patch files that are distributed by the author or other maintainers can be
3150: listed in PATCHFILES.
1.1 dsieger 3151:
1.184 rillig 3152: If it is desired to store any patches that should not be committed into pkgsrc,
3153: they can be kept outside the pkgsrc tree in the $LOCALPATCHES directory. The
3154: directory tree there is expected to have the same "category/package" structure
3155: as pkgsrc, and patches are expected to be stored inside these dirs (also known
3156: as $LOCALPATCHES/$PKGPATH). For example, if you want to keep a private patch
3157: for pkgsrc/graphics/png, keep it in $LOCALPATCHES/graphics/png/mypatch. All
3158: files in the named directory are expected to be patch files, and they are
3159: applied after pkgsrc patches are applied.
1.1 dsieger 3160:
1.184 rillig 3161: 12.3.4. Patching guidelines
1.1 dsieger 3162:
1.184 rillig 3163: When fixing a portability issue in the code do not use preprocessor magic to
3164: check for the current operating system nor platform. Doing so hurts portability
3165: to other platforms because the OS-specific details are not abstracted
3166: appropriately.
1.1 dsieger 3167:
1.184 rillig 3168: The general rule to follow is: instead of checking for the operating system the
3169: application is being built on, check for the specific features you need. For
3170: example, instead of assuming that kqueue is available under NetBSD and using
3171: the __NetBSD__ macro to conditionalize kqueue support, add a check that detects
1.198 leot 3172: kqueue itself -- yes, this generally involves patching the configure script.
1.184 rillig 3173: There is absolutely nothing that prevents some OSes from adopting interfaces
3174: from other OSes (e.g. Linux implementing kqueue), something that the above
3175: checks cannot take into account.
1.1 dsieger 3176:
1.184 rillig 3177: Of course, checking for features generally involves more work on the
3178: developer's side, but the resulting changes are cleaner and there are chances
3179: they will work on many other platforms. Not to mention that there are higher
3180: chances of being later integrated into the mainstream sources. Remember: It
3181: doesn't work unless it is right!
1.1 dsieger 3182:
1.184 rillig 3183: Some typical examples:
1.121 sevan 3184:
1.184 rillig 3185: Table 12.1. Patching examples
1.1 dsieger 3186:
1.184 rillig 3187: +-------------------------------------------------------------------------------------------+
3188: | Where | Incorrect | Correct |
3189: |---------+--------------------------+------------------------------------------------------|
3190: | |case ${target_os} in | |
3191: |configure|netbsd*) have_kvm=yes ;; |AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)|
3192: |script |*) have_kvm=no ;; | |
3193: | |esac | |
3194: |---------+--------------------------+------------------------------------------------------|
3195: |C source |#if defined(__NetBSD__) |#if defined(HAVE_SYS_EVENT_H) |
3196: |file |# include <sys/event.h> |# include <sys/event.h> |
3197: | |#endif |#endif |
3198: |---------+--------------------------+------------------------------------------------------|
3199: | |int |int |
3200: | |monitor_file(...) |monitor_file(...) |
3201: | |{ |{ |
3202: | |#if defined(__NetBSD__) |#if defined(HAVE_KQUEUE) |
3203: |C source | int fd = kqueue();| int fd = kqueue(); |
3204: |file | ... | ... |
3205: | |#else |#else |
3206: | | ... | ... |
3207: | |#endif |#endif |
3208: | |} |} |
3209: +-------------------------------------------------------------------------------------------+
1.1 dsieger 3210:
3211:
1.184 rillig 3212: 12.3.5. Feedback to the author
1.1 dsieger 3213:
1.184 rillig 3214: Always, always, always feed back any portability fixes or improvements you do
3215: to a package to the mainstream developers. This is the only way to get their
3216: attention on portability issues and to ensure that future versions can be built
3217: out-of-the box on NetBSD. Furthermore, any user that gets newer distfiles will
3218: get the fixes straight from the packaged code.
1.1 dsieger 3219:
1.184 rillig 3220: This generally involves cleaning up the patches (because sometimes the patches
3221: that are added to pkgsrc are quick hacks), filing bug reports in the
3222: appropriate trackers for the projects and working with the mainstream authors
3223: to accept your changes. It is extremely important that you do it so that the
3224: packages in pkgsrc are kept simple and thus further changes can be done without
3225: much hassle.
1.1 dsieger 3226:
1.184 rillig 3227: When you have done this, please add a URL to the upstream bug report to the
3228: patch comment.
1.1 dsieger 3229:
1.184 rillig 3230: Support the idea of free software!
1.1 dsieger 3231:
1.184 rillig 3232: 12.4. Other mandatory files
1.1 dsieger 3233:
1.184 rillig 3234: DESCR
1.1 dsieger 3235:
1.184 rillig 3236: A multi-line description of the piece of software. This should include any
3237: credits where they are due. Please bear in mind that others do not share
3238: your sense of humour (or spelling idiosyncrasies), and that others will
3239: read everything that you write here.
1.1 dsieger 3240:
1.184 rillig 3241: PLIST
1.1 dsieger 3242:
1.184 rillig 3243: This file governs the files that are installed on your system: all the
3244: binaries, manual pages, etc. There are other directives which may be
3245: entered in this file, to control the creation and deletion of directories,
3246: and the location of inserted files. See Chapter 19, PLIST issues for more
3247: information.
1.1 dsieger 3248:
1.184 rillig 3249: 12.5. Optional files
1.1 dsieger 3250:
1.184 rillig 3251: 12.5.1. Files affecting the binary package
1.1 dsieger 3252:
1.184 rillig 3253: INSTALL
1.1 dsieger 3254:
1.184 rillig 3255: This shell script is invoked twice by pkg_add(1). First time after package
3256: extraction and before files are moved in place, the second time after the
3257: files to install are moved in place. This can be used to do any custom
3258: procedures not possible with @exec commands in PLIST. See pkg_add(1) and
3259: pkg_create(1) for more information. See also Section 20.1, "Files and
3260: directories outside the installation prefix". Please note that you can
3261: modify variables in it easily by using FILES_SUBST in the package's
3262: Makefile:
1.1 dsieger 3263:
1.184 rillig 3264: FILES_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 3265:
1.184 rillig 3266: replaces "@SOMEVAR@" with "somevalue" in the INSTALL. By default,
3267: substitution is performed for PREFIX, LOCALBASE, X11BASE, VARBASE, and a
3268: few others, type make help topic=FILES_SUBST for a complete list.
1.1 dsieger 3269:
1.184 rillig 3270: DEINSTALL
1.1 dsieger 3271:
1.184 rillig 3272: This script is executed before and after any files are removed. It is this
3273: script's responsibility to clean up any additional messy details around the
3274: package's installation, since all pkg_delete knows is how to delete the
3275: files created in the original distribution. See pkg_delete(1) and
3276: pkg_create(1) for more information. The same methods to replace variables
3277: can be used as for the INSTALL file.
1.1 dsieger 3278:
1.184 rillig 3279: MESSAGE
1.1 dsieger 3280:
1.198 leot 3281: This file is displayed after installation of the package. While this was
3282: used often in the past, it has two problems: the display will be missed if
3283: many packages are intalled at once, and the person installing the package
3284: and the one using or configuring it may be different. It should therefore
3285: be used only in exceptional circumstances where lasting negative
3286: consequences would result from someone not reading it.
3287:
3288: MESSAGE should not be used for:
3289:
3290: + exhortations to read the documentation
3291:
3292: + reminders to install rc.d files and set variables
3293:
3294: + anything that should be explained in the installation/configuration
3295: documentation that should come with the package
3296:
3297: If the documentation provided by upstream needs enhancing, create e.g.
3298: files/README.pkgsrc and install it in the package's documentation
3299: directory.
3300:
3301: Note that MESSAGE is shown for all operating systems and all init systems.
3302: If a MESSAGE is necessary, it should be narrowed to only those operating
3303: systems and init systems to which it applies.
3304:
3305: Note that you can modify variables in it easily by using MESSAGE_SUBST in
3306: the package's Makefile:
1.1 dsieger 3307:
1.184 rillig 3308: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 3309:
1.184 rillig 3310: replaces "${SOMEVAR}" with "somevalue" in MESSAGE. By default, substitution
3311: is performed for PKGNAME, PKGBASE, PREFIX, LOCALBASE, X11BASE,
3312: PKG_SYSCONFDIR, ROOT_GROUP, and ROOT_USER.
1.1 dsieger 3313:
1.184 rillig 3314: You can display a different or additional files by setting the MESSAGE_SRC
3315: variable. Its default is MESSAGE, if the file exists.
1.1 dsieger 3316:
1.184 rillig 3317: ALTERNATIVES
1.1 dsieger 3318:
1.184 rillig 3319: This file is used by the alternatives framework. It creates, configures,
3320: and destroys generic wrappers used to run programs with similar interfaces.
3321: See pkg_alternatives(8) from pkgtools/pkg_alternatives for more
3322: information.
1.1 dsieger 3323:
1.184 rillig 3324: Each line of the file contains two filenames, first the wrapper and then
3325: the alternative provided by the package. Both paths are relative to PREFIX.
1.1 dsieger 3326:
1.184 rillig 3327: 12.5.2. Files affecting the build process
1.1 dsieger 3328:
1.184 rillig 3329: Makefile.common
1.1 dsieger 3330:
1.184 rillig 3331: This file contains arbitrary things that could also go into a Makefile, but
3332: its purpose is to be used by more than one package. This file should only
3333: be used when the packages that will use the file are known in advance. For
3334: other purposes it is often better to write a *.mk file and give it a good
3335: name that describes what it does.
1.1 dsieger 3336:
1.184 rillig 3337: buildlink3.mk
1.1 dsieger 3338:
1.184 rillig 3339: This file contains the dependency information for the buildlink3 framework
3340: (see Chapter 18, Buildlink methodology).
1.1 dsieger 3341:
1.184 rillig 3342: hacks.mk
1.1 dsieger 3343:
1.184 rillig 3344: This file contains workarounds for compiler bugs and similar things. It is
3345: included automatically by the pkgsrc infrastructure, so you don't need an
3346: extra .include line for it.
1.1 dsieger 3347:
1.184 rillig 3348: options.mk
1.1 dsieger 3349:
1.184 rillig 3350: This file contains the code for the package-specific options (see
3351: Chapter 16, Options handling) that can be selected by the user. If a
3352: package has only one or two options, it is equally acceptable to put the
3353: code directly into the Makefile.
1.1 dsieger 3354:
1.184 rillig 3355: 12.5.3. Files affecting nothing at all
1.1 dsieger 3356:
1.184 rillig 3357: README*
1.1 dsieger 3358:
1.184 rillig 3359: These files do not take place in the creation of a package and thus are
3360: purely informative to the package developer.
1.1 dsieger 3361:
1.184 rillig 3362: TODO
1.1 dsieger 3363:
1.184 rillig 3364: This file contains things that need to be done to make the package even
3365: better.
1.1 dsieger 3366:
1.184 rillig 3367: 12.6. work*
1.1 dsieger 3368:
1.184 rillig 3369: When you type make, the distribution files are unpacked into the directory
3370: denoted by WRKDIR. It can be removed by running make clean. Besides the
3371: sources, this directory is also used to keep various timestamp files. The
3372: directory gets removed completely on clean. The default is ${.CURDIR}/work or $
3373: {.CURDIR}/work.${MACHINE_ARCH} if OBJMACHINE is set.
1.1 dsieger 3374:
1.184 rillig 3375: 12.7. files/*
1.80 wiz 3376:
1.184 rillig 3377: If you have any files that you wish to be placed in the package prior to
3378: configuration or building, you can place these files here and use a ${CP}
3379: command in the "post-extract" target to achieve this.
1.1 dsieger 3380:
1.184 rillig 3381: If you want to share files in this way with other packages, set the FILESDIR
3382: variable to point to the other package's files directory, e.g.:
1.1 dsieger 3383:
1.184 rillig 3384: FILESDIR= ../../editors/xemacs/files
1.14 jmcneill 3385:
1.184 rillig 3386: Chapter 13. The build process
1.1 dsieger 3387:
1.184 rillig 3388: Table of Contents
1.1 dsieger 3389:
1.184 rillig 3390: 13.1. Introduction
3391: 13.2. Program location
3392: 13.3. Directories used during the build process
3393: 13.4. Running a phase
3394: 13.5. The fetch phase
3395:
3396: 13.5.1. What to fetch and where to get it from
3397: 13.5.2. How are the files fetched?
3398:
3399: 13.6. The checksum phase
3400: 13.7. The extract phase
3401: 13.8. The patch phase
3402: 13.9. The tools phase
3403: 13.10. The wrapper phase
3404: 13.11. The configure phase
3405: 13.12. The build phase
3406: 13.13. The test phase
3407: 13.14. The install phase
3408: 13.15. The package phase
3409: 13.16. Cleaning up
3410: 13.17. Other helpful targets
1.1 dsieger 3411:
1.184 rillig 3412: 13.1. Introduction
1.122 leot 3413:
1.184 rillig 3414: This chapter gives a detailed description on how a package is built. Building a
3415: package is separated into different phases (for example fetch, build, install),
3416: all of which are described in the following sections. Each phase is split into
3417: so-called stages, which take the name of the containing phase, prefixed by one
3418: of pre-, do- or post-. (Examples are pre-configure, post-build.) Most of the
3419: actual work is done in the do-* stages.
1.1 dsieger 3420:
1.184 rillig 3421: Never override the regular targets (like fetch), if you have to, override the
3422: do-* ones instead.
1.1 dsieger 3423:
1.184 rillig 3424: The basic steps for building a program are always the same. First the program's
3425: source (distfile) must be brought to the local system and then extracted. After
3426: any pkgsrc-specific patches to compile properly are applied, the software can
3427: be configured, then built (usually by compiling), and finally the generated
3428: binaries, etc. can be put into place on the system.
1.1 dsieger 3429:
1.184 rillig 3430: To get more details about what is happening at each step, you can set the
3431: PKG_VERBOSE variable, or the PATCH_DEBUG variable if you are just interested in
3432: more details about the patch step.
1.1 dsieger 3433:
1.184 rillig 3434: 13.2. Program location
1.1 dsieger 3435:
1.184 rillig 3436: Before outlining the process performed by the NetBSD package system in the next
3437: section, here's a brief discussion on where programs are installed, and which
3438: variables influence this.
1.1 dsieger 3439:
1.184 rillig 3440: The automatic variable PREFIX indicates where all files of the final program
3441: shall be installed. It is usually set to LOCALBASE (/usr/pkg), or CROSSBASE for
3442: pkgs in the cross category. The value of PREFIX needs to be put into the
3443: various places in the program's source where paths to these files are encoded.
3444: See Section 12.3, "patches/*" and Section 21.3.1, "Shared libraries - libtool"
3445: for more details.
1.1 dsieger 3446:
1.184 rillig 3447: When choosing which of these variables to use, follow the following rules:
1.1 dsieger 3448:
1.184 rillig 3449: * PREFIX always points to the location where the current pkg will be
3450: installed. When referring to a pkg's own installation path, use "${PREFIX}"
3451: .
1.1 dsieger 3452:
1.184 rillig 3453: * LOCALBASE is where all non-X11 pkgs are installed. If you need to construct
3454: a -I or -L argument to the compiler to find includes and libraries
3455: installed by another non-X11 pkg, use "${LOCALBASE}". The name LOCALBASE
3456: stems from FreeBSD, which installed all packages in /usr/local. As pkgsrc
3457: leaves /usr/local for the system administrator, this variable is a
3458: misnomer.
1.1 dsieger 3459:
1.184 rillig 3460: * X11BASE is where the actual X11 distribution (from xsrc, etc.) is
3461: installed. When looking for standard X11 includes (not those installed by a
3462: package), use "${X11BASE}".
1.1 dsieger 3463:
1.184 rillig 3464: * X11-based packages using imake must set USE_IMAKE to be installed correctly
3465: under LOCALBASE.
1.1 dsieger 3466:
1.184 rillig 3467: * Within ${PREFIX}, packages should install files according to hier(7), with
3468: the exception that manual pages go into ${PREFIX}/man, not ${PREFIX}/share/
3469: man.
1.1 dsieger 3470:
1.184 rillig 3471: 13.3. Directories used during the build process
1.2 rillig 3472:
1.184 rillig 3473: When building a package, various directories are used to store source files,
3474: temporary files, pkgsrc-internal files, and so on. These directories are
3475: explained here.
1.1 dsieger 3476:
1.184 rillig 3477: Some of the directory variables contain relative pathnames. There are two
3478: common base directories for these relative directories: PKGSRCDIR/PKGPATH is
3479: used for directories that are pkgsrc-specific. WRKSRC is used for directories
3480: inside the package itself.
1.1 dsieger 3481:
1.184 rillig 3482: PKGSRCDIR
1.1 dsieger 3483:
1.184 rillig 3484: This is an absolute pathname that points to the pkgsrc root directory.
3485: Generally, you don't need it.
1.1 dsieger 3486:
1.184 rillig 3487: PKGDIR
1.1 dsieger 3488:
1.184 rillig 3489: This is an absolute pathname that points to the current package.
1.1 dsieger 3490:
1.184 rillig 3491: PKGPATH
1.1 dsieger 3492:
1.184 rillig 3493: This is a pathname relative to PKGSRCDIR that points to the current
3494: package.
1.1 dsieger 3495:
1.184 rillig 3496: WRKDIR
1.1 dsieger 3497:
1.184 rillig 3498: This is an absolute pathname pointing to the directory where all work takes
3499: place. The distfiles are extracted to this directory. It also contains
3500: temporary directories and log files used by the various pkgsrc frameworks,
3501: like buildlink or the wrappers.
1.1 dsieger 3502:
1.184 rillig 3503: WRKSRC
1.1 dsieger 3504:
1.184 rillig 3505: This is an absolute pathname pointing to the directory where the distfiles
3506: are extracted. It is usually a direct subdirectory of WRKDIR, and often
3507: it's the only directory entry that isn't hidden. This variable may be
3508: changed by a package Makefile.
1.1 dsieger 3509:
1.184 rillig 3510: The CREATE_WRKDIR_SYMLINK definition takes either the value yes or no and
3511: defaults to no. It indicates whether a symbolic link to the WRKDIR is to be
3512: created in the pkgsrc entry's directory. If users would like to have their
3513: pkgsrc trees behave in a read-only manner, then the value of
3514: CREATE_WRKDIR_SYMLINK should be set to no.
1.1 dsieger 3515:
1.184 rillig 3516: 13.4. Running a phase
1.1 dsieger 3517:
1.184 rillig 3518: You can run a particular phase by typing make phase, where phase is the name of
3519: the phase. This will automatically run all phases that are required for this
3520: phase. The default phase is build, that is, when you run make without
3521: parameters in a package directory, the package will be built, but not
3522: installed.
1.1 dsieger 3523:
1.184 rillig 3524: 13.5. The fetch phase
1.1 dsieger 3525:
1.184 rillig 3526: The first step in building a package is to fetch the distribution files
3527: (distfiles) from the sites that are providing them. This is the task of the
3528: fetch phase.
1.25 wiz 3529:
1.184 rillig 3530: 13.5.1. What to fetch and where to get it from
1.1 dsieger 3531:
1.184 rillig 3532: In simple cases, MASTER_SITES defines all URLs from where the distfile, whose
3533: name is derived from the DISTNAME variable, is fetched. The more complicated
3534: cases are described below.
1.1 dsieger 3535:
1.184 rillig 3536: The variable DISTFILES specifies the list of distfiles that have to be fetched.
3537: Its value defaults to ${DEFAULT_DISTFILES} and its value is ${DISTNAME}$
3538: {EXTRACT_SUFX}, so that most packages don't need to define it at all.
3539: EXTRACT_SUFX is .tar.gz by default, but can be changed freely. Note that if
3540: your package requires additional distfiles to the default one, you cannot just
3541: append the additional filenames using the += operator, but you have write for
3542: example:
1.1 dsieger 3543:
1.184 rillig 3544: DISTFILES= ${DEFAULT_DISTFILES} additional-files.tar.gz
1.1 dsieger 3545:
1.184 rillig 3546: Each distfile is fetched from a list of sites, usually MASTER_SITES. If the
3547: package has multiple DISTFILES or multiple PATCHFILES from different sites, you
3548: can set SITES.distfile to the list of URLs where the file distfile (including
3549: the suffix) can be found.
1.1 dsieger 3550:
1.184 rillig 3551: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
3552: DISTFILES+= foo-file.tar.gz
3553: SITES.foo-file.tar.gz= \
3554: https://www.somewhere.com/somehow/ \
3555: https://www.somewhereelse.com/mirror/somehow/
1.1 dsieger 3556:
1.184 rillig 3557: When actually fetching the distfiles, each item from MASTER_SITES or SITES.*
3558: gets the name of each distfile appended to it, without an intermediate slash.
3559: Therefore, all site values have to end with a slash or other separator
3560: character. This allows for example to set MASTER_SITES to a URL of a CGI script
3561: that gets the name of the distfile as a parameter. In this case, the definition
3562: would look like:
1.1 dsieger 3563:
1.184 rillig 3564: MASTER_SITES= https://www.example.com/download.cgi?file=
1.1 dsieger 3565:
1.184 rillig 3566: The exception to this rule are URLs starting with a dash. In that case the URL
3567: is taken as is, fetched and the result stored under the name of the distfile.
3568: You can use this style for the case when the download URL style does not match
3569: the above common case. For example, if permanent download URL is a redirector
3570: to the real download URL, or the download file name is offered by an HTTP
3571: Content-Disposition header. In the following example, foo-1.0.0.tar.gz will be
3572: created instead of the default v1.0.0.tar.gz.
1.1 dsieger 3573:
1.184 rillig 3574: DISTNAME= foo-1.0.0
3575: MASTER_SITES= -https://www.example.com/archive/v1.0.0.tar.gz
1.29 wiz 3576:
1.184 rillig 3577: There are some predefined values for MASTER_SITES, which can be used in
3578: packages. The names of the variables should speak for themselves.
1.29 wiz 3579:
1.184 rillig 3580: MASTER_SITE_APACHE MASTER_SITE_BACKUP
3581: MASTER_SITE_CRATESIO MASTER_SITE_CYGWIN
3582: MASTER_SITE_DEBIAN MASTER_SITE_FREEBSD
3583: MASTER_SITE_FREEBSD_LOCAL MASTER_SITE_GENTOO
3584: MASTER_SITE_GITHUB MASTER_SITE_GNOME
3585: MASTER_SITE_GNU MASTER_SITE_GNUSTEP
3586: MASTER_SITE_HASKELL_HACKAGE MASTER_SITE_IFARCHIVE
3587: MASTER_SITE_KDE MASTER_SITE_MOZILLA
3588: MASTER_SITE_MOZILLA_ALL MASTER_SITE_MYSQL
3589: MASTER_SITE_NETLIB MASTER_SITE_OPENBSD
3590: MASTER_SITE_OPENOFFICE MASTER_SITE_OSDN
3591: MASTER_SITE_PERL_CPAN MASTER_SITE_PGSQL
3592: MASTER_SITE_PYPI MASTER_SITE_RUBYGEMS
3593: MASTER_SITE_R_CRAN MASTER_SITE_SOURCEFORGE
3594: MASTER_SITE_SUNSITE MASTER_SITE_SUSE
3595: MASTER_SITE_TEX_CTAN MASTER_SITE_XCONTRIB
3596: MASTER_SITE_XEMACS MASTER_SITE_XORG
1.1 dsieger 3597:
1.184 rillig 3598: Some explanations for the less self-explaining ones: MASTER_SITE_BACKUP
3599: contains backup sites for packages that are maintained in ftp://ftp.NetBSD.org/
3600: pub/pkgsrc/distfiles/${DIST_SUBDIR}. MASTER_SITE_LOCAL contains local package
3601: source distributions that are maintained in ftp://ftp.NetBSD.org/pub/pkgsrc/
3602: distfiles/LOCAL_PORTS/.
1.1 dsieger 3603:
1.184 rillig 3604: If you choose one of these predefined sites, you may want to specify a
3605: subdirectory of that site. Since these macros may expand to more than one
3606: actual site, you must use the following construct to specify a subdirectory:
1.1 dsieger 3607:
1.184 rillig 3608: MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/}
3609: MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.1 dsieger 3610:
1.184 rillig 3611: Note the trailing slash after the subdirectory name.
1.1 dsieger 3612:
1.184 rillig 3613: 13.5.2. How are the files fetched?
1.1 dsieger 3614:
1.184 rillig 3615: The fetch phase makes sure that all the distfiles exist in a local directory
3616: (DISTDIR, which can be set by the pkgsrc user). If the files do not exist, they
3617: are fetched using commands of the form
1.1 dsieger 3618:
1.184 rillig 3619: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 dsieger 3620:
1.184 rillig 3621: where ${site} varies through several possibilities in turn: first,
3622: MASTER_SITE_OVERRIDE is tried, then the sites specified in either SITES.file if
3623: defined, else MASTER_SITES or PATCH_SITES, as applies, then finally the value
3624: of MASTER_SITE_BACKUP. The order of all except the first and the last can be
3625: optionally sorted by the user, via setting either MASTER_SORT_RANDOM, and
3626: MASTER_SORT_AWK or MASTER_SORT_REGEX.
1.1 dsieger 3627:
1.184 rillig 3628: The specific command and arguments used depend on the FETCH_USING parameter.
3629: The example above is for FETCH_USING=custom.
1.66 asau 3630:
1.184 rillig 3631: The distfiles mirror run by the NetBSD Foundation uses the mirror-distfiles
3632: target to mirror the distfiles, if they are freely distributable. Packages
3633: setting NO_SRC_ON_FTP (usually to "${RESTRICTED}") will not have their
3634: distfiles mirrored.
1.1 dsieger 3635:
1.184 rillig 3636: 13.6. The checksum phase
1.1 dsieger 3637:
1.184 rillig 3638: After the distfile(s) are fetched, their checksum is generated and compared
3639: with the checksums stored in the distinfo file. If the checksums don't match,
3640: the build is aborted. This is to ensure the same distfile is used for building,
3641: and that the distfile wasn't changed, e.g. by some malign force, deliberately
3642: changed distfiles on the master distribution site or network lossage.
1.1 dsieger 3643:
1.184 rillig 3644: 13.7. The extract phase
1.1 dsieger 3645:
1.184 rillig 3646: When the distfiles are present on the local system, they need to be extracted,
3647: as they usually come in the form of some compressed archive format.
1.1 dsieger 3648:
1.184 rillig 3649: By default, all DISTFILES are extracted. If you only need some of them, you can
3650: set the EXTRACT_ONLY variable to the list of those files.
1.1 dsieger 3651:
1.184 rillig 3652: Extracting the files is usually done by a little program, mk/extract/extract,
3653: which already knows how to extract various archive formats, so most likely you
3654: will not need to change anything here. But if you need, the following variables
3655: may help you:
1.1 dsieger 3656:
1.184 rillig 3657: EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}
1.1 dsieger 3658:
1.184 rillig 3659: Use these variables to override the default options for an extract command,
3660: which are defined in mk/extract/extract.
1.1 dsieger 3661:
1.184 rillig 3662: EXTRACT_USING
1.1 dsieger 3663:
1.184 rillig 3664: This variable can be set to bsdtar, gtar, nbtar (which is the default
3665: value), pax, or an absolute pathname pointing to the command with which tar
3666: archives should be extracted. It is preferred to choose bsdtar over gtar if
3667: NetBSD's pax-as-tar is not good enough.
1.1 dsieger 3668:
1.184 rillig 3669: If the extract program doesn't serve your needs, you can also override the
3670: EXTRACT_CMD variable, which holds the command used for extracting the files.
3671: This command is executed in the ${WRKSRC} directory. During execution of this
3672: command, the shell variable extract_file holds the absolute pathname of the
3673: file that is going to be extracted.
1.1 dsieger 3674:
1.184 rillig 3675: And if that still does not suffice, you can override the do-extract target in
3676: the package Makefile.
1.1 dsieger 3677:
1.184 rillig 3678: 13.8. The patch phase
1.1 dsieger 3679:
1.184 rillig 3680: After extraction, all the patches named by the PATCHFILES, those present in the
3681: patches subdirectory of the package as well as in $LOCALPATCHES/$PKGPATH (e.g.
3682: /usr/local/patches/graphics/png) are applied. Patchfiles ending in .Z or .gz
3683: are uncompressed before they are applied, files ending in .orig or .rej are
3684: ignored. Any special options to patch(1) can be handed in PATCH_DIST_ARGS. See
3685: Section 12.3, "patches/*" for more details.
1.1 dsieger 3686:
1.184 rillig 3687: By default patch(1) is given special arguments to make it fail if the expected
3688: text from the patch context is not found in the patched file. If that happens,
3689: fix the patch file by comparing it with the actual text in the file to be
3690: patched.
1.1 dsieger 3691:
1.184 rillig 3692: 13.9. The tools phase
1.1 dsieger 3693:
1.184 rillig 3694: This is covered in Chapter 17, Tools needed for building or running.
1.1 dsieger 3695:
1.184 rillig 3696: 13.10. The wrapper phase
1.1 dsieger 3697:
1.184 rillig 3698: This phase creates wrapper programs for the compilers and linkers. The
3699: following variables can be used to tweak the wrappers.
1.1 dsieger 3700:
1.184 rillig 3701: ECHO_WRAPPER_MSG
1.1 dsieger 3702:
1.184 rillig 3703: The command used to print progress messages. Does nothing by default. Set
3704: to ${ECHO} to see the progress messages.
1.1 dsieger 3705:
1.184 rillig 3706: WRAPPER_DEBUG
1.1 dsieger 3707:
1.184 rillig 3708: This variable can be set to yes (default) or no, depending on whether you
3709: want additional information in the wrapper log file.
1.1 dsieger 3710:
1.184 rillig 3711: WRAPPER_UPDATE_CACHE
1.1 dsieger 3712:
1.184 rillig 3713: This variable can be set to yes or no, depending on whether the wrapper
3714: should use its cache, which will improve the speed. The default value is
3715: yes, but is forced to no if the platform does not support it.
1.1 dsieger 3716:
1.184 rillig 3717: WRAPPER_REORDER_CMDS
1.1 dsieger 3718:
1.184 rillig 3719: A list of reordering commands. A reordering command has the form reorder:l:
3720: lib1:lib2. It ensures that that -llib1 occurs before -llib2.
1.1 dsieger 3721:
1.184 rillig 3722: 13.11. The configure phase
1.1 dsieger 3723:
1.184 rillig 3724: Most pieces of software need information on the header files, system calls, and
3725: library routines which are available on the platform they run on. The process
3726: of determining this information is known as configuration, and is usually
3727: automated. In most cases, a script is supplied with the distfiles, and its
3728: invocation results in generation of header files, Makefiles, etc.
1.1 dsieger 3729:
1.184 rillig 3730: If the package contains a configure script, this can be invoked by setting
3731: HAS_CONFIGURE to "yes". If the configure script is a GNU autoconf script, you
1.187 rillig 3732: should set GNU_CONFIGURE to "yes" instead.
1.1 dsieger 3733:
1.187 rillig 3734: In the do-configure stage, a rough equivalent of the following command is run.
3735: See mk/configure/configure.mk, target do-configure-script for the exact
3736: definition.
3737:
3738: .for dir in ${CONFIGURE_DIRS}
3739: cd ${WRKSRC} && cd ${dir} \
3740: && env ${CONFIGURE_ENV} \
3741: ${CONFIG_SHELL} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
1.184 rillig 3742: .endfor
1.1 dsieger 3743:
1.184 rillig 3744: CONFIGURE_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In
3745: each of these directories, the configure script is run with the environment
3746: CONFIGURE_ENV and arguments CONFIGURE_ARGS. The variables CONFIGURE_ENV,
3747: CONFIGURE_SCRIPT (default: "./configure") and CONFIGURE_ARGS may all be changed
3748: by the package.
1.1 dsieger 3749:
1.184 rillig 3750: If the program uses the Perl way of configuration (mainly Perl modules, but not
3751: only), i.e. a file called Makefile.PL, it should include ../../lang/perl5/
3752: module.mk. To set any parameter for Makefile.PL use the MAKE_PARAMS variable
3753: (e.g., MAKE_PARAMS+=foo=bar
1.1 dsieger 3754:
1.184 rillig 3755: If the program uses an Imakefile for configuration, the appropriate steps can
3756: be invoked by setting USE_IMAKE to "yes". If you only need xmkmf, add it to
3757: USE_TOOLS. You can add variables to xmkmf's environment by adding them to the
3758: SCRIPTS_ENV variable.
1.1 dsieger 3759:
1.184 rillig 3760: If the program uses cmake for configuration, the appropriate steps can be
3761: invoked by setting USE_CMAKE to "yes". You can add variables to cmake's
3762: environment by adding them to the CONFIGURE_ENV variable and arguments to cmake
3763: by adding them to the CMAKE_ARGS variable. The top directory argument is given
3764: by the CMAKE_ARG_PATH variable, that defaults to "." (relative to
3765: CONFIGURE_DIRS)
1.1 dsieger 3766:
1.184 rillig 3767: If there is no configure step at all, set NO_CONFIGURE to "yes".
1.1 dsieger 3768:
1.184 rillig 3769: 13.12. The build phase
1.1 dsieger 3770:
1.187 rillig 3771: For building a package, a rough equivalent of the following code is executed;
3772: see mk/build/build.mk, target do-build for the exact definition.
1.154 rillig 3773:
1.187 rillig 3774: .for dir in ${BUILD_DIRS}
3775: cd ${WRKSRC} && cd ${dir} \
1.184 rillig 3776: && env ${MAKE_ENV} \
1.187 rillig 3777: ${MAKE_PROGRAM} ${MAKE_FLAGS} ${BUILD_MAKE_FLAGS} \
1.184 rillig 3778: -f ${MAKE_FILE} \
3779: ${BUILD_TARGET}
3780: .endfor
1.1 dsieger 3781:
1.184 rillig 3782: BUILD_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In each of
3783: these directories, MAKE_PROGRAM is run with the environment MAKE_ENV and
3784: arguments BUILD_MAKE_FLAGS. The variables MAKE_ENV, BUILD_MAKE_FLAGS, MAKE_FILE
3785: and BUILD_TARGET may all be changed by the package.
1.1 dsieger 3786:
1.184 rillig 3787: The default value of MAKE_PROGRAM is "gmake" if USE_TOOLS contains "gmake", "
3788: make" otherwise. The default value of MAKE_FILE is "Makefile", and BUILD_TARGET
3789: defaults to "all".
1.1 dsieger 3790:
1.184 rillig 3791: If there is no build step at all, set NO_BUILD to "yes".
1.1 dsieger 3792:
1.184 rillig 3793: 13.13. The test phase
1.1 dsieger 3794:
1.184 rillig 3795: [TODO]
1.1 dsieger 3796:
1.184 rillig 3797: 13.14. The install phase
1.1 dsieger 3798:
1.184 rillig 3799: Once the build stage has completed, the final step is to install the software
3800: in public directories, so users can access the programs and files.
1.1 dsieger 3801:
1.187 rillig 3802: In the install phase, a rough equivalent of the following code is executed; see
3803: mk/install/install.mk, target do-install for the exact definition.
3804: Additionally, before and after this code, several consistency checks are run
3805: against the files-to-be-installed, see mk/check/*.mk for details.
3806:
3807: .for dir in ${INSTALL_DIRS}
3808: cd ${WRKSRC} && cd ${dir} \
3809: && env ${INSTALL_ENV} ${MAKE_ENV} \
3810: ${MAKE_PROGRAM} ${MAKE_FLAGS} ${INSTALL_MAKE_FLAGS} \
3811: -f ${MAKE_FILE} ${INSTALL_TARGET}
1.184 rillig 3812: .endfor
1.1 dsieger 3813:
1.184 rillig 3814: The variable's meanings are analogous to the ones in the build phase.
3815: INSTALL_DIRS defaults to BUILD_DIRS. INSTALL_TARGET is "install" by default,
3816: plus "install.man" if USE_IMAKE is defined and NO_INSTALL_MANPAGES is not
3817: defined.
1.1 dsieger 3818:
1.184 rillig 3819: In the install phase, the following variables are useful. They are all
3820: variations of the install(1) command that have the owner, group and permissions
3821: preset. INSTALL is the plain install command. The specialized variants,
3822: together with their intended use, are:
1.1 dsieger 3823:
1.184 rillig 3824: INSTALL_PROGRAM_DIR
1.1 dsieger 3825:
1.184 rillig 3826: directories that contain binaries
1.1 dsieger 3827:
1.184 rillig 3828: INSTALL_SCRIPT_DIR
1.1 dsieger 3829:
1.184 rillig 3830: directories that contain scripts
1.1 dsieger 3831:
1.184 rillig 3832: INSTALL_LIB_DIR
1.1 dsieger 3833:
1.184 rillig 3834: directories that contain shared and static libraries
1.1 dsieger 3835:
1.184 rillig 3836: INSTALL_DATA_DIR
1.108 rillig 3837:
1.184 rillig 3838: directories that contain data files
1.108 rillig 3839:
1.184 rillig 3840: INSTALL_MAN_DIR
1.108 rillig 3841:
1.184 rillig 3842: directories that contain man pages
1.108 rillig 3843:
1.184 rillig 3844: INSTALL_GAME_DIR
1.108 rillig 3845:
1.184 rillig 3846: directories that contain data files for games
1.108 rillig 3847:
1.184 rillig 3848: INSTALL_PROGRAM
1.108 rillig 3849:
1.184 rillig 3850: binaries that can be stripped from debugging symbols
1.108 rillig 3851:
1.184 rillig 3852: INSTALL_SCRIPT
1.108 rillig 3853:
1.184 rillig 3854: binaries that cannot be stripped
1.108 rillig 3855:
1.184 rillig 3856: INSTALL_GAME
1.108 rillig 3857:
1.184 rillig 3858: game binaries
1.108 rillig 3859:
1.184 rillig 3860: INSTALL_LIB
1.108 rillig 3861:
1.184 rillig 3862: shared and static libraries
1.108 rillig 3863:
1.184 rillig 3864: INSTALL_DATA
1.108 rillig 3865:
1.184 rillig 3866: data files
1.1 dsieger 3867:
1.184 rillig 3868: INSTALL_GAME_DATA
1.1 dsieger 3869:
1.184 rillig 3870: data files for games
1.108 rillig 3871:
1.184 rillig 3872: INSTALL_MAN
1.108 rillig 3873:
1.184 rillig 3874: man pages
1.1 dsieger 3875:
1.184 rillig 3876: Some other variables are:
1.1 dsieger 3877:
1.184 rillig 3878: INSTALL_UNSTRIPPED
1.1 dsieger 3879:
1.184 rillig 3880: If set to yes, do not run strip(1) when installing binaries. Any debugging
3881: sections and symbols present in binaries will be preserved.
1.1 dsieger 3882:
1.184 rillig 3883: INSTALLATION_DIRS
1.1 dsieger 3884:
1.184 rillig 3885: A list of directories relative to PREFIX that are created by pkgsrc at the
3886: beginning of the install phase. The package is supposed to create all
3887: needed directories itself before installing files to it and list all other
3888: directories here.
1.1 dsieger 3889:
1.184 rillig 3890: In the rare cases that a package shouldn't install anything, set NO_INSTALL to
3891: "yes". This is mostly relevant for packages in the regress category.
1.1 dsieger 3892:
1.184 rillig 3893: 13.15. The package phase
1.121 sevan 3894:
1.184 rillig 3895: Once the install stage has completed, a binary package of the installed files
3896: can be built. These binary packages can be used for quick installation without
3897: previous compilation, e.g. by the make bin-install or by using pkg_add.
1.1 dsieger 3898:
1.184 rillig 3899: By default, the binary packages are created in ${PACKAGES}/All and symlinks are
3900: created in ${PACKAGES}/category, one for each category in the CATEGORIES
3901: variable. PACKAGES defaults to pkgsrc/packages.
1.1 dsieger 3902:
1.184 rillig 3903: 13.16. Cleaning up
1.1 dsieger 3904:
1.184 rillig 3905: Once you're finished with a package, you can clean the work directory by
3906: running make clean. If you want to clean the work directories of all
3907: dependencies too, use make clean-depends.
1.1 dsieger 3908:
1.184 rillig 3909: 13.17. Other helpful targets
1.1 dsieger 3910:
1.184 rillig 3911: pre/post-*
1.1 dsieger 3912:
1.184 rillig 3913: For any of the main targets described in the previous section (configure,
3914: build, install, etc.), two auxiliary targets exist with "pre-" and "post-"
3915: used as a prefix for the main target's name. These targets are invoked
3916: before and after the main target is called, allowing extra configuration or
3917: installation steps be performed from a package's Makefile, for example,
3918: which a program's configure script or install target omitted.
3919:
3920: About 5% of the pkgsrc packages define their custom post-extract target,
3921: another 5% define pre-configure, and 10% define post-install. The other pre
3922: /post-* targets are defined even less often.
1.1 dsieger 3923:
1.184 rillig 3924: do-*
1.182 leot 3925:
1.184 rillig 3926: Should one of the main targets do the wrong thing, and should there be no
3927: variable to fix this, you can redefine it with the do-* target. (Note that
3928: redefining the target itself instead of the do-* target is a bad idea, as
3929: the pre-* and post-* targets won't be called anymore, etc.)
1.1 dsieger 3930:
1.184 rillig 3931: About 15% of the pkgsrc packages override the default do-install, the other
3932: do-* targets are overridden even less often.
1.1 dsieger 3933:
1.184 rillig 3934: reinstall
1.1 dsieger 3935:
1.184 rillig 3936: If you did a make install and you noticed some file was not installed
3937: properly, you can repeat the installation with this target, which will
3938: ignore the "already installed" flag.
1.1 dsieger 3939:
1.184 rillig 3940: This is the default value of DEPENDS_TARGET except in the case of make
3941: update and make package, where the defaults are "package" and "update",
3942: respectively.
1.1 dsieger 3943:
1.184 rillig 3944: deinstall
1.1 dsieger 3945:
1.184 rillig 3946: This target does a pkg_delete(1) in the current directory, effectively
3947: de-installing the package. The following variables can be used to tune the
3948: behaviour:
1.1 dsieger 3949:
1.184 rillig 3950: PKG_VERBOSE
1.1 dsieger 3951:
1.184 rillig 3952: Add a "-v" to the pkg_delete(1) command.
1.1 dsieger 3953:
1.184 rillig 3954: DEINSTALLDEPENDS
1.1 dsieger 3955:
1.184 rillig 3956: Remove all packages that require (depend on) the given package. This
3957: can be used to remove any packages that may have been pulled in by a
3958: given package, e.g. if make deinstall DEINSTALLDEPENDS=1 is done in
3959: pkgsrc/x11/kde, this is likely to remove whole KDE. Works by adding "-R
3960: " to the pkg_delete(1) command line.
1.1 dsieger 3961:
1.184 rillig 3962: bin-install
1.1 dsieger 3963:
1.184 rillig 3964: Install a binary package from local disk and via FTP from a list of sites
3965: (see the BINPKG_SITES variable), and do a make package if no binary package
3966: is available anywhere. The arguments given to pkg_add can be set via
3967: BIN_INSTALL_FLAGS e.g., to do verbose operation, etc.
1.1 dsieger 3968:
1.184 rillig 3969: install-clean
1.1 dsieger 3970:
1.184 rillig 3971: This target removes the state files for the "install" and later phases so
3972: that the "install" target may be re-invoked. This can be used after editing
3973: the PLIST to install the package without rebuilding it.
1.1 dsieger 3974:
1.184 rillig 3975: build-clean
1.18 mishka 3976:
1.184 rillig 3977: This target removes the state files for the "build" and later phases so
3978: that the "build" target may be re-invoked.
1.18 mishka 3979:
1.184 rillig 3980: update
1.18 mishka 3981:
1.184 rillig 3982: This target causes the current package to be updated to the latest version.
3983: The package and all depending packages first get de-installed, then current
3984: versions of the corresponding packages get compiled and installed. This is
3985: similar to manually noting which packages are currently installed, then
3986: performing a series of make deinstall and make install (or whatever
3987: UPDATE_TARGET is set to) for these packages.
1.18 mishka 3988:
1.184 rillig 3989: You can use the "update" target to resume package updating in case a
3990: previous make update was interrupted for some reason. However, in this
3991: case, make sure you don't call make clean or otherwise remove the list of
3992: dependent packages in WRKDIR. Otherwise, you lose the ability to
3993: automatically update the current package along with the dependent packages
3994: you have installed.
1.121 sevan 3995:
1.184 rillig 3996: Resuming an interrupted make update will only work as long as the package
3997: tree remains unchanged. If the source code for one of the packages to be
3998: updated has been changed, resuming make update will most certainly fail!
1.1 dsieger 3999:
1.184 rillig 4000: The following variables can be used either on the command line or in
4001: mk.conf to alter the behaviour of make update:
1.1 dsieger 4002:
1.184 rillig 4003: UPDATE_TARGET
1.1 dsieger 4004:
1.184 rillig 4005: Install target to recursively use for the updated package and the
4006: dependent packages. Defaults to DEPENDS_TARGET if set, "install"
4007: otherwise for make update. Other good targets are "package" or "
4008: bin-install". Do not set this to "update" or you will get stuck in an
4009: endless loop!
1.1 dsieger 4010:
1.184 rillig 4011: NOCLEAN
1.1 dsieger 4012:
1.184 rillig 4013: Don't clean up after updating. Useful if you want to leave the work
4014: sources of the updated packages around for inspection or other
4015: purposes. Be sure you eventually clean up the source tree (see the "
4016: clean-update" target below) or you may run into troubles with old
4017: source code still lying around on your next make or make update.
1.1 dsieger 4018:
1.184 rillig 4019: REINSTALL
1.1 dsieger 4020:
1.184 rillig 4021: Deinstall each package before installing (making DEPENDS_TARGET). This
4022: may be necessary if the "clean-update" target (see below) was called
4023: after interrupting a running make update.
1.1 dsieger 4024:
1.184 rillig 4025: DEPENDS_TARGET
1.1 dsieger 4026:
1.184 rillig 4027: Allows you to disable recursion and hardcode the target for packages.
4028: The default is "update" for the update target, facilitating a recursive
4029: update of prerequisite packages. Only set DEPENDS_TARGET if you want to
4030: disable recursive updates. Use UPDATE_TARGET instead to just set a
4031: specific target for each package to be installed during make update
4032: (see above).
1.1 dsieger 4033:
1.184 rillig 4034: clean-update
1.1 dsieger 4035:
1.184 rillig 4036: Clean the source tree for all packages that would get updated if make
4037: update was called from the current directory. This target should not be
4038: used if the current package (or any of its depending packages) have already
4039: been de-installed (e.g., after calling make update) or you may lose some
4040: packages you intended to update. As a rule of thumb: only use this target
4041: before the first time you run make update and only if you have a dirty
4042: package tree (e.g., if you used NOCLEAN).
1.86 wiz 4043:
1.184 rillig 4044: If you are unsure about whether your tree is clean, you can either perform
4045: a make clean at the top of the tree, or use the following sequence of
4046: commands from the directory of the package you want to update (before
4047: running make update for the first time, otherwise you lose all the packages
4048: you wanted to update!):
1.86 wiz 4049:
1.184 rillig 4050: # make clean-update
4051: # make clean CLEANDEPENDS=YES
4052: # make update
1.86 wiz 4053:
4054:
1.184 rillig 4055: The following variables can be used either on the command line or in
4056: mk.conf to alter the behaviour of make clean-update:
1.86 wiz 4057:
1.184 rillig 4058: CLEAR_DIRLIST
1.86 wiz 4059:
1.184 rillig 4060: After make clean, do not reconstruct the list of directories to update
4061: for this package. Only use this if make update successfully installed
4062: all packages you wanted to update. Normally, this is done automatically
4063: on make update, but may have been suppressed by the NOCLEAN variable
4064: (see above).
1.1 dsieger 4065:
1.184 rillig 4066: replace
1.1 dsieger 4067:
1.184 rillig 4068: Update the installation of the current package. This differs from update in
4069: that it does not replace dependent packages. You will need to install
4070: pkgtools/pkg_tarup for this target to work.
1.1 dsieger 4071:
1.184 rillig 4072: Be careful when using this target! There are no guarantees that dependent
4073: packages will still work, in particular they will most certainly break if
4074: you make replace a library package whose shared library major version
4075: changed between your installed version and the new one. For this reason,
4076: this target is not officially supported and only recommended for advanced
4077: users.
1.1 dsieger 4078:
1.184 rillig 4079: info
1.1 dsieger 4080:
1.184 rillig 4081: This target invokes pkg_info(1) for the current package. You can use this
4082: to check which version of a package is installed.
1.86 wiz 4083:
1.184 rillig 4084: index
1.1 dsieger 4085:
1.184 rillig 4086: This is a top-level command, i.e. it should be used in the pkgsrc
4087: directory. It creates a database of all packages in the local pkgsrc tree,
4088: including dependencies, comment, maintainer, and some other useful
4089: information. Individual entries are created by running make describe in the
4090: packages' directories. This index file is saved as pkgsrc/INDEX. It can be
4091: displayed in verbose format by running make print-index. You can search in
4092: it with make search key=something. You can extract a list of all packages
4093: that depend on a particular one by running make show-deps PKG=somepackage.
1.1 dsieger 4094:
1.184 rillig 4095: Running this command takes a very long time, some hours even on fast
4096: machines!
1.1 dsieger 4097:
1.184 rillig 4098: readme
1.1 dsieger 4099:
1.199 nia 4100: This target generates a index.html file, which can be viewed using a
1.184 rillig 4101: browser such as www/firefox or www/links. The generated files contain
4102: references to any packages which are in the PACKAGES directory on the local
4103: host. The generated files can be made to refer to URLs based on
4104: FTP_PKG_URL_HOST and FTP_PKG_URL_DIR. For example, if I wanted to generate
1.199 nia 4105: index.html files which pointed to binary packages on the local machine, in
1.184 rillig 4106: the directory /usr/packages, set FTP_PKG_URL_HOST=file://localhost and
4107: FTP_PKG_URL_DIR=/usr/packages. The ${PACKAGES} directory and its
4108: subdirectories will be searched for all the binary packages.
1.1 dsieger 4109:
1.184 rillig 4110: The target can be run at the toplevel or in category directories, in which
4111: case it descends recursively.
1.1 dsieger 4112:
1.184 rillig 4113: readme-all
1.1 dsieger 4114:
1.184 rillig 4115: This is a top-level command, run it in pkgsrc. Use this target to create a
4116: file README-all.html which contains a list of all packages currently
4117: available in the NetBSD Packages Collection, together with the category
4118: they belong to and a short description. This file is compiled from the
1.199 nia 4119: pkgsrc/*/index.html files, so be sure to run this after a make readme.
1.1 dsieger 4120:
1.184 rillig 4121: cdrom-readme
1.1 dsieger 4122:
1.184 rillig 4123: This is very much the same as the "readme" target (see above), but is to be
4124: used when generating a pkgsrc tree to be written to a CD-ROM. This target
1.199 nia 4125: also produces index.html files, and can be made to refer to URLs based on
1.184 rillig 4126: CDROM_PKG_URL_HOST and CDROM_PKG_URL_DIR.
1.1 dsieger 4127:
1.184 rillig 4128: show-distfiles
1.1 dsieger 4129:
1.184 rillig 4130: This target shows which distfiles and patchfiles are needed to build the
4131: package (ALLFILES, which contains all DISTFILES and PATCHFILES, but not
4132: patches/*).
1.1 dsieger 4133:
1.184 rillig 4134: show-downlevel
1.1 dsieger 4135:
1.184 rillig 4136: This target shows nothing if the package is not installed. If a version of
4137: this package is installed, but is not the version provided in this version
4138: of pkgsrc, then a warning message is displayed. This target can be used to
4139: show which of your installed packages are downlevel, and so the old
4140: versions can be deleted, and the current ones added.
1.1 dsieger 4141:
1.184 rillig 4142: show-pkgsrc-dir
1.1 dsieger 4143:
1.184 rillig 4144: This target shows the directory in the pkgsrc hierarchy from which the
4145: package can be built and installed. This may not be the same directory as
4146: the one from which the package was installed. This target is intended to be
4147: used by people who may wish to upgrade many packages on a single host, and
4148: can be invoked from the top-level pkgsrc Makefile by using the "
4149: show-host-specific-pkgs" target.
1.1 dsieger 4150:
1.184 rillig 4151: show-installed-depends
1.1 dsieger 4152:
1.184 rillig 4153: This target shows which installed packages match the current package's
4154: DEPENDS. Useful if out of date dependencies are causing build problems.
1.1 dsieger 4155:
1.184 rillig 4156: print-build-depends-list
1.1 dsieger 4157:
1.184 rillig 4158: This target shows the list of packages that the current package depends on
4159: for building.
1.1 dsieger 4160:
1.184 rillig 4161: print-run-depends-list
1.1 dsieger 4162:
1.184 rillig 4163: This target shows the list of packages that the current package depends on
4164: for running.
1.1 dsieger 4165:
1.184 rillig 4166: check-shlibs
1.1 dsieger 4167:
1.184 rillig 4168: After a package is installed, check all its binaries and (on ELF platforms)
4169: shared libraries to see if they find the shared libs they need. Run by
4170: default if PKG_DEVELOPER is set in mk.conf.
1.1 dsieger 4171:
1.184 rillig 4172: print-PLIST
1.1 dsieger 4173:
1.184 rillig 4174: After a "make install" from a new or upgraded pkg, this prints out an
4175: attempt to generate a new PLIST from a find -newer work/.extract_done. An
4176: attempt is made to care for shared libs etc., but it is strongly
4177: recommended to review the result before putting it into PLIST. On upgrades,
4178: it's useful to diff the output of this command against an already existing
4179: PLIST file.
1.1 dsieger 4180:
1.184 rillig 4181: If the package installs files via tar(1) or other methods that don't update
4182: file access times, be sure to add these files manually to your PLIST, as
4183: the "find -newer" command used by this target won't catch them!
1.56 ryoon 4184:
1.184 rillig 4185: See Section 19.3, "Tweaking output of make print-PLIST" for more
4186: information on this target.
1.1 dsieger 4187:
1.184 rillig 4188: Chapter 14. Creating a new pkgsrc package from scratch
1.1 dsieger 4189:
1.184 rillig 4190: Table of Contents
1.1 dsieger 4191:
1.184 rillig 4192: 14.1. Common types of packages
1.1 dsieger 4193:
1.184 rillig 4194: 14.1.1. Perl modules
4195: 14.1.2. Python modules and programs
4196: 14.1.3. R packages
4197: 14.1.4. TeXlive packages
1.1 dsieger 4198:
1.184 rillig 4199: 14.2. Examples
1.1 dsieger 4200:
1.184 rillig 4201: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 4202:
1.184 rillig 4203: When you find a package that is not yet in pkgsrc, you most likely have a URL
4204: from where you can download the source code. Starting with this URL, creating a
4205: package involves only a few steps.
1.1 dsieger 4206:
1.184 rillig 4207: 1. In your mk.conf, set PKG_DEVELOPER=yes to enable the basic quality checks.
1.1 dsieger 4208:
1.184 rillig 4209: 2. Install the package meta-pkgs/pkg_developer, which among others will
4210: install the utilities url2pkg, pkglint, pkgvi and mkpatches:
1.1 dsieger 4211:
1.184 rillig 4212: $ cd /usr/pkgsrc
4213: $ (cd meta-pkgs/pkg_developer && bmake update)
1.1 dsieger 4214:
1.184 rillig 4215: 3. Choose one of the top-level directories as the category in which you want
4216: to place your package. You can also create a directory of your own (maybe
4217: called local). In that category directory, create another directory for
4218: your package and change into it:
1.1 dsieger 4219:
1.184 rillig 4220: $ mkdir category/package
4221: $ cd category/package
1.1 dsieger 4222:
1.184 rillig 4223: 4. Run the program url2pkg, which will ask you for a URL. Enter the URL of the
4224: distribution file (in most cases a .tar.gz file) and watch how the basic
4225: ingredients of your package are created automatically. The distribution
4226: file is extracted automatically to fill in some details in the Makefile
4227: that would otherwise have to be done manually:
1.1 dsieger 4228:
1.184 rillig 4229: $ url2pkg https://www.example.org/packages/package-1.0.tar.gz
1.1 dsieger 4230:
1.184 rillig 4231: 5. Examine the extracted files to determine the dependencies of your package.
4232: Ideally, this is mentioned in some README file, but things may differ. For
4233: each of these dependencies, look where it exists in pkgsrc, and if there is
4234: a file called buildlink3.mk in that directory, add a line to your package
4235: Makefile which includes that file just before the last line. If the
4236: buildlink3.mk file does not exist, it must be created first. The
4237: buildlink3.mk file makes sure that the package's include files and
4238: libraries are provided.
1.1 dsieger 4239:
1.184 rillig 4240: If you just need binaries from a package, add a DEPENDS line to the
4241: Makefile, which specifies the version of the dependency and where it can be
4242: found in pkgsrc. This line should be placed in the third paragraph. If the
4243: dependency is only needed for building the package, but not when using it,
4244: use TOOL_DEPENDS or BUILD_DEPENDS instead of DEPENDS. The difference
4245: between TOOL_DEPENDS and BUILD_DEPENDS occurs when cross-compiling:
4246: TOOL_DEPENDS are native packages, i.e. packages for the architecture where
4247: the package is built; BUILD_DEPENDS are target packages, i.e. packages for
4248: the architecture for which the package is built. There is also
4249: TEST_DEPENDS, which is used to specify a dependency used only for testing
4250: the resulting package built, using the upstream project's included test
4251: suite. Your package may then look like this:
1.1 dsieger 4252:
1.184 rillig 4253: [...]
1.1 dsieger 4254:
1.184 rillig 4255: TOOL_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt
4256: DEPENDS+= screen-[0-9]*:../../misc/screen
4257: DEPENDS+= screen>=4.0:../../misc/screen
1.1 dsieger 4258:
1.184 rillig 4259: [...]
1.1 dsieger 4260:
1.184 rillig 4261: .include "../../category/package/buildlink3.mk"
4262: .include "../../devel/glib2/buildlink3.mk"
4263: .include "../../mk/bsd.pkg.mk"
1.1 dsieger 4264:
1.184 rillig 4265: 6. Run pkglint to see what things still need to be done to make your package a
4266: "good" one. If you don't know what pkglint's warnings want to tell you, try
4267: pkglint --explain or pkglint -e, which outputs additional explanations.
1.1 dsieger 4268:
1.184 rillig 4269: 7. In many cases the package is not yet ready to build. You can find
4270: instructions for the most common cases in the next section, Section 14.1,
4271: "Common types of packages". After you have followed the instructions over
4272: there, you can hopefully continue here.
1.1 dsieger 4273:
1.184 rillig 4274: 8. Run bmake clean to clean the working directory from the extracted files.
4275: Besides these files, a lot of cache files and other system information has
4276: been saved in the working directory, which may become wrong after you
4277: edited the Makefile.
1.1 dsieger 4278:
1.184 rillig 4279: 9. Now, run bmake to build the package. For the various things that can go
4280: wrong in this phase, consult Chapter 21, Making your package work.
1.1 dsieger 4281:
1.184 rillig 4282: If the extracted files from the package need to be fixed, run multiple
4283: rounds of these commands:
1.1 dsieger 4284:
1.184 rillig 4285: $ make
4286: $ pkgvi ${WRKSRC}/some/file/that/does/not/compile
4287: $ mkpatches
4288: $ make mps
4289: $ make clean
1.1 dsieger 4290:
1.184 rillig 4291: 10. When the package builds fine, the next step is to install the package. Run
4292: bmake install and hope that everything works.
1.1 dsieger 4293:
1.184 rillig 4294: 11. Up to now, the file PLIST, which contains a list of the files that are
4295: installed by the package, is nearly empty. Run bmake print-PLIST >PLIST to
4296: generate a probably correct list. Check the file using your preferred text
4297: editor to see if the list of files looks plausible.
1.1 dsieger 4298:
1.184 rillig 4299: 12. Run pkglint again to see if the generated PLIST contains garbage or not.
1.1 dsieger 4300:
1.184 rillig 4301: 13. When you ran bmake install, the package had been registered in the database
4302: of installed files, but with an empty list of files. To fix this, run bmake
4303: deinstall and bmake install again. Now the package is registered with the
4304: list of files from PLIST.
1.48 wiz 4305:
1.184 rillig 4306: 14. Run bmake package to create a binary package from the set of installed
4307: files.
1.48 wiz 4308:
1.184 rillig 4309: 15. Run bmake clean update to run everything from above again in a single step,
4310: making sure that the PLIST is correct and the whole package is created as
4311: intended.
1.48 wiz 4312:
1.184 rillig 4313: 16. Run pkglint to see if there's anything left to do.
1.48 wiz 4314:
1.184 rillig 4315: 17. Commit the package to pkgsrc-wip or main pkgsrc; see Chapter 23, Submitting
4316: and Committing.
1.50 wiz 4317:
1.184 rillig 4318: 14.1. Common types of packages
1.1 dsieger 4319:
1.184 rillig 4320: 14.1.1. Perl modules
1.1 dsieger 4321:
1.184 rillig 4322: Simple Perl modules are handled automatically by url2pkg, including
4323: dependencies.
1.1 dsieger 4324:
1.184 rillig 4325: 14.1.2. Python modules and programs
1.1 dsieger 4326:
1.184 rillig 4327: Python modules and programs packages are easily created using a set of
4328: predefined variables.
1.1 dsieger 4329:
1.184 rillig 4330: If some Python versions are not supported by the software, set the
4331: PYTHON_VERSIONS_INCOMPATIBLE variable to the Python versions that are not
4332: supported, e.g.
1.1 dsieger 4333:
1.184 rillig 4334: PYTHON_VERSIONS_INCOMPATIBLE= 27
1.1 dsieger 4335:
1.184 rillig 4336: If the packaged software is a Python module, include one of ../../lang/python/
4337: egg.mk, ../../lang/python/distutils.mk, or ../../lang/python/extension.mk.
1.1 dsieger 4338:
1.184 rillig 4339: Most Python packages use either "distutils" or easy-setup/setuptools ("eggs").
4340: If the packaged software is using setuptools, you only need to include "../../
4341: lang/python/egg.mk". Otherwise, if the software uses "distutils", include "..
4342: /../lang/python/distutils.mk", so pkgsrc will use this framework. "distutils"
4343: uses a script called setup.py; if the "distutils" driver is not called
4344: setup.py, set the PYSETUP variable to the name of the script.
1.1 dsieger 4345:
1.184 rillig 4346: Either way, the package directory should be called "py-software" and PKGNAME
4347: should be set to "${PYPKGPREFIX}-${DISTNAME}", e.g.
1.1 dsieger 4348:
1.184 rillig 4349: DISTNAME= foopymodule-1.2.10
4350: PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
1.1 dsieger 4351:
1.184 rillig 4352: If it is an application, include "../../lang/python/application.mk". In order
4353: to correctly set the path to the Python interpreter, use the REPLACE_PYTHON
4354: variable and set it to the list of files (paths relative to WRKSRC) that must
4355: be corrected. For example:
1.1 dsieger 4356:
1.184 rillig 4357: REPLACE_PYTHON= *.py
1.1 dsieger 4358:
1.184 rillig 4359: Some Python modules have separate distributions for Python-2.x and Python-3.x
4360: support. In pkgsrc this is handled by the versioned_dependencies.mk file. Set
4361: PYTHON_VERSIONED_DEPENDENCIES to the list of packages that should be depended
4362: upon and include "../../lang/python/versioned_dependencies.mk", then the pkgsrc
4363: infrastructure will depend on the appropriate package version. For example:
1.1 dsieger 4364:
1.184 rillig 4365: PYTHON_VERSIONED_DEPENDENCIES=dialog
1.1 dsieger 4366:
1.184 rillig 4367: Look inside versioned_dependencies.mk for a list of supported packages.
1.1 dsieger 4368:
1.184 rillig 4369: 14.1.3. R packages
1.1 dsieger 4370:
1.184 rillig 4371: Simple R packages from CRAN are handled automatically by R2pkg, which is
4372: available in pkgtools/R2pkg. Individual packages (and optionally their
4373: dependencies) may be created and updated. R packages generally follow the same
4374: form, and most of the relevant information needed is contained in a DESCRIPTION
4375: file as part of each R package on CRAN. Consequently, R2pkg downloads that
4376: information and creates or updates a package in the canonical form. The
4377: resulting package should be reviewed for correctness.
1.1 dsieger 4378:
1.184 rillig 4379: 14.1.4. TeXlive packages
1.1 dsieger 4380:
1.184 rillig 4381: TeXlive packages from CTAN are handled automatically by texlive2pkg, which is
4382: available in pkgtools/texlive2pkg.
1.1 dsieger 4383:
1.184 rillig 4384: If the TeXlive package name is not known, it may be useful to search CTAN. A "
4385: Contained in" field on the package page typically identifies the basename of
4386: the package file in the TeXlive archive.
1.1 dsieger 4387:
1.184 rillig 4388: If the TeXlive package name is known, download the files from the TeXlive
4389: archive. For package foo, you will need to download foo.tar.xz. Most TeXlive
4390: packages also have associated documentation packages, so download
4391: foo.doc.tar.xz at the same time. These files should be placed in the
4392: appropriate category directory, which is often but not always print. Then run
4393: the following command in the category directory.
1.1 dsieger 4394:
1.184 rillig 4395: texlive2pkg foo.tar.xz foo.doc.tar.xz
1.1 dsieger 4396:
1.184 rillig 4397: This will create two packages, tex-foo and tex-foo-doc. Be sure to check that
4398: both packages are correct.
1.1 dsieger 4399:
1.184 rillig 4400: Finally, CTAN currently does not include version information in package
4401: filenames and changes their contents periodically when updates occur.
4402: Consequently, pkgsrc avoids downloading distfiles directly from CTAN and
4403: instead relies on the pkgsrc archives. For each new or updated TeXlive package,
4404: e.g., the main one and the corresponding documentation, upload the distfiles
4405: with the following command in each package directory.
1.1 dsieger 4406:
1.184 rillig 4407: make upload-distfiles
1.117 sevan 4408:
1.184 rillig 4409: 14.2. Examples
1.117 sevan 4410:
1.184 rillig 4411: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 4412:
1.184 rillig 4413: 14.2.1.1. The initial package
1.1 dsieger 4414:
1.184 rillig 4415: Looking at the file pkgsrc/doc/TODO, I saw that the "nvu" package has not yet
4416: been imported into pkgsrc. As the description says it has to do with the web,
4417: the obvious choice for the category is "www".
1.1 dsieger 4418:
1.184 rillig 4419: $ mkdir www/nvu
4420: $ cd www/nvu
1.1 dsieger 4421:
1.184 rillig 4422: The web site says that the sources are available as a tar file, so I fed that
4423: URL to the url2pkg program:
1.1 dsieger 4424:
1.184 rillig 4425: $ url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
1.1 dsieger 4426:
1.184 rillig 4427: My editor popped up, and I added a PKGNAME line below the DISTNAME line, as the
4428: package name should not have the word "sources" in it. I also filled in the
4429: MAINTAINER, HOMEPAGE and COMMENT fields. Then the package Makefile looked like
4430: that:
1.1 dsieger 4431:
1.184 rillig 4432: # $NetBSD $
4433: #
1.1 dsieger 4434:
1.184 rillig 4435: DISTNAME= nvu-1.0-sources
4436: PKGNAME= nvu-1.0
4437: CATEGORIES= www
4438: MASTER_SITES= http://cvs.nvu.com/download/
4439: EXTRACT_SUFX= .tar.bz2
1.1 dsieger 4440:
1.184 rillig 4441: MAINTAINER= rillig@NetBSD.org
4442: HOMEPAGE= http://cvs.nvu.com/
4443: COMMENT= Web Authoring System
1.1 dsieger 4444:
1.184 rillig 4445: # url2pkg-marker (please do not remove this line.)
4446: .include "../../mk/bsd.pkg.mk"
1.1 dsieger 4447:
1.184 rillig 4448: On the first line of output above, an artificial space has been added between
4449: NetBSD and $, this is a workaround to prevent CVS expanding to the filename of
4450: the guide.
1.1 dsieger 4451:
1.184 rillig 4452: Then, I quit the editor and watched pkgsrc downloading a large source archive:
1.1 dsieger 4453:
1.184 rillig 4454: url2pkg> Running "make makesum" ...
4455: => Required installed package digest>=20010302: digest-20060826 found
4456: => Fetching nvu-1.0-sources.tar.bz2
4457: Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
4458: 100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA
4459: 29687976 bytes retrieved in 03:12 (150.77 KB/s)
4460: url2pkg> Running "make extract" ...
4461: => Required installed package digest>=20010302: digest-20060826 found
4462: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
4463: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
4464: work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc
4465: ===> Installing dependencies for nvu-1.0
4466: ===> Overriding tools for nvu-1.0
4467: ===> Extracting for nvu-1.0
4468: url2pkg> Adjusting the Makefile.
1.1 dsieger 4469:
1.184 rillig 4470: Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
1.1 dsieger 4471:
1.184 rillig 4472: Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
1.1 dsieger 4473:
1.184 rillig 4474: 14.2.1.2. Fixing all kinds of problems to make the package work
1.1 dsieger 4475:
1.184 rillig 4476: Now that the package has been extracted, let's see what's inside it. The
4477: package has a README.txt, but that only says something about mozilla, so it's
4478: probably useless for seeing what dependencies this package has. But since there
4479: is a GNU configure script in the package, let's hope that it will complain
4480: about everything it needs.
1.1 dsieger 4481:
1.184 rillig 4482: $ bmake
4483: => Required installed package digest>=20010302: digest-20060826 found
4484: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
4485: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
4486: ===> Patching for nvu-1.0
4487: ===> Creating toolchain wrappers for nvu-1.0
4488: ===> Configuring for nvu-1.0
4489: [...]
4490: configure: error: Perl 5.004 or higher is required.
4491: [...]
4492: WARNING: Please add USE_TOOLS+=perl to the package Makefile.
4493: [...]
1.1 dsieger 4494:
1.184 rillig 4495: That worked quite well. So I opened the package Makefile in my editor, and
4496: since it already has a USE_TOOLS line, I just appended "perl" to it. Since the
4497: dependencies of the package have changed now, and since a perl wrapper is
4498: automatically installed in the "tools" phase, I need to build the package from
4499: scratch.
1.1 dsieger 4500:
1.184 rillig 4501: $ bmake clean
4502: ===> Cleaning for nvu-1.0
4503: $ bmake
4504: [...]
4505: *** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
4506: GNU Make. You will not be able to build Mozilla without GNU Make.
4507: [...]
1.1 dsieger 4508:
1.184 rillig 4509: So I added "gmake" to the USE_TOOLS line and tried again (from scratch).
1.1 dsieger 4510:
1.184 rillig 4511: [...]
4512: checking for GTK - version >= 1.2.0... no
4513: *** Could not run GTK test program, checking why...
4514: [...]
1.1 dsieger 4515:
1.184 rillig 4516: Now to the other dependencies. The first question is: Where is the GTK package
4517: hidden in pkgsrc?
1.1 dsieger 4518:
1.184 rillig 4519: $ echo ../../*/gtk*
4520: [many packages ...]
4521: $ echo ../../*/gtk
4522: ../../x11/gtk
4523: $ echo ../../*/gtk2
4524: ../../x11/gtk2
4525: $ echo ../../*/gtk2/bui*
4526: ../../x11/gtk2/buildlink3.mk
1.1 dsieger 4527:
1.184 rillig 4528: The first try was definitely too broad. The second one had exactly one result,
4529: which is very good. But there is one pitfall with GNOME packages. Before GNOME
4530: 2 had been released, there were already many GNOME 1 packages in pkgsrc. To be
4531: able to continue to use these packages, the GNOME 2 packages were imported as
4532: separate packages, and their names usually have a "2" appended. So I checked
4533: whether this was the case here, and indeed it was.
1.1 dsieger 4534:
1.184 rillig 4535: Since the GTK2 package has a buildlink3.mk file, adding the dependency is very
4536: easy. I just inserted an .include line before the last line of the package
4537: Makefile, so that it now looks like this:
1.1 dsieger 4538:
1.184 rillig 4539: [...]
4540: .include "../../x11/gtk2/buildlink3.mk"
4541: .include "../../mk/bsd.pkg.mk
1.1 dsieger 4542:
1.184 rillig 4543: After another bmake clean && bmake, the answer was:
1.108 rillig 4544:
1.184 rillig 4545: [...]
4546: checking for gtk-config... /home/roland/pkg/bin/gtk-config
4547: checking for GTK - version >= 1.2.0... no
4548: *** Could not run GTK test program, checking why...
4549: *** The test program failed to compile or link. See the file config.log for the
4550: *** exact error that occured. This usually means GTK was incorrectly installed
4551: *** or that you have moved GTK since it was installed. In the latter case, you
4552: *** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
4553: configure: error: Test for GTK failed.
4554: [...]
1.1 dsieger 4555:
1.184 rillig 4556: In this particular case, the assumption that "every package prefers GNOME 2"
4557: had been wrong. The first of the lines above told me that this package really
4558: wanted to have the GNOME 1 version of GTK. If the package had looked for GTK2,
4559: it would have looked for pkg-config instead of gtk-config. So I changed the x11
4560: /gtk2 to x11/gtk in the package Makefile, and tried again.
1.1 dsieger 4561:
1.184 rillig 4562: [...]
4563: cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...]
4564: In file included from xpidl.c:42:
4565: xpidl.h:53:24: libIDL/IDL.h: No such file or directory
4566: In file included from xpidl.c:42:
4567: xpidl.h:132: error: parse error before "IDL_ns"
4568: [...]
1.1 dsieger 4569:
1.184 rillig 4570: The package still does not find all of its dependencies. Now the question is:
4571: Which package provides the libIDL/IDL.h header file?
1.1 dsieger 4572:
1.184 rillig 4573: $ echo ../../*/*idl*
4574: ../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
4575: $ echo ../../*/*IDL*
4576: ../../net/libIDL
1.1 dsieger 4577:
1.184 rillig 4578: Let's take the one from the second try. So I included the ../../net/libIDL/
4579: buildlink3.mk file and tried again. But the error didn't change. After digging
4580: through some of the code, I concluded that the build process of the package was
4581: broken and couldn't have ever worked, but since the Mozilla source tree is
4582: quite large, I didn't want to fix it. So I added the following to the package
4583: Makefile and tried again:
1.1 dsieger 4584:
1.184 rillig 4585: CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
4586: BUILDLINK_TRANSFORM+= l:IDL:IDL-2
1.1 dsieger 4587:
1.184 rillig 4588: The latter line is needed because the package expects the library libIDL.so,
4589: but only libIDL-2.so is available. So I told the compiler wrapper to rewrite
4590: that on the fly.
1.1 dsieger 4591:
1.184 rillig 4592: The next problem was related to a recent change of the FreeType interface. I
4593: looked up in www/seamonkey which patch files were relevant for this issue and
4594: copied them to the patches directory. Then I retried, fixed the patches so that
4595: they applied cleanly and retried again. This time, everything worked.
1.1 dsieger 4596:
1.184 rillig 4597: 14.2.1.3. Installing the package
1.1 dsieger 4598:
1.184 rillig 4599: $ bmake CHECK_FILES=no install
4600: [...]
4601: $ bmake print-PLIST >PLIST
4602: $ bmake deinstall
4603: $ bmake install
1.1 dsieger 4604:
1.184 rillig 4605: Chapter 15. Programming in Makefiles
1.1 dsieger 4606:
1.184 rillig 4607: Table of Contents
1.1 dsieger 4608:
1.184 rillig 4609: 15.1. Caveats
4610: 15.2. Makefile variables
1.1 dsieger 4611:
1.184 rillig 4612: 15.2.1. Naming conventions
1.1 dsieger 4613:
1.184 rillig 4614: 15.3. Code snippets
1.1 dsieger 4615:
1.184 rillig 4616: 15.3.1. Adding things to a list
4617: 15.3.2. Echoing a string exactly as-is
4618: 15.3.3. Passing CFLAGS to GNU configure scripts
4619: 15.3.4. Handling possibly empty variables
1.1 dsieger 4620:
1.184 rillig 4621: Pkgsrc consists of many Makefile fragments, each of which forms a well-defined
4622: part of the pkgsrc system. Using the make(1) system as a programming language
4623: for a big system like pkgsrc requires some discipline to keep the code correct
4624: and understandable.
1.1 dsieger 4625:
1.184 rillig 4626: The basic ingredients for Makefile programming are variables and shell
4627: commands. Among these shell commands may even be more complex ones like awk(1)
4628: programs. To make sure that every shell command runs as intended it is
4629: necessary to quote all variables correctly when they are used.
1.1 dsieger 4630:
1.184 rillig 4631: This chapter describes some patterns that appear quite often in Makefiles,
4632: including the pitfalls that come along with them.
1.1 dsieger 4633:
1.184 rillig 4634: 15.1. Caveats
1.1 dsieger 4635:
1.184 rillig 4636: * When you are creating a file as a target of a rule, always write the data
4637: to a temporary file first and finally rename that file. Otherwise there
4638: might occur an error in the middle of generating the file, and when the
4639: user runs make(1) for the second time, the file exists and will not be
4640: regenerated properly. Example:
1.1 dsieger 4641:
1.184 rillig 4642: wrong:
4643: @echo "line 1" > ${.TARGET}
4644: @echo "line 2" >> ${.TARGET}
4645: @false
1.1 dsieger 4646:
1.184 rillig 4647: correct:
4648: @echo "line 1" > ${.TARGET}.tmp
4649: @echo "line 2" >> ${.TARGET}.tmp
4650: @false
4651: @mv ${.TARGET}.tmp ${.TARGET}
1.1 dsieger 4652:
1.184 rillig 4653: When you run make wrong twice, the file wrong will exist, although there
4654: was an error message in the first run. On the other hand, running make
4655: correct gives an error message twice, as expected.
1.1 dsieger 4656:
1.184 rillig 4657: You might remember that make(1) sometimes removes ${.TARGET} in case of
4658: error, but this only happens when it is interrupted, for example by
4659: pressing Ctrl+C. This does not happen when one of the commands fails (like
4660: false(1) above).
1.1 dsieger 4661:
1.184 rillig 4662: 15.2. Makefile variables
1.1 dsieger 4663:
1.184 rillig 4664: Makefile variables contain strings that can be processed using the five
4665: operators =, +=, ?=, := and !=, which are described in the make(1) man page.
1.1 dsieger 4666:
1.184 rillig 4667: When a variable's value is parsed from a Makefile, the hash character # and the
4668: backslash character \ are handled specially. If a backslash is the last
4669: character in a line, that backslash is removed from the line and the line
4670: continues with the next line of the file.
1.1 dsieger 4671:
1.184 rillig 4672: The # character starts a comment that reaches until the end of the line. To get
4673: an actual # character, such as in a URL, write \# instead.
1.1 dsieger 4674:
1.184 rillig 4675: The evaluation of variables either happens immediately or lazy. It happens
4676: immediately when the variable occurs on the right-hand side of the := or the !=
4677: operator, in a .if condition or a .for loop. In the other cases, it is
4678: evaluated lazily.
1.1 dsieger 4679:
1.184 rillig 4680: Some of the modifiers split the string into words and then operate on the
4681: words, others operate on the string as a whole. When a string is split into
4682: words, double quotes and single quotes are interpreted as delimiters, just like
4683: in sh(1).
1.1 dsieger 4684:
1.184 rillig 4685: 15.2.1. Naming conventions
1.1 dsieger 4686:
1.184 rillig 4687: * All variable names starting with an underscore are reserved for use by the
4688: pkgsrc infrastructure. They shall not be used by packages.
1.1 dsieger 4689:
1.184 rillig 4690: * In .for loops you should use lowercase variable names for the iteration
4691: variables.
1.1 dsieger 4692:
1.184 rillig 4693: * All list variables should have a plural name, such as PKG_OPTIONS or
4694: DISTFILES.
1.1 dsieger 4695:
1.184 rillig 4696: 15.3. Code snippets
1.1 dsieger 4697:
1.184 rillig 4698: 15.3.1. Adding things to a list
1.1 dsieger 4699:
1.184 rillig 4700: When adding a string that possibly contains whitespace or quotes to a list
4701: (example 1), it must be quoted using the :Q modifier.
1.1 dsieger 4702:
1.184 rillig 4703: When adding another list to a list (example 2), it must not be quoted, since
4704: its elements are already quoted.
1.1 dsieger 4705:
1.184 rillig 4706: STRING= foo * bar `date`
4707: LIST= # empty
4708: ANOTHER_LIST= a=b c=d
1.1 dsieger 4709:
1.184 rillig 4710: LIST+= ${STRING:Q} # 1
4711: LIST+= ${ANOTHER_LIST} # 2
1.1 dsieger 4712:
1.184 rillig 4713: 15.3.2. Echoing a string exactly as-is
1.1 dsieger 4714:
1.184 rillig 4715: Echoing a string containing special characters needs special work.
1.1 dsieger 4716:
1.184 rillig 4717: STRING= foo bar < > * `date` $$HOME ' "
4718: EXAMPLE_ENV= string=${STRING:Q} x=multiple\ quoted\ words
1.1 dsieger 4719:
1.184 rillig 4720: all:
4721: echo ${STRING} # 1
4722: echo ${STRING:Q} # 2
4723: printf '%s\n' ${STRING:Q}'' # 3
4724: env ${EXAMPLE_ENV} sh -c 'echo "$$string"; echo "$$x"' # 4
1.1 dsieger 4725:
1.184 rillig 4726: Example 1 leads to a syntax error in the shell, as the characters are just
4727: copied.
1.1 dsieger 4728:
1.184 rillig 4729: Example 2 quotes the string so that the shell interprets it correctly. But the
4730: echo command may additionally interpret strings with a leading dash or those
4731: containing backslashes.
1.1 dsieger 4732:
1.184 rillig 4733: Example 3 can handle arbitrary strings, since printf(1) only interprets the
4734: format string, but not the next argument. The trailing single quotes handle the
4735: case when the string is empty. In that case, the :Q modifier would result in an
4736: empty string too, which would then be skipped by the shell. For printf(1) this
4737: doesn't make a difference, but other programs may care.
1.1 dsieger 4738:
1.184 rillig 4739: In example 4, the EXAMPLE_ENV does not need to be quoted because the quoting
4740: has already been done when adding elements to the list.
1.1 dsieger 4741:
1.184 rillig 4742: 15.3.3. Passing CFLAGS to GNU configure scripts
1.1 dsieger 4743:
1.184 rillig 4744: When passing CFLAGS or similar variables to a GNU-style configure script
4745: (especially those that call other configure scripts), it must not have leading
4746: or trailing whitespace, since otherwise the configure script gets confused. To
4747: trim leading and trailing whitespace, use the :M modifier, as in the following
4748: example:
1.1 dsieger 4749:
1.184 rillig 4750: CPPFLAGS= # empty
4751: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX}\"
4752: CPPFLAGS+= ${MY_CPPFLAGS}
1.1 dsieger 4753:
1.184 rillig 4754: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
1.1 dsieger 4755:
1.184 rillig 4756: all:
4757: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
4758: echo x${CONFIGURE_ARGS:Q}x # properly trimmed
1.1 dsieger 4759:
1.184 rillig 4760: In this example, CPPFLAGS has both leading and trailing whitespace because the
4761: += operator always adds a space.
1.1 dsieger 4762:
1.184 rillig 4763: 15.3.4. Handling possibly empty variables
1.1 dsieger 4764:
1.184 rillig 4765: When a possibly empty variable is used in a shell program, it may lead to a
4766: syntax error.
1.1 dsieger 4767:
1.184 rillig 4768: EGFILES= # empty
1.1 dsieger 4769:
1.184 rillig 4770: install-examples: # produces a syntax error in the shell
4771: for egfile in ${EGFILES}; do \
4772: echo "Installing $$egfile"; \
4773: done
1.1 dsieger 4774:
1.184 rillig 4775: The shell only sees the text for egfile in ; do, since ${EGFILES} is replaced
4776: with an empty string by make(1). To fix this syntax error, use one of the
4777: snippets below.
1.1 dsieger 4778:
1.184 rillig 4779: EMPTY= # empty
1.1 dsieger 4780:
1.184 rillig 4781: install-examples:
4782: for egfile in ${EGFILES} ""; do \
4783: [ -n "$$egfile" ] || continue; \
4784: echo "Installing $$egfile"; \
4785: done
1.1 dsieger 4786:
1.184 rillig 4787: In this case, an empty string is appended to the iteration list (to prevent the
4788: syntax error) and filtered out later.
1.1 dsieger 4789:
1.184 rillig 4790: EGFILES= # empty
1.1 dsieger 4791:
1.184 rillig 4792: install-examples:
4793: .for egfile in ${EGFILES}
4794: echo "Installing ${egfile}"
4795: .endfor
1.1 dsieger 4796:
1.184 rillig 4797: If one of the filenames contains special characters, it should be enclosed in
4798: single or double quotes.
1.1 dsieger 4799:
1.184 rillig 4800: To have a shell command test whether a make variable is empty, use the
4801: following code: ${TEST} -z ${POSSIBLY_EMPTY:Q}"".
1.1 dsieger 4802:
1.184 rillig 4803: Chapter 16. Options handling
1.1 dsieger 4804:
4805: Table of Contents
4806:
1.184 rillig 4807: 16.1. Global default options
4808: 16.2. Converting packages to use bsd.options.mk
4809: 16.3. Option Names
4810: 16.4. Determining the options of dependencies
1.1 dsieger 4811:
4812: Many packages have the ability to be built to support different sets of
4813: features. bsd.options.mk is a framework in pkgsrc that provides generic
4814: handling of those options that determine different ways in which the packages
4815: can be built. It's possible for the user to specify exactly which sets of
4816: options will be built into a package or to allow a set of global default
4817: options apply.
4818:
1.7 rillig 4819: There are two broad classes of behaviors that one might want to control via
4820: options. One is whether some particular feature is enabled in a program that
4821: will be built anyway, often by including or not including a dependency on some
4822: other package. The other is whether or not an additional program will be built
4823: as part of the package. Generally, it is better to make a split package for
4824: such additional programs instead of using options, because it enables binary
4825: packages to be built which can then be added separately. For example, the foo
4826: package might have minimal dependencies (those packages without which foo
4827: doesn't make sense), and then the foo-gfoo package might include the GTK
4828: frontend program gfoo. This is better than including a gtk option to foo that
4829: adds gfoo, because either that option is default, in which case binary users
4830: can't get foo without gfoo, or not default, in which case they can't get gfoo.
4831: With split packages, they can install foo without having GTK, and later decide
4832: to install gfoo (pulling in GTK at that time). This is an advantage to source
4833: users too, avoiding the need for rebuilds.
4834:
4835: Plugins with widely varying dependencies should usually be split instead of
4836: options.
4837:
4838: It is often more work to maintain split packages, especially if the upstream
4839: package does not support this. The decision of split vs. option should be made
4840: based on the likelihood that users will want or object to the various pieces,
4841: the size of the dependencies that are included, and the amount of work.
4842:
4843: A further consideration is licensing. Non-free parts, or parts that depend on
4844: non-free dependencies (especially plugins) should almost always be split if
4845: feasible.
4846:
1.184 rillig 4847: 16.1. Global default options
1.1 dsieger 4848:
4849: Global default options are listed in PKG_DEFAULT_OPTIONS, which is a list of
4850: the options that should be built into every package if that option is
1.4 rillig 4851: supported. This variable should be set in mk.conf.
1.1 dsieger 4852:
1.184 rillig 4853: 16.2. Converting packages to use bsd.options.mk
1.1 dsieger 4854:
4855: The following example shows how bsd.options.mk should be used by the
4856: hypothetical ``wibble'' package, either in the package Makefile, or in a file,
4857: e.g. options.mk, that is included by the main package Makefile.
4858:
4859: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
4860: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
4861: PKG_OPTIONS_OPTIONAL_GROUPS= database
4862: PKG_OPTIONS_GROUP.database= mysql pgsql
4863: PKG_SUGGESTED_OPTIONS= wibble-foo
4864: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
4865: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
4866:
4867: .include "../../mk/bsd.prefs.mk"
4868:
4869: # this package was previously named wibble2
4870: .if defined(PKG_OPTIONS.wibble2)
4871: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
4872: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
4873: "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead."
4874: .endif
4875:
4876: .include "../../mk/bsd.options.mk"
4877:
4878: # Package-specific option-handling
4879:
4880: ###
4881: ### FOO support
4882: ###
4883: .if !empty(PKG_OPTIONS:Mwibble-foo)
4884: CONFIGURE_ARGS+= --enable-foo
4885: .endif
4886:
4887: ###
4888: ### LDAP support
4889: ###
4890: .if !empty(PKG_OPTIONS:Mldap)
4891: . include "../../databases/openldap-client/buildlink3.mk"
4892: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client}
4893: .endif
4894:
4895: ###
4896: ### database support
4897: ###
4898: .if !empty(PKG_OPTIONS:Mmysql)
4899: . include "../../mk/mysql.buildlink3.mk"
4900: .endif
4901: .if !empty(PKG_OPTIONS:Mpgsql)
4902: . include "../../mk/pgsql.buildlink3.mk"
4903: .endif
4904:
4905: The first section contains the information about which build options are
4906: supported by the package, and any default options settings if needed.
4907:
4908: 1. PKG_OPTIONS_VAR is the name of the make(1) variable that the user can set
4909: to override the default options. It should be set to PKG_OPTIONS.pkgbase.
4910: Do not set it to PKG_OPTIONS.${PKGBASE}, since PKGBASE is not defined at
4911: the point where the options are processed.
4912:
4913: 2. PKG_SUPPORTED_OPTIONS is a list of build options supported by the package.
4914:
4915: 3. PKG_OPTIONS_OPTIONAL_GROUPS is a list of names of groups of mutually
4916: exclusive options. The options in each group are listed in
4917: PKG_OPTIONS_GROUP.groupname. The most specific setting of any option from
4918: the group takes precedence over all other options in the group. Options
4919: from the groups will be automatically added to PKG_SUPPORTED_OPTIONS.
4920:
4921: 4. PKG_OPTIONS_REQUIRED_GROUPS is like PKG_OPTIONS_OPTIONAL_GROUPS, but
4922: building the packages will fail if no option from the group is selected.
4923:
4924: 5. PKG_OPTIONS_NONEMPTY_SETS is a list of names of sets of options. At least
4925: one option from each set must be selected. The options in each set are
4926: listed in PKG_OPTIONS_SET.setname. Options from the sets will be
4927: automatically added to PKG_SUPPORTED_OPTIONS. Building the package will
4928: fail if no option from the set is selected.
4929:
4930: 6. PKG_SUGGESTED_OPTIONS is a list of build options which are enabled by
4931: default.
4932:
4933: 7. PKG_OPTIONS_LEGACY_VARS is a list of "USE_VARIABLE:option" pairs that map
1.4 rillig 4934: legacy mk.conf variables to their option counterparts. Pairs should be
1.1 dsieger 4935: added with "+=" to keep the listing of global legacy variables. A warning
4936: will be issued if the user uses a legacy variable.
4937:
4938: 8. PKG_OPTIONS_LEGACY_OPTS is a list of "old-option:new-option" pairs that map
4939: options that have been renamed to their new counterparts. Pairs should be
4940: added with "+=" to keep the listing of global legacy options. A warning
4941: will be issued if the user uses a legacy option.
4942:
4943: 9. PKG_LEGACY_OPTIONS is a list of options implied by deprecated variables
4944: used. This can be used for cases that neither PKG_OPTIONS_LEGACY_VARS nor
4945: PKG_OPTIONS_LEGACY_OPTS can handle, e. g. when PKG_OPTIONS_VAR is renamed.
4946:
4947: 10. PKG_OPTIONS_DEPRECATED_WARNINGS is a list of warnings about deprecated
4948: variables or options used, and what to use instead.
4949:
4950: A package should never modify PKG_DEFAULT_OPTIONS or the variable named in
4951: PKG_OPTIONS_VAR. These are strictly user-settable. To suggest a default set of
4952: options, use PKG_SUGGESTED_OPTIONS.
4953:
4954: PKG_OPTIONS_VAR must be defined before including bsd.options.mk. If none of
4955: PKG_SUPPORTED_OPTIONS, PKG_OPTIONS_OPTIONAL_GROUPS, and
4956: PKG_OPTIONS_REQUIRED_GROUPS are defined (as can happen with platform-specific
4957: options if none of them is supported on the current platform), PKG_OPTIONS is
4958: set to the empty list and the package is otherwise treated as not using the
4959: options framework.
4960:
4961: After the inclusion of bsd.options.mk, the variable PKG_OPTIONS contains the
4962: list of selected build options, properly filtered to remove unsupported and
4963: duplicate options.
4964:
4965: The remaining sections contain the logic that is specific to each option. The
4966: correct way to check for an option is to check whether it is listed in
4967: PKG_OPTIONS:
4968:
4969: .if !empty(PKG_OPTIONS:Moption)
4970:
1.184 rillig 4971: 16.3. Option Names
1.1 dsieger 4972:
4973: Options that enable similar features in different packages (like optional
4974: support for a library) should use a common name in all packages that support it
4975: (like the name of the library). If another package already has an option with
4976: the same meaning, use the same name.
4977:
4978: Options that enable features specific to one package, where it's unlikely that
4979: another (unrelated) package has the same (or a similar) optional feature,
4980: should use a name prefixed with pkgname-.
4981:
4982: If a group of related packages share an optional feature specific to that
4983: group, prefix it with the name of the "main" package (e. g.
4984: djbware-errno-hack).
4985:
4986: For new options, add a line to mk/defaults/options.description. Lines have two
4987: fields, separated by tab. The first field is the option name, the second its
4988: description. The description should be a whole sentence (starting with an
4989: uppercase letter and ending with a period) that describes what enabling the
4990: option does. E. g. "Enable ispell support." The file is sorted by option names.
4991:
1.184 rillig 4992: 16.4. Determining the options of dependencies
1.7 rillig 4993:
4994: When writing buildlink3.mk files, it is often necessary to list different
4995: dependencies based on the options with which the package was built. For
4996: querying these options, the file pkgsrc/mk/pkg-build-options.mk should be used.
4997: A typical example looks like this:
4998:
4999: pkgbase := libpurple
5000: .include "../../mk/pkg-build-options.mk"
5001:
5002: .if !empty(PKG_BUILD_OPTIONS.libpurple:Mdbus)
5003: ...
5004: .endif
5005:
5006: Including pkg-build-options.mk here will set the variable
5007: PKG_BUILD_OPTIONS.libpurple to the build options of the libpurple package,
5008: which can then be queried like PKG_OPTIONS in the options.mk file. See the file
5009: pkg-build-options.mk for more details.
5010:
1.184 rillig 5011: Chapter 17. Tools needed for building or running
5012:
5013: Table of Contents
5014:
5015: 17.1. Tools for pkgsrc builds
5016: 17.2. Tools needed by packages
5017: 17.3. Tools provided by platforms
5018:
5019: The USE_TOOLS definition is used both internally by pkgsrc and also for
5020: individual packages to define what commands are needed for building a package
5021: (like TOOL_DEPENDS) or for later run-time of an installed packaged (such as
5022: DEPENDS). If the native system provides an adequate tool, then in many cases, a
5023: pkgsrc package will not be used.
5024:
5025: When building a package, the replacement tools are made available in a
5026: directory (as symlinks or wrapper scripts) that is early in the executable
5027: search path. Just like the buildlink system, this helps with consistent builds.
5028:
5029: A tool may be needed to help build a specific package. For example, perl, GNU
5030: make (gmake) or yacc may be needed.
5031:
5032: Also a tool may be needed, for example, because the native system's supplied
5033: tool may be inefficient for building a package with pkgsrc. For example, a
5034: package may need GNU awk, bison (instead of yacc) or a better sed.
5035:
5036: The tools used by a package can be listed by running make show-tools.
5037:
5038: 17.1. Tools for pkgsrc builds
5039:
5040: The default set of tools used by pkgsrc is defined in bsd.pkg.mk. This includes
5041: standard Unix tools, such as: cat, awk, chmod, test, and so on. These can be
5042: seen by running: make show-var VARNAME=USE_TOOLS.
5043:
5044: If a package needs a specific program to build then the USE_TOOLS variable can
5045: be used to define the tools needed.
5046:
5047: 17.2. Tools needed by packages
5048:
5049: In the following examples, the :run means that it is needed at run-time (and
5050: becomes a DEPENDS). The default is a build dependency which can be set with
5051: :build. (So in this example, it is the same as gmake:build and
5052: pkg-config:build.)
5053:
5054: USE_TOOLS+= gmake perl:run pkg-config
5055:
5056: When using the tools framework, a TOOLS_PATH.foo variable is defined which
5057: contains the full path to the appropriate tool. For example, TOOLS_PATH.bash
5058: could be "/bin/bash" on Linux systems.
5059:
5060: If you always need a pkgsrc version of the tool at run-time, then just use
5061: DEPENDS instead.
5062:
5063: 17.3. Tools provided by platforms
5064:
5065: When improving or porting pkgsrc to a new platform, have a look at (or create)
5066: the corresponding platform specific make file fragment under pkgsrc/mk/tools/
5067: tools.${OPSYS}.mk which defines the name of the common tools. For example:
5068:
5069: .if exists(/usr/bin/bzcat)
5070: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
5071: .elif exists(/usr/bin/bzip2)
5072: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
5073: .endif
5074:
5075: TOOLS_PLATFORM.true?= true # shell builtin
5076:
5077: Chapter 18. Buildlink methodology
1.1 dsieger 5078:
5079: Table of Contents
5080:
1.184 rillig 5081: 18.1. Converting packages to use buildlink3
5082: 18.2. Writing buildlink3.mk files
5083:
5084: 18.2.1. Anatomy of a buildlink3.mk file
5085: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
5086: buildlink3.mk files
5087:
5088: 18.3. Writing builtin.mk files
5089:
5090: 18.3.1. Anatomy of a builtin.mk file
5091: 18.3.2. Global preferences for native or pkgsrc software
5092:
5093: Buildlink is a framework in pkgsrc that controls what headers and libraries are
5094: seen by a package's configure and build processes. This is implemented in a two
5095: step process:
5096:
5097: 1. Symlink headers and libraries for dependencies into BUILDLINK_DIR, which by
5098: default is a subdirectory of WRKDIR.
5099:
5100: 2. Create wrapper scripts that are used in place of the normal compiler tools
5101: that translate -I${LOCALBASE}/include and -L${LOCALBASE}/lib into
5102: references to BUILDLINK_DIR. The wrapper scripts also make native compiler
5103: on some operating systems look like GCC, so that packages that expect GCC
5104: won't require modifications to build with those native compilers.
5105:
5106: This normalizes the environment in which a package is built so that the package
5107: may be built consistently despite what other software may be installed. Please
5108: note that the normal system header and library paths, e.g. /usr/include, /usr/
5109: lib, etc., are always searched -- buildlink3 is designed to insulate the
5110: package build from non-system-supplied software.
5111:
5112: 18.1. Converting packages to use buildlink3
1.1 dsieger 5113:
1.184 rillig 5114: The process of converting packages to use the buildlink3 framework ("bl3ifying"
5115: ) is fairly straightforward. The things to keep in mind are:
1.1 dsieger 5116:
1.184 rillig 5117: 1. Ensure that the build always calls the wrapper scripts instead of the
5118: actual toolchain. Some packages are tricky, and the only way to know for
5119: sure is the check ${WRKDIR}/.work.log to see if the wrappers are being
5120: invoked.
1.1 dsieger 5121:
1.184 rillig 5122: 2. Don't override PREFIX from within the package Makefile, e.g. Java VMs,
5123: standalone shells, etc., because the code to symlink files into $
5124: {BUILDLINK_DIR} looks for files relative to "pkg_info -qp pkgname".
1.1 dsieger 5125:
1.184 rillig 5126: 3. Remember that only the buildlink3.mk files that you list in a package's
5127: Makefile are added as dependencies for that package.
1.1 dsieger 5128:
1.184 rillig 5129: If a dependency on a particular package is required for its libraries and
5130: headers, then we replace:
1.1 dsieger 5131:
1.184 rillig 5132: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 dsieger 5133:
1.184 rillig 5134: with
1.1 dsieger 5135:
1.184 rillig 5136: .include "../../category/foo/buildlink3.mk"
1.1 dsieger 5137:
1.184 rillig 5138: The buildlink3.mk files usually define the required dependencies. If you need a
5139: newer version of the dependency when using buildlink3.mk files, then you can
5140: define it in your Makefile; for example:
1.1 dsieger 5141:
1.184 rillig 5142: BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0
5143: .include "../../category/foo/buildlink3.mk"
1.1 dsieger 5144:
1.184 rillig 5145: There are several buildlink3.mk files in pkgsrc/mk that handle special package
5146: issues:
1.1 dsieger 5147:
1.184 rillig 5148: * bdb.buildlink3.mk chooses either the native or a pkgsrc Berkeley DB
5149: implementation based on the values of BDB_ACCEPTED and BDB_DEFAULT.
1.1 dsieger 5150:
1.184 rillig 5151: * curses.buildlink3.mk: If the system comes with neither Curses nor NCurses,
5152: this will take care to install the devel/ncurses package.
1.1 dsieger 5153:
1.184 rillig 5154: * krb5.buildlink3.mk uses the value of KRB5_ACCEPTED to choose between adding
5155: a dependency on Heimdal or MIT-krb5 for packages that require a Kerberos 5
5156: implementation.
1.1 dsieger 5157:
1.184 rillig 5158: * motif.buildlink3.mk checks for a system-provided Motif installation or adds
5159: a dependency on x11/lesstif or x11/motif. The user can set MOTIF_TYPE to "
5160: dt", "lesstif" or "motif" to choose which Motif version will be used.
1.1 dsieger 5161:
1.184 rillig 5162: * readline.buildlink3.mk checks for a system-provided GNU readline or
5163: editline (libedit) installation, or adds a dependency on devel/readline,
5164: devel/editline. The user can set READLINE_DEFAULT to choose readline
5165: implementation. If your package really needs GNU readline library, its
5166: Makefile should include devel/readline/buildlink3.mk instead of
5167: readline.buildlink3.mk.
1.1 dsieger 5168:
1.184 rillig 5169: * oss.buildlink3.mk defines several variables that may be used by packages
5170: that use the Open Sound System (OSS) API.
1.1 dsieger 5171:
1.184 rillig 5172: * pgsql.buildlink3.mk will accept any of the Postgres versions in the
5173: variable PGSQL_VERSIONS_ACCEPTED and default to the version
5174: PGSQL_VERSION_DEFAULT. See the file for more information.
1.1 dsieger 5175:
1.184 rillig 5176: * pthread.buildlink3.mk uses the value of PTHREAD_OPTS and checks for native
5177: pthreads or adds a dependency on devel/pth as needed.
1.1 dsieger 5178:
1.184 rillig 5179: * xaw.buildlink3.mk uses the value of XAW_TYPE to choose a particular Athena
5180: widgets library.
1.1 dsieger 5181:
1.184 rillig 5182: The comments in those buildlink3.mk files provide a more complete description
5183: of how to use them properly.
1.1 dsieger 5184:
1.184 rillig 5185: 18.2. Writing buildlink3.mk files
1.1 dsieger 5186:
1.184 rillig 5187: A package's buildlink3.mk file is included by Makefiles to indicate the need to
5188: compile and link against header files and libraries provided by the package. A
5189: buildlink3.mk file should always provide enough information to add the correct
5190: type of dependency relationship and include any other buildlink3.mk files that
5191: it needs to find headers and libraries that it needs in turn.
1.1 dsieger 5192:
1.184 rillig 5193: To generate an initial buildlink3.mk file for further editing, Rene Hexel's
5194: pkgtools/createbuildlink package is highly recommended. For most packages, the
5195: following command will generate a good starting point for buildlink3.mk files:
1.1 dsieger 5196:
1.184 rillig 5197: % cd pkgsrc/category/pkgdir
5198: % createbuildlink >buildlink3.mk
1.1 dsieger 5199:
5200:
1.184 rillig 5201: 18.2.1. Anatomy of a buildlink3.mk file
1.1 dsieger 5202:
1.184 rillig 5203: The following real-life example buildlink3.mk is taken from pkgsrc/graphics/
5204: tiff:
1.14 jmcneill 5205:
1.184 rillig 5206: # $NetBSD: buildlink3.mk,v 1.16 2009/03/20 19:24:45 joerg Exp $
1.1 dsieger 5207:
1.184 rillig 5208: BUILDLINK_TREE+= tiff
1.1 dsieger 5209:
1.184 rillig 5210: .if !defined(TIFF_BUILDLINK3_MK)
5211: TIFF_BUILDLINK3_MK:=
1.1 dsieger 5212:
1.184 rillig 5213: BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1
5214: BUILDLINK_ABI_DEPENDS.tiff+= tiff>=3.7.2nb1
5215: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
1.1 dsieger 5216:
1.184 rillig 5217: .include "../../devel/zlib/buildlink3.mk"
5218: .include "../../graphics/jpeg/buildlink3.mk"
5219: .endif # TIFF_BUILDLINK3_MK
1.1 dsieger 5220:
1.184 rillig 5221: BUILDLINK_TREE+= -tiff
1.1 dsieger 5222:
1.184 rillig 5223: The header and footer manipulate BUILDLINK_TREE, which is common across all
5224: buildlink3.mk files and is used to track the dependency tree.
1.1 dsieger 5225:
1.184 rillig 5226: The main section is protected from multiple inclusion and controls how the
5227: dependency on pkg is added. Several important variables are set in the section:
1.1 dsieger 5228:
1.185 wiz 5229: * BUILDLINK_API_DEPENDS.pkg is the dependency version recorded in the
1.184 rillig 5230: installed package; this should always be set using += to ensure that we're
5231: appending to any pre-existing list of values. This variable should be set
1.185 wiz 5232: to the last version of the package that had an backwards-incompatible API
1.184 rillig 5233: change.
1.1 dsieger 5234:
1.184 rillig 5235: * BUILDLINK_PKGSRCDIR.pkg is the location of the pkg pkgsrc directory.
1.1 dsieger 5236:
1.184 rillig 5237: * BUILDLINK_DEPMETHOD.pkg (not shown above) controls whether we use
5238: BUILD_DEPENDS or DEPENDS to add the dependency on pkg. The build dependency
5239: is selected by setting BUILDLINK_DEPMETHOD.pkg to "build". By default, the
5240: full dependency is used.
1.1 dsieger 5241:
1.184 rillig 5242: * BUILDLINK_INCDIRS.pkg and BUILDLINK_LIBDIRS.pkg (not shown above) are lists
5243: of subdirectories of ${BUILDLINK_PREFIX.pkg} to add to the header and
5244: library search paths. These default to "include" and "lib" respectively.
1.1 dsieger 5245:
1.184 rillig 5246: * BUILDLINK_CPPFLAGS.pkg (not shown above) is the list of preprocessor flags
5247: to add to CPPFLAGS, which are passed on to the configure and build phases.
5248: The "-I" option should be avoided and instead be handled using
5249: BUILDLINK_INCDIRS.pkg as above.
1.66 asau 5250:
1.184 rillig 5251: The following variables are all optionally defined within this second section
5252: (protected against multiple inclusion) and control which package files are
5253: symlinked into ${BUILDLINK_DIR} and how their names are transformed during the
5254: symlinking:
1.23 jakllsch 5255:
1.184 rillig 5256: * BUILDLINK_FILES.pkg (not shown above) is a shell glob pattern relative to $
5257: {BUILDLINK_PREFIX.pkg} to be symlinked into ${BUILDLINK_DIR}, e.g. include/
5258: *.h.
1.1 dsieger 5259:
1.184 rillig 5260: * BUILDLINK_FILES_CMD.pkg (not shown above) is a shell pipeline that outputs
5261: to stdout a list of files relative to ${BUILDLINK_PREFIX.pkg}. The
5262: resulting files are to be symlinked into ${BUILDLINK_DIR}. By default, this
5263: takes the +CONTENTS of a pkg and filters it through $
5264: {BUILDLINK_CONTENTS_FILTER.pkg}.
1.1 dsieger 5265:
1.184 rillig 5266: * BUILDLINK_CONTENTS_FILTER.pkg (not shown above) is a filter command that
5267: filters +CONTENTS input into a list of files relative to $
5268: {BUILDLINK_PREFIX.pkg} on stdout. By default, BUILDLINK_CONTENTS_FILTER.pkg
5269: outputs the contents of the include and lib directories in the package
5270: +CONTENTS.
1.1 dsieger 5271:
1.184 rillig 5272: * BUILDLINK_FNAME_TRANSFORM.pkg (not shown above) is a list of sed arguments
5273: used to transform the name of the source filename into a destination
5274: filename, e.g. -e "s|/curses.h|/ncurses.h|g".
1.1 dsieger 5275:
1.184 rillig 5276: This section can additionally include any buildlink3.mk needed for pkg's
5277: library dependencies. Including these buildlink3.mk files means that the
5278: headers and libraries for these dependencies are also symlinked into $
5279: {BUILDLINK_DIR} whenever the pkg buildlink3.mk file is included. Dependencies
5280: are only added for directly include buildlink3.mk files.
1.1 dsieger 5281:
1.184 rillig 5282: When providing a buildlink3.mk and including other buildlink3.mk files in it,
5283: please only add necessary ones, i.e., those whose libraries or header files are
5284: automatically exposed when the package is use.
1.1 dsieger 5285:
1.184 rillig 5286: In particular, if only an executable (bin/foo) is linked against a library,
5287: that library does not need to be propagated in the buildlink3.mk file.
1.1 dsieger 5288:
1.184 rillig 5289: The following steps should help you decide if a buildlink3.mk file needs to be
5290: included:
1.1 dsieger 5291:
1.184 rillig 5292: * Look at the installed header files: What headers do they include? The
5293: packages providing these files must be buildlinked.
1.1 dsieger 5294:
1.184 rillig 5295: * Run ldd on all installed libraries and look against what other libraries
5296: they link. Some of the packages providing these probably need to be
5297: buildlinked; however, it's not automatic, since e.g. GTK on some systems
5298: pulls in the X libraries, so they will show up in the ldd output, while on
5299: others (like OS X) it won't. ldd output can thus only be used as a hint.
1.1 dsieger 5300:
1.184 rillig 5301: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
5302: buildlink3.mk files
1.16 jnemeth 5303:
1.185 wiz 5304: Both variables set lower bounds for a version of this package. The two
5305: variables differ in that one describes source compatibility (API) and the other
5306: binary compatibility (ABI). The difference is that a change in the API breaks
5307: compilation of programs while changes in the ABI stop compiled programs from
5308: running.
5309:
5310: The BUILDLINK_API_DEPENDS.pkg variable in a buildlink3.mk should be changed
5311: very rarely. (One possible scenario: If all packages using this package need a
5312: higher version than defined in the buildlink3.mk, BUILDLINK_API_DEPENDS.pkg
5313: could be updated to that higher version.)
5314:
5315: On the other hand, changes to BUILDLINK_ABI_DEPENDS.pkg are more common. The
5316: variable will need to be updated every time the major version of one of its
5317: shared libraries is changed, or any other change where a binary built against
5318: the previous version of the package will not run against the new version any
5319: longer.
5320:
5321: In such a case, the package's BUILDLINK_ABI_DEPENDS.pkg must be increased to
5322: require the new package version. Then the PKGREVISION of all packages foo that
5323: depend on this package need to be increased, and if they have buildlink3.mk
5324: files, BUILDLINK_ABI_DEPENDS.foo in their buildlink3.mk files must be increased
5325: to the new version as well. This is required so that a package will pull in the
5326: versions of the packages that use the new ABI and that the packages'
5327: PKGREVISIONs uniquely identify the packages built against the new ABI. The
5328: pkgtools/revbump package can help with these updates.
1.1 dsieger 5329:
1.184 rillig 5330: See Section 21.1.5, "Handling dependencies" for more information about
1.185 wiz 5331: dependencies on other packages, including the BUILDLINK_API_DEPENDS
5332: definitions.
1.1 dsieger 5333:
1.184 rillig 5334: Please take careful consideration before adjusting BUILDLINK_API_DEPENDS.pkg or
1.185 wiz 5335: BUILDLINK_ABI_DEPENDS.pkg in a buildlink3.mk file as we don't want to cause
5336: unneeded package deletions and rebuilds. In many cases, new versions of
5337: packages work just fine with older dependencies.
1.1 dsieger 5338:
1.184 rillig 5339: Also it is not needed to set BUILDLINK_ABI_DEPENDS.pkg when it is identical to
5340: BUILDLINK_API_DEPENDS.pkg.
1.1 dsieger 5341:
1.184 rillig 5342: 18.3. Writing builtin.mk files
1.1 dsieger 5343:
1.184 rillig 5344: Some packages in pkgsrc install headers and libraries that coincide with
5345: headers and libraries present in the base system. Aside from a buildlink3.mk
5346: file, these packages should also include a builtin.mk file that includes the
5347: necessary checks to decide whether using the built-in software or the pkgsrc
5348: software is appropriate.
1.1 dsieger 5349:
1.184 rillig 5350: The only requirements of a builtin.mk file for pkg are:
1.1 dsieger 5351:
1.184 rillig 5352: 1. It should set USE_BUILTIN.pkg to either "yes" or "no" after it is included.
1.1 dsieger 5353:
1.184 rillig 5354: 2. It should not override any USE_BUILTIN.pkg which is already set before the
5355: builtin.mk file is included.
1.1 dsieger 5356:
1.184 rillig 5357: 3. It should be written to allow multiple inclusion. This is very important
5358: and takes careful attention to Makefile coding.
1.1 dsieger 5359:
1.184 rillig 5360: 18.3.1. Anatomy of a builtin.mk file
1.1 dsieger 5361:
1.184 rillig 5362: The following is the recommended template for builtin.mk files:
1.1 dsieger 5363:
1.184 rillig 5364: .if !defined(IS_BUILTIN.foo)
5365: #
5366: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
5367: # genuinely exists in the system or not.
5368: #
5369: IS_BUILTIN.foo?= no
1.1 dsieger 5370:
1.184 rillig 5371: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
5372: # version can be determined.
5373: #
5374: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
5375: BUILTIN_PKG.foo?= foo-1.0
5376: . endif
5377: .endif # IS_BUILTIN.foo
1.1 dsieger 5378:
1.184 rillig 5379: .if !defined(USE_BUILTIN.foo)
5380: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
5381: . if defined(BUILTIN_PKG.foo)
5382: . for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
5383: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
5384: USE_BUILTIN.foo!= \
5385: ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \
5386: && ${ECHO} "yes" || ${ECHO} "no"
5387: . endif
5388: . endfor
5389: . endif
5390: .endif # USE_BUILTIN.foo
1.1 dsieger 5391:
1.184 rillig 5392: CHECK_BUILTIN.foo?= no
5393: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
5394: #
5395: # Here we place code that depends on whether USE_BUILTIN.foo is set to
5396: # "yes" or "no".
5397: #
5398: .endif # CHECK_BUILTIN.foo
1.1 dsieger 5399:
1.184 rillig 5400: The first section sets IS_BUILTIN.pkg depending on if pkg really exists in the
5401: base system. This should not be a base system software with similar
5402: functionality to pkg; it should only be "yes" if the actual package is included
5403: as part of the base system. This variable is only used internally within the
5404: builtin.mk file.
1.1 dsieger 5405:
1.184 rillig 5406: The second section sets BUILTIN_PKG.pkg to the version of pkg in the base
5407: system if it exists (if IS_BUILTIN.pkg is "yes"). This variable is only used
5408: internally within the builtin.mk file.
1.1 dsieger 5409:
1.184 rillig 5410: The third section sets USE_BUILTIN.pkg and is required in all builtin.mk files.
5411: The code in this section must make the determination whether the built-in
5412: software is adequate to satisfy the dependencies listed in
5413: BUILDLINK_API_DEPENDS.pkg. This is typically done by comparing BUILTIN_PKG.pkg
5414: against each of the dependencies in BUILDLINK_API_DEPENDS.pkg. USE_BUILTIN.pkg
5415: must be set to the correct value by the end of the builtin.mk file. Note that
5416: USE_BUILTIN.pkg may be "yes" even if IS_BUILTIN.pkg is "no" because we may make
5417: the determination that the built-in version of the software is similar enough
5418: to be used as a replacement.
1.1 dsieger 5419:
1.184 rillig 5420: The last section is guarded by CHECK_BUILTIN.pkg, and includes code that uses
5421: the value of USE_BUILTIN.pkg set in the previous section. This typically
5422: includes, e.g., adding additional dependency restrictions and listing
5423: additional files to symlink into ${BUILDLINK_DIR} (via BUILDLINK_FILES.pkg).
1.1 dsieger 5424:
1.184 rillig 5425: 18.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 5426:
1.184 rillig 5427: When building packages, it's possible to choose whether to set a global
5428: preference for using either the built-in (native) version or the pkgsrc version
5429: of software to satisfy a dependency. This is controlled by setting
5430: PREFER_PKGSRC and PREFER_NATIVE. These variables take values of either "yes", "
5431: no", or a list of packages. PREFER_PKGSRC tells pkgsrc to use the pkgsrc
5432: versions of software, while PREFER_NATIVE tells pkgsrc to use the built-in
5433: versions. Preferences are determined by the most specific instance of the
5434: package in either PREFER_PKGSRC or PREFER_NATIVE. If a package is specified in
5435: neither or in both variables, then PREFER_PKGSRC has precedence over
5436: PREFER_NATIVE. For example, to require using pkgsrc versions of software for
5437: all but the most basic bits on a NetBSD system, you can set:
1.1 dsieger 5438:
1.184 rillig 5439: PREFER_PKGSRC= yes
5440: PREFER_NATIVE= getopt skey tcp_wrappers
1.1 dsieger 5441:
1.184 rillig 5442: A package must have a builtin.mk file to be listed in PREFER_NATIVE, otherwise
5443: it is simply ignored in that list.
1.1 dsieger 5444:
1.191 bacon 5445: PREFER_PKGSRC and PREFER_NATIVE should be set during bootstrap to ensure that
5446: the bootstrap process does not use inapropriate native tools as dependencies
5447: for core packages.
5448:
5449: # ./bootstrap --prefer-pkgsrc yes --prefer-native openssl
5450:
5451: Switching between settings globally at a later date can introduce complications
5452: with dependency resolution. This is caused by packages built with the opposite
5453: preference being installed alongside each other. Hence, any changes to these
5454: variables after bootstrap will necessitate rebuilding all packages depending on
5455: one whose preference has been changed. This is not trivial and should be
5456: avoided.
5457:
5458: When using pkgsrc on Linux systems, there is high risk of "leakage", where
5459: programs installed by pkgsrc may inadvertently use a command or library not
5460: installed by pkgsrc, e.g. those installed by yum or apt. Such foreign
5461: dependencies may be installed, removed, or upgraded to a version incompatible
5462: with the pkgsrc package at any time, causing pkgsrc packages to subsequently
5463: malfunction. Pkgsrc cannot prevent this, as it has no control over other
5464: package managers. Another potential problem is that under Redhat Enterprise and
5465: related Linux systems, yum packages are only patched and never upgraded, so
5466: eventually they may become too outdated for use by pkgsrc. Even intentionally
5467: using foreign dependencies, not considered leakage, can lead to these problems,
5468: so it is generally discouraged. In order to minimize such problems,
5469: PREFER_PKGSRC defaults to "yes" on Linux systems. This ensures that pkgsrc is
5470: aware of any changes to dependency packages and can rebuild or upgrade the
5471: entire dependency tree as needed. This default can be overridden by setting
5472: --prefer-pkgsrc to "no" or a list of packages, or by setting --prefer-native to
5473: "yes".
1.1 dsieger 5474:
1.184 rillig 5475: Chapter 19. PLIST issues
1.1 dsieger 5476:
1.184 rillig 5477: Table of Contents
1.1 dsieger 5478:
1.184 rillig 5479: 19.1. RCS ID
5480: 19.2. Semi-automatic PLIST generation
5481: 19.3. Tweaking output of make print-PLIST
5482: 19.4. Variable substitution in PLIST
5483: 19.5. Man page compression
5484: 19.6. Changing PLIST source with PLIST_SRC
5485: 19.7. Platform-specific and differing PLISTs
5486: 19.8. Build-specific PLISTs
5487: 19.9. Sharing directories between packages
1.1 dsieger 5488:
1.184 rillig 5489: The PLIST file contains a package's "packing list", i.e. a list of files that
5490: belong to the package (relative to the ${PREFIX} directory it's been installed
5491: in) plus some additional statements - see the pkg_create(1) man page for a full
5492: list. This chapter addresses some issues that need attention when dealing with
5493: the PLIST file (or files, see below!).
1.1 dsieger 5494:
1.184 rillig 5495: 19.1. RCS ID
1.1 dsieger 5496:
1.184 rillig 5497: Be sure to add a RCS ID line as the first thing in any PLIST file you write:
1.1 dsieger 5498:
1.184 rillig 5499: @comment $NetBSD $
1.1 dsieger 5500:
1.184 rillig 5501: An artificial space has been added between NetBSD and $, this is a workaround
5502: here to prevent CVS expanding to the filename of the guide. When adding the RCS
5503: ID the space should be omitted.
1.38 wiz 5504:
1.184 rillig 5505: 19.2. Semi-automatic PLIST generation
1.1 dsieger 5506:
1.184 rillig 5507: You can use the make print-PLIST command to output a PLIST that matches any new
5508: files since the package was extracted. See Section 13.17, "Other helpful
5509: targets" for more information on this target.
1.11 rillig 5510:
1.184 rillig 5511: 19.3. Tweaking output of make print-PLIST
1.1 dsieger 5512:
1.184 rillig 5513: The PRINT_PLIST_AWK variable takes a set of AWK patterns and actions that are
5514: used to filter the output of print-PLIST. You can append any chunk of AWK
5515: scripting you like to it, but be careful with quoting.
1.1 dsieger 5516:
1.184 rillig 5517: For example, to get all files inside the libdata/foo directory removed from the
5518: resulting PLIST:
1.1 dsieger 5519:
1.184 rillig 5520: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 dsieger 5521:
1.185 wiz 5522: The PRINT_PLIST_AWK transformations are evaluated after the file list and
5523: directory list are sorted. EARLY_PRINT_PLIST_AWK is like PRINT_PLIST_AWK except
5524: it operates before the file list and directory list are sorted.
5525:
1.184 rillig 5526: 19.4. Variable substitution in PLIST
1.1 dsieger 5527:
1.184 rillig 5528: A number of variables are substituted automatically in PLISTs when a package is
5529: installed on a system. This includes the following variables:
1.1 dsieger 5530:
1.184 rillig 5531: ${MACHINE_ARCH}, ${MACHINE_GNU_ARCH}
1.1 dsieger 5532:
1.184 rillig 5533: Some packages like emacs and perl embed information about which
5534: architecture they were built on into the pathnames where they install their
5535: files. To handle this case, PLIST will be preprocessed before actually
5536: used, and the symbol "${MACHINE_ARCH}" will be replaced by what uname -p
5537: gives. The same is done if the string ${MACHINE_GNU_ARCH} is embedded in
5538: PLIST somewhere - use this on packages that have GNU autoconf-created
5539: configure scripts.
1.1 dsieger 5540:
1.184 rillig 5541: Legacy note
1.1 dsieger 5542:
1.184 rillig 5543: There used to be a symbol "$ARCH" that was replaced by the output of uname
5544: -m, but that's no longer supported and has been removed.
1.1 dsieger 5545:
1.184 rillig 5546: ${OPSYS}, ${LOWER_OPSYS}, ${OS_VERSION}
1.1 dsieger 5547:
1.184 rillig 5548: Some packages want to embed the OS name and version into some paths. To do
5549: this, use these variables in the PLIST:
1.1 dsieger 5550:
1.184 rillig 5551: + ${OPSYS} - output of "uname -s"
1.1 dsieger 5552:
1.184 rillig 5553: + ${LOWER_OPSYS} - lowercase common name (eg. "solaris")
1.1 dsieger 5554:
1.184 rillig 5555: + ${OS_VERSION} - "uname -r"
1.1 dsieger 5556:
1.184 rillig 5557: For a list of values which are replaced by default, the output of make help
5558: topic=PLIST_SUBST as well as searching the pkgsrc/mk directory with grep for
5559: PLIST_SUBST should help.
1.1 dsieger 5560:
1.184 rillig 5561: If you want to change other variables not listed above, you can add variables
5562: and their expansions to this variable in the following way, similar to
5563: MESSAGE_SUBST (see Section 12.5, "Optional files"):
1.1 dsieger 5564:
1.184 rillig 5565: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 5566:
1.184 rillig 5567: This replaces all occurrences of "${SOMEVAR}" in the PLIST with "somevalue".
1.1 dsieger 5568:
1.184 rillig 5569: The PLIST_VARS variable can be used to simplify the common case of
5570: conditionally including some PLIST entries. It can be done by adding
5571: PLIST_VARS+=foo and setting the corresponding PLIST.foo variable to yes if the
5572: entry should be included. This will substitute "${PLIST.foo}" in the PLIST with
5573: either """" or ""@comment "". For example, in Makefile:
1.1 dsieger 5574:
1.184 rillig 5575: PLIST_VARS+= foo
5576: .if condition
5577: PLIST.foo= yes
5578: .else
1.1 dsieger 5579:
1.184 rillig 5580: And then in PLIST:
1.1 dsieger 5581:
1.184 rillig 5582: @comment $NetBSD $
5583: bin/bar
5584: man/man1/bar.1
5585: ${PLIST.foo}bin/foo
5586: ${PLIST.foo}man/man1/foo.1
5587: ${PLIST.foo}share/bar/foo.data
1.1 dsieger 5588:
1.184 rillig 5589: An artificial space has been added between NetBSD and $, this is a workaround
5590: here to prevent CVS expanding to the filename of the guide. When adding the RCS
1.195 gutterid 5591: ID the space should be omitted.
1.1 dsieger 5592:
1.184 rillig 5593: 19.5. Man page compression
1.1 dsieger 5594:
1.184 rillig 5595: Man pages should be installed in compressed form if MANZ is set (in
5596: bsd.own.mk), and uncompressed otherwise. To handle this in the PLIST file, the
5597: suffix ".gz" is appended/removed automatically for man pages according to MANZ
5598: and MANCOMPRESSED being set or not, see above for details. This modification of
5599: the PLIST file is done on a copy of it, not PLIST itself.
1.100 leot 5600:
1.184 rillig 5601: 19.6. Changing PLIST source with PLIST_SRC
1.100 leot 5602:
1.184 rillig 5603: To use one or more files as source for the PLIST used in generating the binary
5604: package, set the variable PLIST_SRC to the names of that file(s). The files are
5605: later concatenated using cat(1), and the order of things is important. The
5606: default for PLIST_SRC is ${PKGDIR}/PLIST.
1.1 dsieger 5607:
1.184 rillig 5608: 19.7. Platform-specific and differing PLISTs
1.1 dsieger 5609:
1.184 rillig 5610: Some packages decide to install a different set of files based on the operating
5611: system being used. These differences can be automatically handled by using the
5612: following files:
1.1 dsieger 5613:
1.184 rillig 5614: * PLIST.common
1.1 dsieger 5615:
1.184 rillig 5616: * PLIST.${OPSYS}
1.1 dsieger 5617:
1.184 rillig 5618: * PLIST.${MACHINE_ARCH}
1.1 dsieger 5619:
1.184 rillig 5620: * PLIST.${OPSYS}-${MACHINE_ARCH}
1.1 dsieger 5621:
1.184 rillig 5622: * PLIST.common_end
1.1 dsieger 5623:
1.184 rillig 5624: 19.8. Build-specific PLISTs
1.1 dsieger 5625:
1.184 rillig 5626: Some packages decide to generate hard-to-guess file names during installation
5627: that are hard to wire down.
1.1 dsieger 5628:
1.184 rillig 5629: In such cases, you can set the GENERATE_PLIST variable to shell code terminated
5630: (with a semicolon) that will output PLIST entries which will be appended to the
5631: PLIST
1.1 dsieger 5632:
1.184 rillig 5633: You can find one example in editors/xemacs:
1.1 dsieger 5634:
1.184 rillig 5635: GENERATE_PLIST+= ${ECHO} bin/${DISTNAME}-`${WRKSRC}/src/xemacs -sd`.dmp ;
1.1 dsieger 5636:
1.184 rillig 5637: which will append something like bin/xemacs-21.4.23-54e8ea71.dmp to the PLIST.
1.1 dsieger 5638:
1.184 rillig 5639: 19.9. Sharing directories between packages
1.1 dsieger 5640:
1.184 rillig 5641: A "shared directory" is a directory where multiple (and unrelated) packages
5642: install files. These directories were problematic because you had to add
5643: special tricks in the PLIST to conditionally remove them, or have some
5644: centralized package handle them.
1.106 tnn 5645:
1.184 rillig 5646: In pkgsrc, it is now easy: Each package should create directories and install
5647: files as needed; pkg_delete will remove any directories left empty after
5648: uninstalling a package.
1.106 tnn 5649:
1.184 rillig 5650: If a package needs an empty directory to work, create the directory during
5651: installation as usual, and also add an entry to the PLIST:
1.1 dsieger 5652:
1.184 rillig 5653: @pkgdir path/to/empty/directory
1.1 dsieger 5654:
1.184 rillig 5655: or take a look at MAKE_DIRS and OWN_DIRS.
1.1 dsieger 5656:
1.184 rillig 5657: Chapter 20. The pkginstall framework
1.1 dsieger 5658:
1.184 rillig 5659: Table of Contents
1.1 dsieger 5660:
1.184 rillig 5661: 20.1. Files and directories outside the installation prefix
1.1 dsieger 5662:
1.184 rillig 5663: 20.1.1. Directory manipulation
5664: 20.1.2. File manipulation
1.1 dsieger 5665:
1.184 rillig 5666: 20.2. Configuration files
1.1 dsieger 5667:
1.184 rillig 5668: 20.2.1. How PKG_SYSCONFDIR is set
5669: 20.2.2. Telling the software where configuration files are
5670: 20.2.3. Patching installations
5671: 20.2.4. Disabling handling of configuration files
1.1 dsieger 5672:
1.184 rillig 5673: 20.3. System startup scripts
1.1 dsieger 5674:
1.184 rillig 5675: 20.3.1. Disabling handling of system startup scripts
1.1 dsieger 5676:
1.184 rillig 5677: 20.4. System users and groups
5678: 20.5. System shells
1.1 dsieger 5679:
1.184 rillig 5680: 20.5.1. Disabling shell registration
1.1 dsieger 5681:
1.184 rillig 5682: 20.6. Fonts
1.1 dsieger 5683:
1.184 rillig 5684: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 5685:
1.184 rillig 5686: This chapter describes the framework known as pkginstall, whose key features
5687: are:
1.1 dsieger 5688:
1.184 rillig 5689: * Generic installation and manipulation of directories and files outside the
5690: pkgsrc-handled tree, LOCALBASE.
1.1 dsieger 5691:
1.184 rillig 5692: * Automatic handling of configuration files during installation, provided
5693: that packages are correctly designed.
1.1 dsieger 5694:
1.184 rillig 5695: * Generation and installation of system startup scripts.
1.1 dsieger 5696:
1.184 rillig 5697: * Registration of system users and groups.
1.1 dsieger 5698:
1.184 rillig 5699: * Registration of system shells.
1.1 dsieger 5700:
1.184 rillig 5701: * Automatic updating of fonts databases.
1.1 dsieger 5702:
1.184 rillig 5703: The following sections inspect each of the above points in detail.
1.1 dsieger 5704:
1.184 rillig 5705: You may be thinking that many of the things described here could be easily done
5706: with simple code in the package's post-installation target (post-install). This
5707: is incorrect, as the code in them is only executed when building from source.
5708: Machines using binary packages could not benefit from it at all (as the code
5709: itself could be unavailable). Therefore, the only way to achieve any of the
5710: items described above is by means of the installation scripts, which are
5711: automatically generated by pkginstall.
1.1 dsieger 5712:
1.184 rillig 5713: 20.1. Files and directories outside the installation prefix
1.95 wiz 5714:
1.184 rillig 5715: As you already know, the PLIST file holds a list of files and directories that
5716: belong to a package. The names used in it are relative to the installation
5717: prefix (${PREFIX}), which means that it cannot register files outside this
5718: directory (absolute path names are not allowed). Despite this restriction, some
5719: packages need to install files outside this location; e.g., under ${VARBASE} or
5720: ${PKG_SYSCONFDIR}. The only way to achieve this is to create such files during
5721: installation time by using installation scripts.
1.95 wiz 5722:
1.184 rillig 5723: The generic installation scripts are shell scripts that can contain arbitrary
5724: code. The list of scripts to execute is taken from the INSTALL_FILE variable,
5725: which defaults to INSTALL. A similar variable exists for package removal
5726: (DEINSTALL_FILE, whose default is DEINSTALL). These scripts can run arbitrary
5727: commands, so they have the potential to create and manage files anywhere in the
5728: file system.
1.95 wiz 5729:
1.184 rillig 5730: Using these general installation files is not recommended, but may be needed in
5731: some special cases. One reason for avoiding them is that the user has to trust
5732: the packager that there is no unwanted or simply erroneous code included in the
5733: installation script. Also, previously there were many similar scripts for the
5734: same functionality, and fixing a common error involved finding and changing all
5735: of them.
1.95 wiz 5736:
1.184 rillig 5737: The pkginstall framework offers another, standardized way. It provides generic
5738: scripts to abstract the manipulation of such files and directories based on
5739: variables set in the package's Makefile. The rest of this section describes
5740: these variables.
1.1 dsieger 5741:
1.184 rillig 5742: 20.1.1. Directory manipulation
1.1 dsieger 5743:
1.184 rillig 5744: The following variables can be set to request the creation of directories
5745: anywhere in the file system:
1.1 dsieger 5746:
1.184 rillig 5747: * MAKE_DIRS and OWN_DIRS contain a list of directories that should be created
5748: and should attempt to be destroyed by the installation scripts. The
5749: difference between the two is that the latter prompts the administrator to
5750: remove any directories that may be left after deinstallation (because they
5751: were not empty), while the former does not. Example:
1.1 dsieger 5752:
1.184 rillig 5753: MAKE_DIRS+= ${VARBASE}/foo/private
1.1 dsieger 5754:
1.184 rillig 5755: * MAKE_DIRS_PERMS and OWN_DIRS_PERMS contain a list of tuples describing
5756: which directories should be created and should attempt to be destroyed by
5757: the installation scripts. Each tuple holds the following values, separated
5758: by spaces: the directory name, its owner, its group and its numerical mode.
5759: For example:
1.1 dsieger 5760:
1.184 rillig 5761: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private \
5762: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 5763:
1.184 rillig 5764: The difference between the two is exactly the same as their non-PERMS
5765: counterparts.
1.1 dsieger 5766:
1.184 rillig 5767: 20.1.2. File manipulation
1.1 dsieger 5768:
1.184 rillig 5769: Creating non-empty files outside the installation prefix is tricky because the
5770: PLIST forces all files to be inside it. To overcome this problem, the only
5771: solution is to extract the file in the known place (i.e., inside the
5772: installation prefix) and copy it to the appropriate location during
5773: installation (done by the installation scripts generated by pkginstall). We
5774: will call the former the master file in the following paragraphs, which
5775: describe the variables that can be used to automatically and consistently
5776: handle files outside the installation prefix:
1.1 dsieger 5777:
1.184 rillig 5778: * CONF_FILES and REQD_FILES are pairs of master and target files. During
5779: installation time, the master file is copied to the target one if and only
5780: if the latter does not exist. Upon deinstallation, the target file is
5781: removed provided that it was not modified by the installation.
1.1 dsieger 5782:
1.184 rillig 5783: The difference between the two is that the latter prompts the administrator
5784: to remove any files that may be left after deinstallation (because they
5785: were not empty), while the former does not.
1.1 dsieger 5786:
1.184 rillig 5787: * CONF_FILES_PERMS and REQD_FILES_PERMS contain tuples describing master
5788: files as well as their target locations. For each of them, it also
5789: specifies their owner, their group and their numeric permissions, in this
5790: order. For example:
1.1 dsieger 5791:
1.184 rillig 5792: REQD_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile \
5793: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 5794:
1.184 rillig 5795: The difference between the two is exactly the same as their non-PERMS
5796: counterparts.
1.1 dsieger 5797:
1.184 rillig 5798: 20.2. Configuration files
1.1 dsieger 5799:
1.184 rillig 5800: Configuration files are special in the sense that they are installed in their
5801: own specific directory, PKG_SYSCONFDIR, and need special treatment during
5802: installation (most of which is automated by pkginstall). The main concept you
5803: must bear in mind is that files marked as configuration files are automatically
5804: copied to the right place (somewhere inside PKG_SYSCONFDIR) during installation
5805: if and only if they didn't exist before. Similarly, they will not be removed if
5806: they have local modifications. This ensures that administrators never lose any
5807: custom changes they may have made.
1.1 dsieger 5808:
1.184 rillig 5809: 20.2.1. How PKG_SYSCONFDIR is set
1.1 dsieger 5810:
1.184 rillig 5811: As said before, the PKG_SYSCONFDIR variable specifies where configuration files
5812: shall be installed. Its contents are set based upon the following variables:
1.1 dsieger 5813:
1.184 rillig 5814: * PKG_SYSCONFBASE: The configuration's root directory. Defaults to ${PREFIX}/
5815: etc although it may be overridden by the user to point to his preferred
5816: location (e.g., /etc, /etc/pkg, etc.). Packages must not use it directly.
1.1 dsieger 5817:
1.184 rillig 5818: * PKG_SYSCONFSUBDIR: A subdirectory of PKG_SYSCONFBASE under which the
5819: configuration files for the package being built shall be installed. The
5820: definition of this variable only makes sense in the package's Makefile
5821: (i.e., it is not user-customizable).
1.1 dsieger 5822:
1.184 rillig 5823: As an example, consider the Apache package, www/apache24, which places its
5824: configuration files under the httpd/ subdirectory of PKG_SYSCONFBASE. This
5825: should be set in the package Makefile.
1.1 dsieger 5826:
1.184 rillig 5827: * PKG_SYSCONFVAR: Specifies the name of the variable that holds this
5828: package's configuration directory (if different from PKG_SYSCONFBASE). It
5829: defaults to PKGBASE's value, and is always prefixed with PKG_SYSCONFDIR.
1.1 dsieger 5830:
1.184 rillig 5831: * PKG_SYSCONFDIR.${PKG_SYSCONFVAR}: Holds the directory where the
5832: configuration files for the package identified by PKG_SYSCONFVAR's shall be
5833: placed.
1.1 dsieger 5834:
1.184 rillig 5835: Based on the above variables, pkginstall determines the value of
5836: PKG_SYSCONFDIR, which is the only variable that can be used within a package to
5837: refer to its configuration directory. The algorithm used to set its value is
5838: basically the following:
1.1 dsieger 5839:
1.184 rillig 5840: 1. If PKG_SYSCONFDIR.${PKG_SYSCONFVAR} is set, its value is used.
1.1 dsieger 5841:
1.184 rillig 5842: 2. If the previous variable is not defined but PKG_SYSCONFSUBDIR is set in the
5843: package's Makefile, the resulting value is ${PKG_SYSCONFBASE}/$
5844: {PKG_SYSCONFSUBDIR}.
1.1 dsieger 5845:
1.184 rillig 5846: 3. Otherwise, it is set to ${PKG_SYSCONFBASE}.
1.1 dsieger 5847:
1.184 rillig 5848: It is worth mentioning that ${PKG_SYSCONFDIR} is automatically added to
5849: OWN_DIRS. See Section 20.1.1, "Directory manipulation" what this means. This
5850: does not apply to subdirectories of ${PKG_SYSCONFDIR}, they still have to be
5851: created with OWN_DIRS or MAKE_DIRS.
1.1 dsieger 5852:
1.184 rillig 5853: 20.2.2. Telling the software where configuration files are
1.1 dsieger 5854:
1.184 rillig 5855: Given that pkgsrc (and users!) expect configuration files to be in a known
5856: place, you need to teach each package where it shall install its files. In some
5857: cases you will have to patch the package Makefiles to achieve it. If you are
5858: lucky, though, it may be as easy as passing an extra flag to the configuration
5859: script; this is the case of GNU Autoconf- generated files:
1.1 dsieger 5860:
1.184 rillig 5861: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.1 dsieger 5862:
1.184 rillig 5863: Note that this specifies where the package has to look for its configuration
5864: files, not where they will be originally installed (although the difference is
5865: never explicit, unfortunately).
1.1 dsieger 5866:
1.184 rillig 5867: 20.2.3. Patching installations
1.1 dsieger 5868:
1.184 rillig 5869: As said before, pkginstall automatically handles configuration files. This
5870: means that the packages themselves must not touch the contents of $
5871: {PKG_SYSCONFDIR} directly. Bad news is that many software installation scripts
5872: will, out of the box, mess with the contents of that directory. So what is the
5873: correct procedure to fix this issue?
1.1 dsieger 5874:
1.184 rillig 5875: You must teach the package (usually by manually patching it) to install any
5876: configuration files under the examples hierarchy, share/examples/${PKGBASE}/.
5877: This way, the PLIST registers them and the administrator always has the
5878: original copies available.
1.1 dsieger 5879:
1.184 rillig 5880: Once the required configuration files are in place (i.e., under the examples
5881: hierarchy), the pkginstall framework can use them as master copies during the
5882: package installation to update what is in ${PKG_SYSCONFDIR}. To achieve this,
5883: the variables CONF_FILES and CONF_FILES_PERMS are used. Check out
5884: Section 20.1.2, "File manipulation" for information about their syntax and
5885: their purpose. Here is an example, taken from the mail/mutt package:
1.1 dsieger 5886:
1.184 rillig 5887: EGDIR= ${PREFIX}/share/doc/mutt/samples
5888: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.1 dsieger 5889:
1.184 rillig 5890: Note that the EGDIR variable is specific to that package and has no meaning
5891: outside it.
1.1 dsieger 5892:
1.184 rillig 5893: 20.2.4. Disabling handling of configuration files
1.1 dsieger 5894:
1.184 rillig 5895: The automatic copying of config files can be toggled by setting the environment
5896: variable PKG_CONFIG prior to package installation.
1.1 dsieger 5897:
1.184 rillig 5898: 20.3. System startup scripts
1.1 dsieger 5899:
1.184 rillig 5900: System startup scripts are special files because they must be installed in a
5901: place known by the underlying OS, usually outside the installation prefix.
5902: Therefore, the same rules described in Section 20.1, "Files and directories
5903: outside the installation prefix" apply, and the same solutions can be used.
5904: However, pkginstall provides a special mechanism to handle these files.
1.1 dsieger 5905:
1.184 rillig 5906: In order to provide system startup scripts, the package has to:
1.1 dsieger 5907:
1.184 rillig 5908: 1. Store the script inside ${FILESDIR}, with the .sh suffix appended.
5909: Considering the print/cups package as an example, it has a cupsd.sh in its
5910: files directory.
1.95 wiz 5911:
1.184 rillig 5912: 2. Tell pkginstall to handle it, appending the name of the script, without its
5913: extension, to the RCD_SCRIPTS variable. Continuing the previous example:
1.95 wiz 5914:
1.184 rillig 5915: RCD_SCRIPTS+= cupsd
1.95 wiz 5916:
1.184 rillig 5917: Once this is done, pkginstall will do the following steps for each script in an
5918: automated fashion:
1.95 wiz 5919:
1.184 rillig 5920: 1. Process the file found in the files directory applying all the
5921: substitutions described in the FILES_SUBST variable.
1.1 dsieger 5922:
1.184 rillig 5923: 2. Copy the script from the files directory to the examples hierarchy, $
5924: {PREFIX}/share/examples/rc.d/. Note that this master file must be
5925: explicitly registered in the PLIST.
1.1 dsieger 5926:
1.184 rillig 5927: 3. Add code to the installation scripts to copy the startup script from the
5928: examples hierarchy into the system-wide startup scripts directory.
1.1 dsieger 5929:
1.184 rillig 5930: 20.3.1. Disabling handling of system startup scripts
1.1 dsieger 5931:
1.184 rillig 5932: The automatic copying of config files can be toggled by setting the environment
5933: variable PKG_RCD_SCRIPTS prior to package installation. Note that the scripts
5934: will be always copied inside the examples hierarchy, ${PREFIX}/share/examples/
5935: rc.d/, no matter what the value of this variable is.
1.1 dsieger 5936:
1.184 rillig 5937: 20.4. System users and groups
1.1 dsieger 5938:
1.184 rillig 5939: If a package needs to create special users and/or groups during installation,
5940: it can do so by using the pkginstall framework.
1.1 dsieger 5941:
1.184 rillig 5942: Users can be created by adding entries to the PKG_USERS variable. Each entry
5943: has the following syntax:
1.1 dsieger 5944:
1.184 rillig 5945: user:group
1.1 dsieger 5946:
1.184 rillig 5947: Further specification of user details may be done by setting per-user
5948: variables. PKG_UID.user is the numeric UID for the user. PKG_GECOS.user is the
5949: user's description or comment. PKG_HOME.user is the user's home directory, and
5950: defaults to /nonexistent if not specified. PKG_SHELL.user is the user's shell,
5951: and defaults to /sbin/nologin if not specified.
1.1 dsieger 5952:
1.184 rillig 5953: Similarly, groups can be created by adding entries to the PKG_GROUPS variable,
5954: whose syntax is:
1.1 dsieger 5955:
1.184 rillig 5956: group
1.1 dsieger 5957:
1.184 rillig 5958: The numeric GID of the group may be set by defining PKG_GID.group.
1.1 dsieger 5959:
1.184 rillig 5960: If a package needs to create the users and groups at an earlier stage, then it
5961: can set USERGROUP_PHASE to either configure,build, or pre-install to indicate
5962: the phase before which the users and groups are created. In this case, the
5963: numeric UIDs and GIDs of the created users and groups are automatically
5964: hardcoded into the final installation scripts.
1.1 dsieger 5965:
1.184 rillig 5966: 20.5. System shells
1.1 dsieger 5967:
1.184 rillig 5968: Packages that install system shells should register them in the shell database,
5969: /etc/shells, to make things easier to the administrator. This must be done from
5970: the installation scripts to keep binary packages working on any system.
5971: pkginstall provides an easy way to accomplish this task.
1.1 dsieger 5972:
1.184 rillig 5973: When a package provides a shell interpreter, it has to set the PKG_SHELL
5974: variable to its absolute file name. This will add some hooks to the
5975: installation scripts to handle it. Consider the following example, taken from
5976: shells/zsh:
1.1 dsieger 5977:
1.184 rillig 5978: PKG_SHELL= ${PREFIX}/bin/zsh
1.1 dsieger 5979:
1.184 rillig 5980: 20.5.1. Disabling shell registration
1.1 dsieger 5981:
1.184 rillig 5982: The automatic registration of shell interpreters can be disabled by the
5983: administrator by setting the PKG_REGISTER_SHELLS environment variable to NO.
1.1 dsieger 5984:
1.184 rillig 5985: 20.6. Fonts
1.1 dsieger 5986:
1.184 rillig 5987: Packages that install X11 fonts should update the database files that index the
5988: fonts within each fonts directory. This can easily be accomplished within the
5989: pkginstall framework.
1.1 dsieger 5990:
1.184 rillig 5991: When a package installs X11 fonts, it must list the directories in which fonts
5992: are installed in the FONTS_DIRS.type variables, where type can be one of "ttf",
5993: "type1" or "x11". This will add hooks to the installation scripts to run the
5994: appropriate commands to update the fonts database files within each of those
5995: directories. For convenience, if the directory path is relative, it is taken to
5996: be relative to the package's installation prefix. Consider the following
5997: example, taken from fonts/dbz-ttf:
1.1 dsieger 5998:
1.184 rillig 5999: FONTS_DIRS.ttf= ${PREFIX}/share/fonts/X11/TTF
1.1 dsieger 6000:
1.184 rillig 6001: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 6002:
1.184 rillig 6003: The automatic update of fonts databases can be disabled by the administrator by
6004: setting the PKG_UPDATE_FONTS_DB environment variable to NO.
1.1 dsieger 6005:
1.154 rillig 6006: Chapter 21. Making your package work
1.1 dsieger 6007:
6008: Table of Contents
6009:
1.154 rillig 6010: 21.1. General operation
1.1 dsieger 6011:
1.154 rillig 6012: 21.1.1. How to pull in user-settable variables from mk.conf
6013: 21.1.2. User interaction
6014: 21.1.3. Handling licenses
6015: 21.1.4. Restricted packages
6016: 21.1.5. Handling dependencies
6017: 21.1.6. Handling conflicts with other packages
6018: 21.1.7. Packages that cannot or should not be built
6019: 21.1.8. Packages which should not be deleted, once installed
6020: 21.1.9. Handling packages with security problems
6021: 21.1.10. How to handle incrementing versions when fixing an existing
1.1 dsieger 6022: package
1.154 rillig 6023: 21.1.11. Substituting variable text in the package files (the SUBST
1.1 dsieger 6024: framework)
6025:
1.154 rillig 6026: 21.2. The fetch phase
1.1 dsieger 6027:
1.154 rillig 6028: 21.2.1. Packages whose distfiles aren't available for plain downloading
6029: 21.2.2. How to handle modified distfiles with the 'old' name
6030: 21.2.3. Packages hosted on github.com
6031:
6032: 21.3. The configure phase
6033:
6034: 21.3.1. Shared libraries - libtool
6035: 21.3.2. Using libtool on GNU packages that already support libtool
6036: 21.3.3. GNU Autoconf/Automake
6037:
6038: 21.4. Programming languages
6039:
6040: 21.4.1. C, C++, and Fortran
6041: 21.4.2. Java
6042: 21.4.3. Packages containing perl scripts
6043: 21.4.4. Packages containing shell scripts
6044: 21.4.5. Other programming languages
6045:
6046: 21.5. The build phase
6047:
6048: 21.5.1. Compiling C and C++ code conditionally
6049: 21.5.2. How to handle compiler bugs
1.172 rillig 6050: 21.5.3. No such file or directory
6051: 21.5.4. Undefined reference to "..."
6052: 21.5.5. Running out of memory
1.154 rillig 6053:
6054: 21.6. The install phase
6055:
6056: 21.6.1. Creating needed directories
6057: 21.6.2. Where to install documentation
6058: 21.6.3. Installing highscore files
6059: 21.6.4. Adding DESTDIR support to packages
6060: 21.6.5. Packages with hardcoded paths to other interpreters
6061: 21.6.6. Packages installing perl modules
6062: 21.6.7. Packages installing info files
6063: 21.6.8. Packages installing man pages
6064: 21.6.9. Packages installing GConf data files
6065: 21.6.10. Packages installing scrollkeeper/rarian data files
6066: 21.6.11. Packages installing X11 fonts
6067: 21.6.12. Packages installing GTK2 modules
6068: 21.6.13. Packages installing SGML or XML data
6069: 21.6.14. Packages installing extensions to the MIME database
6070: 21.6.15. Packages using intltool
6071: 21.6.16. Packages installing startup scripts
6072: 21.6.17. Packages installing TeX modules
6073: 21.6.18. Packages supporting running binaries in emulation
6074: 21.6.19. Packages installing hicolor theme icons
6075: 21.6.20. Packages installing desktop files
1.1 dsieger 6076:
1.154 rillig 6077: 21.7. Marking packages as having problems
1.1 dsieger 6078:
1.154 rillig 6079: 21.1. General operation
1.1 dsieger 6080:
6081: One appealing feature of pkgsrc is that it runs on many different platforms. As
6082: a result, it is important to ensure, where possible, that packages in pkgsrc
6083: are portable. This chapter mentions some particular details you should pay
6084: attention to while working on pkgsrc.
6085:
1.154 rillig 6086: 21.1.1. How to pull in user-settable variables from mk.conf
1.1 dsieger 6087:
6088: The pkgsrc user can configure pkgsrc by overriding several variables in the
1.4 rillig 6089: file pointed to by MAKECONF, which is mk.conf by default. When you want to use
6090: those variables in the preprocessor directives of make(1) (for example .if or
6091: .for), you need to include the file ../../mk/bsd.prefs.mk before, which in turn
6092: loads the user preferences.
1.1 dsieger 6093:
6094: But note that some variables may not be completely defined after ../../mk/
6095: bsd.prefs.mk has been included, as they may contain references to variables
1.108 rillig 6096: that are not yet defined. In shell commands (the lines in Makefile that are
6097: indented with a tab) this is no problem, since variables are only expanded when
6098: they are used. But in the preprocessor directives mentioned above and in
6099: dependency lines (of the form target: dependencies) the variables are expanded
6100: at load time.
1.1 dsieger 6101:
6102: Note
6103:
1.108 rillig 6104: To check whether a variable can be used at load time, run pkglint -Wall on your
6105: package.
1.1 dsieger 6106:
1.154 rillig 6107: 21.1.2. User interaction
1.1 dsieger 6108:
6109: Occasionally, packages require interaction from the user, and this can be in a
6110: number of ways:
6111:
6112: * When fetching the distfiles, some packages require user interaction such as
6113: entering username/password or accepting a license on a web page.
6114:
6115: * When extracting the distfiles, some packages may ask for passwords.
6116:
6117: * help to configure the package before it is built
6118:
6119: * help during the build process
6120:
6121: * help during the installation of a package
6122:
1.108 rillig 6123: A package can set the INTERACTIVE_STAGE variable to define which stages need
6124: interaction. This should be done in the package's Makefile, e.g.:
1.1 dsieger 6125:
6126: INTERACTIVE_STAGE= configure install
6127:
6128: The user can then decide to skip this package by setting the BATCH variable.
1.108 rillig 6129: Packages that require interaction are also excluded from bulk builds.
1.1 dsieger 6130:
1.154 rillig 6131: 21.1.3. Handling licenses
1.1 dsieger 6132:
6133: Authors of software can choose the licence under which software can be copied.
1.111 sevan 6134: The Free Software Foundation has declared some licenses "Free", and the Open
6135: Source Initiative has a definition of "Open Source".
6136:
6137: By default, pkgsrc allows packages with Free or Open Source licenses to be
6138: built. To allow packages with other licenses to be built as well, the pkgsrc
6139: user needs to add these licenses to the ACCEPTABLE_LICENSES variable in mk.conf
6140: . Note that this variable only affects which packages may be built, while the
6141: license terms often also restrict the actual use of the package and its
6142: redistribution.
1.1 dsieger 6143:
6144: One might want to only install packages with a BSD license, or the GPL, and not
1.20 jnemeth 6145: the other. The free licenses are added to the default ACCEPTABLE_LICENSES
1.111 sevan 6146: variable. The pkgsrc user can override the default by setting the
6147: ACCEPTABLE_LICENSES variable with "=" instead of "+=". The licenses accepted by
6148: default are defined in the DEFAULT_ACCEPTABLE_LICENSES variable in the file
6149: pkgsrc/mk/license.mk.
1.1 dsieger 6150:
6151: The license tag mechanism is intended to address copyright-related issues
6152: surrounding building, installing and using a package, and not to address
1.20 jnemeth 6153: redistribution issues (see RESTRICTED and NO_SRC_ON_FTP, etc.). Packages with
6154: redistribution restrictions should set these tags.
1.1 dsieger 6155:
6156: Denoting that a package may be copied according to a particular license is done
6157: by placing the license in pkgsrc/licenses and setting the LICENSE variable to a
6158: string identifying the license, e.g. in graphics/xv:
6159:
6160: LICENSE= xv-license
6161:
6162: When trying to build, the user will get a notice that the package is covered by
6163: a license which has not been placed in the ACCEPTABLE_LICENSES variable:
6164:
6165: % make
6166: ===> xv-3.10anb9 has an unacceptable license: xv-license.
6167: ===> To view the license, enter "/usr/bin/make show-license".
6168: ===> To indicate acceptance, add this line to your /etc/mk.conf:
6169: ===> ACCEPTABLE_LICENSES+=xv-license
6170: *** Error code 1
6171:
6172: The license can be viewed with make show-license, and if the user so chooses,
1.4 rillig 6173: the line printed above can be added to mk.conf to convey to pkgsrc that it
1.1 dsieger 6174: should not in the future fail because of that license:
6175:
6176: ACCEPTABLE_LICENSES+=xv-license
6177:
1.111 sevan 6178: The use of LICENSE=shareware, LICENSE=no-commercial-use, and similar language
6179: is deprecated because it does not crisply refer to a particular license text.
6180: Another problem with such usage is that it does not enable a user to tell
6181: pkgsrc to proceed for a single package without also telling pkgsrc to proceed
6182: for all packages with that tag.
6183:
1.154 rillig 6184: 21.1.3.1. Adding a package with a new license
1.1 dsieger 6185:
1.49 rodent 6186: When adding a package with a new license, the following steps are required:
6187:
1.111 sevan 6188: 1. Check whether the license qualifies as Free or Open Source by referencing
6189: Various Licenses and Comments about Them and Licenses by Name | Open Source
6190: Initiative. If this is the case, the filename in pkgsrc/licenses/ does not
6191: need the -license suffix, and the license name should be added to:
1.49 rodent 6192:
6193: + DEFAULT_ACCEPTABLE_LICENSES in pkgsrc/mk/license.mk
6194:
6195: + default_acceptable_licenses in pkgsrc/pkgtools/pkg_install/files/lib/
6196: license.c
6197:
6198: 2. The license text should be added to pkgsrc/licenses for displaying. A list
6199: of known licenses can be seen in this directory.
1.1 dsieger 6200:
1.154 rillig 6201: 21.1.3.2. Change to the license
1.1 dsieger 6202:
1.111 sevan 6203: When the license changes (in a way other than formatting), make sure that the
6204: new license has a different name (e.g., append the version number if it exists,
6205: or the date). Just because a user told pkgsrc to build programs under a
6206: previous version of a license does not mean that pkgsrc should build programs
6207: under the new licenses. The higher-level point is that pkgsrc does not evaluate
6208: licenses for reasonableness; the only test is a mechanistic test of whether a
6209: particular text has been approved by either of two bodies (FSF or OSI).
1.1 dsieger 6210:
1.154 rillig 6211: 21.1.4. Restricted packages
1.1 dsieger 6212:
1.111 sevan 6213: Some licenses restrict how software may be re-distributed. By declaring the
6214: restrictions, package tools can automatically refrain from e.g. placing binary
6215: packages on FTP sites.
6216:
6217: There are four possible restrictions, which are the cross product of sources
6218: (distfiles) and binaries not being placed on FTP sites and CD-ROMs. Because
6219: this is rarely the exact language in any license, and because non-Free licenses
6220: tend to be different from each other, pkgsrc adopts a definition of FTP and
6221: CD-ROM. "FTP" means making the source or binary file available over the
6222: Internet at no charge. "CD-ROM" means making the source or binary available on
6223: some kind of media, together with other source and binary packages, which is
6224: sold for a distribution charge.
1.1 dsieger 6225:
6226: In order to encode these restrictions, the package system defines five make
6227: variables that can be set to note these restrictions:
6228:
6229: * RESTRICTED
6230:
6231: This variable should be set whenever a restriction exists (regardless of
6232: its kind). Set this variable to a string containing the reason for the
6233: restriction. It should be understood that those wanting to understand the
6234: restriction will have to read the license, and perhaps seek advice of
6235: counsel.
6236:
6237: * NO_BIN_ON_CDROM
6238:
6239: Binaries may not be placed on CD-ROM containing other binary packages, for
6240: which a distribution charge may be made. In this case, set this variable to
6241: ${RESTRICTED}.
6242:
6243: * NO_BIN_ON_FTP
6244:
6245: Binaries may not made available on the Internet without charge. In this
6246: case, set this variable to ${RESTRICTED}. If this variable is set, binary
6247: packages will not be included on ftp.NetBSD.org.
6248:
6249: * NO_SRC_ON_CDROM
6250:
6251: Distfiles may not be placed on CD-ROM, together with other distfiles, for
6252: which a fee may be charged. In this case, set this variable to $
6253: {RESTRICTED}.
6254:
6255: * NO_SRC_ON_FTP
6256:
6257: Distfiles may not made available via FTP at no charge. In this case, set
6258: this variable to ${RESTRICTED}. If this variable is set, the distfile(s)
6259: will not be mirrored on ftp.NetBSD.org.
6260:
1.111 sevan 6261: Please note that packages will be removed from pkgsrc when the distfiles are
1.33 wiz 6262: not distributable and cannot be obtained for a period of one full quarter
1.111 sevan 6263: branch. Packages with manual/interactive fetch must have a maintainer and it is
6264: his/her responsibility to ensure this.
1.33 wiz 6265:
1.154 rillig 6266: 21.1.5. Handling dependencies
1.1 dsieger 6267:
1.175 gutterid 6268: Your package may depend on some other package being present, and there are
6269: various ways of expressing this dependency. pkgsrc supports the DEPENDS,
6270: BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS definitions, the USE_TOOLS
6271: definition, as well as dependencies via buildlink3.mk, which is the preferred
6272: way to handle dependencies, and which uses the variables named above. See
1.184 rillig 6273: Chapter 18, Buildlink methodology for more information.
1.175 gutterid 6274:
6275: The basic difference is that the DEPENDS definition registers that
6276: pre-requisite in the binary package so it will be pulled in when the binary
6277: package is later installed, whilst the BUILD_DEPENDS, TOOL_DEPENDS, and
6278: TEST_DEPENDS definitions do not, marking a dependency that is only needed for
1.184 rillig 6279: building or testing the resulting package. See also Chapter 14, Creating a new
1.175 gutterid 6280: pkgsrc package from scratch for more information.
6281:
6282: This means that if you only need a package present whilst you are building or
6283: testing, it should be noted as a TOOL_DEPENDS, BUILD_DEPENDS, or TEST_DEPENDS.
6284: When cross-compiling, TOOL_DEPENDS are native packages, i.e. packages for the
6285: architecture where the package is built; BUILD_DEPENDS are target packages,
6286: i.e., packages for the architecture for which the package is built.
1.1 dsieger 6287:
1.175 gutterid 6288: The format for a DEPENDS, BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS
6289: definition is:
1.1 dsieger 6290:
6291: <pre-req-package-name>:../../<category>/<pre-req-package>
6292:
6293: Please note that the "pre-req-package-name" may include any of the wildcard
6294: version numbers recognized by pkg_info(1).
6295:
1.55 wiz 6296: 1. If your package needs another package's binaries or libraries to build and
1.1 dsieger 6297: run, and if that package has a buildlink3.mk file available, use it:
6298:
6299: .include "../../graphics/jpeg/buildlink3.mk"
6300:
1.55 wiz 6301: 2. If your package needs another package's binaries or libraries only for
6302: building, and if that package has a buildlink3.mk file available, use it:
6303:
6304: .include "../../graphics/jpeg/buildlink3.mk"
6305:
6306: but set BUILDLINK_DEPMETHOD.jpeg?=build to make it a build dependency only.
6307: This case is rather rare.
6308:
6309: 3. If your package needs binaries from another package to build, use the
1.156 leot 6310: TOOL_DEPENDS definition:
6311:
6312: TOOL_DEPENDS+= itstool-[0-9]*:../../textproc/itstool
1.1 dsieger 6313:
1.156 leot 6314: 4. If your package needs static libraries to link against, header files to
6315: include, etc. from another package to build, use the BUILD_DEPENDS
6316: definition.
1.1 dsieger 6317:
1.156 leot 6318: 5. If your package needs a library with which to link and there is no
1.26 spz 6319: buildlink3.mk file available, create one. Using DEPENDS won't be sufficient
6320: because the include files and libraries will be hidden from the compiler.
1.1 dsieger 6321:
1.156 leot 6322: 6. If your package needs some executable to be able to run correctly and if
1.26 spz 6323: there's no buildlink3.mk file, this is specified using the DEPENDS
6324: variable. The print/lyx package needs to be able to execute the latex
1.129 wiz 6325: binary from the tex-latex-bin package when it runs, and that is specified:
1.1 dsieger 6326:
1.129 wiz 6327: DEPENDS+= tex-latex-bin-[0-9]*:../../print/tex-latex-bin
1.1 dsieger 6328:
1.175 gutterid 6329: 7. If your package includes a test suite that has extra dependencies only
6330: required for this purpose (frequently this can be run as a "make test"
6331: target), use the TEST_DEPENDS variable.
6332:
6333: 8. You can use wildcards in package dependencies. Note that such wildcard
1.26 spz 6334: dependencies are retained when creating binary packages. The dependency is
6335: checked when installing the binary package and any package which matches
6336: the pattern will be used. Wildcard dependencies should be used with care.
1.1 dsieger 6337:
6338: The "-[0-9]*" should be used instead of "-*" to avoid potentially ambiguous
6339: matches such as "tk-postgresql" matching a "tk-*" DEPENDS.
6340:
6341: Wildcards can also be used to specify that a package will only build
6342: against a certain minimum version of a pre-requisite:
6343:
1.26 spz 6344: DEPENDS+= ImageMagick>=6.0:../../graphics/ImageMagick
1.1 dsieger 6345:
1.26 spz 6346: This means that the package will build using version 6.0 of ImageMagick or
6347: newer. Such a dependency may be warranted if, for example, the command line
6348: options of an executable have changed.
6349:
1.183 wiz 6350: If you need to depend on minimum versions of libraries, set
6351: BUILDLINK_API_DEPENDS.pkg to the appropriate pattern before including its
6352: buildlink3.mk file, e.g.
6353:
6354: BUILDLINK_API_DEPENDS.jpeg+= jpeg>=9.0
6355: .include "../../graphics/jpeg/buildlink3.mk"
1.1 dsieger 6356:
6357: For security fixes, please update the package vulnerabilities file. See
1.154 rillig 6358: Section 21.1.9, "Handling packages with security problems" for more
1.1 dsieger 6359: information.
6360:
6361: If your package needs files from another package to build, add the relevant
6362: distribution files to DISTFILES, so they will be extracted automatically. See
6363: the print/ghostscript package for an example. (It relies on the jpeg sources
6364: being present in source form during the build.)
6365:
1.154 rillig 6366: 21.1.6. Handling conflicts with other packages
1.1 dsieger 6367:
6368: Your package may conflict with other packages a user might already have
6369: installed on his system, e.g. if your package installs the same set of files as
1.80 wiz 6370: another package in the pkgsrc tree or has the same PKGNAME.
1.1 dsieger 6371:
1.142 leot 6372: For example, x11/libXaw3d and x11/Xaw-Xpm install the same shared library, thus
6373: you set in pkgsrc/x11/libXaw3d/Makefile:
1.1 dsieger 6374:
1.142 leot 6375: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 dsieger 6376:
6377:
1.142 leot 6378: and in pkgsrc/x11/Xaw-Xpm/Makefile:
1.1 dsieger 6379:
1.142 leot 6380: CONFLICTS= libXaw3d-[0-9]*
1.1 dsieger 6381:
1.142 leot 6382:
6383: pkg_add(1) is able to detect attempts to install packages that conflict with
6384: existing packages and abort. However, in many situations this is too late in
6385: the process. Binary package managers will not know about the conflict until
6386: they attempt to install the package after already downloading it and all its
6387: dependencies. Users may also waste time building a package and its dependencies
6388: only to find out at the end that it conflicts with another package they have
6389: installed.
6390:
6391: To avoid these issues CONFLICTS entries should be added in all cases where it
6392: is known that packages conflict with each other. These CONFLICTS entries are
6393: exported in pkg_summary(5) files and consumed by binary package managers to
6394: inform users that packages cannot be installed onto the target system.
1.1 dsieger 6395:
1.154 rillig 6396: 21.1.7. Packages that cannot or should not be built
1.1 dsieger 6397:
6398: There are several reasons why a package might be instructed to not build under
6399: certain circumstances. If the package builds and runs on most platforms, the
1.83 dholland 6400: exceptions should be noted with BROKEN_ON_PLATFORM. If the package builds and
6401: runs on a small handful of platforms, set BROKEN_EXCEPT_ON_PLATFORM instead.
6402: Both BROKEN_ON_PLATFORM and BROKEN_EXCEPT_ON_PLATFORM are OS triples
6403: (OS-version-platform) that can use glob-style wildcards.
6404:
1.114 maya 6405: If a package is not appropriate for some platforms (as opposed to merely
1.83 dholland 6406: broken), a different set of variables should be used as this affects failure
6407: reporting and statistics. If the package is appropriate for most platforms, the
6408: exceptions should be noted with NOT_FOR_PLATFORM. If the package is appropriate
6409: for only a small handful of platforms (often exactly one), set
6410: ONLY_FOR_PLATFORM instead. Both ONLY_FOR_PLATFORM and NOT_FOR_PLATFORM are OS
6411: triples (OS-version-platform) that can use glob-style wildcards.
1.1 dsieger 6412:
6413: Some packages are tightly bound to a specific version of an operating system,
6414: e.g. LKMs or sysutils/lsof. Such binary packages are not backwards compatible
6415: with other versions of the OS, and should be uploaded to a version specific
6416: directory on the FTP server. Mark these packages by setting OSVERSION_SPECIFIC
6417: to "yes". This variable is not currently used by any of the package system
6418: internals, but may be used in the future.
6419:
6420: If the package should be skipped (for example, because it provides
6421: functionality already provided by the system), set PKG_SKIP_REASON to a
6422: descriptive message. If the package should fail because some preconditions are
6423: not met, set PKG_FAIL_REASON to a descriptive message.
6424:
1.154 rillig 6425: 21.1.8. Packages which should not be deleted, once installed
1.1 dsieger 6426:
6427: To ensure that a package may not be deleted, once it has been installed, the
6428: PKG_PRESERVE definition should be set in the package Makefile. This will be
1.25 wiz 6429: carried into any binary package that is made from this pkgsrc entry. A "
6430: preserved" package will not be deleted using pkg_delete(1) unless the "-f"
1.1 dsieger 6431: option is used.
6432:
1.154 rillig 6433: 21.1.9. Handling packages with security problems
1.1 dsieger 6434:
6435: When a vulnerability is found, this should be noted in localsrc/security/
1.32 wiz 6436: advisories/pkg-vulnerabilities, and after committing that file, ask
6437: pkgsrc-security@NetBSD.org to update the file on ftp.NetBSD.org.
1.1 dsieger 6438:
6439: After fixing the vulnerability by a patch, its PKGREVISION should be increased
6440: (this is of course not necessary if the problem is fixed by using a newer
1.32 wiz 6441: release of the software), and the pattern in the pkg-vulnerabilities file must
6442: be updated.
1.1 dsieger 6443:
6444: Also, if the fix should be applied to the stable pkgsrc branch, be sure to
6445: submit a pullup request!
6446:
6447: Binary packages already on ftp.NetBSD.org will be handled semi-automatically by
6448: a weekly cron job.
6449:
1.154 rillig 6450: 21.1.10. How to handle incrementing versions when fixing an existing package
1.1 dsieger 6451:
6452: When making fixes to an existing package it can be useful to change the version
6453: number in PKGNAME. To avoid conflicting with future versions by the original
6454: author, a "nb1", "nb2", ... suffix can be used on package versions by setting
6455: PKGREVISION=1 (2, ...). The "nb" is treated like a "." by the package tools.
6456: e.g.
6457:
6458: DISTNAME= foo-17.42
6459: PKGREVISION= 9
6460:
6461: will result in a PKGNAME of "foo-17.42nb9". If you want to use the original
6462: value of PKGNAME without the "nbX" suffix, e.g. for setting DIST_SUBDIR, use
6463: PKGNAME_NOREV.
6464:
6465: When a new release of the package is released, the PKGREVISION should be
6466: removed, e.g. on a new minor release of the above package, things should be
6467: like:
6468:
6469: DISTNAME= foo-17.43
6470:
6471: PKGREVISION should be incremented for any non-trivial change in the resulting
6472: binary package. Without a PKGREVISION bump, someone with the previous version
6473: installed has no way of knowing that their package is out of date. Thus,
6474: changes without increasing PKGREVISION are essentially labeled "this is so
6475: trivial that no reasonable person would want to upgrade", and this is the rough
6476: test for when increasing PKGREVISION is appropriate. Examples of changes that
6477: do not merit increasing PKGREVISION are:
6478:
1.14 jmcneill 6479: * Changing HOMEPAGE, MAINTAINER, OWNER, or comments in Makefile.
1.1 dsieger 6480:
6481: * Changing build variables if the resulting binary package is the same.
6482:
6483: * Changing DESCR.
6484:
6485: * Adding PKG_OPTIONS if the default options don't change.
6486:
6487: Examples of changes that do merit an increase to PKGREVISION include:
6488:
6489: * Security fixes
6490:
6491: * Changes or additions to a patch file
6492:
6493: * Changes to the PLIST
6494:
1.12 weinem 6495: * A dependency is changed or renamed.
6496:
1.1 dsieger 6497: PKGREVISION must also be incremented when dependencies have ABI changes.
6498:
1.154 rillig 6499: 21.1.11. Substituting variable text in the package files (the SUBST framework)
1.1 dsieger 6500:
1.180 rillig 6501: When you want to replace the same text in multiple files, or multiple times in
6502: the same file, it is cumbersome to maintain a patch file for this. This is
6503: where the SUBST framework steps in. It provides an easy-to-use interface for
6504: replacing text in files. It just needs the following information:
1.172 rillig 6505:
1.180 rillig 6506: * In which phase of the package build cycle should the replacement happen?
1.172 rillig 6507:
1.180 rillig 6508: * In which files should the replacement happen?
1.172 rillig 6509:
6510: * Which text should be replaced with what?
6511:
1.180 rillig 6512: This information is encoded in a block of SUBST variables. A minimal example
6513: is:
6514:
6515: SUBST_CLASSES+= paths
6516: SUBST_STAGE.paths= pre-configure
6517: SUBST_FILES.paths= src/*.c
6518: SUBST_SED.paths= -e 's,/usr/local,${PREFIX},g'
6519:
6520: Translated into English, it means: In the pre-configure stage (that is, after
6521: applying the patches from the patches/ directory and before running the
6522: configure script and the portability check), replace the text /usr/local with
6523: the content of the variable PREFIX.
6524:
6525: Each SUBST block starts by appending an identifier to SUBST_CLASSES (note the +
6526: =). This identifier can be chosen freely by the package. If there should ever
6527: be duplicate identifiers, the pkgsrc infrastructure will catch this and fail
6528: early, so don't worry about name collisions.
6529:
6530: Except for SUBST_CLASSES, all variables in a SUBST block are parameterized
6531: using this identifier. In the remainder of this section, these parameterized
6532: variables are written as SUBST_STAGE.*.
6533:
6534: SUBST_CLASSES+= paths
6535: SUBST_STAGE.paths= pre-configure
6536: SUBST_MESSAGE.paths= Fixing absolute paths.
6537: SUBST_FILES.paths= src/*.c
6538: SUBST_FILES.paths+= scripts/*.sh
6539: SUBST_SED.paths= -e 's,"/usr/local,"${PREFIX},g'
6540: SUBST_SED.paths+= -e 's,"/var/log,"${VARBASE}/log,g'
6541: SUBST_VARS.paths= LOCALBASE PREFIX PKGVERSION
6542:
6543: To get a complete picture about the SUBST substitutions, run bmake
6544: show-all-subst. If something doesn't work as expected, run pkglint on the
6545: package, which detects several typical mistakes surrounding the SUBST blocks.
6546: For any questions that might remain after this, have a look at mk/subst.mk.
6547:
6548: 21.1.11.1. Choosing the time where the substitutions happen
6549:
6550: The SUBST_STAGE.* is one of {pre,do,post}-
6551: {extract,patch,configure,build,test,install}. Of these, pre-configure is used
6552: most often, by far. The most popular stages are, in chronological order:
6553:
6554: post-extract
6555:
6556: The substitutions are applied immediately after the distfiles are
6557: extracted. Running bmake extract on the package will leave no traces of the
6558: original files.
6559:
6560: When the substitution applies to files for which there is also a patch in
6561: the patches/ directory, this means that the patches will be computed based
6562: on the result of the substitution. When these patches are sent to the
6563: upstream maintainer later, to be fixed in the upstream package, these
6564: patches may no longer match what the upstream author is used to. Because of
6565: this, pre-configure is often a better choice.
6566:
6567: pre-configure
6568:
6569: The substitutions are applied after the patches from the patches/
6570: directory. This makes it possible to run bmake patch on the package, after
6571: which the patches can be edited using the tools pkgvi and mkpatches from
6572: the pkgtools/pkgdiff package.
6573:
6574: When updating the patches, it is helpful to explicitly separate the bmake
6575: patch from the bmake configure, and to only edit the patches between these
6576: commands. Otherwise the substitutions from the SUBST block will end up in
6577: the patch file. When this happens in really obvious ways, pkglint will
6578: complain about patches that contain a hard-coded /usr/pkg instead of the
6579: correct and intended @PREFIX@, but it can only detect these really obvious
6580: cases.
6581:
6582: do-configure
6583:
6584: This stage should only be used if the package defines a pre-configure
6585: action itself, and the substitution must happen after that. Typical
6586: examples are packages that use the pre-configure stage to regenerate the
6587: GNU configure script from configure.ac.
6588:
6589: post-configure
6590:
6591: This stage is used to fix up any mistakes by the configure stage.
6592:
6593: pre-build
6594:
6595: This stage should only be used for substitutions that are clearly related
6596: to building the package, not for fixing the configuration. Substitutions
6597: for pathnames (such as replacing /usr/local with ${PREFIX}) or user names
6598: (such as replacing @MY_USER@ with the actual username) belong in
6599: pre-configure or post-configure instead.
6600:
6601: post-build
6602:
6603: Just as with pre-build, this stage should only be used for substitutions
6604: that are clearly related to building the package, not for fixing the
6605: configuration. Substitutions for pathnames (such as replacing /usr/local
6606: with ${PREFIX}) or user names (such as replacing @MY_USER@ with the actual
6607: username) belong in pre-configure or post-configure instead.
6608:
6609: A typical use is to update pkg-config files to include the rpath compiler
6610: options.
6611:
6612: pre-install
6613:
6614: In general, the install phase should be as simple as possible. As with the
6615: pre-build and post-build stages, it should not be used to fix pathnames or
6616: user names, these belong in pre-configure instead. There are only few
6617: legitimate use cases for applying substitutions in this stage.
6618:
1.181 rillig 6619: 21.1.11.2. Choosing the files where the substitutions happen
1.180 rillig 6620:
6621: The SUBST_FILES.* variable contains a list of filename patterns. These patterns
6622: are relative to WRKSRC since that is where most substitutions happen. A typical
6623: example is:
6624:
6625: SUBST_FILES.path= Makefile */Makefile */*/Makefile *.[ch]
6626:
6627: The above patterns, especially the last, are quite broad. The SUBST
6628: implementation checks that each filename pattern that is mentioned here has an
6629: effect. For example, if none of the */*/Makefile files contains the patterns to
6630: be found and substituted, that filename pattern is redundant and should be left
1.181 rillig 6631: out. By default, the SUBST framework will complain with an error message. If
6632: the text to be substituted occurs in some of the files from a single pattern,
6633: but not in all of them, that is totally ok, and the SUBST framework will only
6634: print an INFO message for those files.
1.180 rillig 6635:
6636: If there is a good reason for having redundant filename patterns, set
1.181 rillig 6637: SUBST_NOOP_OK.* to yes.
1.180 rillig 6638:
6639: Another popular way of choosing the files for the substitutions is via a shell
6640: command, like this:
6641:
1.181 rillig 6642: C_FILES_CMD= cd ${WRKSRC} && ${FIND} . -name '*.c'
1.180 rillig 6643: SUBST_FILES.path= ${C_FILES_CMD:sh}
6644:
6645: The variable name C_FILES_CMD in this example is freely chosen and independent
6646: of the SUBST framework.
6647:
6648: In this variant, the SUBST_FILES.* variable lists each file individually.
6649: Thereby chances are higher that there are filename patterns in which no
6650: substitution happens. Since the SUBST framework cannot know whether the
6651: filename patterns in SUBST_FILES.* have been explicitly listed in the Makefile
6652: (where any redundant filename pattern would be suspicious) or been generated by
6653: a shell command (in which redundant filename patterns are more likely and to be
6654: expected), it will complain about these redundant filename patterns. Therefore,
6655: SUBST blocks that use a shell command to generate the list of filename patterns
6656: often need to set SUBST_NOOP_OK.* to yes.
6657:
6658: 21.1.11.3. Choosing what to substitute
6659:
6660: In most cases, the substitutions are given using one or more sed(1) commands,
6661: like this:
6662:
6663: SUBST_SED.path= -e 's|/usr/local|${PREFIX}|g'
6664:
6665: Each of the sed commands needs to be preceded by the -e option and should be
6666: specified on a line of its own, to avoid hiding short sed commands at the end
6667: of a line.
6668:
6669: Since the sed commands often contain shell metacharacters as the separator (the
6670: | in the above example), it is common to enclose them in single quotes.
6671:
6672: A common substitution is to replace placeholders of the form @VARNAME@ with
6673: their pkgsrc counterpart variable ${VARNAME}. A typical example is:
6674:
6675: SUBST_VARS.path= PREFIX
6676:
1.181 rillig 6677: This type of substitutions is typically done by the GNU configure scripts
6678: during the do-configure stage, but in some cases these need to be overridden.
6679: The same pattern is also used when a package defines patches that replace
6680: previously hard-coded paths like /usr/local with a @PREFIX@ placeholder first,
6681: which then gets substituted by the actual ${PREFIX} in the pre-configure stage.
6682: In many of these cases, it works equally well to just use the SUBST framework
6683: to directly replace /usr/local with ${PREFIX}, thereby omitting the
6684: intermediate patch file.
1.180 rillig 6685:
6686: If the above is not flexible enough, it is possible to not use sed at all for
6687: the substitution but to specify an entirely different command, like this:
6688:
6689: SUBST_FILTER_CMD.path= LC_ALL=C ${TR} -d '\r'
1.1 dsieger 6690:
1.180 rillig 6691: This is used for the few remaining packages in which the distributed files use
6692: Windows-style line endings that need to be converted to UNIX-style line
6693: endings.
1.1 dsieger 6694:
1.180 rillig 6695: 21.1.11.4. Other SUBST variables
1.172 rillig 6696:
1.180 rillig 6697: When a SUBST block is applied during a package build, a message is logged. The
6698: default message is fine for most purposes but can be overridden by setting
6699: SUBST_MESSAGE.* to an individual message.
1.1 dsieger 6700:
1.154 rillig 6701: 21.2. The fetch phase
1.1 dsieger 6702:
1.154 rillig 6703: 21.2.1. Packages whose distfiles aren't available for plain downloading
1.1 dsieger 6704:
6705: If you need to download from a dynamic URL you can set DYNAMIC_MASTER_SITES and
6706: a make fetch will call files/getsite.sh with the name of each file to download
6707: as an argument, expecting it to output the URL of the directory from which to
6708: download it. graphics/ns-cult3d is an example of this usage.
6709:
6710: If the download can't be automated, because the user must submit personal
6711: information to apply for a password, or must pay for the source, or whatever,
6712: you can set FETCH_MESSAGE to a list of lines that are displayed to the user
6713: before aborting the build. Example:
6714:
6715: FETCH_MESSAGE= "Please download the files"
6716: FETCH_MESSAGE+= " "${DISTFILES:Q}
6717: FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"."
6718:
1.154 rillig 6719: 21.2.2. How to handle modified distfiles with the 'old' name
1.1 dsieger 6720:
6721: Sometimes authors of a software package make some modifications after the
6722: software was released, and they put up a new distfile without changing the
6723: package's version number. If a package is already in pkgsrc at that time, the
6724: checksum will no longer match. The contents of the new distfile should be
6725: compared against the old one before changing anything, to make sure the
6726: distfile was really updated on purpose, and that no trojan horse or so crept
6727: in. Please mention that the distfiles were compared and what was found in your
1.54 rodent 6728: commit message.
6729:
6730: Then, the correct way to work around this is to set DIST_SUBDIR to a unique
1.109 wiz 6731: directory name, usually based on PKGNAME_NOREV (but take care with python or
6732: ruby packages, where PKGNAME includes a variable prefix). All DISTFILES and
6733: PATCHFILES for this package will be put in that subdirectory of the local
1.154 rillig 6734: distfiles directory. (See Section 21.1.10, "How to handle incrementing versions
1.109 wiz 6735: when fixing an existing package" for more details.) In case this happens more
6736: often, PKGNAME can be used (thus including the nbX suffix) or a date stamp can
6737: be appended, like ${PKGNAME_NOREV}-YYYYMMDD.
1.54 rodent 6738:
6739: DIST_SUBDIR is also used when a distfile's name does not contain a version and
6740: the distfile is apt to change. In cases where the likelihood of this is very
6741: small, DIST_SUBDIR might not be required. Additionally, DIST_SUBDIR must not be
6742: removed unless the distfile name changes, even if a package is being moved or
6743: renamed.
6744:
6745: Do not forget regenerating the distinfo file after that, since it contains the
6746: DIST_SUBDIR path in the filenames. Also, increase the PKGREVISION if the
6747: installed package is different. Furthermore, a mail to the package's authors
6748: seems appropriate telling them that changing distfiles after releases without
6749: changing the file names is not good practice.
1.1 dsieger 6750:
1.154 rillig 6751: 21.2.3. Packages hosted on github.com
1.88 tnn 6752:
1.90 tnn 6753: Helper methods exist for packages hosted on github.com which will often have
6754: distfile names that clash with other packages, for example 1.0.tar.gz. Use one
6755: of the three recipes from below:
1.88 tnn 6756:
1.154 rillig 6757: 21.2.3.1. Fetch based on a tagged release
1.88 tnn 6758:
1.189 bacon 6759: If your distfile URL looks similar to https://github.com/username/example/
6760: archive/v1.0.zip, then you are packaging a tagged release.
1.88 tnn 6761:
1.189 bacon 6762: DISTNAME= example-1.0
1.90 tnn 6763: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
1.189 bacon 6764: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
1.90 tnn 6765: GITHUB_TAG= v${PKGVERSION_NOREV}
1.88 tnn 6766: EXTRACT_SUFX= .zip
6767:
1.189 bacon 6768: 21.2.3.2. Fetch based on a specific commit before the first release
6769:
6770: If your distfile looks similar to https://github.com/username/example/archive/
6771: 988881adc9fc3655077dc2d4d757d480b5ea0e11 and is from a commit before the first
6772: release, then set the package version to 0.0.0.N, where N is the number of
6773: commits to the repository, and set GITHUB_TAG to the commit hash. This will
6774: (almost) ensure that the first tagged release will have a version greater than
6775: this one so that package upgrades will function properly.
6776:
6777: DISTNAME= example-0.0.0.347
6778: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6779: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
6780: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
6781:
6782: 21.2.3.3. Fetch based on a specific commit after a release
1.88 tnn 6783:
1.189 bacon 6784: If your distfile looks similar to https://github.com/username/example/archive/
6785: 988881adc9fc3655077dc2d4d757d480b5ea0e11 and is from a commit after a release,
6786: then include the last release version and the commit count since that release
6787: in the package version and set GITHUB_TAG to the commit hash. The latest
6788: release and commit count are shown in the output of "git describe --tags":
6789:
6790: # git clone https://github.com/username/example
6791: # cd example
6792: # git describe --tags
6793: 1.2.3-5-g988881a
1.88 tnn 6794:
1.189 bacon 6795: DISTNAME= example-1.2.3.5
6796: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6797: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
1.90 tnn 6798: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
1.88 tnn 6799:
1.189 bacon 6800: 21.2.3.4. Fetch based on release
1.88 tnn 6801:
1.189 bacon 6802: If your distfile URL looks similar to https://github.com/username/example/
6803: releases/download/rel-1.6/offensive-1.6.zip, then you are packaging a release.
1.88 tnn 6804:
1.90 tnn 6805: DISTNAME= offensive-1.6
1.88 tnn 6806: PKGNAME= ${DISTNAME:S/offensive/proper/}
1.90 tnn 6807: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
1.189 bacon 6808: GITHUB_PROJECT= example
1.90 tnn 6809: GITHUB_RELEASE= rel-${PKGVERSION_NOREV} # usually just set this to ${DISTNAME}
6810: EXTRACT_SUFX= .zip
1.88 tnn 6811:
1.154 rillig 6812: 21.3. The configure phase
1.1 dsieger 6813:
1.154 rillig 6814: 21.3.1. Shared libraries - libtool
1.1 dsieger 6815:
6816: pkgsrc supports many different machines, with different object formats like
6817: a.out and ELF, and varying abilities to do shared library and dynamic loading
6818: at all. To accompany this, varying commands and options have to be passed to
6819: the compiler, linker, etc. to get the Right Thing, which can be pretty annoying
6820: especially if you don't have all the machines at your hand to test things. The
6821: devel/libtool pkg can help here, as it just "knows" how to build both static
6822: and dynamic libraries from a set of source files, thus being
6823: platform-independent.
6824:
6825: Here's how to use libtool in a package in seven simple steps:
6826:
6827: 1. Add USE_LIBTOOL=yes to the package Makefile.
6828:
6829: 2. For library objects, use "${LIBTOOL} --mode=compile ${CC}" in place of "$
6830: {CC}". You could even add it to the definition of CC, if only libraries are
6831: being built in a given Makefile. This one command will build both PIC and
6832: non-PIC library objects, so you need not have separate shared and
6833: non-shared library rules.
6834:
6835: 3. For the linking of the library, remove any "ar", "ranlib", and "ld
6836: -Bshareable" commands, and instead use:
6837:
6838: ${LIBTOOL} --mode=link \
6839: ${CC} -o ${.TARGET:.a=.la} \
6840: ${OBJS:.o=.lo} \
6841: -rpath ${PREFIX}/lib \
6842: -version-info major:minor
6843:
6844: Note that the library is changed to have a .la extension, and the objects
6845: are changed to have a .lo extension. Change OBJS as necessary. This
6846: automatically creates all of the .a, .so.major.minor, and ELF symlinks (if
6847: necessary) in the build directory. Be sure to include "-version-info",
6848: especially when major and minor are zero, as libtool will otherwise strip
6849: off the shared library version.
6850:
6851: From the libtool manual:
6852:
6853: So, libtool library versions are described by three integers:
6854:
6855: CURRENT
6856: The most recent interface number that this library implements.
6857:
6858: REVISION
6859: The implementation number of the CURRENT interface.
6860:
6861: AGE
6862: The difference between the newest and oldest interfaces that
6863: this library implements. In other words, the library implements
6864: all the interface numbers in the range from number `CURRENT -
6865: AGE' to `CURRENT'.
6866:
6867: If two libraries have identical CURRENT and AGE numbers, then the
6868: dynamic linker chooses the library with the greater REVISION number.
6869:
6870: The "-release" option will produce different results for a.out and ELF
1.25 wiz 6871: (excluding symlinks) in only one case. An ELF library of the form "
6872: libfoo-release.so.x.y" will have a symlink of "libfoo.so.x.y" on an a.out
1.1 dsieger 6873: platform. This is handled automatically.
6874:
6875: The "-rpath argument" is the install directory of the library being built.
6876:
6877: In the PLIST, include only the .la file, the other files will be added
6878: automatically.
6879:
6880: 4. When linking shared object (.so) files, i.e. files that are loaded via
6881: dlopen(3), NOT shared libraries, use "-module -avoid-version" to prevent
6882: them getting version tacked on.
6883:
6884: The PLIST file gets the foo.so entry.
6885:
6886: 5. When linking programs that depend on these libraries before they are
6887: installed, preface the cc(1) or ld(1) line with "${LIBTOOL} --mode=link",
6888: and it will find the correct libraries (static or shared), but please be
6889: aware that libtool will not allow you to specify a relative path in -L
6890: (such as "-L../somelib"), because it expects you to change that argument to
6891: be the .la file. e.g.
6892:
6893: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
6894:
6895: should be changed to:
6896:
6897: ${LIBTOOL} --mode=link ${CC} -o someprog ../somelib/somelib.la
6898:
6899: and it will do the right thing with the libraries.
6900:
6901: 6. When installing libraries, preface the install(1) or cp(1) command with "$
6902: {LIBTOOL} --mode=install", and change the library name to .la. e.g.
6903:
1.23 jakllsch 6904: ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 dsieger 6905:
6906: This will install the static .a, shared library, any needed symlinks, and
6907: run ldconfig(8).
6908:
6909: 7. In your PLIST, include only the .la file (this is a change from previous
6910: behaviour).
6911:
1.154 rillig 6912: 21.3.2. Using libtool on GNU packages that already support libtool
1.1 dsieger 6913:
6914: Add USE_LIBTOOL=yes to the package Makefile. This will override the package's
6915: own libtool in most cases. For older libtool using packages, libtool is made by
6916: ltconfig script during the do-configure step; you can check the libtool script
6917: location by doing make configure; find work*/ -name libtool.
6918:
6919: LIBTOOL_OVERRIDE specifies which libtool scripts, relative to WRKSRC, to
6920: override. By default, it is set to "libtool */libtool */*/libtool". If this
6921: does not match the location of the package's libtool script(s), set it as
6922: appropriate.
6923:
6924: If you do not need *.a static libraries built and installed, then use
6925: SHLIBTOOL_OVERRIDE instead.
6926:
6927: If your package makes use of the platform-independent library for loading
6928: dynamic shared objects, that comes with libtool (libltdl), you should include
6929: devel/libltdl/buildlink3.mk.
6930:
6931: Some packages use libtool incorrectly so that the package may not work or build
6932: in some circumstances. Some of the more common errors are:
6933:
6934: * The inclusion of a shared object (-module) as a dependent library in an
6935: executable or library. This in itself isn't a problem if one of two things
6936: has been done:
6937:
6938: 1. The shared object is named correctly, i.e. libfoo.la, not foo.la
6939:
6940: 2. The -dlopen option is used when linking an executable.
6941:
6942: * The use of libltdl without the correct calls to initialisation routines.
6943: The function lt_dlinit() should be called and the macro
6944: LTDL_SET_PRELOADED_SYMBOLS included in executables.
6945:
1.154 rillig 6946: 21.3.3. GNU Autoconf/Automake
1.1 dsieger 6947:
6948: If a package needs GNU autoconf or automake to be executed to regenerate the
6949: configure script and Makefile.in makefile templates, then they should be
6950: executed in a pre-configure target.
6951:
6952: For packages that need only autoconf:
6953:
6954: AUTOCONF_REQD= 2.50 # if default version is not good enough
6955: USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
6956: ...
6957:
6958: pre-configure:
6959: cd ${WRKSRC} && autoconf
6960:
6961: ...
6962:
6963: and for packages that need automake and autoconf:
6964:
6965: AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
6966: USE_TOOLS+= automake # use "automake14" for automake-1.4
6967: ...
6968:
6969: pre-configure:
6970: set -e; cd ${WRKSRC}; \
6971: aclocal; autoheader; automake -a --foreign -i; autoconf
6972:
6973: ...
6974:
6975: Packages which use GNU Automake will almost certainly require GNU Make.
6976:
6977: There are times when the configure process makes additional changes to the
6978: generated files, which then causes the build process to try to re-execute the
6979: automake sequence. This is prevented by touching various files in the configure
6980: stage. If this causes problems with your package you can set AUTOMAKE_OVERRIDE=
6981: NO in the package Makefile.
6982:
1.154 rillig 6983: 21.4. Programming languages
1.1 dsieger 6984:
1.154 rillig 6985: 21.4.1. C, C++, and Fortran
1.1 dsieger 6986:
6987: Compilers for the C, C++, and Fortran languages comes with the NetBSD base
6988: system. By default, pkgsrc assumes that a package is written in C and will hide
1.184 rillig 6989: all other compilers (via the wrapper framework, see Chapter 18, Buildlink
1.1 dsieger 6990: methodology).
6991:
6992: To declare which language's compiler a package needs, set the USE_LANGUAGES
6993: variable. Allowed values currently are "c", "c++", and "fortran" (and any
6994: combination). The default is "c". Packages using GNU configure scripts, even if
6995: written in C++, usually need a C compiler for the configure phase.
6996:
1.154 rillig 6997: 21.4.2. Java
1.1 dsieger 6998:
6999: If a program is written in Java, use the Java framework in pkgsrc. The package
7000: must include ../../mk/java-vm.mk. This Makefile fragment provides the following
7001: variables:
7002:
7003: * USE_JAVA defines if a build dependency on the JDK is added. If USE_JAVA is
7004: set to "run", then there is only a runtime dependency on the JDK. The
7005: default is "yes", which also adds a build dependency on the JDK.
7006:
7007: * Set USE_JAVA2 to declare that a package needs a Java2 implementation. The
7008: supported values are "yes", "1.4", and "1.5". "yes" accepts any Java2
7009: implementation, "1.4" insists on versions 1.4 or above, and "1.5" only
7010: accepts versions 1.5 or above. This variable is not set by default.
7011:
1.25 wiz 7012: * PKG_JAVA_HOME is automatically set to the runtime location of the used Java
7013: implementation dependency. It may be used to set JAVA_HOME to a good value
7014: if the program needs this variable to be defined.
7015:
1.154 rillig 7016: 21.4.3. Packages containing perl scripts
1.1 dsieger 7017:
7018: If your package contains interpreted perl scripts, add "perl" to the USE_TOOLS
7019: variable and set REPLACE_PERL to ensure that the proper interpreter path is
7020: set. REPLACE_PERL should contain a list of scripts, relative to WRKSRC, that
1.74 wiz 7021: you want adjusted. Every occurrence of */bin/perl in a she-bang line will be
7022: replaced with the full path to the perl executable.
1.1 dsieger 7023:
7024: If a particular version of perl is needed, set the PERL5_REQD variable to the
7025: version number. The default is "5.0".
7026:
1.154 rillig 7027: See Section 21.6.6, "Packages installing perl modules" for information about
1.1 dsieger 7028: handling perl modules.
7029:
1.154 rillig 7030: 21.4.4. Packages containing shell scripts
1.41 wiz 7031:
7032: REPLACE_SH, REPLACE_BASH, REPLACE_CSH, and REPLACE_KSH can be used to replace
1.195 gutterid 7033: shell hash bangs in files. Please use the appropriate one, preferring
7034: REPLACE_SH in case this shell is sufficient. Each should contain a list of
7035: scripts, relative to WRKSRC, that you want adjusted. Every occurrence of the
7036: matching shell in a she-bang line will be replaced with the full path to the
7037: shell executable. When using REPLACE_BASH, don't forget to add bash to
7038: USE_TOOLS.
1.41 wiz 7039:
1.154 rillig 7040: 21.4.5. Other programming languages
1.1 dsieger 7041:
7042: Currently, there is no special handling for other languages in pkgsrc. If a
7043: compiler package provides a buildlink3.mk file, include that, otherwise just
7044: add a (build) dependency on the appropriate compiler package.
7045:
1.154 rillig 7046: 21.5. The build phase
1.1 dsieger 7047:
7048: The most common failures when building a package are that some platforms do not
7049: provide certain header files, functions or libraries, or they provide the
7050: functions in a library that the original package author didn't know. To work
7051: around this, you can rewrite the source code in most cases so that it does not
7052: use the missing functions or provides a replacement function.
7053:
1.154 rillig 7054: 21.5.1. Compiling C and C++ code conditionally
1.1 dsieger 7055:
7056: If a package already comes with a GNU configure script, the preferred way to
7057: fix the build failure is to change the configure script, not the code. In the
7058: other cases, you can utilize the C preprocessor, which defines certain macros
7059: depending on the operating system and hardware architecture it compiles for.
7060: These macros can be queried using for example #if defined(__i386). Almost every
7061: operating system, hardware architecture and compiler has its own macro. For
7062: example, if the macros __GNUC__, __i386__ and __NetBSD__ are all defined, you
7063: know that you are using NetBSD on an i386 compatible CPU, and your compiler is
7064: GCC.
7065:
7066: The list of the following macros for hardware and operating system depends on
7067: the compiler that is used. For example, if you want to conditionally compile
7068: code on Solaris, don't use __sun__, as the SunPro compiler does not define it.
7069: Use __sun instead.
7070:
1.154 rillig 7071: 21.5.1.1. C preprocessor macros to identify the operating system
1.1 dsieger 7072:
7073: To distinguish between 4.4 BSD-derived systems and the rest of the world, you
7074: should use the following code.
7075:
7076: #include <sys/param.h>
7077: #if (defined(BSD) && BSD >= 199306)
7078: /* BSD-specific code goes here */
7079: #else
7080: /* non-BSD-specific code goes here */
7081: #endif
7082:
7083: If this distinction is not fine enough, you can also test for the following
7084: macros.
7085:
1.46 obache 7086: Cygwin __CYGWIN__
7087: DragonFly __DragonFly__
1.1 dsieger 7088: FreeBSD __FreeBSD__
1.46 obache 7089: Haiku __HAIKU__
1.1 dsieger 7090: Interix __INTERIX
7091: IRIX __sgi (TODO: get a definite source for this)
7092: Linux linux, __linux, __linux__
1.83 dholland 7093: Mac OS X __APPLE__
1.46 obache 7094: MirBSD __MirBSD__ (__OpenBSD__ is also defined)
7095: Minix3 __minix
1.1 dsieger 7096: NetBSD __NetBSD__
7097: OpenBSD __OpenBSD__
7098: Solaris sun, __sun
7099:
1.154 rillig 7100: 21.5.1.2. C preprocessor macros to identify the hardware architecture
1.1 dsieger 7101:
7102: i386 i386, __i386, __i386__
7103: MIPS __mips
7104: SPARC sparc, __sparc
7105:
1.154 rillig 7106: 21.5.1.3. C preprocessor macros to identify the compiler
1.1 dsieger 7107:
7108: GCC __GNUC__ (major version), __GNUC_MINOR__
7109: MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41)
7110: SunPro __SUNPRO_C (0x570 for Sun C 5.7)
7111: SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8)
7112:
1.154 rillig 7113: 21.5.2. How to handle compiler bugs
1.1 dsieger 7114:
7115: Some source files trigger bugs in the compiler, based on combinations of
7116: compiler version and architecture and almost always relation to optimisation
7117: being enabled. Common symptoms are gcc internal errors or never finishing
7118: compiling a file.
7119:
7120: Typically, a workaround involves testing the MACHINE_ARCH and compiler version,
1.87 tnn 7121: disabling optimisation for that combination of file, MACHINE_ARCH and compiler.
7122:
7123: This used to be a big problem in the past, but is rarely needed now as compiler
7124: technology has matured. If you still need to add a compiler specific
7125: workaround, please do so in the file hacks.mk and describe the symptom and
7126: compiler version as detailed as possible.
1.1 dsieger 7127:
1.172 rillig 7128: 21.5.3. No such file or directory
7129:
7130: Compilation sometimes fails with an error message like this:
7131:
7132: .../x11/gtk3/work/gtk+-3.24.12/gdk/gdktypes.h:35:10:
7133: fatal error: pango/pango.h: No such file or directory
7134:
7135: The proper way to fix this problem depends on the type of the header, which is
7136: described in the following sections.
7137:
7138: 21.5.3.1. Headers from other packages
7139:
7140: If the header name looks like it comes from a different package, that other
7141: package should be included via the buildlink3 framework.
7142:
7143: First, look whether the header is somewhere in the buildlink3 directory below
7144: WRKDIR. In the above case of the missing Pango header:
7145:
7146: $ find work/.buildlink/ -print | grep -F pango/pango.h
7147:
7148: In the case of Pango, the output is:
7149:
7150: work/.buildlink/include/pango-1.0/pango/pango.h
7151:
7152: If the pango/pango.h file were placed directly in the .buildlink directory, it
7153: would have been found automatically. There is an extra pango-1.0 path component
7154: though, which means that the compiler command line must contain an option of
7155: the form -I${BUILDLINK3_PREFIX.pango}/include/pango-1.0. In most cases this
7156: option is generated by the configure script, which can be examined using:
7157:
7158: $ $ grep -o '[-]I[^[:space:]]*/pango[^[:space:]]*' work/*/Makefile
7159: -I/usr/pkg/include/pango-1.0
7160: -I/usr/pkg/include/pango-1.0
7161: -I/usr/pkg/include/pango-1.0
7162: -I/usr/pkg/include/pango-1.0
7163: -I/usr/pkg/include/pango-1.0
7164:
7165: This looks good. These options are transformed by the buildlink wrapper to
7166: refer to the correct path inside work/.buildlink.
7167:
7168: Since the compilation fails though, examine the compiler command lines in work
7169: /.work.log to see whether the -I option is included in the particular command
7170: line.
7171:
7172: To further analyze the situation, run bmake build-env, which sets up an
7173: interactive, realistic environment including all the pkgsrc wrapper commands
7174: and environment variables. From there, try to compile some simple example
7175: programs that use the header.
7176:
7177: 21.5.3.2. Headers generated during the build
7178:
7179: If the name of the header seems to come from the package itself, and if the
7180: build is run with parallel jobs, the package may have some undeclared
7181: dependencies between the .c and the .h files, and a C file is compiled before
7182: its required header is generated.
7183:
7184: To see whether the build runs with parallel jobs, run bmake show-all-build |
7185: grep JOBS. Its output looks like this:
7186:
7187: usr MAKE_JOBS= 7
7188: pkg MAKE_JOBS_SAFE # undefined
7189: def _MAKE_JOBS_N= 7
7190:
7191: In this case the pkgsrc user has asked pkgsrc to build packages with 7 jobs in
7192: parallel (MAKE_JOBS). The package could have disabled parallel builds by
7193: setting MAKE_JOBS_SAFE to no, but in this case it hasn't.
7194:
7195: To see whether the build failure is caused by parallel builds, first save the
7196: exact error message and a bit of context, maybe you need it later for reporting
7197: a bug. Next, run:
7198:
7199: MAKE_JOBS_SAFE=no bmake clean build
7200:
7201: If that succeeds, file a bug report against the pkgsrc package, including the
7202: exact error message and the contents of your mk.conf file.
7203:
1.173 rillig 7204: 21.5.3.3. Symlinks
7205:
7206: Pkgsrc does not work reliably if any of LOCALBASE, VARBASE or WRKDIR contains a
7207: symlink. Since 2019Q2, the pkgsrc bootstrap program prevents installing pkgsrc
7208: in symlink-based directories. Existing pkgsrc installations are not checked for
7209: symlinks though.
7210:
7211: The "No such file or directory" error messages are a typical symptom of
7212: symlinks, and it's quite difficult to find out that this is the actual cause.
7213:
7214: 21.5.3.4. Stale working directories
7215:
7216: When building a hierarchy of packages, it may happen that one package is built
7217: and then pkgsrc is updated. This situation can provoke various hard to diagnose
7218: build errors. To clean up the situation:
7219:
7220: $ (cd ../../ && test -f mk/bsd.pkg.mk && rm -rf */*/work)
7221:
7222: (The test for bsd.pkg.mk just prevents running this command in the wrong
7223: directory.)
7224:
7225: If you have set WRKOBJDIR in mk.conf, remove that directory as well.
7226:
7227: 21.5.3.5. Other possible reasons
7228:
7229: On platforms other than BSD, third-party packages are installed in /usr/
7230: include, together with the base system. This means that pkgsrc cannot
7231: distinguish between headers provided by the base system (which it needs) and
7232: headers from third-party packages (which are often included in pkgsrc as well).
7233: This can lead to subtle version mismatches.
7234:
7235: In pkgsrc installations that have been active for several years, it may happen
7236: that some files are manually deleted. To exclude this unlikely reason, run
7237: pkg_admin check.
7238:
7239: It may help to run pkg_admin rebuild-tree to check/fix dependencies.
7240:
7241: If all of the above doesn't help, see Chapter 2, Getting help for contact
7242: information. Be prepared to describe what you have tried so far and what any
7243: error messages were.
7244:
1.172 rillig 7245: 21.5.4. Undefined reference to "..."
1.1 dsieger 7246:
7247: This error message often means that a package did not link to a shared library
7248: it needs. The following functions are known to cause this error message over
7249: and over.
7250:
7251: +-----------------------------------------------------+
7252: | Function |Library |Affected platforms|
7253: |-------------------------+--------+------------------|
7254: |accept, bind, connect |-lsocket|Solaris |
7255: |-------------------------+--------+------------------|
7256: |crypt |-lcrypt |DragonFly, NetBSD |
7257: |-------------------------+--------+------------------|
7258: |dlopen, dlsym |-ldl |Linux |
7259: |-------------------------+--------+------------------|
7260: |gethost* |-lnsl |Solaris |
7261: |-------------------------+--------+------------------|
7262: |inet_aton |-lresolv|Solaris |
7263: |-------------------------+--------+------------------|
7264: |nanosleep, sem_*, timer_*|-lrt |Solaris |
7265: |-------------------------+--------+------------------|
7266: |openpty |-lutil |Linux |
7267: +-----------------------------------------------------+
7268:
7269: To fix these linker errors, it is often sufficient to say LIBS.OperatingSystem+
7270: = -lfoo to the package Makefile and then say bmake clean; bmake.
7271:
1.172 rillig 7272: 21.5.4.1. Special issue: The SunPro compiler
1.1 dsieger 7273:
7274: When you are using the SunPro compiler, there is another possibility. That
7275: compiler cannot handle the following code:
7276:
7277: extern int extern_func(int);
7278:
7279: static inline int
7280: inline_func(int x)
7281: {
7282: return extern_func(x);
7283: }
7284:
7285: int main(void)
7286: {
7287: return 0;
7288: }
7289:
7290: It generates the code for inline_func even if that function is never used. This
7291: code then refers to extern_func, which can usually not be resolved. To solve
7292: this problem you can try to tell the package to disable inlining of functions.
7293:
1.172 rillig 7294: 21.5.5. Running out of memory
1.1 dsieger 7295:
7296: Sometimes packages fail to build because the compiler runs into an operating
7297: system specific soft limit. With the UNLIMIT_RESOURCES variable pkgsrc can be
1.94 wiz 7298: told to unlimit the resources. Currently, the allowed values are any
7299: combination of "cputime", "datasize", "memorysize", and "stacksize". Setting
7300: this variable is similar to running the shell builtin ulimit command to raise
7301: the maximum data segment size or maximum stack size of a process, respectively,
7302: to their hard limits.
1.1 dsieger 7303:
1.154 rillig 7304: 21.6. The install phase
1.1 dsieger 7305:
1.154 rillig 7306: 21.6.1. Creating needed directories
1.1 dsieger 7307:
7308: The BSD-compatible install supplied with some operating systems cannot create
7309: more than one directory at a time. As such, you should call ${INSTALL_*_DIR}
7310: like this:
7311:
7312: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
7313: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
7314:
7315: You can also just append "dir1 dir2" to the INSTALLATION_DIRS variable, which
7316: will automatically do the right thing.
7317:
1.154 rillig 7318: 21.6.2. Where to install documentation
1.1 dsieger 7319:
7320: In general, documentation should be installed into ${PREFIX}/share/doc/$
7321: {PKGBASE} or ${PREFIX}/share/doc/${PKGNAME} (the latter includes the version
7322: number of the package).
7323:
7324: Many modern packages using GNU autoconf allow to set the directory where HTML
7325: documentation is installed with the "--with-html-dir" option. Sometimes using
7326: this flag is needed because otherwise the documentation ends up in ${PREFIX}/
7327: share/doc/html or other places.
7328:
7329: An exception to the above is that library API documentation generated with the
7330: textproc/gtk-doc tools, for use by special browsers (devhelp) should be left at
7331: their default location, which is ${PREFIX}/share/gtk-doc. Such documentation
7332: can be recognized from files ending in .devhelp or .devhelp2. (It is also
7333: acceptable to install such files in ${PREFIX}/share/doc/${PKGBASE} or ${PREFIX}
7334: /share/doc/${PKGNAME}; the .devhelp* file must be directly in that directory
7335: then, no additional subdirectory level is allowed in this case. This is usually
7336: achieved by using "--with-html-dir=${PREFIX}/share/doc". ${PREFIX}/share/
7337: gtk-doc is preferred though.)
7338:
1.154 rillig 7339: 21.6.3. Installing highscore files
1.1 dsieger 7340:
7341: Certain packages, most of them in the games category, install a score file that
7342: allows all users on the system to record their highscores. In order for this to
7343: work, the binaries need to be installed setgid and the score files owned by the
1.36 wiz 7344: appropriate group and/or owner (traditionally the "games" user/group). Set
7345: USE_GAMESGROUP to yes to support this. The following variables, documented in
7346: more detail in mk/defaults/mk.conf, control this behaviour: GAMEDATAMODE,
1.100 leot 7347: GAMEDIRMODE, GAMES_GROUP, GAMEMODE, GAME_USER. Other useful variables are:
7348: GAMEDIR_PERMS, GAMEDATA_PERMS and SETGID_GAMES_PERMS.
7349:
7350: An example that illustrates some of the variables described above is games/
7351: moon-buggy. OWN_DIRS_PERMS is used to properly set directory permissions of the
7352: directory where the scorefile is saved, REQD_FILES_PERMS is used to create a
7353: dummy scorefile (mbscore) with the proper permissions and SPECIAL_PERMS is used
7354: to install setgid the game binary:
7355:
7356: USE_GAMESGROUP= yes
7357:
7358: BUILD_DEFS+= VARBASE
7359:
7360: OWN_DIRS_PERMS+= ${VARBASE}/games/moon-buggy ${GAMEDIR_PERMS}
7361: REQD_FILES_PERMS+= /dev/null ${VARBASE}/games/moon-buggy/mbscore ${GAMEDATA_PERMS}
7362: SPECIAL_PERMS+= ${PREFIX}/bin/moon-buggy ${SETGID_GAMES_PERMS}
7363:
7364: Various INSTALL_* variables are also available: INSTALL_GAME to install setgid
7365: game binaries, INSTALL_GAME_DIR to install game directories that are needed to
7366: be accessed by setgid games and INSTALL_GAME_DATA to install scorefiles.
1.1 dsieger 7367:
1.14 jmcneill 7368: A package should therefore never hard code file ownership or access permissions
1.100 leot 7369: but rely on *_PERMS as described above or alternatively on INSTALL_GAME,
7370: INSTALL_GAME_DATA and INSTALL_GAME_DIR to set these correctly.
1.1 dsieger 7371:
1.154 rillig 7372: 21.6.4. Adding DESTDIR support to packages
1.4 rillig 7373:
1.14 jmcneill 7374: DESTDIR support means that a package installs into a staging directory, not the
7375: final location of the files. Then a binary package is created which can be used
7376: for installation as usual. There are two ways: Either the package must install
1.25 wiz 7377: as root ("destdir") or the package can install as non-root user ("user-destdir"
7378: ).
1.14 jmcneill 7379:
1.113 leot 7380: * PKG_DESTDIR_SUPPORT has to be set to "destdir" or "user-destdir". By
7381: default PKG_DESTDIR_SUPPORT is set to "user-destdir" to help catching more
7382: potential packaging problems. If bsd.prefs.mk is included in the Makefile,
7383: PKG_DESTDIR_SUPPORT needs to be set before the inclusion.
1.14 jmcneill 7384:
1.4 rillig 7385: * All installation operations have to be prefixed with ${DESTDIR}.
7386:
7387: * automake gets this DESTDIR mostly right automatically. Many manual rules
7388: and pre/post-install often are incorrect; fix them.
7389:
1.17 imil 7390: * If files are installed with special owner/group use SPECIAL_PERMS.
1.4 rillig 7391:
7392: * In general, packages should support UNPRIVILEGED to be able to use DESTDIR.
7393:
1.154 rillig 7394: 21.6.5. Packages with hardcoded paths to other interpreters
1.1 dsieger 7395:
7396: Your package may also contain scripts with hardcoded paths to other
7397: interpreters besides (or as well as) perl. To correct the full pathname to the
7398: script interpreter, you need to set the following definitions in your Makefile
7399: (we shall use tclsh in this example):
7400:
7401: REPLACE_INTERPRETER+= tcl
7402: REPLACE.tcl.old= .*/bin/tclsh
7403: REPLACE.tcl.new= ${PREFIX}/bin/tclsh
7404: REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
7405: # relative to ${WRKSRC}, just as in REPLACE_PERL
7406:
7407: Note
7408:
7409: Before March 2006, these variables were called _REPLACE.* and _REPLACE_FILES.*.
7410:
1.154 rillig 7411: 21.6.6. Packages installing perl modules
1.1 dsieger 7412:
7413: Makefiles of packages providing perl5 modules should include the Makefile
7414: fragment ../../lang/perl5/module.mk. It provides a do-configure target for the
7415: standard perl configuration for such modules as well as various hooks to tune
7416: this configuration. See comments in this file for details.
7417:
7418: Perl5 modules will install into different places depending on the version of
7419: perl used during the build process. To address this, pkgsrc will append lines
7420: to the PLIST corresponding to the files listed in the installed .packlist file
7421: generated by most perl5 modules. This is invoked by defining PERL5_PACKLIST to
1.48 wiz 7422: a space-separated list of packlist files relative to PERL5_PACKLIST_DIR
7423: (PERL5_INSTALLVENDORARCH by default), e.g.:
1.1 dsieger 7424:
1.48 wiz 7425: PERL5_PACKLIST= auto/Pg/.packlist
1.1 dsieger 7426:
1.48 wiz 7427: The perl5 config variables installarchlib, installscript, installvendorbin,
7428: installvendorscript, installvendorarch, installvendorlib, installvendorman1dir,
7429: and installvendorman3dir represent those locations in which components of perl5
7430: modules may be installed, provided as variable with uppercase and prefixed with
7431: PERL5_, e.g. PERL5_INSTALLARCHLIB and may be used by perl5 packages that don't
7432: have a packlist. These variables are also substituted for in the PLIST as
7433: uppercase prefixed with PERL5_SUB_.
1.1 dsieger 7434:
1.154 rillig 7435: 21.6.7. Packages installing info files
1.1 dsieger 7436:
7437: Some packages install info files or use the "makeinfo" or "install-info"
7438: commands. INFO_FILES should be defined in the package Makefile so that INSTALL
7439: and DEINSTALL scripts will be generated to handle registration of the info
7440: files in the Info directory file. The "install-info" command used for the info
7441: files registration is either provided by the system, or by a special purpose
7442: package automatically added as dependency if needed.
7443:
7444: PKGINFODIR is the directory under ${PREFIX} where info files are primarily
7445: located. PKGINFODIR defaults to "info" and can be overridden by the user.
7446:
7447: The info files for the package should be listed in the package PLIST; however
7448: any split info files need not be listed.
7449:
7450: A package which needs the "makeinfo" command at build time must add "makeinfo"
7451: to USE_TOOLS in its Makefile. If a minimum version of the "makeinfo" command is
7452: needed it should be noted with the TEXINFO_REQD variable in the package
7453: Makefile. By default, a minimum version of 3.12 is required. If the system does
7454: not provide a makeinfo command or if it does not match the required minimum, a
7455: build dependency on the devel/gtexinfo package will be added automatically.
7456:
7457: The build and installation process of the software provided by the package
7458: should not use the install-info command as the registration of info files is
1.25 wiz 7459: the task of the package INSTALL script, and it must use the appropriate
1.1 dsieger 7460: makeinfo command.
7461:
7462: To achieve this goal, the pkgsrc infrastructure creates overriding scripts for
7463: the install-info and makeinfo commands in a directory listed early in PATH.
7464:
7465: The script overriding install-info has no effect except the logging of a
7466: message. The script overriding makeinfo logs a message and according to the
7467: value of TEXINFO_REQD either runs the appropriate makeinfo command or exit on
7468: error.
7469:
1.154 rillig 7470: 21.6.8. Packages installing man pages
1.1 dsieger 7471:
7472: All packages that install manual pages should install them into the same
7473: directory, so that there is one common place to look for them. In pkgsrc, this
7474: place is ${PREFIX}/${PKGMANDIR}, and this expression should be used in
1.25 wiz 7475: packages. The default for PKGMANDIR is "man". Another often-used value is "
7476: share/man".
1.1 dsieger 7477:
7478: Note
7479:
7480: The support for a custom PKGMANDIR is far from complete.
7481:
7482: The PLIST files can just use man/ as the top level directory for the man page
7483: file entries, and the pkgsrc framework will convert as needed. In all other
7484: places, the correct PKGMANDIR must be used.
7485:
7486: Packages that are configured with GNU_CONFIGURE set as "yes", by default will
7487: use the ./configure --mandir switch to set where the man pages should be
7488: installed. The path is GNU_CONFIGURE_MANDIR which defaults to ${PREFIX}/$
7489: {PKGMANDIR}.
7490:
7491: Packages that use GNU_CONFIGURE but do not use --mandir, can set
7492: CONFIGURE_HAS_MANDIR to "no". Or if the ./configure script uses a non-standard
7493: use of --mandir, you can set GNU_CONFIGURE_MANDIR as needed.
7494:
1.184 rillig 7495: See Section 19.5, "Man page compression" for information on installation of
1.1 dsieger 7496: compressed manual pages.
7497:
1.154 rillig 7498: 21.6.9. Packages installing GConf data files
1.1 dsieger 7499:
1.7 rillig 7500: If a package installs .schemas or .entries files, used by GConf, you need to
1.1 dsieger 7501: take some extra steps to make sure they get registered in the database:
7502:
1.7 rillig 7503: 1. Include ../../devel/GConf/schemas.mk instead of its buildlink3.mk file.
7504: This takes care of rebuilding the GConf database at installation and
7505: deinstallation time, and tells the package where to install GConf data
1.1 dsieger 7506: files using some standard configure arguments. It also disallows any access
7507: to the database directly from the package.
7508:
7509: 2. Ensure that the package installs its .schemas files under ${PREFIX}/share/
7510: gconf/schemas. If they get installed under ${PREFIX}/etc, you will need to
7511: manually patch the package.
7512:
7513: 3. Check the PLIST and remove any entries under the etc/gconf directory, as
1.154 rillig 7514: they will be handled automatically. See Section 10.13, "How do I change the
1.1 dsieger 7515: location of configuration files?" for more information.
7516:
1.7 rillig 7517: 4. Define the GCONF_SCHEMAS variable in your Makefile with a list of all
1.1 dsieger 7518: .schemas files installed by the package, if any. Names must not contain any
7519: directories in them.
7520:
1.7 rillig 7521: 5. Define the GCONF_ENTRIES variable in your Makefile with a list of all
1.1 dsieger 7522: .entries files installed by the package, if any. Names must not contain any
7523: directories in them.
7524:
1.154 rillig 7525: 21.6.10. Packages installing scrollkeeper/rarian data files
1.1 dsieger 7526:
1.18 mishka 7527: If a package installs .omf files, used by scrollkeeper/rarian, you need to take
7528: some extra steps to make sure they get registered in the database:
1.1 dsieger 7529:
1.18 mishka 7530: 1. Include ../../mk/omf-scrollkeeper.mk instead of rarian's buildlink3.mk
7531: file. This takes care of rebuilding the scrollkeeper database at
7532: installation and deinstallation time, and disallows any access to it
7533: directly from the package.
1.1 dsieger 7534:
7535: 2. Check the PLIST and remove any entries under the libdata/scrollkeeper
7536: directory, as they will be handled automatically.
7537:
7538: 3. Remove the share/omf directory from the PLIST. It will be handled by
1.18 mishka 7539: rarian. (make print-PLIST does this automatically.)
1.1 dsieger 7540:
1.154 rillig 7541: 21.6.11. Packages installing X11 fonts
1.1 dsieger 7542:
7543: If a package installs font files, you will need to rebuild the fonts database
7544: in the directory where they get installed at installation and deinstallation
7545: time. This can be automatically done by using the pkginstall framework.
7546:
7547: You can list the directories where fonts are installed in the FONTS_DIRS.type
7548: variables, where type can be one of "ttf", "type1" or "x11". Also make sure
7549: that the database file fonts.dir is not listed in the PLIST.
7550:
7551: Note that you should not create new directories for fonts; instead use the
7552: standard ones to avoid that the user needs to manually configure his X server
7553: to find them.
7554:
1.154 rillig 7555: 21.6.12. Packages installing GTK2 modules
1.1 dsieger 7556:
7557: If a package installs GTK2 immodules or loaders, you need to take some extra
7558: steps to get them registered in the GTK2 database properly:
7559:
7560: 1. Include ../../x11/gtk2/modules.mk instead of its buildlink3.mk file. This
7561: takes care of rebuilding the database at installation and deinstallation
7562: time.
7563:
7564: 2. Set GTK2_IMMODULES=YES if your package installs GTK2 immodules.
7565:
7566: 3. Set GTK2_LOADERS=YES if your package installs GTK2 loaders.
7567:
7568: 4. Patch the package to not touch any of the GTK2 databases directly. These
7569: are:
7570:
1.42 asau 7571: + libdata/gtk-2.0/gdk-pixbuf.loaders
1.1 dsieger 7572:
1.42 asau 7573: + libdata/gtk-2.0/gtk.immodules
1.1 dsieger 7574:
7575: 5. Check the PLIST and remove any entries under the libdata/gtk-2.0 directory,
7576: as they will be handled automatically.
7577:
1.154 rillig 7578: 21.6.13. Packages installing SGML or XML data
1.1 dsieger 7579:
7580: If a package installs SGML or XML data files that need to be registered in
7581: system-wide catalogs (like DTDs, sub-catalogs, etc.), you need to take some
7582: extra steps:
7583:
7584: 1. Include ../../textproc/xmlcatmgr/catalogs.mk in your Makefile, which takes
7585: care of registering those files in system-wide catalogs at installation and
7586: deinstallation time.
7587:
7588: 2. Set SGML_CATALOGS to the full path of any SGML catalogs installed by the
7589: package.
7590:
7591: 3. Set XML_CATALOGS to the full path of any XML catalogs installed by the
7592: package.
7593:
7594: 4. Set SGML_ENTRIES to individual entries to be added to the SGML catalog.
7595: These come in groups of three strings; see xmlcatmgr(1) for more
7596: information (specifically, arguments recognized by the 'add' action). Note
7597: that you will normally not use this variable.
7598:
7599: 5. Set XML_ENTRIES to individual entries to be added to the XML catalog. These
7600: come in groups of three strings; see xmlcatmgr(1) for more information
7601: (specifically, arguments recognized by the 'add' action). Note that you
7602: will normally not use this variable.
7603:
1.154 rillig 7604: 21.6.14. Packages installing extensions to the MIME database
1.1 dsieger 7605:
7606: If a package provides extensions to the MIME database by installing .xml files
7607: inside ${PREFIX}/share/mime/packages, you need to take some extra steps to
7608: ensure that the database is kept consistent with respect to these new files:
7609:
7610: 1. Include ../../databases/shared-mime-info/mimedb.mk (avoid using the
7611: buildlink3.mk file from this same directory, which is reserved for
7612: inclusion from other buildlink3.mk files). It takes care of rebuilding the
7613: MIME database at installation and deinstallation time, and disallows any
7614: access to it directly from the package.
7615:
1.25 wiz 7616: 2. Check the PLIST and remove any entries under the share/mime directory,
1.1 dsieger 7617: except for files saved under share/mime/packages. The former are handled
7618: automatically by the update-mime-database program, but the latter are
7619: package-dependent and must be removed by the package that installed them in
7620: the first place.
7621:
7622: 3. Remove any share/mime/* directories from the PLIST. They will be handled by
7623: the shared-mime-info package.
7624:
1.154 rillig 7625: 21.6.15. Packages using intltool
1.1 dsieger 7626:
7627: If a package uses intltool during its build, add intltool to the USE_TOOLS,
7628: which forces it to use the intltool package provided by pkgsrc, instead of the
7629: one bundled with the distribution file.
7630:
7631: This tracks intltool's build-time dependencies and uses the latest available
7632: version; this way, the package benefits of any bug fixes that may have appeared
7633: since it was released.
7634:
1.154 rillig 7635: 21.6.16. Packages installing startup scripts
1.1 dsieger 7636:
7637: If a package contains a rc.d script, it won't be copied into the startup
7638: directory by default, but you can enable it, by adding the option
1.4 rillig 7639: PKG_RCD_SCRIPTS=YES in mk.conf. This option will copy the scripts into /etc/
7640: rc.d when a package is installed, and it will automatically remove the scripts
7641: when the package is deinstalled.
1.1 dsieger 7642:
1.154 rillig 7643: 21.6.17. Packages installing TeX modules
1.1 dsieger 7644:
7645: If a package installs TeX packages into the texmf tree, the ls-R database of
7646: the tree needs to be updated.
7647:
7648: Note
7649:
1.23 jakllsch 7650: Except the main TeX packages such as kpathsea, packages should install files
7651: into ${PREFIX}/share/texmf-dist, not ${PREFIX}/share/texmf.
1.1 dsieger 7652:
1.23 jakllsch 7653: 1. Include ../../print/kpathsea/texmf.mk. This takes care of rebuilding the
7654: ls-R database at installation and deinstallation time.
1.1 dsieger 7655:
1.23 jakllsch 7656: 2. If your package installs files into a texmf tree other than the one at $
7657: {PREFIX}/share/texmf-dist, set TEX_TEXMF_DIRS to the list of all texmf
7658: trees that need database update.
1.1 dsieger 7659:
7660: If your package also installs font map files that need to be registered
1.30 dholland 7661: using updmap, include ../../print/tex-tetex/map.mk and set TEX_MAP_FILES
7662: and/or TEX_MIXEDMAP_FILES to the list of all such font map files. Then
7663: updmap will be run automatically at installation/deinstallation to enable/
7664: disable font map files for TeX output drivers.
1.1 dsieger 7665:
7666: 3. Make sure that none of ls-R databases are included in PLIST, as they will
1.30 dholland 7667: be removed only by the kpathsea package.
1.1 dsieger 7668:
1.154 rillig 7669: 21.6.18. Packages supporting running binaries in emulation
1.1 dsieger 7670:
7671: There are some packages that provide libraries and executables for running
7672: binaries from a one operating system on a different one (if the latter supports
7673: it). One example is running Linux binaries on NetBSD.
7674:
7675: The pkgtools/rpm2pkg helps in extracting and packaging Linux rpm packages.
7676:
7677: The CHECK_SHLIBS can be set to no to avoid the check-shlibs target, which tests
7678: if all libraries for each installed executable can be found by the dynamic
7679: linker. Since the standard dynamic linker is run, this fails for emulation
7680: packages, because the libraries used by the emulation are not in the standard
7681: directories.
7682:
1.154 rillig 7683: 21.6.19. Packages installing hicolor theme icons
1.1 dsieger 7684:
7685: If a package installs images under the share/icons/hicolor and/or updates the
7686: share/icons/hicolor/icon-theme.cache database, you need to take some extra
7687: steps to make sure that the shared theme directory is handled appropriately and
7688: that the cache database is rebuilt:
7689:
7690: 1. Include ../../graphics/hicolor-icon-theme/buildlink3.mk.
7691:
7692: 2. Check the PLIST and remove the entry that refers to the theme cache.
7693:
7694: 3. Ensure that the PLIST does not remove the shared icon directories from the
7695: share/icons/hicolor hierarchy because they will be handled automatically.
7696:
7697: The best way to verify that the PLIST is correct with respect to the last two
7698: points is to regenerate it using make print-PLIST.
7699:
1.154 rillig 7700: 21.6.20. Packages installing desktop files
1.1 dsieger 7701:
7702: If a package installs .desktop files under share/applications and these include
1.54 rodent 7703: MIME information (MimeType key), you need to take extra steps to ensure that
7704: they are registered into the MIME database:
1.1 dsieger 7705:
7706: 1. Include ../../sysutils/desktop-file-utils/desktopdb.mk.
7707:
7708: 2. Check the PLIST and remove the entry that refers to the share/applications/
7709: mimeinfo.cache file. It will be handled automatically.
7710:
7711: The best way to verify that the PLIST is correct with respect to the last point
7712: is to regenerate it using make print-PLIST.
7713:
1.154 rillig 7714: 21.7. Marking packages as having problems
1.1 dsieger 7715:
1.23 jakllsch 7716: In some cases one does not have the time to solve a problem immediately. In
7717: this case, one can plainly mark a package as broken. For this, one just sets
7718: the variable BROKEN to the reason why the package is broken (similar to the
1.162 rillig 7719: PKG_FAIL_REASON variable). A user trying to build the package will immediately
7720: be shown this message, and the build will not be even tried.
1.1 dsieger 7721:
1.23 jakllsch 7722: BROKEN packages are removed from pkgsrc in irregular intervals.
1.1 dsieger 7723:
1.184 rillig 7724: Chapter 22. GNOME packaging and porting
7725:
7726: Table of Contents
7727:
7728: 22.1. Meta packages
7729: 22.2. Packaging a GNOME application
7730: 22.3. Updating GNOME to a newer version
7731: 22.4. Patching guidelines
7732:
7733: Quoting GNOME's web site:
7734:
7735: The GNOME project provides two things: The GNOME desktop environment, an
7736: intuitive and attractive desktop for users, and the GNOME development
7737: platform, an extensive framework for building applications that integrate
7738: into the rest of the desktop.
7739:
7740: pkgsrc provides a seamless way to automatically build and install a complete
7741: GNOME environment under many different platforms. We can say with confidence
7742: that pkgsrc is one of the most advanced build and packaging systems for GNOME
7743: due to its included technologies buildlink3, the wrappers and tools framework
7744: and automatic configuration file management. Lots of efforts are put into
7745: achieving a completely clean deinstallation of installed software components.
7746:
7747: Given that pkgsrc is NetBSD's official packaging system, the above also means
7748: that great efforts are put into making GNOME work under this operating system.
7749:
7750: This chapter is aimed at pkgsrc developers and other people interested in
7751: helping our GNOME porting and packaging efforts. It provides instructions on
7752: how to manage the existing packages and some important information regarding
7753: their internals.
7754:
7755: We need your help!
7756:
7757: Should you have some spare cycles to devote to NetBSD, pkgsrc and GNOME and are
7758: willing to learn new exciting stuff, please jump straight to the pending work
7759: list! There is still a long way to go to get a fully-functional GNOME desktop
7760: under NetBSD and we need your help to achieve it!
7761:
7762: 22.1. Meta packages
7763:
7764: pkgsrc includes three GNOME-related meta packages:
7765:
7766: * meta-pkgs/gnome-base: Provides the core GNOME desktop environment. It only
7767: includes the necessary bits to get it to boot correctly, although it may
7768: lack important functionality for daily operation. The idea behind this
7769: package is to let end users build their own configurations on top of this
7770: one, first installing this meta package to achieve a functional setup and
7771: then adding individual applications.
7772:
7773: * meta-pkgs/gnome: Provides a complete installation of the GNOME platform and
7774: desktop as defined by the GNOME project; this is based on the components
7775: distributed in the platform/x.y/x.y.z/sources and desktop/x.y/x.y.z/sources
7776: directories of the official FTP server. Developer-only tools found in those
7777: directories are not installed unless required by some other component to
7778: work properly. Similarly, packages from the bindings set (bindings/x.y/
7779: x.y.z/sources) are not pulled in unless required as a dependency for an
7780: end-user component. This package "extends" meta-pkgs/gnome-base.
7781:
7782: * meta-pkgs/gnome-devel: Installs all the tools required to build a GNOME
7783: component when fetched from the CVS repository. These are required to let
7784: the autogen.sh scripts work appropriately.
7785:
7786: In all these packages, the DEPENDS lines are sorted in a way that eases
7787: updates: a package may depend on other packages listed before it but not on any
7788: listed after it. It is very important to keep this order to ease updates so...
7789: do not change it to alphabetical sorting!
7790:
7791: 22.2. Packaging a GNOME application
7792:
7793: Almost all GNOME applications are written in C and use a common set of tools as
7794: their build system. Things get different with the new bindings to other
7795: languages (such as Python), but the following will give you a general idea on
7796: the minimum required tools:
7797:
7798: * Almost all GNOME applications use the GNU Autotools as their build system.
7799: As a general rule you will need to tell this to your package:
7800:
7801: GNU_CONFIGURE=yes
7802: USE_LIBTOOL=yes
7803: USE_TOOLS+=gmake
7804:
7805: * If the package uses pkg-config to detect dependencies, add this tool to the
7806: list of required utilities:
7807:
7808: USE_TOOLS+=pkg-config
7809:
7810: Also use pkgtools/verifypc at the end of the build process to ensure that
7811: you did not miss to specify any dependency in your package and that the
7812: version requirements are all correct.
7813:
7814: * If the package uses intltool, be sure to add intltool to the USE_TOOLS to
7815: handle dependencies and to force the package to use the latest available
7816: version.
7817:
7818: * If the package uses gtk-doc (a documentation generation utility), do not
7819: add a dependency on it. The tool is rather big and the distfile should come
7820: with pregenerated documentation anyway; if it does not, it is a bug that
7821: you ought to report. For such packages you should disable gtk-doc (unless
7822: it is the default):
7823:
7824: CONFIGURE_ARGS+=--disable-gtk-doc
7825:
7826: The default location of installed HTML files (share/gtk-doc/<package-name>)
7827: is correct and should not be changed unless the package insists on
7828: installing them somewhere else. Otherwise programs as devhelp will not be
7829: able to open them. You can do that with an entry similar to:
1.1 dsieger 7830:
1.184 rillig 7831: CONFIGURE_ARGS+=--with-html-dir=${PREFIX}/share/gtk-doc/...
1.1 dsieger 7832:
1.184 rillig 7833: GNOME uses multiple shared directories and files under the installation prefix
7834: to maintain databases. In this context, shared means that those exact same
7835: directories and files are used among several different packages, leading to
7836: conflicts in the PLIST. pkgsrc currently includes functionality to handle the
7837: most common cases, so you have to forget about using @unexec ${RMDIR} lines in
7838: your file lists and omitting shared files from them. If you find yourself doing
7839: those, your package is most likely incorrect.
1.1 dsieger 7840:
1.184 rillig 7841: The following table lists the common situations that result in using shared
7842: directories or files. For each of them, the appropriate solution is given.
7843: After applying the solution be sure to regenerate the package's file list with
7844: make print-PLIST and ensure it is correct.
1.1 dsieger 7845:
1.184 rillig 7846: Table 22.1. PLIST handling for GNOME packages
1.1 dsieger 7847:
1.184 rillig 7848: +-----------------------------------------------------------------------------+
7849: | If the package... | Then... |
7850: |-------------------------------------------+---------------------------------|
7851: | |See Section 21.6.10, "Packages |
7852: |Installs OMF files under share/omf. |installing scrollkeeper/rarian |
7853: | |data files". |
7854: |-------------------------------------------+---------------------------------|
7855: |Installs icons under the share/icons/ |See Section 21.6.19, "Packages |
7856: |hicolor hierarchy or updates share/icons/ |installing hicolor theme icons". |
7857: |hicolor/icon-theme.cache. | |
7858: |-------------------------------------------+---------------------------------|
7859: | |See Section 21.6.14, "Packages |
7860: |Installs files under share/mime/packages. |installing extensions to the MIME|
7861: | |database". |
7862: |-------------------------------------------+---------------------------------|
7863: |Installs .desktop files under share/ |See Section 21.6.20, "Packages |
7864: |applications and these include MIME |installing desktop files". |
7865: |information. | |
7866: +-----------------------------------------------------------------------------+
1.1 dsieger 7867:
7868:
1.184 rillig 7869: 22.3. Updating GNOME to a newer version
1.1 dsieger 7870:
1.184 rillig 7871: When seeing GNOME as a whole, there are two kinds of updates:
1.1 dsieger 7872:
1.184 rillig 7873: Major update
1.1 dsieger 7874:
1.184 rillig 7875: Given that there is still a very long way for GNOME 3 (if it ever appears),
7876: we consider a major update one that goes from a 2.X version to a 2.Y one,
7877: where Y is even and greater than X. These are hard to achieve because they
7878: introduce lots of changes in the components' code and almost all GNOME
7879: distfiles are updated to newer versions. Some of them can even break API
7880: and ABI compatibility with the previous major version series. As a result,
7881: the update needs to be done all at once to minimize breakage.
1.1 dsieger 7882:
1.184 rillig 7883: A major update typically consists of around 80 package updates and the
7884: addition of some new ones.
1.1 dsieger 7885:
1.184 rillig 7886: Minor update
1.1 dsieger 7887:
1.184 rillig 7888: We consider a minor update one that goes from a 2.A.X version to a 2.A.Y
7889: one where Y is greater than X. These are easy to achieve because they do
7890: not update all GNOME components, can be done in an incremental way and do
7891: not break API nor ABI compatibility.
1.1 dsieger 7892:
1.184 rillig 7893: A minor update typically consists of around 50 package updates, although
7894: the numbers here may vary a lot.
1.1 dsieger 7895:
1.184 rillig 7896: In order to update the GNOME components in pkgsrc to a new stable release
7897: (either major or minor), the following steps should be followed:
1.1 dsieger 7898:
1.184 rillig 7899: 1. Get a list of all the tarballs that form the new release by using the
7900: following commands. These will leave the full list of the components'
7901: distfiles into the list.txt file:
1.1 dsieger 7902:
1.184 rillig 7903: % echo ls "*.tar.bz2" | \
7904: ftp -V ftp://ftp.gnome.org/pub/gnome/platform/x.y/x.y.z/sources/ | \
7905: awk '{ print $9 }' >list.txt
7906: % echo ls "*.tar.bz2" | \
7907: ftp -V ftp://ftp.gnome.org/pub/gnome/desktop/x.y/x.y.z/sources/ | \
7908: awk '{ print $9 }' >>list.txt
1.1 dsieger 7909:
1.184 rillig 7910: 2. Open each meta package's Makefile and bump their version to the release you
7911: are updating them to. The three meta packages should be always consistent
7912: with versioning. Obviously remove any PKGREVISIONs that might be in them.
1.1 dsieger 7913:
1.184 rillig 7914: 3. For each meta package, update all its DEPENDS lines to match the latest
7915: versions as shown by the above commands. Do not list any newer version
7916: (even if found in the FTP) because the meta packages are supposed to list
7917: the exact versions that form a specific GNOME release. Exceptions are
7918: permitted here if a newer version solves a serious issue in the overall
7919: desktop experience; these typically come in the form of a revision bump in
7920: pkgsrc, not in newer versions from the developers.
1.1 dsieger 7921:
1.184 rillig 7922: Packages not listed in the list.txt file should be updated to the latest
7923: version available (if found in pkgsrc). This is the case, for example, of
7924: the dependencies on the GNU Autotools in the meta-pkgs/gnome-devel meta
7925: package.
1.1 dsieger 7926:
1.184 rillig 7927: 4. Generate a patch from the modified meta packages and extract the list of
7928: "new" lines. This will provide you an outline on what packages need to be
7929: updated in pkgsrc and in what order:
1.1 dsieger 7930:
1.184 rillig 7931: % cvs diff -u gnome-devel gnome-base gnome | grep '^+D' >todo.txt
1.1 dsieger 7932:
1.184 rillig 7933: 5. For major desktop updates it is recommended to zap all your installed
7934: packages and start over from scratch at this point.
1.1 dsieger 7935:
1.184 rillig 7936: 6. Now comes the longest step by far: iterate over the contents of todo.txt
7937: and update the packages listed in it in order. For major desktop updates
7938: none of these should be committed until the entire set is completed because
7939: there are chances of breaking not-yet-updated packages.
1.1 dsieger 7940:
1.184 rillig 7941: 7. Once the packages are up to date and working, commit them to the tree one
7942: by one with appropriate log messages. At the end, commit the three meta
7943: package updates and all the corresponding changes to the doc/CHANGES-<YEAR>
7944: and pkgsrc/doc/TODO files.
1.1 dsieger 7945:
1.184 rillig 7946: 22.4. Patching guidelines
1.1 dsieger 7947:
1.184 rillig 7948: GNOME is a very big component in pkgsrc which approaches 100 packages. Please,
7949: it is very important that you always, always, always feed back any portability
7950: fixes you do to a GNOME package to the mainstream developers (see
7951: Section 12.3.5, "Feedback to the author"). This is the only way to get their
7952: attention on portability issues and to ensure that future versions can be built
7953: out-of-the box on NetBSD. The less custom patches in pkgsrc, the easier further
7954: updates are. Those developers in charge of issuing major GNOME updates will be
7955: grateful if you do that.
1.1 dsieger 7956:
1.200 cirnatda 7957: The most common places to report bugs are the GNOME's GitLab and the
7958: freedesktop.org's GitLab. Not all components use these to track bugs, but most
7959: of them do. Do not be short on your reports: always provide detailed
1.184 rillig 7960: explanations of the current failure, how it can be improved to achieve maximum
1.200 cirnatda 7961: portability and, if at all possible, provide a patch against the main Git
7962: branch. The more verbose you are, the higher chances of your patch being
7963: accepted.
1.1 dsieger 7964:
1.184 rillig 7965: Also, please avoid using preprocessor magic to fix portability issues. While
7966: the FreeBSD GNOME people are doing a great job in porting GNOME to their
7967: operating system, the official GNOME sources are now plagued by conditionals
7968: that check for __FreeBSD__ and similar macros. This hurts portability. Please
7969: see our patching guidelines (Section 12.3.4, "Patching guidelines") for more
7970: details.
1.1 dsieger 7971:
1.154 rillig 7972: Chapter 23. Submitting and Committing
1.1 dsieger 7973:
7974: Table of Contents
7975:
1.154 rillig 7976: 23.1. Submitting binary packages
7977: 23.2. Submitting source packages (for non-NetBSD-developers)
7978: 23.3. General notes when adding, updating, or removing packages
7979: 23.4. Commit Messages
7980: 23.5. Committing: Adding a package to CVS
7981: 23.6. Updating a package to a newer version
7982: 23.7. Renaming a package in pkgsrc
7983: 23.8. Moving a package in pkgsrc
1.1 dsieger 7984:
1.154 rillig 7985: 23.1. Submitting binary packages
1.1 dsieger 7986:
7987: Our policy is that we accept binaries only from pkgsrc developers to guarantee
7988: that the packages don't contain any trojan horses etc. This is not to annoy
7989: anyone but rather to protect our users! You're still free to put up your
7990: home-made binary packages and tell the world where to get them. NetBSD
1.154 rillig 7991: developers doing bulk builds and wanting to upload them please see Chapter 8,
1.66 asau 7992: Creating binary packages for everything in pkgsrc (bulk builds).
1.1 dsieger 7993:
1.154 rillig 7994: 23.2. Submitting source packages (for non-NetBSD-developers)
1.1 dsieger 7995:
7996: First, check that your package is complete, compiles and runs well; see
1.184 rillig 7997: Chapter 14, Creating a new pkgsrc package from scratch and the rest of this
7998: document. Next, generate an uuencoded gzipped tar(1) archive that contains all
7999: files that make up the package. Finally, send this package to the pkgsrc bug
8000: tracking system, either with the send-pr(1) command, or if you don't have that,
8001: go to the web page https://www.NetBSD.org/support/send-pr.html, which contains
8002: some instructions and a link to a form where you can submit packages. The
8003: sysutils/gtk-send-pr package is also available as a substitute for either of
8004: the above two tools.
1.1 dsieger 8005:
8006: In the form of the problem report, the category should be "pkg", the synopsis
8007: should include the package name and version number, and the description field
8008: should contain a short description of your package (contents of the COMMENT
1.25 wiz 8009: variable or DESCR file are OK). The uuencoded package data should go into the "
8010: fix" field.
1.1 dsieger 8011:
8012: If you want to submit several packages, please send a separate PR for each one,
8013: it's easier for us to track things that way.
8014:
8015: Alternatively, you can also import new packages into pkgsrc-wip ("pkgsrc
1.174 leot 8016: work-in-progress"); see the homepage at https://pkgsrc.org/wip/ for details.
1.1 dsieger 8017:
1.154 rillig 8018: 23.3. General notes when adding, updating, or removing packages
1.1 dsieger 8019:
8020: Please note all package additions, updates, moves, and removals in pkgsrc/doc/
8021: CHANGES-YYYY. It's very important to keep this file up to date and conforming
8022: to the existing format, because it will be used by scripts to automatically
8023: update pages on www.NetBSD.org and other sites. Additionally, check the pkgsrc/
8024: doc/TODO file and remove the entry for the package you updated or removed, in
8025: case it was mentioned there.
8026:
8027: When the PKGREVISION of a package is bumped, the change should appear in pkgsrc
8028: /doc/CHANGES-YYYY if it is security related or otherwise relevant. Mass bumps
8029: that result from a dependency being updated should not be mentioned. In all
8030: other cases it's the developer's decision.
8031:
8032: There is a make target that helps in creating proper CHANGES-YYYY entries: make
8033: changes-entry. It uses the optional CTYPE and NETBSD_LOGIN_NAME variables. The
8034: general usage is to first make sure that your CHANGES-YYYY file is up-to-date
8035: (to avoid having to resolve conflicts later-on) and then to cd to the package
8036: directory. For package updates, make changes-entry is enough. For new packages,
8037: or package moves or removals, set the CTYPE variable on the command line to
1.4 rillig 8038: "Added", "Moved", or "Removed". You can set NETBSD_LOGIN_NAME in mk.conf if
1.23 jakllsch 8039: your local login name is not the same as your NetBSD login name. The target
8040: also automatically removes possibly existing entries for the package in the
8041: TODO file. Don't forget to commit the changes, e.g. by using make
1.66 asau 8042: commit-changes-entry! If you are not using a checkout directly from
1.23 jakllsch 8043: cvs.NetBSD.org, but e.g. a local copy of the repository, you can set
8044: USE_NETBSD_REPO=yes. This makes the cvs commands use the main repository.
1.1 dsieger 8045:
1.154 rillig 8046: 23.4. Commit Messages
1.130 wiz 8047:
8048: For several years, there have been mirrors of pkgsrc in fossil, git, and hg.
8049: Standard practise when using these tools is to make the first line of a commit
8050: message function as a summary that can be read without the rest, such as is
8051: commonly done with "git log --oneline". For this reason, we have the following
8052: guidelines for pkgsrc commit messages:
8053:
1.131 wiz 8054: * Start the commit message with a line that explains the big picture in 65
1.130 wiz 8055: characters or less. When a commit is for one package, include the name of
8056: the package. For updates, include the version to which it is updated.
8057:
8058: * Leave the next line empty.
8059:
8060: * Then come the details for the commit (changes in that package, reason for a
8061: change) and any relevant PRs. Wrap this section.
8062:
8063: Here is an example:
8064:
8065: libxslt: update to 1.0.30
8066:
8067: Changes since 1.0.29:
8068: ...
8069:
8070:
8071: Here is another example:
8072:
8073: mk/bsd.pkg.mk: enable SSP by default on NetBSD
8074:
8075: (rationale)
8076:
8077:
8078: Commit messages are final: no "cvs admin" is allowed on the pkgsrc repository
8079: to change commit messages.
8080:
1.154 rillig 8081: 23.5. Committing: Adding a package to CVS
1.1 dsieger 8082:
8083: This section is only of interest for pkgsrc developers with write access to the
1.34 wiz 8084: pkgsrc repository.
8085:
8086: When the package is finished, "cvs add" the files. Start by adding the
8087: directory and then files in the directory. Don't forget to add the new package
8088: to the category's Makefile. Make sure you don't forget any files; you can check
8089: by running "cvs status". An example:
8090:
8091: $ cd .../pkgsrc/category
8092: $ cvs add pkgname
8093: $ cd pkgname
8094: $ cvs add DESCR Makefile PLIST distinfo buildlink3.mk patches
8095: $ cvs add patches/p*
8096: $ cvs status | less
1.35 wiz 8097: $ cvs commit
1.34 wiz 8098: $ cd ..
8099: $ vi Makefile # add SUBDIRS+=pkgname line
1.35 wiz 8100: $ cvs commit Makefile
1.66 asau 8101: $ cd pkgname
1.73 jnemeth 8102: $ make CTYPE=Added commit-changes-entry
1.1 dsieger 8103:
8104: The commit message of the initial import should include part of the DESCR file,
8105: so people reading the mailing lists know what the package is/does.
8106:
1.34 wiz 8107: Also mention the new package in pkgsrc/doc/CHANGES-20xx.
8108:
8109: Previously, "cvs import" was suggested, but it was much easier to get wrong
8110: than "cvs add".
1.1 dsieger 8111:
1.154 rillig 8112: 23.6. Updating a package to a newer version
1.1 dsieger 8113:
8114: Please always put a concise, appropriate and relevant summary of the changes
8115: between old and new versions into the commit log when updating a package. There
8116: are various reasons for this:
8117:
8118: * A URL is volatile, and can change over time. It may go away completely or
8119: its information may be overwritten by newer information.
8120:
8121: * Having the change information between old and new versions in our CVS
8122: repository is very useful for people who use either cvs or anoncvs.
8123:
8124: * Having the change information between old and new versions in our CVS
8125: repository is very useful for people who read the pkgsrc-changes mailing
8126: list, so that they can make tactical decisions about when to upgrade the
8127: package.
8128:
8129: Please also recognize that, just because a new version of a package has been
8130: released, it should not automatically be upgraded in the CVS repository. We
8131: prefer to be conservative in the packages that are included in pkgsrc -
8132: development or beta packages are not really the best thing for most places in
8133: which pkgsrc is used. Please use your judgement about what should go into
8134: pkgsrc, and bear in mind that stability is to be preferred above new and
8135: possibly untested features.
8136:
1.154 rillig 8137: 23.7. Renaming a package in pkgsrc
1.21 snj 8138:
8139: Renaming packages is not recommended.
8140:
1.175 gutterid 8141: When renaming packages, be sure to fix any references to the old name in other
1.21 snj 8142: Makefiles, options, buildlink files, etc.
8143:
1.175 gutterid 8144: Also, when renaming a package, please add the package name and version pattern
1.167 leot 8145: (s) of the previous package to SUPERSEDES. This may be repeated for multiple
8146: renames. The new package would be an exact replacement. Example:
8147:
8148: SUPERSEDES+= p5-IO-Compress-Zlib<2.017
8149: SUPERSEDES+= optcomp-[0-9]*
1.21 snj 8150:
8151: Note that "successor" in the CHANGES-YYYY file doesn't necessarily mean that it
8152: supersedes, as that successor may not be an exact replacement but is a
8153: suggestion for the replaced functionality.
8154:
1.154 rillig 8155: 23.8. Moving a package in pkgsrc
1.21 snj 8156:
8157: It is preferred that packages are not renamed or moved, but if needed please
8158: follow these steps.
1.1 dsieger 8159:
8160: 1. Make a copy of the directory somewhere else.
8161:
8162: 2. Remove all CVS dirs.
8163:
8164: Alternatively to the first two steps you can also do:
8165:
8166: % cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package
8167:
8168: and use that for further work.
8169:
1.25 wiz 8170: 3. Fix CATEGORIES and any DEPENDS paths that just did "../package" instead of
1.1 dsieger 8171: "../../category/package".
8172:
1.21 snj 8173: 4. In the modified package's Makefile, consider setting PREV_PKGPATH to the
8174: previous category/package pathname. The PREV_PKGPATH can be used by tools
8175: for doing an update using pkgsrc building; for example, it can search the
8176: pkg_summary(5) database for PREV_PKGPATH (if no SUPERSEDES) and then use
8177: the corresponding new PKGPATH for that moved package. Note that it may have
8178: multiple matches, so the tool should also check on the PKGBASE too. The
8179: PREV_PKGPATH probably has no value unless SUPERSEDES is not set, i.e.
8180: PKGBASE stays the same.
8181:
8182: 5. cvs import the modified package in the new place.
1.1 dsieger 8183:
1.21 snj 8184: 6. Check if any package depends on it:
1.1 dsieger 8185:
8186: % cd /usr/pkgsrc
8187: % grep /package */*/Makefile* */*/buildlink*
8188:
1.21 snj 8189: 7. Fix paths in packages from step 5 to point to new location.
1.1 dsieger 8190:
1.21 snj 8191: 8. cvs rm (-f) the package at the old location.
1.1 dsieger 8192:
1.21 snj 8193: 9. Remove from oldcategory/Makefile.
1.1 dsieger 8194:
1.21 snj 8195: 10. Add to newcategory/Makefile.
1.1 dsieger 8196:
1.21 snj 8197: 11. Commit the changed and removed files:
1.1 dsieger 8198:
8199: % cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile
8200:
8201: (and any packages from step 5, of course).
8202:
1.154 rillig 8203: Chapter 24. Frequently Asked Questions
1.1 dsieger 8204:
8205: This section contains the answers to questions that may arise when you are
8206: writing a package. If you don't find your question answered here, first have a
8207: look in the other chapters, and if you still don't have the answer, ask on the
8208: pkgsrc-users mailing list.
8209:
1.154 rillig 8210: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
8211: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
8212: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
8213: 24.4. What is the difference between BUILDLINK_LDFLAGS, BUILDLINK_LDADD and
1.1 dsieger 8214: BUILDLINK_LIBS?
1.154 rillig 8215: 24.5. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
8216: 24.6. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.1 dsieger 8217: the := inside it.
1.154 rillig 8218: 24.7. Which mailing lists are there for package developers?
8219: 24.8. Where is the pkgsrc documentation?
8220: 24.9. I have a little time to kill. What shall I do?
1.1 dsieger 8221:
1.154 rillig 8222: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
1.1 dsieger 8223:
8224: MAKEFLAGS are the flags passed to the pkgsrc-internal invocations of make
8225: (1), while MAKE_FLAGS are the flags that are passed to the MAKE_PROGRAM
8226: when building the package. [FIXME: What is .MAKEFLAGS for?]
8227:
1.154 rillig 8228: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
1.1 dsieger 8229:
8230: MAKE is the path to the make(1) program that is used in the pkgsrc
8231: infrastructure. GMAKE is the path to GNU Make, but you need to say
8232: USE_TOOLS+=gmake to use that. MAKE_PROGRAM is the path to the Make
8233: program that is used for building the package.
8234:
1.154 rillig 8235: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
1.1 dsieger 8236:
8237: CC is the path to the real C compiler, which can be configured by the
8238: pkgsrc user. PKG_CC is the path to the compiler wrapper. PKGSRC_COMPILER
8239: is not a path to a compiler, but the type of compiler that should be
8240: used. See mk/compiler.mk for more information about the latter variable.
8241:
1.154 rillig 8242: 24.4. What is the difference between BUILDLINK_LDFLAGS, BUILDLINK_LDADD and
1.1 dsieger 8243: BUILDLINK_LIBS?
8244:
8245: [FIXME]
8246:
1.154 rillig 8247: 24.5. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
1.1 dsieger 8248:
1.25 wiz 8249: For optimization reasons, some variables are only available in the "
8250: wrapper" phase and later. To "simulate" the wrapper phase, append
1.1 dsieger 8251: PKG_PHASE=wrapper to the above command.
8252:
1.154 rillig 8253: 24.6. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.1 dsieger 8254: the := inside it.
8255:
1.108 rillig 8256: The := is not really an assignment operator, although it looks like it.
8257: Instead, it is a degenerate form of ${LIST:old_string=new_string}, which
8258: is documented in the make(1) man page and which is commonly used in the
8259: form ${SRCS:.c=.o}. In the case of MASTER_SITE_*, old_string is the empty
8260: string and new_string is package/. That's where the : and the = fall
8261: together.
1.1 dsieger 8262:
1.154 rillig 8263: 24.7. Which mailing lists are there for package developers?
1.1 dsieger 8264:
8265: tech-pkg
8266:
8267: This is a list for technical discussions related to pkgsrc
8268: development, e.g. soliciting feedback for changes to pkgsrc
8269: infrastructure, proposed new features, questions related to porting
8270: pkgsrc to a new platform, advice for maintaining a package, patches
8271: that affect many packages, help requests moved from pkgsrc-users when
8272: an infrastructure bug is found, etc.
8273:
8274: pkgsrc-bugs
8275:
8276: All bug reports in category "pkg" sent with send-pr(1) appear here.
8277: Please do not report your bugs here directly; use one of the other
8278: mailing lists.
8279:
1.154 rillig 8280: 24.8. Where is the pkgsrc documentation?
1.1 dsieger 8281:
8282: There are many places where you can find documentation about pkgsrc:
8283:
8284: * The pkgsrc guide (this document) is a collection of chapters that
8285: explain large parts of pkgsrc, but some chapters tend to be outdated.
8286: Which ones they are is hard to say.
8287:
1.174 leot 8288: * On the mailing list archives (see https://mail-index.NetBSD.org/),
8289: you can find discussions about certain features, announcements of new
1.1 dsieger 8290: parts of the pkgsrc infrastructure and sometimes even announcements
8291: that a certain feature has been marked as obsolete. The benefit here
8292: is that each message has a date appended to it.
8293:
8294: * Many of the files in the mk/ directory start with a comment that
8295: describes the purpose of the file and how it can be used by the
8296: pkgsrc user and package authors. An easy way to find this
8297: documentation is to run bmake help.
8298:
8299: * The CVS log messages are a rich source of information, but they tend
8300: to be highly abbreviated, especially for actions that occur often.
8301: Some contain a detailed description of what has changed, but they are
8302: geared towards the other pkgsrc developers, not towards an average
8303: pkgsrc user. They also only document changes, so if you don't know
8304: what has been before, these messages may not be worth too much to
8305: you.
8306:
8307: * Some parts of pkgsrc are only "implicitly documented", that is the
8308: documentation exists only in the mind of the developer who wrote the
8309: code. To get this information, use the cvs annotate command to see
8310: who has written it and ask on the tech-pkg mailing list, so that
8311: others can find your questions later (see above). To be sure that the
8312: developer in charge reads the mail, you may CC him or her.
8313:
1.154 rillig 8314: 24.9. I have a little time to kill. What shall I do?
1.1 dsieger 8315:
8316: This is not really an FAQ yet, but here's the answer anyway.
8317:
8318: * Run pkg_chk -N (from the pkgtools/pkg_chk package). It will tell you
8319: about newer versions of installed packages that are available, but
8320: not yet updated in pkgsrc.
8321:
1.198 leot 8322: * Browse pkgsrc/doc/TODO -- it contains a list of suggested new
8323: packages and a list of cleanups and enhancements for pkgsrc that
8324: would be nice to have.
1.1 dsieger 8325:
1.71 wiz 8326: * Review packages for which review was requested on the tech-pkg
8327: mailing list.
1.1 dsieger 8328:
8329: Part III. The pkgsrc infrastructure internals
8330:
8331: This part of the guide deals with everything from the infrastructure that is
8332: behind the interfaces described in the developer's guide. A casual package
8333: maintainer should not need anything from this part.
8334:
8335: Table of Contents
8336:
1.184 rillig 8337: 25. Design of the pkgsrc infrastructure
1.1 dsieger 8338:
1.184 rillig 8339: 25.1. The meaning of variable definitions
8340: 25.2. Avoiding problems before they arise
8341: 25.3. Variable evaluation
1.1 dsieger 8342:
1.184 rillig 8343: 25.3.1. At load time
8344: 25.3.2. At runtime
1.1 dsieger 8345:
1.184 rillig 8346: 25.4. How can variables be specified?
8347: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8348:
1.184 rillig 8349: 25.5.1. Procedures with parameters
8350: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8351:
1.184 rillig 8352: 25.6. The order in which files are loaded
1.1 dsieger 8353:
1.184 rillig 8354: 25.6.1. The order in bsd.prefs.mk
8355: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8356:
1.184 rillig 8357: 26. Regression tests
1.1 dsieger 8358:
1.184 rillig 8359: 26.1. Running the regression tests
8360: 26.2. Adding a new regression test
1.1 dsieger 8361:
1.184 rillig 8362: 26.2.1. Overridable functions
8363: 26.2.2. Helper functions
1.1 dsieger 8364:
1.184 rillig 8365: 27. Porting pkgsrc
1.1 dsieger 8366:
1.184 rillig 8367: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8368:
1.184 rillig 8369: Chapter 25. Design of the pkgsrc infrastructure
1.1 dsieger 8370:
8371: Table of Contents
8372:
1.184 rillig 8373: 25.1. The meaning of variable definitions
8374: 25.2. Avoiding problems before they arise
8375: 25.3. Variable evaluation
1.1 dsieger 8376:
1.184 rillig 8377: 25.3.1. At load time
8378: 25.3.2. At runtime
1.1 dsieger 8379:
1.184 rillig 8380: 25.4. How can variables be specified?
8381: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8382:
1.184 rillig 8383: 25.5.1. Procedures with parameters
8384: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8385:
1.184 rillig 8386: 25.6. The order in which files are loaded
1.1 dsieger 8387:
1.184 rillig 8388: 25.6.1. The order in bsd.prefs.mk
8389: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8390:
8391: The pkgsrc infrastructure consists of many small Makefile fragments. Each such
8392: fragment needs a properly specified interface. This chapter explains how such
8393: an interface looks like.
8394:
1.184 rillig 8395: 25.1. The meaning of variable definitions
1.1 dsieger 8396:
8397: Whenever a variable is defined in the pkgsrc infrastructure, the location and
8398: the way of definition provide much information about the intended use of that
8399: variable. Additionally, more documentation may be found in a header comment or
8400: in this pkgsrc guide.
8401:
8402: A special file is mk/defaults/mk.conf, which lists all variables that are
8403: intended to be user-defined. They are either defined using the ?= operator or
8404: they are left undefined because defining them to anything would effectively
8405: mean "yes". All these variables may be overridden by the pkgsrc user in the
8406: MAKECONF file.
8407:
8408: Outside this file, the following conventions apply: Variables that are defined
8409: using the ?= operator may be overridden by a package.
8410:
8411: Variables that are defined using the = operator may be used read-only at
8412: run-time.
8413:
8414: Variables whose name starts with an underscore must not be accessed outside the
8415: pkgsrc infrastructure at all. They may change without further notice.
8416:
8417: Note
8418:
8419: These conventions are currently not applied consistently to the complete pkgsrc
8420: infrastructure.
8421:
1.184 rillig 8422: 25.2. Avoiding problems before they arise
1.1 dsieger 8423:
8424: All variables that contain lists of things should default to being empty. Two
8425: examples that do not follow this rule are USE_LANGUAGES and DISTFILES. These
8426: variables cannot simply be modified using the += operator in package Makefiles
8427: (or other files included by them), since there is no guarantee whether the
8428: variable is already set or not, and what its value is. In the case of
8429: DISTFILES, the packages "know" the default value and just define it as in the
8430: following example.
8431:
8432: DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
8433:
8434: Because of the selection of this default value, the same value appears in many
8435: package Makefiles. Similarly for USE_LANGUAGES, but in this case the default
8436: value ("c") is so short that it doesn't stand out. Nevertheless it is mentioned
8437: in many files.
8438:
1.184 rillig 8439: 25.3. Variable evaluation
1.1 dsieger 8440:
1.184 rillig 8441: 25.3.1. At load time
1.1 dsieger 8442:
8443: Variable evaluation takes place either at load time or at runtime, depending on
8444: the context in which they occur. The contexts where variables are evaluated at
8445: load time are:
8446:
8447: * The right hand side of the := and != operators,
8448:
8449: * Make directives like .if or .for,
8450:
8451: * Dependency lines.
8452:
8453: A special exception are references to the iteration variables of .for loops,
8454: which are expanded inline, no matter in which context they appear.
8455:
8456: As the values of variables may change during load time, care must be taken not
8457: to evaluate them by accident. Typical examples for variables that should not be
8458: evaluated at load time are DEPENDS and CONFIGURE_ARGS. To make the effect more
8459: clear, here is an example:
8460:
8461: CONFIGURE_ARGS= # none
8462: CFLAGS= -O
8463: CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
8464:
8465: CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
8466:
8467: CFLAGS+= -Wall
8468:
8469: This code shows how the use of the := operator can quickly lead to unexpected
8470: results. The first paragraph is fairly common code. The second paragraph
8471: evaluates the CONFIGURE_ARGS variable, which results in CFLAGS=-O. In the third
8472: paragraph, the -Wall is appended to the CFLAGS, but this addition will not
8473: appear in CONFIGURE_ARGS. In actual code, the three paragraphs from above
8474: typically occur in completely unrelated files.
8475:
1.184 rillig 8476: 25.3.2. At runtime
1.1 dsieger 8477:
8478: After all the files have been loaded, the values of the variables cannot be
8479: changed anymore. Variables that are used in the shell commands are expanded at
8480: this point.
8481:
1.184 rillig 8482: 25.4. How can variables be specified?
1.1 dsieger 8483:
8484: There are many ways in which the definition and use of a variable can be
8485: restricted in order to detect bugs and violations of the (mostly unwritten)
1.108 rillig 8486: policies. A package can be checked with pkglint -Wall to see whether it meets
8487: these rules.
1.1 dsieger 8488:
1.184 rillig 8489: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8490:
8491: Most of the .mk files fall into one of the following classes. Cases where a
8492: file falls into more than one class should be avoided as it often leads to
8493: subtle bugs.
8494:
1.184 rillig 8495: 25.5.1. Procedures with parameters
1.1 dsieger 8496:
8497: In a traditional imperative programming language some of the .mk files could be
1.198 leot 8498: described as procedures. They take some input parameters and--after
8499: inclusion--provide a result in output parameters. Since all variables in
1.23 jakllsch 8500: Makefiles have global scope care must be taken not to use parameter names that
8501: have already another meaning. For example, PKGNAME is a bad choice for a
8502: parameter name.
1.1 dsieger 8503:
8504: Procedures are completely evaluated at preprocessing time. That is, when
8505: calling a procedure all input parameters must be completely resolvable. For
8506: example, CONFIGURE_ARGS should never be an input parameter since it is very
8507: likely that further text will be added after calling the procedure, which would
8508: effectively apply the procedure to only a part of the variable. Also,
1.108 rillig 8509: references to other variables will be modified after calling the procedure.
1.1 dsieger 8510:
8511: A procedure can declare its output parameters either as suitable for use in
8512: preprocessing directives or as only available at runtime. The latter
8513: alternative is for variables that contain references to other runtime
8514: variables.
8515:
8516: Procedures shall be written such that it is possible to call the procedure more
8517: than once. That is, the file must not contain multiple-inclusion guards.
8518:
8519: Examples for procedures are mk/bsd.options.mk and mk/buildlink3/bsd.builtin.mk.
8520: To express that the parameters are evaluated at load time, they should be
8521: assigned using the := operator, which should be used only for this purpose.
8522:
1.184 rillig 8523: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8524:
8525: Action files take some input parameters and may define runtime variables. They
8526: shall not define loadtime variables. There are action files that are included
8527: implicitly by the pkgsrc infrastructure, while other must be included
8528: explicitly.
8529:
8530: An example for action files is mk/subst.mk.
8531:
1.184 rillig 8532: 25.6. The order in which files are loaded
1.1 dsieger 8533:
8534: Package Makefiles usually consist of a set of variable definitions, and include
8535: the file ../../mk/bsd.pkg.mk in the very last line. Before that, they may also
8536: include various other *.mk files if they need to query the availability of
8537: certain features like the type of compiler or the X11 implementation. Due to
8538: the heavy use of preprocessor directives like .if and .for, the order in which
8539: the files are loaded matters.
8540:
8541: This section describes at which point the various files are loaded and gives
8542: reasons for that order.
8543:
1.184 rillig 8544: 25.6.1. The order in bsd.prefs.mk
1.1 dsieger 8545:
8546: The very first action in bsd.prefs.mk is to define some essential variables
8547: like OPSYS, OS_VERSION and MACHINE_ARCH.
8548:
1.4 rillig 8549: Then, the user settings are loaded from the file specified in MAKECONF, which
8550: is usually mk.conf. After that, those variables that have not been overridden
8551: by the user are loaded from mk/defaults/mk.conf.
1.1 dsieger 8552:
8553: After the user settings, the system settings and platform settings are loaded,
8554: which may override the user settings.
8555:
8556: Then, the tool definitions are loaded. The tool wrappers are not yet in effect.
8557: This only happens when building a package, so the proper variables must be used
8558: instead of the direct tool names.
8559:
8560: As the last steps, some essential variables from the wrapper and the package
8561: system flavor are loaded, as well as the variables that have been cached in
8562: earlier phases of a package build.
8563:
1.184 rillig 8564: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8565:
8566: First, bsd.prefs.mk is loaded.
8567:
8568: Then, the various *-vars.mk files are loaded, which fill default values for
8569: those variables that have not been defined by the package. These variables may
8570: later be used even in unrelated files.
8571:
8572: Then, the file bsd.pkg.error.mk provides the target error-check that is added
8573: as a special dependency to all other targets that use DELAYED_ERROR_MSG or
8574: DELAYED_WARNING_MSG.
8575:
8576: Then, the package-specific hacks from hacks.mk are included.
8577:
8578: Then, various other files follow. Most of them don't have any dependencies on
8579: what they need to have included before or after them, though some do.
8580:
8581: The code to check PKG_FAIL_REASON and PKG_SKIP_REASON is then executed, which
8582: restricts the use of these variables to all the files that have been included
8583: before. Appearances in later files will be silently ignored.
8584:
8585: Then, the files for the main targets are included, in the order of later
8586: execution, though the actual order should not matter.
8587:
8588: At last, some more files are included that don't set any interesting variables
8589: but rather just define make targets to be executed.
8590:
1.184 rillig 8591: Chapter 26. Regression tests
1.1 dsieger 8592:
8593: Table of Contents
8594:
1.184 rillig 8595: 26.1. Running the regression tests
8596: 26.2. Adding a new regression test
1.1 dsieger 8597:
1.184 rillig 8598: 26.2.1. Overridable functions
8599: 26.2.2. Helper functions
1.1 dsieger 8600:
8601: The pkgsrc infrastructure consists of a large codebase, and there are many
8602: corners where every little bit of a file is well thought out, making pkgsrc
8603: likely to fail as soon as anything is changed near those parts. To prevent most
8604: changes from breaking anything, a suite of regression tests should go along
8605: with every important part of the pkgsrc infrastructure. This chapter describes
8606: how regression tests work in pkgsrc and how you can add new tests.
8607:
1.184 rillig 8608: 26.1. Running the regression tests
1.1 dsieger 8609:
1.25 wiz 8610: You first need to install the pkgtools/pkg_regress package, which provides the
1.1 dsieger 8611: pkg_regress command. Then you can simply run that command, which will run all
1.168 rillig 8612: tests in the regress/ directory.
1.1 dsieger 8613:
1.184 rillig 8614: 26.2. Adding a new regression test
1.1 dsieger 8615:
1.168 rillig 8616: Every directory in the regress/ directory that contains a file called spec is
1.1 dsieger 8617: considered a regression test. This file is a shell program that is included by
8618: the pkg_regress command. The following functions can be overridden to suit your
8619: needs.
8620:
1.184 rillig 8621: 26.2.1. Overridable functions
1.1 dsieger 8622:
1.108 rillig 8623: These functions do not take any parameters. Although they are called in "set -e
1.168 rillig 8624: " mode, they don't stop at the first failing command. See this Stack Overflow
1.108 rillig 8625: question for details.
1.1 dsieger 8626:
1.108 rillig 8627: do_setup
1.1 dsieger 8628:
8629: This function prepares the environment for the test. By default it does
8630: nothing.
8631:
1.108 rillig 8632: do_test
1.1 dsieger 8633:
8634: This function runs the actual test. By default, it calls TEST_MAKE with the
8635: arguments MAKEARGS_TEST and writes its output including error messages into
8636: the file TEST_OUTFILE.
8637:
1.108 rillig 8638: When defining this function, make sure that all output that needs to be
8639: checked is written to the correct output file. Example:
8640:
8641: do_test() {
8642: echo "Example output"
8643: } 1>$TEST_OUTFILE 2>&1
8644:
8645: check_result
1.1 dsieger 8646:
8647: This function is run after the test and is typically used to compare the
8648: actual output from the one that is expected. It can make use of the various
1.108 rillig 8649: helper functions from the next section. Example:
8650:
8651: check_result() {
8652: exit_status 0
8653: output_require "Example"
8654: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
8655: output_prohibit "no such file or directory"
1.169 rillig 8656: regress_fail "expected $expected but got $actual for input $input"
1.108 rillig 8657: }
1.1 dsieger 8658:
1.108 rillig 8659: do_cleanup
1.1 dsieger 8660:
8661: This function cleans everything up after the test has been run. By default
8662: it does nothing.
8663:
1.184 rillig 8664: 26.2.2. Helper functions
1.1 dsieger 8665:
1.168 rillig 8666: regress_fail message...
8667:
8668: This function makes the test fail with the given error message.
8669:
1.108 rillig 8670: exit_status expected
1.1 dsieger 8671:
1.108 rillig 8672: This function compares the exitcode of the do_test function with its first
8673: parameter. If they differ, the test will fail.
1.1 dsieger 8674:
1.108 rillig 8675: output_require regex...
1.1 dsieger 8676:
8677: This function checks for each of its parameters if the output from do_test
1.108 rillig 8678: matches the extended regular expression. If it does not, the test will
8679: fail. Example:
8680:
8681: output_require "looks fine"
8682: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
1.1 dsieger 8683:
1.177 leot 8684: output_prohibit regex...
1.1 dsieger 8685:
8686: This function checks for each of its parameters if the output from do_test
8687: () does not match the extended regular expression. If any of the regular
8688: expressions matches, the test will fail.
8689:
1.184 rillig 8690: Chapter 27. Porting pkgsrc
1.1 dsieger 8691:
8692: Table of Contents
8693:
1.184 rillig 8694: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8695:
8696: The pkgsrc system has already been ported to many operating systems, hardware
8697: architectures and compilers. This chapter explains the necessary steps to make
8698: pkgsrc even more portable.
8699:
1.184 rillig 8700: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8701:
8702: To port pkgsrc to a new operating system (called MyOS in this example), you
8703: need to touch the following files:
8704:
8705: pkgtools/bootstrap-mk-files/files/mods/MyOS.sys.mk
8706:
8707: This file contains some basic definitions, for example the name of the C
8708: compiler.
8709:
8710: mk/bsd.prefs.mk
8711:
8712: Insert code that defines the variables OPSYS, OS_VERSION, LOWER_OS_VERSION,
8713: LOWER_VENDOR, MACHINE_ARCH, OBJECT_FMT, APPEND_ELF, and the other variables
8714: that appear in this file.
8715:
8716: mk/platform/MyOS.mk
8717:
8718: This file contains the platform-specific definitions that are used by
8719: pkgsrc. Start by copying one of the other files and edit it to your needs.
8720:
8721: mk/tools/tools.MyOS.mk
8722:
8723: This file defines the paths to all the tools that are needed by one or the
8724: other package in pkgsrc, as well as by pkgsrc itself. Find out where these
8725: tools are on your platform and add them.
8726:
8727: Now, you should be able to build some basic packages, like lang/perl5, shells/
8728: bash.
8729:
8730: Appendix A. A simple example package: bison
8731:
8732: Table of Contents
8733:
8734: A.1. files
8735:
8736: A.1.1. Makefile
8737: A.1.2. DESCR
8738: A.1.3. PLIST
8739: A.1.4. Checking a package with pkglint
8740:
8741: A.2. Steps for building, installing, packaging
8742:
8743: We checked to find a piece of software that wasn't in the packages collection,
1.25 wiz 8744: and picked GNU bison. Quite why someone would want to have bison when Berkeley
1.1 dsieger 8745: yacc is already present in the tree is beyond us, but it's useful for the
8746: purposes of this exercise.
8747:
8748: A.1. files
8749:
8750: A.1.1. Makefile
8751:
1.2 rillig 8752: # $NetBSD$
1.1 dsieger 8753: #
8754:
8755: DISTNAME= bison-1.25
8756: CATEGORIES= devel
1.171 rillig 8757: MASTER_SITES= ${MASTER_SITE_GNU:=bison/}
1.1 dsieger 8758:
1.30 dholland 8759: MAINTAINER= pkgsrc-users@NetBSD.org
1.174 leot 8760: HOMEPAGE= https://www.gnu.org/software/bison/bison.html
1.1 dsieger 8761: COMMENT= GNU yacc clone
8762:
8763: GNU_CONFIGURE= yes
1.47 wiz 8764: INFO_FILES= yes
1.1 dsieger 8765:
8766: .include "../../mk/bsd.pkg.mk"
8767:
8768: A.1.2. DESCR
8769:
8770: GNU version of yacc. Can make re-entrant parsers, and numerous other
8771: improvements. Why you would want this when Berkeley yacc(1) is part
8772: of the NetBSD source tree is beyond me.
8773:
8774: A.1.3. PLIST
8775:
1.2 rillig 8776: @comment $NetBSD$
1.1 dsieger 8777: bin/bison
8778: man/man1/bison.1.gz
8779: share/bison.simple
8780: share/bison.hairy
8781:
8782: A.1.4. Checking a package with pkglint
8783:
8784: The NetBSD package system comes with pkgtools/pkglint which helps to check the
8785: contents of these files. After installation it is quite easy to use, just
1.171 rillig 8786: change to the directory of the package you wish to examine and run pkglint:
1.1 dsieger 8787:
8788: $ pkglint
1.171 rillig 8789: ERROR: Makefile: Each package must define its LICENSE.
8790: WARN: Makefile:9: HOMEPAGE should migrate from http to https.
8791: NOTE: PLIST:3: The .gz extension is unnecessary for manual pages.
8792: WARN: PLIST:5: "share/bison.hairy" should be sorted before "share/bison.simple".
8793: 1 error, 2 warnings and 1 note found.
8794: (Run "pkglint -e" to show explanations.)
8795: (Run "pkglint -fs" to show what can be fixed automatically.)
1.172 rillig 8796: (Run "pkglint -F" to automatically fix some issues.)
1.1 dsieger 8797:
8798: Depending on the supplied command line arguments (see pkglint(1)), more checks
1.170 rillig 8799: will be performed. Use e.g. pkglint -Wall for a very thorough check.
1.1 dsieger 8800:
8801: A.2. Steps for building, installing, packaging
8802:
8803: Create the directory where the package lives, plus any auxiliary directories:
8804:
8805: # cd /usr/pkgsrc/lang
8806: # mkdir bison
8807: # cd bison
8808: # mkdir patches
8809:
1.184 rillig 8810: Create Makefile, DESCR and PLIST (see Chapter 12, Package components - files,
1.1 dsieger 8811: directories and contents) then continue with fetching the distfile:
8812:
8813: # make fetch
8814: >> bison-1.25.tar.gz doesn't seem to exist on this system.
8815: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
8816: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8817: ftp: Error retrieving file: 500 Internal error
8818:
8819: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
8820: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8821: ftp: Error retrieving file: 500 Internal error
8822:
8823: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
8824: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8825: Successfully retrieved file.
8826:
8827: Generate the checksum of the distfile into distinfo:
8828:
8829: # make makedistinfo
8830:
8831: Now compile:
8832:
8833: # make
8834: >> Checksum OK for bison-1.25.tar.gz.
8835: ===> Extracting for bison-1.25
8836: ===> Patching for bison-1.25
8837: ===> Ignoring empty patch directory
8838: ===> Configuring for bison-1.25
8839: creating cache ./config.cache
8840: checking for gcc... cc
8841: checking whether we are using GNU C... yes
8842: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
8843: checking how to run the C preprocessor... cc -E
8844: checking for minix/config.h... no
8845: checking for POSIXized ISC... no
8846: checking whether cross-compiling... no
8847: checking for ANSI C header files... yes
8848: checking for string.h... yes
8849: checking for stdlib.h... yes
8850: checking for memory.h... yes
8851: checking for working const... yes
8852: checking for working alloca.h... no
8853: checking for alloca... yes
8854: checking for strerror... yes
8855: updating cache ./config.cache
8856: creating ./config.status
8857: creating Makefile
8858: ===> Building for bison-1.25
8859: 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
8860: 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
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 closure.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 conflicts.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 derives.c
8864: 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
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 getargs.c
8866: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g gram.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 lalr.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 lex.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 main.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 nullable.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 output.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 print.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 reader.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 reduce.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 symtab.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 warshall.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 version.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 getopt.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 getopt1.c
8880: 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
8881: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
8882: rm -f bison.s1
8883: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
8884:
8885: Everything seems OK, so install the files:
8886:
8887: # make install
8888: >> Checksum OK for bison-1.25.tar.gz.
8889: ===> Installing for bison-1.25
8890: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
8891: rm -f /usr/pkg/bin/bison
8892: cd /usr/pkg/share; rm -f bison.simple bison.hairy
8893: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
8894: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
8895: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
8896: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
8897: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
8898: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
8899: ===> Registering installation for bison-1.25
8900:
8901: You can now use bison, and also - if you decide so - remove it with pkg_delete
8902: bison. Should you decide that you want a binary package, do this now:
8903:
8904: # make package
8905: >> Checksum OK for bison-1.25.tar.gz.
8906: ===> Building package for bison-1.25
8907: Creating package bison-1.25.tgz
8908: Registering depends:.
8909: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
8910:
8911: Now that you don't need the source and object files any more, clean up:
8912:
8913: # make clean
8914: ===> Cleaning for bison-1.25
8915:
8916: Appendix B. Build logs
8917:
8918: Table of Contents
8919:
8920: B.1. Building figlet
8921: B.2. Packaging figlet
8922:
8923: B.1. Building figlet
8924:
8925: # make
8926: ===> Checking for vulnerabilities in figlet-2.2.1nb2
8927: => figlet221.tar.gz doesn't seem to exist on this system.
8928: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
8929: => [172219 bytes]
8930: Connected to ftp.plig.net.
8931: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
8932: 331 Guest login ok, send your complete e-mail address as password.
8933: 230-You are user #5 of 500 simultaneous users allowed.
8934: 230-
8935: 230- ___ _ _ _
8936: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
8937: 230- | _| _| . |_| . | | | . |_| . | _| . |
8938: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
8939: 230- |_| |_| |___| |___|
8940: 230-
8941: 230-** Welcome to ftp.plig.org **
8942: 230-
8943: 230-Please note that all transfers from this FTP site are logged. If you
8944: 230-do not like this, please disconnect now.
8945: 230-
1.19 snj 8946: 230-This archive is available via
1.1 dsieger 8947: 230-
8948: 230-HTTP: http://ftp.plig.org/
8949: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
8950: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
8951: 230-
8952: 230-Please email comments, bug reports and requests for packages to be
8953: 230-mirrored to ftp-admin@plig.org.
8954: 230-
8955: 230-
8956: 230 Logged in anonymously.
8957: Remote system type is UNIX.
8958: Using binary mode to transfer files.
8959: 200 Type okay.
8960: 250 "/pub" is new cwd.
8961: 250-"/pub/figlet" is new cwd.
8962: 250-
8963: 250-Welcome to the figlet archive at ftp.figlet.org
8964: 250-
8965: 250- ftp://ftp.figlet.org/pub/figlet/
8966: 250-
8967: 250-The official FIGlet web page is:
8968: 250- http://www.figlet.org/
8969: 250-
8970: 250-If you have questions, please mailto:info@figlet.org. If you want to
8971: 250-contribute a font or something else, you can email us.
8972: 250
8973: 250 "/pub/figlet/program" is new cwd.
8974: 250 "/pub/figlet/program/unix" is new cwd.
8975: local: figlet221.tar.gz remote: figlet221.tar.gz
8976: 502 Unimplemented command.
8977: 227 Entering Passive Mode (195,40,6,41,246,104)
8978: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
8979: 38% |************** | 65800 64.16 KB/s 00:01 ETA
8980: 226 Transfer completed.
8981: 172219 bytes received in 00:02 (75.99 KB/s)
8982: 221 Goodbye.
8983: => Checksum OK for figlet221.tar.gz.
8984: ===> Extracting for figlet-2.2.1nb2
8985: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
8986: ===> Patching for figlet-2.2.1nb2
8987: ===> Applying pkgsrc patches for figlet-2.2.1nb2
8988: ===> Overriding tools for figlet-2.2.1nb2
8989: ===> Creating toolchain wrappers for figlet-2.2.1nb2
8990: ===> Configuring for figlet-2.2.1nb2
8991: ===> Building for figlet-2.2.1nb2
8992: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
8993: chmod a+x figlet
8994: gcc -O2 -o chkfont chkfont.c
8995: => Unwrapping files-to-be-installed.
8996: #
8997: # make install
8998: ===> Checking for vulnerabilities in figlet-2.2.1nb2
8999: ===> Installing for figlet-2.2.1nb2
9000: install -d -o root -g wheel -m 755 /usr/pkg/bin
9001: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
9002: mkdir -p /usr/pkg/share/figlet
9003: cp figlet /usr/pkg/bin
9004: cp chkfont /usr/pkg/bin
9005: chmod 555 figlist showfigfonts
9006: cp figlist /usr/pkg/bin
9007: cp showfigfonts /usr/pkg/bin
9008: cp fonts/*.flf /usr/pkg/share/figlet
9009: cp fonts/*.flc /usr/pkg/share/figlet
9010: cp figlet.6 /usr/pkg/man/man6
9011: ===> Registering installation for figlet-2.2.1nb2
9012: #
9013:
9014: B.2. Packaging figlet
9015:
9016: # make package
9017: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9018: ===> Packaging figlet-2.2.1nb2
9019: ===> Building binary package for figlet-2.2.1nb2
9020: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
9021: Using SrcDir value of /usr/pkg
9022: Registering depends:.
9023: #
9024:
9025: Appendix C. Directory layout of the pkgsrc FTP server
9026:
9027: Table of Contents
9028:
1.23 jakllsch 9029: C.1. distfiles: The distributed source files
9030: C.2. misc: Miscellaneous things
9031: C.3. packages: Binary packages
9032: C.4. reports: Bulk build reports
1.148 leot 9033: C.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 9034:
9035: As in other big projects, the directory layout of pkgsrc is quite complex for
9036: newbies. This chapter explains where you find things on the FTP server. The
9037: base directory on ftp.NetBSD.org is /pub/pkgsrc/. On other servers it may be
9038: different, but inside this directory, everything should look the same, no
9039: matter on which server you are. This directory contains some subdirectories,
9040: which are explained below.
9041:
1.23 jakllsch 9042: C.1. distfiles: The distributed source files
1.1 dsieger 9043:
9044: The directory distfiles contains lots of archive files from all pkgsrc
9045: packages, which are mirrored here. The subdirectories are called after their
9046: package names and are used when the distributed files have names that don't
9047: explicitly contain a version number or are otherwise too generic (for example
9048: release.tar.gz).
9049:
1.23 jakllsch 9050: C.2. misc: Miscellaneous things
1.1 dsieger 9051:
9052: This directory contains things that individual pkgsrc developers find worth
9053: publishing.
9054:
1.23 jakllsch 9055: C.3. packages: Binary packages
1.1 dsieger 9056:
1.3 rillig 9057: This directory contains binary packages for the various platforms that are
9058: supported by pkgsrc. Each subdirectory is of the form OPSYS/ARCH/OSVERSION_TAG.
9059: The meaning of these variables is:
9060:
9061: * OPSYS is the name of the operating system for which the packages have been
1.9 rillig 9062: built. The name is taken from the output of the uname command, so it may
9063: differ from the one you are used to hear.
1.3 rillig 9064:
1.8 rillig 9065: * ARCH is the hardware architecture of the platform for which the packages
1.10 hubertf 9066: have been built. It also includes the ABI (Application Binary Interface)
9067: for platforms that have several of them.
1.3 rillig 9068:
1.8 rillig 9069: * OSVERSION is the version of the operating system. For version numbers that
9070: change often (for example NetBSD-current), the often-changing part should
9071: be replaced with an x, for example 4.99.x.
1.3 rillig 9072:
1.23 jakllsch 9073: * TAG is either 20xxQy for a stable branch, or head for packages built from
1.8 rillig 9074: the HEAD branch. The latter should only be used when the packages are
9075: updated on a regular basis. Otherwise the date from checking out pkgsrc
9076: should be appended, for example head_20071015.
1.3 rillig 9077:
9078: The rationale for exactly this scheme is that the pkgsrc users looking for
9079: binary packages can quickly click through the directories on the server and
9080: find the best binary packages for their machines. Since they usually know the
9081: operating system and the hardware architecture, OPSYS and ARCH are placed
9082: first. After these choices, they can select the best combination of OSVERSION
9083: and TAG together, since it is usually the case that packages stay compatible
9084: between different version of the operating system.
9085:
9086: In each of these directories, there is a whole binary packages collection for a
9087: specific platform. It has a directory called All which contains all binary
9088: packages. Besides that, there are various category directories that contain
9089: symbolic links to the real binary packages.
1.1 dsieger 9090:
1.23 jakllsch 9091: C.4. reports: Bulk build reports
1.8 rillig 9092:
9093: Here are the reports from bulk builds, for those who want to fix packages that
9094: didn't build on some of the platforms. The structure of subdirectories should
1.23 jakllsch 9095: look like the one in Section C.3, "packages: Binary packages".
1.8 rillig 9096:
1.148 leot 9097: C.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 9098:
9099: These directories contain the "real" pkgsrc, that is the files that define how
9100: to create binary packages from source archives.
9101:
1.149 leot 9102: Each of the current, stable and pkgsrc-20xxQy directories share the same
9103: structure. They each contain a pkgsrc directory and pkgsrc.tar.{bz,gz,xz} file.
9104:
1.1 dsieger 9105: The directory pkgsrc contains a snapshot of the CVS repository, which is
1.149 leot 9106: updated regularly. The file pkgsrc.tar.{bz,gz,xz} contains the same as the
9107: directory, ready to be downloaded as a whole.
1.1 dsieger 9108:
1.149 leot 9109: The current directory contains files related to the HEAD branch of the CVS
9110: repository. In this directory there is an additional file called
9111: pkgsrc-readmes.tar.{bz,gz,xz} that contains all pkgsrc READMEs with information
9112: about categories and packages.
9113:
9114: The stable directory is a symlink to the latest pkgsrc-20xxQy.
9115:
9116: The pkgsrc-20xxQy. directories contain files related to the -20xxQy stable
9117: branch of the CVS repository. In these directories there is an additional file
9118: called pkgsrc-20xxQy.tar.{bz,gz,xz}, which contains the state of pkgsrc when it
9119: was branched.
1.148 leot 9120:
1.154 rillig 9121: Appendix D. Help topics
9122:
9123: The following list contains all help topics that are available when running
9124: bmake help topic=:index.
9125:
1.201 cirnatda 9126: #! -lintl
9127: 64bit ABI
9128: ACCEPTABLE_LICENSES ACROREAD_FONTPATH
9129: ADDITIONAL AFAIK
9130: AIX ALLOW_VULNERABLE_PACKAGES
9131: ALL_ENV ALTERNATIVES_SRC
9132: AMANDA_TMP AMANDA_USER
9133: AMANDA_VAR APACHE_GROUP
9134: APACHE_MODULE_NAME APACHE_MODULE_SRC
9135: APACHE_MODULE_SRCDIR APACHE_PKG_PREFIX
9136: APACHE_SUEXEC_CONFIGURE_ARGS APACHE_SUEXEC_DOCROOT
9137: APACHE_USER APPEND_ABI
9138: APPEND_ELF ARLA_CACHE
9139: AUDIT_PACKAGES_FLAGS AUTOCONF_REQD
9140: AUTOMAKE_OVERRIDE AUTOMAKE_REQD
9141: AUTO_MKDIRS BDB185_DEFAULT
9142: BDBBASE BDB_ACCEPTED
9143: BDB_DEFAULT BDB_LIBS
9144: BDB_TYPE BINCIMAP_GROUP
9145: BINCIMAP_USER BIND_DIR
9146: BIND_GROUP BIND_USER
9147: BINOWN BINPKG_SITES
9148: BIN_INSTALL_FLAGS BISON_PKGDATADIR
9149: BLAS_ACCEPTED BLAS_LIBS
9150: BLAS_TYPE BOOTSTRAP_DEPENDS
9151: BOOTSTRAP_SETUPTOOLS BROKEN
9152: BROKEN_EXCEPT_ON_PLATFORM BROKEN_ON_PLATFORM
9153: BSDSRCDIR BSDXSRCDIR
9154: BSD_MAKE_ENV BUILDLINK_AUTO_DIRS
9155: BUILDLINK_AUTO_VARS BUILDLINK_CFLAGS
9156: BUILDLINK_CONTENTS_FILTER BUILDLINK_CPPFLAGS
9157: BUILDLINK_FILES BUILDLINK_FILES_CMD
9158: BUILDLINK_FNAME_TRANSFORM BUILDLINK_LDFLAGS
9159: BUILDLINK_LIBS BUILDLINK_OPSYS_SUPPORT_PTHREAD
9160: BUILDLINK_PKGNAME BUILDLINK_PREFIX
9161: BUILDLINK_RPATHDIRS BUILDLINK_TREE
9162: BUILD_DEFS BUILD_DEFS_EFFECTS
9163: BUILD_DEPENDS BUILD_DIRS
9164: BUILD_ENV_SHELL BUILD_MAKE_CMD
9165: BUILD_MAKE_FLAGS BUILD_TARGET
9166: BUILTIN_FIND_FILES BUILTIN_FIND_FILES_VAR
9167: BUILTIN_FIND_GREP BUILTIN_FIND_HEADERS
9168: BUILTIN_FIND_HEADERS_VAR BUILTIN_FIND_PKGCONFIG
9169: BUILTIN_FIND_PKGCONFIG_VAR BUILTIN_PKG
9170: BUILTIN_TEST_CURSES_DEFINES BUILTIN_TEST_CURSES_FUNCS
9171: BUILTIN_VERSION_SCRIPT BUILTIN_X11_TYPE
9172: BUILTIN_X11_VERSION CACTI_GROUP
9173: CACTI_USER CANNA_GROUP
9174: CANNA_USER CAT
9175: CCACHE_BASE CCACHE_DIR
9176: CCACHE_LOGFILE CC_VERSION
9177: CC_VERSION_STRING CDRECORD_CONF
9178: CDROM_PKG_URL_DIR CDROM_PKG_URL_HOST
9179: CHECK_COMPILER CHECK_FAKEHOME
9180: CHECK_FILES CHECK_FILES_SKIP
9181: CHECK_FILES_STRICT CHECK_HEADERS
9182: CHECK_HEADERS_SKIP CHECK_INTERPRETER
9183: CHECK_INTERPRETER_SKIP CHECK_PERMS
9184: CHECK_PERMS_AUTOFIX CHECK_PERMS_SKIP
9185: CHECK_PORTABILITY CHECK_PORTABILITY_EXPERIMENTAL
9186: CHECK_PORTABILITY_SKIP CHECK_RELRO
9187: CHECK_RELRO_SKIP CHECK_RELRO_SUPPORTED
9188: CHECK_SHLIBS CHECK_SHLIBS_BLACKLIST
9189: CHECK_SHLIBS_SKIP CHECK_SHLIBS_SUPPORTED
9190: CHECK_SSP CHECK_SSP_SKIP
9191: CHECK_SSP_SUPPORTED CHECK_STRIPPED
9192: CHECK_STRIPPED_SKIP CHECK_WRKREF
9193: CHECK_WRKREF_EXTRA_DIRS CHECK_WRKREF_SKIP
9194: CLAMAV_DBDIR CLAMAV_GROUP
9195: CLAMAV_USER CLANGBASE
9196: CLEANDEPENDS CMAKE_DEPENDENCIES_REWRITE
9197: CMAKE_INSTALL_NAME_DIR CMAKE_INSTALL_PREFIX
9198: CMAKE_MODULE_PATH_OVERRIDE CMAKE_PKGSRC_BUILD_FLAGS
9199: CMAKE_PREFIX_PATH CMAKE_USE_GNU_INSTALL_DIRS
9200: COMPILER_RPATH_FLAG COMPILER_USE_SYMLINKS
9201: CONFIGURE_ARGS CONFIGURE_DIRS
9202: CONFIGURE_ENV CONFIGURE_ENV_SHELL
9203: CONFIGURE_HAS_INFODIR CONFIGURE_HAS_MANDIR
9204: CONFIGURE_SCRIPT CONFIG_SHELL
9205: CONFIG_SHELL_FLAGS CONF_FILES
9206: CONF_FILES_MODE CONF_FILES_PERMS
9207: CONSERVER_DEFAULTHOST CONSERVER_DEFAULTPORT
9208: CP CPP
9209: CPP_PRECOMP_FLAGS CREATE_WRKDIR_SYMLINK
9210: CROSSBASE CTFCONVERT
9211: CTF_FILES_SKIP CTF_SUPPORTED
9212: CTYPE CUPS_GROUP
9213: CUPS_SYSTEM_GROUPS CUPS_USER
9214: CURSES_DEFAULT CURSES_TYPE
9215: CXX CYRUS_GROUP
9216: CYRUS_IDLE CYRUS_USER
9217: DAEMONTOOLS_GROUP DAEMONTOOLS_LOG_USER
9218: DARWIN_NO_SYSTEM_LIBS DARWIN_REQUIRES_FILTER
9219: DBUS_GROUP DBUS_USER
9220: DEFANG_GROUP DEFANG_USER
9221: DEFAULT_ACCEPTABLE_LICENSES DEFAULT_DISTFILES
9222: DEFAULT_IRC_SERVER DEFAULT_SERIAL_DEVICE
9223: DEF_UMASK DEINSTALLDEPENDS
9224: DEINSTALL_SRC DEINSTALL_TEMPLATES
9225: DELAYED_ERROR_MSG DELAYED_WARNING_MSG
9226: DEPENDS DEPENDS_TARGET
9227: DEPENDS_TYPE DESTDIR
9228: DESTDIR_VARNAME DIALER_GROUP
9229: DIGEST_REQD DISTDIR
9230: DISTFILES DISTINFO_FILE
9231: DISTNAME DIST_PATH
9232: DIST_SUBDIR DJBDNS_AXFR_USER
9233: DJBDNS_CACHE_USER DJBDNS_DJBDNS_GROUP
9234: DJBDNS_LOG_USER DJBDNS_RBL_USER
9235: DJBDNS_TINY_USER DLOPEN_REQUIRE_PTHREADS
9236: DL_AUTO_VARS DL_CFLAGS
9237: DL_LDFLAGS DL_LIBS
9238: DNS DOCOWN
9239: DOWNLOADED_DISTFILE DT_LAYOUT
9240: DYNAMIC_SITES_CMD DYNAMIC_SITES_SCRIPT
9241: ECHO ECHO_N
9242: ELK_GUI EMACS_TYPE
9243: EMULDIR EMULSUBDIR
9244: EMULSUBDIRSLASH EMUL_ARCH
9245: EMUL_DISTRO EMUL_EXEC_FMT
9246: EMUL_IS_NATIVE EMUL_MODULES
9247: EMUL_OPSYS EMUL_PKG_FMT
9248: EMUL_PLATFORM EMUL_PLATFORMS
9249: EMUL_PREFER EMUL_REQD
9250: EMUL_TYPE ERROR_MSG
9251: EXIM_GROUP EXIM_USER
9252: EXPORT_SYMBOLS_LDFLAGS EXTRACTOR
9253: EXTRACT_CMD EXTRACT_CMD_DEFAULT
9254: EXTRACT_DIR EXTRACT_ELEMENTS
9255: EXTRACT_ENV EXTRACT_ONLY
9256: EXTRACT_OPTS EXTRACT_SUFX
9257: EXTRACT_USING FAIL
9258: FAILOVER_FETCH FAIL_MSG
9259: FAKE_NCURSES FAM
9260: FAM_ACCEPTED FAM_DEFAULT
9261: FAM_SERVER FCPATH
9262: FEATURE_CPPFLAGS FEATURE_LDFLAGS
9263: FEATURE_LIBS FETCH_AFTER_ARGS
9264: FETCH_BEFORE_ARGS FETCH_CMD
9265: FETCH_OUTPUT_ARGS FETCH_PROXY
9266: FETCH_RESUME_ARGS FETCH_TIMEOUT
9267: FETCH_USE_IPV4_ONLY FETCH_USING
9268: FILES_SUBST FILES_SUBST_SED
9269: FIX_SYSTEM_HEADERS FLUXBOX_USE_GNOME
9270: FLUXBOX_USE_KDE FLUXBOX_USE_XFT
9271: FLUXBOX_USE_XINERAMA FONTS_DIRS
9272: FONTS_VERBOSE FOO_HACKS_MK
9273: FOX_USE_XUNICODE FREEWNN_GROUP
9274: FREEWNN_USER FTP_PKG_URL_DIR
9275: FTP_PKG_URL_HOST GAMEDATAMODE
9276: GAMEDATA_PERMS GAMEDIRMODE
9277: GAMEDIR_PERMS GAMEGRP
9278: GAMEMODE GAMEOWN
9279: GAMES_GROUP GAMES_USER
9280: GCC GCCBASE
9281: GCC_REQD GCC_VERSION_SUFFIX
9282: GEM_BUILD GEM_CLEANBUILD
9283: GEM_CLEANBUILD_EXTENSIONS GEM_DOCDIR
9284: GEM_EXTSDIR GEM_HOME
9285: GEM_KEEPBUILD GEM_LIBDIR
9286: GEM_NAME GEM_PATH
9287: GEM_PLUGINSDIR GEM_SPECFILE
9288: GENERATE_PLIST GHC
9289: GHOSTSCRIPT_REQD GITHUB_PROJECT
9290: GITHUB_RELEASE GITHUB_SUBMODULES
9291: GITHUB_TAG GITHUB_TYPE
9292: GNU GNU_CONFIGURE
9293: GNU_CONFIGURE_INFODIR GNU_CONFIGURE_MANDIR
9294: GNU_CONFIGURE_QUIET GNU_CONFIGURE_STRICT
9295: GODEP_REDIRECTS GO_BUILD_PATTERN
9296: GO_DEPS GO_DIST_BASE
9297: GO_MODULE_FILES GO_SRCPATH
9298: GO_VERSION_DEFAULT GROUP_SPECIFIC_PKGS
9299: GRUB_NETWORK_CARDS GRUB_PRESET_COMMAND
9300: GRUB_SCAN_ARGS GZIP
9301: HASKELL_ENABLE_HADDOCK_DOCUMENTATION HASKELL_ENABLE_LIBRARY_PROFILING
9302: HASKELL_ENABLE_SHARED_LIBRARY HASKELL_OPTIMIZATION_LEVEL
9303: HAS_CONFIGURE HEADER_TEMPLATES
9304: HOMEPAGE HOST_PKGTOOLS_ARGS
9305: HOST_SPECIFIC_PKGS HOWL_GROUP
9306: HOWL_USER ICCBASE
9307: ICECAST_CHROOTDIR ICON_THEMES
9308: IDOBASE IGNORE_CCACHE
9309: IGNORE_INFO_DIRS IGNORE_INTERACTIVE_FETCH
9310: IMAKE IMAKEOPTS
9311: IMAKE_MAKE IMAKE_MANINSTALL
9312: IMAP_UW_CCLIENT_MBOX_FMT IMDICTDIR
9313: INCOMPAT_CURSES INFO_DIR
9314: INFO_FILES INFO_FILES_VERBOSE
9315: INFO_MSG INIT_SYSTEM
9316: INN_DATA_DIR INN_GROUP
9317: INN_USER INSTALLATION_DIRS
9318: INSTALLATION_DIRS_FROM_PLIST INSTALL_ENV
9319: INSTALL_SH_OVERRIDE INSTALL_SRC
9320: INSTALL_TEMPLATES INSTALL_UNSTRIPPED
9321: IRCD_HYBRID_IRC_GROUP IRCD_HYBRID_IRC_USER
9322: IRCD_HYBRID_MAXCONN IRCD_HYBRID_NICLEN
9323: IRCD_HYBRID_SYSLOG_EVENTS IRCD_HYBRID_SYSLOG_FACILITY
9324: IRCD_HYBRID_TOPICLEN IRIX
9325: IRRD_USE_PGP JABBERD_GROUP
9326: JABBERD_LOGDIR JABBERD_PIDDIR
9327: JABBERD_SPOOLDIR JABBERD_USER
9328: JAKARTA_HOME JAVA_BINPREFIX
9329: JAVA_CLASSPATH JAVA_HOME
9330: JAVA_LD_LIBRARY_PATH JAVA_NAME
9331: JAVA_UNLIMIT JAVA_WRAPPERS
9332: JPEG_ACCEPTED JPEG_DEFAULT
9333: KERBEROS KERMIT_SUID_UUCP
9334: KJS_USE_PCRE KNEWS_DOMAIN_FILE
9335: KNEWS_DOMAIN_NAME KRB5_ACCEPTED
9336: KRB5_DEFAULT LANGUAGES
9337: LAPACK_LIBS LATEX2HTML_ICONPATH
9338: LDCONFIG_ADD_CMD LDCONFIG_REMOVE_CMD
9339: LEAFNODE_DATA_DIR LEAFNODE_GROUP
9340: LEAFNODE_USER LIBDVDCSS_HOMEPAGE
9341: LIBDVDCSS_MASTER_SITES LIBRSVG_TYPE
9342: LIBTOOL LIBTOOLIZE_PLIST
9343: LIBTOOL_M4_OVERRIDE LIBUSB_TYPE
9344: LICENSE LINKER_RPATH_FLAG
9345: LINK_RPATH_FLAG LINUX_LOCALES
9346: LOCALBASE LOCALBASE_LOCKTYPE
9347: LOCALPATCHES LOVE_DATA
9348: LOVE_GAME LOVE_VERSION
9349: LP64PLATFORMS MACHINE_PLATFORM
9350: MAILAGENT_DOMAIN MAILAGENT_EMAIL
9351: MAILAGENT_FQDN MAILAGENT_ORGANIZATION
9352: MAJORDOMO_HOMEDIR MAKEINFO_ARGS
9353: MAKE_DIRS MAKE_DIRS_PERMS
9354: MAKE_ENV MAKE_FILE
9355: MAKE_FLAGS MAKE_JOBS
9356: MAKE_JOBS_SAFE MAKE_PROGRAM
9357: MANCOMPRESSED_IF_MANZ MANINSTALL
9358: MANZ MASTER_SITES
9359: MASTER_SITE_BACKUP MASTER_SITE_LOCAL
9360: MASTER_SITE_MOZILLA MASTER_SITE_OVERRIDE
9361: MASTER_SITE_PERL_CPAN MASTER_SORT
9362: MASTER_SORT_RANDOM MASTER_SORT_REGEX
9363: MECAB_CHARSET MEDIATOMB_GROUP
9364: MEDIATOMB_USER MIPSPROBASE
9365: MIREDO_GROUP MIREDO_USER
9366: MISSING_FEATURES MKDIR
9367: MLDONKEY_GROUP MLDONKEY_HOME
9368: MLDONKEY_USER MONOTONE_GROUP
9369: MONOTONE_USER MOTIFBASE
9370: MOTIF_TYPE MOTIF_TYPE_DEFAULT
9371: MPI_TYPE MSGFMT_STRIP_MSGCTXT
9372: MSGFMT_STRIP_MSGID_PLURAL MTOOLS_ENABLE_FLOPPYD
9373: MV MYSQL_CHARSET
9374: MYSQL_DATADIR MYSQL_EXTRA_CHARSET
9375: MYSQL_GROUP MYSQL_USER
9376: MYSQL_VERSION MYSQL_VERSIONS_ACCEPTED
9377: MYSQL_VERSIONS_ALL MYSQL_VERSION_DEFAULT
9378: NAGIOSCMD_GROUP NAGIOSDIR
9379: NAGIOS_GROUP NAGIOS_USER
9380: NATIVE_APPEND_ABI NATIVE_APPEND_ELF
9381: NATIVE_EXEC_FMT NATIVE_MACHINE_PLATFORM
9382: NATIVE_OBJECT_FMT NBPAX_PROGRAM_PREFIX
9383: NETBSD_LOGIN_NAME NMH_EDITOR
9384: NMH_MTA NMH_PAGER
9385: NOLOGIN NOTE
9386: NOT_FOR_PLATFORM NOT_PAX_ASLR_SAFE
9387: NOT_PAX_MPROTECT_SAFE NO_BUILD
9388: NO_CHECKSUM NO_CONFIGURE
9389: NO_SKIP NS_PREFERRED
9390: NULLMAILER_GROUP NULLMAILER_USER
9391: OASIS OASIS_BUILD_ARGS
9392: OBJHOSTNAME OBJMACHINE
9393: OCAML_FINDLIB_DIRS OCAML_FINDLIB_REGISTER
9394: OCAML_FINDLIB_REGISTER_VERBOSE OCAML_SITELIBDIR
9395: OCAML_TOPKG_DOCDIR OCAML_USE_DUNE
9396: OCAML_USE_FINDLIB OCAML_USE_JBUILDER
9397: OCAML_USE_OASIS OCAML_USE_OASIS_DYNRUN
9398: OCAML_USE_OPAM OCAML_USE_OPT_COMPILER
9399: OCAML_USE_TOPKG OMF
9400: ONLY_FOR_COMPILER ONLY_FOR_PLATFORM
9401: OPENSSH_CHROOT OPENSSH_GROUP
9402: OPENSSH_USER OPSYS
9403: OPSYS_EMULDIR OS
9404: OSS_TYPE OSX
9405: OSX_TOLERATE_SDK_SKEW OS_VARIANT
9406: OS_VERSION OTF_FONTS_DIR
9407: OVERRIDE_DIRDEPTH OVERRIDE_GEMSPEC
9408: OVERRIDE_GNU_CONFIG_SCRIPTS OWN_DIRS
9409: OWN_DIRS_PERMS P4GROUP
9410: P4PORT P4ROOT
9411: P4USER PACKAGES
9412: PALMOS_DEFAULT_SDK PAMBASE
9413: PAM_DEFAULT PAPERSIZE
9414: PASSIVE_FETCH PATCHDIR
9415: PATCHFILES PATCH_ARGS
9416: PATCH_DEBUG PATCH_DIST_ARGS
9417: PATCH_DIST_CAT PATCH_DIST_STRIP
9418: PATCH_FUZZ_FACTOR PATCH_STRIP
9419: PATH PCCBASE
9420: PEAR_CMD PEAR_LIB
9421: PEAR_PACKAGE_XML PERL5
9422: PERL5_CONFIGURE PERL5_CONFIGURE_DIRS
9423: PERL5_LDFLAGS PERL5_LICENSE
9424: PERL5_MODULE_TYPE PERL5_PACKLIST
9425: PERL5_PACKLIST_DIR PERL5_PERLBASE
9426: PERL5_SITEBASE PERL5_USE_PACKLIST
9427: PERL5_VENDORBASE PFCTL
9428: PFVAR_H PF_VERSION
9429: PGGROUP PGHOME
9430: PGPKGSRCDIR PGSQL_TYPE
9431: PGSQL_VERSION PGSQL_VERSIONS_ACCEPTED
9432: PGSQL_VERSION_DEFAULT PGUSER
9433: PG_LIB_EXT PHP
9434: PHPCOMMON_MK PHPPKGSRCDIR
9435: PHP_BASE_VERS PHP_CHECK_INSTALLED
9436: PHP_EXTENSION_DIR PHP_INITIAL_TEENY
9437: PHP_PKG_PREFIX PHP_VERSION
9438: PHP_VERSIONS_ACCEPTED PHP_VERSIONS_INCOMPATIBLE
9439: PHP_VERSION_DEFAULT PHP_VERSION_REQD
9440: PILRC_USE_GTK PKGCONFIG_BASE
9441: PKGCONFIG_FILE PKGCONFIG_OVERRIDE
9442: PKGCONFIG_OVERRIDE_STAGE PKGDIR
9443: PKGGNUDIR PKGINFODIR
9444: PKGLOCALEDIR PKGMANDIR
9445: PKGNAME PKGNAME_REQD
9446: PKGPATH PKGREVISION
9447: PKGSRC_BLAS_TYPES PKGSRC_CHANGES
9448: PKGSRC_COMPILER PKGSRC_KEEP_BIN_PKGS
9449: PKGSRC_LOCKTYPE PKGSRC_MAKE_ENV
9450: PKGSRC_MESSAGE_RECIPIENTS PKGSRC_MKPIE
9451: PKGSRC_MKREPRO PKGSRC_RUN_TEST
9452: PKGSRC_SETENV PKGSRC_SLEEPSECS
9453: PKGSRC_TODO PKGSRC_USE_CTF
9454: PKGSRC_USE_FORTIFY PKGSRC_USE_RELRO
9455: PKGSRC_USE_SSP PKGSRC_USE_STACK_CHECK
9456: PKGTASKS_DATAFILE PKGTOOLS_ARGS
9457: PKGTOOLS_ENV PKG_ALTERNATIVES
9458: PKG_APACHE PKG_APACHE_ACCEPTED
9459: PKG_APACHE_DEFAULT PKG_BEST_EXISTS
9460: PKG_BUILD_OPTIONS PKG_COMPRESSION
9461: PKG_CONFIG PKG_CONFIG_PERMS
9462: PKG_CREATE_USERGROUP PKG_DB_TMPDIR
9463: PKG_DEBUG_LEVEL PKG_DEFAULT_OPTIONS
9464: PKG_DESTDIR_SUPPORT PKG_DEVELOPER
9465: PKG_DISABLED_OPTIONS PKG_FATAL_ERRORS
9466: PKG_FC PKG_FILELIST_CMD
9467: PKG_GECOS PKG_GID
9468: PKG_GROUPS PKG_GROUPS_VARS
9469: PKG_HOME PKG_INIT_SCRIPTS
9470: PKG_JAVA_HOME PKG_JVM
9471: PKG_JVMS_ACCEPTED PKG_JVM_DEFAULT
9472: PKG_LEGACY_OPTIONS PKG_LIBTOOL
9473: PKG_OPTIONS PKG_OPTIONS_DEPRECATED_WARNINGS
9474: PKG_OPTIONS_LEGACY_OPTS PKG_OPTIONS_LEGACY_VARS
9475: PKG_OPTIONS_NONEMPTY_SETS PKG_OPTIONS_OPTIONAL_GROUPS
9476: PKG_OPTIONS_REQUIRED_GROUPS PKG_OPTIONS_VAR
9477: PKG_PHP PKG_PHP_MAJOR_VERS
9478: PKG_PHP_VERSION PKG_RCD_SCRIPTS
9479: PKG_REFCOUNT_DBDIR PKG_REGISTER_SHELLS
9480: PKG_RESUME_TRANSFERS PKG_SHELL
9481: PKG_SUGGESTED_OPTIONS PKG_SUPPORTED_OPTIONS
9482: PKG_SYSCONFBASE PKG_SYSCONFBASEDIR
9483: PKG_SYSCONFDIR PKG_SYSCONFDIR_PERMS
9484: PKG_SYSCONFSUBDIR PKG_SYSCONFVAR
9485: PKG_TOOLS_BIN PKG_UID
9486: PKG_UPDATE_FONTS_DB PKG_USERS
9487: PKG_USERS_VARS PKG_VERBOSE
9488: PLEASE PLIST
9489: PLIST_AWK PLIST_AWK_ENV
9490: PLIST_SRC PLIST_SUBST
9491: PLIST_TYPE PLIST_VARS
9492: POPTOP_USE_MPPE POSSIBLE_GFORTRAN_VERSION
9493: POST_FETCH_HOOK PREFER
9494: PREFER_NATIVE PREFER_NATIVE_PTHREADS
9495: PREFER_PKGSRC PREFIX
9496: PREPEND_PATH PRE_ROOT_CMD
9497: PRIVILEGED_STAGES PS
9498: PTHREAD_AUTO_VARS PTHREAD_CFLAGS
9499: PTHREAD_LDFLAGS PTHREAD_LIBS
9500: PTHREAD_OPTS PTHREAD_TYPE
9501: PVM_SSH PYPKGPREFIX
9502: PYTHON_FOR_BUILD_ONLY PYTHON_SELF_CONFLICT
9503: PYTHON_VERSIONED_DEPENDENCIES PYTHON_VERSIONS_ACCEPTED
9504: PYTHON_VERSIONS_INCOMPATIBLE PYTHON_VERSION_DEFAULT
9505: PYTHON_VERSION_REQD PYVERSSUFFIX
9506: PY_NO_EGG QMAILDIR
9507: QMAIL_ALIAS_USER QMAIL_DAEMON_USER
9508: QMAIL_LOG_USER QMAIL_NOFILES_GROUP
9509: QMAIL_PASSWD_USER QMAIL_QMAIL_GROUP
9510: QMAIL_QUEUE_DIR QMAIL_QUEUE_EXTRA
9511: QMAIL_QUEUE_USER QMAIL_REMOTE_USER
9512: QMAIL_ROOT_USER QMAIL_SEND_USER
9513: QPOPPER_FAC QPOPPER_SPOOL_DIR
9514: QPOPPER_USER RAKE_NAME
9515: RASMOL_DEPTH RCD_SCRIPTS
9516: RCD_SCRIPTS_DIR RCD_SCRIPTS_EXAMPLEDIR
9517: RCD_SCRIPTS_MODE RCD_SCRIPTS_SHELL
9518: RCD_SCRIPT_SRC RDOC
9519: READLINE_DEFAULT READLINE_TYPE
9520: REAL_ROOT_GROUP REAL_ROOT_USER
9521: RECURSIVE_MAKE RELAY_CTRL_DIR
9522: RELRO_SUPPORTED REPLACE_AWK
9523: REPLACE_BASH REPLACE_CSH
9524: REPLACE_KSH REPLACE_PERL
9525: REPLACE_PERL6 REPLACE_PHP
9526: REPLACE_PYTHON REPLACE_RUBY
9527: REPLACE_RUBY_DIRS REPLACE_RUBY_PAT
9528: REPLACE_SH REPLACE_TEXLUA
9529: REQD_DIRS REQD_DIRS_PERMS
9530: REQD_FILES REQD_FILES_MODE
9531: REQD_FILES_PERMS RESOLV_AUTO_VARS
9532: RESOLV_LDFLAGS RESOLV_LIBS
9533: RM ROOT_CMD
9534: ROOT_GROUP ROOT_USER
9535: RPCGEN RPM
9536: RPM2PKG_PLIST RPM2PKG_PREFIX
9537: RPM2PKG_STAGE RPM2PKG_STRIP
9538: RPM2PKG_SUBPREFIX RPMFILES
9539: RPMIGNOREPATH RPM_DB_PREFIX
9540: RSSH_CVS_PATH RSSH_RDIST_PATH
9541: RSSH_RSYNC_PATH RSSH_SCP_PATH
9542: RSSH_SFTP_SERVER_PATH RUBY
9543: RUBYGEM RUBYGEM_NAME
9544: RUBYGEM_OPTIONS RUBYGEM_VERBOSE
9545: RUBY_ABI_VERSION RUBY_ARCH
9546: RUBY_ARCHINC RUBY_ARCHLIB
9547: RUBY_BASE RUBY_BASERIDIR
9548: RUBY_BUILD_DOCUMENT RUBY_DLEXT
9549: RUBY_DOC RUBY_DYNAMIC_DIRS
9550: RUBY_EG RUBY_ENCODING_ARG
9551: RUBY_EXTCONF RUBY_EXTCONF_CHECK
9552: RUBY_EXTCONF_DEBUG RUBY_EXTCONF_MAKEFILE
9553: RUBY_GEM_BASE RUBY_INC
9554: RUBY_LIB RUBY_LIB_BASE
9555: RUBY_NAME RUBY_NOVERSION
9556: RUBY_PKGPREFIX RUBY_RAILS
9557: RUBY_RAILS52_VERSION RUBY_RAILS60_VERSION
9558: RUBY_RAILS61_VERSION RUBY_RAILS_ACCEPTED
9559: RUBY_RAILS_DEFAULT RUBY_RAILS_REQD
9560: RUBY_RAILS_STRICT_DEP RUBY_RIDIR
9561: RUBY_SETUP RUBY_SHLIB
9562: RUBY_SHLIBALIAS RUBY_SHLIBVER
9563: RUBY_SIMPLE_INSTALL RUBY_SITEARCHLIB
9564: RUBY_SITELIB RUBY_SITELIB_BASE
9565: RUBY_SITERIDIR RUBY_SLEXT
9566: RUBY_SRCDIR RUBY_STATICLIB
9567: RUBY_SUFFIX RUBY_SYSRIDIR
9568: RUBY_USE_PTHREAD RUBY_VENDORARCHLIB
9569: RUBY_VENDORLIB RUBY_VENDORLIB_BASE
9570: RUBY_VER RUBY_VERSION
9571: RUBY_VERSIONS_ACCEPTED RUBY_VERSIONS_INCOMPATIBLE
9572: RUBY_VERSION_DEFAULT RUBY_VERSION_REQD
9573: RUBY_VER_DIR RUN
9574: RUN_LDCONFIG SAWFISH_THEMES
9575: SCO SCREWS_GROUP
9576: SCREWS_USER SCRIPTS_ENV
9577: SCROLLKEEPER_DATADIR SCROLLKEEPER_REBUILDDB
9578: SCROLLKEEPER_UPDATEDB SDIST_PAWD
9579: SERIAL_DEVICES SETGIDGAME
9580: SETGID_GAMES_PERMS SETUID_ROOT_PERMS
9581: SH SHLIB
9582: SIGN_PACKAGES SILC_CLIENT_WITH_PERL
9583: SITE_SPECIFIC_PKGS SKIP_DEPENDS
9584: SMF_INSTANCES SMF_MANIFEST
9585: SMF_METHODS SMF_METHOD_SHELL
9586: SMF_METHOD_SRC SMF_NAME
9587: SMF_PREFIX SMF_SRCDIR
9588: SNIPROXY_GROUP SNIPROXY_USER
9589: SOURCE_BUFFSIZE SPECIAL_PERMS
9590: SPECIFIC_PKGS SSH_SUID
9591: SSP_SUPPORTED SSYNC_PAWD
9592: STEP_MSG STRIP
9593: STRIP_DBG STRIP_DEBUG
9594: STRIP_DEBUG_SUPPORTED STRIP_FILES_SKIP
9595: SU SUBDIR
9596: SUBST SUBST_CLASSES
9597: SUBST_FILES SUBST_FILTER_CMD
9598: SUBST_MESSAGE SUBST_NOOP_OK
9599: SUBST_SED SUBST_SHOW_DIFF
9600: SUBST_SKIP_TEXT_CHECK SUBST_STAGE
9601: SUBST_VARS SUNWSPROBASE
9602: SUSE_PREFER SU_CMD
9603: SYSCONFBASE TBL
9604: TERMCAP_TYPE TERMINFO_DEFAULT
9605: TERMINFO_TYPE TEST
9606: TEST_DEPENDS TEST_DIRS
9607: TEST_ENV TEST_ENV_SHELL
9608: TEST_MAKE_CMD TEST_MAKE_FLAGS
9609: TEST_TARGET TEXLIVE_IGNORE_PATTERNS
9610: TEXLIVE_REV TEXLIVE_UNVERSIONED
9611: TEXMFSITE TEX_FORMATS
9612: TEX_HYPHEN_DAT TEX_HYPHEN_DEF
9613: TEX_TEXMF_DIRS THTTPD_LOG_FACILITY
9614: TINYDYN_USER TO
9615: TOOLS_ALIASES TOOLS_ALWAYS_WRAP
9616: TOOLS_ARGS TOOLS_BROKEN
9617: TOOLS_CMD TOOLS_CMDLINE_SED
9618: TOOLS_CREATE TOOLS_DIR
9619: TOOLS_FAIL TOOLS_GNU_MISSING
9620: TOOLS_LDCONFIG TOOLS_NOOP
9621: TOOLS_PATH TOOLS_SCRIPT
9622: TOOL_DEPENDS TTF_FONTS_DIR
9623: TYPE UAC_REQD_EXECS
9624: UCSPI_SSL_GROUP UCSPI_SSL_USER
9625: UNLIMIT_RESOURCES UNPRIVILEGED
9626: UNPRIVILEGED_GROUP UNPRIVILEGED_GROUPS
9627: UNPRIVILEGED_USER UNWRAP_FILES
9628: UNWRAP_PATTERNS UPDATE_GEMSPEC
9629: UPDATE_TARGET URI
9630: USERGROUP_PHASE USERPPP_GROUP
9631: USER_SPECIFIC_PKGS USE_ABI_DEPENDS
9632: USE_APR USE_BSD_MAKEFILE
9633: USE_BUILTIN USE_CROSS_COMPILE
9634: USE_CURSES USE_CWRAPPERS
9635: USE_DB185 USE_FEATURES
9636: USE_GAMESGROUP USE_GCC_RUNTIME
9637: USE_IMAKE USE_JAVA
9638: USE_JAVA2 USE_LANGUAGES
9639: USE_LIBTOOL USE_NATIVE_GCC
9640: USE_NETBSD_REPO USE_PKGSRC_GCC
9641: USE_PKGSRC_GCC_RUNTIME USE_PKGTASKS
9642: USE_PKG_ADMIN_DIGEST USE_RUBY_EXTCONF
9643: USE_RUBY_INSTALL USE_RUBY_SETUP
9644: USE_RUBY_SETUP_PKG USE_TOOLS
9645: UUCP_GROUP UUCP_USER
9646: VARBASE VARNAME
9647: VIM_EXTRA_OPTS WARNING_MSG
9648: WCALC_CGIDIR WCALC_CGIPATH
9649: WCALC_HTMLDIR WCALC_HTMLPATH
9650: WDM_MANAGERS WRAPPER_CC
9651: WRAPPER_REORDER_CMDS WRKDIR
9652: WRKDIR_BASENAME WRKDIR_LOCKTYPE
9653: WRKLOG WRKOBJDIR
9654: WRKSRC X10_PORT
9655: X11 X11BASE
9656: X11_PKGSRCDIR X11_TYPE
9657: X509_CERTIFICATE X509_KEY
9658: XAW_TYPE XLOCK_DEFAULT_MODE
9659: XMKMF XMKMF_FLAGS
9660: XXX YES
9661: ZSH_STATIC __stdc__
9662: _vargroups accept
9663: acquire-localbase-lock acquire-lock
9664: add administrator
9665: alloca alternatives
9666: aslr asprintf
9667: atlas autoconf
9668: automake autoreconf
9669: awk bash
9670: big-endian bin-install
9671: bind binpkg-list
9672: blas bootstrap-depends
9673: broken broken_on_platform
9674: bsd bsd.prog.mk
9675: build build-env
9676: buildlink-directories buildlink-oss-soundcard-h
9677: c c++
9678: ccache cce
9679: cdefs ceil
9680: changes changes-entry
9681: changes-entry-noupdate check
9682: check-clean check-files
9683: check-files-clean check-vulnerable
9684: checksum checksum-phase
9685: clean clean-depends
9686: cleandir commit
9687: commit-changes-entry compact
9688: compiler conf
9689: config.guess config.sub
9690: configuration configure
9691: configure-env configure-help
9692: configure_args connect
9693: cos cputime
9694: create-usergroup csh
9695: ctf debug
9696: declaration declare
9697: defined depend
9698: dependencies depends
9699: depends-checksum depends-fetch
9700: deps describe
9701: destdir disable
9702: distclean distinfo
9703: dl dlopen
9704: do-build do-buildlink
9705: do-clean do-configure
9706: do-configure-post-hook do-extract
9707: do-fetch emul
9708: emul-distinfo emul-fetch
9709: emulation emulator
9710: enable endian
9711: enomem err
9712: errx etc
9713: exp extract-rpm
9714: fabs feature
9715: features fetch
9716: fetch-list follows
9717: forbids form
9718: format fortify
9719: fortify_source friend
9720: fts fts_close
9721: fts_open fts_read
9722: fts_set gcc
9723: gethostbyaddr gethostbyname
9724: gethostbyname2 getopt_long
9725: getprogname getservbyname
9726: getservbyport getservent
9727: gettext github
9728: glob gnu
9729: gnu_configure_strict go
9730: go-deps golang
9731: guess-license hashbang
9732: heimdal help
9733: imake increment
9734: inet_aton interp
9735: interpreter intl
9736: ip4 ip6
9737: ipv4 ipv6
9738: iso kerberos
9739: krb krb5
9740: ksh lapack
9741: latex libintl_bindtextdomain
9742: libintl_gettext libintl_textdomain
9743: libnbcompat libs
9744: libtool licence
9745: license lintl
9746: little-endian lock
9747: locking lvalue
9748: make makesum
9749: memory meta
9750: meta-package meta_package
9751: mit-krb5 mk.conf
9752: mkl mount
9753: mprotect mremap
9754: nb nbcompat
9755: obstack obstack_ptr_grow
9756: occurs only
9757: openblas options
9758: options.mk order
9759: override override-intltool
9760: override-message-intltool package
9761: parallel path
9762: pax paxctl
9763: pbulk-index pc
9764: perl perl5
9765: perms php
9766: pkg-build-options pkg-config
9767: pkg_build_options platform
9768: plist post-extract
9769: post-fetch post-wrapper
9770: pre-build-checks-hook pre-configure
9771: pre-configure-checks-hook pre-extract
9772: pre-fetch print-go-deps
9773: print-plist print-summary-data
9774: privileged-install-hook pypi
9775: python readme-all
9776: recv recvfrom
9777: regcomp release-localbase-lock
9778: release-lock relro
9779: rename reorder
9780: replace replace_interpreter
9781: reproducible resolv
9782: root ruby
9783: send sendfile
9784: sendto setenv
9785: setgid setprogname
9786: setuid sh
9787: shebang show
9788: show-all show-build-defs
9789: show-depends show-deps
9790: show-distfiles show-downlevel
9791: show-subdir-var show-tools
9792: show-var show-vars
9793: snprintf socket
9794: ssp st_mode
9795: stage-install strcasestr
9796: strict strip
9797: strndup strnlen
9798: strsep subst
9799: substitutions sun
9800: sunpro sunwspro
9801: symlink test
9802: test-env tex
9803: texlive tmp
9804: tool tools
9805: tools-libtool-m4-override type
9806: ulimit undefined
9807: undo-replace unlimit
9808: unprivileged unprivileged-install-hook
9809: unstripped update
9810: upload upload-distfiles
9811: use_tools user
9812: utimes vasprintf
9813: verbose vsnprintf
9814: warn warning
9815: warnings warnx
9816: wattr_off wattr_on
9817: work wrapper
9818: wrkdir
1.154 rillig 9819:
9820: Appendix E. Editing guidelines for the pkgsrc guide
1.1 dsieger 9821:
9822: Table of Contents
9823:
1.154 rillig 9824: E.1. Make targets
9825: E.2. Procedure
1.1 dsieger 9826:
9827: This section contains information on editing the pkgsrc guide itself.
9828:
1.154 rillig 9829: E.1. Make targets
1.1 dsieger 9830:
9831: The pkgsrc guide's source code is stored in pkgsrc/doc/guide/files, and several
9832: files are created from it:
9833:
9834: * pkgsrc/doc/pkgsrc.txt
9835:
9836: * pkgsrc/doc/pkgsrc.html
9837:
1.174 leot 9838: * https://www.NetBSD.org/docs/pkgsrc/
1.1 dsieger 9839:
1.174 leot 9840: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.pdf: The PDF version of the
9841: pkgsrc guide.
1.1 dsieger 9842:
1.174 leot 9843: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.ps: PostScript version of the
1.2 rillig 9844: pkgsrc guide.
1.1 dsieger 9845:
1.154 rillig 9846: E.2. Procedure
1.1 dsieger 9847:
9848: The procedure to edit the pkgsrc guide is:
9849:
1.190 bacon 9850: 1. Make sure you have checked out the htdocs repository into a sibling
9851: directory of your pkgsrc directory. You will need the ability to commit
9852: from both pkgsrc and htdocs.
9853:
9854: 2. Make sure you have the packages needed to regenerate the pkgsrc guide (and
1.46 obache 9855: other XML-based NetBSD documentation) installed. These are automatically
9856: installed when you install the meta-pkgs/pkgsrc-guide-tools package.
1.1 dsieger 9857:
1.190 bacon 9858: 3. Run cd doc/guide to get to the right directory. All further steps will take
1.1 dsieger 9859: place here.
9860:
1.190 bacon 9861: 4. Edit the XML file(s) in files/.
1.1 dsieger 9862:
1.190 bacon 9863: 5. Run bmake to check the pkgsrc guide for valid XML and to build the final
1.1 dsieger 9864: output files. If you get any errors at this stage, you can just edit the
9865: files, as there are only symbolic links in the working directory, pointing
9866: to the files in files/.
9867:
1.190 bacon 9868: 6. (cd files && cvs commit)
1.1 dsieger 9869:
1.190 bacon 9870: 7. Run bmake clean && bmake to regenerate the output files with the proper RCS
1.1 dsieger 9871: Ids.
9872:
1.190 bacon 9873: 8. Run bmake regen to install and commit the files in both pkgsrc/doc and
1.1 dsieger 9874: htdocs.
9875:
9876: Note
9877:
9878: If you have added, removed or renamed some chapters, you need to
9879: synchronize them using cvs add or cvs delete in the htdocs directory.
9880:
CVSweb <webmaster@jp.NetBSD.org>