FreeBSD Porter's Handbook

The FreeBSD Documentation Project

Revision: 51129
Copyright
Legal Notice
Last modified on 2017-10-18 14:53:49 by mat.

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 Emacs
6.20. Using Ruby
6.21. Using SDL
6.22. Using wxWidgets
6.23. Using Lua
6.24. Using iconv
6.25. Using Xfce
6.26. Using Mozilla
6.27. Using Databases
6.28. Starting and Stopping Services (rc Scripts)
6.29. Adding Users and Groups
6.30. Ports That Rely on Kernel Sources
6.31. Go Libraries
7. Advanced pkg-plist Practices
7.1. Changing pkg-plist Based on Make Variables
7.2. Empty Directories
7.3. Configuration Files
7.4. Dynamic Versus Static Package List
7.5. Automated Package List Creation
7.6. Expanding Package List with Keywords
8. pkg-*
8.1. pkg-message
8.2. pkg-install
8.3. pkg-deinstall
8.4. Changing the Names of pkg-*
8.5. Making Use of SUB_FILES and SUB_LIST
9. Testing the Port
9.1. Running make describe
9.2. Portlint
9.3. Port Tools
9.4. PREFIX and DESTDIR
9.5. Poudriere
9.6. Tinderbox
10. Upgrading a Port
10.1. Using Subversion to Make Patches
10.2. UPDATING and MOVED
11. Security
11.1. Why Security is So Important
11.2. Fixing Security Vulnerabilities
11.3. Keeping the Community Informed
12. Dos and Don'ts
12.1. Introduction
12.2. WRKDIR
12.3. WRKDIRPREFIX
12.4. Differentiating Operating Systems and OS Versions
12.5. Writing Something After bsd.port.mk
12.6. Use the exec Statement in Wrapper Scripts
12.7. Do Things Rationally
12.8. Respect Both CC and CXX
12.9. Respect CFLAGS
12.10. Verbose Build Logs
12.11. Feedback
12.12. README.html
12.13. Marking a Port as Architecture Neutral
12.14. Marking a Port Not Installable with BROKEN, FORBIDDEN, or IGNORE
12.15. Marking a Port for Removal with DEPRECATED or EXPIRATION_DATE
12.16. Avoid Use of the .error Construct
12.17. Usage of sysctl
12.18. Rerolling Distfiles
12.19. Use POSIX Standards
12.20. Miscellanea
13. A Sample Makefile
14. Order of Variables in Port Makefiles
14.1. PORTNAME Block
14.2. PATCHFILES Block
14.3. MAINTAINER Block
14.4. LICENSE Block
14.5. Generic BROKEN/IGNORE/DEPRECATED Messages
14.6. The Dependencies Block
14.7. USES and USE_x
14.8. Standard bsd.port.mk Variables
14.9. Options and Helpers
14.10. The Rest of the Variables
14.11. The Targets
15. Keeping Up
15.1. FreshPorts
15.2. The Web Interface to the Source Repository
15.3. The FreeBSD Ports Mailing List
15.4. The FreeBSD Port Building Cluster
15.5. Portscout: the FreeBSD Ports Distfile Scanner
15.6. The FreeBSD Ports Monitoring System
16. Using USES Macros
16.1. An Introduction to USES
16.2. 7z
16.3. ada
16.4. autoreconf
16.5. blaslapack
16.6. bdb
16.7. bison
16.8. charsetfix
16.9. cmake
16.10. compiler
16.11. cpe
16.12. cran
16.13. desktop-file-utils
16.14. desthack
16.15. display
16.16. dos2unix
16.17. drupal
16.18. fakeroot
16.19. fam
16.20. firebird
16.21. fmake
16.22. fonts
16.23. fortran
16.24. fuse
16.25. gecko
16.26. gem
16.27. gettext
16.28. gettext-runtime
16.29. gettext-tools
16.30. ghostscript
16.31. gmake
16.32. gnome
16.33. go
16.34. gperf
16.35. grantlee
16.36. groff
16.37. gssapi
16.38. horde
16.39. iconv
16.40. imake
16.41. kde
16.42. kmod
16.43. lha
16.44. libarchive
16.45. libedit
16.46. libtool
16.47. linux
16.48. localbase
16.49. lua
16.50. lxqt
16.51. makeinfo
16.52. makeself
16.53. mate
16.54. meson
16.55. metaport
16.56. mysql
16.57. mono
16.58. motif
16.59. ncurses
16.60. ninja
16.61. objc
16.62. openal
16.63. pathfix
16.64. pear
16.65. perl5
16.66. pgsql
16.67. php
16.68. pkgconfig
16.69. pure
16.70. pyqt
16.71. python
16.72. qmail
16.73. qmake
16.74. readline
16.75. samba
16.76. scons
16.77. shared-mime-info
16.78. shebangfix
16.79. sqlite
16.80. ssl
16.81. tar
16.82. tcl
16.83. terminfo
16.84. tk
16.85. uidfix
16.86. uniquefiles
16.87. varnish
16.88. webplugin
16.89. xfce
16.90. zip
16.91. zope
17. __FreeBSD_version Values
17.1. FreeBSD 12 Versions
17.2. FreeBSD 11 Versions
17.3. FreeBSD 10 Versions
17.4. FreeBSD 9 Versions
17.5. FreeBSD 8 Versions
17.6. FreeBSD 7 Versions
17.7. FreeBSD 6 Versions
17.8. FreeBSD 5 Versions
17.9. FreeBSD 4 Versions
17.10. FreeBSD 3 Versions
17.11. FreeBSD 2.2 Versions
17.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. Variables for Ports That Use scons
6.5. Read-Only Variables for Ports That Use Perl
6.6. Variables for Ports That Use X
6.7. GNOME Components
6.8. GNOME Macro Components
6.9. GNOME Legacy Components
6.10. Deprecated Components: Do Not Use
6.11. Variables Provided to Ports That Use Qt
6.12. Available Qt Library Components
6.13. Available Qt Tool Components
6.14. Available Qt Plugin Components
6.15. Variables for Ports That Use qmake
6.16. Available KDE 4 Components
6.17. Available LXQt Components
6.18. Variables Which May be Set by Ports That Use Java
6.19. Variables Provided to Ports That Use Java
6.20. Constants Defined for Ports That Use Java
6.21. Variables for Ports That Use Apache
6.22. Useful Variables for Porting Apache Modules
6.23. Most Useful Variables for Ports That Use Python
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 to Select Unicode in wxWidgets Versions
6.35. Variables Defined for Ports That Use wxWidgets
6.36. Legal Values for WX_CONF_ARGS
6.37. Variables Defined for Ports That Use Lua
6.38. Variables for Ports That Use Mozilla
6.39. Variables for Ports Using Databases
10.1. Subversion Update File Prefixes
17.1. FreeBSD 12 __FreeBSD_version Values
17.2. FreeBSD 11 __FreeBSD_version Values
17.3. FreeBSD 10 __FreeBSD_version Values
17.4. FreeBSD 9 __FreeBSD_version Values
17.5. FreeBSD 8 __FreeBSD_version Values
17.6. FreeBSD 7 __FreeBSD_version Values
17.7. FreeBSD 6 __FreeBSD_version Values
17.8. FreeBSD 5 __FreeBSD_version Values
17.9. FreeBSD 4 __FreeBSD_version Values
17.10. FreeBSD 3 __FreeBSD_version Values
17.11. FreeBSD 2.2 __FreeBSD_version Values
17.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. Using PLIST_SUB with Regular Expressions
7.2. Example of a @dirrmtryecho Keyword
7.3. Real Life Example, How @sample is Implemented
9.1. Using make.conf to Change Default Perl
12.1. How to Avoid Using .error
14.1. Options Variables Order Example
16.1. Using Multiple Values
16.2. Adding an Argument
16.3. Adding Multiple Arguments
16.4. Mixing it All Together
16.5. Typical Use
16.6. Adding Another Interpreter to USES=shebangfix
16.7. Specifying all the Paths When Adding an Interpreter to USES=shebangfix
16.8. Adding a Strange Location for an Interpreter
16.9. USES=shebangfix with SHEBANG_REGEX
16.10. USES=shebangfix with SHEBANG_GLOB
16.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>.