Annotation of htdocs/docs/pkgsrc/pkgsrc.txt, revision 1.231
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.231 ! jnemeth 15: Copyright 1994-2023 The NetBSD Foundation, Inc
1.1 dsieger 16:
1.231 ! jnemeth 17: $NetBSD: pkgsrc.xml,v 1.42 2023/01/02 05:45:23 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?
1.221 nia 147: 10.12. Using 'sudo' or `priv` with pkgsrc
1.154 rillig 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.219 nia 208: 14.1.1. Python modules and programs
209: 14.1.2. R packages
210: 14.1.3. TeXlive packages
1.1 dsieger 211:
1.184 rillig 212: 14.2. Examples
1.1 dsieger 213:
1.184 rillig 214: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 215:
1.184 rillig 216: 15. Programming in Makefiles
1.1 dsieger 217:
1.184 rillig 218: 15.1. Caveats
219: 15.2. Makefile variables
1.1 dsieger 220:
1.184 rillig 221: 15.2.1. Naming conventions
1.1 dsieger 222:
1.184 rillig 223: 15.3. Code snippets
1.1 dsieger 224:
1.184 rillig 225: 15.3.1. Adding things to a list
226: 15.3.2. Echoing a string exactly as-is
227: 15.3.3. Passing CFLAGS to GNU configure scripts
228: 15.3.4. Handling possibly empty variables
1.229 gutterid 229: 15.3.5. Testing yes/no variables in conditions
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
1.223 nia 327: 21.3.4. Meson / ninja
1.154 rillig 328:
329: 21.4. Programming languages
330:
331: 21.4.1. C, C++, and Fortran
332: 21.4.2. Java
1.205 wiz 333: 21.4.3. Go
1.223 nia 334: 21.4.4. Rust
335: 21.4.5. Packages containing Perl scripts
336: 21.4.6. Packages containing shell scripts
337: 21.4.7. Other programming languages
1.154 rillig 338:
339: 21.5. The build phase
340:
341: 21.5.1. Compiling C and C++ code conditionally
342: 21.5.2. How to handle compiler bugs
1.172 rillig 343: 21.5.3. No such file or directory
344: 21.5.4. Undefined reference to "..."
345: 21.5.5. Running out of memory
1.154 rillig 346:
347: 21.6. The install phase
348:
349: 21.6.1. Creating needed directories
350: 21.6.2. Where to install documentation
351: 21.6.3. Installing highscore files
352: 21.6.4. Adding DESTDIR support to packages
353: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 354: 21.6.6. Packages installing Perl modules
1.154 rillig 355: 21.6.7. Packages installing info files
356: 21.6.8. Packages installing man pages
1.203 nia 357: 21.6.9. Packages installing X11 fonts
358: 21.6.10. Packages installing SGML or XML data
359: 21.6.11. Packages installing extensions to the MIME database
360: 21.6.12. Packages using intltool
361: 21.6.13. Packages installing startup scripts
362: 21.6.14. Packages installing TeX modules
363: 21.6.15. Packages supporting running binaries in emulation
364: 21.6.16. Packages installing hicolor icons
365: 21.6.17. Packages installing desktop files
1.154 rillig 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:
1.207 leot 434: B. Security hardening
1.1 dsieger 435:
1.207 leot 436: B.1. Mechanisms
1.1 dsieger 437:
1.207 leot 438: B.1.1. Enabled by default
439: B.1.2. Not enabled by default
1.1 dsieger 440:
1.207 leot 441: B.2. Caveats
1.1 dsieger 442:
1.207 leot 443: B.2.1. Problems with PKGSRC_MKPIE
444: B.2.2. Problems with PKGSRC_USE_FORTIFY
445: B.2.3. Problems with PKGSRC_USE_RELRO
446: B.2.4. Problems with PKGSRC_USE_SSP
1.1 dsieger 447:
1.207 leot 448: B.3. Auditing the system
449:
450: B.3.1. Checking for PIE
451: B.3.2. Checking for partial RELRO
452: B.3.3. Checking for full RELRO
453: B.3.4. Checking for SSP
454:
455: C. Build logs
456:
457: C.1. Building figlet
458: C.2. Packaging figlet
459:
460: D. Directory layout of the pkgsrc FTP server
461:
462: D.1. distfiles: The distributed source files
463: D.2. misc: Miscellaneous things
464: D.3. packages: Binary packages
465: D.4. reports: Bulk build reports
466: D.5. current, stable, pkgsrc-20xxQy: source packages
467:
468: E. Help topics
469: F. Editing guidelines for the pkgsrc guide
470:
471: F.1. Make targets
472: F.2. Procedure
1.1 dsieger 473:
474: List of Tables
475:
476: 1.1. Platforms supported by pkgsrc
1.184 rillig 477: 12.1. Patching examples
478: 22.1. PLIST handling for GNOME packages
1.1 dsieger 479:
480: Chapter 1. What is pkgsrc?
481:
482: Table of Contents
483:
484: 1.1. Introduction
485:
486: 1.1.1. Why pkgsrc?
487: 1.1.2. Supported platforms
488:
489: 1.2. Overview
490: 1.3. Terminology
491:
492: 1.3.1. Roles involved in pkgsrc
493:
494: 1.4. Typography
495:
496: 1.1. Introduction
497:
498: There is a lot of software freely available for Unix-based systems, which is
499: usually available in form of the source code. Before such software can be used,
500: it needs to be configured to the local system, compiled and installed, and this
501: is exactly what The NetBSD Packages Collection (pkgsrc) does. pkgsrc also has
502: some basic commands to handle binary packages, so that not every user has to
503: build the packages for himself, which is a time-costly task.
504:
505: pkgsrc currently contains several thousand packages, including:
506:
1.104 sevan 507: * www/apache24 - The Apache web server
1.1 dsieger 508:
509: * www/firefox - The Firefox web browser
510:
511: * meta-pkgs/gnome - The GNOME Desktop Environment
512:
1.102 ryoon 513: * meta-pkgs/kde4 - The K Desktop Environment
1.1 dsieger 514:
1.108 rillig 515: ? just to name a few.
1.1 dsieger 516:
517: pkgsrc has built-in support for handling varying dependencies, such as pthreads
518: and X11, and extended features such as IPv6 support on a range of platforms.
519:
520: 1.1.1. Why pkgsrc?
521:
522: pkgsrc provides the following key features:
523:
524: * Easy building of software from source as well as the creation and
525: installation of binary packages. The source and latest patches are
526: retrieved from a master or mirror download site, checksum verified, then
527: built on your system. Support for binary-only distributions is available
528: for both native platforms and NetBSD emulated platforms.
529:
530: * All packages are installed in a consistent directory tree, including
531: binaries, libraries, man pages and other documentation.
532:
1.104 sevan 533: * Tracking of package dependencies automatically, including when performing
534: updates, to ensure required packages are installed. The configuration files
535: of various packages are handled automatically during updates, so local
536: changes are preserved.
1.1 dsieger 537:
538: * Like NetBSD, pkgsrc is designed with portability in mind and consists of
539: highly portable code. This allows the greatest speed of development when
1.26 spz 540: porting to a new platform. This portability also ensures that pkgsrc is
1.1 dsieger 541: consistent across all platforms.
542:
543: * The installation prefix, acceptable software licenses, international
544: encryption requirements and build-time options for a large number of
545: packages are all set in a simple, central configuration file.
546:
547: * The entire source (not including the distribution files) is freely
548: available under a BSD license, so you may extend and adapt pkgsrc to your
549: needs. Support for local packages and patches is available right out of the
550: box, so you can configure it specifically for your environment.
551:
552: The following principles are basic to pkgsrc:
553:
1.198 leot 554: * "It should only work if it's right." -- That means, if a package contains
1.1 dsieger 555: bugs, it's better to find them and to complain about them rather than to
556: just install the package and hope that it works. There are numerous checks
1.175 gutterid 557: in pkgsrc that try to find such bugs: static analysis tools (pkgtools/
1.1 dsieger 558: pkglint), build-time checks (portability of shell scripts), and
559: post-installation checks (installed files, references to shared libraries,
560: script interpreters).
561:
1.198 leot 562: * "If it works, it should work everywhere" -- Like NetBSD has been ported to
1.1 dsieger 563: many hardware architectures, pkgsrc has been ported to many operating
564: systems. Care is taken that packages behave the same on all platforms.
565:
566: 1.1.2. Supported platforms
567:
568: pkgsrc consists of both a source distribution and a binary distribution for
569: these operating systems. After retrieving the required source or binaries, you
570: can be up and running with pkgsrc in just minutes!
571:
572: pkgsrc was derived from FreeBSD's ports system, and initially developed for
573: NetBSD only. Since then, pkgsrc has grown a lot, and now supports the following
574: platforms:
575:
576: Table 1.1. Platforms supported by pkgsrc
577:
1.92 sevan 578: +-----------------------------------------------------------------------------+
1.229 gutterid 579: | Platform | Date Support | Notes |
580: | | Added | |
581: |-------------------------------------+---------------+-----------------------|
582: |NetBSD | Aug 1997 | |
583: |-------------------------------------+---------------+-----------------------|
584: |Solaris | Mar 1999 |README.Solaris |
585: |-------------------------------------+---------------+-----------------------|
586: |Linux | Jun 1999 |README.Linux |
587: |-------------------------------------+---------------+-----------------------|
588: |Darwin / Mac OS X / OS X / macOS | Oct 2001 |README.macOS |
589: |-------------------------------------+---------------+-----------------------|
590: |FreeBSD | Nov 2002 |README.FreeBSD |
591: |-------------------------------------+---------------+-----------------------|
592: |OpenBSD | Nov 2002 |README.OpenBSD |
593: |-------------------------------------+---------------+-----------------------|
594: |IRIX | Dec 2002 |README.IRIX |
595: |-------------------------------------+---------------+-----------------------|
596: |BSD/OS | Dec 2003 | |
597: |-------------------------------------+---------------+-----------------------|
598: |AIX | Dec 2003 |README.AIX |
599: |-------------------------------------+---------------+-----------------------|
600: |Interix (Microsoft Windows Services | Mar 2004 |README.Interix |
601: |for Unix) | | |
602: |-------------------------------------+---------------+-----------------------|
603: |DragonFlyBSD | Oct 2004 | |
604: |-------------------------------------+---------------+-----------------------|
605: |OSF/1 | Nov 2004 |README.OSF1 |
606: |-------------------------------------+---------------+-----------------------|
607: |HP-UX | Apr 2007 |README.HPUX |
608: |-------------------------------------+---------------+-----------------------|
609: |Haiku | Sep 2010 |README.Haiku |
610: |-------------------------------------+---------------+-----------------------|
611: |MirBSD | Jan 2011 | |
612: |-------------------------------------+---------------+-----------------------|
613: |Minix3 | Nov 2011 |README.Minix3 |
614: |-------------------------------------+---------------+-----------------------|
615: |Cygwin | Mar 2013 |README.Cygwin |
616: |-------------------------------------+---------------+-----------------------|
617: |GNU/kFreeBSD | Jul 2013 |README.GNUkFreeBSD |
618: |-------------------------------------+---------------+-----------------------|
619: |Bitrig | Jun 2014 |Removed from pkgsrc Sep|
620: | | |2022 |
1.92 sevan 621: +-----------------------------------------------------------------------------+
1.1 dsieger 622:
623:
624: 1.2. Overview
625:
626: This document is divided into three parts. The first, The pkgsrc user's guide,
627: describes how one can use one of the packages in the Package Collection, either
628: by installing a precompiled binary package, or by building one's own copy using
629: the NetBSD package system. The second part, The pkgsrc developer's guide,
630: explains how to prepare a package so it can be easily built by other NetBSD
631: users without knowing about the package's building details. The third part, The
632: pkgsrc infrastructure internals is intended for those who want to understand
633: how pkgsrc is implemented.
634:
635: This document is available in various formats: HTML, PDF, PS, TXT.
636:
637: 1.3. Terminology
638:
639: There has been a lot of talk about "ports", "packages", etc. so far. Here is a
640: description of all the terminology used within this document.
641:
642: Package
643:
644: A set of files and building instructions that describe what's necessary to
645: build a certain piece of software using pkgsrc. Packages are traditionally
1.123 wiz 646: stored under /usr/pkgsrc, but may be stored in any location, referred to as
647: PKGSRCDIR.
1.1 dsieger 648:
649: The NetBSD package system
650:
651: This is the former name of "pkgsrc". It is part of the NetBSD operating
652: system and can be bootstrapped to run on non-NetBSD operating systems as
653: well. It handles building (compiling), installing, and removing of
654: packages.
655:
656: Distfile
657:
658: This term describes the file or files that are provided by the author of
659: the piece of software to distribute his work. All the changes necessary to
660: build on NetBSD are reflected in the corresponding package. Usually the
661: distfile is in the form of a compressed tar-archive, but other types are
662: possible, too. Distfiles are usually stored below /usr/pkgsrc/distfiles.
663:
664: Port
665:
666: This is the term used by FreeBSD and OpenBSD people for what we call a
667: package. In NetBSD terminology, "port" refers to a different architecture.
668:
669: Precompiled/binary package
670:
671: A set of binaries built with pkgsrc from a distfile and stuffed together in
672: a single .tgz file so it can be installed on machines of the same machine
673: architecture without the need to recompile. Packages are usually generated
674: in /usr/pkgsrc/packages; there is also an archive on ftp.NetBSD.org.
675:
676: Sometimes, this is referred to by the term "package" too, especially in the
677: context of precompiled packages.
678:
679: Program
680:
681: The piece of software to be installed which will be constructed from all
682: the files in the distfile by the actions defined in the corresponding
683: package.
684:
685: 1.3.1. Roles involved in pkgsrc
686:
687: pkgsrc users
688:
689: The pkgsrc users are people who use the packages provided by pkgsrc.
690: Typically they are system administrators. The people using the software
691: that is inside the packages (maybe called "end users") are not covered by
692: the pkgsrc guide.
693:
694: There are two kinds of pkgsrc users: Some only want to install pre-built
695: binary packages. Others build the pkgsrc packages from source, either for
696: installing them directly or for building binary packages themselves. For
697: pkgsrc users Part I, "The pkgsrc user's guide" should provide all necessary
698: documentation.
699:
700: package maintainers
701:
702: A package maintainer creates packages as described in Part II, "The pkgsrc
703: developer's guide".
704:
705: infrastructure developers
706:
707: These people are involved in all those files that live in the mk/ directory
708: and below. Only these people should need to read through Part III, "The
709: pkgsrc infrastructure internals", though others might be curious, too.
710:
711: 1.4. Typography
712:
713: When giving examples for commands, shell prompts are used to show if the
714: command should/can be issued as root, or if "normal" user privileges are
1.115 sevan 715: sufficient. We use a # for root's shell prompt, a % for users' shell prompt,
1.229 gutterid 716: assuming they use the C-shell or tcsh and a $ for Bourne shell and derivatives.
1.1 dsieger 717:
718: Part I. The pkgsrc user's guide
719:
720: Table of Contents
721:
1.154 rillig 722: 2. Getting help
723: 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 724:
1.154 rillig 725: 3.1. Getting pkgsrc for the first time
1.1 dsieger 726:
1.154 rillig 727: 3.1.1. As tar archive
728: 3.1.2. Via anonymous CVS
1.1 dsieger 729:
1.154 rillig 730: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 731:
1.154 rillig 732: 3.2.1. Via tar files
733: 3.2.2. Via CVS
1.1 dsieger 734:
1.154 rillig 735: 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 736:
1.154 rillig 737: 4.1. Binary distribution
738: 4.2. Bootstrapping pkgsrc
1.1 dsieger 739:
1.154 rillig 740: 5. Using pkgsrc
1.1 dsieger 741:
1.154 rillig 742: 5.1. Using binary packages
1.1 dsieger 743:
1.154 rillig 744: 5.1.1. Finding binary packages
745: 5.1.2. Installing binary packages
1.202 nia 746: 5.1.3. Updating packages
747: 5.1.4. Deinstalling packages
748: 5.1.5. Getting information about installed packages
749: 5.1.6. Checking for security vulnerabilities in installed packages
750: 5.1.7. Finding if newer versions of your installed packages are in
1.1 dsieger 751: pkgsrc
1.202 nia 752: 5.1.8. Other administrative functions
1.1 dsieger 753:
1.154 rillig 754: 5.2. Building packages from source
1.1 dsieger 755:
1.154 rillig 756: 5.2.1. Requirements
757: 5.2.2. Fetching distfiles
758: 5.2.3. How to build and install
1.1 dsieger 759:
1.154 rillig 760: 6. Configuring pkgsrc
1.1 dsieger 761:
1.154 rillig 762: 6.1. General configuration
763: 6.2. Variables affecting the build process
764: 6.3. Variables affecting the installation process
765: 6.4. Selecting and configuring the compiler
1.1 dsieger 766:
1.154 rillig 767: 6.4.1. Selecting the compiler
768: 6.4.2. Additional flags to the compiler (CFLAGS)
769: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 770:
1.154 rillig 771: 6.5. Developer/advanced settings
772: 6.6. Selecting Build Options
1.1 dsieger 773:
1.154 rillig 774: 7. Creating binary packages
1.1 dsieger 775:
1.154 rillig 776: 7.1. Building a single binary package
777: 7.2. Settings for creation of binary packages
1.1 dsieger 778:
1.154 rillig 779: 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 780:
1.154 rillig 781: 8.1. Preparations
1.180 rillig 782: 8.2. Running a bulk build
1.6 rillig 783:
1.154 rillig 784: 8.2.1. Configuration
1.6 rillig 785:
1.154 rillig 786: 8.3. Requirements of a full bulk build
1.178 rillig 787: 8.4. Bulk build variants
788:
1.179 rillig 789: 8.4.1. Detect unknown configure options
790: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 791: 8.4.3. Force compiler options only in the build phase
792: 8.4.4. Use custom directories
793: 8.4.5. Turn warnings into errors
794: 8.4.6. Reject packages for which pkglint reports errors
795: 8.4.7. Reject packages that contain forbidden strings
796: 8.4.8. Reject packages whose self-test fails
797: 8.4.9. Reject packages that use undefined shell variables
798: 8.4.10. Turn off verbose logging
1.6 rillig 799:
1.178 rillig 800: 8.5. Creating a multiple CD-ROM packages collection
801:
802: 8.5.1. Example of cdpack
1.6 rillig 803:
1.154 rillig 804: 9. Directory layout of the installed files
1.6 rillig 805:
1.154 rillig 806: 9.1. File system layout in ${LOCALBASE}
807: 9.2. File system layout in ${VARBASE}
1.6 rillig 808:
1.154 rillig 809: 10. Frequently Asked Questions
1.6 rillig 810:
1.154 rillig 811: 10.1. Are there any mailing lists for pkg-related discussion?
812: 10.2. Utilities for package management (pkgtools)
813: 10.3. How to use pkgsrc as non-root
814: 10.4. How to resume transfers when fetching distfiles?
815: 10.5. How can I install/use modular X.org from pkgsrc?
816: 10.6. How to fetch files from behind a firewall
817: 10.7. How to fetch files from HTTPS sites
818: 10.8. How do I tell make fetch to do passive FTP?
819: 10.9. How to fetch all distfiles at once
820: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
821: 10.11. What does "Could not find bsd.own.mk" mean?
1.221 nia 822: 10.12. Using 'sudo' or `priv` with pkgsrc
1.154 rillig 823: 10.13. How do I change the location of configuration files?
824: 10.14. Automated security checks
825: 10.15. Why do some packages ignore my CFLAGS?
826: 10.16. A package does not build. What shall I do?
827: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.24 wiz 828: conflicts" mean?
1.1 dsieger 829:
1.154 rillig 830: Chapter 2. Getting help
831:
832: To get help when using pkgsrc, the definitive source is this document, the
833: pkgsrc guide. If you don't find anything here, there are alternatives:
834:
835: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
836: Run bmake help topic=? to get help for any topic, such as a variable name
837: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
838: like strcasecmp or any other topic.
839:
1.207 leot 840: The available help topics are listed in Appendix E, Help topics.
1.154 rillig 841:
1.163 rillig 842: * To see the value of a single variable, run bmake show-var VARNAME=X.
843:
844: * To see the values of the most common variables, run bmake show-all. These
845: variables are grouped by topic. To see the variables for a single topic,
846: run bmake show-all-topic, for example bmake show-all-fetch.
847:
1.154 rillig 848: * The pkgsrc-users mailing list, to which you can subscribe and then ask your
849: questions.
850:
851: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
852: a specialized chat program such as XChat. Pick any user name and join the
853: channel #pkgsrc.
854:
855: Chapter 3. Where to get pkgsrc and how to keep it up-to-date
1.1 dsieger 856:
857: Table of Contents
858:
1.154 rillig 859: 3.1. Getting pkgsrc for the first time
1.1 dsieger 860:
1.154 rillig 861: 3.1.1. As tar archive
862: 3.1.2. Via anonymous CVS
1.1 dsieger 863:
1.154 rillig 864: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 865:
1.154 rillig 866: 3.2.1. Via tar files
867: 3.2.2. Via CVS
1.1 dsieger 868:
869: Before you download and extract the files, you need to decide where you want to
870: extract them. When using pkgsrc as root user, pkgsrc is usually installed in /
871: usr/pkgsrc. You are though free to install the sources and binary packages
872: wherever you want in your filesystem, provided that the pathname does not
873: contain white-space or other characters that are interpreted specially by the
874: shell and some other programs. A safe bet is to use only letters, digits,
875: underscores and dashes.
876:
1.154 rillig 877: 3.1. Getting pkgsrc for the first time
1.1 dsieger 878:
1.25 wiz 879: Before you download any pkgsrc files, you should decide whether you want the
1.1 dsieger 880: current branch or the stable branch. The latter is forked on a quarterly basis
881: from the current branch and only gets modified for security updates. The names
882: of the stable branches are built from the year and the quarter, for example
1.214 leot 883: 2021Q4.
1.1 dsieger 884:
885: The second step is to decide how you want to download pkgsrc. You can get it as
1.24 wiz 886: a tar file or via CVS. Both ways are described here.
1.1 dsieger 887:
1.52 asau 888: Note that tar archive contains CVS working copy. Thus you can switch to using
889: CVS at any later time.
1.1 dsieger 890:
1.154 rillig 891: 3.1.1. As tar archive
1.52 asau 892:
1.151 sevan 893: The primary download location for all pkgsrc files is https://cdn.NetBSD.org/
894: pub/pkgsrc/ or ftp://ftp.NetBSD.org/pub/pkgsrc/ (it points to the same
895: location). There are a number of subdirectories for different purposes, which
1.207 leot 896: are described in detail in Appendix D, Directory layout of the pkgsrc FTP
1.151 sevan 897: server.
1.1 dsieger 898:
1.52 asau 899: The tar archive for the current branch is in the directory current and is
1.118 sevan 900: called pkgsrc.tar.gz. It is autogenerated weekly.
1.52 asau 901:
902: To save download time we provide bzip2- and xz-compressed archives which are
903: published at pkgsrc.tar.bz2 and pkgsrc.tar.xz respectively.
904:
905: You can fetch the same files using FTP.
1.1 dsieger 906:
1.214 leot 907: The tar file for the stable branch 2021Q4 is in the directory pkgsrc-2021Q4 and
1.59 jnemeth 908: is also called pkgsrc.tar.gz.
1.1 dsieger 909:
1.136 leot 910: To download the latest pkgsrc stable tarball, run:
1.12 weinem 911:
1.214 leot 912: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2021Q4/pkgsrc.tar.gz
1.12 weinem 913:
1.78 snj 914: If you prefer, you can also fetch it using "wget", "curl", or your web browser.
1.52 asau 915:
1.12 weinem 916: Then, extract it with:
917:
1.78 snj 918: $ tar -xzf pkgsrc.tar.gz -C /usr
1.12 weinem 919:
920: This will create the directory pkgsrc/ in /usr/ and all the package source will
921: be stored under /usr/pkgsrc/.
922:
923: To download pkgsrc-current, run:
924:
925: $ ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz
1.1 dsieger 926:
1.154 rillig 927: 3.1.2. Via anonymous CVS
1.1 dsieger 928:
1.24 wiz 929: To fetch a specific pkgsrc stable branch, run:
1.1 dsieger 930:
1.214 leot 931: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2021Q4 -P pkgsrc
1.13 weinem 932:
1.24 wiz 933: This will create the directory pkgsrc/ in your /usr/ directory and all the
934: package source will be stored under /usr/pkgsrc/.
935:
936: To fetch the pkgsrc current branch, run:
1.1 dsieger 937:
1.40 wiz 938: $ cd /usr && cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 939:
1.30 dholland 940: Refer to the list of available mirrors to choose a faster CVS mirror, if
941: needed.
1.1 dsieger 942:
1.24 wiz 943: If you get error messages from rsh, you need to set CVS_RSH variable. E.g.:
1.1 dsieger 944:
1.40 wiz 945: $ cd /usr && env CVS_RSH=ssh cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 946:
1.24 wiz 947: Refer to documentation on your command shell how to set CVS_RSH=ssh
948: permanently. For Bourne shells, you can set it in your .profile or better
949: globally in /etc/profile:
950:
951: # set CVS remote shell command
952: CVS_RSH=ssh
953: export CVS_RSH
1.12 weinem 954:
1.13 weinem 955: By default, CVS doesn't do things like most people would expect it to do. But
956: there is a way to convince CVS, by creating a file called .cvsrc in your home
1.12 weinem 957: directory and saving the following lines to it. This file will save you lots of
958: headache and some bug reports, so we strongly recommend it. You can find an
959: explanation of this file in the CVS documentation.
1.2 rillig 960:
961: # recommended CVS configuration file from the pkgsrc guide
1.155 sevan 962: cvs -q
1.2 rillig 963: checkout -P
1.4 rillig 964: update -dP
965: diff -upN
1.2 rillig 966: rdiff -u
1.24 wiz 967: release -d
1.1 dsieger 968:
1.154 rillig 969: 3.2. Keeping pkgsrc up-to-date
1.1 dsieger 970:
971: The preferred way to keep pkgsrc up-to-date is via CVS (which also works if you
972: have first installed it via a tar file). It saves bandwidth and hard disk
973: activity, compared to downloading the tar file again.
974:
1.154 rillig 975: 3.2.1. Via tar files
1.1 dsieger 976:
977: Warning
978:
979: When updating from a tar file, you first need to completely remove the old
980: pkgsrc directory. Otherwise those files that have been removed from pkgsrc in
981: the mean time will not be removed on your local disk, resulting in
982: inconsistencies. When removing the old files, any changes that you have done to
983: the pkgsrc files will be lost after updating. Therefore updating via CVS is
984: strongly recommended.
985:
986: Note that by default the distfiles and the binary packages are saved in the
987: pkgsrc tree, so don't forget to rescue them before updating. You can also
1.78 snj 988: configure pkgsrc to store distfiles and packages in directories outside the
1.154 rillig 989: pkgsrc tree by setting the DISTDIR and PACKAGES variables. See Chapter 6,
1.78 snj 990: Configuring pkgsrc for the details.
1.1 dsieger 991:
992: To update pkgsrc from a tar file, download the tar file as explained above.
993: Then, make sure that you have not made any changes to the files in the pkgsrc
994: directory. Remove the pkgsrc directory and extract the new tar file. Done.
995:
1.154 rillig 996: 3.2.2. Via CVS
1.1 dsieger 997:
1.26 spz 998: To update pkgsrc via CVS, change to the pkgsrc directory and run cvs:
1.12 weinem 999:
1.26 spz 1000: $ cd /usr/pkgsrc && cvs update -dP
1001:
1002: If you get error messages from rsh, you need to set CVS_RSH variable as
1003: described above. E.g.:
1004:
1005: $ cd /usr/pkgsrc && env CVS_RSH=ssh cvs up -dP
1.1 dsieger 1006:
1.154 rillig 1007: 3.2.2.1. Switching between different pkgsrc branches
1.1 dsieger 1008:
1009: When updating pkgsrc, the CVS program keeps track of the branch you selected.
1010: But if you, for whatever reason, want to switch from the stable branch to the
1011: current one, you can do it by adding the option "-A" after the "update"
1.25 wiz 1012: keyword. To switch from the current branch back to the stable branch, add the "
1.214 leot 1013: -rpkgsrc-2021Q4" option.
1.1 dsieger 1014:
1.154 rillig 1015: 3.2.2.2. What happens to my changes when updating?
1.1 dsieger 1016:
1017: When you update pkgsrc, the CVS program will only touch those files that are
1018: registered in the CVS repository. That means that any packages that you created
1019: on your own will stay unmodified. If you change files that are managed by CVS,
1020: later updates will try to merge your changes with those that have been done by
1021: others. See the CVS manual, chapter "update" for details.
1022:
1.154 rillig 1023: Chapter 4. Using pkgsrc on systems other than NetBSD
1.1 dsieger 1024:
1025: Table of Contents
1026:
1.154 rillig 1027: 4.1. Binary distribution
1028: 4.2. Bootstrapping pkgsrc
1.1 dsieger 1029:
1.154 rillig 1030: 4.1. Binary distribution
1.1 dsieger 1031:
1.154 rillig 1032: See Section 5.1, "Using binary packages".
1.1 dsieger 1033:
1.154 rillig 1034: 4.2. Bootstrapping pkgsrc
1.1 dsieger 1035:
1.44 asau 1036: pkgsrc can be bootstrapped for use in two different modes: privileged and
1037: unprivileged one. In unprivileged mode in contrast to privileged one all
1.45 asau 1038: programs are installed under one particular user and cannot utilise privileged
1.44 asau 1039: operations (packages don't create special users and all special file
1040: permissions like setuid are ignored).
1041:
1.1 dsieger 1042: Installing the bootstrap kit from source should be as simple as:
1043:
1.60 asau 1044: # env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
1.1 dsieger 1045: # cd pkgsrc/bootstrap
1046: # ./bootstrap
1047:
1048:
1.44 asau 1049: To bootstrap in unprivileged mode pass "--unprivileged" flag to bootstrap
1050:
1051: By default, in privileged mode pkgsrc uses /usr/pkg for prefix where programs
1.118 sevan 1052: will be installed in, and /usr/pkg/pkgdb for the package database directory
1053: where pkgsrc will do its internal bookkeeping, /var is used as varbase, where
1.44 asau 1054: packages install their persistent data. In unprivileged mode pkgsrc uses ~/pkg
1.118 sevan 1055: for prefix, ~/pkg/pkgdb for the package database, and ~/pkg/var for varbase.
1.44 asau 1056:
1057: You can change default layout using command-line arguments. Run "./bootstrap
1058: --help" to get details.
1.1 dsieger 1059:
1060: Note
1061:
1062: The bootstrap installs a bmake tool. Use this bmake when building via pkgsrc.
1063: For examples in this guide, use bmake instead of "make".
1064:
1.44 asau 1065: Note
1066:
1067: It is possible to bootstrap multiple instances of pkgsrc using non-intersecting
1068: directories. Use bmake corresponding to the installation you're working with to
1069: build and install packages.
1070:
1.154 rillig 1071: Chapter 5. Using pkgsrc
1.1 dsieger 1072:
1073: Table of Contents
1074:
1.154 rillig 1075: 5.1. Using binary packages
1.1 dsieger 1076:
1.154 rillig 1077: 5.1.1. Finding binary packages
1078: 5.1.2. Installing binary packages
1.202 nia 1079: 5.1.3. Updating packages
1080: 5.1.4. Deinstalling packages
1081: 5.1.5. Getting information about installed packages
1082: 5.1.6. Checking for security vulnerabilities in installed packages
1083: 5.1.7. Finding if newer versions of your installed packages are in pkgsrc
1084: 5.1.8. Other administrative functions
1.154 rillig 1085:
1086: 5.2. Building packages from source
1087:
1088: 5.2.1. Requirements
1089: 5.2.2. Fetching distfiles
1090: 5.2.3. How to build and install
1.1 dsieger 1091:
1092: Basically, there are two ways of using pkgsrc. The first is to only install the
1093: package tools and to use binary packages that someone else has prepared. This
1094: is the "pkg" in pkgsrc. The second way is to install the "src" of pkgsrc, too.
1095: Then you are able to build your own packages, and you can still use binary
1096: packages from someone else.
1097:
1.154 rillig 1098: 5.1. Using binary packages
1.1 dsieger 1099:
1.151 sevan 1100: On the cdn.NetBSD.org site and mirrors, there are collections of binary
1.9 rillig 1101: packages, ready to be installed. These binary packages have been built using
1102: the default settings for the directories, that is:
1103:
1104: * /usr/pkg for LOCALBASE, where most of the files are installed,
1105:
1106: * /usr/pkg/etc for configuration files,
1107:
1108: * /var for VARBASE, where those files are installed that may change after
1109: installation.
1110:
1111: If you cannot use these directories for whatever reasons (maybe because you're
1112: not root), you cannot use these binary packages, but have to build the packages
1.154 rillig 1113: yourself, which is explained in Section 4.2, "Bootstrapping pkgsrc".
1.1 dsieger 1114:
1.154 rillig 1115: 5.1.1. Finding binary packages
1.1 dsieger 1116:
1.5 weinem 1117: To install binary packages, you first need to know from where to get them. The
1.202 nia 1118: first place where you should look is on the main pkgsrc CDN in the directory /
1119: pub/pkgsrc/packages.
1.5 weinem 1120:
1121: This directory contains binary packages for multiple platforms. First, select
1.226 gutterid 1122: your operating system. Then, select your hardware architecture, and in the
1123: third step, the OS version and the "version" of pkgsrc.
1.9 rillig 1124:
1.226 gutterid 1125: In this directory, you may find a file called bootstrap.tar.gz which contains
1.9 rillig 1126: the package management tools. If the file is missing, it is likely that your
1127: operating system already provides those tools. Download the file and extract it
1128: in the / directory. It will create the directories /usr/pkg (containing the
1.118 sevan 1129: tools for managing binary packages and the database of installed packages).
1.1 dsieger 1130:
1.154 rillig 1131: 5.1.2. Installing binary packages
1.1 dsieger 1132:
1.85 wiz 1133: In the directory from the last section, there is a subdirectory called All/,
1.9 rillig 1134: which contains all the binary packages that are available for the platform,
1.202 nia 1135: excluding those that may not be distributed via HTTP or FTP.
1.9 rillig 1136:
1137: To install packages directly from an FTP or HTTP server, run the following
1138: commands in a Bourne-compatible shell (be sure to su to root first):
1139:
1.202 nia 1140: # PATH="/usr/pkg/sbin:/usr/pkg/bin:$PATH"
1141: # PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages"
1.169 rillig 1142: # PKG_PATH="$PKG_PATH/OPSYS/ARCH/VERSIONS/All/"
1.9 rillig 1143: # export PATH PKG_PATH
1.202 nia 1144: # pkg_add pkgin
1.9 rillig 1145:
1146: Instead of URLs, you can also use local paths, for example if you are
1147: installing from a set of CDROMs, DVDs or an NFS-mounted repository. If you want
1148: to install packages from multiple sources, you can separate them by a semicolon
1149: in PKG_PATH.
1150:
1151: After these preparations, installing a package is very easy:
1152:
1.202 nia 1153: # pkgin search nginx
1154: nginx-1.19.6 Lightweight HTTP server and mail proxy server
1155: nginx-1.18.0nb8 Lightweight HTTP server and mail proxy server
1156: # pkgin install zsh nginx-1.19.6 vim
1.1 dsieger 1157:
1.202 nia 1158: Note that pkgin is a user-friendly frontend to the pkg_* tools.
1.1 dsieger 1159:
1.202 nia 1160: Any prerequisite packages needed to run the package in question will be
1161: installed, too, assuming they are present in the repository.
1.1 dsieger 1162:
1163: After you've installed packages, be sure to have /usr/pkg/bin and /usr/pkg/sbin
1164: in your PATH so you can actually start the just installed program.
1165:
1.202 nia 1166: 5.1.3. Updating packages
1.1 dsieger 1167:
1.202 nia 1168: To update binary packages, it is recommended that you use pkgin upgrade. This
1169: will compare the remote package repository to your locally installed packages
1170: and safely replace any older packages.
1.1 dsieger 1171:
1.202 nia 1172: Note that pkgsrc is released as quarterly branches. If you are updating to a
1173: newer quarterly branch of pkgsrc, you may need to adjust the repository in /usr
1174: /pkg/etc/pkgin/repositories.conf.
1.1 dsieger 1175:
1.202 nia 1176: 5.1.4. Deinstalling packages
1.1 dsieger 1177:
1.202 nia 1178: To deinstall a package, it does not matter whether it was installed from source
1179: code or from a binary package. Neither the pkgin or the pkg_delete command need
1180: to know.
1.1 dsieger 1181:
1.202 nia 1182: To delete a package, you can just run pkgin remove package-name. The package
1183: name can be given with or without version number.
1.1 dsieger 1184:
1.202 nia 1185: 5.1.5. Getting information about installed packages
1.1 dsieger 1186:
1187: The pkg_info shows information about installed packages or binary package
1.202 nia 1188: files. As with other management tools, it works with packages installed from
1189: source or binaries.
1.1 dsieger 1190:
1.202 nia 1191: 5.1.6. Checking for security vulnerabilities in installed packages
1.1 dsieger 1192:
1.202 nia 1193: The pkgsrc Security Team and Packages Groups maintain a list of known
1.164 leot 1194: vulnerabilities to packages which are (or have been) included in pkgsrc. The
1.202 nia 1195: list is available from the NetBSD CDN at https://cdn.NetBSD.org/pub/NetBSD/
1.179 rillig 1196: packages/vulns/pkg-vulnerabilities.
1.1 dsieger 1197:
1.202 nia 1198: Please note that not every "vulnerability" with a CVE assignment is exploitable
1199: in every configuration. Some bugs are marked as active simply because an fix
1200: was not marked as such. Operating system specific hardening and mitigation
1201: features may also reduce the impact of bugs.
1202:
1.23 jakllsch 1203: Through pkg_admin fetch-pkg-vulnerabilities, this list can be downloaded
1204: automatically, and a security audit of all packages installed on a system can
1205: take place.
1206:
1207: There are two components to auditing. The first step, pkg_admin
1208: fetch-pkg-vulnerabilities, is for downloading the list of vulnerabilities from
1209: the NetBSD FTP site. The second step, pkg_admin audit, checks to see if any of
1210: your installed packages are vulnerable. If a package is vulnerable, you will
1211: see output similar to the following:
1.1 dsieger 1212:
1213: Package samba-2.0.9 has a local-root-shell vulnerability, see
1.174 leot 1214: https://www.samba.org/samba/whatsnew/macroexploit.html
1.1 dsieger 1215:
1.23 jakllsch 1216: You may wish to have the vulnerabilities file downloaded daily so that it
1217: remains current. This may be done by adding an appropriate entry to the root
1218: users crontab(5) entry. For example the entry
1219:
1.121 sevan 1220: # Download vulnerabilities file
1.118 sevan 1221: 0 3 * * * /usr/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities >/dev/null 2>&1
1.121 sevan 1222: # Audit the installed packages and email results to root
1223: 9 3 * * * /usr/pkg/sbin/pkg_admin audit |mail -s "Installed package audit result" \
1224: root >/dev/null 2>&1
1.118 sevan 1225:
1226:
1227: will update the vulnerability list every day at 3AM, followed by an audit at
1228: 3:09AM. The result of the audit are then emailed to root. On NetBSD this may be
1229: accomplished instead by adding the following line to /etc/daily.conf:
1230:
1231: fetch_pkg_vulnerabilities=YES
1232:
1.23 jakllsch 1233:
1.118 sevan 1234: to fetch the vulnerability list from the daily security script. The system is
1235: set to audit the packages by default but can be set explicitly, if desired (not
1.123 wiz 1236: required), by adding the following line to /etc/security.conf:
1.23 jakllsch 1237:
1.118 sevan 1238: check_pkg_vulnerabilities=YES
1.23 jakllsch 1239:
1240:
1.118 sevan 1241: see daily.conf(5) and security.conf(5) for more details.
1.1 dsieger 1242:
1.202 nia 1243: 5.1.7. Finding if newer versions of your installed packages are in pkgsrc
1.1 dsieger 1244:
1.12 weinem 1245: Install pkgtools/lintpkgsrc and run lintpkgsrc with the "-i" argument to check
1.202 nia 1246: if any packages are stale, e.g.
1.1 dsieger 1247:
1248: % lintpkgsrc -i
1249: ...
1250: Version mismatch: 'tcsh' 6.09.00 vs 6.10.00
1251:
1252:
1.202 nia 1253: 5.1.8. Other administrative functions
1.1 dsieger 1254:
1255: The pkg_admin executes various administrative functions on the package system.
1256:
1.154 rillig 1257: 5.2. Building packages from source
1.1 dsieger 1258:
1259: After obtaining pkgsrc, the pkgsrc directory now contains a set of packages,
1.25 wiz 1260: organized into categories. You can browse the online index of packages, or run
1.1 dsieger 1261: make readme from the pkgsrc directory to build local README.html files for all
1262: packages, viewable with any web browser such as www/lynx or www/firefox.
1263:
1264: The default prefix for installed packages is /usr/pkg. If you wish to change
1265: this, you should do so by setting LOCALBASE in mk.conf. You should not try to
1266: use multiple different LOCALBASE definitions on the same system (inside a
1267: chroot is an exception).
1268:
1269: The rest of this chapter assumes that the package is already in pkgsrc. If it
1270: is not, see Part II, "The pkgsrc developer's guide" for instructions how to
1271: create your own packages.
1272:
1.154 rillig 1273: 5.2.1. Requirements
1.1 dsieger 1274:
1275: To build packages from source, you need a working C compiler. On NetBSD, you
1276: need to install the "comp" and the "text" distribution sets. If you want to
1277: build X11-related packages, the "xbase" and "xcomp" distribution sets are
1278: required, too.
1279:
1.154 rillig 1280: 5.2.2. Fetching distfiles
1.1 dsieger 1281:
1282: The first step for building a package is downloading the distfiles (i.e. the
1283: unmodified source). If they have not yet been downloaded, pkgsrc will fetch
1284: them automatically.
1285:
1286: If you have all files that you need in the distfiles directory, you don't need
1287: to connect. If the distfiles are on CD-ROM, you can mount the CD-ROM on /cdrom
1288: and add:
1289:
1290: DISTDIR=/cdrom/pkgsrc/distfiles
1291:
1292: to your mk.conf.
1293:
1294: By default a list of distribution sites will be randomly intermixed to prevent
1295: huge load on servers which holding popular packages (for example,
1296: SourceForge.net mirrors). Thus, every time when you need to fetch yet another
1297: distfile all the mirrors will be tried in new (random) order. You can turn this
1298: feature off by setting MASTER_SORT_RANDOM=NO (for PKG_DEVELOPERs it's already
1299: disabled).
1300:
1301: You can overwrite some of the major distribution sites to fit to sites that are
1302: close to your own. By setting one or two variables you can modify the order in
1303: which the master sites are accessed. MASTER_SORT contains a whitespace
1304: delimited list of domain suffixes. MASTER_SORT_REGEX is even more flexible, it
1305: contains a whitespace delimited list of regular expressions. It has higher
1306: priority than MASTER_SORT. Have a look at pkgsrc/mk/defaults/mk.conf to find
1307: some examples. This may save some of your bandwidth and time.
1308:
1309: You can change these settings either in your shell's environment, or, if you
1.4 rillig 1310: want to keep the settings, by editing the mk.conf file, and adding the
1.1 dsieger 1311: definitions there.
1312:
1.132 wiz 1313: If a package depends on many other packages (such as meta-pkgs/kde4), the build
1.1 dsieger 1314: process may alternate between periods of downloading source, and compiling. To
1315: ensure you have all the source downloaded initially you can run the command:
1316:
1317: % make fetch-list | sh
1318:
1319: which will output and run a set of shell commands to fetch the necessary files
1320: into the distfiles directory. You can also choose to download the files
1321: manually.
1322:
1.154 rillig 1323: 5.2.3. How to build and install
1.1 dsieger 1324:
1325: Once the software has downloaded, any patches will be applied, then it will be
1326: compiled for you. This may take some time depending on your computer, and how
1327: many other packages the software depends on and their compile time.
1328:
1329: Note
1330:
1331: If using bootstrap or pkgsrc on a non-NetBSD system, use the pkgsrc bmake
1332: command instead of "make" in the examples in this guide.
1333:
1334: For example, type
1335:
1336: % cd misc/figlet
1337: % make
1338:
1339:
1340: at the shell prompt to build the various components of the package.
1341:
1342: The next stage is to actually install the newly compiled program onto your
1343: system. Do this by entering:
1344:
1345: % make install
1346:
1347:
1348: while you are still in the directory for whatever package you are installing.
1349:
1350: Installing the package on your system may require you to be root. However,
1351: pkgsrc has a just-in-time-su feature, which allows you to only become root for
1352: the actual installation step.
1353:
1354: That's it, the software should now be installed and setup for use. You can now
1355: enter:
1356:
1357: % make clean
1358:
1359:
1360: to remove the compiled files in the work directory, as you shouldn't need them
1361: any more. If other packages were also added to your system (dependencies) to
1362: allow your program to compile, you can tidy these up also with the command:
1363:
1364: % make clean-depends
1365:
1366:
1367: Taking the figlet utility as an example, we can install it on our system by
1.207 leot 1368: building as shown in Appendix C, Build logs.
1.1 dsieger 1369:
1370: The program is installed under the default root of the packages tree - /usr/
1371: pkg. Should this not conform to your tastes, set the LOCALBASE variable in your
1372: environment, and it will use that value as the root of your packages tree. So,
1373: to use /usr/local, set LOCALBASE=/usr/local in your environment. Please note
1374: that you should use a directory which is dedicated to packages and not shared
1375: with other programs (i.e., do not try and use LOCALBASE=/usr). Also, you should
1376: not try to add any of your own files or directories (such as src/, obj/, or
1377: pkgsrc/) below the LOCALBASE tree. This is to prevent possible conflicts
1378: between programs and other files installed by the package system and whatever
1379: else may have been installed there.
1380:
1.4 rillig 1381: Some packages look in mk.conf to alter some configuration options at build
1.1 dsieger 1382: time. Have a look at pkgsrc/mk/defaults/mk.conf to get an overview of what will
1383: be set there by default. Environment variables such as LOCALBASE can be set in
1.4 rillig 1384: mk.conf to save having to remember to set them each time you want to use
1.1 dsieger 1385: pkgsrc.
1386:
1387: Occasionally, people want to "look under the covers" to see what is going on
1388: when a package is building or being installed. This may be for debugging
1389: purposes, or out of simple curiosity. A number of utility values have been
1390: added to help with this.
1391:
1392: 1. If you invoke the make(1) command with PKG_DEBUG_LEVEL=2, then a huge
1393: amount of information will be displayed. For example,
1394:
1395: make patch PKG_DEBUG_LEVEL=2
1396:
1.25 wiz 1397: will show all the commands that are invoked, up to and including the "patch
1398: " stage.
1.1 dsieger 1399:
1400: 2. If you want to know the value of a certain make(1) definition, then the
1401: VARNAME definition should be used, in conjunction with the show-var target.
1402: e.g. to show the expansion of the make(1) variable LOCALBASE:
1403:
1404: % make show-var VARNAME=LOCALBASE
1405: /usr/pkg
1406: %
1407:
1408:
1409: If you want to install a binary package that you've either created yourself
1410: (see next section), that you put into pkgsrc/packages manually or that is
1411: located on a remote FTP server, you can use the "bin-install" target. This
1412: target will install a binary package - if available - via pkg_add(1), else do a
1413: make package. The list of remote FTP sites searched is kept in the variable
1414: BINPKG_SITES, which defaults to ftp.NetBSD.org. Any flags that should be added
1415: to pkg_add(1) can be put into BIN_INSTALL_FLAGS. See pkgsrc/mk/defaults/mk.conf
1416: for more details.
1417:
1418: A final word of warning: If you set up a system that has a non-standard setting
1419: for LOCALBASE, be sure to set that before any packages are installed, as you
1420: cannot use several directories for the same purpose. Doing so will result in
1421: pkgsrc not being able to properly detect your installed packages, and fail
1422: miserably. Note also that precompiled binary packages are usually built with
1423: the default LOCALBASE of /usr/pkg, and that you should not install any if you
1424: use a non-standard LOCALBASE.
1425:
1.154 rillig 1426: Chapter 6. Configuring pkgsrc
1.1 dsieger 1427:
1428: Table of Contents
1429:
1.154 rillig 1430: 6.1. General configuration
1431: 6.2. Variables affecting the build process
1432: 6.3. Variables affecting the installation process
1433: 6.4. Selecting and configuring the compiler
1434:
1435: 6.4.1. Selecting the compiler
1436: 6.4.2. Additional flags to the compiler (CFLAGS)
1437: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 1438:
1.154 rillig 1439: 6.5. Developer/advanced settings
1440: 6.6. Selecting Build Options
1.1 dsieger 1441:
1442: The whole pkgsrc system is configured in a single file, usually called mk.conf.
1443: In which directory pkgsrc looks for that file depends on the installation. On
1444: NetBSD, when you use make(1) from the base system, it is in the directory /etc
1445: /. In all other cases the default location is ${PREFIX}/etc/, depending on
1446: where you told the bootstrap program to install the binary packages.
1447:
1448: The format of the configuration file is that of the usual BSD-style Makefiles.
1449: The whole pkgsrc configuration is done by setting variables in this file. Note
1450: that you can define all kinds of variables, and no special error checking (for
1.112 rillig 1451: example for spelling mistakes) takes place.
1.1 dsieger 1452:
1.154 rillig 1453: 6.1. General configuration
1.1 dsieger 1454:
1.112 rillig 1455: The following variables apply to all pkgsrc packages. A complete list of the
1456: variables that can be configured by the user is available in mk/defaults/
1457: mk.conf, together with some comments that describe each variable's intent.
1.1 dsieger 1458:
1459: * LOCALBASE: Where packages will be installed. The default is /usr/pkg. Do
1460: not mix binary packages with different LOCALBASEs!
1461:
1462: * CROSSBASE: Where "cross" category packages will be installed. The default
1463: is ${LOCALBASE}/cross.
1464:
1.84 wiz 1465: * X11BASE: Where X11 is installed on the system. The default is /usr/X11R7.
1.1 dsieger 1466:
1467: * DISTDIR: Where to store the downloaded copies of the original source
1468: distributions used for building pkgsrc packages. The default is $
1469: {PKGSRCDIR}/distfiles.
1470:
1471: * PKG_DBDIR: Where the database about installed packages is stored. The
1.118 sevan 1472: default is /usr/pkg/pkgdb.
1.1 dsieger 1473:
1474: * MASTER_SITE_OVERRIDE: If set, override the packages' MASTER_SITES with this
1475: value.
1476:
1477: * MASTER_SITE_BACKUP: Backup location(s) for distribution files and patch
1478: files if not found locally or in ${MASTER_SITES} or ${PATCH_SITES}
1.118 sevan 1479: respectively. The defaults is ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/$
1.1 dsieger 1480: {DIST_SUBDIR}/.
1481:
1482: * BINPKG_SITES: List of sites carrying binary pkgs. rel and arch are replaced
1483: with OS release ("2.0", etc.) and architecture ("mipsel", etc.).
1484:
1.23 jakllsch 1485: * ACCEPTABLE_LICENSES: List of acceptable licenses. License names are
1486: case-sensitive. Whenever you try to build a package whose license is not in
1487: this list, you will get an error message. If the license condition is
1488: simple enough, the error message will include specific instructions on how
1489: to change this variable.
1.1 dsieger 1490:
1.154 rillig 1491: 6.2. Variables affecting the build process
1.1 dsieger 1492:
1493: * PACKAGES: The top level directory for the binary packages. The default is $
1494: {PKGSRCDIR}/packages.
1495:
1496: * WRKOBJDIR: The top level directory where, if defined, the separate working
1497: directories will get created, and symbolically linked to from ${WRKDIR}
1498: (see below). This is useful for building packages on several architectures,
1499: then ${PKGSRCDIR} can be NFS-mounted while ${WRKOBJDIR} is local to every
1500: architecture. (It should be noted that PKGSRCDIR should not be set by the
1.198 leot 1501: user -- it is an internal definition which refers to the root of the pkgsrc
1.1 dsieger 1502: tree. It is possible to have many pkgsrc tree instances.)
1503:
1504: * LOCALPATCHES: Directory for local patches that aren't part of pkgsrc. See
1.184 rillig 1505: Section 12.3, "patches/*" for more information.
1.1 dsieger 1506:
1507: * PKGMAKECONF: Location of the mk.conf file used by a package's BSD-style
1508: Makefile. If this is not set, MAKECONF is set to /dev/null to avoid picking
1509: up settings used by builds in /usr/src.
1510:
1.154 rillig 1511: 6.3. Variables affecting the installation process
1.1 dsieger 1512:
1.198 leot 1513: * PKGSRC_KEEP_BIN_PKGS: By default, binary packages of built packages are
1.150 leot 1514: preserved in ${PACKAGES}/All. Setting this variable to "no" prevents this.
1.1 dsieger 1515:
1.107 jnemeth 1516: Packages have to support installation into a subdirectory of WRKDIR. This
1517: allows a package to be built, before the actual filesystem is touched. DESTDIR
1518: support exists in two variations:
1.4 rillig 1519:
1520: * Basic DESTDIR support means that the package installation and packaging is
1521: still run as root.
1522:
1523: * Full DESTDIR support can run the complete build, installation and packaging
1524: as normal user. Root privileges are only needed to add packages.
1525:
1526: With basic DESTDIR support, make clean needs to be run as root.
1527:
1.17 imil 1528: Considering the foo/bar package, DESTDIR full support can be tested using the
1529: following commands
1530:
1531: $ id
1532: uid=1000(myusername) gid=100(users) groups=100(users),0(wheel)
1533: $ mkdir $HOME/packages
1534: $ cd $PKGSRCDIR/foo/bar
1535:
1536: Verify DESTDIR full support, no root privileges should be needed
1537:
1.66 asau 1538: $ make stage-install
1.17 imil 1539:
1540: Create a package without root privileges
1541:
1.66 asau 1542: $ make PACKAGES=$HOME/packages package
1.17 imil 1543:
1544: For the following command, you must be able to gain root privileges using su(1)
1545:
1.66 asau 1546: $ make PACKAGES=$HOME/packages install
1.17 imil 1547:
1548: Then, as a simple user
1549:
1550: $ make clean
1551:
1.154 rillig 1552: 6.4. Selecting and configuring the compiler
1.4 rillig 1553:
1.154 rillig 1554: 6.4.1. Selecting the compiler
1.1 dsieger 1555:
1556: By default, pkgsrc will use GCC to build packages. This may be overridden by
1557: setting the following variables in /etc/mk.conf:
1558:
1559: PKGSRC_COMPILER:
1560:
1561: This is a list of values specifying the chain of compilers to invoke when
1562: building packages. Valid values are:
1563:
1.66 asau 1564: + ccc: Compaq C Compilers (Tru64)
1565:
1566: + ccache: compiler cache (chainable)
1567:
1568: + clang: Clang C and Objective-C compiler
1569:
1.42 asau 1570: + distcc: distributed C/C++ (chainable)
1.1 dsieger 1571:
1.66 asau 1572: + f2c: Fortran 77 to C compiler (chainable)
1573:
1574: + icc: Intel C++ Compiler (Linux)
1575:
1576: + ido: SGI IRIS Development Option cc (IRIX 5)
1.1 dsieger 1577:
1.42 asau 1578: + gcc: GNU C/C++ Compiler
1.1 dsieger 1579:
1.66 asau 1580: + hp: HP-UX C/aC++ compilers
1581:
1.42 asau 1582: + mipspro: Silicon Graphics, Inc. MIPSpro (n32/n64)
1.1 dsieger 1583:
1.66 asau 1584: + mipspro-ucode: Silicon Graphics, Inc. MIPSpro (o32)
1.1 dsieger 1585:
1.42 asau 1586: + sunpro: Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio
1.1 dsieger 1587:
1.118 sevan 1588: + xlc: IBM's XL C/C++ compiler suite
1.66 asau 1589:
1.1 dsieger 1590: The default is "gcc". You can use ccache and/or distcc with an appropriate
1591: PKGSRC_COMPILER setting, e.g. "ccache gcc". This variable should always be
1592: terminated with a value for a real compiler. Note that only one real
1593: compiler should be listed (e.g. "sunpro gcc" is not allowed).
1594:
1595: GCC_REQD:
1596:
1597: This specifies the minimum version of GCC to use when building packages. If
1598: the system GCC doesn't satisfy this requirement, then pkgsrc will build and
1599: install one of the GCC packages to use instead.
1600:
1.153 leot 1601: PYTHON_VERSION_DEFAULT:
1.114 maya 1602:
1603: Specifies which version of python to use when several options are
1604: available.
1605:
1606: PKGSRC_FORTRAN:
1607:
1.176 gutterid 1608: Specifies the Fortran compiler to use. The default is gfortran.
1.114 maya 1609:
1610: GFORTRAN_VERSION:
1611:
1612: If PKGSRC_FORTRAN= gfortran is used, this option specifies which version to
1613: use.
1614:
1.154 rillig 1615: 6.4.2. Additional flags to the compiler (CFLAGS)
1.1 dsieger 1616:
1617: If you wish to set the CFLAGS variable, please make sure to use the += operator
1618: instead of the = operator:
1619:
1620: CFLAGS+= -your -flags
1621:
1622: Using CFLAGS= (i.e. without the "+") may lead to problems with packages that
1.16 jnemeth 1623: need to add their own flags. You may want to take a look at the devel/cpuflags
1.24 wiz 1624: package if you're interested in optimization specifically for the current CPU.
1.1 dsieger 1625:
1.154 rillig 1626: 6.4.3. Additional flags to the linker (LDFLAGS)
1.1 dsieger 1627:
1628: If you want to pass flags to the linker, both in the configure step and the
1629: build step, you can do this in two ways. Either set LDFLAGS or LIBS. The
1630: difference between the two is that LIBS will be appended to the command line,
1631: while LDFLAGS come earlier. LDFLAGS is pre-loaded with rpath settings for ELF
1632: machines depending on the setting of USE_IMAKE or the inclusion of mk/
1633: x11.buildlink3.mk. As with CFLAGS, if you do not wish to override these
1634: settings, use the += operator:
1635:
1636: LDFLAGS+= -your -linkerflags
1637:
1.154 rillig 1638: 6.5. Developer/advanced settings
1.1 dsieger 1639:
1640: * PKG_DEVELOPER: Run some sanity checks that package developers want:
1641:
1.42 asau 1642: + make sure patches apply with zero fuzz
1.1 dsieger 1643:
1.42 asau 1644: + run check-shlibs to see that all binaries will find their shared libs.
1.1 dsieger 1645:
1646: * PKG_DEBUG_LEVEL: The level of debugging output which is displayed whilst
1647: making and installing the package. The default value for this is 0, which
1648: will not display the commands as they are executed (normal, default, quiet
1649: operation); the value 1 will display all shell commands before their
1650: invocation, and the value 2 will display both the shell commands before
1.112 rillig 1651: their invocation, as well as their actual execution progress with set -x.
1.1 dsieger 1652:
1.154 rillig 1653: 6.6. Selecting Build Options
1.1 dsieger 1654:
1655: Some packages have build time options, usually to select between different
1656: dependencies, enable optional support for big dependencies or enable
1657: experimental features.
1658:
1659: To see which options, if any, a package supports, and which options are
1660: mutually exclusive, run make show-options, for example:
1661:
1662: The following options are supported by this package:
1663: ssl Enable SSL support.
1664: Exactly one of the following gecko options is required:
1665: firefox Use firefox as gecko rendering engine.
1666: mozilla Use mozilla as gecko rendering engine.
1667: At most one of the following database options may be selected:
1668: mysql Enable support for MySQL database.
1669: pgsql Enable support for PostgreSQL database.
1670:
1671: These options are enabled by default: firefox
1672: These options are currently enabled: mozilla ssl
1673:
1.4 rillig 1674: The following variables can be defined in mk.conf to select which options to
1675: enable for a package: PKG_DEFAULT_OPTIONS, which can be used to select or
1.1 dsieger 1676: disable options for all packages that support them, and PKG_OPTIONS.pkgbase,
1677: which can be used to select or disable options specifically for package pkgbase
1678: . Options listed in these variables are selected, options preceded by "-" are
1679: disabled. A few examples:
1680:
1.4 rillig 1681: $ grep "PKG.*OPTION" mk.conf
1.1 dsieger 1682: PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
1683: PKG_OPTIONS.kdebase= debug -sasl
1684: PKG_OPTIONS.apache= suexec
1685:
1.11 rillig 1686: It is important to note that options that were specifically suggested by the
1.19 snj 1687: package maintainer must be explicitly removed if you do not wish to include the
1688: option. If you are unsure you can view the current state with make show-options
1689: .
1.11 rillig 1690:
1.1 dsieger 1691: The following settings are consulted in the order given, and the last setting
1692: that selects or disables an option is used:
1693:
1694: 1. the default options as suggested by the package maintainer
1695:
1696: 2. the options implied by the settings of legacy variables (see below)
1697:
1698: 3. PKG_DEFAULT_OPTIONS
1699:
1700: 4. PKG_OPTIONS.pkgbase
1701:
1702: For groups of mutually exclusive options, the last option selected is used, all
1703: others are automatically disabled. If an option of the group is explicitly
1704: disabled, the previously selected option, if any, is used. It is an error if no
1705: option from a required group of options is selected, and building the package
1706: will fail.
1707:
1708: Before the options framework was introduced, build options were selected by
1.4 rillig 1709: setting a variable (often named USE_FOO) in mk.conf for each option. To ease
1710: transition to the options framework for the user, these legacy variables are
1711: converted to the appropriate options setting (PKG_OPTIONS.pkgbase)
1712: automatically. A warning is issued to prompt the user to update mk.conf to use
1713: the options framework directly. Support for the legacy variables will be
1.1 dsieger 1714: removed eventually.
1715:
1.154 rillig 1716: Chapter 7. Creating binary packages
1.1 dsieger 1717:
1718: Table of Contents
1719:
1.154 rillig 1720: 7.1. Building a single binary package
1721: 7.2. Settings for creation of binary packages
1.1 dsieger 1722:
1.154 rillig 1723: 7.1. Building a single binary package
1.1 dsieger 1724:
1725: Once you have built and installed a package, you can create a binary package
1726: which can be installed on another system with pkg_add(1). This saves having to
1727: build the same package on a group of hosts and wasting CPU time. It also
1728: provides a simple means for others to install your package, should you
1729: distribute it.
1730:
1731: To create a binary package, change into the appropriate directory in pkgsrc,
1732: and run make package:
1733:
1.112 rillig 1734: $ cd misc/figlet
1735: $ make package
1.1 dsieger 1736:
1737: This will build and install your package (if not already done), and then build
1738: a binary package from what was installed. You can then use the pkg_* tools to
1739: manipulate it. Binary packages are created by default in /usr/pkgsrc/packages,
1.207 leot 1740: in the form of a gzipped tar file. See Section C.2, "Packaging figlet" for a
1.1 dsieger 1741: continuation of the above misc/figlet example.
1742:
1.154 rillig 1743: See Chapter 23, Submitting and Committing for information on how to submit such
1.1 dsieger 1744: a binary package.
1745:
1.154 rillig 1746: 7.2. Settings for creation of binary packages
1.1 dsieger 1747:
1.184 rillig 1748: See Section 13.17, "Other helpful targets".
1.6 rillig 1749:
1.154 rillig 1750: Chapter 8. Creating binary packages for everything in pkgsrc (bulk builds)
1.6 rillig 1751:
1752: Table of Contents
1753:
1.154 rillig 1754: 8.1. Preparations
1.180 rillig 1755: 8.2. Running a bulk build
1.6 rillig 1756:
1.154 rillig 1757: 8.2.1. Configuration
1.6 rillig 1758:
1.154 rillig 1759: 8.3. Requirements of a full bulk build
1.178 rillig 1760: 8.4. Bulk build variants
1761:
1.179 rillig 1762: 8.4.1. Detect unknown configure options
1763: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.181 rillig 1764: 8.4.3. Force compiler options only in the build phase
1765: 8.4.4. Use custom directories
1766: 8.4.5. Turn warnings into errors
1767: 8.4.6. Reject packages for which pkglint reports errors
1768: 8.4.7. Reject packages that contain forbidden strings
1769: 8.4.8. Reject packages whose self-test fails
1770: 8.4.9. Reject packages that use undefined shell variables
1771: 8.4.10. Turn off verbose logging
1.6 rillig 1772:
1.178 rillig 1773: 8.5. Creating a multiple CD-ROM packages collection
1774:
1775: 8.5.1. Example of cdpack
1.6 rillig 1776:
1.175 gutterid 1777: For a number of reasons, you may want to build binary packages for a large
1778: selected set of packages in pkgsrc, or even for all pkgsrc packages. For
1.71 wiz 1779: instance, when you have multiple machines that should run the same software, it
1780: is wasted time if they all build their packages themselves from source. Or you
1781: may want to build a list of packages you want and check them before deploying
1.175 gutterid 1782: onto production systems. There is a way of getting a set of binary packages:
1783: the bulk build system, or pbulk ("p" stands for "parallel"). This chapter
1784: describes how to set it up.
1.71 wiz 1785:
1.154 rillig 1786: 8.1. Preparations
1.71 wiz 1787:
1788: First of all, you have to decide whether you build all packages or a limited
1789: set of them. Full bulk builds usually consume a lot more resources, both space
1.175 gutterid 1790: and time, than builds for some practical sets of packages. A number of
1791: particularly heavy packages exist that are not actually interesting to a wide
1792: audience. (The approximate resource consumption for a full bulk build is given
1793: in section Section 8.3, "Requirements of a full bulk build".) For limited bulk
1794: builds you need to make a list of packages you want to build. Note that all
1795: their dependencies will be built, so you don't need to track them manually.
1.71 wiz 1796:
1797: During bulk builds various packages are installed and deinstalled in /usr/pkg
1798: (or whatever LOCALBASE is), so make sure that you don't need any package during
1.112 rillig 1799: the builds. Essentially, you should provide a fresh system, either a chroot
1.71 wiz 1800: environment or something even more restrictive, depending on what the operating
1801: system provides, or dedicate the whole physical machine. As a useful side
1802: effect this makes sure that bulk builds cannot break anything in your system.
1803: There have been numerous cases where certain packages tried to install files
1804: outside the LOCALBASE or wanted to edit some files in /etc.
1.6 rillig 1805:
1.180 rillig 1806: 8.2. Running a bulk build
1.6 rillig 1807:
1.180 rillig 1808: Running a bulk build works roughly as follows:
1.15 rillig 1809:
1810: * First, build the pbulk infrastructure in a fresh pkgsrc location.
1811:
1812: * Then, build each of the packages from a clean installation directory using
1813: the infrastructure.
1814:
1.154 rillig 1815: 8.2.1. Configuration
1.6 rillig 1816:
1.112 rillig 1817: To simplify configuration, we provide the helper script mk/pbulk/pbulk.sh.
1.6 rillig 1818:
1.68 asau 1819: In order to use it, prepare a clear system (real one, chroot environment, jail,
1820: zone, virtual machine). Configure network access to fetch distribution files.
1.112 rillig 1821: Create a user with name "pbulk".
1.68 asau 1822:
1823: Fetch and extract pkgsrc. Use a command like one of these:
1824:
1.151 sevan 1825: # (cd /usr && ftp -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1826: # (cd /usr && fetch -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)
1.72 wiz 1827: # (cd /usr && cvs -Q -z3 -d anoncvs@anoncvs.NetBSD.org:/cvsroot get -P pkgsrc)
1.68 asau 1828:
1829: Or any other way that fits (e.g., curl, wget).
1830:
1831: Deploy and configure pbulk tools, e.g.:
1832:
1.118 sevan 1833: # sh pbulk.sh -n # use native make, no bootstrap kit needed (for use on NetBSD)
1.68 asau 1834: # sh pbulk.sh -n -c mk.conf.frag # native, apply settings from given mk.conf fragment
1835: # sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build
1836:
1837: Note
1838:
1839: mk.conf.frag is a fragment of mk.conf that contains settings you want to apply
1840: to packages you build. For instance,
1841:
1.112 rillig 1842: PKG_DEVELOPER= yes # perform more checks
1843: X11_TYPE= modular # use pkgsrc X11
1844: SKIP_LICENSE_CHECK= yes # accept all licences (useful
1845: # when building all packages)
1.68 asau 1846:
1847: If configured for limited list, replace the list in /usr/pbulk/etc/pbulk.list
1.112 rillig 1848: with your list of packages, one per line without empty lines or comments. E.g.:
1.68 asau 1849:
1850: www/firefox
1851: mail/thunderbird
1852: misc/libreoffice4
1853:
1.69 asau 1854: At this point you can also review configuration in /usr/pbulk/etc and make
1855: final amendments, if wanted.
1856:
1.68 asau 1857: Start it:
1858:
1859: # /usr/pbulk/bin/bulkbuild
1860:
1861: After it finishes, you'll have /mnt filled with distribution files, binary
1862: packages, and reports, plain text summary in /mnt/bulklog/meta/report.txt
1863:
1864: Note
1865:
1866: The pbulk.sh script does not cover all possible use cases. While being ready to
1867: run, it serves as a good starting point to understand and build more complex
1868: setups. The script is kept small enough for better understanding.
1869:
1870: Note
1871:
1872: The pbulk.sh script supports running unprivileged bulk build and helps
1.205 wiz 1873: configuring distributed bulk builds. Distributed bulk builds support either
1874: building in worker chroots (each node is a path to a different chroot) that
1875: replicate the target system, including the pbulk prefix, or remote machines
1876: (each node is an IP address that must be accessible over SSH without a
1877: password).
1.15 rillig 1878:
1.154 rillig 1879: 8.3. Requirements of a full bulk build
1.71 wiz 1880:
1881: A complete bulk build requires lots of disk space. Some of the disk space can
1882: be read-only, some other must be writable. Some can be on remote filesystems
1883: (such as NFS) and some should be local. Some can be temporary filesystems,
1884: others must survive a sudden reboot.
1885:
1.205 wiz 1886: * 70 GB for the distfiles (read-write, remote, temporary)
1.71 wiz 1887:
1.205 wiz 1888: * 60 GB for the binary packages (read-write, remote, permanent)
1.71 wiz 1889:
1890: * 1 GB for the pkgsrc tree (read-only, remote, permanent)
1891:
1892: * 5 GB for LOCALBASE (read-write, local, temporary)
1893:
1894: * 10 GB for the log files (read-write, remote, permanent)
1895:
1896: * 5 GB for temporary files (read-write, local, temporary)
1897:
1.178 rillig 1898: 8.4. Bulk build variants
1899:
1900: To ensure that pkgsrc packages work in different configurations, it makes sense
1901: to run non-default bulk builds from time to time. This section lists some ideas
1902: for bulk builds that intentionally let packages fail if they don't follow the
1903: pkgsrc style.
1904:
1.179 rillig 1905: 8.4.1. Detect unknown configure options
1.178 rillig 1906:
1907: Add the following line to mk.conf.
1908:
1909: GNU_CONFIGURE_STRICT= yes
1910:
1911: When a package fails this additional check, the most common cause is that the
1912: configure option was valid for an older version of the package but does not
1913: apply anymore. In that case, just remove it.
1914:
1.179 rillig 1915: 8.4.2. Detect classes of bugs by forcing compiler warnings
1.178 rillig 1916:
1917: The job of a compiler is not restricted to producing executable code, most
1.179 rillig 1918: compilers also detect typical programming mistakes. The pkgsrc compiler
1919: wrappers make it easy to force compiler options when the package is built. This
1920: can be used to find typical bugs across all packages that are in pkgsrc. By
1921: reporting these bugs upstream, the packages will be more reliable with the next
1922: updates.
1.178 rillig 1923:
1.179 rillig 1924: Add some of the following lines to mk.conf:
1.178 rillig 1925:
1926: CFLAGS+= -Werror=char-subscripts
1.179 rillig 1927: CFLAGS+= -Werror=implicit-function-declaration
1.178 rillig 1928:
1.179 rillig 1929: When a package fails to build using these stricter compiler options, document
1930: the circumstances in which the compiler produced the error message. This
1931: includes:
1.178 rillig 1932:
1933: * The platform (MACHINE_PLATFORM)
1934:
1935: * The source file
1936:
1937: * An excerpt of the code. GCC and Clang already do this as part of the
1938: diagnostic.
1939:
1.179 rillig 1940: * The exact error message from the compiler.
1.178 rillig 1941:
1.179 rillig 1942: If a package produces these error messages, but the package is fine, record
1943: this in your local mk.conf, like this, to skip this check in the next builds:
1.178 rillig 1944:
1.179 rillig 1945: .if ${PKGPATH} == category/package
1.178 rillig 1946: # Version ${VERSION} failed on ${MACHINE_PLATFORM}:
1947: # error message
1948: # code
1.179 rillig 1949: # Reason why the code does not need to be fixed.
1.178 rillig 1950: BUILDLINK_TRANSFORM+= rm:-Werror=char-subscripts
1.179 rillig 1951: .endif
1.178 rillig 1952:
1953: If the error messages from the compiler are valid and the code needs to be
1.179 rillig 1954: fixed, prepare a local patch (see LOCALPATCHES) and report the bug to the
1955: upstream authors of the package, providing them with the information you
1956: collected above.
1.178 rillig 1957:
1.179 rillig 1958: Patches that are not essential for the package to work should only be reported
1959: upstream but not committed to pkgsrc, to make future updates easier.
1960:
1.181 rillig 1961: 8.4.3. Force compiler options only in the build phase
1962:
1963: When adding custom compiler flags via CFLAGS, these apply to all phases of the
1964: package build process. Especially in the configure phase, adding -Werror leads
1965: to wrong decisions. The GNU configure scripts feed many small test programs to
1966: the C compiler to see whether certain headers are available, functions are
1967: defined in a library and programs can be run. In many cases these programs
1968: would not survive a strict compiler run with -Wall -Wextra -Werror.
1969:
1970: The pkgsrc infrastructure is flexible enough to support compiler options being
1971: added between the configure and build phases. It's a little more complicated
1972: than the other examples in this section but still easy enough.
1973:
1974: The basic idea is to use the pkgsrc compiler wrapper to inject the desired
1975: compiler options. The compiler wrapper's original task is to hide unwanted
1976: directories of include files and to normalize compiler options. It does this by
1977: wrapping the compiler command and rewriting the command line. To see this in
1978: action, run bmake patch in a package directory and examine the work/.cwrappers/
1979: config directory. It contains individual configurations for the C compiler and
1980: the related tools. The plan is to find a hook between the configure and build
1981: phases, and to modify these configuration files at that point.
1982:
1983: To find this hook, have a look at mk/build/build.mk, which contains among
1984: others the pre-build-checks-hook. The word checks doesn't quite fit, but the
1985: pre-build-hook sounds good enough.
1986:
1987: The code to be included in mk.conf is:
1988:
1989: # Just a few example options.
1990: BUILD_ONLY_CFLAGS= -Wall -Werror -O2 -DTEMPDIR='"/tmp"'
1991:
1992: .if ${BUILD_ONLY_CFLAGS:U:M*}
1993: pre-build-checks-hook: add-build-only-cflags
1994:
1995: add-build-only-cflags: .PHONY
1996: ${RUN} cd ${CWRAPPERS_CONFIG_DIR}; \
1997: ${TEST} ! -f ${.TARGET} || exit 0; \
1998: for flag in ${BUILD_ONLY_CFLAGS}; do \
1999: ${ECHO} "append=$$flag" >> cc; \
2000: done; \
2001: > ${.TARGET}
2002: .endif
2003:
2004: (When editing the mk.conf, make sure that the commands of the
2005: add-build-only-cflags target are indented with a tab, not with spaces.)
2006:
2007: The condition in the .if statement contains the :U modifier to prevent parse
2008: errors if the variable should be undefined, possibly because it is only defined
2009: for a subset of the packages. The :M* modifier ensures that there is at least
2010: one compiler option, to prevent a syntax error in the shell parser.
2011:
2012: The code around the ${.TARGET} variable ensures that the additional compiler
2013: options are only appended once, even if bmake build is run multiple times. To
2014: do this, it creates a marker file.
2015:
2016: To verify that this setup works, run bmake configure in a package directory. Up
2017: to now, everything works as usual. Examine the directory work/.cwrappers/config
2018: to see that the compiler options from BUILD_ONLY_CFLAGS are not yet added to
2019: the file cc. Examine the tail of the work/.work.log file to see that the normal
2020: compiler options are used.
2021:
2022: Now run bmake build. This will append the options to the file cc and will
2023: create the marker file in the same directory. After that, the build starts as
2024: usual, but with the added compiler options. Examine the tail of the file work
2025: /.work.log to see that the lines starting with [*] don't contain the compiler
2026: options, but the corresponding lines starting with <.> do end with these
2027: options.
2028:
2029: Building packages using this setup variant and fixing the resulting bugs is the
2030: same as in Section 8.4.2, "Detect classes of bugs by forcing compiler warnings"
2031: .
2032:
2033: 8.4.4. Use custom directories
1.178 rillig 2034:
2035: Some directories like PREFIX, VARBASE, PKG_SYSCONFDIR, PKGMANDIR, PKG_INFODIR
2036: can be configured in pkgsrc. Set these to arbitrary paths during bootstrap or
2037: afterwards in mk.conf.
2038:
2039: PREFIX= /a-random-uuid
2040: PKG_SYSCONFDIR= /a-random-uuid
2041: VARBASE= /a-random-uuid
2042: PKGMANDIR= a-random-uuid
2043: PKG_INFODIR= a-random-uuid
2044:
1.181 rillig 2045: 8.4.5. Turn warnings into errors
1.178 rillig 2046:
2047: When building a package, warnings are typically ignored since they just flow by
2048: and do not cause the build to fail immediately. To find these warnings,
2049: redefine them to errors in mk.conf.
2050:
2051: DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)"
2052: WARNING_MSG= ${FAIL_MSG} "(was warning)"
2053:
2054: (There are many more classes of warnings in pkgsrc, and most of them can be
2055: redefined with a simple definition like above.
2056:
1.179 rillig 2057: If a package suggests to add USE_TOOLS+=perl to the package Makefile, research
1.178 rillig 2058: whether the package actually needs Perl. If it does, add USE_TOOLS+=perl to the
2059: package Makefile, and if it doesn't, add TOOLS_BROKEN+=perl.
2060:
1.181 rillig 2061: 8.4.6. Reject packages for which pkglint reports errors
1.178 rillig 2062:
2063: Using pkglint as part of the regular build process is mostly a waste of time.
2064: If you want to fix some of the warnings, just run pkglint recursively on the
2065: whole pkgsrc tree. This will take a few minutes (up to 10), which is much
2066: faster than a complete bulk build.
2067:
1.181 rillig 2068: 8.4.7. Reject packages that contain forbidden strings
1.178 rillig 2069:
2070: To ensure that the binary packages don't contain references to the build
2071: directory, there is already CHECK_WRKREF. If that variable includes the item
2072: extra, it is possible to define additional patterns that must not appear in any
2073: installed file. This is specified in mk.conf.
2074:
2075: CHECK_WRKREF= extra
2076: CHECK_WRKREF_EXTRA_DIRS+= /usr/local
2077: CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg
2078: CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@
2079:
2080: The above patterns will probably generate many false positives, therefore the
2081: results need to be taken with a grain of salt.
2082:
1.181 rillig 2083: 8.4.8. Reject packages whose self-test fails
1.178 rillig 2084:
2085: To run the test suites that come with each package, add this line to mk.conf.
2086:
2087: PKGSRC_RUN_TEST= yes
2088:
2089: Be prepared that even the most basic packages fail this test. When doing a bulk
2090: build with this, it will often abort in the early phase where the packages are
2091: scanned for their dependencies since there are cyclic dependencies. There is
2092: still a lot to do in this area.
2093:
1.181 rillig 2094: 8.4.9. Reject packages that use undefined shell variables
1.178 rillig 2095:
2096: To catch typos in the shell snippets from the Makefile fragments, add the -u
2097: flag to most of the commands by adding this line to mk.conf.
2098:
2099: RUN= @set -eu;
2100:
1.181 rillig 2101: After that, ensure that none of the bulk build log files (even those for
2102: successfully built packages) contains the string parameter not set or whatever
2103: error message the command sh -ceu '$undefined' outputs.
2104:
1.178 rillig 2105: See mk/misc/common.mk for the existing definition.
2106:
1.181 rillig 2107: 8.4.10. Turn off verbose logging
1.178 rillig 2108:
2109: The build logs of a package are often quite long. This allows error messages or
2110: other interesting details to hide between the noise. To make the actual error
2111: message stand out more, add these lines to mk.conf.
2112:
2113: GNU_CONFIGURE_QUIET= yes
2114: MAKE_FLAGS+= -s
2115:
2116: The -s option works for both GNU Make and BSD Make. On exotic platforms with
2117: their own make, it may be a little different.
2118:
2119: 8.5. Creating a multiple CD-ROM packages collection
1.1 dsieger 2120:
2121: After your pkgsrc bulk-build has completed, you may wish to create a CD-ROM set
2122: of the resulting binary packages to assist in installing packages on other
2123: machines. The pkgtools/cdpack package provides a simple tool for creating the
2124: ISO 9660 images. cdpack arranges the packages on the CD-ROMs in a way that
2125: keeps all the dependencies for a given package on the same CD as that package.
2126:
1.178 rillig 2127: 8.5.1. Example of cdpack
1.1 dsieger 2128:
2129: Complete documentation for cdpack is found in the cdpack(1) man page. The
2130: following short example assumes that the binary packages are left in /usr/
2131: pkgsrc/packages/All and that sufficient disk space exists in /u2 to hold the
2132: ISO 9660 images.
2133:
2134: # mkdir /u2/images
2135: # pkg_add /usr/pkgsrc/packages/All/cdpack
2136: # cdpack /usr/pkgsrc/packages/All /u2/images
2137:
2138:
2139: If you wish to include a common set of files (COPYRIGHT, README, etc.) on each
2140: CD in the collection, then you need to create a directory which contains these
1.175 gutterid 2141: files, e.g.:
1.1 dsieger 2142:
2143: # mkdir /tmp/common
2144: # echo "This is a README" > /tmp/common/README
2145: # echo "Another file" > /tmp/common/COPYING
2146: # mkdir /tmp/common/bin
2147: # echo "#!/bin/sh" > /tmp/common/bin/myscript
2148: # echo "echo Hello world" >> /tmp/common/bin/myscript
2149: # chmod 755 /tmp/common/bin/myscript
2150:
2151:
2152: Now create the images:
2153:
2154: # cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images
2155:
2156: Each image will contain README, COPYING, and bin/myscript in their root
2157: directories.
2158:
1.154 rillig 2159: Chapter 9. Directory layout of the installed files
1.1 dsieger 2160:
2161: Table of Contents
2162:
1.154 rillig 2163: 9.1. File system layout in ${LOCALBASE}
2164: 9.2. File system layout in ${VARBASE}
1.1 dsieger 2165:
2166: The files that are installed by pkgsrc are organized in a way that is similar
2167: to what you find in the /usr directory of the base system. But some details are
2168: different. This is because pkgsrc initially came from FreeBSD and had adopted
2169: its file system hierarchy. Later it was largely influenced by NetBSD. But no
2170: matter which operating system you are using pkgsrc with, you can expect the
2171: same layout for pkgsrc.
2172:
2173: There are mainly four root directories for pkgsrc, which are all configurable
2174: in the bootstrap/bootstrap script. When pkgsrc has been installed as root, the
2175: default locations are:
2176:
2177: LOCALBASE= /usr/pkg
2178: PKG_SYSCONFBASE= /usr/pkg/etc
2179: VARBASE= /var
1.119 sevan 2180: PKG_DBDIR= /usr/pkg/pkgdb
1.1 dsieger 2181:
2182: In unprivileged mode (when pkgsrc has been installed as any other user), the
2183: default locations are:
2184:
2185: LOCALBASE= ${HOME}/pkg
2186: PKG_SYSCONFBASE= ${HOME}/pkg/etc
2187: VARBASE= ${HOME}/pkg/var
1.119 sevan 2188: PKG_DBDIR= ${HOME}/pkg/pkgdb
1.1 dsieger 2189:
2190: What these four directories are for, and what they look like is explained
2191: below.
2192:
1.25 wiz 2193: * LOCALBASE corresponds to the /usr directory in the base system. It is the "
2194: main" directory where the files are installed and contains the well-known
1.1 dsieger 2195: subdirectories like bin, include, lib, share and sbin.
2196:
2197: * VARBASE corresponds to /var in the base system. Some programs (especially
2198: games, network daemons) need write access to it during normal operation.
2199:
2200: * PKG_SYSCONFDIR corresponds to /etc in the base system. It contains
2201: configuration files of the packages, as well as pkgsrc's mk.conf itself.
2202:
1.154 rillig 2203: 9.1. File system layout in ${LOCALBASE}
1.1 dsieger 2204:
2205: The following directories exist in a typical pkgsrc installation in $
2206: {LOCALBASE}.
2207:
2208: bin
2209:
2210: Contains executable programs that are intended to be directly used by the
2211: end user.
2212:
2213: emul
2214:
2215: Contains files for the emulation layers of various other operating systems,
2216: especially for NetBSD.
2217:
2218: etc (the usual location of ${PKG_SYSCONFDIR})
2219:
2220: Contains the configuration files.
2221:
2222: include
2223:
2224: Contains headers for the C and C++ programming languages.
2225:
2226: info
2227:
2228: Contains GNU info files of various packages.
2229:
2230: lib
2231:
2232: Contains shared and static libraries.
2233:
2234: libdata
2235:
2236: Contains data files that don't change after installation. Other data files
2237: belong into ${VARBASE}.
2238:
2239: libexec
2240:
2241: Contains programs that are not intended to be used by end users, such as
2242: helper programs or network daemons.
2243:
2244: libexec/cgi-bin
2245:
2246: Contains programs that are intended to be executed as CGI scripts by a web
2247: server.
2248:
2249: man (the usual value of ${PKGMANDIR})
2250:
2251: Contains brief documentation in form of manual pages.
2252:
2253: sbin
2254:
2255: Contains programs that are intended to be used only by the super-user.
2256:
2257: share
2258:
2259: Contains platform-independent data files that don't change after
2260: installation.
2261:
2262: share/doc
2263:
2264: Contains documentation files provided by the packages.
2265:
2266: share/examples
2267:
2268: Contains example files provided by the packages. Among others, the original
2269: configuration files are saved here and copied to ${PKG_SYSCONFDIR} during
2270: installation.
2271:
2272: share/examples/rc.d
2273:
2274: Contains the original files for rc.d scripts.
2275:
2276: var (the usual location of ${VARBASE})
2277:
2278: Contains files that may be modified after installation.
2279:
1.154 rillig 2280: 9.2. File system layout in ${VARBASE}
1.1 dsieger 2281:
2282: db/pkg (the usual location of ${PKG_DBDIR})
2283:
2284: Contains information about the currently installed packages.
2285:
2286: games
2287:
2288: Contains highscore files.
2289:
2290: log
2291:
2292: Contains log files.
2293:
2294: run
2295:
2296: Contains informational files about daemons that are currently running.
2297:
1.154 rillig 2298: Chapter 10. Frequently Asked Questions
1.1 dsieger 2299:
2300: Table of Contents
2301:
1.154 rillig 2302: 10.1. Are there any mailing lists for pkg-related discussion?
2303: 10.2. Utilities for package management (pkgtools)
2304: 10.3. How to use pkgsrc as non-root
2305: 10.4. How to resume transfers when fetching distfiles?
2306: 10.5. How can I install/use modular X.org from pkgsrc?
2307: 10.6. How to fetch files from behind a firewall
2308: 10.7. How to fetch files from HTTPS sites
2309: 10.8. How do I tell make fetch to do passive FTP?
2310: 10.9. How to fetch all distfiles at once
2311: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
2312: 10.11. What does "Could not find bsd.own.mk" mean?
1.221 nia 2313: 10.12. Using 'sudo' or `priv` with pkgsrc
1.154 rillig 2314: 10.13. How do I change the location of configuration files?
2315: 10.14. Automated security checks
2316: 10.15. Why do some packages ignore my CFLAGS?
2317: 10.16. A package does not build. What shall I do?
2318: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.24 wiz 2319: conflicts" mean?
1.1 dsieger 2320:
2321: This section contains hints, tips & tricks on special things in pkgsrc that we
2322: didn't find a better place for in the previous chapters, and it contains items
2323: for both pkgsrc users and developers.
2324:
1.154 rillig 2325: 10.1. Are there any mailing lists for pkg-related discussion?
1.1 dsieger 2326:
2327: The following mailing lists may be of interest to pkgsrc users:
2328:
2329: * pkgsrc-users: This is a general purpose list for most issues regarding
2330: pkgsrc, regardless of platform, e.g. soliciting user help for pkgsrc
2331: configuration, unexpected build failures, using particular packages,
2332: upgrading pkgsrc installations, questions regarding the pkgsrc release
2333: branches, etc. General announcements or proposals for changes that impact
2334: the pkgsrc user community, e.g. major infrastructure changes, new features,
2335: package removals, etc., may also be posted.
2336:
2337: * pkgsrc-bulk: A list where the results of pkgsrc bulk builds are sent and
2338: discussed.
2339:
2340: * pkgsrc-changes: This list is for those who are interested in getting a
2341: commit message for every change committed to pkgsrc. It is also available
2342: in digest form, meaning one daily message containing all commit messages
2343: for changes to the package source tree in that 24 hour period.
2344:
2345: To subscribe, do:
2346:
2347: % echo subscribe listname | mail majordomo@NetBSD.org
2348:
1.174 leot 2349: Archives for all these mailing lists are available from https://
1.1 dsieger 2350: mail-index.NetBSD.org/.
2351:
1.154 rillig 2352: 10.2. Utilities for package management (pkgtools)
1.1 dsieger 2353:
2354: The directory pkgsrc/pkgtools contains a number of useful utilities for both
2355: users and developers of pkgsrc. This section attempts only to make the reader
1.121 sevan 2356: aware of some of the utilities and when they might be useful, and not to
2357: duplicate the documentation that comes with each package.
1.1 dsieger 2358:
2359: Utilities used by pkgsrc (automatically installed when needed):
2360:
2361: * pkgtools/x11-links: Symlinks for use by buildlink.
2362:
2363: OS tool augmentation (automatically installed when needed):
2364:
1.121 sevan 2365: * pkgtools/digest: Calculates various kinds of checksums (including SHA3).
1.1 dsieger 2366:
2367: * pkgtools/libnbcompat: Compatibility library for pkgsrc tools.
2368:
2369: * pkgtools/mtree: Installed on non-BSD systems due to lack of native mtree.
2370:
2371: * pkgtools/pkg_install: Up-to-date replacement for /usr/sbin/pkg_install, or
2372: for use on operating systems where pkg_install is not present.
2373:
2374: Utilities used by pkgsrc (not automatically installed):
2375:
2376: * pkgtools/pkg_tarup: Create a binary package from an already-installed
2377: package. Used by make replace to save the old package.
2378:
2379: * pkgtools/dfdisk: Adds extra functionality to pkgsrc, allowing it to fetch
2380: distfiles from multiple locations. It currently supports the following
2381: methods: multiple CD-ROMs and network FTP/HTTP connections.
2382:
2383: * devel/cpuflags: Determine the best compiler flags to optimise code for your
1.24 wiz 2384: current CPU and compiler.
1.1 dsieger 2385:
2386: Utilities for keeping track of installed packages, being up to date, etc:
2387:
1.65 wiz 2388: * pkgtools/pkgin: A package update tool similar to apt(1). Download, install,
2389: and upgrade binary packages easily.
2390:
1.1 dsieger 2391: * pkgtools/pkg_chk: Reports on packages whose installed versions do not match
2392: the latest pkgsrc entries.
2393:
2394: * pkgtools/pkgdep: Makes dependency graphs of packages, to aid in choosing a
2395: strategy for updating.
2396:
2397: * pkgtools/pkgdepgraph: Makes graphs from the output of pkgtools/pkgdep (uses
2398: graphviz).
2399:
1.12 weinem 2400: * pkgtools/pkglint: The pkglint(1) program checks a pkgsrc entry for errors.
2401:
2402: * pkgtools/lintpkgsrc: The lintpkgsrc(1) program does various checks on the
2403: complete pkgsrc system.
1.1 dsieger 2404:
2405: * pkgtools/pkgsurvey: Report what packages you have installed.
2406:
2407: Utilities for people maintaining or creating individual packages:
2408:
2409: * pkgtools/pkgdiff: Automate making and maintaining patches for a package
2410: (includes pkgdiff, pkgvi, mkpatches, etc.).
2411:
1.65 wiz 2412: * pkgtools/url2pkg: Aids in converting to pkgsrc.
1.1 dsieger 2413:
2414: Utilities for people maintaining pkgsrc (or: more obscure pkg utilities)
2415:
2416: * pkgtools/pkg_comp: Build packages in a chrooted area.
2417:
2418: * pkgtools/libkver: Spoof kernel version for chrooted cross builds.
2419:
1.154 rillig 2420: 10.3. How to use pkgsrc as non-root
1.1 dsieger 2421:
1.108 rillig 2422: To install packages from source as a non-root user, download pkgsrc as
1.154 rillig 2423: described in Chapter 3, Where to get pkgsrc and how to keep it up-to-date, cd
1.108 rillig 2424: into that directory and run the command ./bootstrap/bootstrap --unprivileged.
2425:
2426: This will install the binary part of pkgsrc to ~/pkg and put the pkgsrc
2427: configuration mk.conf into ~/pkg/etc.
2428:
2429: For more details, see mk/unprivileged.mk.
1.1 dsieger 2430:
1.154 rillig 2431: 10.4. How to resume transfers when fetching distfiles?
1.1 dsieger 2432:
2433: By default, resuming transfers in pkgsrc is disabled, but you can enable this
1.4 rillig 2434: feature by adding the option PKG_RESUME_TRANSFERS=YES into mk.conf. If, during
2435: a fetch step, an incomplete distfile is found, pkgsrc will try to resume it.
1.1 dsieger 2436:
1.61 wiz 2437: You can also use a different program than the platform default program by
2438: changing the FETCH_USING variable. You can specify the program by using of ftp,
2439: fetch, wget or curl. Alternatively, fetching can be disabled by using the value
2440: manual. A value of custom disables the system defaults and dependency tracking
2441: for the fetch program. In that case you have to provide FETCH_CMD,
2442: FETCH_BEFORE_ARGS, FETCH_RESUME_ARGS, FETCH_OUTPUT_ARGS, FETCH_AFTER_ARGS.
1.1 dsieger 2443:
1.16 jnemeth 2444: For example, if you want to use wget to download, you'll have to use something
2445: like:
1.1 dsieger 2446:
1.16 jnemeth 2447: FETCH_USING= wget
1.1 dsieger 2448:
1.154 rillig 2449: 10.5. How can I install/use modular X.org from pkgsrc?
1.1 dsieger 2450:
1.4 rillig 2451: If you want to use modular X.org from pkgsrc instead of your system's own X11
2452: (/usr/X11R6, /usr/openwin, ...) you will have to add the following line into
1.1 dsieger 2453: mk.conf:
2454:
1.4 rillig 2455: X11_TYPE=modular
1.1 dsieger 2456:
1.154 rillig 2457: 10.6. How to fetch files from behind a firewall
1.1 dsieger 2458:
2459: If you are sitting behind a firewall which does not allow direct connections to
2460: Internet hosts (i.e. non-NAT), you may specify the relevant proxy hosts. This
2461: is done using an environment variable in the form of a URL, e.g. in Amdahl, the
2462: machine "orpheus.amdahl.com" is one of the firewalls, and it uses port 80 as
2463: the proxy port number. So the proxy environment variables are:
2464:
2465: ftp_proxy=ftp://orpheus.amdahl.com:80/
2466: http_proxy=http://orpheus.amdahl.com:80/
2467:
1.154 rillig 2468: 10.7. How to fetch files from HTTPS sites
1.65 wiz 2469:
2470: Some fetch tools are not prepared to support HTTPS by default (for example, the
2471: one in NetBSD 6.0), or the one installed by the pkgsrc bootstrap (to avoid an
2472: openssl dependency that low in the dependency graph).
2473:
2474: Usually you won't notice, because distribution files are mirrored weekly to "
2475: ftp.NetBSD.org", but that might not be often enough if you are following
2476: pkgsrc-current. In that case, set FETCH_USING in your mk.conf file to "curl" or
2477: "wget", which are both compiled with HTTPS support by default. Of course, these
2478: tools need to be installed before you can use them this way.
2479:
1.154 rillig 2480: 10.8. How do I tell make fetch to do passive FTP?
1.1 dsieger 2481:
2482: This depends on which utility is used to retrieve distfiles. From bsd.pkg.mk,
2483: FETCH_CMD is assigned the first available command from the following list:
2484:
2485: * ${LOCALBASE}/bin/ftp
2486:
2487: * /usr/bin/ftp
2488:
2489: On a default NetBSD installation, this will be /usr/bin/ftp, which
2490: automatically tries passive connections first, and falls back to active
2491: connections if the server refuses to do passive. For the other tools, add the
1.4 rillig 2492: following to your mk.conf file: PASSIVE_FETCH=1.
1.1 dsieger 2493:
2494: Having that option present will prevent /usr/bin/ftp from falling back to
2495: active transfers.
2496:
1.154 rillig 2497: 10.9. How to fetch all distfiles at once
1.1 dsieger 2498:
2499: You would like to download all the distfiles in a single batch from work or
2500: university, where you can't run a make fetch. There is an archive of distfiles
2501: on ftp.NetBSD.org, but downloading the entire directory may not be appropriate.
2502:
2503: The answer here is to do a make fetch-list in /usr/pkgsrc or one of its
2504: subdirectories, carry the resulting list to your machine at work/school and use
2505: it there. If you don't have a NetBSD-compatible ftp(1) (like tnftp) at work,
2506: don't forget to set FETCH_CMD to something that fetches a URL:
2507:
2508: At home:
2509:
2510: % cd /usr/pkgsrc
2511: % make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh
2512: % scp /tmp/fetch.sh work:/tmp
2513:
2514: At work:
2515:
2516: % sh /tmp/fetch.sh
2517:
2518: then tar up /tmp/distfiles and take it home.
2519:
2520: If you have a machine running NetBSD, and you want to get all distfiles (even
2521: ones that aren't for your machine architecture), you can do so by using the
2522: above-mentioned make fetch-list approach, or fetch the distfiles directly by
2523: running:
2524:
2525: % make mirror-distfiles
2526:
2527: If you even decide to ignore NO_{SRC,BIN}_ON_{FTP,CDROM}, then you can get
2528: everything by running:
2529:
2530: % make fetch NO_SKIP=yes
2531:
1.154 rillig 2532: 10.10. What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
1.1 dsieger 2533:
2534: When compiling the pkgtools/pkg_install package, you get the error from make
2535: that it doesn't know how to make /usr/share/tmac/tmac.andoc? This indicates
2536: that you don't have installed the "text" set (nroff, ...) from the NetBSD base
2537: distribution on your machine. It is recommended to do that to format man pages.
2538:
2539: In the case of the pkgtools/pkg_install package, you can get away with setting
1.4 rillig 2540: NOMAN=YES either in the environment or in mk.conf.
1.1 dsieger 2541:
1.154 rillig 2542: 10.11. What does "Could not find bsd.own.mk" mean?
1.1 dsieger 2543:
2544: You didn't install the compiler set, comp.tgz, when you installed your NetBSD
2545: machine. Please get and install it, by extracting it in /:
2546:
2547: # cd /
2548: # tar --unlink -zxvpf .../comp.tgz
2549:
2550: comp.tgz is part of every NetBSD release. Get the one that corresponds to your
2551: release (determine via uname -r).
2552:
1.221 nia 2553: 10.12. Using 'sudo' or `priv` with pkgsrc
1.1 dsieger 2554:
2555: When installing packages as non-root user and using the just-in-time su(1)
2556: feature of pkgsrc, it can become annoying to type in the root password for each
2557: required package installed. To avoid this, the sudo package can be used, which
1.221 nia 2558: does password caching over a limited time. To use it, install sudo or priv
2559: (either as binary package, from security/priv, or security/sudo) and then put
2560: the following into your mk.conf, somewhere after the definition of the
2561: LOCALBASE variable:
1.1 dsieger 2562:
2563: .if exists(${LOCALBASE}/bin/sudo)
2564: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
2565: .endif
2566:
1.154 rillig 2567: 10.13. How do I change the location of configuration files?
1.1 dsieger 2568:
2569: As the system administrator, you can choose where configuration files are
2570: installed. The default settings make all these files go into ${PREFIX}/etc or
2571: some of its subdirectories; this may be suboptimal depending on your
2572: expectations (e.g., a read-only, NFS-exported PREFIX with a need of per-machine
2573: configuration of the provided packages).
2574:
2575: In order to change the defaults, you can modify the PKG_SYSCONFBASE variable
1.4 rillig 2576: (in mk.conf) to point to your preferred configuration directory; some common
2577: examples include /etc or /etc/pkg.
1.1 dsieger 2578:
2579: Furthermore, you can change this value on a per-package basis by setting the
2580: PKG_SYSCONFDIR.${PKG_SYSCONFVAR} variable. PKG_SYSCONFVAR's value usually
2581: matches the name of the package you would like to modify, that is, the contents
2582: of PKGBASE.
2583:
2584: Note that after changing these settings, you must rebuild and reinstall any
2585: affected packages.
2586:
1.154 rillig 2587: 10.14. Automated security checks
1.1 dsieger 2588:
2589: Please be aware that there can often be bugs in third-party software, and some
2590: of these bugs can leave a machine vulnerable to exploitation by attackers. In
2591: an effort to lessen the exposure, the NetBSD packages team maintains a database
2592: of known-exploits to packages which have at one time been included in pkgsrc.
2593: The database can be downloaded automatically, and a security audit of all
1.14 jmcneill 2594: packages installed on a system can take place. To do this, refer to the
2595: following two tools (installed as part of the pkgtools/pkg_install package):
1.1 dsieger 2596:
1.21 snj 2597: 1. pkg_admin fetch-pkg-vulnerabilities, an easy way to download a list of the
2598: security vulnerabilities information. This list is kept up to date by the
1.26 spz 2599: pkgsrc security team, and is distributed from the NetBSD ftp server:
1.1 dsieger 2600:
1.177 leot 2601: https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities
1.1 dsieger 2602:
1.21 snj 2603: 2. pkg_admin audit, an easy way to audit the current machine, checking each
1.24 wiz 2604: known vulnerability. If a vulnerable package is installed, it will be shown
2605: by output to stdout, including a description of the type of vulnerability,
2606: and a URL containing more information.
1.1 dsieger 2607:
1.202 nia 2608: Use of these tools is strongly recommended! See Section 5.1.6, "Checking for
1.121 sevan 2609: security vulnerabilities in installed packages" for instructions on how to
2610: automate checking and reporting.
2611:
2612: If this database is installed, pkgsrc builds will use it to perform a security
2613: check before building any package.
1.1 dsieger 2614:
1.154 rillig 2615: 10.15. Why do some packages ignore my CFLAGS?
1.1 dsieger 2616:
2617: When you add your own preferences to the CFLAGS variable in your mk.conf, these
2618: flags are passed in environment variables to the ./configure scripts and to
2619: make(1). Some package authors ignore the CFLAGS from the environment variable
2620: by overriding them in the Makefiles of their package.
2621:
2622: Currently there is no solution to this problem. If you really need the package
2623: to use your CFLAGS you should run make patch in the package directory and then
2624: inspect any Makefile and Makefile.in for whether they define CFLAGS explicitly.
2625: Usually you can remove these lines. But be aware that some "smart" programmers
2626: write so bad code that it only works for the specific combination of CFLAGS
2627: they have chosen.
2628:
1.172 rillig 2629: To find out where the CFLAGS are ignored, add the following lines to mk.conf:
2630:
2631: CPPFLAGS+= -Dpkgsrc___CPPFLAGS
2632: CFLAGS+= -Dpkgsrc___CFLAGS
2633: CXXFLAGS+= -Dpkgsrc___CXXFLAGS
2634:
2635: Then run bmake show-all-configure show-all-build to see whether the above flags
2636: are passed to the actual build commands in general.
2637:
2638: To find out whether the flags are passed to individual compiler commands, have
2639: a look at the file work/.work.log. In most cases, the flags from the original
2640: command lines (the lines starting with [*]) are passed unmodified to the actual
2641: compiler (the lines starting with <.>). If the flag is missing from the actual
2642: compiler command, it must have been removed by the pkgsrc compiler wrappers.
2643:
1.154 rillig 2644: 10.16. A package does not build. What shall I do?
1.1 dsieger 2645:
2646: 1. Make sure that your copy of pkgsrc is consistent. A case that occurs often
2647: is that people only update pkgsrc in parts, because of performance reasons.
2648: Since pkgsrc is one large system, not a collection of many small systems,
2649: there are sometimes changes that only work when the whole pkgsrc tree is
2650: updated.
2651:
1.25 wiz 2652: 2. Make sure that you don't have any CVS conflicts. Search for "<<<<<<" or "
2653: >>>>>>" in all your pkgsrc files.
1.1 dsieger 2654:
1.25 wiz 2655: 3. Make sure that you don't have old copies of the packages extracted. Run
1.1 dsieger 2656: make clean clean-depends to verify this.
2657:
1.108 rillig 2658: 4. If you are a package developer who wants to invest some work, have a look
1.154 rillig 2659: at Chapter 21, Making your package work.
1.108 rillig 2660:
2661: 5. If the problem still exists, write a mail to the pkgsrc-users mailing list.
1.1 dsieger 2662:
1.154 rillig 2663: 10.17. What does "Makefile appears to contain unresolved cvs/rcs/??? merge
1.1 dsieger 2664: conflicts" mean?
2665:
2666: You have modified a file from pkgsrc, and someone else has modified that same
2667: file afterwards in the CVS repository. Both changes are in the same region of
2668: the file, so when you updated pkgsrc, the cvs command marked the conflicting
2669: changes in the file. Because of these markers, the file is no longer a valid
2670: Makefile.
2671:
2672: Have a look at that file, and if you don't need your local changes anymore, you
2673: can remove that file and run cvs -q update -dP in that directory to download
2674: the current version.
2675:
2676: Part II. The pkgsrc developer's guide
2677:
2678: This part of the book deals with creating and modifying packages. It starts
2679: with a "HOWTO"-like guide on creating a new package. The remaining chapters are
2680: more like a reference manual for pkgsrc.
2681:
2682: Table of Contents
2683:
1.154 rillig 2684: 11. Getting help
1.184 rillig 2685: 12. Package components - files, directories and contents
1.1 dsieger 2686:
1.184 rillig 2687: 12.1. Makefile
2688: 12.2. distinfo
2689: 12.3. patches/*
1.1 dsieger 2690:
1.184 rillig 2691: 12.3.1. Structure of a single patch file
2692: 12.3.2. Creating patch files
2693: 12.3.3. Sources where the patch files come from
2694: 12.3.4. Patching guidelines
2695: 12.3.5. Feedback to the author
1.1 dsieger 2696:
1.184 rillig 2697: 12.4. Other mandatory files
2698: 12.5. Optional files
1.1 dsieger 2699:
1.184 rillig 2700: 12.5.1. Files affecting the binary package
2701: 12.5.2. Files affecting the build process
2702: 12.5.3. Files affecting nothing at all
1.1 dsieger 2703:
1.184 rillig 2704: 12.6. work*
2705: 12.7. files/*
1.1 dsieger 2706:
1.184 rillig 2707: 13. The build process
1.1 dsieger 2708:
1.184 rillig 2709: 13.1. Introduction
2710: 13.2. Program location
2711: 13.3. Directories used during the build process
2712: 13.4. Running a phase
2713: 13.5. The fetch phase
1.1 dsieger 2714:
1.184 rillig 2715: 13.5.1. What to fetch and where to get it from
2716: 13.5.2. How are the files fetched?
1.1 dsieger 2717:
1.184 rillig 2718: 13.6. The checksum phase
2719: 13.7. The extract phase
2720: 13.8. The patch phase
2721: 13.9. The tools phase
2722: 13.10. The wrapper phase
2723: 13.11. The configure phase
2724: 13.12. The build phase
2725: 13.13. The test phase
2726: 13.14. The install phase
2727: 13.15. The package phase
2728: 13.16. Cleaning up
2729: 13.17. Other helpful targets
1.1 dsieger 2730:
1.184 rillig 2731: 14. Creating a new pkgsrc package from scratch
1.1 dsieger 2732:
1.184 rillig 2733: 14.1. Common types of packages
1.1 dsieger 2734:
1.219 nia 2735: 14.1.1. Python modules and programs
2736: 14.1.2. R packages
2737: 14.1.3. TeXlive packages
1.1 dsieger 2738:
1.184 rillig 2739: 14.2. Examples
1.1 dsieger 2740:
1.184 rillig 2741: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 2742:
1.184 rillig 2743: 15. Programming in Makefiles
1.1 dsieger 2744:
1.184 rillig 2745: 15.1. Caveats
2746: 15.2. Makefile variables
1.1 dsieger 2747:
1.184 rillig 2748: 15.2.1. Naming conventions
1.1 dsieger 2749:
1.184 rillig 2750: 15.3. Code snippets
1.1 dsieger 2751:
1.184 rillig 2752: 15.3.1. Adding things to a list
2753: 15.3.2. Echoing a string exactly as-is
2754: 15.3.3. Passing CFLAGS to GNU configure scripts
2755: 15.3.4. Handling possibly empty variables
1.229 gutterid 2756: 15.3.5. Testing yes/no variables in conditions
1.1 dsieger 2757:
1.184 rillig 2758: 16. Options handling
1.1 dsieger 2759:
1.184 rillig 2760: 16.1. Global default options
2761: 16.2. Converting packages to use bsd.options.mk
2762: 16.3. Option Names
2763: 16.4. Determining the options of dependencies
1.1 dsieger 2764:
1.184 rillig 2765: 17. Tools needed for building or running
1.1 dsieger 2766:
1.184 rillig 2767: 17.1. Tools for pkgsrc builds
2768: 17.2. Tools needed by packages
2769: 17.3. Tools provided by platforms
1.1 dsieger 2770:
1.184 rillig 2771: 18. Buildlink methodology
1.1 dsieger 2772:
1.184 rillig 2773: 18.1. Converting packages to use buildlink3
2774: 18.2. Writing buildlink3.mk files
1.1 dsieger 2775:
1.184 rillig 2776: 18.2.1. Anatomy of a buildlink3.mk file
2777: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.
2778: pkg in buildlink3.mk files
1.1 dsieger 2779:
1.184 rillig 2780: 18.3. Writing builtin.mk files
1.1 dsieger 2781:
1.184 rillig 2782: 18.3.1. Anatomy of a builtin.mk file
2783: 18.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 2784:
1.184 rillig 2785: 19. PLIST issues
1.1 dsieger 2786:
1.184 rillig 2787: 19.1. RCS ID
2788: 19.2. Semi-automatic PLIST generation
2789: 19.3. Tweaking output of make print-PLIST
2790: 19.4. Variable substitution in PLIST
2791: 19.5. Man page compression
2792: 19.6. Changing PLIST source with PLIST_SRC
2793: 19.7. Platform-specific and differing PLISTs
2794: 19.8. Build-specific PLISTs
2795: 19.9. Sharing directories between packages
1.1 dsieger 2796:
1.184 rillig 2797: 20. The pkginstall framework
1.1 dsieger 2798:
1.184 rillig 2799: 20.1. Files and directories outside the installation prefix
1.1 dsieger 2800:
1.184 rillig 2801: 20.1.1. Directory manipulation
2802: 20.1.2. File manipulation
1.1 dsieger 2803:
1.184 rillig 2804: 20.2. Configuration files
1.1 dsieger 2805:
1.184 rillig 2806: 20.2.1. How PKG_SYSCONFDIR is set
2807: 20.2.2. Telling the software where configuration files are
2808: 20.2.3. Patching installations
2809: 20.2.4. Disabling handling of configuration files
1.1 dsieger 2810:
1.184 rillig 2811: 20.3. System startup scripts
1.1 dsieger 2812:
1.184 rillig 2813: 20.3.1. Disabling handling of system startup scripts
1.1 dsieger 2814:
1.184 rillig 2815: 20.4. System users and groups
2816: 20.5. System shells
1.1 dsieger 2817:
1.184 rillig 2818: 20.5.1. Disabling shell registration
1.1 dsieger 2819:
1.184 rillig 2820: 20.6. Fonts
1.1 dsieger 2821:
1.184 rillig 2822: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 2823:
1.154 rillig 2824: 21. Making your package work
1.1 dsieger 2825:
1.154 rillig 2826: 21.1. General operation
1.1 dsieger 2827:
1.154 rillig 2828: 21.1.1. How to pull in user-settable variables from mk.conf
2829: 21.1.2. User interaction
2830: 21.1.3. Handling licenses
2831: 21.1.4. Restricted packages
2832: 21.1.5. Handling dependencies
2833: 21.1.6. Handling conflicts with other packages
2834: 21.1.7. Packages that cannot or should not be built
2835: 21.1.8. Packages which should not be deleted, once installed
2836: 21.1.9. Handling packages with security problems
2837: 21.1.10. How to handle incrementing versions when fixing an existing
1.1 dsieger 2838: package
1.154 rillig 2839: 21.1.11. Substituting variable text in the package files (the SUBST
1.1 dsieger 2840: framework)
2841:
1.154 rillig 2842: 21.2. The fetch phase
1.1 dsieger 2843:
1.154 rillig 2844: 21.2.1. Packages whose distfiles aren't available for plain downloading
2845: 21.2.2. How to handle modified distfiles with the 'old' name
2846: 21.2.3. Packages hosted on github.com
2847:
2848: 21.3. The configure phase
2849:
2850: 21.3.1. Shared libraries - libtool
2851: 21.3.2. Using libtool on GNU packages that already support libtool
2852: 21.3.3. GNU Autoconf/Automake
1.223 nia 2853: 21.3.4. Meson / ninja
1.154 rillig 2854:
2855: 21.4. Programming languages
2856:
2857: 21.4.1. C, C++, and Fortran
2858: 21.4.2. Java
1.205 wiz 2859: 21.4.3. Go
1.223 nia 2860: 21.4.4. Rust
2861: 21.4.5. Packages containing Perl scripts
2862: 21.4.6. Packages containing shell scripts
2863: 21.4.7. Other programming languages
1.154 rillig 2864:
2865: 21.5. The build phase
2866:
2867: 21.5.1. Compiling C and C++ code conditionally
2868: 21.5.2. How to handle compiler bugs
1.172 rillig 2869: 21.5.3. No such file or directory
2870: 21.5.4. Undefined reference to "..."
2871: 21.5.5. Running out of memory
1.154 rillig 2872:
2873: 21.6. The install phase
2874:
2875: 21.6.1. Creating needed directories
2876: 21.6.2. Where to install documentation
2877: 21.6.3. Installing highscore files
2878: 21.6.4. Adding DESTDIR support to packages
2879: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 2880: 21.6.6. Packages installing Perl modules
1.154 rillig 2881: 21.6.7. Packages installing info files
2882: 21.6.8. Packages installing man pages
1.203 nia 2883: 21.6.9. Packages installing X11 fonts
2884: 21.6.10. Packages installing SGML or XML data
2885: 21.6.11. Packages installing extensions to the MIME database
2886: 21.6.12. Packages using intltool
2887: 21.6.13. Packages installing startup scripts
2888: 21.6.14. Packages installing TeX modules
2889: 21.6.15. Packages supporting running binaries in emulation
2890: 21.6.16. Packages installing hicolor icons
2891: 21.6.17. Packages installing desktop files
1.154 rillig 2892:
2893: 21.7. Marking packages as having problems
2894:
1.184 rillig 2895: 22. GNOME packaging and porting
2896:
2897: 22.1. Meta packages
2898: 22.2. Packaging a GNOME application
2899: 22.3. Updating GNOME to a newer version
2900: 22.4. Patching guidelines
2901:
1.154 rillig 2902: 23. Submitting and Committing
2903:
2904: 23.1. Submitting binary packages
2905: 23.2. Submitting source packages (for non-NetBSD-developers)
2906: 23.3. General notes when adding, updating, or removing packages
2907: 23.4. Commit Messages
2908: 23.5. Committing: Adding a package to CVS
2909: 23.6. Updating a package to a newer version
2910: 23.7. Renaming a package in pkgsrc
2911: 23.8. Moving a package in pkgsrc
2912:
2913: 24. Frequently Asked Questions
2914:
2915: Chapter 11. Getting help
2916:
2917: To get help when developing pkgsrc, the definitive source is this document, the
2918: pkgsrc guide. If you don't find anything here, there are alternatives:
2919:
2920: * The built-in pkgsrc help, which is available after bootstrapping pkgsrc.
2921: Run bmake help topic=? to get help for any topic, such as a variable name
2922: like BUILD_DEFS, a make target like do-build, a missing C or C++ function
2923: like strcasecmp or any other topic.
2924:
1.207 leot 2925: The available help topics are listed in Appendix E, Help topics.
1.154 rillig 2926:
1.163 rillig 2927: * To see the value of a single variable, run bmake show-var VARNAME=X.
2928:
2929: * To see the values of the most common variables, run bmake show-all. These
2930: variables are grouped by topic. To see the variables for a single topic,
2931: run bmake show-all-topic, for example bmake show-all-fetch.
2932:
1.154 rillig 2933: * The tech-pkg mailing list, to which you can subscribe and then ask your
2934: questions.
2935:
2936: * The #pkgsrc IRC channel, which is accessible via a web browser or by using
2937: a specialized chat program such as XChat. Pick any user name and join the
2938: channel #pkgsrc.
1.1 dsieger 2939:
1.184 rillig 2940: Chapter 12. Package components - files, directories and contents
1.1 dsieger 2941:
2942: Table of Contents
2943:
1.184 rillig 2944: 12.1. Makefile
2945: 12.2. distinfo
2946: 12.3. patches/*
2947:
2948: 12.3.1. Structure of a single patch file
2949: 12.3.2. Creating patch files
2950: 12.3.3. Sources where the patch files come from
2951: 12.3.4. Patching guidelines
2952: 12.3.5. Feedback to the author
2953:
2954: 12.4. Other mandatory files
2955: 12.5. Optional files
2956:
2957: 12.5.1. Files affecting the binary package
2958: 12.5.2. Files affecting the build process
2959: 12.5.3. Files affecting nothing at all
1.1 dsieger 2960:
1.184 rillig 2961: 12.6. work*
2962: 12.7. files/*
1.1 dsieger 2963:
1.184 rillig 2964: Whenever you're preparing a package, there are a number of files involved which
2965: are described in the following sections.
1.1 dsieger 2966:
1.184 rillig 2967: 12.1. Makefile
1.1 dsieger 2968:
1.184 rillig 2969: Building, installation and creation of a binary package are all controlled by
2970: the package's Makefile. The Makefile describes various things about a package,
2971: for example from where to get it, how to configure, build, and install it.
1.1 dsieger 2972:
1.184 rillig 2973: A package Makefile contains several sections that describe the package.
1.1 dsieger 2974:
1.184 rillig 2975: In the first section there are the following variables, which should appear
2976: exactly in the order given here. The order and grouping of the variables is
2977: mostly historical and has no further meaning.
1.1 dsieger 2978:
1.184 rillig 2979: * DISTNAME is the basename of the distribution file to be downloaded from the
2980: package's website.
1.1 dsieger 2981:
1.184 rillig 2982: * PKGNAME is the name of the package, as used by pkgsrc. You need to provide
2983: it if DISTNAME (which is the default) is not a good name for the package in
2984: pkgsrc or DISTNAME is not provided (no distribution file is required).
2985: Usually it is the pkgsrc directory name together with the version number.
2986: It must match the regular expression ^[A-Za-z0-9][A-Za-z0-9-_.+]*$, that
2987: is, it starts with a letter or digit, and contains only letters, digits,
1.204 nia 2988: dashes, underscores, dots and plus signs. New packages should have entirely
2989: lower-case names, with the exception of some that must follow pre-existing
2990: conventions (e.g. R packages begin with R-). You can use the :tl variable
2991: modifier to lower-case the package name.
1.26 spz 2992:
1.184 rillig 2993: * CATEGORIES is a list of categories which the package fits in. You can
2994: choose any of the top-level directories of pkgsrc for it.
1.1 dsieger 2995:
1.184 rillig 2996: Currently the following values are available for CATEGORIES. If more than
2997: one is used, they need to be separated by spaces:
1.1 dsieger 2998:
1.184 rillig 2999: archivers cross geography meta-pkgs security
3000: audio databases graphics misc shells
3001: benchmarks devel ham multimedia sysutils
3002: biology editors inputmethod net textproc
3003: cad emulators lang news time
3004: chat finance mail parallel wm
3005: comms fonts math pkgtools www
3006: converters games mbone print x11
1.1 dsieger 3007:
1.184 rillig 3008: * MASTER_SITES, DYNAMIC_MASTER_SITES, DIST_SUBDIR, EXTRACT_SUFX and DISTFILES
3009: are discussed in detail in Section 13.5, "The fetch phase".
1.1 dsieger 3010:
1.184 rillig 3011: The second section contains information about separately downloaded patches, if
3012: any.
1.1 dsieger 3013:
1.184 rillig 3014: * PATCHFILES: Name(s) of additional files that contain distribution patches.
3015: There is no default. pkgsrc will look for them at PATCH_SITES. They will
3016: automatically be uncompressed before patching if the names end with .gz or
3017: .Z.
1.1 dsieger 3018:
1.184 rillig 3019: * PATCH_SITES: Primary location(s) for distribution patch files (see
3020: PATCHFILES above) if not found locally.
1.1 dsieger 3021:
1.184 rillig 3022: * PATCH_DIST_STRIP: an argument to patch(1) that sets the pathname strip
3023: count to help find the correct files to patch. It defaults to -p0.
1.1 dsieger 3024:
1.184 rillig 3025: The third section contains the following variables.
1.1 dsieger 3026:
1.184 rillig 3027: * MAINTAINER is the email address of the person who feels responsible for
3028: this package, and who is most likely to look at problems or questions
3029: regarding this package which have been reported with send-pr(1). Other
3030: developers may contact the MAINTAINER before making changes to the package,
3031: but are not required to do so. When packaging a new program, set MAINTAINER
3032: to yourself. If you really can't maintain the package for future updates,
3033: set it to <pkgsrc-users@NetBSD.org>.
1.1 dsieger 3034:
1.184 rillig 3035: * OWNER should be used instead of MAINTAINER when you do not want other
3036: developers to update or change the package without contacting you first. A
3037: package Makefile should contain one of MAINTAINER or OWNER, but not both.
1.1 dsieger 3038:
1.184 rillig 3039: * HOMEPAGE is a URL where users can find more information about the package.
1.1 dsieger 3040:
1.184 rillig 3041: * COMMENT is a one-line description of the package (should not include the
3042: package name).
1.1 dsieger 3043:
1.184 rillig 3044: * LICENSE indicates the license(s) applicable for the package. See
3045: Section 21.1.3, "Handling licenses" for further details.
1.1 dsieger 3046:
1.184 rillig 3047: Other variables that affect the build:
1.1 dsieger 3048:
1.184 rillig 3049: * WRKSRC: The directory where the interesting distribution files of the
3050: package are found. The default is ${WRKDIR}/${DISTNAME}, which works for
3051: most packages.
1.1 dsieger 3052:
1.184 rillig 3053: If a package doesn't create a subdirectory for itself (most GNU software
3054: does, for instance), but extracts itself in the current directory, you
3055: should set WRKSRC=${WRKDIR}.
1.1 dsieger 3056:
1.184 rillig 3057: If a package doesn't create a subdirectory with the name of DISTNAME but
3058: some different name, set WRKSRC to point to the proper name in ${WRKDIR},
3059: for example WRKSRC=${WRKDIR}/${DISTNAME}/unix. See lang/tcl and x11/tk for
3060: other examples.
1.17 imil 3061:
1.184 rillig 3062: The name of the working directory created by pkgsrc is taken from the
3063: WRKDIR_BASENAME variable. By default, its value is work. If you want to use
3064: the same pkgsrc tree for building different kinds of binary packages, you
3065: can change the variable according to your needs. Two other variables handle
3066: common cases of setting WRKDIR_BASENAME individually. If OBJHOSTNAME is
3067: defined in mk.conf, the first component of the host's name is attached to
3068: the directory name. If OBJMACHINE is defined, the platform name is
3069: attached, which might look like work.i386 or work.sparc.
1.17 imil 3070:
1.184 rillig 3071: Please pay attention to the following gotchas:
1.17 imil 3072:
1.184 rillig 3073: * Add MANCOMPRESSED if man pages are installed in compressed form by the
3074: package. For packages using BSD-style makefiles which honor MANZ, there is
3075: MANCOMPRESSED_IF_MANZ.
1.17 imil 3076:
1.184 rillig 3077: * Replace /usr/local with "${PREFIX}" in all files (see patches, below).
1.103 wiz 3078:
1.184 rillig 3079: * If the package installs any info files, see Section 21.6.7, "Packages
3080: installing info files".
1.103 wiz 3081:
1.184 rillig 3082: 12.2. distinfo
1.17 imil 3083:
1.184 rillig 3084: The distinfo file contains the message digest, or checksum, of each distfile
3085: needed for the package. This ensures that the distfiles retrieved from the
3086: Internet have not been corrupted during transfer or altered by a malign force
3087: to introduce a security hole. To provide maximum security, all distfiles are
3088: protected using three different message digest algorithms (SHA1, RMD160,
3089: SHA512), as well as the file size.
1.17 imil 3090:
1.184 rillig 3091: The distinfo file also contains the checksums for all the patches found in the
3092: patches directory (see Section 12.3, "patches/*"). These checksums ensure that
3093: patches are only applied intentionally and that they don't accidentally change,
3094: e.g. when merging different changes together. They also make sure that new
3095: patches are actually added to CVS and old ones are removed. Too see whether the
3096: patches and the distinfo file match, run pkglint after changing the patches.
1.17 imil 3097:
1.184 rillig 3098: To regenerate the distinfo file, use the make distinfo command.
1.17 imil 3099:
1.184 rillig 3100: Some packages have different sets of distfiles depending on the platform, for
3101: example lang/openjdk8. These are kept in the same distinfo file and care should
3102: be taken when upgrading such a package to ensure distfile information is not
3103: lost.
1.17 imil 3104:
1.184 rillig 3105: 12.3. patches/*
1.63 wiz 3106:
1.184 rillig 3107: Some packages don't work out-of-the box on the various platforms that are
3108: supported by pkgsrc. These packages need to be patched to make them work. The
3109: patch files can be found in the patches/ directory.
1.17 imil 3110:
1.184 rillig 3111: In the patch phase, these patches are applied to the files in WRKSRC directory
3112: after extracting them, in alphabetic order.
1.160 brook 3113:
1.184 rillig 3114: 12.3.1. Structure of a single patch file
1.160 brook 3115:
1.184 rillig 3116: The patch-* files should be in diff -bu format, and apply without a fuzz to
3117: avoid problems. (To force patches to apply with fuzz you can set
3118: PATCH_FUZZ_FACTOR=-F2). Furthermore, each patch should contain only changes for
3119: a single file, and no file should be patched by more than one patch file. This
3120: helps to keep future modifications simple.
1.160 brook 3121:
1.184 rillig 3122: Each patch file is structured as follows: In the first line, there is the RCS
3123: Id of the patch itself. The second line should be empty for aesthetic reasons.
3124: After that, there should be a comment for each change that the patch does.
3125: There are a number of standard cases:
1.160 brook 3126:
1.184 rillig 3127: * Patches for commonly known vulnerabilities should mention the vulnerability
3128: ID (CAN, CVE).
1.160 brook 3129:
1.184 rillig 3130: * Patches that change source code should mention the platform and other
3131: environment (for example, the compiler) that the patch is needed for.
1.160 brook 3132:
1.184 rillig 3133: The patch should be commented so that any developer who knows the code of the
3134: application can make some use of the patch. Special care should be taken for
3135: the upstream developers, since we generally want that they accept our patches,
3136: so we have less work in the future.
1.160 brook 3137:
1.184 rillig 3138: 12.3.2. Creating patch files
1.160 brook 3139:
1.184 rillig 3140: One important thing to mention is to pay attention that no RCS IDs get stored
3141: in the patch files, as these will cause problems when later checked into the
3142: NetBSD CVS tree. Use the pkgdiff command from the pkgtools/pkgdiff package to
3143: avoid these problems.
1.160 brook 3144:
1.184 rillig 3145: For even more automation, we recommend using mkpatches from the same package to
1.222 gutterid 3146: make a whole set of patches. You just have to back up files before you edit
3147: them to filename.orig, e.g., with cp -p filename filename.orig or, easier, by
3148: using pkgvi again from the same package. If you upgrade a package this way, you
3149: can easily compare the new set of patches with the previously existing one with
1.184 rillig 3150: patchdiff. The files in patches are replaced by new files, so carefully check
3151: if you want to take all the changes.
1.160 brook 3152:
1.184 rillig 3153: When you have finished a package, remember to generate the checksums for the
3154: patch files by using the make makepatchsum command, see Section 12.2,
3155: "distinfo".
1.1 dsieger 3156:
1.184 rillig 3157: When adding a patch that corrects a problem in the distfile (rather than e.g.
3158: enforcing pkgsrc's view of where man pages should go), send the patch as a bug
3159: report to the maintainer. This benefits non-pkgsrc users of the package, and
3160: usually makes it possible to remove the patch in future version.
1.1 dsieger 3161:
1.184 rillig 3162: The file names of the patch files are usually of the form patch-
3163: path_to_file__with__underscores.c. Many packages still use the previous
3164: convention patch-[a-z][a-z], but new patches should be of the form containing
3165: the filename. mkpatches included in pkgtools/pkgdiff takes care of the name
3166: automatically.
1.1 dsieger 3167:
1.222 gutterid 3168: When updating pre-existing patch files, if a file uses the old patch-[a-z][a-z]
3169: convention, it's best not to change it to the new form, as that will just cause
3170: churn that makes it harder to track changes to patching over time. Similarly,
3171: if a patch now applies at different line offsets, but still applies cleanly
3172: as-is, there's no need to update it, as that also unnecessarily complicates the
3173: patch history.
3174:
1.184 rillig 3175: 12.3.3. Sources where the patch files come from
1.1 dsieger 3176:
1.184 rillig 3177: If you want to share patches between multiple packages in pkgsrc, e.g. because
3178: they use the same distfiles, set PATCHDIR to the path where the patch files can
3179: be found, e.g.:
1.1 dsieger 3180:
1.184 rillig 3181: PATCHDIR= ../../editors/xemacs/patches
1.1 dsieger 3182:
1.184 rillig 3183: Patch files that are distributed by the author or other maintainers can be
3184: listed in PATCHFILES.
1.1 dsieger 3185:
1.184 rillig 3186: If it is desired to store any patches that should not be committed into pkgsrc,
3187: they can be kept outside the pkgsrc tree in the $LOCALPATCHES directory. The
3188: directory tree there is expected to have the same "category/package" structure
3189: as pkgsrc, and patches are expected to be stored inside these dirs (also known
3190: as $LOCALPATCHES/$PKGPATH). For example, if you want to keep a private patch
3191: for pkgsrc/graphics/png, keep it in $LOCALPATCHES/graphics/png/mypatch. All
3192: files in the named directory are expected to be patch files, and they are
3193: applied after pkgsrc patches are applied.
1.1 dsieger 3194:
1.184 rillig 3195: 12.3.4. Patching guidelines
1.1 dsieger 3196:
1.184 rillig 3197: When fixing a portability issue in the code do not use preprocessor magic to
3198: check for the current operating system nor platform. Doing so hurts portability
3199: to other platforms because the OS-specific details are not abstracted
3200: appropriately.
1.1 dsieger 3201:
1.184 rillig 3202: The general rule to follow is: instead of checking for the operating system the
3203: application is being built on, check for the specific features you need. For
3204: example, instead of assuming that kqueue is available under NetBSD and using
3205: the __NetBSD__ macro to conditionalize kqueue support, add a check that detects
1.198 leot 3206: kqueue itself -- yes, this generally involves patching the configure script.
1.184 rillig 3207: There is absolutely nothing that prevents some OSes from adopting interfaces
3208: from other OSes (e.g. Linux implementing kqueue), something that the above
3209: checks cannot take into account.
1.1 dsieger 3210:
1.184 rillig 3211: Of course, checking for features generally involves more work on the
3212: developer's side, but the resulting changes are cleaner and there are chances
3213: they will work on many other platforms. Not to mention that there are higher
3214: chances of being later integrated into the mainstream sources. Remember: It
3215: doesn't work unless it is right!
1.1 dsieger 3216:
1.184 rillig 3217: Some typical examples:
1.121 sevan 3218:
1.184 rillig 3219: Table 12.1. Patching examples
1.1 dsieger 3220:
1.184 rillig 3221: +-------------------------------------------------------------------------------------------+
3222: | Where | Incorrect | Correct |
3223: |---------+--------------------------+------------------------------------------------------|
3224: | |case ${target_os} in | |
3225: |configure|netbsd*) have_kvm=yes ;; |AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)|
3226: |script |*) have_kvm=no ;; | |
3227: | |esac | |
3228: |---------+--------------------------+------------------------------------------------------|
3229: |C source |#if defined(__NetBSD__) |#if defined(HAVE_SYS_EVENT_H) |
3230: |file |# include <sys/event.h> |# include <sys/event.h> |
3231: | |#endif |#endif |
3232: |---------+--------------------------+------------------------------------------------------|
3233: | |int |int |
3234: | |monitor_file(...) |monitor_file(...) |
3235: | |{ |{ |
3236: | |#if defined(__NetBSD__) |#if defined(HAVE_KQUEUE) |
3237: |C source | int fd = kqueue();| int fd = kqueue(); |
3238: |file | ... | ... |
3239: | |#else |#else |
3240: | | ... | ... |
3241: | |#endif |#endif |
3242: | |} |} |
3243: +-------------------------------------------------------------------------------------------+
1.1 dsieger 3244:
3245:
1.184 rillig 3246: 12.3.5. Feedback to the author
1.1 dsieger 3247:
1.184 rillig 3248: Always, always, always feed back any portability fixes or improvements you do
3249: to a package to the mainstream developers. This is the only way to get their
3250: attention on portability issues and to ensure that future versions can be built
3251: out-of-the box on NetBSD. Furthermore, any user that gets newer distfiles will
3252: get the fixes straight from the packaged code.
1.1 dsieger 3253:
1.184 rillig 3254: This generally involves cleaning up the patches (because sometimes the patches
3255: that are added to pkgsrc are quick hacks), filing bug reports in the
3256: appropriate trackers for the projects and working with the mainstream authors
3257: to accept your changes. It is extremely important that you do it so that the
3258: packages in pkgsrc are kept simple and thus further changes can be done without
3259: much hassle.
1.1 dsieger 3260:
1.184 rillig 3261: When you have done this, please add a URL to the upstream bug report to the
3262: patch comment.
1.1 dsieger 3263:
1.184 rillig 3264: Support the idea of free software!
1.1 dsieger 3265:
1.184 rillig 3266: 12.4. Other mandatory files
1.1 dsieger 3267:
1.184 rillig 3268: DESCR
1.1 dsieger 3269:
1.184 rillig 3270: A multi-line description of the piece of software. This should include any
3271: credits where they are due. Please bear in mind that others do not share
3272: your sense of humour (or spelling idiosyncrasies), and that others will
3273: read everything that you write here.
1.1 dsieger 3274:
1.184 rillig 3275: PLIST
1.1 dsieger 3276:
1.184 rillig 3277: This file governs the files that are installed on your system: all the
3278: binaries, manual pages, etc. There are other directives which may be
3279: entered in this file, to control the creation and deletion of directories,
3280: and the location of inserted files. See Chapter 19, PLIST issues for more
3281: information.
1.1 dsieger 3282:
1.184 rillig 3283: 12.5. Optional files
1.1 dsieger 3284:
1.184 rillig 3285: 12.5.1. Files affecting the binary package
1.1 dsieger 3286:
1.184 rillig 3287: INSTALL
1.1 dsieger 3288:
1.184 rillig 3289: This shell script is invoked twice by pkg_add(1). First time after package
3290: extraction and before files are moved in place, the second time after the
3291: files to install are moved in place. This can be used to do any custom
3292: procedures not possible with @exec commands in PLIST. See pkg_add(1) and
3293: pkg_create(1) for more information. See also Section 20.1, "Files and
3294: directories outside the installation prefix". Please note that you can
3295: modify variables in it easily by using FILES_SUBST in the package's
3296: Makefile:
1.1 dsieger 3297:
1.184 rillig 3298: FILES_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 3299:
1.184 rillig 3300: replaces "@SOMEVAR@" with "somevalue" in the INSTALL. By default,
3301: substitution is performed for PREFIX, LOCALBASE, X11BASE, VARBASE, and a
3302: few others, type make help topic=FILES_SUBST for a complete list.
1.1 dsieger 3303:
1.184 rillig 3304: DEINSTALL
1.1 dsieger 3305:
1.184 rillig 3306: This script is executed before and after any files are removed. It is this
3307: script's responsibility to clean up any additional messy details around the
3308: package's installation, since all pkg_delete knows is how to delete the
3309: files created in the original distribution. See pkg_delete(1) and
3310: pkg_create(1) for more information. The same methods to replace variables
3311: can be used as for the INSTALL file.
1.1 dsieger 3312:
1.184 rillig 3313: MESSAGE
1.1 dsieger 3314:
1.198 leot 3315: This file is displayed after installation of the package. While this was
3316: used often in the past, it has two problems: the display will be missed if
3317: many packages are intalled at once, and the person installing the package
3318: and the one using or configuring it may be different. It should therefore
3319: be used only in exceptional circumstances where lasting negative
3320: consequences would result from someone not reading it.
3321:
3322: MESSAGE should not be used for:
3323:
3324: + exhortations to read the documentation
3325:
3326: + reminders to install rc.d files and set variables
3327:
3328: + anything that should be explained in the installation/configuration
3329: documentation that should come with the package
3330:
3331: If the documentation provided by upstream needs enhancing, create e.g.
3332: files/README.pkgsrc and install it in the package's documentation
3333: directory.
3334:
3335: Note that MESSAGE is shown for all operating systems and all init systems.
3336: If a MESSAGE is necessary, it should be narrowed to only those operating
3337: systems and init systems to which it applies.
3338:
3339: Note that you can modify variables in it easily by using MESSAGE_SUBST in
3340: the package's Makefile:
1.1 dsieger 3341:
1.184 rillig 3342: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 3343:
1.184 rillig 3344: replaces "${SOMEVAR}" with "somevalue" in MESSAGE. By default, substitution
3345: is performed for PKGNAME, PKGBASE, PREFIX, LOCALBASE, X11BASE,
3346: PKG_SYSCONFDIR, ROOT_GROUP, and ROOT_USER.
1.1 dsieger 3347:
1.184 rillig 3348: You can display a different or additional files by setting the MESSAGE_SRC
3349: variable. Its default is MESSAGE, if the file exists.
1.1 dsieger 3350:
1.184 rillig 3351: ALTERNATIVES
1.1 dsieger 3352:
1.184 rillig 3353: This file is used by the alternatives framework. It creates, configures,
3354: and destroys generic wrappers used to run programs with similar interfaces.
3355: See pkg_alternatives(8) from pkgtools/pkg_alternatives for more
3356: information.
1.1 dsieger 3357:
1.184 rillig 3358: Each line of the file contains two filenames, first the wrapper and then
3359: the alternative provided by the package. Both paths are relative to PREFIX.
1.1 dsieger 3360:
1.184 rillig 3361: 12.5.2. Files affecting the build process
1.1 dsieger 3362:
1.184 rillig 3363: Makefile.common
1.1 dsieger 3364:
1.184 rillig 3365: This file contains arbitrary things that could also go into a Makefile, but
3366: its purpose is to be used by more than one package. This file should only
3367: be used when the packages that will use the file are known in advance. For
3368: other purposes it is often better to write a *.mk file and give it a good
3369: name that describes what it does.
1.1 dsieger 3370:
1.184 rillig 3371: buildlink3.mk
1.1 dsieger 3372:
1.184 rillig 3373: This file contains the dependency information for the buildlink3 framework
3374: (see Chapter 18, Buildlink methodology).
1.1 dsieger 3375:
1.184 rillig 3376: hacks.mk
1.1 dsieger 3377:
1.184 rillig 3378: This file contains workarounds for compiler bugs and similar things. It is
3379: included automatically by the pkgsrc infrastructure, so you don't need an
3380: extra .include line for it.
1.1 dsieger 3381:
1.184 rillig 3382: options.mk
1.1 dsieger 3383:
1.184 rillig 3384: This file contains the code for the package-specific options (see
3385: Chapter 16, Options handling) that can be selected by the user. If a
3386: package has only one or two options, it is equally acceptable to put the
3387: code directly into the Makefile.
1.1 dsieger 3388:
1.184 rillig 3389: 12.5.3. Files affecting nothing at all
1.1 dsieger 3390:
1.184 rillig 3391: README*
1.1 dsieger 3392:
1.184 rillig 3393: These files do not take place in the creation of a package and thus are
3394: purely informative to the package developer.
1.1 dsieger 3395:
1.184 rillig 3396: TODO
1.1 dsieger 3397:
1.184 rillig 3398: This file contains things that need to be done to make the package even
3399: better.
1.1 dsieger 3400:
1.184 rillig 3401: 12.6. work*
1.1 dsieger 3402:
1.184 rillig 3403: When you type make, the distribution files are unpacked into the directory
3404: denoted by WRKDIR. It can be removed by running make clean. Besides the
3405: sources, this directory is also used to keep various timestamp files. The
3406: directory gets removed completely on clean. The default is ${.CURDIR}/work or $
3407: {.CURDIR}/work.${MACHINE_ARCH} if OBJMACHINE is set.
1.1 dsieger 3408:
1.184 rillig 3409: 12.7. files/*
1.80 wiz 3410:
1.184 rillig 3411: If you have any files that you wish to be placed in the package prior to
3412: configuration or building, you can place these files here and use a ${CP}
3413: command in the "post-extract" target to achieve this.
1.1 dsieger 3414:
1.184 rillig 3415: If you want to share files in this way with other packages, set the FILESDIR
3416: variable to point to the other package's files directory, e.g.:
1.1 dsieger 3417:
1.184 rillig 3418: FILESDIR= ../../editors/xemacs/files
1.14 jmcneill 3419:
1.184 rillig 3420: Chapter 13. The build process
1.1 dsieger 3421:
1.184 rillig 3422: Table of Contents
1.1 dsieger 3423:
1.184 rillig 3424: 13.1. Introduction
3425: 13.2. Program location
3426: 13.3. Directories used during the build process
3427: 13.4. Running a phase
3428: 13.5. The fetch phase
3429:
3430: 13.5.1. What to fetch and where to get it from
3431: 13.5.2. How are the files fetched?
3432:
3433: 13.6. The checksum phase
3434: 13.7. The extract phase
3435: 13.8. The patch phase
3436: 13.9. The tools phase
3437: 13.10. The wrapper phase
3438: 13.11. The configure phase
3439: 13.12. The build phase
3440: 13.13. The test phase
3441: 13.14. The install phase
3442: 13.15. The package phase
3443: 13.16. Cleaning up
3444: 13.17. Other helpful targets
1.1 dsieger 3445:
1.184 rillig 3446: 13.1. Introduction
1.122 leot 3447:
1.184 rillig 3448: This chapter gives a detailed description on how a package is built. Building a
3449: package is separated into different phases (for example fetch, build, install),
3450: all of which are described in the following sections. Each phase is split into
3451: so-called stages, which take the name of the containing phase, prefixed by one
3452: of pre-, do- or post-. (Examples are pre-configure, post-build.) Most of the
3453: actual work is done in the do-* stages.
1.1 dsieger 3454:
1.184 rillig 3455: Never override the regular targets (like fetch), if you have to, override the
3456: do-* ones instead.
1.1 dsieger 3457:
1.184 rillig 3458: The basic steps for building a program are always the same. First the program's
3459: source (distfile) must be brought to the local system and then extracted. After
3460: any pkgsrc-specific patches to compile properly are applied, the software can
3461: be configured, then built (usually by compiling), and finally the generated
3462: binaries, etc. can be put into place on the system.
1.1 dsieger 3463:
1.184 rillig 3464: To get more details about what is happening at each step, you can set the
3465: PKG_VERBOSE variable, or the PATCH_DEBUG variable if you are just interested in
3466: more details about the patch step.
1.1 dsieger 3467:
1.184 rillig 3468: 13.2. Program location
1.1 dsieger 3469:
1.184 rillig 3470: Before outlining the process performed by the NetBSD package system in the next
3471: section, here's a brief discussion on where programs are installed, and which
3472: variables influence this.
1.1 dsieger 3473:
1.184 rillig 3474: The automatic variable PREFIX indicates where all files of the final program
3475: shall be installed. It is usually set to LOCALBASE (/usr/pkg), or CROSSBASE for
3476: pkgs in the cross category. The value of PREFIX needs to be put into the
3477: various places in the program's source where paths to these files are encoded.
3478: See Section 12.3, "patches/*" and Section 21.3.1, "Shared libraries - libtool"
3479: for more details.
1.1 dsieger 3480:
1.184 rillig 3481: When choosing which of these variables to use, follow the following rules:
1.1 dsieger 3482:
1.184 rillig 3483: * PREFIX always points to the location where the current pkg will be
3484: installed. When referring to a pkg's own installation path, use "${PREFIX}"
3485: .
1.1 dsieger 3486:
1.223 nia 3487: * LOCALBASE is where all pkgs are installed. If you need to construct a -I or
3488: -L argument to the compiler to find includes and libraries installed by
3489: another pkg, use "${LOCALBASE}". The name LOCALBASE stems from FreeBSD,
3490: which installed all packages in /usr/local. As pkgsrc leaves /usr/local for
3491: the system administrator, this variable is a misnomer.
1.1 dsieger 3492:
1.184 rillig 3493: * X11BASE is where the actual X11 distribution (from xsrc, etc.) is
3494: installed. When looking for standard X11 includes (not those installed by a
3495: package), use "${X11BASE}".
1.1 dsieger 3496:
1.184 rillig 3497: * X11-based packages using imake must set USE_IMAKE to be installed correctly
3498: under LOCALBASE.
1.1 dsieger 3499:
1.184 rillig 3500: * Within ${PREFIX}, packages should install files according to hier(7), with
3501: the exception that manual pages go into ${PREFIX}/man, not ${PREFIX}/share/
3502: man.
1.1 dsieger 3503:
1.184 rillig 3504: 13.3. Directories used during the build process
1.2 rillig 3505:
1.184 rillig 3506: When building a package, various directories are used to store source files,
3507: temporary files, pkgsrc-internal files, and so on. These directories are
3508: explained here.
1.1 dsieger 3509:
1.184 rillig 3510: Some of the directory variables contain relative pathnames. There are two
3511: common base directories for these relative directories: PKGSRCDIR/PKGPATH is
3512: used for directories that are pkgsrc-specific. WRKSRC is used for directories
3513: inside the package itself.
1.1 dsieger 3514:
1.184 rillig 3515: PKGSRCDIR
1.1 dsieger 3516:
1.184 rillig 3517: This is an absolute pathname that points to the pkgsrc root directory.
3518: Generally, you don't need it.
1.1 dsieger 3519:
1.184 rillig 3520: PKGDIR
1.1 dsieger 3521:
1.184 rillig 3522: This is an absolute pathname that points to the current package.
1.1 dsieger 3523:
1.184 rillig 3524: PKGPATH
1.1 dsieger 3525:
1.184 rillig 3526: This is a pathname relative to PKGSRCDIR that points to the current
1.228 gutterid 3527: package. It is defined after including bsd.prefs.mk and can be used in
3528: makefile fragments that are used by several packages to distinguish between
3529: these packages. Other variables that would serve the same purpose are
3530: PKGBASE and PKGNAME, but these are only defined after including bsd.pkg.mk,
3531: which is too late.
3532:
3533: In mk.conf, the pkgsrc user can use PKGPATH to tweak variables like
3534: MAKE_JOBS and CFLAGS.
1.1 dsieger 3535:
1.184 rillig 3536: WRKDIR
1.1 dsieger 3537:
1.184 rillig 3538: This is an absolute pathname pointing to the directory where all work takes
3539: place. The distfiles are extracted to this directory. It also contains
3540: temporary directories and log files used by the various pkgsrc frameworks,
3541: like buildlink or the wrappers.
1.1 dsieger 3542:
1.184 rillig 3543: WRKSRC
1.1 dsieger 3544:
1.184 rillig 3545: This is an absolute pathname pointing to the directory where the distfiles
3546: are extracted. It is usually a direct subdirectory of WRKDIR, and often
3547: it's the only directory entry that isn't hidden. This variable may be
3548: changed by a package Makefile.
1.1 dsieger 3549:
1.184 rillig 3550: The CREATE_WRKDIR_SYMLINK definition takes either the value yes or no and
3551: defaults to no. It indicates whether a symbolic link to the WRKDIR is to be
3552: created in the pkgsrc entry's directory. If users would like to have their
3553: pkgsrc trees behave in a read-only manner, then the value of
3554: CREATE_WRKDIR_SYMLINK should be set to no.
1.1 dsieger 3555:
1.184 rillig 3556: 13.4. Running a phase
1.1 dsieger 3557:
1.184 rillig 3558: You can run a particular phase by typing make phase, where phase is the name of
3559: the phase. This will automatically run all phases that are required for this
3560: phase. The default phase is build, that is, when you run make without
3561: parameters in a package directory, the package will be built, but not
3562: installed.
1.1 dsieger 3563:
1.184 rillig 3564: 13.5. The fetch phase
1.1 dsieger 3565:
1.184 rillig 3566: The first step in building a package is to fetch the distribution files
3567: (distfiles) from the sites that are providing them. This is the task of the
3568: fetch phase.
1.25 wiz 3569:
1.184 rillig 3570: 13.5.1. What to fetch and where to get it from
1.1 dsieger 3571:
1.184 rillig 3572: In simple cases, MASTER_SITES defines all URLs from where the distfile, whose
3573: name is derived from the DISTNAME variable, is fetched. The more complicated
3574: cases are described below.
1.1 dsieger 3575:
1.184 rillig 3576: The variable DISTFILES specifies the list of distfiles that have to be fetched.
3577: Its value defaults to ${DEFAULT_DISTFILES} and its value is ${DISTNAME}$
3578: {EXTRACT_SUFX}, so that most packages don't need to define it at all.
3579: EXTRACT_SUFX is .tar.gz by default, but can be changed freely. Note that if
3580: your package requires additional distfiles to the default one, you cannot just
3581: append the additional filenames using the += operator, but you have write for
3582: example:
1.1 dsieger 3583:
1.184 rillig 3584: DISTFILES= ${DEFAULT_DISTFILES} additional-files.tar.gz
1.1 dsieger 3585:
1.184 rillig 3586: Each distfile is fetched from a list of sites, usually MASTER_SITES. If the
3587: package has multiple DISTFILES or multiple PATCHFILES from different sites, you
3588: can set SITES.distfile to the list of URLs where the file distfile (including
3589: the suffix) can be found.
1.1 dsieger 3590:
1.184 rillig 3591: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
3592: DISTFILES+= foo-file.tar.gz
3593: SITES.foo-file.tar.gz= \
3594: https://www.somewhere.com/somehow/ \
3595: https://www.somewhereelse.com/mirror/somehow/
1.1 dsieger 3596:
1.184 rillig 3597: When actually fetching the distfiles, each item from MASTER_SITES or SITES.*
3598: gets the name of each distfile appended to it, without an intermediate slash.
3599: Therefore, all site values have to end with a slash or other separator
3600: character. This allows for example to set MASTER_SITES to a URL of a CGI script
3601: that gets the name of the distfile as a parameter. In this case, the definition
3602: would look like:
1.1 dsieger 3603:
1.184 rillig 3604: MASTER_SITES= https://www.example.com/download.cgi?file=
1.1 dsieger 3605:
1.184 rillig 3606: The exception to this rule are URLs starting with a dash. In that case the URL
3607: is taken as is, fetched and the result stored under the name of the distfile.
3608: You can use this style for the case when the download URL style does not match
3609: the above common case. For example, if permanent download URL is a redirector
3610: to the real download URL, or the download file name is offered by an HTTP
3611: Content-Disposition header. In the following example, foo-1.0.0.tar.gz will be
3612: created instead of the default v1.0.0.tar.gz.
1.1 dsieger 3613:
1.184 rillig 3614: DISTNAME= foo-1.0.0
3615: MASTER_SITES= -https://www.example.com/archive/v1.0.0.tar.gz
1.29 wiz 3616:
1.184 rillig 3617: There are some predefined values for MASTER_SITES, which can be used in
3618: packages. The names of the variables should speak for themselves.
1.29 wiz 3619:
1.225 gutterid 3620: MASTER_SITE_APACHE MASTER_SITE_BACKUP
3621: MASTER_SITE_CRATESIO MASTER_SITE_CYGWIN
3622: MASTER_SITE_DEBIAN MASTER_SITE_FREEBSD
3623: MASTER_SITE_FREEBSD_LOCAL MASTER_SITE_GENTOO
3624: MASTER_SITE_GITHUB MASTER_SITE_GITLAB
3625: MASTER_SITE_GNOME MASTER_SITE_GNU
3626: MASTER_SITE_GNUSTEP MASTER_SITE_HASKELL_HACKAGE
3627: MASTER_SITE_IFARCHIVE MASTER_SITE_KDE
3628: MASTER_SITE_MOZILLA MASTER_SITE_MOZILLA_ALL
3629: MASTER_SITE_MYSQL MASTER_SITE_NETLIB
3630: MASTER_SITE_OPENBSD MASTER_SITE_OPENOFFICE
3631: MASTER_SITE_OSDN MASTER_SITE_PERL_CPAN
3632: MASTER_SITE_PGSQL MASTER_SITE_PYPI
3633: MASTER_SITE_RUBYGEMS MASTER_SITE_R_CRAN
3634: MASTER_SITE_SOURCEFORGE MASTER_SITE_SUNSITE
3635: MASTER_SITE_SUSE MASTER_SITE_TEX_CTAN
3636: MASTER_SITE_XCONTRIB MASTER_SITE_XEMACS
3637: MASTER_SITE_XORG
1.1 dsieger 3638:
1.184 rillig 3639: Some explanations for the less self-explaining ones: MASTER_SITE_BACKUP
3640: contains backup sites for packages that are maintained in ftp://ftp.NetBSD.org/
3641: pub/pkgsrc/distfiles/${DIST_SUBDIR}. MASTER_SITE_LOCAL contains local package
3642: source distributions that are maintained in ftp://ftp.NetBSD.org/pub/pkgsrc/
3643: distfiles/LOCAL_PORTS/.
1.1 dsieger 3644:
1.184 rillig 3645: If you choose one of these predefined sites, you may want to specify a
3646: subdirectory of that site. Since these macros may expand to more than one
3647: actual site, you must use the following construct to specify a subdirectory:
1.1 dsieger 3648:
1.184 rillig 3649: MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/}
3650: MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.1 dsieger 3651:
1.184 rillig 3652: Note the trailing slash after the subdirectory name.
1.1 dsieger 3653:
1.184 rillig 3654: 13.5.2. How are the files fetched?
1.1 dsieger 3655:
1.184 rillig 3656: The fetch phase makes sure that all the distfiles exist in a local directory
3657: (DISTDIR, which can be set by the pkgsrc user). If the files do not exist, they
3658: are fetched using commands of the form
1.1 dsieger 3659:
1.184 rillig 3660: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1 dsieger 3661:
1.184 rillig 3662: where ${site} varies through several possibilities in turn: first,
3663: MASTER_SITE_OVERRIDE is tried, then the sites specified in either SITES.file if
3664: defined, else MASTER_SITES or PATCH_SITES, as applies, then finally the value
3665: of MASTER_SITE_BACKUP. The order of all except the first and the last can be
3666: optionally sorted by the user, via setting either MASTER_SORT_RANDOM, and
3667: MASTER_SORT_AWK or MASTER_SORT_REGEX.
1.1 dsieger 3668:
1.184 rillig 3669: The specific command and arguments used depend on the FETCH_USING parameter.
3670: The example above is for FETCH_USING=custom.
1.66 asau 3671:
1.184 rillig 3672: The distfiles mirror run by the NetBSD Foundation uses the mirror-distfiles
3673: target to mirror the distfiles, if they are freely distributable. Packages
3674: setting NO_SRC_ON_FTP (usually to "${RESTRICTED}") will not have their
3675: distfiles mirrored.
1.1 dsieger 3676:
1.184 rillig 3677: 13.6. The checksum phase
1.1 dsieger 3678:
1.184 rillig 3679: After the distfile(s) are fetched, their checksum is generated and compared
3680: with the checksums stored in the distinfo file. If the checksums don't match,
3681: the build is aborted. This is to ensure the same distfile is used for building,
3682: and that the distfile wasn't changed, e.g. by some malign force, deliberately
3683: changed distfiles on the master distribution site or network lossage.
1.1 dsieger 3684:
1.184 rillig 3685: 13.7. The extract phase
1.1 dsieger 3686:
1.184 rillig 3687: When the distfiles are present on the local system, they need to be extracted,
3688: as they usually come in the form of some compressed archive format.
1.1 dsieger 3689:
1.184 rillig 3690: By default, all DISTFILES are extracted. If you only need some of them, you can
3691: set the EXTRACT_ONLY variable to the list of those files.
1.1 dsieger 3692:
1.184 rillig 3693: Extracting the files is usually done by a little program, mk/extract/extract,
3694: which already knows how to extract various archive formats, so most likely you
3695: will not need to change anything here. But if you need, the following variables
3696: may help you:
1.1 dsieger 3697:
1.184 rillig 3698: EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}
1.1 dsieger 3699:
1.184 rillig 3700: Use these variables to override the default options for an extract command,
3701: which are defined in mk/extract/extract.
1.1 dsieger 3702:
1.184 rillig 3703: EXTRACT_USING
1.1 dsieger 3704:
1.184 rillig 3705: This variable can be set to bsdtar, gtar, nbtar (which is the default
3706: value), pax, or an absolute pathname pointing to the command with which tar
3707: archives should be extracted. It is preferred to choose bsdtar over gtar if
3708: NetBSD's pax-as-tar is not good enough.
1.1 dsieger 3709:
1.184 rillig 3710: If the extract program doesn't serve your needs, you can also override the
3711: EXTRACT_CMD variable, which holds the command used for extracting the files.
3712: This command is executed in the ${WRKSRC} directory. During execution of this
3713: command, the shell variable extract_file holds the absolute pathname of the
3714: file that is going to be extracted.
1.1 dsieger 3715:
1.184 rillig 3716: And if that still does not suffice, you can override the do-extract target in
3717: the package Makefile.
1.1 dsieger 3718:
1.184 rillig 3719: 13.8. The patch phase
1.1 dsieger 3720:
1.184 rillig 3721: After extraction, all the patches named by the PATCHFILES, those present in the
3722: patches subdirectory of the package as well as in $LOCALPATCHES/$PKGPATH (e.g.
3723: /usr/local/patches/graphics/png) are applied. Patchfiles ending in .Z or .gz
3724: are uncompressed before they are applied, files ending in .orig or .rej are
3725: ignored. Any special options to patch(1) can be handed in PATCH_DIST_ARGS. See
3726: Section 12.3, "patches/*" for more details.
1.1 dsieger 3727:
1.184 rillig 3728: By default patch(1) is given special arguments to make it fail if the expected
3729: text from the patch context is not found in the patched file. If that happens,
3730: fix the patch file by comparing it with the actual text in the file to be
3731: patched.
1.1 dsieger 3732:
1.184 rillig 3733: 13.9. The tools phase
1.1 dsieger 3734:
1.184 rillig 3735: This is covered in Chapter 17, Tools needed for building or running.
1.1 dsieger 3736:
1.184 rillig 3737: 13.10. The wrapper phase
1.1 dsieger 3738:
1.184 rillig 3739: This phase creates wrapper programs for the compilers and linkers. The
3740: following variables can be used to tweak the wrappers.
1.1 dsieger 3741:
1.184 rillig 3742: ECHO_WRAPPER_MSG
1.1 dsieger 3743:
1.184 rillig 3744: The command used to print progress messages. Does nothing by default. Set
3745: to ${ECHO} to see the progress messages.
1.1 dsieger 3746:
1.184 rillig 3747: WRAPPER_DEBUG
1.1 dsieger 3748:
1.184 rillig 3749: This variable can be set to yes (default) or no, depending on whether you
3750: want additional information in the wrapper log file.
1.1 dsieger 3751:
1.184 rillig 3752: WRAPPER_UPDATE_CACHE
1.1 dsieger 3753:
1.184 rillig 3754: This variable can be set to yes or no, depending on whether the wrapper
3755: should use its cache, which will improve the speed. The default value is
3756: yes, but is forced to no if the platform does not support it.
1.1 dsieger 3757:
1.184 rillig 3758: WRAPPER_REORDER_CMDS
1.1 dsieger 3759:
1.184 rillig 3760: A list of reordering commands. A reordering command has the form reorder:l:
3761: lib1:lib2. It ensures that that -llib1 occurs before -llib2.
1.1 dsieger 3762:
1.184 rillig 3763: 13.11. The configure phase
1.1 dsieger 3764:
1.184 rillig 3765: Most pieces of software need information on the header files, system calls, and
3766: library routines which are available on the platform they run on. The process
3767: of determining this information is known as configuration, and is usually
3768: automated. In most cases, a script is supplied with the distfiles, and its
3769: invocation results in generation of header files, Makefiles, etc.
1.1 dsieger 3770:
1.184 rillig 3771: If the package contains a configure script, this can be invoked by setting
3772: HAS_CONFIGURE to "yes". If the configure script is a GNU autoconf script, you
1.187 rillig 3773: should set GNU_CONFIGURE to "yes" instead.
1.1 dsieger 3774:
1.187 rillig 3775: In the do-configure stage, a rough equivalent of the following command is run.
3776: See mk/configure/configure.mk, target do-configure-script for the exact
3777: definition.
3778:
3779: .for dir in ${CONFIGURE_DIRS}
3780: cd ${WRKSRC} && cd ${dir} \
3781: && env ${CONFIGURE_ENV} \
3782: ${CONFIG_SHELL} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
1.184 rillig 3783: .endfor
1.1 dsieger 3784:
1.184 rillig 3785: CONFIGURE_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In
3786: each of these directories, the configure script is run with the environment
3787: CONFIGURE_ENV and arguments CONFIGURE_ARGS. The variables CONFIGURE_ENV,
3788: CONFIGURE_SCRIPT (default: "./configure") and CONFIGURE_ARGS may all be changed
3789: by the package.
1.1 dsieger 3790:
1.184 rillig 3791: If the program uses the Perl way of configuration (mainly Perl modules, but not
3792: only), i.e. a file called Makefile.PL, it should include ../../lang/perl5/
3793: module.mk. To set any parameter for Makefile.PL use the MAKE_PARAMS variable
3794: (e.g., MAKE_PARAMS+=foo=bar
1.1 dsieger 3795:
1.184 rillig 3796: If the program uses an Imakefile for configuration, the appropriate steps can
3797: be invoked by setting USE_IMAKE to "yes". If you only need xmkmf, add it to
3798: USE_TOOLS. You can add variables to xmkmf's environment by adding them to the
3799: SCRIPTS_ENV variable.
1.1 dsieger 3800:
1.184 rillig 3801: If the program uses cmake for configuration, the appropriate steps can be
3802: invoked by setting USE_CMAKE to "yes". You can add variables to cmake's
3803: environment by adding them to the CONFIGURE_ENV variable and arguments to cmake
3804: by adding them to the CMAKE_ARGS variable. The top directory argument is given
3805: by the CMAKE_ARG_PATH variable, that defaults to "." (relative to
3806: CONFIGURE_DIRS)
1.1 dsieger 3807:
1.184 rillig 3808: If there is no configure step at all, set NO_CONFIGURE to "yes".
1.1 dsieger 3809:
1.184 rillig 3810: 13.12. The build phase
1.1 dsieger 3811:
1.187 rillig 3812: For building a package, a rough equivalent of the following code is executed;
3813: see mk/build/build.mk, target do-build for the exact definition.
1.154 rillig 3814:
1.187 rillig 3815: .for dir in ${BUILD_DIRS}
3816: cd ${WRKSRC} && cd ${dir} \
1.184 rillig 3817: && env ${MAKE_ENV} \
1.187 rillig 3818: ${MAKE_PROGRAM} ${MAKE_FLAGS} ${BUILD_MAKE_FLAGS} \
1.184 rillig 3819: -f ${MAKE_FILE} \
3820: ${BUILD_TARGET}
3821: .endfor
1.1 dsieger 3822:
1.184 rillig 3823: BUILD_DIRS (default: ".") is a list of pathnames relative to WRKSRC. In each of
3824: these directories, MAKE_PROGRAM is run with the environment MAKE_ENV and
3825: arguments BUILD_MAKE_FLAGS. The variables MAKE_ENV, BUILD_MAKE_FLAGS, MAKE_FILE
3826: and BUILD_TARGET may all be changed by the package.
1.1 dsieger 3827:
1.184 rillig 3828: The default value of MAKE_PROGRAM is "gmake" if USE_TOOLS contains "gmake", "
3829: make" otherwise. The default value of MAKE_FILE is "Makefile", and BUILD_TARGET
3830: defaults to "all".
1.1 dsieger 3831:
1.184 rillig 3832: If there is no build step at all, set NO_BUILD to "yes".
1.1 dsieger 3833:
1.184 rillig 3834: 13.13. The test phase
1.1 dsieger 3835:
1.184 rillig 3836: [TODO]
1.1 dsieger 3837:
1.184 rillig 3838: 13.14. The install phase
1.1 dsieger 3839:
1.184 rillig 3840: Once the build stage has completed, the final step is to install the software
3841: in public directories, so users can access the programs and files.
1.1 dsieger 3842:
1.187 rillig 3843: In the install phase, a rough equivalent of the following code is executed; see
3844: mk/install/install.mk, target do-install for the exact definition.
3845: Additionally, before and after this code, several consistency checks are run
3846: against the files-to-be-installed, see mk/check/*.mk for details.
3847:
3848: .for dir in ${INSTALL_DIRS}
3849: cd ${WRKSRC} && cd ${dir} \
3850: && env ${INSTALL_ENV} ${MAKE_ENV} \
3851: ${MAKE_PROGRAM} ${MAKE_FLAGS} ${INSTALL_MAKE_FLAGS} \
3852: -f ${MAKE_FILE} ${INSTALL_TARGET}
1.184 rillig 3853: .endfor
1.1 dsieger 3854:
1.184 rillig 3855: The variable's meanings are analogous to the ones in the build phase.
3856: INSTALL_DIRS defaults to BUILD_DIRS. INSTALL_TARGET is "install" by default,
3857: plus "install.man" if USE_IMAKE is defined and NO_INSTALL_MANPAGES is not
3858: defined.
1.1 dsieger 3859:
1.184 rillig 3860: In the install phase, the following variables are useful. They are all
3861: variations of the install(1) command that have the owner, group and permissions
3862: preset. INSTALL is the plain install command. The specialized variants,
3863: together with their intended use, are:
1.1 dsieger 3864:
1.184 rillig 3865: INSTALL_PROGRAM_DIR
1.1 dsieger 3866:
1.184 rillig 3867: directories that contain binaries
1.1 dsieger 3868:
1.184 rillig 3869: INSTALL_SCRIPT_DIR
1.1 dsieger 3870:
1.184 rillig 3871: directories that contain scripts
1.1 dsieger 3872:
1.184 rillig 3873: INSTALL_LIB_DIR
1.1 dsieger 3874:
1.184 rillig 3875: directories that contain shared and static libraries
1.1 dsieger 3876:
1.184 rillig 3877: INSTALL_DATA_DIR
1.108 rillig 3878:
1.184 rillig 3879: directories that contain data files
1.108 rillig 3880:
1.184 rillig 3881: INSTALL_MAN_DIR
1.108 rillig 3882:
1.184 rillig 3883: directories that contain man pages
1.108 rillig 3884:
1.184 rillig 3885: INSTALL_GAME_DIR
1.108 rillig 3886:
1.184 rillig 3887: directories that contain data files for games
1.108 rillig 3888:
1.184 rillig 3889: INSTALL_PROGRAM
1.108 rillig 3890:
1.184 rillig 3891: binaries that can be stripped from debugging symbols
1.108 rillig 3892:
1.184 rillig 3893: INSTALL_SCRIPT
1.108 rillig 3894:
1.184 rillig 3895: binaries that cannot be stripped
1.108 rillig 3896:
1.184 rillig 3897: INSTALL_GAME
1.108 rillig 3898:
1.184 rillig 3899: game binaries
1.108 rillig 3900:
1.184 rillig 3901: INSTALL_LIB
1.108 rillig 3902:
1.184 rillig 3903: shared and static libraries
1.108 rillig 3904:
1.184 rillig 3905: INSTALL_DATA
1.108 rillig 3906:
1.184 rillig 3907: data files
1.1 dsieger 3908:
1.184 rillig 3909: INSTALL_GAME_DATA
1.1 dsieger 3910:
1.184 rillig 3911: data files for games
1.108 rillig 3912:
1.184 rillig 3913: INSTALL_MAN
1.108 rillig 3914:
1.184 rillig 3915: man pages
1.1 dsieger 3916:
1.184 rillig 3917: Some other variables are:
1.1 dsieger 3918:
1.184 rillig 3919: INSTALL_UNSTRIPPED
1.1 dsieger 3920:
1.184 rillig 3921: If set to yes, do not run strip(1) when installing binaries. Any debugging
3922: sections and symbols present in binaries will be preserved.
1.1 dsieger 3923:
1.184 rillig 3924: INSTALLATION_DIRS
1.1 dsieger 3925:
1.184 rillig 3926: A list of directories relative to PREFIX that are created by pkgsrc at the
3927: beginning of the install phase. The package is supposed to create all
3928: needed directories itself before installing files to it and list all other
3929: directories here.
1.1 dsieger 3930:
1.184 rillig 3931: In the rare cases that a package shouldn't install anything, set NO_INSTALL to
3932: "yes". This is mostly relevant for packages in the regress category.
1.1 dsieger 3933:
1.184 rillig 3934: 13.15. The package phase
1.121 sevan 3935:
1.184 rillig 3936: Once the install stage has completed, a binary package of the installed files
3937: can be built. These binary packages can be used for quick installation without
3938: previous compilation, e.g. by the make bin-install or by using pkg_add.
1.1 dsieger 3939:
1.184 rillig 3940: By default, the binary packages are created in ${PACKAGES}/All and symlinks are
3941: created in ${PACKAGES}/category, one for each category in the CATEGORIES
3942: variable. PACKAGES defaults to pkgsrc/packages.
1.1 dsieger 3943:
1.184 rillig 3944: 13.16. Cleaning up
1.1 dsieger 3945:
1.184 rillig 3946: Once you're finished with a package, you can clean the work directory by
3947: running make clean. If you want to clean the work directories of all
3948: dependencies too, use make clean-depends.
1.1 dsieger 3949:
1.184 rillig 3950: 13.17. Other helpful targets
1.1 dsieger 3951:
1.184 rillig 3952: pre/post-*
1.1 dsieger 3953:
1.184 rillig 3954: For any of the main targets described in the previous section (configure,
3955: build, install, etc.), two auxiliary targets exist with "pre-" and "post-"
3956: used as a prefix for the main target's name. These targets are invoked
3957: before and after the main target is called, allowing extra configuration or
3958: installation steps be performed from a package's Makefile, for example,
3959: which a program's configure script or install target omitted.
3960:
3961: About 5% of the pkgsrc packages define their custom post-extract target,
3962: another 5% define pre-configure, and 10% define post-install. The other pre
3963: /post-* targets are defined even less often.
1.1 dsieger 3964:
1.184 rillig 3965: do-*
1.182 leot 3966:
1.184 rillig 3967: Should one of the main targets do the wrong thing, and should there be no
3968: variable to fix this, you can redefine it with the do-* target. (Note that
3969: redefining the target itself instead of the do-* target is a bad idea, as
3970: the pre-* and post-* targets won't be called anymore, etc.)
1.1 dsieger 3971:
1.184 rillig 3972: About 15% of the pkgsrc packages override the default do-install, the other
3973: do-* targets are overridden even less often.
1.1 dsieger 3974:
1.184 rillig 3975: reinstall
1.1 dsieger 3976:
1.184 rillig 3977: If you did a make install and you noticed some file was not installed
3978: properly, you can repeat the installation with this target, which will
3979: ignore the "already installed" flag.
1.1 dsieger 3980:
1.184 rillig 3981: This is the default value of DEPENDS_TARGET except in the case of make
3982: update and make package, where the defaults are "package" and "update",
3983: respectively.
1.1 dsieger 3984:
1.184 rillig 3985: deinstall
1.1 dsieger 3986:
1.184 rillig 3987: This target does a pkg_delete(1) in the current directory, effectively
3988: de-installing the package. The following variables can be used to tune the
3989: behaviour:
1.1 dsieger 3990:
1.184 rillig 3991: PKG_VERBOSE
1.1 dsieger 3992:
1.184 rillig 3993: Add a "-v" to the pkg_delete(1) command.
1.1 dsieger 3994:
1.184 rillig 3995: DEINSTALLDEPENDS
1.1 dsieger 3996:
1.184 rillig 3997: Remove all packages that require (depend on) the given package. This
3998: can be used to remove any packages that may have been pulled in by a
3999: given package, e.g. if make deinstall DEINSTALLDEPENDS=1 is done in
4000: pkgsrc/x11/kde, this is likely to remove whole KDE. Works by adding "-R
4001: " to the pkg_delete(1) command line.
1.1 dsieger 4002:
1.184 rillig 4003: bin-install
1.1 dsieger 4004:
1.184 rillig 4005: Install a binary package from local disk and via FTP from a list of sites
4006: (see the BINPKG_SITES variable), and do a make package if no binary package
4007: is available anywhere. The arguments given to pkg_add can be set via
4008: BIN_INSTALL_FLAGS e.g., to do verbose operation, etc.
1.1 dsieger 4009:
1.184 rillig 4010: install-clean
1.1 dsieger 4011:
1.184 rillig 4012: This target removes the state files for the "install" and later phases so
4013: that the "install" target may be re-invoked. This can be used after editing
4014: the PLIST to install the package without rebuilding it.
1.1 dsieger 4015:
1.184 rillig 4016: build-clean
1.18 mishka 4017:
1.184 rillig 4018: This target removes the state files for the "build" and later phases so
4019: that the "build" target may be re-invoked.
1.18 mishka 4020:
1.184 rillig 4021: update
1.18 mishka 4022:
1.184 rillig 4023: This target causes the current package to be updated to the latest version.
4024: The package and all depending packages first get de-installed, then current
4025: versions of the corresponding packages get compiled and installed. This is
4026: similar to manually noting which packages are currently installed, then
4027: performing a series of make deinstall and make install (or whatever
4028: UPDATE_TARGET is set to) for these packages.
1.18 mishka 4029:
1.184 rillig 4030: You can use the "update" target to resume package updating in case a
4031: previous make update was interrupted for some reason. However, in this
4032: case, make sure you don't call make clean or otherwise remove the list of
4033: dependent packages in WRKDIR. Otherwise, you lose the ability to
4034: automatically update the current package along with the dependent packages
4035: you have installed.
1.121 sevan 4036:
1.184 rillig 4037: Resuming an interrupted make update will only work as long as the package
4038: tree remains unchanged. If the source code for one of the packages to be
4039: updated has been changed, resuming make update will most certainly fail!
1.1 dsieger 4040:
1.184 rillig 4041: The following variables can be used either on the command line or in
4042: mk.conf to alter the behaviour of make update:
1.1 dsieger 4043:
1.184 rillig 4044: UPDATE_TARGET
1.1 dsieger 4045:
1.184 rillig 4046: Install target to recursively use for the updated package and the
4047: dependent packages. Defaults to DEPENDS_TARGET if set, "install"
4048: otherwise for make update. Other good targets are "package" or "
4049: bin-install". Do not set this to "update" or you will get stuck in an
4050: endless loop!
1.1 dsieger 4051:
1.184 rillig 4052: NOCLEAN
1.1 dsieger 4053:
1.184 rillig 4054: Don't clean up after updating. Useful if you want to leave the work
4055: sources of the updated packages around for inspection or other
4056: purposes. Be sure you eventually clean up the source tree (see the "
4057: clean-update" target below) or you may run into troubles with old
4058: source code still lying around on your next make or make update.
1.1 dsieger 4059:
1.184 rillig 4060: REINSTALL
1.1 dsieger 4061:
1.184 rillig 4062: Deinstall each package before installing (making DEPENDS_TARGET). This
4063: may be necessary if the "clean-update" target (see below) was called
4064: after interrupting a running make update.
1.1 dsieger 4065:
1.184 rillig 4066: DEPENDS_TARGET
1.1 dsieger 4067:
1.184 rillig 4068: Allows you to disable recursion and hardcode the target for packages.
4069: The default is "update" for the update target, facilitating a recursive
4070: update of prerequisite packages. Only set DEPENDS_TARGET if you want to
4071: disable recursive updates. Use UPDATE_TARGET instead to just set a
4072: specific target for each package to be installed during make update
4073: (see above).
1.1 dsieger 4074:
1.184 rillig 4075: clean-update
1.1 dsieger 4076:
1.184 rillig 4077: Clean the source tree for all packages that would get updated if make
4078: update was called from the current directory. This target should not be
4079: used if the current package (or any of its depending packages) have already
4080: been de-installed (e.g., after calling make update) or you may lose some
4081: packages you intended to update. As a rule of thumb: only use this target
4082: before the first time you run make update and only if you have a dirty
4083: package tree (e.g., if you used NOCLEAN).
1.86 wiz 4084:
1.184 rillig 4085: If you are unsure about whether your tree is clean, you can either perform
4086: a make clean at the top of the tree, or use the following sequence of
4087: commands from the directory of the package you want to update (before
4088: running make update for the first time, otherwise you lose all the packages
4089: you wanted to update!):
1.86 wiz 4090:
1.184 rillig 4091: # make clean-update
4092: # make clean CLEANDEPENDS=YES
4093: # make update
1.86 wiz 4094:
4095:
1.184 rillig 4096: The following variables can be used either on the command line or in
4097: mk.conf to alter the behaviour of make clean-update:
1.86 wiz 4098:
1.184 rillig 4099: CLEAR_DIRLIST
1.86 wiz 4100:
1.184 rillig 4101: After make clean, do not reconstruct the list of directories to update
4102: for this package. Only use this if make update successfully installed
4103: all packages you wanted to update. Normally, this is done automatically
4104: on make update, but may have been suppressed by the NOCLEAN variable
4105: (see above).
1.1 dsieger 4106:
1.184 rillig 4107: replace
1.1 dsieger 4108:
1.184 rillig 4109: Update the installation of the current package. This differs from update in
4110: that it does not replace dependent packages. You will need to install
4111: pkgtools/pkg_tarup for this target to work.
1.1 dsieger 4112:
1.184 rillig 4113: Be careful when using this target! There are no guarantees that dependent
4114: packages will still work, in particular they will most certainly break if
4115: you make replace a library package whose shared library major version
4116: changed between your installed version and the new one. For this reason,
4117: this target is not officially supported and only recommended for advanced
4118: users.
1.1 dsieger 4119:
1.184 rillig 4120: info
1.1 dsieger 4121:
1.184 rillig 4122: This target invokes pkg_info(1) for the current package. You can use this
4123: to check which version of a package is installed.
1.86 wiz 4124:
1.184 rillig 4125: index
1.1 dsieger 4126:
1.184 rillig 4127: This is a top-level command, i.e. it should be used in the pkgsrc
4128: directory. It creates a database of all packages in the local pkgsrc tree,
4129: including dependencies, comment, maintainer, and some other useful
4130: information. Individual entries are created by running make describe in the
4131: packages' directories. This index file is saved as pkgsrc/INDEX. It can be
4132: displayed in verbose format by running make print-index. You can search in
4133: it with make search key=something. You can extract a list of all packages
4134: that depend on a particular one by running make show-deps PKG=somepackage.
1.1 dsieger 4135:
1.184 rillig 4136: Running this command takes a very long time, some hours even on fast
4137: machines!
1.1 dsieger 4138:
1.184 rillig 4139: readme
1.1 dsieger 4140:
1.199 nia 4141: This target generates a index.html file, which can be viewed using a
1.184 rillig 4142: browser such as www/firefox or www/links. The generated files contain
4143: references to any packages which are in the PACKAGES directory on the local
4144: host. The generated files can be made to refer to URLs based on
4145: FTP_PKG_URL_HOST and FTP_PKG_URL_DIR. For example, if I wanted to generate
1.199 nia 4146: index.html files which pointed to binary packages on the local machine, in
1.184 rillig 4147: the directory /usr/packages, set FTP_PKG_URL_HOST=file://localhost and
4148: FTP_PKG_URL_DIR=/usr/packages. The ${PACKAGES} directory and its
4149: subdirectories will be searched for all the binary packages.
1.1 dsieger 4150:
1.184 rillig 4151: The target can be run at the toplevel or in category directories, in which
4152: case it descends recursively.
1.1 dsieger 4153:
1.184 rillig 4154: readme-all
1.1 dsieger 4155:
1.184 rillig 4156: This is a top-level command, run it in pkgsrc. Use this target to create a
4157: file README-all.html which contains a list of all packages currently
4158: available in the NetBSD Packages Collection, together with the category
4159: they belong to and a short description. This file is compiled from the
1.199 nia 4160: pkgsrc/*/index.html files, so be sure to run this after a make readme.
1.1 dsieger 4161:
1.184 rillig 4162: cdrom-readme
1.1 dsieger 4163:
1.184 rillig 4164: This is very much the same as the "readme" target (see above), but is to be
4165: used when generating a pkgsrc tree to be written to a CD-ROM. This target
1.199 nia 4166: also produces index.html files, and can be made to refer to URLs based on
1.184 rillig 4167: CDROM_PKG_URL_HOST and CDROM_PKG_URL_DIR.
1.1 dsieger 4168:
1.184 rillig 4169: show-distfiles
1.1 dsieger 4170:
1.184 rillig 4171: This target shows which distfiles and patchfiles are needed to build the
4172: package (ALLFILES, which contains all DISTFILES and PATCHFILES, but not
4173: patches/*).
1.1 dsieger 4174:
1.184 rillig 4175: show-downlevel
1.1 dsieger 4176:
1.184 rillig 4177: This target shows nothing if the package is not installed. If a version of
4178: this package is installed, but is not the version provided in this version
4179: of pkgsrc, then a warning message is displayed. This target can be used to
4180: show which of your installed packages are downlevel, and so the old
4181: versions can be deleted, and the current ones added.
1.1 dsieger 4182:
1.184 rillig 4183: show-pkgsrc-dir
1.1 dsieger 4184:
1.184 rillig 4185: This target shows the directory in the pkgsrc hierarchy from which the
4186: package can be built and installed. This may not be the same directory as
4187: the one from which the package was installed. This target is intended to be
4188: used by people who may wish to upgrade many packages on a single host, and
4189: can be invoked from the top-level pkgsrc Makefile by using the "
4190: show-host-specific-pkgs" target.
1.1 dsieger 4191:
1.184 rillig 4192: show-installed-depends
1.1 dsieger 4193:
1.184 rillig 4194: This target shows which installed packages match the current package's
4195: DEPENDS. Useful if out of date dependencies are causing build problems.
1.1 dsieger 4196:
1.184 rillig 4197: print-build-depends-list
1.1 dsieger 4198:
1.184 rillig 4199: This target shows the list of packages that the current package depends on
4200: for building.
1.1 dsieger 4201:
1.184 rillig 4202: print-run-depends-list
1.1 dsieger 4203:
1.184 rillig 4204: This target shows the list of packages that the current package depends on
4205: for running.
1.1 dsieger 4206:
1.184 rillig 4207: check-shlibs
1.1 dsieger 4208:
1.184 rillig 4209: After a package is installed, check all its binaries and (on ELF platforms)
4210: shared libraries to see if they find the shared libs they need. Run by
4211: default if PKG_DEVELOPER is set in mk.conf.
1.1 dsieger 4212:
1.184 rillig 4213: print-PLIST
1.1 dsieger 4214:
1.184 rillig 4215: After a "make install" from a new or upgraded pkg, this prints out an
4216: attempt to generate a new PLIST from a find -newer work/.extract_done. An
4217: attempt is made to care for shared libs etc., but it is strongly
4218: recommended to review the result before putting it into PLIST. On upgrades,
4219: it's useful to diff the output of this command against an already existing
4220: PLIST file.
1.1 dsieger 4221:
1.184 rillig 4222: If the package installs files via tar(1) or other methods that don't update
4223: file access times, be sure to add these files manually to your PLIST, as
4224: the "find -newer" command used by this target won't catch them!
1.56 ryoon 4225:
1.184 rillig 4226: See Section 19.3, "Tweaking output of make print-PLIST" for more
4227: information on this target.
1.1 dsieger 4228:
1.184 rillig 4229: Chapter 14. Creating a new pkgsrc package from scratch
1.1 dsieger 4230:
1.184 rillig 4231: Table of Contents
1.1 dsieger 4232:
1.184 rillig 4233: 14.1. Common types of packages
1.1 dsieger 4234:
1.219 nia 4235: 14.1.1. Python modules and programs
4236: 14.1.2. R packages
4237: 14.1.3. TeXlive packages
1.1 dsieger 4238:
1.184 rillig 4239: 14.2. Examples
1.1 dsieger 4240:
1.184 rillig 4241: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 4242:
1.184 rillig 4243: When you find a package that is not yet in pkgsrc, you most likely have a URL
4244: from where you can download the source code. Starting with this URL, creating a
4245: package involves only a few steps.
1.1 dsieger 4246:
1.184 rillig 4247: 1. In your mk.conf, set PKG_DEVELOPER=yes to enable the basic quality checks.
1.1 dsieger 4248:
1.184 rillig 4249: 2. Install the package meta-pkgs/pkg_developer, which among others will
4250: install the utilities url2pkg, pkglint, pkgvi and mkpatches:
1.1 dsieger 4251:
1.184 rillig 4252: $ cd /usr/pkgsrc
4253: $ (cd meta-pkgs/pkg_developer && bmake update)
1.1 dsieger 4254:
1.184 rillig 4255: 3. Choose one of the top-level directories as the category in which you want
4256: to place your package. You can also create a directory of your own (maybe
1.219 nia 4257: called local). Change into that category directory:
1.1 dsieger 4258:
1.219 nia 4259: $ cd category
1.1 dsieger 4260:
1.219 nia 4261: 4. Run the program url2pkg, passing as argument the URL of the distribution
4262: file (in most cases a .tar.gz file). This will download the distribution
4263: file and create the necessary files of the package, based on what's in the
4264: distribution file:
1.1 dsieger 4265:
1.184 rillig 4266: $ url2pkg https://www.example.org/packages/package-1.0.tar.gz
1.1 dsieger 4267:
1.184 rillig 4268: 5. Examine the extracted files to determine the dependencies of your package.
4269: Ideally, this is mentioned in some README file, but things may differ. For
4270: each of these dependencies, look where it exists in pkgsrc, and if there is
4271: a file called buildlink3.mk in that directory, add a line to your package
4272: Makefile which includes that file just before the last line. If the
4273: buildlink3.mk file does not exist, it must be created first. The
4274: buildlink3.mk file makes sure that the package's include files and
4275: libraries are provided.
1.1 dsieger 4276:
1.219 nia 4277: If you just need binaries from a dependent package, add a DEPENDS line to
4278: the Makefile, which specifies the version of the dependency and where it
4279: can be found in pkgsrc. This line should be placed in the third paragraph.
4280: If the dependency is only needed for building the package, but not when
4281: using it, use TOOL_DEPENDS or BUILD_DEPENDS instead of DEPENDS. The
4282: difference between TOOL_DEPENDS and BUILD_DEPENDS occurs when
4283: cross-compiling: TOOL_DEPENDS are native packages, i.e. packages for the
4284: platform where the package is built; BUILD_DEPENDS are target packages,
4285: i.e. packages for the platform for which the package is built. There is
4286: also TEST_DEPENDS, which specifies a dependency used only for testing the
4287: resulting package built, using the upstream project's included test suite,
4288: on the native platform. Your package may then look like this:
1.1 dsieger 4289:
1.184 rillig 4290: [...]
1.1 dsieger 4291:
1.184 rillig 4292: TOOL_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt
4293: DEPENDS+= screen-[0-9]*:../../misc/screen
4294: DEPENDS+= screen>=4.0:../../misc/screen
1.1 dsieger 4295:
1.184 rillig 4296: [...]
1.1 dsieger 4297:
1.184 rillig 4298: .include "../../category/package/buildlink3.mk"
4299: .include "../../devel/glib2/buildlink3.mk"
4300: .include "../../mk/bsd.pkg.mk"
1.1 dsieger 4301:
1.184 rillig 4302: 6. Run pkglint to see what things still need to be done to make your package a
4303: "good" one. If you don't know what pkglint's warnings want to tell you, try
4304: pkglint --explain or pkglint -e, which outputs additional explanations.
1.1 dsieger 4305:
1.184 rillig 4306: 7. In many cases the package is not yet ready to build. You can find
4307: instructions for the most common cases in the next section, Section 14.1,
4308: "Common types of packages". After you have followed the instructions over
4309: there, you can hopefully continue here.
1.1 dsieger 4310:
1.184 rillig 4311: 8. Run bmake clean to clean the working directory from the extracted files.
1.219 nia 4312: Besides these files, a lot of cache files and other system information have
4313: been saved in the working directory, which may have become outdated after
4314: you edited the Makefile.
1.1 dsieger 4315:
1.184 rillig 4316: 9. Now, run bmake to build the package. For the various things that can go
4317: wrong in this phase, consult Chapter 21, Making your package work.
1.1 dsieger 4318:
1.184 rillig 4319: If the extracted files from the package need to be fixed, run multiple
4320: rounds of these commands:
1.1 dsieger 4321:
1.219 nia 4322: $ bmake
1.184 rillig 4323: $ pkgvi ${WRKSRC}/some/file/that/does/not/compile
4324: $ mkpatches
1.219 nia 4325: $ bmake mps
4326: $ bmake clean
1.1 dsieger 4327:
1.184 rillig 4328: 10. When the package builds fine, the next step is to install the package. Run
4329: bmake install and hope that everything works.
1.1 dsieger 4330:
1.184 rillig 4331: 11. Up to now, the file PLIST, which contains a list of the files that are
4332: installed by the package, is nearly empty. Run bmake print-PLIST >PLIST to
4333: generate a probably correct list. Check the file using your preferred text
4334: editor to see if the list of files looks plausible.
1.1 dsieger 4335:
1.184 rillig 4336: 12. Run pkglint again to see if the generated PLIST contains garbage or not.
1.1 dsieger 4337:
1.184 rillig 4338: 13. When you ran bmake install, the package had been registered in the database
4339: of installed files, but with an empty list of files. To fix this, run bmake
4340: deinstall and bmake install again. Now the package is registered with the
4341: list of files from PLIST.
1.48 wiz 4342:
1.219 nia 4343: 14. Run bmake clean update to run everything from above again in a single step,
1.184 rillig 4344: making sure that the PLIST is correct and the whole package is created as
4345: intended.
1.48 wiz 4346:
1.219 nia 4347: 15. Run pkglint to see if there's anything left to do.
1.48 wiz 4348:
1.219 nia 4349: 16. Commit the package to pkgsrc-wip or main pkgsrc; see Chapter 23, Submitting
1.184 rillig 4350: and Committing.
1.50 wiz 4351:
1.184 rillig 4352: 14.1. Common types of packages
1.1 dsieger 4353:
1.219 nia 4354: 14.1.1. Python modules and programs
1.1 dsieger 4355:
1.184 rillig 4356: Python modules and programs packages are easily created using a set of
4357: predefined variables.
1.1 dsieger 4358:
1.184 rillig 4359: If some Python versions are not supported by the software, set the
4360: PYTHON_VERSIONS_INCOMPATIBLE variable to the Python versions that are not
4361: supported, e.g.
1.1 dsieger 4362:
1.184 rillig 4363: PYTHON_VERSIONS_INCOMPATIBLE= 27
1.1 dsieger 4364:
1.184 rillig 4365: If the packaged software is a Python module, include one of ../../lang/python/
1.215 wiz 4366: egg.mk or ../../lang/python/extension.mk.
1.1 dsieger 4367:
1.215 wiz 4368: Most Python packages use setuptools ("eggs"). If the packaged software is using
4369: setuptools, you only need to include "../../lang/python/egg.mk".
1.1 dsieger 4370:
1.184 rillig 4371: Either way, the package directory should be called "py-software" and PKGNAME
4372: should be set to "${PYPKGPREFIX}-${DISTNAME}", e.g.
1.1 dsieger 4373:
1.184 rillig 4374: DISTNAME= foopymodule-1.2.10
4375: PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
1.1 dsieger 4376:
1.226 gutterid 4377: For software in PyPi, the name should match what PyPi specifies for "pip
4378: install software".
4379:
1.184 rillig 4380: If it is an application, include "../../lang/python/application.mk". In order
4381: to correctly set the path to the Python interpreter, use the REPLACE_PYTHON
4382: variable and set it to the list of files (paths relative to WRKSRC) that must
4383: be corrected. For example:
1.1 dsieger 4384:
1.184 rillig 4385: REPLACE_PYTHON= *.py
1.1 dsieger 4386:
1.184 rillig 4387: Some Python modules have separate distributions for Python-2.x and Python-3.x
4388: support. In pkgsrc this is handled by the versioned_dependencies.mk file. Set
4389: PYTHON_VERSIONED_DEPENDENCIES to the list of packages that should be depended
4390: upon and include "../../lang/python/versioned_dependencies.mk", then the pkgsrc
4391: infrastructure will depend on the appropriate package version. For example:
1.1 dsieger 4392:
1.184 rillig 4393: PYTHON_VERSIONED_DEPENDENCIES=dialog
1.1 dsieger 4394:
1.184 rillig 4395: Look inside versioned_dependencies.mk for a list of supported packages.
1.1 dsieger 4396:
1.219 nia 4397: 14.1.2. R packages
1.1 dsieger 4398:
1.184 rillig 4399: Simple R packages from CRAN are handled automatically by R2pkg, which is
4400: available in pkgtools/R2pkg. Individual packages (and optionally their
4401: dependencies) may be created and updated. R packages generally follow the same
4402: form, and most of the relevant information needed is contained in a DESCRIPTION
4403: file as part of each R package on CRAN. Consequently, R2pkg downloads that
4404: information and creates or updates a package in the canonical form. The
4405: resulting package should be reviewed for correctness.
1.1 dsieger 4406:
1.219 nia 4407: 14.1.3. TeXlive packages
1.1 dsieger 4408:
1.184 rillig 4409: TeXlive packages from CTAN are handled automatically by texlive2pkg, which is
4410: available in pkgtools/texlive2pkg.
1.1 dsieger 4411:
1.184 rillig 4412: If the TeXlive package name is not known, it may be useful to search CTAN. A "
4413: Contained in" field on the package page typically identifies the basename of
4414: the package file in the TeXlive archive.
1.1 dsieger 4415:
1.184 rillig 4416: If the TeXlive package name is known, download the files from the TeXlive
4417: archive. For package foo, you will need to download foo.tar.xz. Most TeXlive
4418: packages also have associated documentation packages, so download
4419: foo.doc.tar.xz at the same time. These files should be placed in the
4420: appropriate category directory, which is often but not always print. Then run
4421: the following command in the category directory.
1.1 dsieger 4422:
1.184 rillig 4423: texlive2pkg foo.tar.xz foo.doc.tar.xz
1.1 dsieger 4424:
1.184 rillig 4425: This will create two packages, tex-foo and tex-foo-doc. Be sure to check that
4426: both packages are correct.
1.1 dsieger 4427:
1.184 rillig 4428: Finally, CTAN currently does not include version information in package
4429: filenames and changes their contents periodically when updates occur.
4430: Consequently, pkgsrc avoids downloading distfiles directly from CTAN and
4431: instead relies on the pkgsrc archives. For each new or updated TeXlive package,
4432: e.g., the main one and the corresponding documentation, upload the distfiles
4433: with the following command in each package directory.
1.1 dsieger 4434:
1.184 rillig 4435: make upload-distfiles
1.117 sevan 4436:
1.184 rillig 4437: 14.2. Examples
1.117 sevan 4438:
1.184 rillig 4439: 14.2.1. How the www/nvu package came into pkgsrc
1.1 dsieger 4440:
1.184 rillig 4441: 14.2.1.1. The initial package
1.1 dsieger 4442:
1.184 rillig 4443: Looking at the file pkgsrc/doc/TODO, I saw that the "nvu" package has not yet
4444: been imported into pkgsrc. As the description says it has to do with the web,
4445: the obvious choice for the category is "www".
1.1 dsieger 4446:
1.184 rillig 4447: $ mkdir www/nvu
4448: $ cd www/nvu
1.1 dsieger 4449:
1.184 rillig 4450: The web site says that the sources are available as a tar file, so I fed that
4451: URL to the url2pkg program:
1.1 dsieger 4452:
1.184 rillig 4453: $ url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
1.1 dsieger 4454:
1.184 rillig 4455: My editor popped up, and I added a PKGNAME line below the DISTNAME line, as the
4456: package name should not have the word "sources" in it. I also filled in the
4457: MAINTAINER, HOMEPAGE and COMMENT fields. Then the package Makefile looked like
4458: that:
1.1 dsieger 4459:
1.184 rillig 4460: # $NetBSD $
4461: #
1.1 dsieger 4462:
1.184 rillig 4463: DISTNAME= nvu-1.0-sources
4464: PKGNAME= nvu-1.0
4465: CATEGORIES= www
4466: MASTER_SITES= http://cvs.nvu.com/download/
4467: EXTRACT_SUFX= .tar.bz2
1.1 dsieger 4468:
1.184 rillig 4469: MAINTAINER= rillig@NetBSD.org
4470: HOMEPAGE= http://cvs.nvu.com/
4471: COMMENT= Web Authoring System
1.1 dsieger 4472:
1.184 rillig 4473: # url2pkg-marker (please do not remove this line.)
4474: .include "../../mk/bsd.pkg.mk"
1.1 dsieger 4475:
1.184 rillig 4476: On the first line of output above, an artificial space has been added between
4477: NetBSD and $, this is a workaround to prevent CVS expanding to the filename of
4478: the guide.
1.1 dsieger 4479:
1.184 rillig 4480: Then, I quit the editor and watched pkgsrc downloading a large source archive:
1.1 dsieger 4481:
1.184 rillig 4482: url2pkg> Running "make makesum" ...
4483: => Required installed package digest>=20010302: digest-20060826 found
4484: => Fetching nvu-1.0-sources.tar.bz2
4485: Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
4486: 100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA
4487: 29687976 bytes retrieved in 03:12 (150.77 KB/s)
4488: url2pkg> Running "make extract" ...
4489: => Required installed package digest>=20010302: digest-20060826 found
4490: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
4491: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
4492: work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc
4493: ===> Installing dependencies for nvu-1.0
4494: ===> Overriding tools for nvu-1.0
4495: ===> Extracting for nvu-1.0
4496: url2pkg> Adjusting the Makefile.
1.1 dsieger 4497:
1.184 rillig 4498: Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
1.1 dsieger 4499:
1.184 rillig 4500: Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
1.1 dsieger 4501:
1.184 rillig 4502: 14.2.1.2. Fixing all kinds of problems to make the package work
1.1 dsieger 4503:
1.184 rillig 4504: Now that the package has been extracted, let's see what's inside it. The
4505: package has a README.txt, but that only says something about mozilla, so it's
4506: probably useless for seeing what dependencies this package has. But since there
4507: is a GNU configure script in the package, let's hope that it will complain
4508: about everything it needs.
1.1 dsieger 4509:
1.184 rillig 4510: $ bmake
4511: => Required installed package digest>=20010302: digest-20060826 found
4512: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
4513: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
4514: ===> Patching for nvu-1.0
4515: ===> Creating toolchain wrappers for nvu-1.0
4516: ===> Configuring for nvu-1.0
4517: [...]
4518: configure: error: Perl 5.004 or higher is required.
4519: [...]
4520: WARNING: Please add USE_TOOLS+=perl to the package Makefile.
4521: [...]
1.1 dsieger 4522:
1.184 rillig 4523: That worked quite well. So I opened the package Makefile in my editor, and
4524: since it already has a USE_TOOLS line, I just appended "perl" to it. Since the
4525: dependencies of the package have changed now, and since a perl wrapper is
4526: automatically installed in the "tools" phase, I need to build the package from
4527: scratch.
1.1 dsieger 4528:
1.184 rillig 4529: $ bmake clean
4530: ===> Cleaning for nvu-1.0
4531: $ bmake
4532: [...]
4533: *** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
4534: GNU Make. You will not be able to build Mozilla without GNU Make.
4535: [...]
1.1 dsieger 4536:
1.184 rillig 4537: So I added "gmake" to the USE_TOOLS line and tried again (from scratch).
1.1 dsieger 4538:
1.184 rillig 4539: [...]
4540: checking for GTK - version >= 1.2.0... no
4541: *** Could not run GTK test program, checking why...
4542: [...]
1.1 dsieger 4543:
1.184 rillig 4544: Now to the other dependencies. The first question is: Where is the GTK package
4545: hidden in pkgsrc?
1.1 dsieger 4546:
1.184 rillig 4547: $ echo ../../*/gtk*
4548: [many packages ...]
4549: $ echo ../../*/gtk
4550: ../../x11/gtk
4551: $ echo ../../*/gtk2
4552: ../../x11/gtk2
4553: $ echo ../../*/gtk2/bui*
4554: ../../x11/gtk2/buildlink3.mk
1.1 dsieger 4555:
1.184 rillig 4556: The first try was definitely too broad. The second one had exactly one result,
4557: which is very good. But there is one pitfall with GNOME packages. Before GNOME
4558: 2 had been released, there were already many GNOME 1 packages in pkgsrc. To be
4559: able to continue to use these packages, the GNOME 2 packages were imported as
4560: separate packages, and their names usually have a "2" appended. So I checked
4561: whether this was the case here, and indeed it was.
1.1 dsieger 4562:
1.184 rillig 4563: Since the GTK2 package has a buildlink3.mk file, adding the dependency is very
4564: easy. I just inserted an .include line before the last line of the package
4565: Makefile, so that it now looks like this:
1.1 dsieger 4566:
1.184 rillig 4567: [...]
4568: .include "../../x11/gtk2/buildlink3.mk"
4569: .include "../../mk/bsd.pkg.mk
1.1 dsieger 4570:
1.184 rillig 4571: After another bmake clean && bmake, the answer was:
1.108 rillig 4572:
1.184 rillig 4573: [...]
4574: checking for gtk-config... /home/roland/pkg/bin/gtk-config
4575: checking for GTK - version >= 1.2.0... no
4576: *** Could not run GTK test program, checking why...
4577: *** The test program failed to compile or link. See the file config.log for the
4578: *** exact error that occured. This usually means GTK was incorrectly installed
4579: *** or that you have moved GTK since it was installed. In the latter case, you
4580: *** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
4581: configure: error: Test for GTK failed.
4582: [...]
1.1 dsieger 4583:
1.184 rillig 4584: In this particular case, the assumption that "every package prefers GNOME 2"
4585: had been wrong. The first of the lines above told me that this package really
4586: wanted to have the GNOME 1 version of GTK. If the package had looked for GTK2,
4587: it would have looked for pkg-config instead of gtk-config. So I changed the x11
4588: /gtk2 to x11/gtk in the package Makefile, and tried again.
1.1 dsieger 4589:
1.184 rillig 4590: [...]
4591: cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...]
4592: In file included from xpidl.c:42:
4593: xpidl.h:53:24: libIDL/IDL.h: No such file or directory
4594: In file included from xpidl.c:42:
4595: xpidl.h:132: error: parse error before "IDL_ns"
4596: [...]
1.1 dsieger 4597:
1.184 rillig 4598: The package still does not find all of its dependencies. Now the question is:
4599: Which package provides the libIDL/IDL.h header file?
1.1 dsieger 4600:
1.184 rillig 4601: $ echo ../../*/*idl*
4602: ../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
4603: $ echo ../../*/*IDL*
4604: ../../net/libIDL
1.1 dsieger 4605:
1.184 rillig 4606: Let's take the one from the second try. So I included the ../../net/libIDL/
4607: buildlink3.mk file and tried again. But the error didn't change. After digging
4608: through some of the code, I concluded that the build process of the package was
4609: broken and couldn't have ever worked, but since the Mozilla source tree is
4610: quite large, I didn't want to fix it. So I added the following to the package
4611: Makefile and tried again:
1.1 dsieger 4612:
1.184 rillig 4613: CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
4614: BUILDLINK_TRANSFORM+= l:IDL:IDL-2
1.1 dsieger 4615:
1.184 rillig 4616: The latter line is needed because the package expects the library libIDL.so,
4617: but only libIDL-2.so is available. So I told the compiler wrapper to rewrite
4618: that on the fly.
1.1 dsieger 4619:
1.184 rillig 4620: The next problem was related to a recent change of the FreeType interface. I
4621: looked up in www/seamonkey which patch files were relevant for this issue and
4622: copied them to the patches directory. Then I retried, fixed the patches so that
4623: they applied cleanly and retried again. This time, everything worked.
1.1 dsieger 4624:
1.184 rillig 4625: 14.2.1.3. Installing the package
1.1 dsieger 4626:
1.184 rillig 4627: $ bmake CHECK_FILES=no install
4628: [...]
4629: $ bmake print-PLIST >PLIST
4630: $ bmake deinstall
4631: $ bmake install
1.1 dsieger 4632:
1.184 rillig 4633: Chapter 15. Programming in Makefiles
1.1 dsieger 4634:
1.184 rillig 4635: Table of Contents
1.1 dsieger 4636:
1.184 rillig 4637: 15.1. Caveats
4638: 15.2. Makefile variables
1.1 dsieger 4639:
1.184 rillig 4640: 15.2.1. Naming conventions
1.1 dsieger 4641:
1.184 rillig 4642: 15.3. Code snippets
1.1 dsieger 4643:
1.184 rillig 4644: 15.3.1. Adding things to a list
4645: 15.3.2. Echoing a string exactly as-is
4646: 15.3.3. Passing CFLAGS to GNU configure scripts
4647: 15.3.4. Handling possibly empty variables
1.229 gutterid 4648: 15.3.5. Testing yes/no variables in conditions
1.1 dsieger 4649:
1.184 rillig 4650: Pkgsrc consists of many Makefile fragments, each of which forms a well-defined
4651: part of the pkgsrc system. Using the make(1) system as a programming language
4652: for a big system like pkgsrc requires some discipline to keep the code correct
4653: and understandable.
1.1 dsieger 4654:
1.184 rillig 4655: The basic ingredients for Makefile programming are variables and shell
4656: commands. Among these shell commands may even be more complex ones like awk(1)
4657: programs. To make sure that every shell command runs as intended it is
4658: necessary to quote all variables correctly when they are used.
1.1 dsieger 4659:
1.184 rillig 4660: This chapter describes some patterns that appear quite often in Makefiles,
4661: including the pitfalls that come along with them.
1.1 dsieger 4662:
1.184 rillig 4663: 15.1. Caveats
1.1 dsieger 4664:
1.184 rillig 4665: * When you are creating a file as a target of a rule, always write the data
4666: to a temporary file first and finally rename that file. Otherwise there
4667: might occur an error in the middle of generating the file, and when the
4668: user runs make(1) for the second time, the file exists and will not be
4669: regenerated properly. Example:
1.1 dsieger 4670:
1.184 rillig 4671: wrong:
4672: @echo "line 1" > ${.TARGET}
4673: @echo "line 2" >> ${.TARGET}
4674: @false
1.1 dsieger 4675:
1.184 rillig 4676: correct:
4677: @echo "line 1" > ${.TARGET}.tmp
4678: @echo "line 2" >> ${.TARGET}.tmp
4679: @false
4680: @mv ${.TARGET}.tmp ${.TARGET}
1.1 dsieger 4681:
1.184 rillig 4682: When you run make wrong twice, the file wrong will exist, although there
4683: was an error message in the first run. On the other hand, running make
4684: correct gives an error message twice, as expected.
1.1 dsieger 4685:
1.184 rillig 4686: You might remember that make(1) sometimes removes ${.TARGET} in case of
4687: error, but this only happens when it is interrupted, for example by
4688: pressing Ctrl+C. This does not happen when one of the commands fails (like
4689: false(1) above).
1.1 dsieger 4690:
1.184 rillig 4691: 15.2. Makefile variables
1.1 dsieger 4692:
1.184 rillig 4693: Makefile variables contain strings that can be processed using the five
4694: operators =, +=, ?=, := and !=, which are described in the make(1) man page.
1.1 dsieger 4695:
1.184 rillig 4696: When a variable's value is parsed from a Makefile, the hash character # and the
4697: backslash character \ are handled specially. If a backslash is the last
4698: character in a line, that backslash is removed from the line and the line
4699: continues with the next line of the file.
1.1 dsieger 4700:
1.184 rillig 4701: The # character starts a comment that reaches until the end of the line. To get
4702: an actual # character, such as in a URL, write \# instead.
1.1 dsieger 4703:
1.184 rillig 4704: The evaluation of variables either happens immediately or lazy. It happens
4705: immediately when the variable occurs on the right-hand side of the := or the !=
4706: operator, in a .if condition or a .for loop. In the other cases, it is
4707: evaluated lazily.
1.1 dsieger 4708:
1.184 rillig 4709: Some of the modifiers split the string into words and then operate on the
4710: words, others operate on the string as a whole. When a string is split into
4711: words, double quotes and single quotes are interpreted as delimiters, just like
4712: in sh(1).
1.1 dsieger 4713:
1.184 rillig 4714: 15.2.1. Naming conventions
1.1 dsieger 4715:
1.184 rillig 4716: * All variable names starting with an underscore are reserved for use by the
4717: pkgsrc infrastructure. They shall not be used by packages.
1.1 dsieger 4718:
1.184 rillig 4719: * In .for loops you should use lowercase variable names for the iteration
4720: variables.
1.1 dsieger 4721:
1.184 rillig 4722: * All list variables should have a plural name, such as PKG_OPTIONS or
4723: DISTFILES.
1.1 dsieger 4724:
1.184 rillig 4725: 15.3. Code snippets
1.1 dsieger 4726:
1.184 rillig 4727: 15.3.1. Adding things to a list
1.1 dsieger 4728:
1.184 rillig 4729: When adding a string that possibly contains whitespace or quotes to a list
4730: (example 1), it must be quoted using the :Q modifier.
1.1 dsieger 4731:
1.184 rillig 4732: When adding another list to a list (example 2), it must not be quoted, since
4733: its elements are already quoted.
1.1 dsieger 4734:
1.184 rillig 4735: STRING= foo * bar `date`
4736: LIST= # empty
4737: ANOTHER_LIST= a=b c=d
1.1 dsieger 4738:
1.184 rillig 4739: LIST+= ${STRING:Q} # 1
4740: LIST+= ${ANOTHER_LIST} # 2
1.1 dsieger 4741:
1.184 rillig 4742: 15.3.2. Echoing a string exactly as-is
1.1 dsieger 4743:
1.184 rillig 4744: Echoing a string containing special characters needs special work.
1.1 dsieger 4745:
1.184 rillig 4746: STRING= foo bar < > * `date` $$HOME ' "
4747: EXAMPLE_ENV= string=${STRING:Q} x=multiple\ quoted\ words
1.1 dsieger 4748:
1.184 rillig 4749: all:
4750: echo ${STRING} # 1
4751: echo ${STRING:Q} # 2
4752: printf '%s\n' ${STRING:Q}'' # 3
4753: env ${EXAMPLE_ENV} sh -c 'echo "$$string"; echo "$$x"' # 4
1.1 dsieger 4754:
1.184 rillig 4755: Example 1 leads to a syntax error in the shell, as the characters are just
4756: copied.
1.1 dsieger 4757:
1.184 rillig 4758: Example 2 quotes the string so that the shell interprets it correctly. But the
4759: echo command may additionally interpret strings with a leading dash or those
4760: containing backslashes.
1.1 dsieger 4761:
1.184 rillig 4762: Example 3 can handle arbitrary strings, since printf(1) only interprets the
4763: format string, but not the next argument. The trailing single quotes handle the
4764: case when the string is empty. In that case, the :Q modifier would result in an
4765: empty string too, which would then be skipped by the shell. For printf(1) this
4766: doesn't make a difference, but other programs may care.
1.1 dsieger 4767:
1.184 rillig 4768: In example 4, the EXAMPLE_ENV does not need to be quoted because the quoting
4769: has already been done when adding elements to the list.
1.1 dsieger 4770:
1.184 rillig 4771: 15.3.3. Passing CFLAGS to GNU configure scripts
1.1 dsieger 4772:
1.184 rillig 4773: When passing CFLAGS or similar variables to a GNU-style configure script
4774: (especially those that call other configure scripts), it must not have leading
4775: or trailing whitespace, since otherwise the configure script gets confused. To
4776: trim leading and trailing whitespace, use the :M modifier, as in the following
4777: example:
1.1 dsieger 4778:
1.184 rillig 4779: CPPFLAGS= # empty
4780: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX}\"
4781: CPPFLAGS+= ${MY_CPPFLAGS}
1.1 dsieger 4782:
1.184 rillig 4783: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
1.1 dsieger 4784:
1.184 rillig 4785: all:
4786: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
4787: echo x${CONFIGURE_ARGS:Q}x # properly trimmed
1.1 dsieger 4788:
1.184 rillig 4789: In this example, CPPFLAGS has both leading and trailing whitespace because the
4790: += operator always adds a space.
1.1 dsieger 4791:
1.184 rillig 4792: 15.3.4. Handling possibly empty variables
1.1 dsieger 4793:
1.184 rillig 4794: When a possibly empty variable is used in a shell program, it may lead to a
4795: syntax error.
1.1 dsieger 4796:
1.184 rillig 4797: EGFILES= # empty
1.1 dsieger 4798:
1.184 rillig 4799: install-examples: # produces a syntax error in the shell
4800: for egfile in ${EGFILES}; do \
4801: echo "Installing $$egfile"; \
4802: done
1.1 dsieger 4803:
1.184 rillig 4804: The shell only sees the text for egfile in ; do, since ${EGFILES} is replaced
4805: with an empty string by make(1). To fix this syntax error, use one of the
4806: snippets below.
1.1 dsieger 4807:
1.229 gutterid 4808: EGFILES= # empty
1.1 dsieger 4809:
1.184 rillig 4810: install-examples:
4811: for egfile in ${EGFILES} ""; do \
4812: [ -n "$$egfile" ] || continue; \
4813: echo "Installing $$egfile"; \
4814: done
1.1 dsieger 4815:
1.184 rillig 4816: In this case, an empty string is appended to the iteration list (to prevent the
4817: syntax error) and filtered out later.
1.1 dsieger 4818:
1.184 rillig 4819: EGFILES= # empty
1.1 dsieger 4820:
1.184 rillig 4821: install-examples:
4822: .for egfile in ${EGFILES}
4823: echo "Installing ${egfile}"
4824: .endfor
1.1 dsieger 4825:
1.184 rillig 4826: If one of the filenames contains special characters, it should be enclosed in
4827: single or double quotes.
1.1 dsieger 4828:
1.184 rillig 4829: To have a shell command test whether a make variable is empty, use the
4830: following code: ${TEST} -z ${POSSIBLY_EMPTY:Q}"".
1.1 dsieger 4831:
1.229 gutterid 4832: 15.3.5. Testing yes/no variables in conditions
4833:
4834: When a variable can have the values yes or no, use the following pattern to
4835: test the variable:
4836:
4837: .if ${VAR:U:tl} == "yes"
4838: # do something
4839: .endif
4840:
4841: The :U modifier is only necessary if the variable can be undefined. If the
4842: variable is guaranteed to be defined, the :U can be omitted.
4843:
4844: The :tl modifier converts the variable value to lowercase, allowing for the
4845: values yes, Yes, YES.
4846:
1.184 rillig 4847: Chapter 16. Options handling
1.1 dsieger 4848:
4849: Table of Contents
4850:
1.184 rillig 4851: 16.1. Global default options
4852: 16.2. Converting packages to use bsd.options.mk
4853: 16.3. Option Names
4854: 16.4. Determining the options of dependencies
1.1 dsieger 4855:
4856: Many packages have the ability to be built to support different sets of
4857: features. bsd.options.mk is a framework in pkgsrc that provides generic
4858: handling of those options that determine different ways in which the packages
4859: can be built. It's possible for the user to specify exactly which sets of
4860: options will be built into a package or to allow a set of global default
4861: options apply.
4862:
1.7 rillig 4863: There are two broad classes of behaviors that one might want to control via
4864: options. One is whether some particular feature is enabled in a program that
4865: will be built anyway, often by including or not including a dependency on some
4866: other package. The other is whether or not an additional program will be built
4867: as part of the package. Generally, it is better to make a split package for
4868: such additional programs instead of using options, because it enables binary
4869: packages to be built which can then be added separately. For example, the foo
4870: package might have minimal dependencies (those packages without which foo
4871: doesn't make sense), and then the foo-gfoo package might include the GTK
4872: frontend program gfoo. This is better than including a gtk option to foo that
4873: adds gfoo, because either that option is default, in which case binary users
4874: can't get foo without gfoo, or not default, in which case they can't get gfoo.
4875: With split packages, they can install foo without having GTK, and later decide
4876: to install gfoo (pulling in GTK at that time). This is an advantage to source
4877: users too, avoiding the need for rebuilds.
4878:
4879: Plugins with widely varying dependencies should usually be split instead of
4880: options.
4881:
4882: It is often more work to maintain split packages, especially if the upstream
4883: package does not support this. The decision of split vs. option should be made
4884: based on the likelihood that users will want or object to the various pieces,
4885: the size of the dependencies that are included, and the amount of work.
4886:
4887: A further consideration is licensing. Non-free parts, or parts that depend on
4888: non-free dependencies (especially plugins) should almost always be split if
4889: feasible.
4890:
1.184 rillig 4891: 16.1. Global default options
1.1 dsieger 4892:
4893: Global default options are listed in PKG_DEFAULT_OPTIONS, which is a list of
4894: the options that should be built into every package if that option is
1.4 rillig 4895: supported. This variable should be set in mk.conf.
1.1 dsieger 4896:
1.184 rillig 4897: 16.2. Converting packages to use bsd.options.mk
1.1 dsieger 4898:
4899: The following example shows how bsd.options.mk should be used by the
4900: hypothetical ``wibble'' package, either in the package Makefile, or in a file,
4901: e.g. options.mk, that is included by the main package Makefile.
4902:
4903: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
4904: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
4905: PKG_OPTIONS_OPTIONAL_GROUPS= database
4906: PKG_OPTIONS_GROUP.database= mysql pgsql
4907: PKG_SUGGESTED_OPTIONS= wibble-foo
4908: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
4909: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
4910:
4911: .include "../../mk/bsd.prefs.mk"
4912:
4913: # this package was previously named wibble2
4914: .if defined(PKG_OPTIONS.wibble2)
4915: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
4916: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
4917: "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead."
4918: .endif
4919:
4920: .include "../../mk/bsd.options.mk"
4921:
4922: # Package-specific option-handling
4923:
4924: ###
4925: ### FOO support
4926: ###
4927: .if !empty(PKG_OPTIONS:Mwibble-foo)
4928: CONFIGURE_ARGS+= --enable-foo
4929: .endif
4930:
4931: ###
4932: ### LDAP support
4933: ###
4934: .if !empty(PKG_OPTIONS:Mldap)
4935: . include "../../databases/openldap-client/buildlink3.mk"
4936: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client}
4937: .endif
4938:
4939: ###
4940: ### database support
4941: ###
4942: .if !empty(PKG_OPTIONS:Mmysql)
4943: . include "../../mk/mysql.buildlink3.mk"
4944: .endif
4945: .if !empty(PKG_OPTIONS:Mpgsql)
4946: . include "../../mk/pgsql.buildlink3.mk"
4947: .endif
4948:
4949: The first section contains the information about which build options are
4950: supported by the package, and any default options settings if needed.
4951:
4952: 1. PKG_OPTIONS_VAR is the name of the make(1) variable that the user can set
4953: to override the default options. It should be set to PKG_OPTIONS.pkgbase.
4954: Do not set it to PKG_OPTIONS.${PKGBASE}, since PKGBASE is not defined at
4955: the point where the options are processed.
4956:
4957: 2. PKG_SUPPORTED_OPTIONS is a list of build options supported by the package.
4958:
4959: 3. PKG_OPTIONS_OPTIONAL_GROUPS is a list of names of groups of mutually
4960: exclusive options. The options in each group are listed in
4961: PKG_OPTIONS_GROUP.groupname. The most specific setting of any option from
4962: the group takes precedence over all other options in the group. Options
4963: from the groups will be automatically added to PKG_SUPPORTED_OPTIONS.
4964:
4965: 4. PKG_OPTIONS_REQUIRED_GROUPS is like PKG_OPTIONS_OPTIONAL_GROUPS, but
4966: building the packages will fail if no option from the group is selected.
4967:
4968: 5. PKG_OPTIONS_NONEMPTY_SETS is a list of names of sets of options. At least
4969: one option from each set must be selected. The options in each set are
4970: listed in PKG_OPTIONS_SET.setname. Options from the sets will be
4971: automatically added to PKG_SUPPORTED_OPTIONS. Building the package will
4972: fail if no option from the set is selected.
4973:
4974: 6. PKG_SUGGESTED_OPTIONS is a list of build options which are enabled by
4975: default.
4976:
4977: 7. PKG_OPTIONS_LEGACY_VARS is a list of "USE_VARIABLE:option" pairs that map
1.4 rillig 4978: legacy mk.conf variables to their option counterparts. Pairs should be
1.1 dsieger 4979: added with "+=" to keep the listing of global legacy variables. A warning
4980: will be issued if the user uses a legacy variable.
4981:
4982: 8. PKG_OPTIONS_LEGACY_OPTS is a list of "old-option:new-option" pairs that map
4983: options that have been renamed to their new counterparts. Pairs should be
4984: added with "+=" to keep the listing of global legacy options. A warning
4985: will be issued if the user uses a legacy option.
4986:
4987: 9. PKG_LEGACY_OPTIONS is a list of options implied by deprecated variables
4988: used. This can be used for cases that neither PKG_OPTIONS_LEGACY_VARS nor
4989: PKG_OPTIONS_LEGACY_OPTS can handle, e. g. when PKG_OPTIONS_VAR is renamed.
4990:
4991: 10. PKG_OPTIONS_DEPRECATED_WARNINGS is a list of warnings about deprecated
4992: variables or options used, and what to use instead.
4993:
4994: A package should never modify PKG_DEFAULT_OPTIONS or the variable named in
4995: PKG_OPTIONS_VAR. These are strictly user-settable. To suggest a default set of
4996: options, use PKG_SUGGESTED_OPTIONS.
4997:
4998: PKG_OPTIONS_VAR must be defined before including bsd.options.mk. If none of
4999: PKG_SUPPORTED_OPTIONS, PKG_OPTIONS_OPTIONAL_GROUPS, and
5000: PKG_OPTIONS_REQUIRED_GROUPS are defined (as can happen with platform-specific
5001: options if none of them is supported on the current platform), PKG_OPTIONS is
5002: set to the empty list and the package is otherwise treated as not using the
5003: options framework.
5004:
5005: After the inclusion of bsd.options.mk, the variable PKG_OPTIONS contains the
5006: list of selected build options, properly filtered to remove unsupported and
5007: duplicate options.
5008:
5009: The remaining sections contain the logic that is specific to each option. The
5010: correct way to check for an option is to check whether it is listed in
5011: PKG_OPTIONS:
5012:
5013: .if !empty(PKG_OPTIONS:Moption)
5014:
1.184 rillig 5015: 16.3. Option Names
1.1 dsieger 5016:
5017: Options that enable similar features in different packages (like optional
5018: support for a library) should use a common name in all packages that support it
5019: (like the name of the library). If another package already has an option with
5020: the same meaning, use the same name.
5021:
5022: Options that enable features specific to one package, where it's unlikely that
5023: another (unrelated) package has the same (or a similar) optional feature,
5024: should use a name prefixed with pkgname-.
5025:
5026: If a group of related packages share an optional feature specific to that
5027: group, prefix it with the name of the "main" package (e. g.
5028: djbware-errno-hack).
5029:
5030: For new options, add a line to mk/defaults/options.description. Lines have two
5031: fields, separated by tab. The first field is the option name, the second its
5032: description. The description should be a whole sentence (starting with an
5033: uppercase letter and ending with a period) that describes what enabling the
5034: option does. E. g. "Enable ispell support." The file is sorted by option names.
5035:
1.184 rillig 5036: 16.4. Determining the options of dependencies
1.7 rillig 5037:
5038: When writing buildlink3.mk files, it is often necessary to list different
5039: dependencies based on the options with which the package was built. For
5040: querying these options, the file pkgsrc/mk/pkg-build-options.mk should be used.
5041: A typical example looks like this:
5042:
5043: pkgbase := libpurple
5044: .include "../../mk/pkg-build-options.mk"
5045:
5046: .if !empty(PKG_BUILD_OPTIONS.libpurple:Mdbus)
5047: ...
5048: .endif
5049:
5050: Including pkg-build-options.mk here will set the variable
5051: PKG_BUILD_OPTIONS.libpurple to the build options of the libpurple package,
5052: which can then be queried like PKG_OPTIONS in the options.mk file. See the file
5053: pkg-build-options.mk for more details.
5054:
1.184 rillig 5055: Chapter 17. Tools needed for building or running
5056:
5057: Table of Contents
5058:
5059: 17.1. Tools for pkgsrc builds
5060: 17.2. Tools needed by packages
5061: 17.3. Tools provided by platforms
5062:
5063: The USE_TOOLS definition is used both internally by pkgsrc and also for
5064: individual packages to define what commands are needed for building a package
5065: (like TOOL_DEPENDS) or for later run-time of an installed packaged (such as
5066: DEPENDS). If the native system provides an adequate tool, then in many cases, a
5067: pkgsrc package will not be used.
5068:
5069: When building a package, the replacement tools are made available in a
5070: directory (as symlinks or wrapper scripts) that is early in the executable
5071: search path. Just like the buildlink system, this helps with consistent builds.
5072:
5073: A tool may be needed to help build a specific package. For example, perl, GNU
5074: make (gmake) or yacc may be needed.
5075:
5076: Also a tool may be needed, for example, because the native system's supplied
5077: tool may be inefficient for building a package with pkgsrc. For example, a
5078: package may need GNU awk, bison (instead of yacc) or a better sed.
5079:
5080: The tools used by a package can be listed by running make show-tools.
5081:
5082: 17.1. Tools for pkgsrc builds
5083:
5084: The default set of tools used by pkgsrc is defined in bsd.pkg.mk. This includes
5085: standard Unix tools, such as: cat, awk, chmod, test, and so on. These can be
5086: seen by running: make show-var VARNAME=USE_TOOLS.
5087:
5088: If a package needs a specific program to build then the USE_TOOLS variable can
5089: be used to define the tools needed.
5090:
5091: 17.2. Tools needed by packages
5092:
5093: In the following examples, the :run means that it is needed at run-time (and
5094: becomes a DEPENDS). The default is a build dependency which can be set with
5095: :build. (So in this example, it is the same as gmake:build and
5096: pkg-config:build.)
5097:
5098: USE_TOOLS+= gmake perl:run pkg-config
5099:
5100: When using the tools framework, a TOOLS_PATH.foo variable is defined which
5101: contains the full path to the appropriate tool. For example, TOOLS_PATH.bash
5102: could be "/bin/bash" on Linux systems.
5103:
5104: If you always need a pkgsrc version of the tool at run-time, then just use
5105: DEPENDS instead.
5106:
5107: 17.3. Tools provided by platforms
5108:
5109: When improving or porting pkgsrc to a new platform, have a look at (or create)
5110: the corresponding platform specific make file fragment under pkgsrc/mk/tools/
5111: tools.${OPSYS}.mk which defines the name of the common tools. For example:
5112:
5113: .if exists(/usr/bin/bzcat)
5114: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
5115: .elif exists(/usr/bin/bzip2)
5116: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
5117: .endif
5118:
5119: TOOLS_PLATFORM.true?= true # shell builtin
5120:
5121: Chapter 18. Buildlink methodology
1.1 dsieger 5122:
5123: Table of Contents
5124:
1.184 rillig 5125: 18.1. Converting packages to use buildlink3
5126: 18.2. Writing buildlink3.mk files
5127:
5128: 18.2.1. Anatomy of a buildlink3.mk file
5129: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
5130: buildlink3.mk files
5131:
5132: 18.3. Writing builtin.mk files
5133:
5134: 18.3.1. Anatomy of a builtin.mk file
5135: 18.3.2. Global preferences for native or pkgsrc software
5136:
5137: Buildlink is a framework in pkgsrc that controls what headers and libraries are
5138: seen by a package's configure and build processes. This is implemented in a two
5139: step process:
5140:
5141: 1. Symlink headers and libraries for dependencies into BUILDLINK_DIR, which by
5142: default is a subdirectory of WRKDIR.
5143:
5144: 2. Create wrapper scripts that are used in place of the normal compiler tools
5145: that translate -I${LOCALBASE}/include and -L${LOCALBASE}/lib into
5146: references to BUILDLINK_DIR. The wrapper scripts also make native compiler
5147: on some operating systems look like GCC, so that packages that expect GCC
5148: won't require modifications to build with those native compilers.
5149:
5150: This normalizes the environment in which a package is built so that the package
5151: may be built consistently despite what other software may be installed. Please
5152: note that the normal system header and library paths, e.g. /usr/include, /usr/
5153: lib, etc., are always searched -- buildlink3 is designed to insulate the
5154: package build from non-system-supplied software.
5155:
5156: 18.1. Converting packages to use buildlink3
1.1 dsieger 5157:
1.184 rillig 5158: The process of converting packages to use the buildlink3 framework ("bl3ifying"
5159: ) is fairly straightforward. The things to keep in mind are:
1.1 dsieger 5160:
1.184 rillig 5161: 1. Ensure that the build always calls the wrapper scripts instead of the
5162: actual toolchain. Some packages are tricky, and the only way to know for
5163: sure is the check ${WRKDIR}/.work.log to see if the wrappers are being
5164: invoked.
1.1 dsieger 5165:
1.184 rillig 5166: 2. Don't override PREFIX from within the package Makefile, e.g. Java VMs,
5167: standalone shells, etc., because the code to symlink files into $
5168: {BUILDLINK_DIR} looks for files relative to "pkg_info -qp pkgname".
1.1 dsieger 5169:
1.184 rillig 5170: 3. Remember that only the buildlink3.mk files that you list in a package's
5171: Makefile are added as dependencies for that package.
1.1 dsieger 5172:
1.184 rillig 5173: If a dependency on a particular package is required for its libraries and
5174: headers, then we replace:
1.1 dsieger 5175:
1.184 rillig 5176: DEPENDS+= foo>=1.1.0:../../category/foo
1.1 dsieger 5177:
1.184 rillig 5178: with
1.1 dsieger 5179:
1.184 rillig 5180: .include "../../category/foo/buildlink3.mk"
1.1 dsieger 5181:
1.184 rillig 5182: The buildlink3.mk files usually define the required dependencies. If you need a
5183: newer version of the dependency when using buildlink3.mk files, then you can
5184: define it in your Makefile; for example:
1.1 dsieger 5185:
1.184 rillig 5186: BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0
5187: .include "../../category/foo/buildlink3.mk"
1.1 dsieger 5188:
1.184 rillig 5189: There are several buildlink3.mk files in pkgsrc/mk that handle special package
5190: issues:
1.1 dsieger 5191:
1.184 rillig 5192: * bdb.buildlink3.mk chooses either the native or a pkgsrc Berkeley DB
5193: implementation based on the values of BDB_ACCEPTED and BDB_DEFAULT.
1.1 dsieger 5194:
1.184 rillig 5195: * curses.buildlink3.mk: If the system comes with neither Curses nor NCurses,
5196: this will take care to install the devel/ncurses package.
1.1 dsieger 5197:
1.184 rillig 5198: * krb5.buildlink3.mk uses the value of KRB5_ACCEPTED to choose between adding
5199: a dependency on Heimdal or MIT-krb5 for packages that require a Kerberos 5
5200: implementation.
1.1 dsieger 5201:
1.184 rillig 5202: * motif.buildlink3.mk checks for a system-provided Motif installation or adds
5203: a dependency on x11/lesstif or x11/motif. The user can set MOTIF_TYPE to "
5204: dt", "lesstif" or "motif" to choose which Motif version will be used.
1.1 dsieger 5205:
1.184 rillig 5206: * readline.buildlink3.mk checks for a system-provided GNU readline or
5207: editline (libedit) installation, or adds a dependency on devel/readline,
5208: devel/editline. The user can set READLINE_DEFAULT to choose readline
5209: implementation. If your package really needs GNU readline library, its
5210: Makefile should include devel/readline/buildlink3.mk instead of
5211: readline.buildlink3.mk.
1.1 dsieger 5212:
1.184 rillig 5213: * oss.buildlink3.mk defines several variables that may be used by packages
5214: that use the Open Sound System (OSS) API.
1.1 dsieger 5215:
1.184 rillig 5216: * pgsql.buildlink3.mk will accept any of the Postgres versions in the
5217: variable PGSQL_VERSIONS_ACCEPTED and default to the version
5218: PGSQL_VERSION_DEFAULT. See the file for more information.
1.1 dsieger 5219:
1.184 rillig 5220: * pthread.buildlink3.mk uses the value of PTHREAD_OPTS and checks for native
5221: pthreads or adds a dependency on devel/pth as needed.
1.1 dsieger 5222:
1.184 rillig 5223: * xaw.buildlink3.mk uses the value of XAW_TYPE to choose a particular Athena
5224: widgets library.
1.1 dsieger 5225:
1.184 rillig 5226: The comments in those buildlink3.mk files provide a more complete description
5227: of how to use them properly.
1.1 dsieger 5228:
1.184 rillig 5229: 18.2. Writing buildlink3.mk files
1.1 dsieger 5230:
1.184 rillig 5231: A package's buildlink3.mk file is included by Makefiles to indicate the need to
5232: compile and link against header files and libraries provided by the package. A
5233: buildlink3.mk file should always provide enough information to add the correct
5234: type of dependency relationship and include any other buildlink3.mk files that
5235: it needs to find headers and libraries that it needs in turn.
1.1 dsieger 5236:
1.184 rillig 5237: To generate an initial buildlink3.mk file for further editing, Rene Hexel's
5238: pkgtools/createbuildlink package is highly recommended. For most packages, the
5239: following command will generate a good starting point for buildlink3.mk files:
1.1 dsieger 5240:
1.184 rillig 5241: % cd pkgsrc/category/pkgdir
5242: % createbuildlink >buildlink3.mk
1.1 dsieger 5243:
5244:
1.184 rillig 5245: 18.2.1. Anatomy of a buildlink3.mk file
1.1 dsieger 5246:
1.184 rillig 5247: The following real-life example buildlink3.mk is taken from pkgsrc/graphics/
5248: tiff:
1.14 jmcneill 5249:
1.184 rillig 5250: BUILDLINK_TREE+= tiff
1.1 dsieger 5251:
1.184 rillig 5252: .if !defined(TIFF_BUILDLINK3_MK)
5253: TIFF_BUILDLINK3_MK:=
1.1 dsieger 5254:
1.184 rillig 5255: BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1
5256: BUILDLINK_ABI_DEPENDS.tiff+= tiff>=3.7.2nb1
5257: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
1.1 dsieger 5258:
1.184 rillig 5259: .include "../../devel/zlib/buildlink3.mk"
5260: .include "../../graphics/jpeg/buildlink3.mk"
5261: .endif # TIFF_BUILDLINK3_MK
1.1 dsieger 5262:
1.184 rillig 5263: BUILDLINK_TREE+= -tiff
1.1 dsieger 5264:
1.184 rillig 5265: The header and footer manipulate BUILDLINK_TREE, which is common across all
5266: buildlink3.mk files and is used to track the dependency tree.
1.1 dsieger 5267:
1.184 rillig 5268: The main section is protected from multiple inclusion and controls how the
5269: dependency on pkg is added. Several important variables are set in the section:
1.1 dsieger 5270:
1.185 wiz 5271: * BUILDLINK_API_DEPENDS.pkg is the dependency version recorded in the
1.184 rillig 5272: installed package; this should always be set using += to ensure that we're
5273: appending to any pre-existing list of values. This variable should be set
1.185 wiz 5274: to the last version of the package that had an backwards-incompatible API
1.184 rillig 5275: change.
1.1 dsieger 5276:
1.184 rillig 5277: * BUILDLINK_PKGSRCDIR.pkg is the location of the pkg pkgsrc directory.
1.1 dsieger 5278:
1.184 rillig 5279: * BUILDLINK_DEPMETHOD.pkg (not shown above) controls whether we use
5280: BUILD_DEPENDS or DEPENDS to add the dependency on pkg. The build dependency
5281: is selected by setting BUILDLINK_DEPMETHOD.pkg to "build". By default, the
5282: full dependency is used.
1.1 dsieger 5283:
1.184 rillig 5284: * BUILDLINK_INCDIRS.pkg and BUILDLINK_LIBDIRS.pkg (not shown above) are lists
5285: of subdirectories of ${BUILDLINK_PREFIX.pkg} to add to the header and
5286: library search paths. These default to "include" and "lib" respectively.
1.1 dsieger 5287:
1.184 rillig 5288: * BUILDLINK_CPPFLAGS.pkg (not shown above) is the list of preprocessor flags
5289: to add to CPPFLAGS, which are passed on to the configure and build phases.
5290: The "-I" option should be avoided and instead be handled using
5291: BUILDLINK_INCDIRS.pkg as above.
1.66 asau 5292:
1.184 rillig 5293: The following variables are all optionally defined within this second section
5294: (protected against multiple inclusion) and control which package files are
5295: symlinked into ${BUILDLINK_DIR} and how their names are transformed during the
5296: symlinking:
1.23 jakllsch 5297:
1.184 rillig 5298: * BUILDLINK_FILES.pkg (not shown above) is a shell glob pattern relative to $
5299: {BUILDLINK_PREFIX.pkg} to be symlinked into ${BUILDLINK_DIR}, e.g. include/
5300: *.h.
1.1 dsieger 5301:
1.184 rillig 5302: * BUILDLINK_FILES_CMD.pkg (not shown above) is a shell pipeline that outputs
5303: to stdout a list of files relative to ${BUILDLINK_PREFIX.pkg}. The
5304: resulting files are to be symlinked into ${BUILDLINK_DIR}. By default, this
5305: takes the +CONTENTS of a pkg and filters it through $
5306: {BUILDLINK_CONTENTS_FILTER.pkg}.
1.1 dsieger 5307:
1.184 rillig 5308: * BUILDLINK_CONTENTS_FILTER.pkg (not shown above) is a filter command that
5309: filters +CONTENTS input into a list of files relative to $
5310: {BUILDLINK_PREFIX.pkg} on stdout. By default, BUILDLINK_CONTENTS_FILTER.pkg
5311: outputs the contents of the include and lib directories in the package
5312: +CONTENTS.
1.1 dsieger 5313:
1.184 rillig 5314: * BUILDLINK_FNAME_TRANSFORM.pkg (not shown above) is a list of sed arguments
5315: used to transform the name of the source filename into a destination
5316: filename, e.g. -e "s|/curses.h|/ncurses.h|g".
1.1 dsieger 5317:
1.184 rillig 5318: This section can additionally include any buildlink3.mk needed for pkg's
5319: library dependencies. Including these buildlink3.mk files means that the
5320: headers and libraries for these dependencies are also symlinked into $
5321: {BUILDLINK_DIR} whenever the pkg buildlink3.mk file is included. Dependencies
5322: are only added for directly include buildlink3.mk files.
1.1 dsieger 5323:
1.184 rillig 5324: When providing a buildlink3.mk and including other buildlink3.mk files in it,
5325: please only add necessary ones, i.e., those whose libraries or header files are
5326: automatically exposed when the package is use.
1.1 dsieger 5327:
1.184 rillig 5328: In particular, if only an executable (bin/foo) is linked against a library,
5329: that library does not need to be propagated in the buildlink3.mk file.
1.1 dsieger 5330:
1.184 rillig 5331: The following steps should help you decide if a buildlink3.mk file needs to be
5332: included:
1.1 dsieger 5333:
1.184 rillig 5334: * Look at the installed header files: What headers do they include? The
5335: packages providing these files must be buildlinked.
1.1 dsieger 5336:
1.184 rillig 5337: * Run ldd on all installed libraries and look against what other libraries
5338: they link. Some of the packages providing these probably need to be
5339: buildlinked; however, it's not automatic, since e.g. GTK on some systems
5340: pulls in the X libraries, so they will show up in the ldd output, while on
5341: others (like OS X) it won't. ldd output can thus only be used as a hint.
1.1 dsieger 5342:
1.184 rillig 5343: 18.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
5344: buildlink3.mk files
1.16 jnemeth 5345:
1.185 wiz 5346: Both variables set lower bounds for a version of this package. The two
5347: variables differ in that one describes source compatibility (API) and the other
5348: binary compatibility (ABI). The difference is that a change in the API breaks
5349: compilation of programs while changes in the ABI stop compiled programs from
5350: running.
5351:
5352: The BUILDLINK_API_DEPENDS.pkg variable in a buildlink3.mk should be changed
5353: very rarely. (One possible scenario: If all packages using this package need a
5354: higher version than defined in the buildlink3.mk, BUILDLINK_API_DEPENDS.pkg
5355: could be updated to that higher version.)
5356:
5357: On the other hand, changes to BUILDLINK_ABI_DEPENDS.pkg are more common. The
5358: variable will need to be updated every time the major version of one of its
5359: shared libraries is changed, or any other change where a binary built against
5360: the previous version of the package will not run against the new version any
5361: longer.
5362:
5363: In such a case, the package's BUILDLINK_ABI_DEPENDS.pkg must be increased to
5364: require the new package version. Then the PKGREVISION of all packages foo that
5365: depend on this package need to be increased, and if they have buildlink3.mk
5366: files, BUILDLINK_ABI_DEPENDS.foo in their buildlink3.mk files must be increased
5367: to the new version as well. This is required so that a package will pull in the
5368: versions of the packages that use the new ABI and that the packages'
5369: PKGREVISIONs uniquely identify the packages built against the new ABI. The
5370: pkgtools/revbump package can help with these updates.
1.1 dsieger 5371:
1.184 rillig 5372: See Section 21.1.5, "Handling dependencies" for more information about
1.185 wiz 5373: dependencies on other packages, including the BUILDLINK_API_DEPENDS
5374: definitions.
1.1 dsieger 5375:
1.184 rillig 5376: Please take careful consideration before adjusting BUILDLINK_API_DEPENDS.pkg or
1.185 wiz 5377: BUILDLINK_ABI_DEPENDS.pkg in a buildlink3.mk file as we don't want to cause
5378: unneeded package deletions and rebuilds. In many cases, new versions of
5379: packages work just fine with older dependencies.
1.1 dsieger 5380:
1.211 gutterid 5381: Also, it is not needed to set BUILDLINK_ABI_DEPENDS.pkg when it is identical to
1.184 rillig 5382: BUILDLINK_API_DEPENDS.pkg.
1.1 dsieger 5383:
1.211 gutterid 5384: Note there is also the distinction that users are able to disable enforcement
5385: of ABI dependencies using the USE_ABI_DEPENDS variable, but there is no
5386: equivalent option for API dependencies.
5387:
1.184 rillig 5388: 18.3. Writing builtin.mk files
1.1 dsieger 5389:
1.184 rillig 5390: Some packages in pkgsrc install headers and libraries that coincide with
5391: headers and libraries present in the base system. Aside from a buildlink3.mk
5392: file, these packages should also include a builtin.mk file that includes the
5393: necessary checks to decide whether using the built-in software or the pkgsrc
5394: software is appropriate.
1.1 dsieger 5395:
1.184 rillig 5396: The only requirements of a builtin.mk file for pkg are:
1.1 dsieger 5397:
1.184 rillig 5398: 1. It should set USE_BUILTIN.pkg to either "yes" or "no" after it is included.
1.1 dsieger 5399:
1.184 rillig 5400: 2. It should not override any USE_BUILTIN.pkg which is already set before the
5401: builtin.mk file is included.
1.1 dsieger 5402:
1.184 rillig 5403: 3. It should be written to allow multiple inclusion. This is very important
5404: and takes careful attention to Makefile coding.
1.1 dsieger 5405:
1.184 rillig 5406: 18.3.1. Anatomy of a builtin.mk file
1.1 dsieger 5407:
1.184 rillig 5408: The following is the recommended template for builtin.mk files:
1.1 dsieger 5409:
1.184 rillig 5410: .if !defined(IS_BUILTIN.foo)
5411: #
5412: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
5413: # genuinely exists in the system or not.
5414: #
5415: IS_BUILTIN.foo?= no
1.1 dsieger 5416:
1.184 rillig 5417: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
5418: # version can be determined.
5419: #
5420: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
5421: BUILTIN_PKG.foo?= foo-1.0
5422: . endif
5423: .endif # IS_BUILTIN.foo
1.1 dsieger 5424:
1.184 rillig 5425: .if !defined(USE_BUILTIN.foo)
5426: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
5427: . if defined(BUILTIN_PKG.foo)
5428: . for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
5429: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
5430: USE_BUILTIN.foo!= \
5431: ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \
5432: && ${ECHO} "yes" || ${ECHO} "no"
5433: . endif
5434: . endfor
5435: . endif
5436: .endif # USE_BUILTIN.foo
1.1 dsieger 5437:
1.184 rillig 5438: CHECK_BUILTIN.foo?= no
5439: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
5440: #
5441: # Here we place code that depends on whether USE_BUILTIN.foo is set to
5442: # "yes" or "no".
5443: #
5444: .endif # CHECK_BUILTIN.foo
1.1 dsieger 5445:
1.184 rillig 5446: The first section sets IS_BUILTIN.pkg depending on if pkg really exists in the
5447: base system. This should not be a base system software with similar
5448: functionality to pkg; it should only be "yes" if the actual package is included
5449: as part of the base system. This variable is only used internally within the
5450: builtin.mk file.
1.1 dsieger 5451:
1.184 rillig 5452: The second section sets BUILTIN_PKG.pkg to the version of pkg in the base
5453: system if it exists (if IS_BUILTIN.pkg is "yes"). This variable is only used
5454: internally within the builtin.mk file.
1.1 dsieger 5455:
1.184 rillig 5456: The third section sets USE_BUILTIN.pkg and is required in all builtin.mk files.
5457: The code in this section must make the determination whether the built-in
5458: software is adequate to satisfy the dependencies listed in
5459: BUILDLINK_API_DEPENDS.pkg. This is typically done by comparing BUILTIN_PKG.pkg
5460: against each of the dependencies in BUILDLINK_API_DEPENDS.pkg. USE_BUILTIN.pkg
5461: must be set to the correct value by the end of the builtin.mk file. Note that
5462: USE_BUILTIN.pkg may be "yes" even if IS_BUILTIN.pkg is "no" because we may make
5463: the determination that the built-in version of the software is similar enough
5464: to be used as a replacement.
1.1 dsieger 5465:
1.184 rillig 5466: The last section is guarded by CHECK_BUILTIN.pkg, and includes code that uses
5467: the value of USE_BUILTIN.pkg set in the previous section. This typically
5468: includes, e.g., adding additional dependency restrictions and listing
5469: additional files to symlink into ${BUILDLINK_DIR} (via BUILDLINK_FILES.pkg).
1.1 dsieger 5470:
1.184 rillig 5471: 18.3.2. Global preferences for native or pkgsrc software
1.1 dsieger 5472:
1.184 rillig 5473: When building packages, it's possible to choose whether to set a global
5474: preference for using either the built-in (native) version or the pkgsrc version
5475: of software to satisfy a dependency. This is controlled by setting
5476: PREFER_PKGSRC and PREFER_NATIVE. These variables take values of either "yes", "
5477: no", or a list of packages. PREFER_PKGSRC tells pkgsrc to use the pkgsrc
5478: versions of software, while PREFER_NATIVE tells pkgsrc to use the built-in
5479: versions. Preferences are determined by the most specific instance of the
5480: package in either PREFER_PKGSRC or PREFER_NATIVE. If a package is specified in
5481: neither or in both variables, then PREFER_PKGSRC has precedence over
5482: PREFER_NATIVE. For example, to require using pkgsrc versions of software for
5483: all but the most basic bits on a NetBSD system, you can set:
1.1 dsieger 5484:
1.184 rillig 5485: PREFER_PKGSRC= yes
5486: PREFER_NATIVE= getopt skey tcp_wrappers
1.1 dsieger 5487:
1.184 rillig 5488: A package must have a builtin.mk file to be listed in PREFER_NATIVE, otherwise
5489: it is simply ignored in that list.
1.1 dsieger 5490:
1.191 bacon 5491: PREFER_PKGSRC and PREFER_NATIVE should be set during bootstrap to ensure that
5492: the bootstrap process does not use inapropriate native tools as dependencies
5493: for core packages.
5494:
5495: # ./bootstrap --prefer-pkgsrc yes --prefer-native openssl
5496:
5497: Switching between settings globally at a later date can introduce complications
5498: with dependency resolution. This is caused by packages built with the opposite
5499: preference being installed alongside each other. Hence, any changes to these
5500: variables after bootstrap will necessitate rebuilding all packages depending on
5501: one whose preference has been changed. This is not trivial and should be
5502: avoided.
5503:
5504: When using pkgsrc on Linux systems, there is high risk of "leakage", where
5505: programs installed by pkgsrc may inadvertently use a command or library not
5506: installed by pkgsrc, e.g. those installed by yum or apt. Such foreign
5507: dependencies may be installed, removed, or upgraded to a version incompatible
5508: with the pkgsrc package at any time, causing pkgsrc packages to subsequently
5509: malfunction. Pkgsrc cannot prevent this, as it has no control over other
5510: package managers. Another potential problem is that under Redhat Enterprise and
5511: related Linux systems, yum packages are only patched and never upgraded, so
5512: eventually they may become too outdated for use by pkgsrc. Even intentionally
5513: using foreign dependencies, not considered leakage, can lead to these problems,
5514: so it is generally discouraged. In order to minimize such problems,
5515: PREFER_PKGSRC defaults to "yes" on Linux systems. This ensures that pkgsrc is
5516: aware of any changes to dependency packages and can rebuild or upgrade the
5517: entire dependency tree as needed. This default can be overridden by setting
5518: --prefer-pkgsrc to "no" or a list of packages, or by setting --prefer-native to
5519: "yes".
1.1 dsieger 5520:
1.184 rillig 5521: Chapter 19. PLIST issues
1.1 dsieger 5522:
1.184 rillig 5523: Table of Contents
1.1 dsieger 5524:
1.184 rillig 5525: 19.1. RCS ID
5526: 19.2. Semi-automatic PLIST generation
5527: 19.3. Tweaking output of make print-PLIST
5528: 19.4. Variable substitution in PLIST
5529: 19.5. Man page compression
5530: 19.6. Changing PLIST source with PLIST_SRC
5531: 19.7. Platform-specific and differing PLISTs
5532: 19.8. Build-specific PLISTs
5533: 19.9. Sharing directories between packages
1.1 dsieger 5534:
1.184 rillig 5535: The PLIST file contains a package's "packing list", i.e. a list of files that
5536: belong to the package (relative to the ${PREFIX} directory it's been installed
5537: in) plus some additional statements - see the pkg_create(1) man page for a full
5538: list. This chapter addresses some issues that need attention when dealing with
5539: the PLIST file (or files, see below!).
1.1 dsieger 5540:
1.184 rillig 5541: 19.1. RCS ID
1.1 dsieger 5542:
1.184 rillig 5543: Be sure to add a RCS ID line as the first thing in any PLIST file you write:
1.1 dsieger 5544:
1.184 rillig 5545: @comment $NetBSD $
1.1 dsieger 5546:
1.184 rillig 5547: An artificial space has been added between NetBSD and $, this is a workaround
5548: here to prevent CVS expanding to the filename of the guide. When adding the RCS
5549: ID the space should be omitted.
1.38 wiz 5550:
1.184 rillig 5551: 19.2. Semi-automatic PLIST generation
1.1 dsieger 5552:
1.184 rillig 5553: You can use the make print-PLIST command to output a PLIST that matches any new
5554: files since the package was extracted. See Section 13.17, "Other helpful
5555: targets" for more information on this target.
1.11 rillig 5556:
1.184 rillig 5557: 19.3. Tweaking output of make print-PLIST
1.1 dsieger 5558:
1.184 rillig 5559: The PRINT_PLIST_AWK variable takes a set of AWK patterns and actions that are
5560: used to filter the output of print-PLIST. You can append any chunk of AWK
5561: scripting you like to it, but be careful with quoting.
1.1 dsieger 5562:
1.184 rillig 5563: For example, to get all files inside the libdata/foo directory removed from the
5564: resulting PLIST:
1.1 dsieger 5565:
1.184 rillig 5566: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.1 dsieger 5567:
1.185 wiz 5568: The PRINT_PLIST_AWK transformations are evaluated after the file list and
5569: directory list are sorted. EARLY_PRINT_PLIST_AWK is like PRINT_PLIST_AWK except
5570: it operates before the file list and directory list are sorted.
5571:
1.184 rillig 5572: 19.4. Variable substitution in PLIST
1.1 dsieger 5573:
1.184 rillig 5574: A number of variables are substituted automatically in PLISTs when a package is
5575: installed on a system. This includes the following variables:
1.1 dsieger 5576:
1.184 rillig 5577: ${MACHINE_ARCH}, ${MACHINE_GNU_ARCH}
1.1 dsieger 5578:
1.184 rillig 5579: Some packages like emacs and perl embed information about which
5580: architecture they were built on into the pathnames where they install their
5581: files. To handle this case, PLIST will be preprocessed before actually
5582: used, and the symbol "${MACHINE_ARCH}" will be replaced by what uname -p
5583: gives. The same is done if the string ${MACHINE_GNU_ARCH} is embedded in
5584: PLIST somewhere - use this on packages that have GNU autoconf-created
5585: configure scripts.
1.1 dsieger 5586:
1.184 rillig 5587: Legacy note
1.1 dsieger 5588:
1.184 rillig 5589: There used to be a symbol "$ARCH" that was replaced by the output of uname
5590: -m, but that's no longer supported and has been removed.
1.1 dsieger 5591:
1.184 rillig 5592: ${OPSYS}, ${LOWER_OPSYS}, ${OS_VERSION}
1.1 dsieger 5593:
1.184 rillig 5594: Some packages want to embed the OS name and version into some paths. To do
5595: this, use these variables in the PLIST:
1.1 dsieger 5596:
1.184 rillig 5597: + ${OPSYS} - output of "uname -s"
1.1 dsieger 5598:
1.184 rillig 5599: + ${LOWER_OPSYS} - lowercase common name (eg. "solaris")
1.1 dsieger 5600:
1.184 rillig 5601: + ${OS_VERSION} - "uname -r"
1.1 dsieger 5602:
1.184 rillig 5603: For a list of values which are replaced by default, the output of make help
5604: topic=PLIST_SUBST as well as searching the pkgsrc/mk directory with grep for
5605: PLIST_SUBST should help.
1.1 dsieger 5606:
1.184 rillig 5607: If you want to change other variables not listed above, you can add variables
5608: and their expansions to this variable in the following way, similar to
5609: MESSAGE_SUBST (see Section 12.5, "Optional files"):
1.1 dsieger 5610:
1.184 rillig 5611: PLIST_SUBST+= SOMEVAR="somevalue"
1.1 dsieger 5612:
1.184 rillig 5613: This replaces all occurrences of "${SOMEVAR}" in the PLIST with "somevalue".
1.1 dsieger 5614:
1.184 rillig 5615: The PLIST_VARS variable can be used to simplify the common case of
5616: conditionally including some PLIST entries. It can be done by adding
5617: PLIST_VARS+=foo and setting the corresponding PLIST.foo variable to yes if the
5618: entry should be included. This will substitute "${PLIST.foo}" in the PLIST with
5619: either """" or ""@comment "". For example, in Makefile:
1.1 dsieger 5620:
1.184 rillig 5621: PLIST_VARS+= foo
5622: .if condition
5623: PLIST.foo= yes
5624: .else
1.1 dsieger 5625:
1.184 rillig 5626: And then in PLIST:
1.1 dsieger 5627:
1.184 rillig 5628: @comment $NetBSD $
5629: bin/bar
5630: man/man1/bar.1
5631: ${PLIST.foo}bin/foo
5632: ${PLIST.foo}man/man1/foo.1
5633: ${PLIST.foo}share/bar/foo.data
1.1 dsieger 5634:
1.184 rillig 5635: An artificial space has been added between NetBSD and $, this is a workaround
5636: here to prevent CVS expanding to the filename of the guide. When adding the RCS
1.195 gutterid 5637: ID the space should be omitted.
1.1 dsieger 5638:
1.184 rillig 5639: 19.5. Man page compression
1.1 dsieger 5640:
1.184 rillig 5641: Man pages should be installed in compressed form if MANZ is set (in
5642: bsd.own.mk), and uncompressed otherwise. To handle this in the PLIST file, the
5643: suffix ".gz" is appended/removed automatically for man pages according to MANZ
5644: and MANCOMPRESSED being set or not, see above for details. This modification of
5645: the PLIST file is done on a copy of it, not PLIST itself.
1.100 leot 5646:
1.184 rillig 5647: 19.6. Changing PLIST source with PLIST_SRC
1.100 leot 5648:
1.184 rillig 5649: To use one or more files as source for the PLIST used in generating the binary
5650: package, set the variable PLIST_SRC to the names of that file(s). The files are
5651: later concatenated using cat(1), and the order of things is important. The
5652: default for PLIST_SRC is ${PKGDIR}/PLIST.
1.1 dsieger 5653:
1.184 rillig 5654: 19.7. Platform-specific and differing PLISTs
1.1 dsieger 5655:
1.184 rillig 5656: Some packages decide to install a different set of files based on the operating
5657: system being used. These differences can be automatically handled by using the
5658: following files:
1.1 dsieger 5659:
1.184 rillig 5660: * PLIST.common
1.1 dsieger 5661:
1.184 rillig 5662: * PLIST.${OPSYS}
1.1 dsieger 5663:
1.184 rillig 5664: * PLIST.${MACHINE_ARCH}
1.1 dsieger 5665:
1.184 rillig 5666: * PLIST.${OPSYS}-${MACHINE_ARCH}
1.1 dsieger 5667:
1.184 rillig 5668: * PLIST.common_end
1.1 dsieger 5669:
1.184 rillig 5670: 19.8. Build-specific PLISTs
1.1 dsieger 5671:
1.184 rillig 5672: Some packages decide to generate hard-to-guess file names during installation
5673: that are hard to wire down.
1.1 dsieger 5674:
1.184 rillig 5675: In such cases, you can set the GENERATE_PLIST variable to shell code terminated
5676: (with a semicolon) that will output PLIST entries which will be appended to the
5677: PLIST
1.1 dsieger 5678:
1.184 rillig 5679: You can find one example in editors/xemacs:
1.1 dsieger 5680:
1.184 rillig 5681: GENERATE_PLIST+= ${ECHO} bin/${DISTNAME}-`${WRKSRC}/src/xemacs -sd`.dmp ;
1.1 dsieger 5682:
1.184 rillig 5683: which will append something like bin/xemacs-21.4.23-54e8ea71.dmp to the PLIST.
1.1 dsieger 5684:
1.184 rillig 5685: 19.9. Sharing directories between packages
1.1 dsieger 5686:
1.184 rillig 5687: A "shared directory" is a directory where multiple (and unrelated) packages
5688: install files. These directories were problematic because you had to add
5689: special tricks in the PLIST to conditionally remove them, or have some
5690: centralized package handle them.
1.106 tnn 5691:
1.184 rillig 5692: In pkgsrc, it is now easy: Each package should create directories and install
5693: files as needed; pkg_delete will remove any directories left empty after
5694: uninstalling a package.
1.106 tnn 5695:
1.184 rillig 5696: If a package needs an empty directory to work, create the directory during
5697: installation as usual, and also add an entry to the PLIST:
1.1 dsieger 5698:
1.184 rillig 5699: @pkgdir path/to/empty/directory
1.1 dsieger 5700:
1.184 rillig 5701: or take a look at MAKE_DIRS and OWN_DIRS.
1.1 dsieger 5702:
1.184 rillig 5703: Chapter 20. The pkginstall framework
1.1 dsieger 5704:
1.184 rillig 5705: Table of Contents
1.1 dsieger 5706:
1.184 rillig 5707: 20.1. Files and directories outside the installation prefix
1.1 dsieger 5708:
1.184 rillig 5709: 20.1.1. Directory manipulation
5710: 20.1.2. File manipulation
1.1 dsieger 5711:
1.184 rillig 5712: 20.2. Configuration files
1.1 dsieger 5713:
1.184 rillig 5714: 20.2.1. How PKG_SYSCONFDIR is set
5715: 20.2.2. Telling the software where configuration files are
5716: 20.2.3. Patching installations
5717: 20.2.4. Disabling handling of configuration files
1.1 dsieger 5718:
1.184 rillig 5719: 20.3. System startup scripts
1.1 dsieger 5720:
1.184 rillig 5721: 20.3.1. Disabling handling of system startup scripts
1.1 dsieger 5722:
1.184 rillig 5723: 20.4. System users and groups
5724: 20.5. System shells
1.1 dsieger 5725:
1.184 rillig 5726: 20.5.1. Disabling shell registration
1.1 dsieger 5727:
1.184 rillig 5728: 20.6. Fonts
1.1 dsieger 5729:
1.184 rillig 5730: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 5731:
1.184 rillig 5732: This chapter describes the framework known as pkginstall, whose key features
5733: are:
1.1 dsieger 5734:
1.184 rillig 5735: * Generic installation and manipulation of directories and files outside the
5736: pkgsrc-handled tree, LOCALBASE.
1.1 dsieger 5737:
1.184 rillig 5738: * Automatic handling of configuration files during installation, provided
5739: that packages are correctly designed.
1.1 dsieger 5740:
1.184 rillig 5741: * Generation and installation of system startup scripts.
1.1 dsieger 5742:
1.184 rillig 5743: * Registration of system users and groups.
1.1 dsieger 5744:
1.184 rillig 5745: * Registration of system shells.
1.1 dsieger 5746:
1.184 rillig 5747: * Automatic updating of fonts databases.
1.1 dsieger 5748:
1.184 rillig 5749: The following sections inspect each of the above points in detail.
1.1 dsieger 5750:
1.184 rillig 5751: You may be thinking that many of the things described here could be easily done
5752: with simple code in the package's post-installation target (post-install). This
5753: is incorrect, as the code in them is only executed when building from source.
5754: Machines using binary packages could not benefit from it at all (as the code
5755: itself could be unavailable). Therefore, the only way to achieve any of the
5756: items described above is by means of the installation scripts, which are
5757: automatically generated by pkginstall.
1.1 dsieger 5758:
1.184 rillig 5759: 20.1. Files and directories outside the installation prefix
1.95 wiz 5760:
1.184 rillig 5761: As you already know, the PLIST file holds a list of files and directories that
5762: belong to a package. The names used in it are relative to the installation
5763: prefix (${PREFIX}), which means that it cannot register files outside this
5764: directory (absolute path names are not allowed). Despite this restriction, some
5765: packages need to install files outside this location; e.g., under ${VARBASE} or
5766: ${PKG_SYSCONFDIR}. The only way to achieve this is to create such files during
5767: installation time by using installation scripts.
1.95 wiz 5768:
1.184 rillig 5769: The generic installation scripts are shell scripts that can contain arbitrary
5770: code. The list of scripts to execute is taken from the INSTALL_FILE variable,
5771: which defaults to INSTALL. A similar variable exists for package removal
5772: (DEINSTALL_FILE, whose default is DEINSTALL). These scripts can run arbitrary
5773: commands, so they have the potential to create and manage files anywhere in the
5774: file system.
1.95 wiz 5775:
1.184 rillig 5776: Using these general installation files is not recommended, but may be needed in
5777: some special cases. One reason for avoiding them is that the user has to trust
5778: the packager that there is no unwanted or simply erroneous code included in the
5779: installation script. Also, previously there were many similar scripts for the
5780: same functionality, and fixing a common error involved finding and changing all
5781: of them.
1.95 wiz 5782:
1.184 rillig 5783: The pkginstall framework offers another, standardized way. It provides generic
5784: scripts to abstract the manipulation of such files and directories based on
5785: variables set in the package's Makefile. The rest of this section describes
5786: these variables.
1.1 dsieger 5787:
1.184 rillig 5788: 20.1.1. Directory manipulation
1.1 dsieger 5789:
1.184 rillig 5790: The following variables can be set to request the creation of directories
5791: anywhere in the file system:
1.1 dsieger 5792:
1.184 rillig 5793: * MAKE_DIRS and OWN_DIRS contain a list of directories that should be created
5794: and should attempt to be destroyed by the installation scripts. The
5795: difference between the two is that the latter prompts the administrator to
5796: remove any directories that may be left after deinstallation (because they
5797: were not empty), while the former does not. Example:
1.1 dsieger 5798:
1.184 rillig 5799: MAKE_DIRS+= ${VARBASE}/foo/private
1.1 dsieger 5800:
1.184 rillig 5801: * MAKE_DIRS_PERMS and OWN_DIRS_PERMS contain a list of tuples describing
5802: which directories should be created and should attempt to be destroyed by
5803: the installation scripts. Each tuple holds the following values, separated
5804: by spaces: the directory name, its owner, its group and its numerical mode.
5805: For example:
1.1 dsieger 5806:
1.184 rillig 5807: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private \
5808: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 5809:
1.184 rillig 5810: The difference between the two is exactly the same as their non-PERMS
5811: counterparts.
1.1 dsieger 5812:
1.184 rillig 5813: 20.1.2. File manipulation
1.1 dsieger 5814:
1.184 rillig 5815: Creating non-empty files outside the installation prefix is tricky because the
5816: PLIST forces all files to be inside it. To overcome this problem, the only
5817: solution is to extract the file in the known place (i.e., inside the
5818: installation prefix) and copy it to the appropriate location during
5819: installation (done by the installation scripts generated by pkginstall). We
5820: will call the former the master file in the following paragraphs, which
5821: describe the variables that can be used to automatically and consistently
5822: handle files outside the installation prefix:
1.1 dsieger 5823:
1.184 rillig 5824: * CONF_FILES and REQD_FILES are pairs of master and target files. During
5825: installation time, the master file is copied to the target one if and only
5826: if the latter does not exist. Upon deinstallation, the target file is
5827: removed provided that it was not modified by the installation.
1.1 dsieger 5828:
1.184 rillig 5829: The difference between the two is that the latter prompts the administrator
5830: to remove any files that may be left after deinstallation (because they
5831: were not empty), while the former does not.
1.1 dsieger 5832:
1.184 rillig 5833: * CONF_FILES_PERMS and REQD_FILES_PERMS contain tuples describing master
5834: files as well as their target locations. For each of them, it also
5835: specifies their owner, their group and their numeric permissions, in this
5836: order. For example:
1.1 dsieger 5837:
1.184 rillig 5838: REQD_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile \
5839: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1 dsieger 5840:
1.184 rillig 5841: The difference between the two is exactly the same as their non-PERMS
5842: counterparts.
1.1 dsieger 5843:
1.184 rillig 5844: 20.2. Configuration files
1.1 dsieger 5845:
1.184 rillig 5846: Configuration files are special in the sense that they are installed in their
5847: own specific directory, PKG_SYSCONFDIR, and need special treatment during
5848: installation (most of which is automated by pkginstall). The main concept you
5849: must bear in mind is that files marked as configuration files are automatically
5850: copied to the right place (somewhere inside PKG_SYSCONFDIR) during installation
5851: if and only if they didn't exist before. Similarly, they will not be removed if
5852: they have local modifications. This ensures that administrators never lose any
5853: custom changes they may have made.
1.1 dsieger 5854:
1.184 rillig 5855: 20.2.1. How PKG_SYSCONFDIR is set
1.1 dsieger 5856:
1.184 rillig 5857: As said before, the PKG_SYSCONFDIR variable specifies where configuration files
5858: shall be installed. Its contents are set based upon the following variables:
1.1 dsieger 5859:
1.184 rillig 5860: * PKG_SYSCONFBASE: The configuration's root directory. Defaults to ${PREFIX}/
5861: etc although it may be overridden by the user to point to his preferred
5862: location (e.g., /etc, /etc/pkg, etc.). Packages must not use it directly.
1.1 dsieger 5863:
1.184 rillig 5864: * PKG_SYSCONFSUBDIR: A subdirectory of PKG_SYSCONFBASE under which the
5865: configuration files for the package being built shall be installed. The
5866: definition of this variable only makes sense in the package's Makefile
5867: (i.e., it is not user-customizable).
1.1 dsieger 5868:
1.184 rillig 5869: As an example, consider the Apache package, www/apache24, which places its
5870: configuration files under the httpd/ subdirectory of PKG_SYSCONFBASE. This
5871: should be set in the package Makefile.
1.1 dsieger 5872:
1.184 rillig 5873: * PKG_SYSCONFVAR: Specifies the name of the variable that holds this
5874: package's configuration directory (if different from PKG_SYSCONFBASE). It
5875: defaults to PKGBASE's value, and is always prefixed with PKG_SYSCONFDIR.
1.1 dsieger 5876:
1.184 rillig 5877: * PKG_SYSCONFDIR.${PKG_SYSCONFVAR}: Holds the directory where the
5878: configuration files for the package identified by PKG_SYSCONFVAR's shall be
5879: placed.
1.1 dsieger 5880:
1.184 rillig 5881: Based on the above variables, pkginstall determines the value of
5882: PKG_SYSCONFDIR, which is the only variable that can be used within a package to
5883: refer to its configuration directory. The algorithm used to set its value is
5884: basically the following:
1.1 dsieger 5885:
1.184 rillig 5886: 1. If PKG_SYSCONFDIR.${PKG_SYSCONFVAR} is set, its value is used.
1.1 dsieger 5887:
1.184 rillig 5888: 2. If the previous variable is not defined but PKG_SYSCONFSUBDIR is set in the
5889: package's Makefile, the resulting value is ${PKG_SYSCONFBASE}/$
5890: {PKG_SYSCONFSUBDIR}.
1.1 dsieger 5891:
1.184 rillig 5892: 3. Otherwise, it is set to ${PKG_SYSCONFBASE}.
1.1 dsieger 5893:
1.184 rillig 5894: It is worth mentioning that ${PKG_SYSCONFDIR} is automatically added to
5895: OWN_DIRS. See Section 20.1.1, "Directory manipulation" what this means. This
5896: does not apply to subdirectories of ${PKG_SYSCONFDIR}, they still have to be
5897: created with OWN_DIRS or MAKE_DIRS.
1.1 dsieger 5898:
1.184 rillig 5899: 20.2.2. Telling the software where configuration files are
1.1 dsieger 5900:
1.184 rillig 5901: Given that pkgsrc (and users!) expect configuration files to be in a known
5902: place, you need to teach each package where it shall install its files. In some
5903: cases you will have to patch the package Makefiles to achieve it. If you are
5904: lucky, though, it may be as easy as passing an extra flag to the configuration
5905: script; this is the case of GNU Autoconf- generated files:
1.1 dsieger 5906:
1.184 rillig 5907: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.1 dsieger 5908:
1.184 rillig 5909: Note that this specifies where the package has to look for its configuration
5910: files, not where they will be originally installed (although the difference is
5911: never explicit, unfortunately).
1.1 dsieger 5912:
1.184 rillig 5913: 20.2.3. Patching installations
1.1 dsieger 5914:
1.184 rillig 5915: As said before, pkginstall automatically handles configuration files. This
5916: means that the packages themselves must not touch the contents of $
5917: {PKG_SYSCONFDIR} directly. Bad news is that many software installation scripts
5918: will, out of the box, mess with the contents of that directory. So what is the
5919: correct procedure to fix this issue?
1.1 dsieger 5920:
1.184 rillig 5921: You must teach the package (usually by manually patching it) to install any
5922: configuration files under the examples hierarchy, share/examples/${PKGBASE}/.
5923: This way, the PLIST registers them and the administrator always has the
5924: original copies available.
1.1 dsieger 5925:
1.184 rillig 5926: Once the required configuration files are in place (i.e., under the examples
5927: hierarchy), the pkginstall framework can use them as master copies during the
5928: package installation to update what is in ${PKG_SYSCONFDIR}. To achieve this,
5929: the variables CONF_FILES and CONF_FILES_PERMS are used. Check out
5930: Section 20.1.2, "File manipulation" for information about their syntax and
5931: their purpose. Here is an example, taken from the mail/mutt package:
1.1 dsieger 5932:
1.184 rillig 5933: EGDIR= ${PREFIX}/share/doc/mutt/samples
5934: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.1 dsieger 5935:
1.184 rillig 5936: Note that the EGDIR variable is specific to that package and has no meaning
5937: outside it.
1.1 dsieger 5938:
1.184 rillig 5939: 20.2.4. Disabling handling of configuration files
1.1 dsieger 5940:
1.184 rillig 5941: The automatic copying of config files can be toggled by setting the environment
5942: variable PKG_CONFIG prior to package installation.
1.1 dsieger 5943:
1.184 rillig 5944: 20.3. System startup scripts
1.1 dsieger 5945:
1.184 rillig 5946: System startup scripts are special files because they must be installed in a
5947: place known by the underlying OS, usually outside the installation prefix.
5948: Therefore, the same rules described in Section 20.1, "Files and directories
5949: outside the installation prefix" apply, and the same solutions can be used.
5950: However, pkginstall provides a special mechanism to handle these files.
1.1 dsieger 5951:
1.184 rillig 5952: In order to provide system startup scripts, the package has to:
1.1 dsieger 5953:
1.184 rillig 5954: 1. Store the script inside ${FILESDIR}, with the .sh suffix appended.
1.223 nia 5955: Considering the print/cups-base package as an example, it has a cupsd.sh in
5956: its files directory.
1.95 wiz 5957:
1.184 rillig 5958: 2. Tell pkginstall to handle it, appending the name of the script, without its
5959: extension, to the RCD_SCRIPTS variable. Continuing the previous example:
1.95 wiz 5960:
1.184 rillig 5961: RCD_SCRIPTS+= cupsd
1.95 wiz 5962:
1.184 rillig 5963: Once this is done, pkginstall will do the following steps for each script in an
5964: automated fashion:
1.95 wiz 5965:
1.184 rillig 5966: 1. Process the file found in the files directory applying all the
5967: substitutions described in the FILES_SUBST variable.
1.1 dsieger 5968:
1.184 rillig 5969: 2. Copy the script from the files directory to the examples hierarchy, $
5970: {PREFIX}/share/examples/rc.d/. Note that this master file must be
5971: explicitly registered in the PLIST.
1.1 dsieger 5972:
1.184 rillig 5973: 3. Add code to the installation scripts to copy the startup script from the
5974: examples hierarchy into the system-wide startup scripts directory.
1.1 dsieger 5975:
1.184 rillig 5976: 20.3.1. Disabling handling of system startup scripts
1.1 dsieger 5977:
1.184 rillig 5978: The automatic copying of config files can be toggled by setting the environment
5979: variable PKG_RCD_SCRIPTS prior to package installation. Note that the scripts
5980: will be always copied inside the examples hierarchy, ${PREFIX}/share/examples/
5981: rc.d/, no matter what the value of this variable is.
1.1 dsieger 5982:
1.184 rillig 5983: 20.4. System users and groups
1.1 dsieger 5984:
1.184 rillig 5985: If a package needs to create special users and/or groups during installation,
5986: it can do so by using the pkginstall framework.
1.1 dsieger 5987:
1.184 rillig 5988: Users can be created by adding entries to the PKG_USERS variable. Each entry
5989: has the following syntax:
1.1 dsieger 5990:
1.184 rillig 5991: user:group
1.1 dsieger 5992:
1.184 rillig 5993: Further specification of user details may be done by setting per-user
5994: variables. PKG_UID.user is the numeric UID for the user. PKG_GECOS.user is the
5995: user's description or comment. PKG_HOME.user is the user's home directory, and
5996: defaults to /nonexistent if not specified. PKG_SHELL.user is the user's shell,
5997: and defaults to /sbin/nologin if not specified.
1.1 dsieger 5998:
1.184 rillig 5999: Similarly, groups can be created by adding entries to the PKG_GROUPS variable,
6000: whose syntax is:
1.1 dsieger 6001:
1.184 rillig 6002: group
1.1 dsieger 6003:
1.184 rillig 6004: The numeric GID of the group may be set by defining PKG_GID.group.
1.1 dsieger 6005:
1.184 rillig 6006: If a package needs to create the users and groups at an earlier stage, then it
6007: can set USERGROUP_PHASE to either configure,build, or pre-install to indicate
6008: the phase before which the users and groups are created. In this case, the
6009: numeric UIDs and GIDs of the created users and groups are automatically
6010: hardcoded into the final installation scripts.
1.1 dsieger 6011:
1.184 rillig 6012: 20.5. System shells
1.1 dsieger 6013:
1.184 rillig 6014: Packages that install system shells should register them in the shell database,
6015: /etc/shells, to make things easier to the administrator. This must be done from
6016: the installation scripts to keep binary packages working on any system.
6017: pkginstall provides an easy way to accomplish this task.
1.1 dsieger 6018:
1.184 rillig 6019: When a package provides a shell interpreter, it has to set the PKG_SHELL
6020: variable to its absolute file name. This will add some hooks to the
6021: installation scripts to handle it. Consider the following example, taken from
6022: shells/zsh:
1.1 dsieger 6023:
1.184 rillig 6024: PKG_SHELL= ${PREFIX}/bin/zsh
1.1 dsieger 6025:
1.184 rillig 6026: 20.5.1. Disabling shell registration
1.1 dsieger 6027:
1.184 rillig 6028: The automatic registration of shell interpreters can be disabled by the
6029: administrator by setting the PKG_REGISTER_SHELLS environment variable to NO.
1.1 dsieger 6030:
1.184 rillig 6031: 20.6. Fonts
1.1 dsieger 6032:
1.184 rillig 6033: Packages that install X11 fonts should update the database files that index the
6034: fonts within each fonts directory. This can easily be accomplished within the
6035: pkginstall framework.
1.1 dsieger 6036:
1.184 rillig 6037: When a package installs X11 fonts, it must list the directories in which fonts
6038: are installed in the FONTS_DIRS.type variables, where type can be one of "ttf",
6039: "type1" or "x11". This will add hooks to the installation scripts to run the
6040: appropriate commands to update the fonts database files within each of those
6041: directories. For convenience, if the directory path is relative, it is taken to
6042: be relative to the package's installation prefix. Consider the following
6043: example, taken from fonts/dbz-ttf:
1.1 dsieger 6044:
1.184 rillig 6045: FONTS_DIRS.ttf= ${PREFIX}/share/fonts/X11/TTF
1.1 dsieger 6046:
1.184 rillig 6047: 20.6.1. Disabling automatic update of the fonts databases
1.1 dsieger 6048:
1.184 rillig 6049: The automatic update of fonts databases can be disabled by the administrator by
6050: setting the PKG_UPDATE_FONTS_DB environment variable to NO.
1.1 dsieger 6051:
1.154 rillig 6052: Chapter 21. Making your package work
1.1 dsieger 6053:
6054: Table of Contents
6055:
1.154 rillig 6056: 21.1. General operation
1.1 dsieger 6057:
1.154 rillig 6058: 21.1.1. How to pull in user-settable variables from mk.conf
6059: 21.1.2. User interaction
6060: 21.1.3. Handling licenses
6061: 21.1.4. Restricted packages
6062: 21.1.5. Handling dependencies
6063: 21.1.6. Handling conflicts with other packages
6064: 21.1.7. Packages that cannot or should not be built
6065: 21.1.8. Packages which should not be deleted, once installed
6066: 21.1.9. Handling packages with security problems
6067: 21.1.10. How to handle incrementing versions when fixing an existing
1.1 dsieger 6068: package
1.154 rillig 6069: 21.1.11. Substituting variable text in the package files (the SUBST
1.1 dsieger 6070: framework)
6071:
1.154 rillig 6072: 21.2. The fetch phase
1.1 dsieger 6073:
1.154 rillig 6074: 21.2.1. Packages whose distfiles aren't available for plain downloading
6075: 21.2.2. How to handle modified distfiles with the 'old' name
6076: 21.2.3. Packages hosted on github.com
6077:
6078: 21.3. The configure phase
6079:
6080: 21.3.1. Shared libraries - libtool
6081: 21.3.2. Using libtool on GNU packages that already support libtool
6082: 21.3.3. GNU Autoconf/Automake
1.223 nia 6083: 21.3.4. Meson / ninja
1.154 rillig 6084:
6085: 21.4. Programming languages
6086:
6087: 21.4.1. C, C++, and Fortran
6088: 21.4.2. Java
1.205 wiz 6089: 21.4.3. Go
1.223 nia 6090: 21.4.4. Rust
6091: 21.4.5. Packages containing Perl scripts
6092: 21.4.6. Packages containing shell scripts
6093: 21.4.7. Other programming languages
1.154 rillig 6094:
6095: 21.5. The build phase
6096:
6097: 21.5.1. Compiling C and C++ code conditionally
6098: 21.5.2. How to handle compiler bugs
1.172 rillig 6099: 21.5.3. No such file or directory
6100: 21.5.4. Undefined reference to "..."
6101: 21.5.5. Running out of memory
1.154 rillig 6102:
6103: 21.6. The install phase
6104:
6105: 21.6.1. Creating needed directories
6106: 21.6.2. Where to install documentation
6107: 21.6.3. Installing highscore files
6108: 21.6.4. Adding DESTDIR support to packages
6109: 21.6.5. Packages with hardcoded paths to other interpreters
1.203 nia 6110: 21.6.6. Packages installing Perl modules
1.154 rillig 6111: 21.6.7. Packages installing info files
6112: 21.6.8. Packages installing man pages
1.203 nia 6113: 21.6.9. Packages installing X11 fonts
6114: 21.6.10. Packages installing SGML or XML data
6115: 21.6.11. Packages installing extensions to the MIME database
6116: 21.6.12. Packages using intltool
6117: 21.6.13. Packages installing startup scripts
6118: 21.6.14. Packages installing TeX modules
6119: 21.6.15. Packages supporting running binaries in emulation
6120: 21.6.16. Packages installing hicolor icons
6121: 21.6.17. Packages installing desktop files
1.1 dsieger 6122:
1.154 rillig 6123: 21.7. Marking packages as having problems
1.1 dsieger 6124:
1.154 rillig 6125: 21.1. General operation
1.1 dsieger 6126:
6127: One appealing feature of pkgsrc is that it runs on many different platforms. As
6128: a result, it is important to ensure, where possible, that packages in pkgsrc
6129: are portable. This chapter mentions some particular details you should pay
6130: attention to while working on pkgsrc.
6131:
1.154 rillig 6132: 21.1.1. How to pull in user-settable variables from mk.conf
1.1 dsieger 6133:
6134: The pkgsrc user can configure pkgsrc by overriding several variables in the
1.4 rillig 6135: file pointed to by MAKECONF, which is mk.conf by default. When you want to use
6136: those variables in the preprocessor directives of make(1) (for example .if or
6137: .for), you need to include the file ../../mk/bsd.prefs.mk before, which in turn
6138: loads the user preferences.
1.1 dsieger 6139:
6140: But note that some variables may not be completely defined after ../../mk/
6141: bsd.prefs.mk has been included, as they may contain references to variables
1.108 rillig 6142: that are not yet defined. In shell commands (the lines in Makefile that are
6143: indented with a tab) this is no problem, since variables are only expanded when
6144: they are used. But in the preprocessor directives mentioned above and in
6145: dependency lines (of the form target: dependencies) the variables are expanded
6146: at load time.
1.1 dsieger 6147:
6148: Note
6149:
1.108 rillig 6150: To check whether a variable can be used at load time, run pkglint -Wall on your
6151: package.
1.1 dsieger 6152:
1.154 rillig 6153: 21.1.2. User interaction
1.1 dsieger 6154:
6155: Occasionally, packages require interaction from the user, and this can be in a
6156: number of ways:
6157:
6158: * When fetching the distfiles, some packages require user interaction such as
6159: entering username/password or accepting a license on a web page.
6160:
6161: * When extracting the distfiles, some packages may ask for passwords.
6162:
6163: * help to configure the package before it is built
6164:
6165: * help during the build process
6166:
6167: * help during the installation of a package
6168:
1.108 rillig 6169: A package can set the INTERACTIVE_STAGE variable to define which stages need
6170: interaction. This should be done in the package's Makefile, e.g.:
1.1 dsieger 6171:
6172: INTERACTIVE_STAGE= configure install
6173:
6174: The user can then decide to skip this package by setting the BATCH variable.
1.108 rillig 6175: Packages that require interaction are also excluded from bulk builds.
1.1 dsieger 6176:
1.154 rillig 6177: 21.1.3. Handling licenses
1.1 dsieger 6178:
6179: Authors of software can choose the licence under which software can be copied.
1.111 sevan 6180: The Free Software Foundation has declared some licenses "Free", and the Open
6181: Source Initiative has a definition of "Open Source".
6182:
6183: By default, pkgsrc allows packages with Free or Open Source licenses to be
6184: built. To allow packages with other licenses to be built as well, the pkgsrc
6185: user needs to add these licenses to the ACCEPTABLE_LICENSES variable in mk.conf
6186: . Note that this variable only affects which packages may be built, while the
6187: license terms often also restrict the actual use of the package and its
6188: redistribution.
1.1 dsieger 6189:
6190: One might want to only install packages with a BSD license, or the GPL, and not
1.20 jnemeth 6191: the other. The free licenses are added to the default ACCEPTABLE_LICENSES
1.111 sevan 6192: variable. The pkgsrc user can override the default by setting the
6193: ACCEPTABLE_LICENSES variable with "=" instead of "+=". The licenses accepted by
6194: default are defined in the DEFAULT_ACCEPTABLE_LICENSES variable in the file
6195: pkgsrc/mk/license.mk.
1.1 dsieger 6196:
6197: The license tag mechanism is intended to address copyright-related issues
6198: surrounding building, installing and using a package, and not to address
1.20 jnemeth 6199: redistribution issues (see RESTRICTED and NO_SRC_ON_FTP, etc.). Packages with
6200: redistribution restrictions should set these tags.
1.1 dsieger 6201:
6202: Denoting that a package may be copied according to a particular license is done
6203: by placing the license in pkgsrc/licenses and setting the LICENSE variable to a
6204: string identifying the license, e.g. in graphics/xv:
6205:
6206: LICENSE= xv-license
6207:
6208: When trying to build, the user will get a notice that the package is covered by
6209: a license which has not been placed in the ACCEPTABLE_LICENSES variable:
6210:
6211: % make
6212: ===> xv-3.10anb9 has an unacceptable license: xv-license.
6213: ===> To view the license, enter "/usr/bin/make show-license".
6214: ===> To indicate acceptance, add this line to your /etc/mk.conf:
6215: ===> ACCEPTABLE_LICENSES+=xv-license
6216: *** Error code 1
6217:
6218: The license can be viewed with make show-license, and if the user so chooses,
1.4 rillig 6219: the line printed above can be added to mk.conf to convey to pkgsrc that it
1.1 dsieger 6220: should not in the future fail because of that license:
6221:
6222: ACCEPTABLE_LICENSES+=xv-license
6223:
1.111 sevan 6224: The use of LICENSE=shareware, LICENSE=no-commercial-use, and similar language
6225: is deprecated because it does not crisply refer to a particular license text.
6226: Another problem with such usage is that it does not enable a user to tell
6227: pkgsrc to proceed for a single package without also telling pkgsrc to proceed
6228: for all packages with that tag.
6229:
1.154 rillig 6230: 21.1.3.1. Adding a package with a new license
1.1 dsieger 6231:
1.49 rodent 6232: When adding a package with a new license, the following steps are required:
6233:
1.111 sevan 6234: 1. Check whether the license qualifies as Free or Open Source by referencing
6235: Various Licenses and Comments about Them and Licenses by Name | Open Source
6236: Initiative. If this is the case, the filename in pkgsrc/licenses/ does not
6237: need the -license suffix, and the license name should be added to:
1.49 rodent 6238:
6239: + DEFAULT_ACCEPTABLE_LICENSES in pkgsrc/mk/license.mk
6240:
6241: + default_acceptable_licenses in pkgsrc/pkgtools/pkg_install/files/lib/
6242: license.c
6243:
6244: 2. The license text should be added to pkgsrc/licenses for displaying. A list
6245: of known licenses can be seen in this directory.
1.1 dsieger 6246:
1.154 rillig 6247: 21.1.3.2. Change to the license
1.1 dsieger 6248:
1.111 sevan 6249: When the license changes (in a way other than formatting), make sure that the
6250: new license has a different name (e.g., append the version number if it exists,
6251: or the date). Just because a user told pkgsrc to build programs under a
6252: previous version of a license does not mean that pkgsrc should build programs
6253: under the new licenses. The higher-level point is that pkgsrc does not evaluate
6254: licenses for reasonableness; the only test is a mechanistic test of whether a
6255: particular text has been approved by either of two bodies (FSF or OSI).
1.1 dsieger 6256:
1.154 rillig 6257: 21.1.4. Restricted packages
1.1 dsieger 6258:
1.111 sevan 6259: Some licenses restrict how software may be re-distributed. By declaring the
6260: restrictions, package tools can automatically refrain from e.g. placing binary
6261: packages on FTP sites.
6262:
6263: There are four possible restrictions, which are the cross product of sources
6264: (distfiles) and binaries not being placed on FTP sites and CD-ROMs. Because
6265: this is rarely the exact language in any license, and because non-Free licenses
6266: tend to be different from each other, pkgsrc adopts a definition of FTP and
6267: CD-ROM. "FTP" means making the source or binary file available over the
6268: Internet at no charge. "CD-ROM" means making the source or binary available on
6269: some kind of media, together with other source and binary packages, which is
6270: sold for a distribution charge.
1.1 dsieger 6271:
6272: In order to encode these restrictions, the package system defines five make
6273: variables that can be set to note these restrictions:
6274:
6275: * RESTRICTED
6276:
6277: This variable should be set whenever a restriction exists (regardless of
6278: its kind). Set this variable to a string containing the reason for the
6279: restriction. It should be understood that those wanting to understand the
6280: restriction will have to read the license, and perhaps seek advice of
6281: counsel.
6282:
6283: * NO_BIN_ON_CDROM
6284:
6285: Binaries may not be placed on CD-ROM containing other binary packages, for
6286: which a distribution charge may be made. In this case, set this variable to
6287: ${RESTRICTED}.
6288:
6289: * NO_BIN_ON_FTP
6290:
6291: Binaries may not made available on the Internet without charge. In this
6292: case, set this variable to ${RESTRICTED}. If this variable is set, binary
6293: packages will not be included on ftp.NetBSD.org.
6294:
6295: * NO_SRC_ON_CDROM
6296:
6297: Distfiles may not be placed on CD-ROM, together with other distfiles, for
6298: which a fee may be charged. In this case, set this variable to $
6299: {RESTRICTED}.
6300:
6301: * NO_SRC_ON_FTP
6302:
6303: Distfiles may not made available via FTP at no charge. In this case, set
6304: this variable to ${RESTRICTED}. If this variable is set, the distfile(s)
6305: will not be mirrored on ftp.NetBSD.org.
6306:
1.111 sevan 6307: Please note that packages will be removed from pkgsrc when the distfiles are
1.33 wiz 6308: not distributable and cannot be obtained for a period of one full quarter
1.111 sevan 6309: branch. Packages with manual/interactive fetch must have a maintainer and it is
6310: his/her responsibility to ensure this.
1.33 wiz 6311:
1.154 rillig 6312: 21.1.5. Handling dependencies
1.1 dsieger 6313:
1.175 gutterid 6314: Your package may depend on some other package being present, and there are
6315: various ways of expressing this dependency. pkgsrc supports the DEPENDS,
6316: BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS definitions, the USE_TOOLS
6317: definition, as well as dependencies via buildlink3.mk, which is the preferred
6318: way to handle dependencies, and which uses the variables named above. See
1.184 rillig 6319: Chapter 18, Buildlink methodology for more information.
1.175 gutterid 6320:
6321: The basic difference is that the DEPENDS definition registers that
6322: pre-requisite in the binary package so it will be pulled in when the binary
6323: package is later installed, whilst the BUILD_DEPENDS, TOOL_DEPENDS, and
6324: TEST_DEPENDS definitions do not, marking a dependency that is only needed for
1.184 rillig 6325: building or testing the resulting package. See also Chapter 14, Creating a new
1.175 gutterid 6326: pkgsrc package from scratch for more information.
6327:
6328: This means that if you only need a package present whilst you are building or
6329: testing, it should be noted as a TOOL_DEPENDS, BUILD_DEPENDS, or TEST_DEPENDS.
6330: When cross-compiling, TOOL_DEPENDS are native packages, i.e. packages for the
6331: architecture where the package is built; BUILD_DEPENDS are target packages,
6332: i.e., packages for the architecture for which the package is built.
1.1 dsieger 6333:
1.175 gutterid 6334: The format for a DEPENDS, BUILD_DEPENDS, TOOL_DEPENDS, and TEST_DEPENDS
6335: definition is:
1.1 dsieger 6336:
6337: <pre-req-package-name>:../../<category>/<pre-req-package>
6338:
6339: Please note that the "pre-req-package-name" may include any of the wildcard
6340: version numbers recognized by pkg_info(1).
6341:
1.55 wiz 6342: 1. If your package needs another package's binaries or libraries to build and
1.1 dsieger 6343: run, and if that package has a buildlink3.mk file available, use it:
6344:
6345: .include "../../graphics/jpeg/buildlink3.mk"
6346:
1.55 wiz 6347: 2. If your package needs another package's binaries or libraries only for
6348: building, and if that package has a buildlink3.mk file available, use it:
6349:
6350: .include "../../graphics/jpeg/buildlink3.mk"
6351:
6352: but set BUILDLINK_DEPMETHOD.jpeg?=build to make it a build dependency only.
6353: This case is rather rare.
6354:
6355: 3. If your package needs binaries from another package to build, use the
1.156 leot 6356: TOOL_DEPENDS definition:
6357:
6358: TOOL_DEPENDS+= itstool-[0-9]*:../../textproc/itstool
1.1 dsieger 6359:
1.156 leot 6360: 4. If your package needs static libraries to link against, header files to
6361: include, etc. from another package to build, use the BUILD_DEPENDS
6362: definition.
1.1 dsieger 6363:
1.156 leot 6364: 5. If your package needs a library with which to link and there is no
1.26 spz 6365: buildlink3.mk file available, create one. Using DEPENDS won't be sufficient
6366: because the include files and libraries will be hidden from the compiler.
1.1 dsieger 6367:
1.156 leot 6368: 6. If your package needs some executable to be able to run correctly and if
1.26 spz 6369: there's no buildlink3.mk file, this is specified using the DEPENDS
6370: variable. The print/lyx package needs to be able to execute the latex
1.129 wiz 6371: binary from the tex-latex-bin package when it runs, and that is specified:
1.1 dsieger 6372:
1.129 wiz 6373: DEPENDS+= tex-latex-bin-[0-9]*:../../print/tex-latex-bin
1.1 dsieger 6374:
1.175 gutterid 6375: 7. If your package includes a test suite that has extra dependencies only
6376: required for this purpose (frequently this can be run as a "make test"
6377: target), use the TEST_DEPENDS variable.
6378:
6379: 8. You can use wildcards in package dependencies. Note that such wildcard
1.26 spz 6380: dependencies are retained when creating binary packages. The dependency is
6381: checked when installing the binary package and any package which matches
6382: the pattern will be used. Wildcard dependencies should be used with care.
1.1 dsieger 6383:
6384: The "-[0-9]*" should be used instead of "-*" to avoid potentially ambiguous
6385: matches such as "tk-postgresql" matching a "tk-*" DEPENDS.
6386:
6387: Wildcards can also be used to specify that a package will only build
6388: against a certain minimum version of a pre-requisite:
6389:
1.26 spz 6390: DEPENDS+= ImageMagick>=6.0:../../graphics/ImageMagick
1.1 dsieger 6391:
1.26 spz 6392: This means that the package will build using version 6.0 of ImageMagick or
6393: newer. Such a dependency may be warranted if, for example, the command line
6394: options of an executable have changed.
6395:
1.183 wiz 6396: If you need to depend on minimum versions of libraries, set
6397: BUILDLINK_API_DEPENDS.pkg to the appropriate pattern before including its
6398: buildlink3.mk file, e.g.
6399:
6400: BUILDLINK_API_DEPENDS.jpeg+= jpeg>=9.0
6401: .include "../../graphics/jpeg/buildlink3.mk"
1.1 dsieger 6402:
6403: For security fixes, please update the package vulnerabilities file. See
1.154 rillig 6404: Section 21.1.9, "Handling packages with security problems" for more
1.1 dsieger 6405: information.
6406:
6407: If your package needs files from another package to build, add the relevant
6408: distribution files to DISTFILES, so they will be extracted automatically. See
6409: the print/ghostscript package for an example. (It relies on the jpeg sources
6410: being present in source form during the build.)
6411:
1.154 rillig 6412: 21.1.6. Handling conflicts with other packages
1.1 dsieger 6413:
1.226 gutterid 6414: Your package may conflict with other packages users might already have
6415: installed on their system, e.g., if your package installs the same set of files
1.227 wiz 6416: as another package in the pkgsrc tree.
1.1 dsieger 6417:
1.142 leot 6418: For example, x11/libXaw3d and x11/Xaw-Xpm install the same shared library, thus
6419: you set in pkgsrc/x11/libXaw3d/Makefile:
1.1 dsieger 6420:
1.142 leot 6421: CONFLICTS= Xaw-Xpm-[0-9]*
1.1 dsieger 6422:
6423:
1.142 leot 6424: and in pkgsrc/x11/Xaw-Xpm/Makefile:
1.1 dsieger 6425:
1.142 leot 6426: CONFLICTS= libXaw3d-[0-9]*
1.1 dsieger 6427:
1.142 leot 6428:
6429: pkg_add(1) is able to detect attempts to install packages that conflict with
6430: existing packages and abort. However, in many situations this is too late in
6431: the process. Binary package managers will not know about the conflict until
6432: they attempt to install the package after already downloading it and all its
6433: dependencies. Users may also waste time building a package and its dependencies
6434: only to find out at the end that it conflicts with another package they have
6435: installed.
6436:
6437: To avoid these issues CONFLICTS entries should be added in all cases where it
6438: is known that packages conflict with each other. These CONFLICTS entries are
6439: exported in pkg_summary(5) files and consumed by binary package managers to
6440: inform users that packages cannot be installed onto the target system.
1.1 dsieger 6441:
1.154 rillig 6442: 21.1.7. Packages that cannot or should not be built
1.1 dsieger 6443:
6444: There are several reasons why a package might be instructed to not build under
6445: certain circumstances. If the package builds and runs on most platforms, the
1.83 dholland 6446: exceptions should be noted with BROKEN_ON_PLATFORM. If the package builds and
6447: runs on a small handful of platforms, set BROKEN_EXCEPT_ON_PLATFORM instead.
6448: Both BROKEN_ON_PLATFORM and BROKEN_EXCEPT_ON_PLATFORM are OS triples
6449: (OS-version-platform) that can use glob-style wildcards.
6450:
1.114 maya 6451: If a package is not appropriate for some platforms (as opposed to merely
1.83 dholland 6452: broken), a different set of variables should be used as this affects failure
6453: reporting and statistics. If the package is appropriate for most platforms, the
6454: exceptions should be noted with NOT_FOR_PLATFORM. If the package is appropriate
6455: for only a small handful of platforms (often exactly one), set
6456: ONLY_FOR_PLATFORM instead. Both ONLY_FOR_PLATFORM and NOT_FOR_PLATFORM are OS
6457: triples (OS-version-platform) that can use glob-style wildcards.
1.1 dsieger 6458:
6459: Some packages are tightly bound to a specific version of an operating system,
6460: e.g. LKMs or sysutils/lsof. Such binary packages are not backwards compatible
6461: with other versions of the OS, and should be uploaded to a version specific
6462: directory on the FTP server. Mark these packages by setting OSVERSION_SPECIFIC
6463: to "yes". This variable is not currently used by any of the package system
6464: internals, but may be used in the future.
6465:
6466: If the package should be skipped (for example, because it provides
6467: functionality already provided by the system), set PKG_SKIP_REASON to a
6468: descriptive message. If the package should fail because some preconditions are
6469: not met, set PKG_FAIL_REASON to a descriptive message.
6470:
1.154 rillig 6471: 21.1.8. Packages which should not be deleted, once installed
1.1 dsieger 6472:
6473: To ensure that a package may not be deleted, once it has been installed, the
6474: PKG_PRESERVE definition should be set in the package Makefile. This will be
1.25 wiz 6475: carried into any binary package that is made from this pkgsrc entry. A "
6476: preserved" package will not be deleted using pkg_delete(1) unless the "-f"
1.1 dsieger 6477: option is used.
6478:
1.154 rillig 6479: 21.1.9. Handling packages with security problems
1.1 dsieger 6480:
6481: When a vulnerability is found, this should be noted in localsrc/security/
1.205 wiz 6482: advisories/pkg-vulnerabilities. Entries in that file consist of three parts:
6483:
6484: * package version pattern
6485:
6486: * type of vulnerability (please cut'n'paste an existing one where possible)
6487:
6488: * URL providing additional information about the issue
6489:
6490: For the package version pattern please always use `<' to mark an upper bound
6491: (not `<='!). This will avoid possible problems due unrelated PKGREVISION bumps
6492: not related to security fixes. Lower bounds can be added too, using '>' or '>=
1.206 wiz 6493: '. For example, "foo>=1<1.2" would mark versions 1.0 (included) to 1.2
1.205 wiz 6494: (excluded) of "foo" as affected by the security issue.
6495:
6496: Entries should always be added at the bottom of the file.
6497:
6498: When fixing packages, please modify the upper bound of the corresponding entry.
6499: To continue the previous example, if a fix was backported to version 1.1nb2,
1.206 wiz 6500: change the previous pattern to "foo>=1<1.1nb2".
1.205 wiz 6501:
6502: To locally test a package version pattern against a PKGNAME you can use the
6503: pkg_admin pmatch command.
6504:
6505: The URL should be as permanent as possible and provide as much information
6506: about the issue as possible. CVE entries are preferred.
6507:
6508: After committing that file, ask pkgsrc-security@NetBSD.org to update the file
6509: on ftp.NetBSD.org.
1.1 dsieger 6510:
6511: After fixing the vulnerability by a patch, its PKGREVISION should be increased
6512: (this is of course not necessary if the problem is fixed by using a newer
1.32 wiz 6513: release of the software), and the pattern in the pkg-vulnerabilities file must
6514: be updated.
1.1 dsieger 6515:
6516: Also, if the fix should be applied to the stable pkgsrc branch, be sure to
6517: submit a pullup request!
6518:
6519: Binary packages already on ftp.NetBSD.org will be handled semi-automatically by
6520: a weekly cron job.
6521:
1.205 wiz 6522: In case a security issue is disputed, please contact
6523: pkgsrc-security@NetBSD.org.
6524:
1.154 rillig 6525: 21.1.10. How to handle incrementing versions when fixing an existing package
1.1 dsieger 6526:
6527: When making fixes to an existing package it can be useful to change the version
6528: number in PKGNAME. To avoid conflicting with future versions by the original
6529: author, a "nb1", "nb2", ... suffix can be used on package versions by setting
6530: PKGREVISION=1 (2, ...). The "nb" is treated like a "." by the package tools.
6531: e.g.
6532:
6533: DISTNAME= foo-17.42
6534: PKGREVISION= 9
6535:
6536: will result in a PKGNAME of "foo-17.42nb9". If you want to use the original
6537: value of PKGNAME without the "nbX" suffix, e.g. for setting DIST_SUBDIR, use
6538: PKGNAME_NOREV.
6539:
6540: When a new release of the package is released, the PKGREVISION should be
6541: removed, e.g. on a new minor release of the above package, things should be
6542: like:
6543:
6544: DISTNAME= foo-17.43
6545:
6546: PKGREVISION should be incremented for any non-trivial change in the resulting
6547: binary package. Without a PKGREVISION bump, someone with the previous version
6548: installed has no way of knowing that their package is out of date. Thus,
6549: changes without increasing PKGREVISION are essentially labeled "this is so
6550: trivial that no reasonable person would want to upgrade", and this is the rough
6551: test for when increasing PKGREVISION is appropriate. Examples of changes that
6552: do not merit increasing PKGREVISION are:
6553:
1.14 jmcneill 6554: * Changing HOMEPAGE, MAINTAINER, OWNER, or comments in Makefile.
1.1 dsieger 6555:
6556: * Changing build variables if the resulting binary package is the same.
6557:
6558: * Changing DESCR.
6559:
6560: * Adding PKG_OPTIONS if the default options don't change.
6561:
6562: Examples of changes that do merit an increase to PKGREVISION include:
6563:
6564: * Security fixes
6565:
6566: * Changes or additions to a patch file
6567:
6568: * Changes to the PLIST
6569:
1.12 weinem 6570: * A dependency is changed or renamed.
6571:
1.1 dsieger 6572: PKGREVISION must also be incremented when dependencies have ABI changes.
6573:
1.154 rillig 6574: 21.1.11. Substituting variable text in the package files (the SUBST framework)
1.1 dsieger 6575:
1.180 rillig 6576: When you want to replace the same text in multiple files, or multiple times in
6577: the same file, it is cumbersome to maintain a patch file for this. This is
6578: where the SUBST framework steps in. It provides an easy-to-use interface for
6579: replacing text in files. It just needs the following information:
1.172 rillig 6580:
1.180 rillig 6581: * In which phase of the package build cycle should the replacement happen?
1.172 rillig 6582:
1.180 rillig 6583: * In which files should the replacement happen?
1.172 rillig 6584:
6585: * Which text should be replaced with what?
6586:
1.180 rillig 6587: This information is encoded in a block of SUBST variables. A minimal example
6588: is:
6589:
6590: SUBST_CLASSES+= paths
6591: SUBST_STAGE.paths= pre-configure
6592: SUBST_FILES.paths= src/*.c
6593: SUBST_SED.paths= -e 's,/usr/local,${PREFIX},g'
6594:
6595: Translated into English, it means: In the pre-configure stage (that is, after
6596: applying the patches from the patches/ directory and before running the
6597: configure script and the portability check), replace the text /usr/local with
6598: the content of the variable PREFIX.
6599:
6600: Each SUBST block starts by appending an identifier to SUBST_CLASSES (note the +
6601: =). This identifier can be chosen freely by the package. If there should ever
6602: be duplicate identifiers, the pkgsrc infrastructure will catch this and fail
6603: early, so don't worry about name collisions.
6604:
6605: Except for SUBST_CLASSES, all variables in a SUBST block are parameterized
6606: using this identifier. In the remainder of this section, these parameterized
6607: variables are written as SUBST_STAGE.*.
6608:
6609: SUBST_CLASSES+= paths
6610: SUBST_STAGE.paths= pre-configure
6611: SUBST_MESSAGE.paths= Fixing absolute paths.
6612: SUBST_FILES.paths= src/*.c
6613: SUBST_FILES.paths+= scripts/*.sh
6614: SUBST_SED.paths= -e 's,"/usr/local,"${PREFIX},g'
6615: SUBST_SED.paths+= -e 's,"/var/log,"${VARBASE}/log,g'
6616: SUBST_VARS.paths= LOCALBASE PREFIX PKGVERSION
6617:
6618: To get a complete picture about the SUBST substitutions, run bmake
6619: show-all-subst. If something doesn't work as expected, run pkglint on the
6620: package, which detects several typical mistakes surrounding the SUBST blocks.
6621: For any questions that might remain after this, have a look at mk/subst.mk.
6622:
6623: 21.1.11.1. Choosing the time where the substitutions happen
6624:
6625: The SUBST_STAGE.* is one of {pre,do,post}-
6626: {extract,patch,configure,build,test,install}. Of these, pre-configure is used
6627: most often, by far. The most popular stages are, in chronological order:
6628:
6629: post-extract
6630:
6631: The substitutions are applied immediately after the distfiles are
6632: extracted. Running bmake extract on the package will leave no traces of the
6633: original files.
6634:
6635: When the substitution applies to files for which there is also a patch in
6636: the patches/ directory, this means that the patches will be computed based
6637: on the result of the substitution. When these patches are sent to the
6638: upstream maintainer later, to be fixed in the upstream package, these
6639: patches may no longer match what the upstream author is used to. Because of
6640: this, pre-configure is often a better choice.
6641:
6642: pre-configure
6643:
6644: The substitutions are applied after the patches from the patches/
6645: directory. This makes it possible to run bmake patch on the package, after
6646: which the patches can be edited using the tools pkgvi and mkpatches from
6647: the pkgtools/pkgdiff package.
6648:
6649: When updating the patches, it is helpful to explicitly separate the bmake
6650: patch from the bmake configure, and to only edit the patches between these
6651: commands. Otherwise the substitutions from the SUBST block will end up in
6652: the patch file. When this happens in really obvious ways, pkglint will
6653: complain about patches that contain a hard-coded /usr/pkg instead of the
6654: correct and intended @PREFIX@, but it can only detect these really obvious
6655: cases.
6656:
6657: do-configure
6658:
6659: This stage should only be used if the package defines a pre-configure
6660: action itself, and the substitution must happen after that. Typical
6661: examples are packages that use the pre-configure stage to regenerate the
6662: GNU configure script from configure.ac.
6663:
6664: post-configure
6665:
6666: This stage is used to fix up any mistakes by the configure stage.
6667:
6668: pre-build
6669:
6670: This stage should only be used for substitutions that are clearly related
6671: to building the package, not for fixing the configuration. Substitutions
6672: for pathnames (such as replacing /usr/local with ${PREFIX}) or user names
6673: (such as replacing @MY_USER@ with the actual username) belong in
6674: pre-configure or post-configure instead.
6675:
6676: post-build
6677:
6678: Just as with pre-build, this stage should only be used for substitutions
6679: that are clearly related to building the package, not for fixing the
6680: configuration. Substitutions for pathnames (such as replacing /usr/local
6681: with ${PREFIX}) or user names (such as replacing @MY_USER@ with the actual
6682: username) belong in pre-configure or post-configure instead.
6683:
6684: A typical use is to update pkg-config files to include the rpath compiler
6685: options.
6686:
6687: pre-install
6688:
6689: In general, the install phase should be as simple as possible. As with the
6690: pre-build and post-build stages, it should not be used to fix pathnames or
6691: user names, these belong in pre-configure instead. There are only few
6692: legitimate use cases for applying substitutions in this stage.
6693:
1.181 rillig 6694: 21.1.11.2. Choosing the files where the substitutions happen
1.180 rillig 6695:
6696: The SUBST_FILES.* variable contains a list of filename patterns. These patterns
6697: are relative to WRKSRC since that is where most substitutions happen. A typical
6698: example is:
6699:
6700: SUBST_FILES.path= Makefile */Makefile */*/Makefile *.[ch]
6701:
6702: The above patterns, especially the last, are quite broad. The SUBST
6703: implementation checks that each filename pattern that is mentioned here has an
6704: effect. For example, if none of the */*/Makefile files contains the patterns to
6705: be found and substituted, that filename pattern is redundant and should be left
1.181 rillig 6706: out. By default, the SUBST framework will complain with an error message. If
6707: the text to be substituted occurs in some of the files from a single pattern,
6708: but not in all of them, that is totally ok, and the SUBST framework will only
6709: print an INFO message for those files.
1.180 rillig 6710:
6711: If there is a good reason for having redundant filename patterns, set
1.181 rillig 6712: SUBST_NOOP_OK.* to yes.
1.180 rillig 6713:
6714: Another popular way of choosing the files for the substitutions is via a shell
6715: command, like this:
6716:
1.181 rillig 6717: C_FILES_CMD= cd ${WRKSRC} && ${FIND} . -name '*.c'
1.180 rillig 6718: SUBST_FILES.path= ${C_FILES_CMD:sh}
6719:
6720: The variable name C_FILES_CMD in this example is freely chosen and independent
6721: of the SUBST framework.
6722:
6723: In this variant, the SUBST_FILES.* variable lists each file individually.
6724: Thereby chances are higher that there are filename patterns in which no
6725: substitution happens. Since the SUBST framework cannot know whether the
6726: filename patterns in SUBST_FILES.* have been explicitly listed in the Makefile
6727: (where any redundant filename pattern would be suspicious) or been generated by
6728: a shell command (in which redundant filename patterns are more likely and to be
6729: expected), it will complain about these redundant filename patterns. Therefore,
6730: SUBST blocks that use a shell command to generate the list of filename patterns
6731: often need to set SUBST_NOOP_OK.* to yes.
6732:
6733: 21.1.11.3. Choosing what to substitute
6734:
6735: In most cases, the substitutions are given using one or more sed(1) commands,
6736: like this:
6737:
6738: SUBST_SED.path= -e 's|/usr/local|${PREFIX}|g'
6739:
6740: Each of the sed commands needs to be preceded by the -e option and should be
6741: specified on a line of its own, to avoid hiding short sed commands at the end
6742: of a line.
6743:
6744: Since the sed commands often contain shell metacharacters as the separator (the
6745: | in the above example), it is common to enclose them in single quotes.
6746:
6747: A common substitution is to replace placeholders of the form @VARNAME@ with
6748: their pkgsrc counterpart variable ${VARNAME}. A typical example is:
6749:
6750: SUBST_VARS.path= PREFIX
6751:
1.181 rillig 6752: This type of substitutions is typically done by the GNU configure scripts
6753: during the do-configure stage, but in some cases these need to be overridden.
6754: The same pattern is also used when a package defines patches that replace
6755: previously hard-coded paths like /usr/local with a @PREFIX@ placeholder first,
6756: which then gets substituted by the actual ${PREFIX} in the pre-configure stage.
6757: In many of these cases, it works equally well to just use the SUBST framework
6758: to directly replace /usr/local with ${PREFIX}, thereby omitting the
6759: intermediate patch file.
1.180 rillig 6760:
6761: If the above is not flexible enough, it is possible to not use sed at all for
6762: the substitution but to specify an entirely different command, like this:
6763:
6764: SUBST_FILTER_CMD.path= LC_ALL=C ${TR} -d '\r'
1.1 dsieger 6765:
1.180 rillig 6766: This is used for the few remaining packages in which the distributed files use
6767: Windows-style line endings that need to be converted to UNIX-style line
6768: endings.
1.1 dsieger 6769:
1.180 rillig 6770: 21.1.11.4. Other SUBST variables
1.172 rillig 6771:
1.180 rillig 6772: When a SUBST block is applied during a package build, a message is logged. The
6773: default message is fine for most purposes but can be overridden by setting
6774: SUBST_MESSAGE.* to an individual message.
1.1 dsieger 6775:
1.154 rillig 6776: 21.2. The fetch phase
1.1 dsieger 6777:
1.154 rillig 6778: 21.2.1. Packages whose distfiles aren't available for plain downloading
1.1 dsieger 6779:
6780: If you need to download from a dynamic URL you can set DYNAMIC_MASTER_SITES and
6781: a make fetch will call files/getsite.sh with the name of each file to download
6782: as an argument, expecting it to output the URL of the directory from which to
6783: download it. graphics/ns-cult3d is an example of this usage.
6784:
6785: If the download can't be automated, because the user must submit personal
6786: information to apply for a password, or must pay for the source, or whatever,
6787: you can set FETCH_MESSAGE to a list of lines that are displayed to the user
6788: before aborting the build. Example:
6789:
6790: FETCH_MESSAGE= "Please download the files"
6791: FETCH_MESSAGE+= " "${DISTFILES:Q}
6792: FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"."
6793:
1.154 rillig 6794: 21.2.2. How to handle modified distfiles with the 'old' name
1.1 dsieger 6795:
6796: Sometimes authors of a software package make some modifications after the
6797: software was released, and they put up a new distfile without changing the
6798: package's version number. If a package is already in pkgsrc at that time, the
6799: checksum will no longer match. The contents of the new distfile should be
6800: compared against the old one before changing anything, to make sure the
6801: distfile was really updated on purpose, and that no trojan horse or so crept
6802: in. Please mention that the distfiles were compared and what was found in your
1.54 rodent 6803: commit message.
6804:
6805: Then, the correct way to work around this is to set DIST_SUBDIR to a unique
1.109 wiz 6806: directory name, usually based on PKGNAME_NOREV (but take care with python or
6807: ruby packages, where PKGNAME includes a variable prefix). All DISTFILES and
6808: PATCHFILES for this package will be put in that subdirectory of the local
1.154 rillig 6809: distfiles directory. (See Section 21.1.10, "How to handle incrementing versions
1.109 wiz 6810: when fixing an existing package" for more details.) In case this happens more
6811: often, PKGNAME can be used (thus including the nbX suffix) or a date stamp can
6812: be appended, like ${PKGNAME_NOREV}-YYYYMMDD.
1.54 rodent 6813:
6814: DIST_SUBDIR is also used when a distfile's name does not contain a version and
6815: the distfile is apt to change. In cases where the likelihood of this is very
6816: small, DIST_SUBDIR might not be required. Additionally, DIST_SUBDIR must not be
6817: removed unless the distfile name changes, even if a package is being moved or
6818: renamed.
6819:
6820: Do not forget regenerating the distinfo file after that, since it contains the
6821: DIST_SUBDIR path in the filenames. Also, increase the PKGREVISION if the
6822: installed package is different. Furthermore, a mail to the package's authors
6823: seems appropriate telling them that changing distfiles after releases without
6824: changing the file names is not good practice.
1.1 dsieger 6825:
1.154 rillig 6826: 21.2.3. Packages hosted on github.com
1.88 tnn 6827:
1.90 tnn 6828: Helper methods exist for packages hosted on github.com which will often have
6829: distfile names that clash with other packages, for example 1.0.tar.gz. Use one
6830: of the three recipes from below:
1.88 tnn 6831:
1.154 rillig 6832: 21.2.3.1. Fetch based on a tagged release
1.88 tnn 6833:
1.189 bacon 6834: If your distfile URL looks similar to https://github.com/username/example/
6835: archive/v1.0.zip, then you are packaging a tagged release.
1.88 tnn 6836:
1.189 bacon 6837: DISTNAME= example-1.0
1.90 tnn 6838: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
1.189 bacon 6839: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
1.90 tnn 6840: GITHUB_TAG= v${PKGVERSION_NOREV}
1.88 tnn 6841: EXTRACT_SUFX= .zip
6842:
1.230 gutterid 6843: Here, DISTNAME combined with use of GITHUB_TAG leads the file fetching
6844: infrastructure to save the resulting file locally as example-1.0.zip.
6845:
1.189 bacon 6846: 21.2.3.2. Fetch based on a specific commit before the first release
6847:
6848: If your distfile looks similar to https://github.com/username/example/archive/
6849: 988881adc9fc3655077dc2d4d757d480b5ea0e11 and is from a commit before the first
6850: release, then set the package version to 0.0.0.N, where N is the number of
6851: commits to the repository, and set GITHUB_TAG to the commit hash. This will
6852: (almost) ensure that the first tagged release will have a version greater than
6853: this one so that package upgrades will function properly.
6854:
6855: DISTNAME= example-0.0.0.347
6856: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6857: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
6858: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
6859:
6860: 21.2.3.3. Fetch based on a specific commit after a release
1.88 tnn 6861:
1.189 bacon 6862: If your distfile looks similar to https://github.com/username/example/archive/
6863: 988881adc9fc3655077dc2d4d757d480b5ea0e11 and is from a commit after a release,
6864: then include the last release version and the commit count since that release
6865: in the package version and set GITHUB_TAG to the commit hash. The latest
6866: release and commit count are shown in the output of "git describe --tags":
6867:
6868: # git clone https://github.com/username/example
6869: # cd example
6870: # git describe --tags
6871: 1.2.3-5-g988881a
1.88 tnn 6872:
1.189 bacon 6873: DISTNAME= example-1.2.3.5
6874: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
6875: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
1.90 tnn 6876: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
1.88 tnn 6877:
1.189 bacon 6878: 21.2.3.4. Fetch based on release
1.88 tnn 6879:
1.189 bacon 6880: If your distfile URL looks similar to https://github.com/username/example/
6881: releases/download/rel-1.6/offensive-1.6.zip, then you are packaging a release.
1.88 tnn 6882:
1.90 tnn 6883: DISTNAME= offensive-1.6
1.88 tnn 6884: PKGNAME= ${DISTNAME:S/offensive/proper/}
1.90 tnn 6885: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
1.189 bacon 6886: GITHUB_PROJECT= example
1.90 tnn 6887: GITHUB_RELEASE= rel-${PKGVERSION_NOREV} # usually just set this to ${DISTNAME}
6888: EXTRACT_SUFX= .zip
1.88 tnn 6889:
1.154 rillig 6890: 21.3. The configure phase
1.1 dsieger 6891:
1.154 rillig 6892: 21.3.1. Shared libraries - libtool
1.1 dsieger 6893:
6894: pkgsrc supports many different machines, with different object formats like
6895: a.out and ELF, and varying abilities to do shared library and dynamic loading
6896: at all. To accompany this, varying commands and options have to be passed to
6897: the compiler, linker, etc. to get the Right Thing, which can be pretty annoying
6898: especially if you don't have all the machines at your hand to test things. The
6899: devel/libtool pkg can help here, as it just "knows" how to build both static
6900: and dynamic libraries from a set of source files, thus being
6901: platform-independent.
6902:
6903: Here's how to use libtool in a package in seven simple steps:
6904:
6905: 1. Add USE_LIBTOOL=yes to the package Makefile.
6906:
6907: 2. For library objects, use "${LIBTOOL} --mode=compile ${CC}" in place of "$
6908: {CC}". You could even add it to the definition of CC, if only libraries are
6909: being built in a given Makefile. This one command will build both PIC and
6910: non-PIC library objects, so you need not have separate shared and
6911: non-shared library rules.
6912:
6913: 3. For the linking of the library, remove any "ar", "ranlib", and "ld
6914: -Bshareable" commands, and instead use:
6915:
6916: ${LIBTOOL} --mode=link \
6917: ${CC} -o ${.TARGET:.a=.la} \
6918: ${OBJS:.o=.lo} \
6919: -rpath ${PREFIX}/lib \
6920: -version-info major:minor
6921:
6922: Note that the library is changed to have a .la extension, and the objects
6923: are changed to have a .lo extension. Change OBJS as necessary. This
6924: automatically creates all of the .a, .so.major.minor, and ELF symlinks (if
6925: necessary) in the build directory. Be sure to include "-version-info",
6926: especially when major and minor are zero, as libtool will otherwise strip
6927: off the shared library version.
6928:
6929: From the libtool manual:
6930:
6931: So, libtool library versions are described by three integers:
6932:
6933: CURRENT
6934: The most recent interface number that this library implements.
6935:
6936: REVISION
6937: The implementation number of the CURRENT interface.
6938:
6939: AGE
6940: The difference between the newest and oldest interfaces that
6941: this library implements. In other words, the library implements
6942: all the interface numbers in the range from number `CURRENT -
6943: AGE' to `CURRENT'.
6944:
6945: If two libraries have identical CURRENT and AGE numbers, then the
6946: dynamic linker chooses the library with the greater REVISION number.
6947:
6948: The "-release" option will produce different results for a.out and ELF
1.25 wiz 6949: (excluding symlinks) in only one case. An ELF library of the form "
6950: libfoo-release.so.x.y" will have a symlink of "libfoo.so.x.y" on an a.out
1.1 dsieger 6951: platform. This is handled automatically.
6952:
6953: The "-rpath argument" is the install directory of the library being built.
6954:
6955: In the PLIST, include only the .la file, the other files will be added
6956: automatically.
6957:
6958: 4. When linking shared object (.so) files, i.e. files that are loaded via
6959: dlopen(3), NOT shared libraries, use "-module -avoid-version" to prevent
6960: them getting version tacked on.
6961:
6962: The PLIST file gets the foo.so entry.
6963:
6964: 5. When linking programs that depend on these libraries before they are
6965: installed, preface the cc(1) or ld(1) line with "${LIBTOOL} --mode=link",
6966: and it will find the correct libraries (static or shared), but please be
6967: aware that libtool will not allow you to specify a relative path in -L
6968: (such as "-L../somelib"), because it expects you to change that argument to
6969: be the .la file. e.g.
6970:
6971: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
6972:
6973: should be changed to:
6974:
6975: ${LIBTOOL} --mode=link ${CC} -o someprog ../somelib/somelib.la
6976:
6977: and it will do the right thing with the libraries.
6978:
6979: 6. When installing libraries, preface the install(1) or cp(1) command with "$
6980: {LIBTOOL} --mode=install", and change the library name to .la. e.g.
6981:
1.23 jakllsch 6982: ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1 dsieger 6983:
6984: This will install the static .a, shared library, any needed symlinks, and
6985: run ldconfig(8).
6986:
6987: 7. In your PLIST, include only the .la file (this is a change from previous
6988: behaviour).
6989:
1.154 rillig 6990: 21.3.2. Using libtool on GNU packages that already support libtool
1.1 dsieger 6991:
6992: Add USE_LIBTOOL=yes to the package Makefile. This will override the package's
6993: own libtool in most cases. For older libtool using packages, libtool is made by
6994: ltconfig script during the do-configure step; you can check the libtool script
6995: location by doing make configure; find work*/ -name libtool.
6996:
6997: LIBTOOL_OVERRIDE specifies which libtool scripts, relative to WRKSRC, to
6998: override. By default, it is set to "libtool */libtool */*/libtool". If this
6999: does not match the location of the package's libtool script(s), set it as
7000: appropriate.
7001:
7002: If you do not need *.a static libraries built and installed, then use
7003: SHLIBTOOL_OVERRIDE instead.
7004:
7005: If your package makes use of the platform-independent library for loading
7006: dynamic shared objects, that comes with libtool (libltdl), you should include
7007: devel/libltdl/buildlink3.mk.
7008:
7009: Some packages use libtool incorrectly so that the package may not work or build
7010: in some circumstances. Some of the more common errors are:
7011:
7012: * The inclusion of a shared object (-module) as a dependent library in an
7013: executable or library. This in itself isn't a problem if one of two things
7014: has been done:
7015:
7016: 1. The shared object is named correctly, i.e. libfoo.la, not foo.la
7017:
7018: 2. The -dlopen option is used when linking an executable.
7019:
7020: * The use of libltdl without the correct calls to initialisation routines.
7021: The function lt_dlinit() should be called and the macro
7022: LTDL_SET_PRELOADED_SYMBOLS included in executables.
7023:
1.154 rillig 7024: 21.3.3. GNU Autoconf/Automake
1.1 dsieger 7025:
7026: If a package needs GNU autoconf or automake to be executed to regenerate the
1.223 nia 7027: configure script and Makefile.in makefile templates from configure.ac and
7028: Makefile.am, then they should be executed in a pre-configure target:
1.1 dsieger 7029:
1.223 nia 7030: USE_TOOLS+= autoconf automake autoreconf
7031: GNU_CONFIGURE= yes
1.1 dsieger 7032: ...
7033:
7034: pre-configure:
1.223 nia 7035: set -e; cd ${WRKSRC} && autoreconf -fi
1.1 dsieger 7036: ...
7037:
1.223 nia 7038: Packages which use GNU Automake will sometimes require GNU Make (gmake in
7039: USE_TOOLS), but not always. Note that autoreconf only needs to be executed if
7040: configure.ac or Makefiles are modified, or configure is not present.
1.1 dsieger 7041:
7042: There are times when the configure process makes additional changes to the
7043: generated files, which then causes the build process to try to re-execute the
7044: automake sequence. This is prevented by touching various files in the configure
7045: stage. If this causes problems with your package you can set AUTOMAKE_OVERRIDE=
7046: NO in the package Makefile.
7047:
1.223 nia 7048: 21.3.4. Meson / ninja
7049:
7050: Packages using Meson to configure need to include:
7051:
7052: .include "../../devel/meson/build.mk"
7053:
7054: In nearly all cases (any program with dependencies), pkg-config needs to be
7055: added to USE_TOOLS. If the package installs translation files for non-English
7056: languages, also add msgfmt and xgettext:
7057:
7058: USE_TOOLS+= pkg-config msgfmt xgettext
7059:
7060: If any options need to be passed to Meson, use MESON_ARGS instead of
7061: CONFIGURE_ARGS:
7062:
7063: MESON_ARGS+= -Dx11=false
7064:
1.154 rillig 7065: 21.4. Programming languages
1.1 dsieger 7066:
1.154 rillig 7067: 21.4.1. C, C++, and Fortran
1.1 dsieger 7068:
1.223 nia 7069: Compilers for the C and C++ languages comes with the NetBSD base system. By
7070: default, pkgsrc assumes that a package is written in C and will hide all other
7071: compilers (via the wrapper framework, see Chapter 18, Buildlink methodology).
1.1 dsieger 7072:
7073: To declare which language's compiler a package needs, set the USE_LANGUAGES
1.212 wiz 7074: variable. Allowed values currently are:
7075:
7076: c99, c++, c++03, gnu++03, c++0x, gnu++0x, c++11, gnu++11,
7077: c++14, gnu++14, c++17, gnu++17, c++20, gnu++20, fortran,
7078: fortran77, java, objc, obj-c++, and ada.
7079:
7080:
7081: (and any combination). The default is "c". Packages using GNU configure
7082: scripts, even if written in C++, usually need a C compiler for the configure
7083: phase.
1.1 dsieger 7084:
1.223 nia 7085: To express a general requirement on a specific C or C++ version, normally only
7086: GCC_REQD needs to be set. For example, GCC 7 includes support for C++17, so if
7087: the package uses C++17 it should specify:
7088:
7089: GCC_REQD+= 7
7090:
7091:
7092: Language variants like c++11 for USE_LANGUAGES should only be specified if the
7093: package does not explicitly set -std=... when compiling (i.e. the package
7094: assumes the compiler defaults to C++11 or some other standard). This is usually
7095: a bug in the upstream build system.
7096:
7097: GCC version 5 includes support for C++14, while GCC 4.7 includes more-or-less
7098: complete support for C++11. For more information, consult GCC's own
7099: documentation on programming language support.
7100:
1.154 rillig 7101: 21.4.2. Java
1.1 dsieger 7102:
7103: If a program is written in Java, use the Java framework in pkgsrc. The package
7104: must include ../../mk/java-vm.mk. This Makefile fragment provides the following
7105: variables:
7106:
7107: * USE_JAVA defines if a build dependency on the JDK is added. If USE_JAVA is
7108: set to "run", then there is only a runtime dependency on the JDK. The
7109: default is "yes", which also adds a build dependency on the JDK.
7110:
7111: * Set USE_JAVA2 to declare that a package needs a Java2 implementation. The
7112: supported values are "yes", "1.4", and "1.5". "yes" accepts any Java2
7113: implementation, "1.4" insists on versions 1.4 or above, and "1.5" only
7114: accepts versions 1.5 or above. This variable is not set by default.
7115:
1.25 wiz 7116: * PKG_JAVA_HOME is automatically set to the runtime location of the used Java
7117: implementation dependency. It may be used to set JAVA_HOME to a good value
7118: if the program needs this variable to be defined.
7119:
1.205 wiz 7120: 21.4.3. Go
7121:
7122: If a program is written in Go and has any dependencies on other Go modules,
7123: have the package include ../../lang/go/go-module.mk.
7124:
7125: 1. Generate a list of those dependencies with make clean && make patch && make
7126: show-go-modules > go-modules.mk.
7127:
1.223 nia 7128: 2. Prepend .include "go-modules.mk" to any other .includes.
7129:
7130: 3. Incorporate these modules in distinfo with make makesum.
1.205 wiz 7131:
1.223 nia 7132: 21.4.4. Rust
1.205 wiz 7133:
1.223 nia 7134: If a program is written in Rust and uses Cargo to build, have the package
7135: include ../../lang/rust/cargo.mk.
1.205 wiz 7136:
1.223 nia 7137: 1. Generate a list of those dependencies with make CARGO_ARGS="build
7138: --release" build && make print-cargo-depends > cargo-depends.mk.
1.205 wiz 7139:
1.223 nia 7140: 2. Prepend .include "cargo-depends.mk" to any other .includes.
1.205 wiz 7141:
7142: 3. Incorporate these modules in distinfo with make makesum.
7143:
1.223 nia 7144: 21.4.5. Packages containing Perl scripts
1.1 dsieger 7145:
1.203 nia 7146: If your package contains interpreted Perl scripts, add "perl" to the USE_TOOLS
1.1 dsieger 7147: variable and set REPLACE_PERL to ensure that the proper interpreter path is
7148: set. REPLACE_PERL should contain a list of scripts, relative to WRKSRC, that
1.74 wiz 7149: you want adjusted. Every occurrence of */bin/perl in a she-bang line will be
1.210 gutterid 7150: replaced with the full path to the Perl executable.
1.1 dsieger 7151:
1.210 gutterid 7152: If a particular version of Perl is needed, set the PERL5_REQD variable to the
1.1 dsieger 7153: version number. The default is "5.0".
7154:
1.203 nia 7155: See Section 21.6.6, "Packages installing Perl modules" for information about
1.210 gutterid 7156: handling Perl modules.
7157:
7158: There is also the REPLACE_PERL6 variable for the language now known as Raku.
1.1 dsieger 7159:
1.223 nia 7160: 21.4.6. Packages containing shell scripts
1.41 wiz 7161:
7162: REPLACE_SH, REPLACE_BASH, REPLACE_CSH, and REPLACE_KSH can be used to replace
1.225 gutterid 7163: shell she-bangs in files. Please use the appropriate one, preferring REPLACE_SH
7164: when this shell is sufficient. Each should contain a list of scripts, relative
7165: to WRKSRC, that you want adjusted. Every occurrence of the matching shell in a
7166: she-bang line will be replaced with the full path to the shell executable. When
7167: using REPLACE_BASH, don't forget to add bash to USE_TOOLS.
1.41 wiz 7168:
1.223 nia 7169: 21.4.7. Other programming languages
1.1 dsieger 7170:
1.210 gutterid 7171: There are further similar REPLACE variables available, e.g., REPLACE_AWK for
7172: packages containing awk scripts, and REPLACE_R for R. These two, like the
1.211 gutterid 7173: others noted above, have their actions defined centrally in mk/configure/
7174: replace-interpreter.mk. Other languages define the actions of these variables
7175: within their own dedicated part of the tree, e.g., REPLACE_PHP is actioned in
7176: lang/php/phpversion.mk, and REPLACE_PYTHON is actioned in lang/python/
7177: application.mk. For other languages, consult the mk files found within their
1.216 gutterid 7178: specific directories (the naming convention varies), or check the list found in
7179: Appendix E, Help topics.
1.210 gutterid 7180:
7181: Currently, special handling for other languages varies in pkgsrc. If a compiler
7182: package provides a buildlink3.mk file, include that, otherwise just add a
7183: (build) dependency on the appropriate compiler package.
1.1 dsieger 7184:
1.154 rillig 7185: 21.5. The build phase
1.1 dsieger 7186:
7187: The most common failures when building a package are that some platforms do not
7188: provide certain header files, functions or libraries, or they provide the
7189: functions in a library that the original package author didn't know. To work
7190: around this, you can rewrite the source code in most cases so that it does not
7191: use the missing functions or provides a replacement function.
7192:
1.154 rillig 7193: 21.5.1. Compiling C and C++ code conditionally
1.1 dsieger 7194:
7195: If a package already comes with a GNU configure script, the preferred way to
7196: fix the build failure is to change the configure script, not the code. In the
7197: other cases, you can utilize the C preprocessor, which defines certain macros
7198: depending on the operating system and hardware architecture it compiles for.
7199: These macros can be queried using for example #if defined(__i386). Almost every
7200: operating system, hardware architecture and compiler has its own macro. For
7201: example, if the macros __GNUC__, __i386__ and __NetBSD__ are all defined, you
7202: know that you are using NetBSD on an i386 compatible CPU, and your compiler is
7203: GCC.
7204:
7205: The list of the following macros for hardware and operating system depends on
7206: the compiler that is used. For example, if you want to conditionally compile
7207: code on Solaris, don't use __sun__, as the SunPro compiler does not define it.
7208: Use __sun instead.
7209:
1.154 rillig 7210: 21.5.1.1. C preprocessor macros to identify the operating system
1.1 dsieger 7211:
1.223 nia 7212: To distinguish between specific NetBSD versions, you should use the following
7213: code.
7214:
7215: #ifdef __NetBSD__
7216: #include <sys/param.h>
7217: #if __NetBSD_Prereq__(9,99,17)
7218: /* use a newer feature */
7219: #else
7220: /* older code */
7221: #endif
7222: #endif
7223:
7224: #ifndef _WIN32
7225: /* Unix-like specific code */
7226: #endif
7227:
1.1 dsieger 7228: To distinguish between 4.4 BSD-derived systems and the rest of the world, you
7229: should use the following code.
7230:
7231: #include <sys/param.h>
7232: #if (defined(BSD) && BSD >= 199306)
7233: /* BSD-specific code goes here */
7234: #else
7235: /* non-BSD-specific code goes here */
7236: #endif
7237:
1.223 nia 7238: You can also test for the following macros:
1.1 dsieger 7239:
1.46 obache 7240: Cygwin __CYGWIN__
7241: DragonFly __DragonFly__
1.1 dsieger 7242: FreeBSD __FreeBSD__
1.46 obache 7243: Haiku __HAIKU__
1.1 dsieger 7244: Interix __INTERIX
7245: IRIX __sgi (TODO: get a definite source for this)
1.223 nia 7246: Linux __linux
1.83 dholland 7247: Mac OS X __APPLE__
1.46 obache 7248: MirBSD __MirBSD__ (__OpenBSD__ is also defined)
7249: Minix3 __minix
1.1 dsieger 7250: NetBSD __NetBSD__
7251: OpenBSD __OpenBSD__
7252: Solaris sun, __sun
7253:
1.154 rillig 7254: 21.5.1.2. C preprocessor macros to identify the hardware architecture
1.1 dsieger 7255:
7256: i386 i386, __i386, __i386__
1.223 nia 7257: x86-64 __amd64__, __x86_64__
7258: ARM __arm__
1.1 dsieger 7259: MIPS __mips
7260: SPARC sparc, __sparc
1.223 nia 7261: PowerPC __powerpc
1.1 dsieger 7262:
1.154 rillig 7263: 21.5.1.3. C preprocessor macros to identify the compiler
1.1 dsieger 7264:
7265: GCC __GNUC__ (major version), __GNUC_MINOR__
7266: MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41)
7267: SunPro __SUNPRO_C (0x570 for Sun C 5.7)
7268: SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8)
7269:
1.154 rillig 7270: 21.5.2. How to handle compiler bugs
1.1 dsieger 7271:
7272: Some source files trigger bugs in the compiler, based on combinations of
7273: compiler version and architecture and almost always relation to optimisation
7274: being enabled. Common symptoms are gcc internal errors or never finishing
7275: compiling a file.
7276:
7277: Typically, a workaround involves testing the MACHINE_ARCH and compiler version,
1.87 tnn 7278: disabling optimisation for that combination of file, MACHINE_ARCH and compiler.
7279:
7280: This used to be a big problem in the past, but is rarely needed now as compiler
7281: technology has matured. If you still need to add a compiler specific
7282: workaround, please do so in the file hacks.mk and describe the symptom and
7283: compiler version as detailed as possible.
1.1 dsieger 7284:
1.172 rillig 7285: 21.5.3. No such file or directory
7286:
7287: Compilation sometimes fails with an error message like this:
7288:
7289: .../x11/gtk3/work/gtk+-3.24.12/gdk/gdktypes.h:35:10:
7290: fatal error: pango/pango.h: No such file or directory
7291:
7292: The proper way to fix this problem depends on the type of the header, which is
7293: described in the following sections.
7294:
7295: 21.5.3.1. Headers from other packages
7296:
7297: If the header name looks like it comes from a different package, that other
7298: package should be included via the buildlink3 framework.
7299:
7300: First, look whether the header is somewhere in the buildlink3 directory below
7301: WRKDIR. In the above case of the missing Pango header:
7302:
7303: $ find work/.buildlink/ -print | grep -F pango/pango.h
7304:
7305: In the case of Pango, the output is:
7306:
7307: work/.buildlink/include/pango-1.0/pango/pango.h
7308:
7309: If the pango/pango.h file were placed directly in the .buildlink directory, it
7310: would have been found automatically. There is an extra pango-1.0 path component
7311: though, which means that the compiler command line must contain an option of
7312: the form -I${BUILDLINK3_PREFIX.pango}/include/pango-1.0. In most cases this
7313: option is generated by the configure script, which can be examined using:
7314:
7315: $ $ grep -o '[-]I[^[:space:]]*/pango[^[:space:]]*' work/*/Makefile
7316: -I/usr/pkg/include/pango-1.0
7317: -I/usr/pkg/include/pango-1.0
7318: -I/usr/pkg/include/pango-1.0
7319: -I/usr/pkg/include/pango-1.0
7320: -I/usr/pkg/include/pango-1.0
7321:
7322: This looks good. These options are transformed by the buildlink wrapper to
7323: refer to the correct path inside work/.buildlink.
7324:
7325: Since the compilation fails though, examine the compiler command lines in work
7326: /.work.log to see whether the -I option is included in the particular command
7327: line.
7328:
7329: To further analyze the situation, run bmake build-env, which sets up an
7330: interactive, realistic environment including all the pkgsrc wrapper commands
7331: and environment variables. From there, try to compile some simple example
7332: programs that use the header.
7333:
7334: 21.5.3.2. Headers generated during the build
7335:
7336: If the name of the header seems to come from the package itself, and if the
7337: build is run with parallel jobs, the package may have some undeclared
7338: dependencies between the .c and the .h files, and a C file is compiled before
7339: its required header is generated.
7340:
7341: To see whether the build runs with parallel jobs, run bmake show-all-build |
7342: grep JOBS. Its output looks like this:
7343:
7344: usr MAKE_JOBS= 7
7345: pkg MAKE_JOBS_SAFE # undefined
7346: def _MAKE_JOBS_N= 7
7347:
7348: In this case the pkgsrc user has asked pkgsrc to build packages with 7 jobs in
7349: parallel (MAKE_JOBS). The package could have disabled parallel builds by
7350: setting MAKE_JOBS_SAFE to no, but in this case it hasn't.
7351:
7352: To see whether the build failure is caused by parallel builds, first save the
7353: exact error message and a bit of context, maybe you need it later for reporting
7354: a bug. Next, run:
7355:
7356: MAKE_JOBS_SAFE=no bmake clean build
7357:
7358: If that succeeds, file a bug report against the pkgsrc package, including the
7359: exact error message and the contents of your mk.conf file.
7360:
1.173 rillig 7361: 21.5.3.3. Symlinks
7362:
7363: Pkgsrc does not work reliably if any of LOCALBASE, VARBASE or WRKDIR contains a
7364: symlink. Since 2019Q2, the pkgsrc bootstrap program prevents installing pkgsrc
7365: in symlink-based directories. Existing pkgsrc installations are not checked for
7366: symlinks though.
7367:
7368: The "No such file or directory" error messages are a typical symptom of
7369: symlinks, and it's quite difficult to find out that this is the actual cause.
7370:
7371: 21.5.3.4. Stale working directories
7372:
7373: When building a hierarchy of packages, it may happen that one package is built
7374: and then pkgsrc is updated. This situation can provoke various hard to diagnose
7375: build errors. To clean up the situation:
7376:
1.223 nia 7377: $ (cd ../../ && cat mk/bsd.pkg.mk >/dev/null && rm -rf */*/work)
1.173 rillig 7378:
1.223 nia 7379: (The only purpose of the bsd.pkg.mk is to prevent running this command in the
7380: wrong directory.)
1.173 rillig 7381:
7382: If you have set WRKOBJDIR in mk.conf, remove that directory as well.
7383:
7384: 21.5.3.5. Other possible reasons
7385:
7386: On platforms other than BSD, third-party packages are installed in /usr/
7387: include, together with the base system. This means that pkgsrc cannot
7388: distinguish between headers provided by the base system (which it needs) and
7389: headers from third-party packages (which are often included in pkgsrc as well).
7390: This can lead to subtle version mismatches.
7391:
7392: In pkgsrc installations that have been active for several years, it may happen
7393: that some files are manually deleted. To exclude this unlikely reason, run
7394: pkg_admin check.
7395:
7396: It may help to run pkg_admin rebuild-tree to check/fix dependencies.
7397:
7398: If all of the above doesn't help, see Chapter 2, Getting help for contact
7399: information. Be prepared to describe what you have tried so far and what any
7400: error messages were.
7401:
1.172 rillig 7402: 21.5.4. Undefined reference to "..."
1.1 dsieger 7403:
7404: This error message often means that a package did not link to a shared library
7405: it needs. The following functions are known to cause this error message over
7406: and over.
7407:
7408: +-----------------------------------------------------+
7409: | Function |Library |Affected platforms|
7410: |-------------------------+--------+------------------|
7411: |accept, bind, connect |-lsocket|Solaris |
7412: |-------------------------+--------+------------------|
7413: |crypt |-lcrypt |DragonFly, NetBSD |
7414: |-------------------------+--------+------------------|
7415: |dlopen, dlsym |-ldl |Linux |
7416: |-------------------------+--------+------------------|
7417: |gethost* |-lnsl |Solaris |
7418: |-------------------------+--------+------------------|
7419: |inet_aton |-lresolv|Solaris |
7420: |-------------------------+--------+------------------|
7421: |nanosleep, sem_*, timer_*|-lrt |Solaris |
7422: |-------------------------+--------+------------------|
7423: |openpty |-lutil |Linux |
7424: +-----------------------------------------------------+
7425:
1.223 nia 7426: To fix these linker errors, it is often sufficient to add LIBS.OperatingSystem+
7427: = -lfoo to the package Makefile and then run bmake clean; bmake.
1.1 dsieger 7428:
1.223 nia 7429: 21.5.4.1. The SunPro compiler and inline functions
1.1 dsieger 7430:
7431: When you are using the SunPro compiler, there is another possibility. That
7432: compiler cannot handle the following code:
7433:
7434: extern int extern_func(int);
7435:
7436: static inline int
7437: inline_func(int x)
7438: {
7439: return extern_func(x);
7440: }
7441:
7442: int main(void)
7443: {
7444: return 0;
7445: }
7446:
7447: It generates the code for inline_func even if that function is never used. This
7448: code then refers to extern_func, which can usually not be resolved. To solve
7449: this problem you can try to tell the package to disable inlining of functions.
7450:
1.228 gutterid 7451: 21.5.4.2. Missing atomic functions
7452:
7453: When building for older machine architectures (e.g., i386, PowerPC), builds may
7454: fail because the package expects modern 64-bit atomic functions which the
7455: underlying hardware either doesn't support, or will only support with specific
7456: compiler flags. This is generally handled via inclusion of mk/atomic64.mk.
7457:
1.172 rillig 7458: 21.5.5. Running out of memory
1.1 dsieger 7459:
7460: Sometimes packages fail to build because the compiler runs into an operating
7461: system specific soft limit. With the UNLIMIT_RESOURCES variable pkgsrc can be
1.223 nia 7462: told to unlimit the resources. The allowed values are any combination of "
7463: cputime", "datasize", "memorysize", "stacksize" and "virtualsize". Setting this
7464: variable is similar to running the shell builtin ulimit command to raise the
7465: maximum data segment size or maximum stack size of a process, respectively, to
7466: their hard limits.
1.1 dsieger 7467:
1.154 rillig 7468: 21.6. The install phase
1.1 dsieger 7469:
1.154 rillig 7470: 21.6.1. Creating needed directories
1.1 dsieger 7471:
7472: The BSD-compatible install supplied with some operating systems cannot create
7473: more than one directory at a time. As such, you should call ${INSTALL_*_DIR}
7474: like this:
7475:
7476: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
7477: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
7478:
1.223 nia 7479: Instead of running the install commands directly, you can also append "dir1
7480: dir2" to the INSTALLATION_DIRS variable, which will automatically do the right
7481: thing.
1.1 dsieger 7482:
1.154 rillig 7483: 21.6.2. Where to install documentation
1.1 dsieger 7484:
7485: In general, documentation should be installed into ${PREFIX}/share/doc/$
1.223 nia 7486: {PKGBASE} or ${PREFIX}/share/doc/${PKGNAME_NOREV} (the latter includes the
7487: version number of the package).
1.1 dsieger 7488:
7489: Many modern packages using GNU autoconf allow to set the directory where HTML
7490: documentation is installed with the "--with-html-dir" option. Sometimes using
7491: this flag is needed because otherwise the documentation ends up in ${PREFIX}/
1.223 nia 7492: share/doc/html or other places. In pkgsrc, the HTML documentation should go
7493: into the package-specific directory, just like any other documentation.
1.1 dsieger 7494:
7495: An exception to the above is that library API documentation generated with the
7496: textproc/gtk-doc tools, for use by special browsers (devhelp) should be left at
7497: their default location, which is ${PREFIX}/share/gtk-doc. Such documentation
7498: can be recognized from files ending in .devhelp or .devhelp2. (It is also
7499: acceptable to install such files in ${PREFIX}/share/doc/${PKGBASE} or ${PREFIX}
7500: /share/doc/${PKGNAME}; the .devhelp* file must be directly in that directory
7501: then, no additional subdirectory level is allowed in this case. This is usually
7502: achieved by using "--with-html-dir=${PREFIX}/share/doc". ${PREFIX}/share/
7503: gtk-doc is preferred though.)
7504:
1.154 rillig 7505: 21.6.3. Installing highscore files
1.1 dsieger 7506:
7507: Certain packages, most of them in the games category, install a score file that
7508: allows all users on the system to record their highscores. In order for this to
7509: work, the binaries need to be installed setgid and the score files owned by the
1.36 wiz 7510: appropriate group and/or owner (traditionally the "games" user/group). Set
7511: USE_GAMESGROUP to yes to support this. The following variables, documented in
7512: more detail in mk/defaults/mk.conf, control this behaviour: GAMEDATAMODE,
1.100 leot 7513: GAMEDIRMODE, GAMES_GROUP, GAMEMODE, GAME_USER. Other useful variables are:
7514: GAMEDIR_PERMS, GAMEDATA_PERMS and SETGID_GAMES_PERMS.
7515:
7516: An example that illustrates some of the variables described above is games/
7517: moon-buggy. OWN_DIRS_PERMS is used to properly set directory permissions of the
7518: directory where the scorefile is saved, REQD_FILES_PERMS is used to create a
7519: dummy scorefile (mbscore) with the proper permissions and SPECIAL_PERMS is used
7520: to install setgid the game binary:
7521:
7522: USE_GAMESGROUP= yes
7523:
7524: BUILD_DEFS+= VARBASE
7525:
7526: OWN_DIRS_PERMS+= ${VARBASE}/games/moon-buggy ${GAMEDIR_PERMS}
7527: REQD_FILES_PERMS+= /dev/null ${VARBASE}/games/moon-buggy/mbscore ${GAMEDATA_PERMS}
7528: SPECIAL_PERMS+= ${PREFIX}/bin/moon-buggy ${SETGID_GAMES_PERMS}
7529:
7530: Various INSTALL_* variables are also available: INSTALL_GAME to install setgid
7531: game binaries, INSTALL_GAME_DIR to install game directories that are needed to
7532: be accessed by setgid games and INSTALL_GAME_DATA to install scorefiles.
1.1 dsieger 7533:
1.14 jmcneill 7534: A package should therefore never hard code file ownership or access permissions
1.100 leot 7535: but rely on *_PERMS as described above or alternatively on INSTALL_GAME,
7536: INSTALL_GAME_DATA and INSTALL_GAME_DIR to set these correctly.
1.1 dsieger 7537:
1.154 rillig 7538: 21.6.4. Adding DESTDIR support to packages
1.4 rillig 7539:
1.14 jmcneill 7540: DESTDIR support means that a package installs into a staging directory, not the
7541: final location of the files. Then a binary package is created which can be used
7542: for installation as usual. There are two ways: Either the package must install
1.25 wiz 7543: as root ("destdir") or the package can install as non-root user ("user-destdir"
7544: ).
1.14 jmcneill 7545:
1.113 leot 7546: * PKG_DESTDIR_SUPPORT has to be set to "destdir" or "user-destdir". By
7547: default PKG_DESTDIR_SUPPORT is set to "user-destdir" to help catching more
7548: potential packaging problems. If bsd.prefs.mk is included in the Makefile,
7549: PKG_DESTDIR_SUPPORT needs to be set before the inclusion.
1.14 jmcneill 7550:
1.4 rillig 7551: * All installation operations have to be prefixed with ${DESTDIR}.
7552:
7553: * automake gets this DESTDIR mostly right automatically. Many manual rules
7554: and pre/post-install often are incorrect; fix them.
7555:
1.17 imil 7556: * If files are installed with special owner/group use SPECIAL_PERMS.
1.4 rillig 7557:
7558: * In general, packages should support UNPRIVILEGED to be able to use DESTDIR.
7559:
1.154 rillig 7560: 21.6.5. Packages with hardcoded paths to other interpreters
1.1 dsieger 7561:
7562: Your package may also contain scripts with hardcoded paths to other
1.203 nia 7563: interpreters besides (or as well as) Perl. To correct the full pathname to the
1.1 dsieger 7564: script interpreter, you need to set the following definitions in your Makefile
7565: (we shall use tclsh in this example):
7566:
7567: REPLACE_INTERPRETER+= tcl
7568: REPLACE.tcl.old= .*/bin/tclsh
7569: REPLACE.tcl.new= ${PREFIX}/bin/tclsh
7570: REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
7571: # relative to ${WRKSRC}, just as in REPLACE_PERL
7572:
1.203 nia 7573: 21.6.6. Packages installing Perl modules
1.1 dsieger 7574:
7575: Makefiles of packages providing perl5 modules should include the Makefile
7576: fragment ../../lang/perl5/module.mk. It provides a do-configure target for the
7577: standard perl configuration for such modules as well as various hooks to tune
7578: this configuration. See comments in this file for details.
7579:
7580: Perl5 modules will install into different places depending on the version of
7581: perl used during the build process. To address this, pkgsrc will append lines
7582: to the PLIST corresponding to the files listed in the installed .packlist file
7583: generated by most perl5 modules. This is invoked by defining PERL5_PACKLIST to
1.48 wiz 7584: a space-separated list of packlist files relative to PERL5_PACKLIST_DIR
7585: (PERL5_INSTALLVENDORARCH by default), e.g.:
1.1 dsieger 7586:
1.48 wiz 7587: PERL5_PACKLIST= auto/Pg/.packlist
1.1 dsieger 7588:
1.48 wiz 7589: The perl5 config variables installarchlib, installscript, installvendorbin,
7590: installvendorscript, installvendorarch, installvendorlib, installvendorman1dir,
7591: and installvendorman3dir represent those locations in which components of perl5
7592: modules may be installed, provided as variable with uppercase and prefixed with
7593: PERL5_, e.g. PERL5_INSTALLARCHLIB and may be used by perl5 packages that don't
7594: have a packlist. These variables are also substituted for in the PLIST as
7595: uppercase prefixed with PERL5_SUB_.
1.1 dsieger 7596:
1.154 rillig 7597: 21.6.7. Packages installing info files
1.1 dsieger 7598:
7599: Some packages install info files or use the "makeinfo" or "install-info"
7600: commands. INFO_FILES should be defined in the package Makefile so that INSTALL
7601: and DEINSTALL scripts will be generated to handle registration of the info
7602: files in the Info directory file. The "install-info" command used for the info
7603: files registration is either provided by the system, or by a special purpose
7604: package automatically added as dependency if needed.
7605:
7606: PKGINFODIR is the directory under ${PREFIX} where info files are primarily
7607: located. PKGINFODIR defaults to "info" and can be overridden by the user.
7608:
7609: The info files for the package should be listed in the package PLIST; however
7610: any split info files need not be listed.
7611:
7612: A package which needs the "makeinfo" command at build time must add "makeinfo"
7613: to USE_TOOLS in its Makefile. If a minimum version of the "makeinfo" command is
7614: needed it should be noted with the TEXINFO_REQD variable in the package
7615: Makefile. By default, a minimum version of 3.12 is required. If the system does
7616: not provide a makeinfo command or if it does not match the required minimum, a
7617: build dependency on the devel/gtexinfo package will be added automatically.
7618:
7619: The build and installation process of the software provided by the package
7620: should not use the install-info command as the registration of info files is
1.25 wiz 7621: the task of the package INSTALL script, and it must use the appropriate
1.1 dsieger 7622: makeinfo command.
7623:
7624: To achieve this goal, the pkgsrc infrastructure creates overriding scripts for
7625: the install-info and makeinfo commands in a directory listed early in PATH.
7626:
7627: The script overriding install-info has no effect except the logging of a
7628: message. The script overriding makeinfo logs a message and according to the
7629: value of TEXINFO_REQD either runs the appropriate makeinfo command or exit on
7630: error.
7631:
1.154 rillig 7632: 21.6.8. Packages installing man pages
1.1 dsieger 7633:
7634: All packages that install manual pages should install them into the same
7635: directory, so that there is one common place to look for them. In pkgsrc, this
7636: place is ${PREFIX}/${PKGMANDIR}, and this expression should be used in
1.25 wiz 7637: packages. The default for PKGMANDIR is "man". Another often-used value is "
7638: share/man".
1.1 dsieger 7639:
7640: Note
7641:
7642: The support for a custom PKGMANDIR is far from complete.
7643:
7644: The PLIST files can just use man/ as the top level directory for the man page
7645: file entries, and the pkgsrc framework will convert as needed. In all other
7646: places, the correct PKGMANDIR must be used.
7647:
7648: Packages that are configured with GNU_CONFIGURE set as "yes", by default will
7649: use the ./configure --mandir switch to set where the man pages should be
7650: installed. The path is GNU_CONFIGURE_MANDIR which defaults to ${PREFIX}/$
7651: {PKGMANDIR}.
7652:
7653: Packages that use GNU_CONFIGURE but do not use --mandir, can set
7654: CONFIGURE_HAS_MANDIR to "no". Or if the ./configure script uses a non-standard
7655: use of --mandir, you can set GNU_CONFIGURE_MANDIR as needed.
7656:
1.184 rillig 7657: See Section 19.5, "Man page compression" for information on installation of
1.1 dsieger 7658: compressed manual pages.
7659:
1.203 nia 7660: 21.6.9. Packages installing X11 fonts
1.1 dsieger 7661:
7662: If a package installs font files, you will need to rebuild the fonts database
7663: in the directory where they get installed at installation and deinstallation
7664: time. This can be automatically done by using the pkginstall framework.
7665:
7666: You can list the directories where fonts are installed in the FONTS_DIRS.type
7667: variables, where type can be one of "ttf", "type1" or "x11". Also make sure
7668: that the database file fonts.dir is not listed in the PLIST.
7669:
7670: Note that you should not create new directories for fonts; instead use the
7671: standard ones to avoid that the user needs to manually configure his X server
7672: to find them.
7673:
1.203 nia 7674: 21.6.10. Packages installing SGML or XML data
1.1 dsieger 7675:
7676: If a package installs SGML or XML data files that need to be registered in
7677: system-wide catalogs (like DTDs, sub-catalogs, etc.), you need to take some
7678: extra steps:
7679:
7680: 1. Include ../../textproc/xmlcatmgr/catalogs.mk in your Makefile, which takes
7681: care of registering those files in system-wide catalogs at installation and
7682: deinstallation time.
7683:
7684: 2. Set SGML_CATALOGS to the full path of any SGML catalogs installed by the
7685: package.
7686:
7687: 3. Set XML_CATALOGS to the full path of any XML catalogs installed by the
7688: package.
7689:
7690: 4. Set SGML_ENTRIES to individual entries to be added to the SGML catalog.
7691: These come in groups of three strings; see xmlcatmgr(1) for more
7692: information (specifically, arguments recognized by the 'add' action). Note
7693: that you will normally not use this variable.
7694:
7695: 5. Set XML_ENTRIES to individual entries to be added to the XML catalog. These
7696: come in groups of three strings; see xmlcatmgr(1) for more information
7697: (specifically, arguments recognized by the 'add' action). Note that you
7698: will normally not use this variable.
7699:
1.203 nia 7700: 21.6.11. Packages installing extensions to the MIME database
1.1 dsieger 7701:
7702: If a package provides extensions to the MIME database by installing .xml files
7703: inside ${PREFIX}/share/mime/packages, you need to take some extra steps to
7704: ensure that the database is kept consistent with respect to these new files:
7705:
7706: 1. Include ../../databases/shared-mime-info/mimedb.mk (avoid using the
7707: buildlink3.mk file from this same directory, which is reserved for
7708: inclusion from other buildlink3.mk files). It takes care of rebuilding the
7709: MIME database at installation and deinstallation time, and disallows any
7710: access to it directly from the package.
7711:
1.25 wiz 7712: 2. Check the PLIST and remove any entries under the share/mime directory,
1.1 dsieger 7713: except for files saved under share/mime/packages. The former are handled
7714: automatically by the update-mime-database program, but the latter are
7715: package-dependent and must be removed by the package that installed them in
7716: the first place.
7717:
7718: 3. Remove any share/mime/* directories from the PLIST. They will be handled by
7719: the shared-mime-info package.
7720:
1.203 nia 7721: 21.6.12. Packages using intltool
1.1 dsieger 7722:
7723: If a package uses intltool during its build, add intltool to the USE_TOOLS,
7724: which forces it to use the intltool package provided by pkgsrc, instead of the
7725: one bundled with the distribution file.
7726:
7727: This tracks intltool's build-time dependencies and uses the latest available
7728: version; this way, the package benefits of any bug fixes that may have appeared
7729: since it was released.
7730:
1.203 nia 7731: 21.6.13. Packages installing startup scripts
1.1 dsieger 7732:
7733: If a package contains a rc.d script, it won't be copied into the startup
7734: directory by default, but you can enable it, by adding the option
1.4 rillig 7735: PKG_RCD_SCRIPTS=YES in mk.conf. This option will copy the scripts into /etc/
7736: rc.d when a package is installed, and it will automatically remove the scripts
7737: when the package is deinstalled.
1.1 dsieger 7738:
1.203 nia 7739: 21.6.14. Packages installing TeX modules
1.1 dsieger 7740:
7741: If a package installs TeX packages into the texmf tree, the ls-R database of
7742: the tree needs to be updated.
7743:
7744: Note
7745:
1.23 jakllsch 7746: Except the main TeX packages such as kpathsea, packages should install files
7747: into ${PREFIX}/share/texmf-dist, not ${PREFIX}/share/texmf.
1.1 dsieger 7748:
1.23 jakllsch 7749: 1. Include ../../print/kpathsea/texmf.mk. This takes care of rebuilding the
7750: ls-R database at installation and deinstallation time.
1.1 dsieger 7751:
1.23 jakllsch 7752: 2. If your package installs files into a texmf tree other than the one at $
7753: {PREFIX}/share/texmf-dist, set TEX_TEXMF_DIRS to the list of all texmf
7754: trees that need database update.
1.1 dsieger 7755:
7756: If your package also installs font map files that need to be registered
1.30 dholland 7757: using updmap, include ../../print/tex-tetex/map.mk and set TEX_MAP_FILES
7758: and/or TEX_MIXEDMAP_FILES to the list of all such font map files. Then
7759: updmap will be run automatically at installation/deinstallation to enable/
7760: disable font map files for TeX output drivers.
1.1 dsieger 7761:
7762: 3. Make sure that none of ls-R databases are included in PLIST, as they will
1.30 dholland 7763: be removed only by the kpathsea package.
1.1 dsieger 7764:
1.203 nia 7765: 21.6.15. Packages supporting running binaries in emulation
1.1 dsieger 7766:
7767: There are some packages that provide libraries and executables for running
7768: binaries from a one operating system on a different one (if the latter supports
7769: it). One example is running Linux binaries on NetBSD.
7770:
7771: The pkgtools/rpm2pkg helps in extracting and packaging Linux rpm packages.
7772:
7773: The CHECK_SHLIBS can be set to no to avoid the check-shlibs target, which tests
7774: if all libraries for each installed executable can be found by the dynamic
7775: linker. Since the standard dynamic linker is run, this fails for emulation
7776: packages, because the libraries used by the emulation are not in the standard
7777: directories.
7778:
1.203 nia 7779: 21.6.16. Packages installing hicolor icons
1.1 dsieger 7780:
7781: If a package installs images under the share/icons/hicolor and/or updates the
7782: share/icons/hicolor/icon-theme.cache database, you need to take some extra
7783: steps to make sure that the shared theme directory is handled appropriately and
7784: that the cache database is rebuilt:
7785:
7786: 1. Include ../../graphics/hicolor-icon-theme/buildlink3.mk.
7787:
7788: 2. Check the PLIST and remove the entry that refers to the theme cache.
7789:
7790: 3. Ensure that the PLIST does not remove the shared icon directories from the
7791: share/icons/hicolor hierarchy because they will be handled automatically.
7792:
7793: The best way to verify that the PLIST is correct with respect to the last two
7794: points is to regenerate it using make print-PLIST.
7795:
1.203 nia 7796: 21.6.17. Packages installing desktop files
1.1 dsieger 7797:
7798: If a package installs .desktop files under share/applications and these include
1.54 rodent 7799: MIME information (MimeType key), you need to take extra steps to ensure that
7800: they are registered into the MIME database:
1.1 dsieger 7801:
7802: 1. Include ../../sysutils/desktop-file-utils/desktopdb.mk.
7803:
7804: 2. Check the PLIST and remove the entry that refers to the share/applications/
7805: mimeinfo.cache file. It will be handled automatically.
7806:
7807: The best way to verify that the PLIST is correct with respect to the last point
7808: is to regenerate it using make print-PLIST.
7809:
1.154 rillig 7810: 21.7. Marking packages as having problems
1.1 dsieger 7811:
1.23 jakllsch 7812: In some cases one does not have the time to solve a problem immediately. In
7813: this case, one can plainly mark a package as broken. For this, one just sets
7814: the variable BROKEN to the reason why the package is broken (similar to the
1.162 rillig 7815: PKG_FAIL_REASON variable). A user trying to build the package will immediately
7816: be shown this message, and the build will not be even tried.
1.1 dsieger 7817:
1.23 jakllsch 7818: BROKEN packages are removed from pkgsrc in irregular intervals.
1.1 dsieger 7819:
1.184 rillig 7820: Chapter 22. GNOME packaging and porting
7821:
7822: Table of Contents
7823:
7824: 22.1. Meta packages
7825: 22.2. Packaging a GNOME application
7826: 22.3. Updating GNOME to a newer version
7827: 22.4. Patching guidelines
7828:
7829: Quoting GNOME's web site:
7830:
7831: The GNOME project provides two things: The GNOME desktop environment, an
7832: intuitive and attractive desktop for users, and the GNOME development
7833: platform, an extensive framework for building applications that integrate
7834: into the rest of the desktop.
7835:
7836: pkgsrc provides a seamless way to automatically build and install a complete
7837: GNOME environment under many different platforms. We can say with confidence
7838: that pkgsrc is one of the most advanced build and packaging systems for GNOME
7839: due to its included technologies buildlink3, the wrappers and tools framework
7840: and automatic configuration file management. Lots of efforts are put into
7841: achieving a completely clean deinstallation of installed software components.
7842:
7843: Given that pkgsrc is NetBSD's official packaging system, the above also means
7844: that great efforts are put into making GNOME work under this operating system.
7845:
7846: This chapter is aimed at pkgsrc developers and other people interested in
7847: helping our GNOME porting and packaging efforts. It provides instructions on
7848: how to manage the existing packages and some important information regarding
7849: their internals.
7850:
7851: 22.1. Meta packages
7852:
7853: pkgsrc includes three GNOME-related meta packages:
7854:
7855: * meta-pkgs/gnome-base: Provides the core GNOME desktop environment. It only
7856: includes the necessary bits to get it to boot correctly, although it may
7857: lack important functionality for daily operation. The idea behind this
7858: package is to let end users build their own configurations on top of this
7859: one, first installing this meta package to achieve a functional setup and
7860: then adding individual applications.
7861:
7862: * meta-pkgs/gnome: Provides a complete installation of the GNOME platform and
7863: desktop as defined by the GNOME project; this is based on the components
7864: distributed in the platform/x.y/x.y.z/sources and desktop/x.y/x.y.z/sources
7865: directories of the official FTP server. Developer-only tools found in those
7866: directories are not installed unless required by some other component to
7867: work properly. Similarly, packages from the bindings set (bindings/x.y/
7868: x.y.z/sources) are not pulled in unless required as a dependency for an
7869: end-user component. This package "extends" meta-pkgs/gnome-base.
7870:
7871: * meta-pkgs/gnome-devel: Installs all the tools required to build a GNOME
7872: component when fetched from the CVS repository. These are required to let
7873: the autogen.sh scripts work appropriately.
7874:
7875: In all these packages, the DEPENDS lines are sorted in a way that eases
7876: updates: a package may depend on other packages listed before it but not on any
7877: listed after it. It is very important to keep this order to ease updates so...
7878: do not change it to alphabetical sorting!
7879:
7880: 22.2. Packaging a GNOME application
7881:
7882: Almost all GNOME applications are written in C and use a common set of tools as
7883: their build system. Things get different with the new bindings to other
7884: languages (such as Python), but the following will give you a general idea on
7885: the minimum required tools:
7886:
7887: * Almost all GNOME applications use the GNU Autotools as their build system.
7888: As a general rule you will need to tell this to your package:
7889:
1.223 nia 7890: GNU_CONFIGURE= yes
7891: USE_LIBTOOL= yes
7892: USE_TOOLS+= gmake
1.184 rillig 7893:
7894: * If the package uses pkg-config to detect dependencies, add this tool to the
7895: list of required utilities:
7896:
1.223 nia 7897: USE_TOOLS+= pkg-config
1.184 rillig 7898:
7899: Also use pkgtools/verifypc at the end of the build process to ensure that
7900: you did not miss to specify any dependency in your package and that the
7901: version requirements are all correct.
7902:
7903: * If the package uses intltool, be sure to add intltool to the USE_TOOLS to
7904: handle dependencies and to force the package to use the latest available
7905: version.
7906:
7907: * If the package uses gtk-doc (a documentation generation utility), do not
7908: add a dependency on it. The tool is rather big and the distfile should come
7909: with pregenerated documentation anyway; if it does not, it is a bug that
7910: you ought to report. For such packages you should disable gtk-doc (unless
7911: it is the default):
7912:
1.223 nia 7913: CONFIGURE_ARGS+= --disable-gtk-doc
1.184 rillig 7914:
7915: The default location of installed HTML files (share/gtk-doc/<package-name>)
7916: is correct and should not be changed unless the package insists on
7917: installing them somewhere else. Otherwise programs as devhelp will not be
7918: able to open them. You can do that with an entry similar to:
1.1 dsieger 7919:
1.223 nia 7920: CONFIGURE_ARGS+= --with-html-dir=${PREFIX}/share/gtk-doc/...
1.1 dsieger 7921:
1.184 rillig 7922: GNOME uses multiple shared directories and files under the installation prefix
7923: to maintain databases. In this context, shared means that those exact same
7924: directories and files are used among several different packages, leading to
7925: conflicts in the PLIST. pkgsrc currently includes functionality to handle the
7926: most common cases, so you have to forget about using @unexec ${RMDIR} lines in
7927: your file lists and omitting shared files from them. If you find yourself doing
7928: those, your package is most likely incorrect.
1.1 dsieger 7929:
1.184 rillig 7930: The following table lists the common situations that result in using shared
7931: directories or files. For each of them, the appropriate solution is given.
7932: After applying the solution be sure to regenerate the package's file list with
7933: make print-PLIST and ensure it is correct.
1.1 dsieger 7934:
1.184 rillig 7935: Table 22.1. PLIST handling for GNOME packages
1.1 dsieger 7936:
1.184 rillig 7937: +-----------------------------------------------------------------------------+
7938: | If the package... | Then... |
7939: |-------------------------------------------+---------------------------------|
1.203 nia 7940: |Installs icons under the share/icons/ |See Section 21.6.16, "Packages |
7941: |hicolor hierarchy or updates share/icons/ |installing hicolor icons". |
1.184 rillig 7942: |hicolor/icon-theme.cache. | |
7943: |-------------------------------------------+---------------------------------|
1.203 nia 7944: | |See Section 21.6.11, "Packages |
1.184 rillig 7945: |Installs files under share/mime/packages. |installing extensions to the MIME|
7946: | |database". |
7947: |-------------------------------------------+---------------------------------|
1.203 nia 7948: |Installs .desktop files under share/ |See Section 21.6.17, "Packages |
1.184 rillig 7949: |applications and these include MIME |installing desktop files". |
7950: |information. | |
7951: +-----------------------------------------------------------------------------+
1.1 dsieger 7952:
7953:
1.184 rillig 7954: 22.3. Updating GNOME to a newer version
1.1 dsieger 7955:
1.184 rillig 7956: When seeing GNOME as a whole, there are two kinds of updates:
1.1 dsieger 7957:
1.184 rillig 7958: Major update
1.1 dsieger 7959:
1.184 rillig 7960: Given that there is still a very long way for GNOME 3 (if it ever appears),
7961: we consider a major update one that goes from a 2.X version to a 2.Y one,
7962: where Y is even and greater than X. These are hard to achieve because they
7963: introduce lots of changes in the components' code and almost all GNOME
7964: distfiles are updated to newer versions. Some of them can even break API
7965: and ABI compatibility with the previous major version series. As a result,
7966: the update needs to be done all at once to minimize breakage.
1.1 dsieger 7967:
1.184 rillig 7968: A major update typically consists of around 80 package updates and the
7969: addition of some new ones.
1.1 dsieger 7970:
1.184 rillig 7971: Minor update
1.1 dsieger 7972:
1.184 rillig 7973: We consider a minor update one that goes from a 2.A.X version to a 2.A.Y
7974: one where Y is greater than X. These are easy to achieve because they do
7975: not update all GNOME components, can be done in an incremental way and do
7976: not break API nor ABI compatibility.
1.1 dsieger 7977:
1.184 rillig 7978: A minor update typically consists of around 50 package updates, although
7979: the numbers here may vary a lot.
1.1 dsieger 7980:
1.184 rillig 7981: In order to update the GNOME components in pkgsrc to a new stable release
7982: (either major or minor), the following steps should be followed:
1.1 dsieger 7983:
1.184 rillig 7984: 1. Get a list of all the tarballs that form the new release by using the
7985: following commands. These will leave the full list of the components'
7986: distfiles into the list.txt file:
1.1 dsieger 7987:
1.184 rillig 7988: % echo ls "*.tar.bz2" | \
7989: ftp -V ftp://ftp.gnome.org/pub/gnome/platform/x.y/x.y.z/sources/ | \
7990: awk '{ print $9 }' >list.txt
7991: % echo ls "*.tar.bz2" | \
7992: ftp -V ftp://ftp.gnome.org/pub/gnome/desktop/x.y/x.y.z/sources/ | \
7993: awk '{ print $9 }' >>list.txt
1.1 dsieger 7994:
1.184 rillig 7995: 2. Open each meta package's Makefile and bump their version to the release you
7996: are updating them to. The three meta packages should be always consistent
7997: with versioning. Obviously remove any PKGREVISIONs that might be in them.
1.1 dsieger 7998:
1.184 rillig 7999: 3. For each meta package, update all its DEPENDS lines to match the latest
8000: versions as shown by the above commands. Do not list any newer version
8001: (even if found in the FTP) because the meta packages are supposed to list
8002: the exact versions that form a specific GNOME release. Exceptions are
8003: permitted here if a newer version solves a serious issue in the overall
8004: desktop experience; these typically come in the form of a revision bump in
8005: pkgsrc, not in newer versions from the developers.
1.1 dsieger 8006:
1.184 rillig 8007: Packages not listed in the list.txt file should be updated to the latest
8008: version available (if found in pkgsrc). This is the case, for example, of
8009: the dependencies on the GNU Autotools in the meta-pkgs/gnome-devel meta
8010: package.
1.1 dsieger 8011:
1.184 rillig 8012: 4. Generate a patch from the modified meta packages and extract the list of
8013: "new" lines. This will provide you an outline on what packages need to be
8014: updated in pkgsrc and in what order:
1.1 dsieger 8015:
1.184 rillig 8016: % cvs diff -u gnome-devel gnome-base gnome | grep '^+D' >todo.txt
1.1 dsieger 8017:
1.184 rillig 8018: 5. For major desktop updates it is recommended to zap all your installed
8019: packages and start over from scratch at this point.
1.1 dsieger 8020:
1.184 rillig 8021: 6. Now comes the longest step by far: iterate over the contents of todo.txt
8022: and update the packages listed in it in order. For major desktop updates
8023: none of these should be committed until the entire set is completed because
8024: there are chances of breaking not-yet-updated packages.
1.1 dsieger 8025:
1.184 rillig 8026: 7. Once the packages are up to date and working, commit them to the tree one
8027: by one with appropriate log messages. At the end, commit the three meta
8028: package updates and all the corresponding changes to the doc/CHANGES-<YEAR>
8029: and pkgsrc/doc/TODO files.
1.1 dsieger 8030:
1.184 rillig 8031: 22.4. Patching guidelines
1.1 dsieger 8032:
1.184 rillig 8033: GNOME is a very big component in pkgsrc which approaches 100 packages. Please,
8034: it is very important that you always, always, always feed back any portability
8035: fixes you do to a GNOME package to the mainstream developers (see
8036: Section 12.3.5, "Feedback to the author"). This is the only way to get their
8037: attention on portability issues and to ensure that future versions can be built
8038: out-of-the box on NetBSD. The less custom patches in pkgsrc, the easier further
8039: updates are. Those developers in charge of issuing major GNOME updates will be
8040: grateful if you do that.
1.1 dsieger 8041:
1.200 cirnatda 8042: The most common places to report bugs are the GNOME's GitLab and the
8043: freedesktop.org's GitLab. Not all components use these to track bugs, but most
8044: of them do. Do not be short on your reports: always provide detailed
1.184 rillig 8045: explanations of the current failure, how it can be improved to achieve maximum
1.200 cirnatda 8046: portability and, if at all possible, provide a patch against the main Git
8047: branch. The more verbose you are, the higher chances of your patch being
8048: accepted.
1.1 dsieger 8049:
1.184 rillig 8050: Also, please avoid using preprocessor magic to fix portability issues. While
8051: the FreeBSD GNOME people are doing a great job in porting GNOME to their
8052: operating system, the official GNOME sources are now plagued by conditionals
8053: that check for __FreeBSD__ and similar macros. This hurts portability. Please
8054: see our patching guidelines (Section 12.3.4, "Patching guidelines") for more
8055: details.
1.1 dsieger 8056:
1.154 rillig 8057: Chapter 23. Submitting and Committing
1.1 dsieger 8058:
8059: Table of Contents
8060:
1.154 rillig 8061: 23.1. Submitting binary packages
8062: 23.2. Submitting source packages (for non-NetBSD-developers)
8063: 23.3. General notes when adding, updating, or removing packages
8064: 23.4. Commit Messages
8065: 23.5. Committing: Adding a package to CVS
8066: 23.6. Updating a package to a newer version
8067: 23.7. Renaming a package in pkgsrc
8068: 23.8. Moving a package in pkgsrc
1.1 dsieger 8069:
1.154 rillig 8070: 23.1. Submitting binary packages
1.1 dsieger 8071:
8072: Our policy is that we accept binaries only from pkgsrc developers to guarantee
8073: that the packages don't contain any trojan horses etc. This is not to annoy
8074: anyone but rather to protect our users! You're still free to put up your
8075: home-made binary packages and tell the world where to get them. NetBSD
1.154 rillig 8076: developers doing bulk builds and wanting to upload them please see Chapter 8,
1.66 asau 8077: Creating binary packages for everything in pkgsrc (bulk builds).
1.1 dsieger 8078:
1.154 rillig 8079: 23.2. Submitting source packages (for non-NetBSD-developers)
1.1 dsieger 8080:
1.218 nia 8081: Firstly, you can import new packages into pkgsrc-wip ("pkgsrc work-in-progress"
8082: ); see the homepage at https://pkgsrc.org/wip/ for details.
8083:
8084: Next, check that your package is complete, compiles and runs well; see
1.184 rillig 8085: Chapter 14, Creating a new pkgsrc package from scratch and the rest of this
1.218 nia 8086: document. Run the pkgtools/pkglint tool and fix any errors that appear.
8087:
8088: Finally, send a report to the pkgsrc bug tracking system, either with the
8089: send-pr(1) command, or if you don't have that, go to the web page https://
8090: www.NetBSD.org/support/send-pr.html, which contains some instructions and a
8091: link to a form where you can submit packages. The sysutils/gtk-send-pr package
8092: is also available as a substitute for either of the above two tools.
1.1 dsieger 8093:
8094: In the form of the problem report, the category should be "pkg", the synopsis
8095: should include the package name and version number, and the description field
8096: should contain a short description of your package (contents of the COMMENT
1.218 nia 8097: variable or DESCR file are OK).
1.1 dsieger 8098:
1.154 rillig 8099: 23.3. General notes when adding, updating, or removing packages
1.1 dsieger 8100:
8101: Please note all package additions, updates, moves, and removals in pkgsrc/doc/
8102: CHANGES-YYYY. It's very important to keep this file up to date and conforming
8103: to the existing format, because it will be used by scripts to automatically
8104: update pages on www.NetBSD.org and other sites. Additionally, check the pkgsrc/
8105: doc/TODO file and remove the entry for the package you updated or removed, in
8106: case it was mentioned there.
8107:
8108: When the PKGREVISION of a package is bumped, the change should appear in pkgsrc
8109: /doc/CHANGES-YYYY if it is security related or otherwise relevant. Mass bumps
8110: that result from a dependency being updated should not be mentioned. In all
8111: other cases it's the developer's decision.
8112:
8113: There is a make target that helps in creating proper CHANGES-YYYY entries: make
8114: changes-entry. It uses the optional CTYPE and NETBSD_LOGIN_NAME variables. The
8115: general usage is to first make sure that your CHANGES-YYYY file is up-to-date
8116: (to avoid having to resolve conflicts later-on) and then to cd to the package
8117: directory. For package updates, make changes-entry is enough. For new packages,
8118: or package moves or removals, set the CTYPE variable on the command line to
1.4 rillig 8119: "Added", "Moved", or "Removed". You can set NETBSD_LOGIN_NAME in mk.conf if
1.23 jakllsch 8120: your local login name is not the same as your NetBSD login name. The target
8121: also automatically removes possibly existing entries for the package in the
8122: TODO file. Don't forget to commit the changes, e.g. by using make
1.66 asau 8123: commit-changes-entry! If you are not using a checkout directly from
1.23 jakllsch 8124: cvs.NetBSD.org, but e.g. a local copy of the repository, you can set
8125: USE_NETBSD_REPO=yes. This makes the cvs commands use the main repository.
1.1 dsieger 8126:
1.154 rillig 8127: 23.4. Commit Messages
1.130 wiz 8128:
8129: For several years, there have been mirrors of pkgsrc in fossil, git, and hg.
8130: Standard practise when using these tools is to make the first line of a commit
8131: message function as a summary that can be read without the rest, such as is
8132: commonly done with "git log --oneline". For this reason, we have the following
8133: guidelines for pkgsrc commit messages:
8134:
1.131 wiz 8135: * Start the commit message with a line that explains the big picture in 65
1.130 wiz 8136: characters or less. When a commit is for one package, include the name of
8137: the package. For updates, include the version to which it is updated.
8138:
8139: * Leave the next line empty.
8140:
8141: * Then come the details for the commit (changes in that package, reason for a
8142: change) and any relevant PRs. Wrap this section.
8143:
8144: Here is an example:
8145:
8146: libxslt: update to 1.0.30
8147:
8148: Changes since 1.0.29:
8149: ...
8150:
8151:
8152: Here is another example:
8153:
8154: mk/bsd.pkg.mk: enable SSP by default on NetBSD
8155:
8156: (rationale)
8157:
8158:
8159: Commit messages are final: no "cvs admin" is allowed on the pkgsrc repository
8160: to change commit messages.
8161:
1.154 rillig 8162: 23.5. Committing: Adding a package to CVS
1.1 dsieger 8163:
8164: This section is only of interest for pkgsrc developers with write access to the
1.34 wiz 8165: pkgsrc repository.
8166:
8167: When the package is finished, "cvs add" the files. Start by adding the
8168: directory and then files in the directory. Don't forget to add the new package
8169: to the category's Makefile. Make sure you don't forget any files; you can check
8170: by running "cvs status". An example:
8171:
8172: $ cd .../pkgsrc/category
8173: $ cvs add pkgname
8174: $ cd pkgname
8175: $ cvs add DESCR Makefile PLIST distinfo buildlink3.mk patches
8176: $ cvs add patches/p*
8177: $ cvs status | less
1.35 wiz 8178: $ cvs commit
1.34 wiz 8179: $ cd ..
8180: $ vi Makefile # add SUBDIRS+=pkgname line
1.35 wiz 8181: $ cvs commit Makefile
1.66 asau 8182: $ cd pkgname
1.73 jnemeth 8183: $ make CTYPE=Added commit-changes-entry
1.1 dsieger 8184:
8185: The commit message of the initial import should include part of the DESCR file,
8186: so people reading the mailing lists know what the package is/does.
8187:
1.34 wiz 8188: Also mention the new package in pkgsrc/doc/CHANGES-20xx.
8189:
8190: Previously, "cvs import" was suggested, but it was much easier to get wrong
8191: than "cvs add".
1.1 dsieger 8192:
1.154 rillig 8193: 23.6. Updating a package to a newer version
1.1 dsieger 8194:
8195: Please always put a concise, appropriate and relevant summary of the changes
8196: between old and new versions into the commit log when updating a package. There
8197: are various reasons for this:
8198:
8199: * A URL is volatile, and can change over time. It may go away completely or
8200: its information may be overwritten by newer information.
8201:
8202: * Having the change information between old and new versions in our CVS
8203: repository is very useful for people who use either cvs or anoncvs.
8204:
8205: * Having the change information between old and new versions in our CVS
8206: repository is very useful for people who read the pkgsrc-changes mailing
8207: list, so that they can make tactical decisions about when to upgrade the
8208: package.
8209:
8210: Please also recognize that, just because a new version of a package has been
8211: released, it should not automatically be upgraded in the CVS repository. We
8212: prefer to be conservative in the packages that are included in pkgsrc -
8213: development or beta packages are not really the best thing for most places in
8214: which pkgsrc is used. Please use your judgement about what should go into
8215: pkgsrc, and bear in mind that stability is to be preferred above new and
8216: possibly untested features.
8217:
1.154 rillig 8218: 23.7. Renaming a package in pkgsrc
1.21 snj 8219:
8220: Renaming packages is not recommended.
8221:
1.175 gutterid 8222: When renaming packages, be sure to fix any references to the old name in other
1.21 snj 8223: Makefiles, options, buildlink files, etc.
8224:
1.175 gutterid 8225: Also, when renaming a package, please add the package name and version pattern
1.167 leot 8226: (s) of the previous package to SUPERSEDES. This may be repeated for multiple
8227: renames. The new package would be an exact replacement. Example:
8228:
8229: SUPERSEDES+= p5-IO-Compress-Zlib<2.017
8230: SUPERSEDES+= optcomp-[0-9]*
1.21 snj 8231:
8232: Note that "successor" in the CHANGES-YYYY file doesn't necessarily mean that it
8233: supersedes, as that successor may not be an exact replacement but is a
8234: suggestion for the replaced functionality.
8235:
1.154 rillig 8236: 23.8. Moving a package in pkgsrc
1.21 snj 8237:
8238: It is preferred that packages are not renamed or moved, but if needed please
8239: follow these steps.
1.1 dsieger 8240:
8241: 1. Make a copy of the directory somewhere else.
8242:
8243: 2. Remove all CVS dirs.
8244:
8245: Alternatively to the first two steps you can also do:
8246:
8247: % cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package
8248:
8249: and use that for further work.
8250:
1.25 wiz 8251: 3. Fix CATEGORIES and any DEPENDS paths that just did "../package" instead of
1.1 dsieger 8252: "../../category/package".
8253:
1.21 snj 8254: 4. In the modified package's Makefile, consider setting PREV_PKGPATH to the
8255: previous category/package pathname. The PREV_PKGPATH can be used by tools
8256: for doing an update using pkgsrc building; for example, it can search the
8257: pkg_summary(5) database for PREV_PKGPATH (if no SUPERSEDES) and then use
8258: the corresponding new PKGPATH for that moved package. Note that it may have
8259: multiple matches, so the tool should also check on the PKGBASE too. The
8260: PREV_PKGPATH probably has no value unless SUPERSEDES is not set, i.e.
8261: PKGBASE stays the same.
8262:
8263: 5. cvs import the modified package in the new place.
1.1 dsieger 8264:
1.21 snj 8265: 6. Check if any package depends on it:
1.1 dsieger 8266:
8267: % cd /usr/pkgsrc
8268: % grep /package */*/Makefile* */*/buildlink*
8269:
1.21 snj 8270: 7. Fix paths in packages from step 5 to point to new location.
1.1 dsieger 8271:
1.21 snj 8272: 8. cvs rm (-f) the package at the old location.
1.1 dsieger 8273:
1.21 snj 8274: 9. Remove from oldcategory/Makefile.
1.1 dsieger 8275:
1.21 snj 8276: 10. Add to newcategory/Makefile.
1.1 dsieger 8277:
1.21 snj 8278: 11. Commit the changed and removed files:
1.1 dsieger 8279:
8280: % cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile
8281:
8282: (and any packages from step 5, of course).
8283:
1.154 rillig 8284: Chapter 24. Frequently Asked Questions
1.1 dsieger 8285:
8286: This section contains the answers to questions that may arise when you are
8287: writing a package. If you don't find your question answered here, first have a
8288: look in the other chapters, and if you still don't have the answer, ask on the
8289: pkgsrc-users mailing list.
8290:
1.154 rillig 8291: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
8292: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
8293: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
1.223 nia 8294: 24.4. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
8295: 24.5. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.1 dsieger 8296: the := inside it.
1.223 nia 8297: 24.6. Which mailing lists are there for package developers?
8298: 24.7. Where is the pkgsrc documentation?
8299: 24.8. I have a little time to kill. What shall I do?
1.1 dsieger 8300:
1.154 rillig 8301: 24.1. What is the difference between MAKEFLAGS, .MAKEFLAGS and MAKE_FLAGS?
1.1 dsieger 8302:
8303: MAKEFLAGS are the flags passed to the pkgsrc-internal invocations of make
1.223 nia 8304: (1).
8305:
8306: MAKE_FLAGS are the flags that are passed to the MAKE_PROGRAM when
8307: building the package.
8308:
8309: .MAKEFLAGS is an internal variable of bmake and should not be used by
8310: packages.
1.1 dsieger 8311:
1.154 rillig 8312: 24.2. What is the difference between MAKE, GMAKE and MAKE_PROGRAM?
1.1 dsieger 8313:
8314: MAKE is the path to the make(1) program that is used in the pkgsrc
1.223 nia 8315: infrastructure.
8316:
8317: GMAKE is the path to GNU Make, but you need to say USE_TOOLS+=gmake to
8318: use that.
8319:
8320: MAKE_PROGRAM is the path to the Make program that is used for building
8321: the package.
1.1 dsieger 8322:
1.154 rillig 8323: 24.3. What is the difference between CC, PKG_CC and PKGSRC_COMPILER?
1.1 dsieger 8324:
8325: CC is the path to the real C compiler, which can be configured by the
1.223 nia 8326: pkgsrc user.
1.1 dsieger 8327:
1.223 nia 8328: PKG_CC is the path to the compiler wrapper.
1.1 dsieger 8329:
1.223 nia 8330: PKGSRC_COMPILER is not a path to a compiler, but the type of compiler
8331: that should be used. See mk/compiler.mk for more information about the
8332: latter variable.
1.1 dsieger 8333:
1.223 nia 8334: 24.4. Why does make show-var VARNAME=BUILDLINK_PREFIX.foo say it's empty?
1.1 dsieger 8335:
1.25 wiz 8336: For optimization reasons, some variables are only available in the "
8337: wrapper" phase and later. To "simulate" the wrapper phase, append
1.1 dsieger 8338: PKG_PHASE=wrapper to the above command.
8339:
1.223 nia 8340: 24.5. What does ${MASTER_SITE_SOURCEFORGE:=package/} mean? I don't understand
1.1 dsieger 8341: the := inside it.
8342:
1.223 nia 8343: The := is not an assignment operator, even though it may look like one.
1.108 rillig 8344: Instead, it is a degenerate form of ${LIST:old_string=new_string}, which
8345: is documented in the make(1) man page and which is commonly used in the
8346: form ${SRCS:.c=.o}. In the case of MASTER_SITE_*, old_string is the empty
8347: string and new_string is package/. That's where the : and the = fall
8348: together.
1.1 dsieger 8349:
1.223 nia 8350: 24.6. Which mailing lists are there for package developers?
1.1 dsieger 8351:
8352: tech-pkg
8353:
8354: This is a list for technical discussions related to pkgsrc
8355: development, e.g. soliciting feedback for changes to pkgsrc
8356: infrastructure, proposed new features, questions related to porting
8357: pkgsrc to a new platform, advice for maintaining a package, patches
8358: that affect many packages, help requests moved from pkgsrc-users when
8359: an infrastructure bug is found, etc.
8360:
8361: pkgsrc-bugs
8362:
8363: All bug reports in category "pkg" sent with send-pr(1) appear here.
8364: Please do not report your bugs here directly; use one of the other
8365: mailing lists.
8366:
1.223 nia 8367: 24.7. Where is the pkgsrc documentation?
1.1 dsieger 8368:
8369: There are many places where you can find documentation about pkgsrc:
8370:
8371: * The pkgsrc guide (this document) is a collection of chapters that
8372: explain large parts of pkgsrc, but some chapters tend to be outdated.
8373: Which ones they are is hard to say.
8374:
1.174 leot 8375: * On the mailing list archives (see https://mail-index.NetBSD.org/),
8376: you can find discussions about certain features, announcements of new
1.1 dsieger 8377: parts of the pkgsrc infrastructure and sometimes even announcements
8378: that a certain feature has been marked as obsolete. The benefit here
8379: is that each message has a date appended to it.
8380:
8381: * Many of the files in the mk/ directory start with a comment that
8382: describes the purpose of the file and how it can be used by the
8383: pkgsrc user and package authors. An easy way to find this
8384: documentation is to run bmake help.
8385:
8386: * The CVS log messages are a rich source of information, but they tend
8387: to be highly abbreviated, especially for actions that occur often.
8388: Some contain a detailed description of what has changed, but they are
8389: geared towards the other pkgsrc developers, not towards an average
8390: pkgsrc user. They also only document changes, so if you don't know
8391: what has been before, these messages may not be worth too much to
8392: you.
8393:
8394: * Some parts of pkgsrc are only "implicitly documented", that is the
8395: documentation exists only in the mind of the developer who wrote the
8396: code. To get this information, use the cvs annotate command to see
8397: who has written it and ask on the tech-pkg mailing list, so that
8398: others can find your questions later (see above). To be sure that the
8399: developer in charge reads the mail, you may CC him or her.
8400:
1.223 nia 8401: 24.8. I have a little time to kill. What shall I do?
1.1 dsieger 8402:
8403: This is not really an FAQ yet, but here's the answer anyway.
8404:
8405: * Run pkg_chk -N (from the pkgtools/pkg_chk package). It will tell you
8406: about newer versions of installed packages that are available, but
8407: not yet updated in pkgsrc.
8408:
1.198 leot 8409: * Browse pkgsrc/doc/TODO -- it contains a list of suggested new
8410: packages and a list of cleanups and enhancements for pkgsrc that
8411: would be nice to have.
1.1 dsieger 8412:
1.71 wiz 8413: * Review packages for which review was requested on the tech-pkg
8414: mailing list.
1.1 dsieger 8415:
8416: Part III. The pkgsrc infrastructure internals
8417:
8418: This part of the guide deals with everything from the infrastructure that is
8419: behind the interfaces described in the developer's guide. A casual package
8420: maintainer should not need anything from this part.
8421:
8422: Table of Contents
8423:
1.184 rillig 8424: 25. Design of the pkgsrc infrastructure
1.1 dsieger 8425:
1.184 rillig 8426: 25.1. The meaning of variable definitions
8427: 25.2. Avoiding problems before they arise
8428: 25.3. Variable evaluation
1.1 dsieger 8429:
1.184 rillig 8430: 25.3.1. At load time
8431: 25.3.2. At runtime
1.1 dsieger 8432:
1.184 rillig 8433: 25.4. How can variables be specified?
8434: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8435:
1.184 rillig 8436: 25.5.1. Procedures with parameters
8437: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8438:
1.184 rillig 8439: 25.6. The order in which files are loaded
1.1 dsieger 8440:
1.184 rillig 8441: 25.6.1. The order in bsd.prefs.mk
8442: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8443:
1.184 rillig 8444: 26. Regression tests
1.1 dsieger 8445:
1.184 rillig 8446: 26.1. Running the regression tests
8447: 26.2. Adding a new regression test
1.1 dsieger 8448:
1.184 rillig 8449: 26.2.1. Overridable functions
8450: 26.2.2. Helper functions
1.1 dsieger 8451:
1.184 rillig 8452: 27. Porting pkgsrc
1.1 dsieger 8453:
1.184 rillig 8454: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8455:
1.184 rillig 8456: Chapter 25. Design of the pkgsrc infrastructure
1.1 dsieger 8457:
8458: Table of Contents
8459:
1.184 rillig 8460: 25.1. The meaning of variable definitions
8461: 25.2. Avoiding problems before they arise
8462: 25.3. Variable evaluation
1.1 dsieger 8463:
1.184 rillig 8464: 25.3.1. At load time
8465: 25.3.2. At runtime
1.1 dsieger 8466:
1.184 rillig 8467: 25.4. How can variables be specified?
8468: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8469:
1.184 rillig 8470: 25.5.1. Procedures with parameters
8471: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8472:
1.184 rillig 8473: 25.6. The order in which files are loaded
1.1 dsieger 8474:
1.184 rillig 8475: 25.6.1. The order in bsd.prefs.mk
8476: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8477:
8478: The pkgsrc infrastructure consists of many small Makefile fragments. Each such
8479: fragment needs a properly specified interface. This chapter explains how such
8480: an interface looks like.
8481:
1.184 rillig 8482: 25.1. The meaning of variable definitions
1.1 dsieger 8483:
8484: Whenever a variable is defined in the pkgsrc infrastructure, the location and
8485: the way of definition provide much information about the intended use of that
8486: variable. Additionally, more documentation may be found in a header comment or
8487: in this pkgsrc guide.
8488:
8489: A special file is mk/defaults/mk.conf, which lists all variables that are
8490: intended to be user-defined. They are either defined using the ?= operator or
8491: they are left undefined because defining them to anything would effectively
8492: mean "yes". All these variables may be overridden by the pkgsrc user in the
8493: MAKECONF file.
8494:
8495: Outside this file, the following conventions apply: Variables that are defined
8496: using the ?= operator may be overridden by a package.
8497:
8498: Variables that are defined using the = operator may be used read-only at
8499: run-time.
8500:
8501: Variables whose name starts with an underscore must not be accessed outside the
8502: pkgsrc infrastructure at all. They may change without further notice.
8503:
8504: Note
8505:
8506: These conventions are currently not applied consistently to the complete pkgsrc
8507: infrastructure.
8508:
1.184 rillig 8509: 25.2. Avoiding problems before they arise
1.1 dsieger 8510:
8511: All variables that contain lists of things should default to being empty. Two
8512: examples that do not follow this rule are USE_LANGUAGES and DISTFILES. These
8513: variables cannot simply be modified using the += operator in package Makefiles
8514: (or other files included by them), since there is no guarantee whether the
8515: variable is already set or not, and what its value is. In the case of
8516: DISTFILES, the packages "know" the default value and just define it as in the
8517: following example.
8518:
8519: DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
8520:
8521: Because of the selection of this default value, the same value appears in many
8522: package Makefiles. Similarly for USE_LANGUAGES, but in this case the default
8523: value ("c") is so short that it doesn't stand out. Nevertheless it is mentioned
8524: in many files.
8525:
1.184 rillig 8526: 25.3. Variable evaluation
1.1 dsieger 8527:
1.184 rillig 8528: 25.3.1. At load time
1.1 dsieger 8529:
8530: Variable evaluation takes place either at load time or at runtime, depending on
8531: the context in which they occur. The contexts where variables are evaluated at
8532: load time are:
8533:
8534: * The right hand side of the := and != operators,
8535:
8536: * Make directives like .if or .for,
8537:
8538: * Dependency lines.
8539:
8540: A special exception are references to the iteration variables of .for loops,
8541: which are expanded inline, no matter in which context they appear.
8542:
8543: As the values of variables may change during load time, care must be taken not
8544: to evaluate them by accident. Typical examples for variables that should not be
8545: evaluated at load time are DEPENDS and CONFIGURE_ARGS. To make the effect more
8546: clear, here is an example:
8547:
8548: CONFIGURE_ARGS= # none
8549: CFLAGS= -O
8550: CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
8551:
8552: CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
8553:
8554: CFLAGS+= -Wall
8555:
8556: This code shows how the use of the := operator can quickly lead to unexpected
8557: results. The first paragraph is fairly common code. The second paragraph
8558: evaluates the CONFIGURE_ARGS variable, which results in CFLAGS=-O. In the third
8559: paragraph, the -Wall is appended to the CFLAGS, but this addition will not
8560: appear in CONFIGURE_ARGS. In actual code, the three paragraphs from above
8561: typically occur in completely unrelated files.
8562:
1.184 rillig 8563: 25.3.2. At runtime
1.1 dsieger 8564:
8565: After all the files have been loaded, the values of the variables cannot be
8566: changed anymore. Variables that are used in the shell commands are expanded at
8567: this point.
8568:
1.184 rillig 8569: 25.4. How can variables be specified?
1.1 dsieger 8570:
8571: There are many ways in which the definition and use of a variable can be
8572: restricted in order to detect bugs and violations of the (mostly unwritten)
1.108 rillig 8573: policies. A package can be checked with pkglint -Wall to see whether it meets
8574: these rules.
1.1 dsieger 8575:
1.184 rillig 8576: 25.5. Designing interfaces for Makefile fragments
1.1 dsieger 8577:
8578: Most of the .mk files fall into one of the following classes. Cases where a
8579: file falls into more than one class should be avoided as it often leads to
8580: subtle bugs.
8581:
1.184 rillig 8582: 25.5.1. Procedures with parameters
1.1 dsieger 8583:
8584: In a traditional imperative programming language some of the .mk files could be
1.198 leot 8585: described as procedures. They take some input parameters and--after
8586: inclusion--provide a result in output parameters. Since all variables in
1.23 jakllsch 8587: Makefiles have global scope care must be taken not to use parameter names that
8588: have already another meaning. For example, PKGNAME is a bad choice for a
8589: parameter name.
1.1 dsieger 8590:
8591: Procedures are completely evaluated at preprocessing time. That is, when
8592: calling a procedure all input parameters must be completely resolvable. For
8593: example, CONFIGURE_ARGS should never be an input parameter since it is very
8594: likely that further text will be added after calling the procedure, which would
8595: effectively apply the procedure to only a part of the variable. Also,
1.108 rillig 8596: references to other variables will be modified after calling the procedure.
1.1 dsieger 8597:
8598: A procedure can declare its output parameters either as suitable for use in
8599: preprocessing directives or as only available at runtime. The latter
8600: alternative is for variables that contain references to other runtime
8601: variables.
8602:
8603: Procedures shall be written such that it is possible to call the procedure more
8604: than once. That is, the file must not contain multiple-inclusion guards.
8605:
8606: Examples for procedures are mk/bsd.options.mk and mk/buildlink3/bsd.builtin.mk.
8607: To express that the parameters are evaluated at load time, they should be
8608: assigned using the := operator, which should be used only for this purpose.
8609:
1.184 rillig 8610: 25.5.2. Actions taken on behalf of parameters
1.1 dsieger 8611:
8612: Action files take some input parameters and may define runtime variables. They
8613: shall not define loadtime variables. There are action files that are included
8614: implicitly by the pkgsrc infrastructure, while other must be included
8615: explicitly.
8616:
8617: An example for action files is mk/subst.mk.
8618:
1.184 rillig 8619: 25.6. The order in which files are loaded
1.1 dsieger 8620:
8621: Package Makefiles usually consist of a set of variable definitions, and include
8622: the file ../../mk/bsd.pkg.mk in the very last line. Before that, they may also
8623: include various other *.mk files if they need to query the availability of
8624: certain features like the type of compiler or the X11 implementation. Due to
8625: the heavy use of preprocessor directives like .if and .for, the order in which
8626: the files are loaded matters.
8627:
8628: This section describes at which point the various files are loaded and gives
8629: reasons for that order.
8630:
1.184 rillig 8631: 25.6.1. The order in bsd.prefs.mk
1.1 dsieger 8632:
8633: The very first action in bsd.prefs.mk is to define some essential variables
8634: like OPSYS, OS_VERSION and MACHINE_ARCH.
8635:
1.4 rillig 8636: Then, the user settings are loaded from the file specified in MAKECONF, which
8637: is usually mk.conf. After that, those variables that have not been overridden
8638: by the user are loaded from mk/defaults/mk.conf.
1.1 dsieger 8639:
8640: After the user settings, the system settings and platform settings are loaded,
8641: which may override the user settings.
8642:
8643: Then, the tool definitions are loaded. The tool wrappers are not yet in effect.
8644: This only happens when building a package, so the proper variables must be used
8645: instead of the direct tool names.
8646:
8647: As the last steps, some essential variables from the wrapper and the package
8648: system flavor are loaded, as well as the variables that have been cached in
8649: earlier phases of a package build.
8650:
1.184 rillig 8651: 25.6.2. The order in bsd.pkg.mk
1.1 dsieger 8652:
8653: First, bsd.prefs.mk is loaded.
8654:
8655: Then, the various *-vars.mk files are loaded, which fill default values for
8656: those variables that have not been defined by the package. These variables may
8657: later be used even in unrelated files.
8658:
8659: Then, the file bsd.pkg.error.mk provides the target error-check that is added
8660: as a special dependency to all other targets that use DELAYED_ERROR_MSG or
8661: DELAYED_WARNING_MSG.
8662:
8663: Then, the package-specific hacks from hacks.mk are included.
8664:
8665: Then, various other files follow. Most of them don't have any dependencies on
8666: what they need to have included before or after them, though some do.
8667:
8668: The code to check PKG_FAIL_REASON and PKG_SKIP_REASON is then executed, which
8669: restricts the use of these variables to all the files that have been included
8670: before. Appearances in later files will be silently ignored.
8671:
8672: Then, the files for the main targets are included, in the order of later
8673: execution, though the actual order should not matter.
8674:
8675: At last, some more files are included that don't set any interesting variables
8676: but rather just define make targets to be executed.
8677:
1.184 rillig 8678: Chapter 26. Regression tests
1.1 dsieger 8679:
8680: Table of Contents
8681:
1.184 rillig 8682: 26.1. Running the regression tests
8683: 26.2. Adding a new regression test
1.1 dsieger 8684:
1.184 rillig 8685: 26.2.1. Overridable functions
8686: 26.2.2. Helper functions
1.1 dsieger 8687:
8688: The pkgsrc infrastructure consists of a large codebase, and there are many
8689: corners where every little bit of a file is well thought out, making pkgsrc
8690: likely to fail as soon as anything is changed near those parts. To prevent most
8691: changes from breaking anything, a suite of regression tests should go along
8692: with every important part of the pkgsrc infrastructure. This chapter describes
8693: how regression tests work in pkgsrc and how you can add new tests.
8694:
1.184 rillig 8695: 26.1. Running the regression tests
1.1 dsieger 8696:
1.25 wiz 8697: You first need to install the pkgtools/pkg_regress package, which provides the
1.1 dsieger 8698: pkg_regress command. Then you can simply run that command, which will run all
1.168 rillig 8699: tests in the regress/ directory.
1.1 dsieger 8700:
1.184 rillig 8701: 26.2. Adding a new regression test
1.1 dsieger 8702:
1.168 rillig 8703: Every directory in the regress/ directory that contains a file called spec is
1.1 dsieger 8704: considered a regression test. This file is a shell program that is included by
8705: the pkg_regress command. The following functions can be overridden to suit your
8706: needs.
8707:
1.184 rillig 8708: 26.2.1. Overridable functions
1.1 dsieger 8709:
1.108 rillig 8710: These functions do not take any parameters. Although they are called in "set -e
1.168 rillig 8711: " mode, they don't stop at the first failing command. See this Stack Overflow
1.108 rillig 8712: question for details.
1.1 dsieger 8713:
1.108 rillig 8714: do_setup
1.1 dsieger 8715:
8716: This function prepares the environment for the test. By default it does
8717: nothing.
8718:
1.108 rillig 8719: do_test
1.1 dsieger 8720:
8721: This function runs the actual test. By default, it calls TEST_MAKE with the
8722: arguments MAKEARGS_TEST and writes its output including error messages into
8723: the file TEST_OUTFILE.
8724:
1.108 rillig 8725: When defining this function, make sure that all output that needs to be
8726: checked is written to the correct output file. Example:
8727:
8728: do_test() {
8729: echo "Example output"
8730: } 1>$TEST_OUTFILE 2>&1
8731:
8732: check_result
1.1 dsieger 8733:
8734: This function is run after the test and is typically used to compare the
8735: actual output from the one that is expected. It can make use of the various
1.108 rillig 8736: helper functions from the next section. Example:
8737:
8738: check_result() {
8739: exit_status 0
8740: output_require "Example"
8741: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
8742: output_prohibit "no such file or directory"
1.169 rillig 8743: regress_fail "expected $expected but got $actual for input $input"
1.108 rillig 8744: }
1.1 dsieger 8745:
1.108 rillig 8746: do_cleanup
1.1 dsieger 8747:
8748: This function cleans everything up after the test has been run. By default
8749: it does nothing.
8750:
1.184 rillig 8751: 26.2.2. Helper functions
1.1 dsieger 8752:
1.168 rillig 8753: regress_fail message...
8754:
8755: This function makes the test fail with the given error message.
8756:
1.108 rillig 8757: exit_status expected
1.1 dsieger 8758:
1.108 rillig 8759: This function compares the exitcode of the do_test function with its first
8760: parameter. If they differ, the test will fail.
1.1 dsieger 8761:
1.108 rillig 8762: output_require regex...
1.1 dsieger 8763:
8764: This function checks for each of its parameters if the output from do_test
1.108 rillig 8765: matches the extended regular expression. If it does not, the test will
8766: fail. Example:
8767:
8768: output_require "looks fine"
8769: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
1.1 dsieger 8770:
1.177 leot 8771: output_prohibit regex...
1.1 dsieger 8772:
8773: This function checks for each of its parameters if the output from do_test
8774: () does not match the extended regular expression. If any of the regular
8775: expressions matches, the test will fail.
8776:
1.184 rillig 8777: Chapter 27. Porting pkgsrc
1.1 dsieger 8778:
8779: Table of Contents
8780:
1.184 rillig 8781: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8782:
8783: The pkgsrc system has already been ported to many operating systems, hardware
8784: architectures and compilers. This chapter explains the necessary steps to make
8785: pkgsrc even more portable.
8786:
1.184 rillig 8787: 27.1. Porting pkgsrc to a new operating system
1.1 dsieger 8788:
8789: To port pkgsrc to a new operating system (called MyOS in this example), you
8790: need to touch the following files:
8791:
8792: pkgtools/bootstrap-mk-files/files/mods/MyOS.sys.mk
8793:
8794: This file contains some basic definitions, for example the name of the C
8795: compiler.
8796:
8797: mk/bsd.prefs.mk
8798:
1.212 wiz 8799: Insert code that defines the variables OPSYS, OS_VERSION, OPSYS_VERSION,
1.1 dsieger 8800: LOWER_VENDOR, MACHINE_ARCH, OBJECT_FMT, APPEND_ELF, and the other variables
8801: that appear in this file.
8802:
8803: mk/platform/MyOS.mk
8804:
8805: This file contains the platform-specific definitions that are used by
8806: pkgsrc. Start by copying one of the other files and edit it to your needs.
8807:
8808: mk/tools/tools.MyOS.mk
8809:
8810: This file defines the paths to all the tools that are needed by one or the
8811: other package in pkgsrc, as well as by pkgsrc itself. Find out where these
8812: tools are on your platform and add them.
8813:
8814: Now, you should be able to build some basic packages, like lang/perl5, shells/
8815: bash.
8816:
8817: Appendix A. A simple example package: bison
8818:
8819: Table of Contents
8820:
8821: A.1. files
8822:
8823: A.1.1. Makefile
8824: A.1.2. DESCR
8825: A.1.3. PLIST
8826: A.1.4. Checking a package with pkglint
8827:
8828: A.2. Steps for building, installing, packaging
8829:
8830: We checked to find a piece of software that wasn't in the packages collection,
1.25 wiz 8831: and picked GNU bison. Quite why someone would want to have bison when Berkeley
1.1 dsieger 8832: yacc is already present in the tree is beyond us, but it's useful for the
8833: purposes of this exercise.
8834:
8835: A.1. files
8836:
8837: A.1.1. Makefile
8838:
1.2 rillig 8839: # $NetBSD$
1.1 dsieger 8840: #
8841:
8842: DISTNAME= bison-1.25
8843: CATEGORIES= devel
1.171 rillig 8844: MASTER_SITES= ${MASTER_SITE_GNU:=bison/}
1.1 dsieger 8845:
1.30 dholland 8846: MAINTAINER= pkgsrc-users@NetBSD.org
1.174 leot 8847: HOMEPAGE= https://www.gnu.org/software/bison/bison.html
1.1 dsieger 8848: COMMENT= GNU yacc clone
8849:
8850: GNU_CONFIGURE= yes
1.47 wiz 8851: INFO_FILES= yes
1.1 dsieger 8852:
8853: .include "../../mk/bsd.pkg.mk"
8854:
8855: A.1.2. DESCR
8856:
8857: GNU version of yacc. Can make re-entrant parsers, and numerous other
8858: improvements. Why you would want this when Berkeley yacc(1) is part
8859: of the NetBSD source tree is beyond me.
8860:
8861: A.1.3. PLIST
8862:
1.2 rillig 8863: @comment $NetBSD$
1.1 dsieger 8864: bin/bison
8865: man/man1/bison.1.gz
8866: share/bison.simple
8867: share/bison.hairy
8868:
8869: A.1.4. Checking a package with pkglint
8870:
8871: The NetBSD package system comes with pkgtools/pkglint which helps to check the
8872: contents of these files. After installation it is quite easy to use, just
1.171 rillig 8873: change to the directory of the package you wish to examine and run pkglint:
1.1 dsieger 8874:
8875: $ pkglint
1.171 rillig 8876: ERROR: Makefile: Each package must define its LICENSE.
8877: WARN: Makefile:9: HOMEPAGE should migrate from http to https.
8878: NOTE: PLIST:3: The .gz extension is unnecessary for manual pages.
8879: WARN: PLIST:5: "share/bison.hairy" should be sorted before "share/bison.simple".
8880: 1 error, 2 warnings and 1 note found.
8881: (Run "pkglint -e" to show explanations.)
8882: (Run "pkglint -fs" to show what can be fixed automatically.)
1.172 rillig 8883: (Run "pkglint -F" to automatically fix some issues.)
1.1 dsieger 8884:
8885: Depending on the supplied command line arguments (see pkglint(1)), more checks
1.170 rillig 8886: will be performed. Use e.g. pkglint -Wall for a very thorough check.
1.1 dsieger 8887:
8888: A.2. Steps for building, installing, packaging
8889:
8890: Create the directory where the package lives, plus any auxiliary directories:
8891:
8892: # cd /usr/pkgsrc/lang
8893: # mkdir bison
8894: # cd bison
8895: # mkdir patches
8896:
1.184 rillig 8897: Create Makefile, DESCR and PLIST (see Chapter 12, Package components - files,
1.1 dsieger 8898: directories and contents) then continue with fetching the distfile:
8899:
8900: # make fetch
8901: >> bison-1.25.tar.gz doesn't seem to exist on this system.
8902: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
8903: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8904: ftp: Error retrieving file: 500 Internal error
8905:
8906: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
8907: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8908: ftp: Error retrieving file: 500 Internal error
8909:
8910: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
8911: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
8912: Successfully retrieved file.
8913:
8914: Generate the checksum of the distfile into distinfo:
8915:
8916: # make makedistinfo
8917:
8918: Now compile:
8919:
8920: # make
8921: >> Checksum OK for bison-1.25.tar.gz.
8922: ===> Extracting for bison-1.25
8923: ===> Patching for bison-1.25
8924: ===> Ignoring empty patch directory
8925: ===> Configuring for bison-1.25
8926: creating cache ./config.cache
8927: checking for gcc... cc
8928: checking whether we are using GNU C... yes
8929: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
8930: checking how to run the C preprocessor... cc -E
8931: checking for minix/config.h... no
8932: checking for POSIXized ISC... no
8933: checking whether cross-compiling... no
8934: checking for ANSI C header files... yes
8935: checking for string.h... yes
8936: checking for stdlib.h... yes
8937: checking for memory.h... yes
8938: checking for working const... yes
8939: checking for working alloca.h... no
8940: checking for alloca... yes
8941: checking for strerror... yes
8942: updating cache ./config.cache
8943: creating ./config.status
8944: creating Makefile
8945: ===> Building for bison-1.25
8946: 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
8947: 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
8948: 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
8949: 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
8950: 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
8951: 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
8952: 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
8953: 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
8954: 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
8955: 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
8956: 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
8957: 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
8958: 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
8959: 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
8960: 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
8961: 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
8962: 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
8963: 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
8964: 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
8965: 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
8966: 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
8967: 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
8968: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
8969: rm -f bison.s1
8970: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
8971:
8972: Everything seems OK, so install the files:
8973:
8974: # make install
8975: >> Checksum OK for bison-1.25.tar.gz.
8976: ===> Installing for bison-1.25
8977: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
8978: rm -f /usr/pkg/bin/bison
8979: cd /usr/pkg/share; rm -f bison.simple bison.hairy
8980: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
8981: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
8982: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
8983: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
8984: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
8985: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
8986: ===> Registering installation for bison-1.25
8987:
8988: You can now use bison, and also - if you decide so - remove it with pkg_delete
8989: bison. Should you decide that you want a binary package, do this now:
8990:
8991: # make package
8992: >> Checksum OK for bison-1.25.tar.gz.
8993: ===> Building package for bison-1.25
8994: Creating package bison-1.25.tgz
8995: Registering depends:.
8996: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
8997:
8998: Now that you don't need the source and object files any more, clean up:
8999:
9000: # make clean
9001: ===> Cleaning for bison-1.25
9002:
1.207 leot 9003: Appendix B. Security hardening
9004:
9005: Table of Contents
9006:
9007: B.1. Mechanisms
9008:
9009: B.1.1. Enabled by default
9010: B.1.2. Not enabled by default
9011:
9012: B.2. Caveats
9013:
9014: B.2.1. Problems with PKGSRC_MKPIE
9015: B.2.2. Problems with PKGSRC_USE_FORTIFY
9016: B.2.3. Problems with PKGSRC_USE_RELRO
9017: B.2.4. Problems with PKGSRC_USE_SSP
9018:
9019: B.3. Auditing the system
9020:
9021: B.3.1. Checking for PIE
9022: B.3.2. Checking for partial RELRO
9023: B.3.3. Checking for full RELRO
9024: B.3.4. Checking for SSP
9025:
9026: A number of mechanisms are available in pkgsrc to improve the security of the
9027: resulting system. This page describes the mechanisms, and gives hints about
9028: detecting and fixing problems.
9029:
9030: Mechanisms can be enabled individually in mk.conf, and are individually
9031: described below.
9032:
9033: Typically, a feature will cause some programs to fail to build or work when
9034: first enabled. This can be due to latent problems in the program, and can be
9035: due to other reasons. After enough testing to have confidence that user
9036: problems will be quite rare, individual mechanisms will be enabled by default.
9037:
9038: For each mechanism, see the Caveats section below for an explanation of what
9039: might go wrong at compile time and at run time, and how to notice and address
9040: these problems.
9041:
9042: B.1. Mechanisms
9043:
9044: B.1.1. Enabled by default
9045:
9046: B.1.1.1. PKGSRC_USE_FORTIFY
9047:
9048: This allows substitute wrappers to be used for some commonly used library
9049: functions that do not have built-in bounds checking - but could in some cases.
9050:
9051: Two mitigation levels are available:
9052:
9053: * "weak" only enables checks at compile-time.
9054:
9055: * "strong" enables checks at compile-time and runtime.
9056:
9057: "strong" has been enabled by default since pkgsrc-2017Q3.
9058:
9059: B.1.1.2. PKGSRC_USE_SSP
9060:
9061: This enables a stack-smashing protection mitigation. It is done by adding a
9062: guard variable to functions with vulnerable objects. The guards are initialized
9063: when a function is entered and then checked when the function exits. The guard
9064: check will fail and the program forcibly exited if the variable was modified in
9065: the meantime. This can happen in case of buffer overflows or memory corruption,
9066: and therefore exposing these bugs.
9067:
9068: Different mitigation levels are available:
9069:
9070: * "yes", which will only protect functions considered vulnerable by the
9071: compiler;
9072:
9073: * "all", which will protect every function;
9074:
9075: * "strong", the default, which will apply a better balance between the two
9076: settings above.
9077:
9078: This mitigation is supported by both GCC and clang. It may be supported in
9079: additional compilers, possibly under a different name. It is particularly
9080: useful for unsafe programming languages, such as C/C++.
9081:
9082: * "yes" is enabled by default where known supported since pkgsrc-2017Q3.
9083:
9084: * "strong" is enabled by default where known supported since pkgsrc-2021Q4.
9085:
9086: More details can be found here:
9087:
9088: * Buffer overflow protection on Wikipedia
9089:
9090: B.1.1.3. PKGSRC_MKPIE
9091:
9092: This requests the creation of PIE (Position Independent Executables) for all
9093: executables. The PIE mechanism is normally used for shared libraries, so that
9094: they can be loaded at differing addresses at runtime. PIE itself does not have
9095: useful security properties; however, it is necessary to fully leverage some,
9096: such as ASLR. Some operating systems support Address Space Layout Randomization
9097: (ASLR), which causes different addresses to be used each time a program is run.
9098: This makes it more difficult for an attacker to guess addresses and thus makes
9099: exploits harder to construct. With PIE, ASLR can really be applied to the
9100: entire program, instead of the stack and heap only.
9101:
9102: PIE executables will only be built for toolchains that are known to support
9103: PIE. Currently, this means NetBSD on x86, ARM, SPARC64, m68k, and MIPS.
9104:
9105: PKGSRC_MKPIE was enabled by default after the pkgsrc-2021Q3 branch.
9106:
1.219 nia 9107: B.1.1.4. PKGSRC_USE_RELRO
1.207 leot 9108:
9109: This also makes the exploitation of some security vulnerabilities more
9110: difficult in some cases.
9111:
9112: Two different mitigation levels are available:
9113:
1.219 nia 9114: * partial (the default): the ELF sections are reordered so that internal data
9115: sections precede the program's own data sections, and non-PLT GOT is
9116: read-only;
1.207 leot 9117:
9118: * full: in addition to partial RELRO, every relocation is performed
1.218 nia 9119: immediately when starting the program, allowing the entire GOT to be
9120: read-only. This can greatly slow down startup of large programs.
1.207 leot 9121:
9122: This is currently supported by GCC. Many software distributions now enable this
1.220 nia 9123: feature by default, at the "partial" level.
1.207 leot 9124:
9125: More details can be found here:
9126:
9127: * Hardening ELF binaries using Relocation Read-Only (RELRO)
9128:
1.219 nia 9129: B.1.2. Not enabled by default
9130:
9131: B.1.2.1. PKGSRC_MKREPRO
9132:
9133: With this option, pkgsrc will try to build packages reproducibly. This allows
9134: packages built from the same tree and with the same options, to produce
9135: identical results bit by bit. This option should be combined with ASLR and
9136: PKGSRC_MKPIE to avoid predictable address offsets for attackers attempting to
9137: exploit security vulnerabilities.
9138:
9139: More details can be found here:
9140:
9141: * Reproducible Builds - a set of software development practices that create
9142: an independently-verifiable path from source to binary code
9143:
9144: More work likely needs to be done before pkgsrc is fully reproducible.
9145:
9146: B.1.2.2. PKGSRC_USE_STACK_CHECK
1.207 leot 9147:
9148: This uses -fstack-check with GCC for another stack protection mitigation.
9149:
9150: It asks the compiler to generate code verifying that it does not corrupt the
9151: stack. According to GCC's manual page, this is really only useful for
9152: multi-threaded programs.
9153:
9154: B.2. Caveats
9155:
9156: B.2.1. Problems with PKGSRC_MKPIE
9157:
9158: B.2.1.1. Packages failing to build
9159:
9160: A number of packages may fail to build with this option enabled. The failures
9161: are often related to the absence of the -fPIC compilation flag when building
9162: libraries or executables (or ideally -fPIE in the latter case). This flag is
9163: added to the CFLAGS already, but requires the package to actually support it.
9164:
9165: B.2.1.1.1. How to fix
9166:
9167: These instructions are meant as a reference only; they likely need to be
9168: adapted for many packages individually.
9169:
9170: For packages using Makefiles:
9171:
9172: MAKE_FLAGS+= CFLAGS=${CFLAGS:Q}
9173: MAKE_FLAGS+= LDFLAGS=${LDFLAGS:Q}
9174:
9175: For packages using Imakefiles:
9176:
9177: MAKE_FLAGS+= CCOPTIONS=${CFLAGS:Q}
9178: MAKE_FLAGS+= LOCAL_LDFLAGS=${LDFLAGS:Q}
9179:
9180: B.2.1.2. Run-time crashes
9181:
9182: Some programs may fail to run, or crash at random times once built as PIE. Two
9183: scenarios are essentially possible. This is nearly always due to a bug in the
9184: program being exposed due to ASLR.
9185:
9186: B.2.1.3. Disabling PKGSRC_MKPIE on a per-package basis
9187:
9188: Ideally, packages should be fixed for compatibility with MKPIE. However, in
9189: some cases this is very difficult, due to complex build systems, packages using
9190: non-standard toolchains, or programming languages with odd bootstrapping
9191: mechanisms.
9192:
9193: To disable PKGSRC_MKPIE on a per-package basis, set MKPIE_SUPPORTED= no in the
9194: package's Makefile before bsd.prefs.mk is included.
9195:
9196: B.2.2. Problems with PKGSRC_USE_FORTIFY
9197:
9198: B.2.2.1. Packages failing to build
9199:
9200: This feature makes use of pre-processing directives to look for hardened,
9201: alternative implementations of essential library calls. Some programs may fail
9202: to build as a result; this usually happens for those trying too hard to be
9203: portable, or otherwise abusing definitions in the standard library.
9204:
9205: B.2.2.2. Run-time crashes
9206:
9207: This feature may cause some programs to crash, usually indicating an actual bug
9208: in the program. The fix will typically involve patching the original program's
9209: source code.
9210:
9211: B.2.2.3. Optimization is required
9212:
9213: At least in the case of GCC, FORTIFY will only be applied if optimization is
9214: applied while compiling. This means that the CFLAGS should also contain -O, -O2
9215: or another optimization level. This cannot easily be applied globally, as some
9216: packages may require specific optimization levels.
9217:
9218: B.2.2.4. Disabling FORTIFY on a per-package basis
9219:
9220: Note
9221:
9222: FORTIFY should not be disabled to work around runtime crashes in the program!
9223: This is a very bad idea and will expose you to security vulnerabilities.
9224:
9225: To disable FORTIFY on a per-package basis, set the following in the package's
9226: Makefile before bsd.prefs.mk is included:
9227:
9228: FORTIFY_SUPPORTED= no
9229:
9230: B.2.3. Problems with PKGSRC_USE_RELRO
9231:
9232: B.2.3.1. Performance impact
9233:
9234: For better protection, full RELRO requires every symbol to be resolved when the
9235: program starts, rather than simply when required at run-time. This will have
9236: more impact on programs using a lot of symbols, or linked to libraries exposing
9237: a lot of symbols. Therefore, daemons or programs otherwise running in
9238: background are affected only when started. Programs loading plug-ins at
9239: run-time are affected when loading the plug-ins.
9240:
9241: The impact is not expected to be noticeable on modern hardware, except in some
9242: cases for big programs.
9243:
9244: B.2.3.2. Run-time crashes
9245:
9246: Some programs handle plug-ins and dependencies in a way that conflicts with
9247: RELRO: for instance, with an initialization routine listing any other plug-in
9248: required. With full RELRO, the missing symbols are resolved before the
9249: initialization routine can run, and the dynamic loader will not be able to find
9250: them directly and abort as a result. Unfortunately, this is how Xorg loads its
9251: drivers. Partial RELRO can be applied instead in this case.
9252:
9253: B.2.3.3. Disabling RELRO on a per-package basis
9254:
9255: To disable RELRO on a per-package basis, set the following in the package's
9256: Makefile before bsd.prefs.mk is included:
9257:
9258: RELRO_SUPPORTED= no
9259:
1.209 nia 9260: It is also possible to at most enable partial RELRO, by setting RELRO_SUPPORTED
9261: to partial.
9262:
1.207 leot 9263: B.2.4. Problems with PKGSRC_USE_SSP
9264:
9265: B.2.4.1. Packages failing to build
9266:
9267: The stack-smashing protection provided by this option does not work for some
9268: programs. The most common situation in which this happens is when the program
9269: allocates variables on the stack, with the size determined at run-time.
9270:
9271: B.2.4.2. Run-time crashes
9272:
9273: Again, this feature may cause some programs to crash via a SIGABRT, usually
9274: indicating an actual bug in the program.
9275:
9276: On NetBSD LOG_CRIT level syslog messages are sent and - by default - appended
9277: to /var/log/messages, e.g.:
9278:
9279: Jan 6 15:42:51 hostname -: hostname program - - - buffer overflow detected; terminated
9280:
9281: (where hostname is the hostname(1) and program is the basename(1) of the
9282: program crashed).
9283:
9284: Patching the original program is then required.
9285:
9286: Rebuilding the package via:
9287:
9288: % env CFLAGS=-g INSTALL_UNSTRIPPED=yes make replace
9289:
9290: and inspecting the backtrace of the coredump via the debugger should point out
9291: the problematic call by inspecting the frame calling the _chk() (SSP) function.
9292:
9293: B.2.4.3. Performance impact
9294:
9295: The compiler emits extra code when using this feature: a check for buffer
9296: overflows is performed when entering and exiting functions, requiring an extra
9297: variable on the stack. The level of protection can otherwise be adjusted to
9298: affect only those functions considered more sensitive by the compiler (with
9299: -fstack-protector instead of -fstack-protector-all).
9300:
9301: The impact is not expected to be noticeable on modern hardware. However,
9302: programs with a hard requirement to run at the fastest possible speed should
9303: avoid using this feature, or using libraries built with this feature.
9304:
9305: B.2.4.4. Disabling SSP on a per-package basis
9306:
9307: Note
9308:
9309: SSP should not be disabled to work around runtime crashes in the program! This
9310: is a very bad idea and will expose you to security vulnerabilities.
9311:
9312: To disable SSP on a per-package basis, set the following in the package's
9313: Makefile before bsd.prefs.mk is included:
9314:
9315: SSP_SUPPORTED= no
9316:
9317: B.3. Auditing the system
9318:
9319: The illusion of security is worse than having no security at all. This section
9320: lists a number of ways to ensure the security features requested are actually
9321: effective.
9322:
9323: These instructions were obtained and tested on a system derived from NetBSD 7
9324: (amd64). YMMV.
9325:
9326: B.3.1. Checking for PIE
9327:
9328: The ELF executable type in use changes for binaries built as PIE; without:
9329:
9330: $ file /path/to/bin/ary
9331: /path/to/bin/ary: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for NetBSD 7.0, not stripped
9332:
9333: as opposed to the following binary, built as PIE:
9334:
9335: $ file /path/to/pie/bin/ary
9336: /path/to/pie/bin/ary: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for NetBSD 7.0, not stripped
9337:
9338: The latter result is then what is expected.
9339:
9340: B.3.2. Checking for partial RELRO
9341:
9342: The following command should list a section called RELRO:
9343:
9344: $ objdump -p /path/to/bin/ary
9345:
9346: /path/to/bin/ary: file format elf64-x86-64
9347:
9348: Program Header:
9349: [...]
9350: RELRO off 0x0000000000000d78 vaddr 0x0000000000600d78 paddr 0x0000000000600d78 align 2**0
9351:
9352: This check is now performed automatically if PKG_DEVELOPER is set and RELRO is
9353: enabled.
9354:
9355: B.3.3. Checking for full RELRO
9356:
9357: The dynamic loader will apply RELRO immediately when detecting the presence of
9358: the BIND_NOW flag:
9359:
9360: $ objdump -x /path/to/bin/ary
9361:
9362: /path/to/bin/ary: file format elf64-x86-64
9363:
9364: Dynamic Section:
9365: [...]
9366: BIND_NOW 0x0000000000000000
9367:
9368: This has to be combined with partial RELRO (see above) to be fully efficient.
9369:
9370: This check is now performed automatically (where supported) if PKG_DEVELOPER is
9371: set.
9372:
9373: B.3.4. Checking for SSP
9374:
1.208 nia 9375: Note
9376:
9377: Checking for SSP using this method only works where the operating system uses
9378: libssp. libssp is not used on recent NetBSD/FreeBSD/Linux versions.
9379:
1.207 leot 9380: Building objects, binaries and libraries with SSP will affect the presence of
9381: additional symbols in the resulting file:
9382:
9383: $ nm /path/to/bin/ary
9384: [...]
9385: U __stack_chk_fail
9386: 0000000000600ea0 B __stack_chk_guard
9387:
9388: This is an indicator that the program was indeed built with support for SSP.
9389:
9390: This check is now performed automatically (where supported) if PKG_DEVELOPER is
9391: set and SSP is enabled.
9392:
9393: Appendix C. Build logs
1.1 dsieger 9394:
9395: Table of Contents
9396:
1.207 leot 9397: C.1. Building figlet
9398: C.2. Packaging figlet
1.1 dsieger 9399:
1.207 leot 9400: C.1. Building figlet
1.1 dsieger 9401:
9402: # make
9403: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9404: => figlet221.tar.gz doesn't seem to exist on this system.
9405: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
9406: => [172219 bytes]
9407: Connected to ftp.plig.net.
9408: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
9409: 331 Guest login ok, send your complete e-mail address as password.
9410: 230-You are user #5 of 500 simultaneous users allowed.
9411: 230-
9412: 230- ___ _ _ _
9413: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
9414: 230- | _| _| . |_| . | | | . |_| . | _| . |
9415: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
9416: 230- |_| |_| |___| |___|
9417: 230-
9418: 230-** Welcome to ftp.plig.org **
9419: 230-
9420: 230-Please note that all transfers from this FTP site are logged. If you
9421: 230-do not like this, please disconnect now.
9422: 230-
1.19 snj 9423: 230-This archive is available via
1.1 dsieger 9424: 230-
9425: 230-HTTP: http://ftp.plig.org/
9426: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
9427: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
9428: 230-
9429: 230-Please email comments, bug reports and requests for packages to be
9430: 230-mirrored to ftp-admin@plig.org.
9431: 230-
9432: 230-
9433: 230 Logged in anonymously.
9434: Remote system type is UNIX.
9435: Using binary mode to transfer files.
9436: 200 Type okay.
9437: 250 "/pub" is new cwd.
9438: 250-"/pub/figlet" is new cwd.
9439: 250-
9440: 250-Welcome to the figlet archive at ftp.figlet.org
9441: 250-
9442: 250- ftp://ftp.figlet.org/pub/figlet/
9443: 250-
9444: 250-The official FIGlet web page is:
9445: 250- http://www.figlet.org/
9446: 250-
9447: 250-If you have questions, please mailto:info@figlet.org. If you want to
9448: 250-contribute a font or something else, you can email us.
9449: 250
9450: 250 "/pub/figlet/program" is new cwd.
9451: 250 "/pub/figlet/program/unix" is new cwd.
9452: local: figlet221.tar.gz remote: figlet221.tar.gz
9453: 502 Unimplemented command.
9454: 227 Entering Passive Mode (195,40,6,41,246,104)
9455: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
9456: 38% |************** | 65800 64.16 KB/s 00:01 ETA
9457: 226 Transfer completed.
9458: 172219 bytes received in 00:02 (75.99 KB/s)
9459: 221 Goodbye.
9460: => Checksum OK for figlet221.tar.gz.
9461: ===> Extracting for figlet-2.2.1nb2
9462: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
9463: ===> Patching for figlet-2.2.1nb2
9464: ===> Applying pkgsrc patches for figlet-2.2.1nb2
9465: ===> Overriding tools for figlet-2.2.1nb2
9466: ===> Creating toolchain wrappers for figlet-2.2.1nb2
9467: ===> Configuring for figlet-2.2.1nb2
9468: ===> Building for figlet-2.2.1nb2
9469: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
9470: chmod a+x figlet
9471: gcc -O2 -o chkfont chkfont.c
9472: => Unwrapping files-to-be-installed.
9473: #
9474: # make install
9475: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9476: ===> Installing for figlet-2.2.1nb2
9477: install -d -o root -g wheel -m 755 /usr/pkg/bin
9478: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
9479: mkdir -p /usr/pkg/share/figlet
9480: cp figlet /usr/pkg/bin
9481: cp chkfont /usr/pkg/bin
9482: chmod 555 figlist showfigfonts
9483: cp figlist /usr/pkg/bin
9484: cp showfigfonts /usr/pkg/bin
9485: cp fonts/*.flf /usr/pkg/share/figlet
9486: cp fonts/*.flc /usr/pkg/share/figlet
9487: cp figlet.6 /usr/pkg/man/man6
9488: ===> Registering installation for figlet-2.2.1nb2
9489: #
9490:
1.207 leot 9491: C.2. Packaging figlet
1.1 dsieger 9492:
9493: # make package
9494: ===> Checking for vulnerabilities in figlet-2.2.1nb2
9495: ===> Packaging figlet-2.2.1nb2
9496: ===> Building binary package for figlet-2.2.1nb2
9497: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
9498: Using SrcDir value of /usr/pkg
9499: Registering depends:.
9500: #
9501:
1.207 leot 9502: Appendix D. Directory layout of the pkgsrc FTP server
1.1 dsieger 9503:
9504: Table of Contents
9505:
1.207 leot 9506: D.1. distfiles: The distributed source files
9507: D.2. misc: Miscellaneous things
9508: D.3. packages: Binary packages
9509: D.4. reports: Bulk build reports
9510: D.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 9511:
9512: As in other big projects, the directory layout of pkgsrc is quite complex for
9513: newbies. This chapter explains where you find things on the FTP server. The
9514: base directory on ftp.NetBSD.org is /pub/pkgsrc/. On other servers it may be
9515: different, but inside this directory, everything should look the same, no
9516: matter on which server you are. This directory contains some subdirectories,
9517: which are explained below.
9518:
1.207 leot 9519: D.1. distfiles: The distributed source files
1.1 dsieger 9520:
9521: The directory distfiles contains lots of archive files from all pkgsrc
9522: packages, which are mirrored here. The subdirectories are called after their
9523: package names and are used when the distributed files have names that don't
9524: explicitly contain a version number or are otherwise too generic (for example
9525: release.tar.gz).
9526:
1.207 leot 9527: D.2. misc: Miscellaneous things
1.1 dsieger 9528:
9529: This directory contains things that individual pkgsrc developers find worth
9530: publishing.
9531:
1.207 leot 9532: D.3. packages: Binary packages
1.1 dsieger 9533:
1.3 rillig 9534: This directory contains binary packages for the various platforms that are
9535: supported by pkgsrc. Each subdirectory is of the form OPSYS/ARCH/OSVERSION_TAG.
9536: The meaning of these variables is:
9537:
9538: * OPSYS is the name of the operating system for which the packages have been
1.9 rillig 9539: built. The name is taken from the output of the uname command, so it may
9540: differ from the one you are used to hear.
1.3 rillig 9541:
1.8 rillig 9542: * ARCH is the hardware architecture of the platform for which the packages
1.10 hubertf 9543: have been built. It also includes the ABI (Application Binary Interface)
9544: for platforms that have several of them.
1.3 rillig 9545:
1.8 rillig 9546: * OSVERSION is the version of the operating system. For version numbers that
9547: change often (for example NetBSD-current), the often-changing part should
9548: be replaced with an x, for example 4.99.x.
1.3 rillig 9549:
1.23 jakllsch 9550: * TAG is either 20xxQy for a stable branch, or head for packages built from
1.8 rillig 9551: the HEAD branch. The latter should only be used when the packages are
9552: updated on a regular basis. Otherwise the date from checking out pkgsrc
9553: should be appended, for example head_20071015.
1.3 rillig 9554:
9555: The rationale for exactly this scheme is that the pkgsrc users looking for
9556: binary packages can quickly click through the directories on the server and
9557: find the best binary packages for their machines. Since they usually know the
9558: operating system and the hardware architecture, OPSYS and ARCH are placed
9559: first. After these choices, they can select the best combination of OSVERSION
9560: and TAG together, since it is usually the case that packages stay compatible
9561: between different version of the operating system.
9562:
9563: In each of these directories, there is a whole binary packages collection for a
9564: specific platform. It has a directory called All which contains all binary
9565: packages. Besides that, there are various category directories that contain
9566: symbolic links to the real binary packages.
1.1 dsieger 9567:
1.207 leot 9568: D.4. reports: Bulk build reports
1.8 rillig 9569:
9570: Here are the reports from bulk builds, for those who want to fix packages that
9571: didn't build on some of the platforms. The structure of subdirectories should
1.207 leot 9572: look like the one in Section D.3, "packages: Binary packages".
1.8 rillig 9573:
1.207 leot 9574: D.5. current, stable, pkgsrc-20xxQy: source packages
1.1 dsieger 9575:
9576: These directories contain the "real" pkgsrc, that is the files that define how
9577: to create binary packages from source archives.
9578:
1.149 leot 9579: Each of the current, stable and pkgsrc-20xxQy directories share the same
9580: structure. They each contain a pkgsrc directory and pkgsrc.tar.{bz,gz,xz} file.
9581:
1.1 dsieger 9582: The directory pkgsrc contains a snapshot of the CVS repository, which is
1.149 leot 9583: updated regularly. The file pkgsrc.tar.{bz,gz,xz} contains the same as the
9584: directory, ready to be downloaded as a whole.
1.1 dsieger 9585:
1.149 leot 9586: The current directory contains files related to the HEAD branch of the CVS
9587: repository. In this directory there is an additional file called
9588: pkgsrc-readmes.tar.{bz,gz,xz} that contains all pkgsrc READMEs with information
9589: about categories and packages.
9590:
9591: The stable directory is a symlink to the latest pkgsrc-20xxQy.
9592:
9593: The pkgsrc-20xxQy. directories contain files related to the -20xxQy stable
9594: branch of the CVS repository. In these directories there is an additional file
9595: called pkgsrc-20xxQy.tar.{bz,gz,xz}, which contains the state of pkgsrc when it
9596: was branched.
1.148 leot 9597:
1.207 leot 9598: Appendix E. Help topics
1.154 rillig 9599:
9600: The following list contains all help topics that are available when running
9601: bmake help topic=:index.
9602:
1.229 gutterid 9603: #! -lintl
9604: 32bit 64bit
9605: ABI ACCEPTABLE_LICENSES
9606: ACROREAD_FONTPATH ADDITIONAL
9607: AFAIK AIX
9608: ALLOW_VULNERABLE_PACKAGES ALL_ENV
9609: ALTERNATIVES_SRC AMANDA_TMP
9610: AMANDA_USER AMANDA_VAR
9611: APACHE_GROUP APACHE_MODULE_NAME
9612: APACHE_MODULE_SRC APACHE_MODULE_SRCDIR
9613: APACHE_PKG_PREFIX APACHE_SUEXEC_CONFIGURE_ARGS
9614: APACHE_SUEXEC_DOCROOT APACHE_USER
9615: APPEND_ABI APPEND_ELF
9616: ARLA_CACHE AUDIT_PACKAGES_FLAGS
9617: AUTOCONF_REQD AUTOMAKE_OVERRIDE
9618: AUTOMAKE_REQD AUTO_MKDIRS
9619: BDB185_DEFAULT BDBBASE
9620: BDB_ACCEPTED BDB_DEFAULT
9621: BDB_LIBS BDB_TYPE
9622: BINCIMAP_GROUP BINCIMAP_USER
9623: BIND_DIR BIND_GROUP
9624: BIND_USER BINOWN
9625: BINPKG_SITES BIN_INSTALL_FLAGS
9626: BISON_PKGDATADIR BLAS
9627: BLAS_ACCEPTED BLAS_C_INTERFACE
9628: BLAS_INCLUDES BLAS_INDEX64
9629: BLAS_LIBS BLAS_PC
9630: BLAS_TYPE BOOTSTRAP_DEPENDS
9631: BROKEN BROKEN_EXCEPT_ON_PLATFORM
9632: BROKEN_ON_PLATFORM BSDSRCDIR
9633: BSDXSRCDIR BSD_MAKE_ENV
9634: BUILDLINK_AUTO_DIRS BUILDLINK_AUTO_VARS
9635: BUILDLINK_CFLAGS BUILDLINK_CONTENTS_FILTER
9636: BUILDLINK_CPPFLAGS BUILDLINK_FILES
9637: BUILDLINK_FILES_CMD BUILDLINK_FNAME_TRANSFORM
9638: BUILDLINK_LDFLAGS BUILDLINK_LIBS
9639: BUILDLINK_OPSYS_SUPPORT_PTHREAD BUILDLINK_PKGNAME
9640: BUILDLINK_PREFIX BUILDLINK_RPATHDIRS
9641: BUILDLINK_TREE BUILD_DEFS
9642: BUILD_DEFS_EFFECTS BUILD_DEPENDS
9643: BUILD_DIRS BUILD_ENV_SHELL
9644: BUILD_MAKE_CMD BUILD_MAKE_FLAGS
9645: BUILD_TARGET BUILTIN_FIND_FILES
9646: BUILTIN_FIND_FILES_VAR BUILTIN_FIND_GREP
9647: BUILTIN_FIND_HEADERS BUILTIN_FIND_HEADERS_VAR
9648: BUILTIN_FIND_PKGCONFIG BUILTIN_FIND_PKGCONFIG_VAR
9649: BUILTIN_PKG BUILTIN_TEST_CURSES_DEFINES
9650: BUILTIN_TEST_CURSES_FUNCS BUILTIN_VERSION_SCRIPT
9651: BUILTIN_X11_TYPE BUILTIN_X11_VERSION
9652: CACTI_GROUP CACTI_USER
9653: CANNA_GROUP CANNA_USER
9654: CAT CBLAS_LIBS
9655: CBLAS_PC CCACHE_BASE
9656: CCACHE_DIR CCACHE_LOGFILE
9657: CC_VERSION CC_VERSION_STRING
9658: CDRECORD_CONF CDROM_PKG_URL_DIR
9659: CDROM_PKG_URL_HOST CHANGES
9660: CHECK_COMPILER CHECK_FAKEHOME
9661: CHECK_FILES CHECK_FILES_SKIP
9662: CHECK_FILES_STRICT CHECK_HEADERS
9663: CHECK_HEADERS_SKIP CHECK_INTERPRETER
9664: CHECK_INTERPRETER_SKIP CHECK_PERMS
9665: CHECK_PERMS_AUTOFIX CHECK_PERMS_SKIP
9666: CHECK_PIE CHECK_PIE_SKIP
9667: CHECK_PIE_SUPPORTED CHECK_PORTABILITY
9668: CHECK_PORTABILITY_EXPERIMENTAL CHECK_PORTABILITY_SKIP
9669: CHECK_RELRO CHECK_RELRO_SKIP
9670: CHECK_RELRO_SUPPORTED CHECK_SHLIBS
9671: CHECK_SHLIBS_SKIP CHECK_SHLIBS_SUPPORTED
9672: CHECK_SHLIBS_TOXIC CHECK_SSP
9673: CHECK_SSP_SKIP CHECK_SSP_SUPPORTED
9674: CHECK_STRIPPED CHECK_STRIPPED_SKIP
9675: CHECK_WRKREF CHECK_WRKREF_EXTRA_DIRS
9676: CHECK_WRKREF_SKIP CLAMAV_DBDIR
9677: CLAMAV_GROUP CLAMAV_USER
9678: CLANGBASE CLEANDEPENDS
9679: CMAKE_DEPENDENCIES_REWRITE CMAKE_INSTALL_NAME_DIR
9680: CMAKE_INSTALL_PREFIX CMAKE_MODULE_PATH_OVERRIDE
9681: CMAKE_PKGSRC_BUILD_FLAGS CMAKE_PREFIX_PATH
9682: CMAKE_USE_GNU_INSTALL_DIRS COMPILER_RPATH_FLAG
9683: COMPILER_USE_SYMLINKS CONFIGURE_ARGS
9684: CONFIGURE_DIRS CONFIGURE_ENV
9685: CONFIGURE_ENV_SHELL CONFIGURE_HAS_INFODIR
9686: CONFIGURE_HAS_MANDIR CONFIGURE_SCRIPT
9687: CONFIG_SHELL CONFIG_SHELL_FLAGS
9688: CONF_FILES CONF_FILES_MODE
9689: CONF_FILES_PERMS CONSERVER_DEFAULTHOST
9690: CONSERVER_DEFAULTPORT CP
9691: CPP CPP_PRECOMP_FLAGS
9692: CREATE_WRKDIR_SYMLINK CROSSBASE
9693: CTFCONVERT CTF_FILES_SKIP
9694: CTF_SUPPORTED CTYPE
9695: CUPS_GROUP CUPS_SYSTEM_GROUPS
9696: CUPS_USER CURSES_DEFAULT
9697: CURSES_TYPE CXX
9698: CYRUS_GROUP CYRUS_IDLE
9699: CYRUS_USER DAEMONTOOLS_GROUP
9700: DAEMONTOOLS_LOG_USER DARWIN_NO_SYSTEM_LIBS
9701: DARWIN_REQUIRES_FILTER DBUS_GROUP
9702: DBUS_USER DEFANG_GROUP
9703: DEFANG_USER DEFAULT_ACCEPTABLE_LICENSES
9704: DEFAULT_DISTFILES DEFAULT_IRC_SERVER
9705: DEFAULT_SERIAL_DEVICE DEF_UMASK
9706: DEINSTALLDEPENDS DEINSTALL_SRC
9707: DEINSTALL_TEMPLATES DELAYED_ERROR_MSG
9708: DELAYED_WARNING_MSG DEPENDS
9709: DEPENDS_TARGET DEPENDS_TYPE
9710: DESTDIR DESTDIR_VARNAME
9711: DIALER_GROUP DIGEST_REQD
9712: DISTDIR DISTFILES
9713: DISTINFO_FILE DISTNAME
9714: DIST_PATH DIST_SUBDIR
9715: DJBDNS_AXFR_USER DJBDNS_CACHE_USER
9716: DJBDNS_DJBDNS_GROUP DJBDNS_LOG_USER
9717: DJBDNS_RBL_USER DJBDNS_TINY_USER
9718: DLOPEN_REQUIRE_PTHREADS DL_AUTO_VARS
9719: DL_CFLAGS DL_LDFLAGS
9720: DL_LIBS DNS
9721: DOCOWN DOWNLOADED_DISTFILE
9722: DQCACHE_GROUP DQCACHE_USER
9723: DT_LAYOUT DYNAMIC_SITES_CMD
9724: DYNAMIC_SITES_SCRIPT ECHO
9725: ECHO_N ELK_GUI
9726: EMACS_TYPE EMULDIR
9727: EMULSUBDIR EMULSUBDIRSLASH
9728: EMUL_ARCH EMUL_DISTRO
9729: EMUL_EXEC_FMT EMUL_IS_NATIVE
9730: EMUL_MODULES EMUL_OPSYS
9731: EMUL_PKG_FMT EMUL_PLATFORM
9732: EMUL_PLATFORMS EMUL_PREFER
9733: EMUL_REQD EMUL_TYPE
9734: ERROR_MSG EXIM_GROUP
9735: EXIM_USER EXPORT_SYMBOLS_LDFLAGS
9736: EXTRACTOR EXTRACT_CMD
9737: EXTRACT_CMD_DEFAULT EXTRACT_DIR
9738: EXTRACT_ELEMENTS EXTRACT_ENV
9739: EXTRACT_ONLY EXTRACT_OPTS
9740: EXTRACT_SUFX EXTRACT_USING
9741: FAIL FAILOVER_FETCH
9742: FAIL_MSG FAKE_NCURSES
9743: FAM FAM_ACCEPTED
9744: FAM_DEFAULT FAM_SERVER
9745: FCPATH FEATURE_CPPFLAGS
9746: FEATURE_LDFLAGS FEATURE_LIBS
9747: FETCH_AFTER_ARGS FETCH_BEFORE_ARGS
9748: FETCH_CMD FETCH_OUTPUT_ARGS
9749: FETCH_PROXY FETCH_RESUME_ARGS
9750: FETCH_TIMEOUT FETCH_USE_IPV4_ONLY
9751: FETCH_USING FILES_SUBST
9752: FILES_SUBST_SED FIX_SYSTEM_HEADERS
9753: FONTS_DIRS FONTS_VERBOSE
9754: FOO_HACKS_MK FOX_USE_XUNICODE
9755: FREEWNN_GROUP FREEWNN_USER
9756: FTP_PKG_URL_DIR FTP_PKG_URL_HOST
9757: GAMEDATAMODE GAMEDATA_PERMS
9758: GAMEDIRMODE GAMEDIR_PERMS
9759: GAMEGRP GAMEMODE
9760: GAMEOWN GAMES_GROUP
9761: GAMES_USER GCC
9762: GCCBASE GCC_REQD
9763: GCC_VERSION_SUFFIX GEM_BUILD
9764: GEM_CLEANBUILD GEM_CLEANBUILD_EXTENSIONS
9765: GEM_DOCDIR GEM_EXTSDIR
9766: GEM_HOME GEM_KEEPBUILD
9767: GEM_LIBDIR GEM_NAME
9768: GEM_PATH GEM_PLUGINSDIR
9769: GEM_SPECFILE GENERATE_PLIST
9770: GHC GHOSTSCRIPT_REQD
9771: GITHUB_PROJECT GITHUB_RELEASE
9772: GITHUB_SUBMODULES GITHUB_TAG
9773: GITHUB_TYPE GITLAB_PROJECT
9774: GITLAB_RELEASE GITLAB_SUBMODULES
9775: GITLAB_TAG GITLAB_TYPE
9776: GNU GNU_CONFIGURE
9777: GNU_CONFIGURE_INFODIR GNU_CONFIGURE_MANDIR
9778: GNU_CONFIGURE_QUIET GNU_CONFIGURE_STRICT
9779: GODEP_REDIRECTS GO_BUILD_PATTERN
9780: GO_DEPS GO_DIST_BASE
9781: GO_EXTRA_MOD_DIRS GO_MODULE_FILES
9782: GO_SRCPATH GROUP_SPECIFIC_PKGS
9783: GRUB_NETWORK_CARDS GRUB_PRESET_COMMAND
9784: GRUB_SCAN_ARGS GZIP
9785: HASKELL_ENABLE_DYNAMIC_EXECUTABLE HASKELL_ENABLE_HADDOCK_DOCUMENTATION
9786: HASKELL_ENABLE_LIBRARY_PROFILING HASKELL_ENABLE_SHARED_LIBRARY
9787: HASKELL_OPTIMIZATION_LEVEL HASKELL_PKG_NAME
9788: HASKELL_UNRESTRICT_DEPENDENCIES HAS_CONFIGURE
9789: HEADER_TEMPLATES HOMEPAGE
9790: HOST_PKGTOOLS_ARGS HOST_SPECIFIC_PKGS
9791: HOWL_GROUP HOWL_USER
9792: ICCBASE ICECAST_CHROOTDIR
9793: ICON_THEMES IDOBASE
9794: IGNORE_CCACHE IGNORE_INFO_DIRS
9795: IGNORE_INTERACTIVE_FETCH IMAKE
9796: IMAKEOPTS IMAKE_MAKE
9797: IMAKE_MANINSTALL IMAP_UW_CCLIENT_MBOX_FMT
9798: IMDICTDIR INCOMPAT_CURSES
9799: INFO_DIR INFO_FILES
9800: INFO_FILES_VERBOSE INFO_MSG
9801: INIT_SYSTEM INN_DATA_DIR
9802: INN_GROUP INN_USER
9803: INSTALLATION_DIRS INSTALLATION_DIRS_FROM_PLIST
9804: INSTALL_ENV INSTALL_SH_OVERRIDE
9805: INSTALL_SRC INSTALL_TEMPLATES
9806: INSTALL_UNSTRIPPED IRCD_HYBRID_IRC_GROUP
9807: IRCD_HYBRID_IRC_USER IRCD_HYBRID_MAXCONN
9808: IRCD_HYBRID_NICLEN IRCD_HYBRID_SYSLOG_EVENTS
9809: IRCD_HYBRID_SYSLOG_FACILITY IRCD_HYBRID_TOPICLEN
9810: IRIX IRRD_USE_PGP
9811: JABBERD_GROUP JABBERD_LOGDIR
9812: JABBERD_PIDDIR JABBERD_SPOOLDIR
9813: JABBERD_USER JAVA_BINPREFIX
9814: JAVA_CLASSPATH JAVA_HOME
9815: JAVA_LD_LIBRARY_PATH JAVA_NAME
9816: JAVA_UNLIMIT JAVA_WRAPPERS
9817: JPEG_ACCEPTED JPEG_DEFAULT
9818: KERBEROS KERMIT_SUID_UUCP
9819: KJS_USE_PCRE KNEWS_DOMAIN_FILE
9820: KNEWS_DOMAIN_NAME KRB5_ACCEPTED
9821: KRB5_DEFAULT LANGUAGES
9822: LAPACKE_LIBS LAPACKE_PC
9823: LAPACK_LIBS LAPACK_PC
9824: LATEX2HTML_ICONPATH LDCONFIG_ADD_CMD
9825: LDCONFIG_REMOVE_CMD LDD
9826: LEAFNODE_DATA_DIR LEAFNODE_GROUP
9827: LEAFNODE_USER LIBDVDCSS_HOMEPAGE
9828: LIBDVDCSS_MASTER_SITES LIBRSVG_TYPE
9829: LIBTOOL LIBTOOLIZE_PLIST
9830: LIBTOOL_M4_OVERRIDE LIBUSB_TYPE
9831: LICENSE LINKER_RPATH_FLAG
9832: LINK_RPATH_FLAG LINUX_LOCALES
9833: LOCALBASE LOCALBASE_LOCKTYPE
9834: LOCALPATCHES LOVE_DATA
9835: LOVE_GAME LOVE_VERSION
9836: LP32PLATFORMS LP64PLATFORMS
9837: LUA_BUSTED_ARGS LUA_CDIR
9838: LUA_COMPILER LUA_DOCDIR
9839: LUA_EXAMPLESDIR LUA_INCDIR
9840: LUA_INTERPRETER LUA_LDIR
9841: LUA_LINKER_MAGIC LUA_PKGPREFIX
9842: LUA_SELF_CONFLICT LUA_USE_BUSTED
9843: LUA_VERSIONS_ACCEPTED LUA_VERSIONS_INCOMPATIBLE
9844: LUA_VERSION_DEFAULT LUA_VERSION_REQD
9845: Lua MACHINE_PLATFORM
9846: MAILAGENT_DOMAIN MAILAGENT_EMAIL
9847: MAILAGENT_FQDN MAILAGENT_ORGANIZATION
9848: MAJORDOMO_HOMEDIR MAKEINFO_ARGS
9849: MAKE_DIRS MAKE_DIRS_PERMS
9850: MAKE_ENV MAKE_FILE
9851: MAKE_FLAGS MAKE_JOBS
9852: MAKE_JOBS_SAFE MAKE_PROGRAM
9853: MANCOMPRESSED_IF_MANZ MANINSTALL
9854: MANZ MASTER_SITES
9855: MASTER_SITE_BACKUP MASTER_SITE_LOCAL
9856: MASTER_SITE_MOZILLA MASTER_SITE_OVERRIDE
9857: MASTER_SITE_PERL_CPAN MASTER_SORT
9858: MASTER_SORT_RANDOM MASTER_SORT_REGEX
9859: MECAB_CHARSET MEDIATOMB_GROUP
9860: MEDIATOMB_USER MIPSPROBASE
9861: MIREDO_GROUP MIREDO_USER
9862: MISSING_FEATURES MKDIR
9863: MKPIE_SUPPORTED MLDONKEY_GROUP
9864: MLDONKEY_HOME MLDONKEY_USER
9865: MONOTONE_GROUP MONOTONE_USER
9866: MOTIFBASE MOTIF_TYPE
9867: MOTIF_TYPE_DEFAULT MPI_TYPE
9868: MSGFMT_STRIP_MSGCTXT MSGFMT_STRIP_MSGID_PLURAL
9869: MTOOLS_ENABLE_FLOPPYD MV
9870: MYSQL_CHARSET MYSQL_DATADIR
9871: MYSQL_EXTRA_CHARSET MYSQL_GROUP
9872: MYSQL_USER MYSQL_VERSION
9873: MYSQL_VERSIONS_ACCEPTED MYSQL_VERSIONS_ALL
9874: MYSQL_VERSION_DEFAULT NAGIOSCMD_GROUP
9875: NAGIOSDIR NAGIOS_GROUP
9876: NAGIOS_USER NATIVE_APPEND_ABI
9877: NATIVE_APPEND_ELF NATIVE_EXEC_FMT
9878: NATIVE_MACHINE_PLATFORM NATIVE_OBJECT_FMT
9879: NBPAX_PROGRAM_PREFIX NETBSD_LOGIN_NAME
9880: NMH_EDITOR NMH_MTA
9881: NMH_PAGER NODE_VERSIONS_ACCEPTED
9882: NODE_VERSIONS_INCOMPATIBLE NODE_VERSION_DEFAULT
9883: NODE_VERSION_REQD NOLOGIN
9884: NOTE NOT_FOR_PLATFORM
9885: NOT_PAX_ASLR_SAFE NOT_PAX_MPROTECT_SAFE
9886: NO_BUILD NO_CHECKSUM
9887: NO_CONFIGURE NO_SKIP
9888: NS_PREFERRED NULLMAILER_GROUP
9889: NULLMAILER_USER OASIS
9890: OASIS_BUILD_ARGS OBJHOSTNAME
9891: OBJMACHINE OCAML_FINDLIB_DIRS
9892: OCAML_FINDLIB_REGISTER OCAML_FINDLIB_REGISTER_VERBOSE
9893: OCAML_SITELIBDIR OCAML_TOPKG_DOCDIR
9894: OCAML_USE_DUNE OCAML_USE_FINDLIB
9895: OCAML_USE_OASIS OCAML_USE_OASIS_DYNRUN
9896: OCAML_USE_OPAM OCAML_USE_TOPKG
9897: OMF ONLY_FOR_COMPILER
9898: ONLY_FOR_PLATFORM OPENSSH_CHROOT
9899: OPENSSH_GROUP OPENSSH_USER
9900: OPSYS OPSYS_EMULDIR
9901: OPSYS_VERSION OS
9902: OSS_TYPE OSX
9903: OSX_TOLERATE_SDK_SKEW OS_VARIANT
9904: OS_VERSION OTF_FONTS_DIR
9905: OVERRIDE_DIRDEPTH OVERRIDE_GEMSPEC
9906: OVERRIDE_GNU_CONFIG_SCRIPTS OWN_DIRS
9907: OWN_DIRS_PERMS P4GROUP
9908: P4PORT P4ROOT
9909: P4USER PACKAGES
9910: PALMOS_DEFAULT_SDK PAMBASE
9911: PAM_DEFAULT PAPERSIZE
9912: PASSIVE_FETCH PATCHDIR
9913: PATCHFILES PATCH_ARGS
9914: PATCH_DEBUG PATCH_DIST_ARGS
9915: PATCH_DIST_CAT PATCH_DIST_STRIP
9916: PATCH_FUZZ_FACTOR PATCH_STRIP
9917: PATH PCCBASE
9918: PEAR_CMD PEAR_LIB
9919: PEAR_PACKAGE_XML PERL5
9920: PERL5_CONFIGURE PERL5_CONFIGURE_DIRS
9921: PERL5_LDFLAGS PERL5_LICENSE
9922: PERL5_MODULE_TYPE PERL5_PACKLIST
9923: PERL5_PACKLIST_DIR PERL5_PERLBASE
9924: PERL5_SITEBASE PERL5_USE_PACKLIST
9925: PERL5_VENDORBASE PFCTL
9926: PFVAR_H PF_VERSION
9927: PGGROUP PGHOME
9928: PGPKGSRCDIR PGSQL_TYPE
9929: PGSQL_VERSION PGSQL_VERSIONS_ACCEPTED
9930: PGSQL_VERSION_DEFAULT PGUSER
9931: PG_LIB_EXT PHP
9932: PHPCOMMON_MK PHPPKGSRCDIR
9933: PHP_BASE_VERS PHP_CHECK_INSTALLED
9934: PHP_EXTENSION_DIR PHP_INITIAL_TEENY
9935: PHP_PKG_PREFIX PHP_VERSION
9936: PHP_VERSIONS_ACCEPTED PHP_VERSIONS_INCOMPATIBLE
9937: PHP_VERSION_DEFAULT PHP_VERSION_REQD
9938: PILRC_USE_GTK PKGCONFIG_BASE
9939: PKGCONFIG_FILE PKGCONFIG_OVERRIDE
9940: PKGCONFIG_OVERRIDE_STAGE PKGDIR
9941: PKGGNUDIR PKGINFODIR
9942: PKGLOCALEDIR PKGMANDIR
9943: PKGNAME PKGNAME_REQD
9944: PKGPATH PKGREVISION
9945: PKGSRC_BLAS_TYPES PKGSRC_CHANGES
9946: PKGSRC_COMPILER PKGSRC_KEEP_BIN_PKGS
9947: PKGSRC_LOCKTYPE PKGSRC_MAKE_ENV
9948: PKGSRC_MESSAGE_RECIPIENTS PKGSRC_MKPIE
9949: PKGSRC_MKREPRO PKGSRC_OVERRIDE_MKPIE
9950: PKGSRC_RUN_TEST PKGSRC_SETENV
9951: PKGSRC_SLEEPSECS PKGSRC_TODO
9952: PKGSRC_USE_CTF PKGSRC_USE_FORTIFY
9953: PKGSRC_USE_MKTOOLS PKGSRC_USE_RELRO
9954: PKGSRC_USE_SSP PKGSRC_USE_STACK_CHECK
9955: PKGTASKS_DATAFILE PKGTOOLS_ARGS
9956: PKGTOOLS_ENV PKG_ALTERNATIVES
9957: PKG_APACHE PKG_APACHE_ACCEPTED
9958: PKG_APACHE_DEFAULT PKG_BEST_EXISTS
9959: PKG_BUILD_OPTIONS PKG_COMPRESSION
9960: PKG_CONFIG PKG_CONFIG_PERMS
9961: PKG_CREATE_USERGROUP PKG_DB_TMPDIR
9962: PKG_DEBUG_LEVEL PKG_DEFAULT_OPTIONS
9963: PKG_DESTDIR_SUPPORT PKG_DEVELOPER
9964: PKG_DISABLED_OPTIONS PKG_FATAL_ERRORS
9965: PKG_FC PKG_FILELIST_CMD
9966: PKG_GECOS PKG_GID
9967: PKG_GROUPS PKG_GROUPS_VARS
9968: PKG_HOME PKG_INIT_SCRIPTS
9969: PKG_JAVA_HOME PKG_JVM
9970: PKG_JVMS_ACCEPTED PKG_JVM_DEFAULT
9971: PKG_LEGACY_OPTIONS PKG_LIBTOOL
9972: PKG_MKSYMLINKS PKG_OPTIONS
9973: PKG_OPTIONS_DEPRECATED_WARNINGS PKG_OPTIONS_LEGACY_OPTS
9974: PKG_OPTIONS_LEGACY_VARS PKG_OPTIONS_NONEMPTY_SETS
9975: PKG_OPTIONS_OPTIONAL_GROUPS PKG_OPTIONS_REQUIRED_GROUPS
9976: PKG_OPTIONS_VAR PKG_PHP
9977: PKG_PHP_MAJOR_VERS PKG_PHP_VERSION
9978: PKG_RCD_SCRIPTS PKG_REFCOUNT_DBDIR
9979: PKG_REGISTER_SHELLS PKG_RESUME_TRANSFERS
9980: PKG_SHELL PKG_SUGGESTED_OPTIONS
9981: PKG_SUPPORTED_OPTIONS PKG_SYSCONFBASE
9982: PKG_SYSCONFBASEDIR PKG_SYSCONFDIR
9983: PKG_SYSCONFDIR_PERMS PKG_SYSCONFSUBDIR
9984: PKG_SYSCONFVAR PKG_TOOLS_BIN
9985: PKG_UID PKG_UPDATE_FONTS_DB
9986: PKG_USERS PKG_USERS_VARS
9987: PKG_VERBOSE PLEASE
9988: PLIST PLIST_AWK
9989: PLIST_AWK_ENV PLIST_SRC
9990: PLIST_SUBST PLIST_TYPE
9991: PLIST_VARS POPTOP_USE_MPPE
9992: POSSIBLE_GFORTRAN_VERSION POST_FETCH_HOOK
9993: PREFER PREFER_NATIVE
9994: PREFER_NATIVE_PTHREADS PREFER_PKGSRC
9995: PREFIX PREPEND_PATH
9996: PRE_ROOT_CMD PRIVILEGED_STAGES
9997: PS PTHREAD_AUTO_VARS
9998: PTHREAD_CFLAGS PTHREAD_LDFLAGS
9999: PTHREAD_LIBS PTHREAD_OPTS
10000: PTHREAD_TYPE PVM_SSH
10001: PYPKGPREFIX PYTHON_FOR_BUILD_ONLY
10002: PYTHON_SELF_CONFLICT PYTHON_VERSIONED_DEPENDENCIES
10003: PYTHON_VERSIONS_ACCEPTED PYTHON_VERSIONS_INCOMPATIBLE
10004: PYTHON_VERSION_DEFAULT PYTHON_VERSION_REQD
10005: PYVERSSUFFIX QMAILDIR
10006: QMAIL_ALIAS_USER QMAIL_DAEMON_USER
10007: QMAIL_LOG_USER QMAIL_NOFILES_GROUP
10008: QMAIL_PASSWD_USER QMAIL_QMAIL_GROUP
10009: QMAIL_QUEUE_DIR QMAIL_QUEUE_EXTRA
10010: QMAIL_QUEUE_USER QMAIL_REMOTE_USER
10011: QMAIL_ROOT_USER QMAIL_SEND_USER
10012: QORE_LATEST_MODULE_API QORE_MODULE_API
10013: QORE_MODULE_DIR QORE_USER_MODULE_DIR
10014: QORE_VERSION QPOPPER_FAC
10015: QPOPPER_SPOOL_DIR QPOPPER_USER
10016: RAKE_NAME RASMOL_DEPTH
10017: RCD_SCRIPTS RCD_SCRIPTS_DIR
10018: RCD_SCRIPTS_EXAMPLEDIR RCD_SCRIPTS_MODE
10019: RCD_SCRIPTS_SHELL RCD_SCRIPT_SRC
10020: RDOC READLINE_DEFAULT
10021: READLINE_TYPE REAL_ROOT_GROUP
10022: REAL_ROOT_USER RECURSIVE_MAKE
10023: RELAY_CTRL_DIR RELRO_SUPPORTED
10024: REPLACE_AWK REPLACE_BASH
10025: REPLACE_CSH REPLACE_KSH
10026: REPLACE_LUA REPLACE_NODEJS
10027: REPLACE_OCTAVE REPLACE_PERL
10028: REPLACE_PERL6 REPLACE_PHP
10029: REPLACE_PYTHON REPLACE_QORE
10030: REPLACE_R REPLACE_RUBY
10031: REPLACE_RUBY_DIRS REPLACE_RUBY_PAT
10032: REPLACE_SH REPLACE_TEXLUA
10033: REPLACE_WISH REQD_DIRS
10034: REQD_DIRS_PERMS REQD_FILES
10035: REQD_FILES_MODE REQD_FILES_PERMS
10036: RESOLV_AUTO_VARS RESOLV_LDFLAGS
10037: RESOLV_LIBS RM
10038: ROOT_CMD ROOT_GROUP
10039: ROOT_USER RPCGEN
10040: RPM RPM2PKG_PLIST
10041: RPM2PKG_PREFIX RPM2PKG_STAGE
10042: RPM2PKG_STRIP RPM2PKG_SUBPREFIX
10043: RPMFILES RPMIGNOREPATH
10044: RPM_DB_PREFIX RSSH_CVS_PATH
10045: RSSH_RDIST_PATH RSSH_RSYNC_PATH
10046: RSSH_SCP_PATH RSSH_SFTP_SERVER_PATH
10047: RUBY RUBYGEM
1.231 ! jnemeth 10048: RUBYGEM_MANPAGES RUBYGEM_NAME
! 10049: RUBYGEM_OPTIONS RUBYGEM_USE_MANPAGES
1.229 gutterid 10050: RUBYGEM_VERBOSE RUBY_ABI_VERSION
10051: RUBY_ARCH RUBY_ARCHINC
10052: RUBY_ARCHLIB RUBY_BASE
10053: RUBY_BASERIDIR RUBY_BUILD_DOCUMENT
10054: RUBY_DLEXT RUBY_DOC
10055: RUBY_DYNAMIC_DIRS RUBY_EG
10056: RUBY_ENCODING_ARG RUBY_EXTCONF
10057: RUBY_EXTCONF_CHECK RUBY_EXTCONF_DEBUG
10058: RUBY_EXTCONF_MAKEFILE RUBY_GEM_ARCH
10059: RUBY_GEM_BASE RUBY_INC
10060: RUBY_LIB RUBY_LIB_BASE
10061: RUBY_NAME RUBY_NOVERSION
10062: RUBY_PKGPREFIX RUBY_RAILS
10063: RUBY_RAILS52_VERSION RUBY_RAILS60_VERSION
10064: RUBY_RAILS61_VERSION RUBY_RAILS70_VERSION
10065: RUBY_RAILS_ACCEPTED RUBY_RAILS_DEFAULT
10066: RUBY_RAILS_REQD RUBY_RAILS_STRICT_DEP
10067: RUBY_RIDIR RUBY_SETUP
10068: RUBY_SHLIB RUBY_SHLIBALIAS
10069: RUBY_SHLIBVER RUBY_SIMPLE_INSTALL
10070: RUBY_SITEARCHLIB RUBY_SITELIB
10071: RUBY_SITELIB_BASE RUBY_SITERIDIR
10072: RUBY_SLEXT RUBY_SRCDIR
10073: RUBY_STATICLIB RUBY_SUFFIX
10074: RUBY_SYSRIDIR RUBY_USE_PTHREAD
10075: RUBY_VENDORARCHLIB RUBY_VENDORLIB
10076: RUBY_VENDORLIB_BASE RUBY_VER
10077: RUBY_VERSION RUBY_VERSIONS_ACCEPTED
10078: RUBY_VERSIONS_INCOMPATIBLE RUBY_VERSION_DEFAULT
10079: RUBY_VERSION_REQD RUBY_VER_DIR
10080: RUN RUN_LDCONFIG
10081: RUST_TYPE SCO
10082: SCREWS_GROUP SCREWS_USER
10083: SCRIPTS_ENV SCROLLKEEPER_DATADIR
10084: SCROLLKEEPER_REBUILDDB SCROLLKEEPER_UPDATEDB
10085: SDIST_PAWD SDL12_TYPE
10086: SERIAL_DEVICES SETGIDGAME
10087: SETGID_GAMES_PERMS SETUID_ROOT_PERMS
10088: SH SHLIB
10089: SIGN_PACKAGES SILC_CLIENT_WITH_PERL
10090: SITE_SPECIFIC_PKGS SKIP_DEPENDS
10091: SMF_INSTANCES SMF_MANIFEST
10092: SMF_METHODS SMF_METHOD_SHELL
10093: SMF_METHOD_SRC SMF_NAME
10094: SMF_PREFIX SMF_SRCDIR
10095: SNIPROXY_GROUP SNIPROXY_USER
10096: SOURCE_BUFFSIZE SPECIAL_PERMS
10097: SPECIFIC_PKGS SSH_SUID
10098: SSP_SUPPORTED SSYNC_PAWD
10099: STEP_MSG STRIP
10100: STRIP_DBG STRIP_DEBUG
10101: STRIP_DEBUG_SUPPORTED STRIP_FILES_SKIP
10102: SU SUBDIR
10103: SUBST SUBST_CLASSES
10104: SUBST_FILES SUBST_FILTER_CMD
10105: SUBST_MESSAGE SUBST_NOOP_OK
10106: SUBST_SED SUBST_SHOW_DIFF
10107: SUBST_SKIP_TEXT_CHECK SUBST_STAGE
10108: SUBST_VARS SUNWSPROBASE
10109: SUSE_PREFER SU_CMD
10110: SYSCONFBASE TARGET_ARCH
10111: TBL TERMCAP_TYPE
10112: TERMINFO_DEFAULT TERMINFO_TYPE
10113: TEST TEST_DEPENDS
10114: TEST_DIRS TEST_ENV
10115: TEST_ENV_SHELL TEST_MAKE_CMD
10116: TEST_MAKE_FLAGS TEST_TARGET
10117: TEXLIVE_IGNORE_PATTERNS TEXLIVE_REV
10118: TEXLIVE_UNVERSIONED TEXMFSITE
10119: TEX_FORMATS TEX_HYPHEN_DAT
10120: TEX_HYPHEN_DEF TEX_TEXMF_DIRS
10121: THTTPD_LOG_FACILITY TINYDYN_USER
10122: TLSWRAPPER_CHROOT TO
10123: TOOLS_ALIASES TOOLS_ALWAYS_WRAP
10124: TOOLS_ARGS TOOLS_BROKEN
10125: TOOLS_CMD TOOLS_CMDLINE_SED
10126: TOOLS_CREATE TOOLS_CROSS_DESTDIR
10127: TOOLS_DIR TOOLS_FAIL
10128: TOOLS_GNU_MISSING TOOLS_LDCONFIG
10129: TOOLS_NOOP TOOLS_PATH
10130: TOOLS_SCRIPT TOOLS_USE_CROSS_COMPILE
10131: TOOL_DEPENDS TTF_FONTS_DIR
10132: TYPE UAC_REQD_EXECS
10133: UCSPI_SSL_GROUP UCSPI_SSL_USER
10134: UNLIMIT_RESOURCES UNPRIVILEGED
10135: UNPRIVILEGED_GROUP UNPRIVILEGED_GROUPS
10136: UNPRIVILEGED_USER UNWRAP_FILES
10137: UNWRAP_PATTERNS UPDATE_GEMSPEC
10138: UPDATE_TARGET URI
10139: USERGROUP_PHASE USERPPP_GROUP
10140: USER_SPECIFIC_PKGS USE_ABI_DEPENDS
10141: USE_APR USE_BSD_MAKEFILE
10142: USE_BUILTIN USE_CROSS_COMPILE
10143: USE_CURSES USE_CWRAPPERS
10144: USE_DB185 USE_FEATURES
10145: USE_GAMESGROUP USE_GCC_RUNTIME
10146: USE_IMAKE USE_JAVA
10147: USE_JAVA2 USE_LANGUAGES
10148: USE_LIBTOOL USE_NATIVE_GCC
10149: USE_NETBSD_REPO USE_PKGSRC_GCC
10150: USE_PKGSRC_GCC_RUNTIME USE_PKGTASKS
10151: USE_PKG_ADMIN_DIGEST USE_RUBY_EXTCONF
10152: USE_RUBY_INSTALL USE_RUBY_SETUP
10153: USE_RUBY_SETUP_PKG USE_TOOLS
10154: UUCP_GROUP UUCP_USER
10155: VARBASE VARNAME
10156: VIM_EXTRA_OPTS WARNING_MSG
10157: WCALC_CGIDIR WCALC_CGIPATH
10158: WCALC_HTMLDIR WCALC_HTMLPATH
10159: WDM_MANAGERS WRAPPER_CC
10160: WRAPPER_REORDER_CMDS WRKDIR
10161: WRKDIR_BASENAME WRKDIR_LOCKTYPE
10162: WRKLOG WRKOBJDIR
10163: WRKSRC X10_PORT
10164: X11 X11BASE
10165: X11_PKGSRCDIR X11_TYPE
10166: X509_CERTIFICATE X509_KEY
10167: XAW_TYPE XLOCK_DEFAULT_MODE
10168: XMKMF XMKMF_FLAGS
10169: XXX YES
10170: ZSH_STATIC __stdc__
10171: _vargroups accept
10172: acquire-localbase-lock acquire-lock
10173: add added
10174: administrator alloca
10175: alternatives aslr
10176: asprintf atlas
10177: autoconf automake
10178: autoreconf awk
10179: bash big-endian
10180: bin-install bind
10181: binpkg-list blas
10182: bootstrap-depends broken
10183: broken_on_platform bsd
10184: bsd.prog.mk build
10185: build-env buildlink-directories
10186: buildlink-oss-soundcard-h c
10187: c++ ccache
10188: cce cdefs
10189: ceil changes
10190: changes-entry changes-entry-noupdate
10191: check check-clean
10192: check-files check-files-clean
10193: check-vulnerable checksum
10194: checksum-phase clean
10195: clean-depends cleandir
10196: commit commit-changes-entry
10197: compact compiler
10198: conf config.guess
10199: config.sub configuration
10200: configure configure-env
10201: configure-help configure_args
10202: connect cos
10203: cputime create-usergroup
10204: csh ctf
10205: debug declaration
10206: declare defined
10207: depend dependencies
10208: depends depends-checksum
10209: depends-fetch deps
10210: describe destdir
10211: disable distclean
10212: distinfo dl
10213: dlopen do-buildlink
10214: do-clean do-configure
10215: do-configure-post-hook do-extract
10216: do-fetch do-install
10217: emul emul-distinfo
10218: emul-fetch emulation
10219: emulator enable
10220: endian enomem
10221: ensurepip err
10222: errx etc
10223: exp extract-rpm
10224: fabs feature
10225: features fetch
10226: fetch-list follows
10227: forbids form
10228: format fortify
10229: fortify_source friend
10230: fts fts_close
10231: fts_open fts_read
10232: fts_set gcc
10233: gethostbyaddr gethostbyname
10234: gethostbyname2 getopt_long
10235: getprogname getservbyname
10236: getservbyport getservent
10237: gettext github
10238: gitlab glob
10239: gnu gnu_configure_strict
10240: go go-deps
10241: golang guess-license
10242: hashbang heimdal
10243: help imake
10244: increment indirect
10245: inet_aton interp
10246: interpreter intl
10247: ip4 ip6
10248: ipv4 ipv6
10249: iso kerberos
10250: krb krb5
10251: ksh lapack
10252: latex libintl_bindtextdomain
10253: libintl_gettext libintl_textdomain
10254: libnbcompat libs
10255: libtool licence
10256: license lintl
10257: little-endian lock
10258: locking lua
10259: lvalue make
10260: makesum memory
10261: meta meta-package
10262: meta_package mit-krb5
10263: mk.conf mkl
10264: mount move
10265: moved mprotect
10266: mremap nb
10267: nbcompat netlib
10268: node node.js
10269: nodejs obstack
10270: obstack_ptr_grow occurs
10271: only openblas
10272: options options.mk
10273: order override
10274: override-intltool override-message-intltool
10275: package parallel
10276: path pax
10277: paxctl pbulk-index
10278: pc perl
10279: perl5 perms
10280: php pkg-build-options
10281: pkg-config pkg_build_options
10282: platform plist
10283: post-extract post-fetch
10284: post-wrapper pre-build-checks-hook
10285: pre-configure pre-configure-checks-hook
10286: pre-extract pre-fetch
10287: print-go-deps print-plist
10288: print-summary-data privileged-install-hook
10289: pypi python
10290: r readme-all
10291: recursive recv
10292: recvfrom regcomp
10293: release-localbase-lock release-lock
10294: relro remove
10295: removed rename
10296: renamed reorder
10297: replace replace_interpreter
10298: reproducible resolv
10299: root ruby
10300: send sendfile
10301: sendto setenv
10302: setgid setprogname
10303: setuid sh
10304: shebang show
10305: show-all show-build-defs
10306: show-depends show-depends-dirs
10307: show-depends-pkgpaths show-depends-recursive
10308: show-deps show-distfiles
10309: show-downlevel show-subdir-var
10310: show-tools show-var
10311: show-vars snprintf
10312: socket ssp
10313: st_mode stage-install
10314: strcasestr strict
10315: strip strndup
10316: strnlen strsep
10317: subst substitutions
10318: sun sunpro
10319: sunwspro symlink
10320: test test-env
10321: tex texlive
10322: tmp todo
10323: tool tools
10324: tools-libtool-m4-override transitive
10325: type ulimit
10326: undefined undo-replace
10327: unlimit unprivileged
10328: unprivileged-install-hook unstripped
10329: update updated
10330: upload upload-distfiles
10331: use_tools user
10332: utimes vasprintf
10333: verbose vsnprintf
10334: warn warning
10335: warnings warnx
10336: wattr_off wattr_on
10337: work wrapper
10338: wrkdir
1.154 rillig 10339:
1.207 leot 10340: Appendix F. Editing guidelines for the pkgsrc guide
1.1 dsieger 10341:
10342: Table of Contents
10343:
1.207 leot 10344: F.1. Make targets
10345: F.2. Procedure
1.1 dsieger 10346:
10347: This section contains information on editing the pkgsrc guide itself.
10348:
1.207 leot 10349: F.1. Make targets
1.1 dsieger 10350:
10351: The pkgsrc guide's source code is stored in pkgsrc/doc/guide/files, and several
10352: files are created from it:
10353:
10354: * pkgsrc/doc/pkgsrc.txt
10355:
10356: * pkgsrc/doc/pkgsrc.html
10357:
1.174 leot 10358: * https://www.NetBSD.org/docs/pkgsrc/
1.1 dsieger 10359:
1.174 leot 10360: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.pdf: The PDF version of the
10361: pkgsrc guide.
1.1 dsieger 10362:
1.174 leot 10363: * https://www.NetBSD.org/docs/pkgsrc/pkgsrc.ps: PostScript version of the
1.2 rillig 10364: pkgsrc guide.
1.1 dsieger 10365:
1.207 leot 10366: F.2. Procedure
1.1 dsieger 10367:
10368: The procedure to edit the pkgsrc guide is:
10369:
1.190 bacon 10370: 1. Make sure you have checked out the htdocs repository into a sibling
10371: directory of your pkgsrc directory. You will need the ability to commit
10372: from both pkgsrc and htdocs.
10373:
10374: 2. Make sure you have the packages needed to regenerate the pkgsrc guide (and
1.46 obache 10375: other XML-based NetBSD documentation) installed. These are automatically
10376: installed when you install the meta-pkgs/pkgsrc-guide-tools package.
1.1 dsieger 10377:
1.190 bacon 10378: 3. Run cd doc/guide to get to the right directory. All further steps will take
1.1 dsieger 10379: place here.
10380:
1.190 bacon 10381: 4. Edit the XML file(s) in files/.
1.1 dsieger 10382:
1.190 bacon 10383: 5. Run bmake to check the pkgsrc guide for valid XML and to build the final
1.1 dsieger 10384: output files. If you get any errors at this stage, you can just edit the
10385: files, as there are only symbolic links in the working directory, pointing
10386: to the files in files/.
10387:
1.190 bacon 10388: 6. (cd files && cvs commit)
1.1 dsieger 10389:
1.190 bacon 10390: 7. Run bmake clean && bmake to regenerate the output files with the proper RCS
1.1 dsieger 10391: Ids.
10392:
1.190 bacon 10393: 8. Run bmake regen to install and commit the files in both pkgsrc/doc and
1.1 dsieger 10394: htdocs.
10395:
10396: Note
10397:
10398: If you have added, removed or renamed some chapters, you need to
10399: synchronize them using cvs add or cvs delete in the htdocs directory.
10400:
CVSweb <webmaster@jp.NetBSD.org>