FreeBSD Porter's Handbook

The FreeBSD Documentation Project

Revision: 43069
Copyright
Legal Notice
Last modified on 2013-10-29 by wblock.

Table of Contents
1. Introduction
2. Making a New Port Yourself
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 Your 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. Shared Libraries
6.3. Ports with Distribution Restrictions
6.4. Building Mechanisms
6.5. Using GNU Autotools
6.6. Using GNU gettext
6.7. Using Perl
6.8. Using X11
6.9. Using GNOME
6.10. Using Qt
6.11. Using KDE
6.12. Using Java
6.13. Web Applications, Apache and PHP
6.14. Using Python
6.15. Using Tcl/Tk
6.16. Using Emacs
6.17. Using Ruby
6.18. Using SDL
6.19. Using wxWidgets
6.20. Using Lua
6.21. Using iconv
6.22. Using Xfce
6.23. Using Mozilla
6.24. Using Databases
6.25. Starting and Stopping Services (rc Scripts)
6.26. Adding Users and Groups
6.27. 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
8. The pkg-* Files
8.1. pkg-message
8.2. pkg-install
8.3. pkg-deinstall
8.4. Changing the Names of pkg-* Files
8.5. Making Use of SUB_FILES and SUB_LIST
9. Testing Your Port
9.1. Running make describe
9.2. Portlint
9.3. Port Tools
9.4. PREFIX and DESTDIR
9.5. Tinderbox
10. Upgrading an Individual Port
10.1. Using SVN to Make Patches
10.2. The Files UPDATING and MOVED
11. Ports 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. Threading Libraries
12.11. Feedback
12.12. README.html
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 on pointyhat.FreeBSD.org
14.5. Portscout: the FreeBSD Ports Distfile Scanner
14.6. The FreeBSD Ports Monitoring System
15. Appendices
15.1. Values of USES
15.2. __FreeBSD_version Values
List of Tables
5.1. Popular Magic MASTER_SITES Macros
5.2. The USE_* Variables
5.3. Common WITH_* and WITHOUT_* Variables
6.1. Variables for Ports Related to gmake
6.2. Variables for Ports That Use configure
6.3. Variables for Ports That Use cmake
6.4. Variables for Ports That Use scons
6.5. Variables for Ports That Use Perl
6.6. Variables for Ports That Use X
6.7. Variables for Ports That Use Qt
6.8. Additional Variables for Ports That Use Qt 4.x
6.9. Available Qt 4 Library Components
6.10. Available Qt 4 Tool Components
6.11. Available Qt 4 Plugin Components
6.12. Available KDE 4 Components
6.13. Variables Which May be Set by Ports That Use Java
6.14. Variables Provided to Ports That Use Java
6.15. Constants Defined for Ports That Use Java
6.16. Variables for Ports That Use Apache
6.17. Useful Variables for Porting Apache Modules
6.18. Variables for Ports That Use PHP
6.19. Most Useful Variables for Ports That Use Python
6.20. The Most Useful Variables for Ports That Use Tcl/Tk
6.21. Useful Variables for Ports That Use Ruby
6.22. Selected Read-Only Variables for Ports That Use Ruby
6.23. Variables to Select wxWidgets Versions
6.24. Available wxWidgets Versions
6.25. wxWidgets Version Specifications
6.26. Variables to Select Preferred wxWidgets Versions
6.27. Available wxWidgets Components
6.28. Available wxWidgets Dependency Types
6.29. Default wxWidgets Dependency Types
6.30. Variables to Select Unicode in wxWidgets Versions
6.31. Variables Defined for Ports That Use wxWidgets
6.32. Legal Values for WX_CONF_ARGS
6.33. Variables to Select Lua Versions
6.34. Available Lua Versions
6.35. Lua Version Specifications
6.36. Variables to Select Preferred Lua Versions
6.37. Available Lua Components
6.38. Available Lua Dependency Types
6.39. Default Lua Dependency Types
6.40. Variables Defined for Ports That Use Lua
6.41. Variables for Ports That Use Mozilla
6.42. Variables for Ports Using Databases
10.1. SVN Update File Prefixes
15.1. Values of USES
15.2. __FreeBSD_version Values
List of Examples
5.1. Simplified Use of MASTER_SITES:n with One File Per Site
5.2. Simplified Use of MASTER_SITES:n with More Than One File Per Site
5.3. Detailed Use of MASTER_SITES:n in MASTER_SITE_SUBDIR
5.4. Detailed Use of MASTER_SITES:n with Comma Operator, Multiple Files, Multiple Sites and Multiple Subdirectories
5.5. Detailed Use of MASTER_SITES:n with MASTER_SITE_SOURCEFORGE
5.6. Simplified Use of MASTER_SITES:n with PATCH_SITES
5.7. Use of ALWAYS_KEEP_DISTFILES
5.8. Wrong Declaration of an Optional Dependency
5.9. Correct Declaration of an Optional Dependency
5.10. Simple Use of OPTIONS
5.11. Check for Unset Port OPTIONS
5.12. Practical Use of OPTIONS
5.13. Wrong Handling of an Option
5.14. Correct Handling of an Option
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. USE_KDE4 Example
6.7. Example Makefile for PEAR Class
6.8. Selecting wxWidgets Components
6.9. Detecting Installed wxWidgets Versions and Components
6.10. Using wxWidgets Variables in Commands
6.11. Selecting the Lua Version
6.12. Selecting Lua Components
6.13. Detecting Installed Lua Versions and Components
6.14. Telling the Port Where to Find Lua
6.15. Using Lua Variables in Commands
6.16. Simple iconv Usage
6.17. iconv Usage with configure
6.18. Fixing Hardcoded -liconv
6.19. Checking for Native iconv Availability
12.1. How to Avoid Using .error

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>.