FreeBSD Porter's Handbook

The FreeBSD Documentation Project

Revision: 51265
Copyright
Legal Notice
Last modified on 2017-12-08 07:27:10 by gordon.

Table of Contents
1. Introduction
2. Making a New Port
3. Quick Porting
3.1. Writing the Makefile
3.2. Writing the Description Files
3.3. Creating the Checksum File
3.4. Testing the Port
3.5. Checking the Port with portlint
3.6. Submitting the New Port
4. Slow Porting
4.1. How Things Work
4.2. Getting the Original Sources
4.3. Modifying the Port
4.4. Patching
4.5. Configuring
4.6. Handling User Input
5. Configuring the Makefile
5.1. The Original Source
5.2. Naming
5.3. Categorization
5.4. The Distribution Files
5.5. MAINTAINER
5.6. COMMENT
5.7. Licenses
5.8. PORTSCOUT
5.9. Dependencies
5.10. Slave Ports and MASTERDIR
5.11. Man Pages
5.12. Info Files
5.13. Makefile Options
5.14. Specifying the Working Directory
5.15. Conflict Handling
5.16. Installing Files
6. Special Considerations
6.1. Staging
6.2. Bundled Libraries
6.3. Shared Libraries
6.4. Ports with Distribution Restrictions or Legal Concerns
6.5. Building Mechanisms
6.6. Using GNU Autotools
6.7. Using GNU gettext
6.8. Using Perl
6.9. Using X11
6.10. Using GNOME
6.11. GNOME Components
6.12. Using Qt
6.13. Using KDE
6.14. Using LXQt
6.15. Using Java
6.16. Web Applications, Apache and PHP
6.17. Using Python
6.18. Using Tcl/Tk
6.19. Using Ruby
6.20. Using SDL
6.21. Using wxWidgets
6.22. Using Lua
6.23. Using iconv
6.24. Using Xfce
6.25. Using Mozilla
6.26. Using Databases
6.27. Starting and Stopping Services (rc Scripts)
6.28. Adding Users and Groups
6.29. Ports That Rely on Kernel Sources
6.30. Go Libraries
7. Flavors
7.1. An Introduction to Flavors
7.2. Using FLAVORS
7.3. Flavors Auto-Activation
8. Advanced pkg-plist Practices
8.1. Changing pkg-plist Based on Make Variables
8.2. Empty Directories
8.3. Configuration Files
8.4. Dynamic Versus Static Package List
8.5. Automated Package List Creation
8.6. Expanding Package List with Keywords
9. pkg-*
9.1. pkg-message
9.2. pkg-install
9.3. pkg-deinstall
9.4. Changing the Names of pkg-*
9.5. Making Use of SUB_FILES and SUB_LIST
10. Testing the Port
10.1. Running make describe
10.2. Portlint
10.3. Port Tools
10.4. PREFIX and DESTDIR
10.5. Poudriere
10.6. Tinderbox
11. Upgrading a Port
11.1. Using Subversion to Make Patches
11.2. UPDATING and MOVED
12. Security
12.1. Why Security is So Important
12.2. Fixing Security Vulnerabilities
12.3. Keeping the Community Informed
13. Dos and Don'ts
13.1. Introduction
13.2. WRKDIR
13.3. WRKDIRPREFIX
13.4. Differentiating Operating Systems and OS Versions
13.5. Writing Something After bsd.port.mk
13.6. Use the exec Statement in Wrapper Scripts
13.7. Do Things Rationally
13.8. Respect Both CC and CXX
13.9. Respect CFLAGS
13.10. Verbose Build Logs
13.11. Feedback
13.12. README.html
13.13. Marking a Port as Architecture Neutral
13.14. Marking a Port Not Installable with BROKEN, FORBIDDEN, or IGNORE
13.15. Marking a Port for Removal with DEPRECATED or EXPIRATION_DATE
13.16. Avoid Use of the .error Construct
13.17. Usage of sysctl
13.18. Rerolling Distfiles
13.19. Use POSIX Standards
13.20. Miscellanea
14. A Sample Makefile
15. Order of Variables in Port Makefiles
15.1. PORTNAME Block
15.2. PATCHFILES Block
15.3. MAINTAINER Block
15.4. LICENSE Block
15.5. Generic BROKEN/IGNORE/DEPRECATED Messages
15.6. The Dependencies Block
15.7. Flavors
15.8. USES and USE_x
15.9. Standard bsd.port.mk Variables
15.10. Options and Helpers
15.11. The Rest of the Variables
15.12. The Targets
16. Keeping Up
16.1. FreshPorts
16.2. The Web Interface to the Source Repository
16.3. The FreeBSD Ports Mailing List
16.4. The FreeBSD Port Building Cluster
16.5. Portscout: the FreeBSD Ports Distfile Scanner
16.6. The FreeBSD Ports Monitoring System
17. Using USES Macros
17.1. An Introduction to USES
17.2. 7z
17.3. ada
17.4. autoreconf
17.5. blaslapack
17.6. bdb
17.7. bison
17.8. charsetfix
17.9. cmake
17.10. compiler
17.11. cpe
17.12. cran
17.13. desktop-file-utils
17.14. desthack
17.15. display
17.16. dos2unix
17.17. drupal
17.18. fakeroot
17.19. fam
17.20. firebird
17.21. fonts
17.22. fortran
17.23. fuse
17.24. gecko
17.25. gem
17.26. gettext
17.27. gettext-runtime
17.28. gettext-tools
17.29. ghostscript
17.30. gmake
17.31. gnome
17.32. go
17.33. gperf
17.34. grantlee
17.35. groff
17.36. gssapi
17.37. horde
17.38. iconv
17.39. imake
17.40. kde
17.41. kmod
17.42. lha
17.43. libarchive
17.44. libedit
17.45. libtool
17.46. linux
17.47. localbase
17.48. lua
17.49. lxqt
17.50. makeinfo
17.51. makeself
17.52. mate
17.53. meson
17.54. metaport
17.55. mysql
17.56. mono
17.57. motif
17.58. ncurses
17.59. ninja
17.60. objc
17.61. openal
17.62. pathfix
17.63. pear
17.64. perl5
17.65. pgsql
17.66. php
17.67. pkgconfig
17.68. pure
17.69. pyqt
17.70. python
17.71. qmail
17.72. qmake
17.73. readline
17.74. samba
17.75. scons
17.76. shared-mime-info
17.77. shebangfix
17.78. sqlite
17.79. ssl
17.80. tar
17.81. tcl
17.82. terminfo
17.83. tk
17.84. uidfix
17.85. uniquefiles
17.86. varnish
17.87. webplugin
17.88. xfce
17.89. zip
17.90. zope
18. __FreeBSD_version Values
18.1. FreeBSD 12 Versions
18.2. FreeBSD 11 Versions
18.3. FreeBSD 10 Versions
18.4. FreeBSD 9 Versions
18.5. FreeBSD 8 Versions
18.6. FreeBSD 7 Versions
18.7. FreeBSD 6 Versions
18.8. FreeBSD 5 Versions
18.9. FreeBSD 4 Versions
18.10. FreeBSD 3 Versions
18.11. FreeBSD 2.2 Versions
18.12. FreeBSD 2 Before 2.2-RELEASE Versions
List of Tables
5.1. Examples of DISTVERSION and the Derived PORTVERSION
5.2. Package Naming Examples
5.3. Shortcuts for MASTER_SITE_* Macros
5.4. Magic MASTER_SITES Macros
5.5. USE_GITHUB Description
5.6. Predefined License List
5.7. USE_*
6.1. Variables for Ports That Use configure
6.2. Variables for Ports That Use cmake
6.3. Variables the Users Can Define for cmake Builds
6.4. Read-Only Variables for Ports That Use Perl
6.5. Variables for Ports That Use X
6.6. GNOME Components
6.7. GNOME Macro Components
6.8. GNOME Legacy Components
6.9. Deprecated Components: Do Not Use
6.10. Variables Provided to Ports That Use Qt
6.11. Available Qt Library Components
6.12. Available Qt Tool Components
6.13. Available Qt Plugin Components
6.14. Variables for Ports That Use qmake
6.15. Available KDE 4 Components
6.16. Available LXQt Components
6.17. Variables Which May be Set by Ports That Use Java
6.18. Variables Provided to Ports That Use Java
6.19. Constants Defined for Ports That Use Java
6.20. Variables for Ports That Use Apache
6.21. Useful Variables for Porting Apache Modules
6.22. Most Useful Variables for Ports That Use Python
6.23. Python Module Dependency Helpers
6.24. The Most Useful Read-Only Variables for Ports That Use Tcl/Tk
6.25. Useful Variables for Ports That Use Ruby
6.26. Selected Read-Only Variables for Ports That Use Ruby
6.27. Variables to Select wxWidgets Versions
6.28. Available wxWidgets Versions
6.29. wxWidgets Version Specifications
6.30. Variables to Select Preferred wxWidgets Versions
6.31. Available wxWidgets Components
6.32. Available wxWidgets Dependency Types
6.33. Default wxWidgets Dependency Types
6.34. Variables Defined for Ports That Use wxWidgets
6.35. Legal Values for WX_CONF_ARGS
6.36. Variables Defined for Ports That Use Lua
6.37. Variables for Ports That Use Mozilla
6.38. Variables for Ports Using Databases
11.1. Subversion Update File Prefixes
18.1. FreeBSD 12 __FreeBSD_version Values
18.2. FreeBSD 11 __FreeBSD_version Values
18.3. FreeBSD 10 __FreeBSD_version Values
18.4. FreeBSD 9 __FreeBSD_version Values
18.5. FreeBSD 8 __FreeBSD_version Values
18.6. FreeBSD 7 __FreeBSD_version Values
18.7. FreeBSD 6 __FreeBSD_version Values
18.8. FreeBSD 5 __FreeBSD_version Values
18.9. FreeBSD 4 __FreeBSD_version Values
18.10. FreeBSD 3 __FreeBSD_version Values
18.11. FreeBSD 2.2 __FreeBSD_version Values
18.12. FreeBSD 2 Before 2.2-RELEASE __FreeBSD_version Values
List of Examples
3.1. Creating a .diff for a New Port
3.2. Creating a .shar for a New Port
4.1. Applying a Patch for a Specific FreeBSD Version
4.2. Optionaly Applying a Patch
5.1. Using pkg-version(8) to Compare Versions.
5.2. Using DISTVERSION
5.3. Using DISTVERSION When the Version Starts with a Letter or a Prefix
5.4. Using DISTVERSION When the Version Contains Letters Meaning alpha, beta, or pre-release
5.5. Not Using DISTVERSION When the Version Contains Letters Meaning "Patch Level"
5.6. Deriving PORTVERSION Manually
5.7. Derive DISTNAME from PORTVERSION
5.8. Exotic Case 1
5.9. Exotic Case 2
5.10. Simple Use of USE_GITHUB
5.11. More Complete Use of USE_GITHUB
5.12. Use of USE_GITHUB with DISTVERSIONPREFIX
5.13. Using USE_GITHUB When Upstream Does Not Use Versions
5.14. Using USE_GITHUB to Access a Commit Between Two Versions
5.15. Use of USE_GITHUB with Multiple Distribution Files
5.16. Use of USE_GITHUB with Multiple Distribution Files Using GH_TUPLE
5.17. How to Use USE_GITHUB with Git Submodules?
5.18. Simplified Use of MASTER_SITES:n with One File Per Site
5.19. Simplified Use of MASTER_SITES:n with More Than One File Per Site
5.20. Detailed Use of MASTER_SITES:n in MASTER_SITE_SUBDIR
5.21. Detailed Use of MASTER_SITES:n with Comma Operator, Multiple Files, Multiple Sites and Multiple Subdirectories
5.22. Detailed Use of MASTER_SITES:n with SourceForge (SF)
5.23. Simplified Use of MASTER_SITES:n with PATCH_SITES
5.24. Simplest Usage, Predefined Licenses
5.25. Nonstandard License
5.26. Standard and Nonstandard Licenses
5.27. LICENSE_NAME
5.28. LICENSE_FILE
5.29. LICENSE_TEXT
5.30. LICENSE_DISTFILES
5.31. Dual Licenses
5.32. Multiple Licenses
5.33. Wrong Declaration of an Optional Dependency
5.34. Correct Declaration of an Optional Dependency
5.35. Simple Use of OPTIONS
5.36. Check for Unset Port OPTIONS
5.37. Practical Use of OPTIONS
5.38. Wrong Handling of an Option
5.39. Correct Handling of an Option
5.40. Simple Use of OPT_IMPLIES
5.41. Simple Use of OPT_PREVENTS
6.1. Inside ${PREFIX}, Create Relative Symbolic Links
6.2. Outside ${PREFIX}, Create Absolute Symbolic Links
6.3. USES= cmake Example
6.4. Perl Dependency Example
6.5. USE_XORG Example
6.6. Using X11-Related Variables
6.7. Selecting Qt 4 Components
6.8. USES= qmake Example
6.9. USE_KDE Example
6.10. USE_LXQT Example
6.11. Example Makefile for PEAR Class
6.12. Example Makefile for Horde Module
6.13. Makefile for a Simple Python Module
6.14. Selecting wxWidgets Components
6.15. Detecting Installed wxWidgets Versions and Components
6.16. Using wxWidgets Variables in Commands
6.17. Simple iconv Usage
6.18. iconv Usage with configure
6.19. Fixing Hardcoded -liconv
6.20. Checking for Native iconv Availability
6.21. USES=xfce Example
6.22. Using Xfce's Own GTK3 Widgets
7.1. Basic Flavors Usage
7.2. More Complex Flavors Usage
7.3. Flavor Specific PKGNAME
7.4. Simple USES=python
7.5. USES=python with Version Requirements
7.6. For a Port Not Using distutils
8.1. Using PLIST_SUB with Regular Expressions
8.2. Example of a @dirrmtryecho Keyword
8.3. Real Life Example, How @sample is Implemented
10.1. Using make.conf to Change Default Perl
13.1. How to Avoid Using .error
15.1. Options Variables Order Example
17.1. Using Multiple Values
17.2. Adding an Argument
17.3. Adding Multiple Arguments
17.4. Mixing it All Together
17.5. Typical Use
17.6. Adding Another Interpreter to USES=shebangfix
17.7. Specifying all the Paths When Adding an Interpreter to USES=shebangfix
17.8. Adding a Strange Location for an Interpreter
17.9. USES=shebangfix with SHEBANG_REGEX
17.10. USES=shebangfix with SHEBANG_GLOB
17.11. USES=shebangfix with SHEBANG_FILES

All FreeBSD documents are available for download at https://download.freebsd.org/ftp/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.