FreeBSD Porter's Handbook

The FreeBSD Documentation Project

Revision: 45423
Copyright
Legal Notice
Last modified on 2014-08-08 by rene.

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. PORTSCOUT
5.8. Dependencies
5.9. MASTERDIR
5.10. Man Pages
5.11. Info Files
5.12. Makefile Options
5.13. Specifying the Working Directory
5.14. Conflict Handling
5.15. 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 Java
6.15. Web Applications, Apache and PHP
6.16. Using Python
6.17. Using Tcl/Tk
6.18. Using Emacs
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. Using Node.js modules
6.28. Starting and Stopping Services (rc Scripts)
6.29. Adding Users and Groups
6.30. Ports That Rely on Kernel Sources
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. Feedback
12.11. README.html
12.12. Marking a Port as Architecture Neutral
12.13. Marking a Port Not Installable with BROKEN, FORBIDDEN, or IGNORE
12.14. Marking a Port for Removal with DEPRECATED or EXPIRATION_DATE
12.15. Avoid Use of the .error Construct
12.16. Usage of sysctl
12.17. Rerolling Distfiles
12.18. Avoiding Linuxisms
12.19. Miscellanea
13. A Sample Makefile
14. Keeping Up
14.1. FreshPorts
14.2. The Web Interface to the Source Repository
14.3. The FreeBSD Ports Mailing List
14.4. The FreeBSD Port Building Cluster
14.5. Portscout: the FreeBSD Ports Distfile Scanner
14.6. The FreeBSD Ports Monitoring System
15. Using USES Macros
15.1. An Introduction to USES
15.2. ada
15.3. autoreconf
15.4. blaslapack
15.5. bison
15.6. charsetfix
15.7. cmake
15.8. compiler
15.9. cpe
15.10. cran
15.11. desktop-file-utils
15.12. desthack
15.13. display
15.14. dos2unix
15.15. drupal
15.16. execinfo
15.17. fakeroot
15.18. fam
15.19. fmake
15.20. fonts
15.21. fortran
15.22. fuse
15.23. gecko
15.24. gettext
15.25. gettext-runtime
15.26. gettext-tools
15.27. ghostscript
15.28. gmake
15.29. gperf
15.30. gssapi
15.31. horde
15.32. iconv
15.33. imake
15.34. kmod
15.35. lha
15.36. libarchive
15.37. libedit
15.38. libtool
15.39. localbase
15.40. lua
15.41. makeinfo
15.42. makeself
15.43. metaport
15.44. mono
15.45. motif
15.46. ncurses
15.47. ninja
15.48. node
15.49. objc
15.50. openal
15.51. pathfix
15.52. pear
15.53. perl5
15.54. pgsql
15.55. pkgconfig
15.56. pure
15.57. python
15.58. qmail
15.59. qmake
15.60. readline
15.61. scons
15.62. shared-mime-info
15.63. shebangfix
15.64. tar
15.65. tcl
15.66. terminfo
15.67. tk
15.68. twisted
15.69. uidfix
15.70. uniquefiles
15.71. webplugin
15.72. xfce
15.73. zip
15.74. zope
16. __FreeBSD_version Values
List of Tables
5.1. Package Naming Examples
5.2. Examples of DISTVERSION and the Derived PORTVERSION
5.3. Shortcuts for MASTER_SITE_* Macros
5.4. Magic MASTER_SITES Macros
5.5. USE_GITHUB Description
5.6. 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. 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. Variables for Ports That Use PHP
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
6.40. Useful Variables for Porting Node.js Modules
10.1. Subversion Update File Prefixes
16.1. __FreeBSD_version Values
List of Examples
5.1. Simple Use of USE_GITHUB
5.2. More Complete Use of USE_GITHUB
5.3. Use of USE_GITHUB with DISTVERSIONPREFIX
5.4. Use of USE_GITHUB with Multiple Distribution Files
5.5. Simplified Use of MASTER_SITES:n with One File Per Site
5.6. Simplified Use of MASTER_SITES:n with More Than One File Per Site
5.7. Detailed Use of MASTER_SITES:n in MASTER_SITE_SUBDIR
5.8. Detailed Use of MASTER_SITES:n with Comma Operator, Multiple Files, Multiple Sites and Multiple Subdirectories
5.9. Detailed Use of MASTER_SITES:n with SourceForge (SF)
5.10. Simplified Use of MASTER_SITES:n with PATCH_SITES
5.11. Use of ALWAYS_KEEP_DISTFILES
5.12. Wrong Declaration of an Optional Dependency
5.13. Correct Declaration of an Optional Dependency
5.14. Simple Use of OPTIONS
5.15. Check for Unset Port OPTIONS
5.16. Practical Use of OPTIONS
5.17. Wrong Handling of an Option
5.18. Correct Handling of an Option
5.19. Simple Use of OPT_IMPLIES
5.20. Simple Use of OPT_PREVENTS
6.1. USES= cmake Example
6.2. Perl Dependency Example
6.3. USE_XORG Example
6.4. Using X11-Related Variables
6.5. Selecting Qt 4 Components
6.6. USES= qmake Example
6.7. USE_KDE4 Example
6.8. Example Makefile for PEAR Class
6.9. Example Makefile for Horde Module
6.10. Makefile for a Simple Python Module
6.11. Selecting wxWidgets Components
6.12. Detecting Installed wxWidgets Versions and Components
6.13. Using wxWidgets Variables in Commands
6.14. Simple iconv Usage
6.15. iconv Usage with configure
6.16. Fixing Hardcoded -liconv
6.17. Checking for Native iconv Availability
6.18. USES=xfce Example
6.19. Using Xfce's Own GTK3 Widgets
6.20. Example Makefile for Node.js Module
6.21. Example Makefile with Node.js scripts
6.22. Example Makefile with NODE_EXCLUDEDIRS
6.23. Wrong NODE_EXCLUDEDIRS in Makefile
6.24. Correct NODE_EXCLUDEDIRS in Makefile
7.1. Example of a @dirrmtryecho Keyword
7.2. Real Life Example, How @sample is Implemented
9.1. Using make.conf to Change Default Perl
12.1. How to Avoid Using .error
15.1. Using Multiple Values
15.2. Adding an Argument
15.3. Adding Multiple Arguments
15.4. Mixing it All Together
15.5. Typical Use

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/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>.