FreeBSD Porter's Handbook

The FreeBSD Documentation Project


Table of Contents
1 Introduction
2 Making a port yourself
3 Quick Porting
3.1 Writing the Makefile
3.2 Writing the description files
3.2.1 pkg-descr
3.2.2 pkg-plist
3.3 Creating the checksum file
3.4 Testing the port
3.5 Checking your port with portlint
3.6 Submitting the 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.2.1 PORTNAME and PORTVERSION
5.2.2 PORTREVISION and PORTEPOCH
5.2.3 PKGNAMEPREFIX and PKGNAMESUFFIX
5.2.4 LATEST_LINK
5.2.5 Package Naming Conventions
5.3 Categorization
5.3.1 CATEGORIES
5.3.2 Current list of categories
5.3.3 Choosing the right category
5.3.4 Proposing a new category
5.3.5 Proposing reorganizing all the categories
5.4 The distribution files
5.4.1 DISTVERSION/DISTNAME
5.4.2 MASTER_SITES
5.4.3 EXTRACT_SUFX
5.4.4 DISTFILES
5.4.5 EXTRACT_ONLY
5.4.6 PATCHFILES
5.4.7 Multiple distribution files or patches from different sites and subdirectories (MASTER_SITES:n)
5.4.8 DIST_SUBDIR
5.4.9 ALWAYS_KEEP_DISTFILES
5.5 MAINTAINER
5.6 COMMENT
5.7 Dependencies
5.7.1 LIB_DEPENDS
5.7.2 RUN_DEPENDS
5.7.3 BUILD_DEPENDS
5.7.4 FETCH_DEPENDS
5.7.5 EXTRACT_DEPENDS
5.7.6 PATCH_DEPENDS
5.7.7 USE_*
5.7.8 Minimal version of a dependency
5.7.9 Notes on dependencies
5.7.10 Circular dependencies are fatal
5.8 MASTERDIR
5.9 Manpages
5.10 Info files
5.11 Makefile Options
5.11.1 Knobs
5.11.2 OPTIONS
5.11.3 Feature auto-activation
5.12 Specifying the working directory
5.12.1 WRKSRC
5.12.2 NO_WRKSUBDIR
5.13 CONFLICTS
5.14 Installing files
5.14.1 INSTALL_* macros
5.14.2 Stripping Binaries
5.14.3 Installing a whole tree of files
5.14.4 Install additional documentation
5.14.5 Subdirectories under PREFIX
6 Special considerations
6.1 Shared Libraries
6.2 Ports with distribution restrictions
6.2.1 NO_PACKAGE
6.2.2 NO_CDROM
6.2.3 NOFETCHFILES
6.2.4 RESTRICTED
6.2.5 RESTRICTED_FILES
6.3 Building mechanisms
6.3.1 make, gmake, and imake
6.3.2 configure script
6.3.3 Using scons
6.4 Using GNU autotools
6.4.1 Introduction
6.4.2 libtool
6.4.3 libltdl
6.4.4 autoconf and autoheader
6.4.5 automake and aclocal
6.5 Using GNU gettext
6.5.1 Basic usage
6.5.2 Optional usage
6.5.3 Handling message catalog directories
6.6 Using perl
6.7 Using X11
6.7.1 X.Org components
6.7.2 Ports that require Motif
6.7.3 X11 fonts
6.7.4 Getting fake DISPLAY using Xvfb
6.7.5 Desktop entries
6.8 Using GNOME
6.9 Using KDE
6.9.1 Variable definitions
6.9.2 Ports that require Qt
6.9.3 Component selection (Qt 4.x only)
6.9.4 Additional considerations
6.10 Using Java
6.10.1 Variable definitions
6.10.2 Building with Ant
6.10.3 Best practices
6.11 Web applications, Apache and PHP
6.11.1 Apache
6.11.2 Web applications
6.11.3 PHP
6.11.4 PEAR modules
6.12 Using Python
6.13 Using Emacs
6.14 Using Ruby
6.15 Using SDL
6.16 Using wxWidgets
6.16.1 Introduction
6.16.2 Version selection
6.16.3 Component selection
6.16.4 Unicode
6.16.5 Detecting installed versions
6.16.6 Defined variables
6.16.7 Processing in bsd.port.pre.mk
6.16.8 Additional configure arguments
6.17 Using Lua
6.17.1 Introduction
6.17.2 Version selection
6.17.3 Component selection
6.17.4 Detecting installed versions
6.17.5 Defined variables
6.17.6 Processing in bsd.port.pre.mk
6.18 Using Xfce
6.19 Starting and stopping services (rc scripts)
6.19.1 Stopping services at deinstall
7 Advanced pkg-plist practices
7.1 Changing pkg-plist based on make variables
7.2 Empty directories
7.2.1 Cleaning up empty directories
7.2.2 Creating empty directories
7.3 Configuration files
7.4 Dynamic vs. 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 pkg-req
8.5 Changing the names of pkg-* files
8.6 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
11 Ports security
11.1 Why security is so important
11.2 Fixing security vulnerabilities
11.3 Keeping the community informed
11.3.1 The VuXML database
11.3.2 A short introduction to VuXML
11.3.3 Testing your changes to the VuXML database
12 Dos and Don'ts
12.1 Introduction
12.2 WRKDIR
12.3 WRKDIRPREFIX
12.4 Differentiating operating systems and OS versions
12.5 __FreeBSD_version values
12.6 Writing something after bsd.port.mk
12.7 Use the exec statement in wrapper scripts
12.8 UIDs and GIDs
12.9 Do things rationally
12.10 Respect both CC and CXX
12.11 Respect CFLAGS
12.12 Threading libraries
12.13 Feedback
12.14 README.html
12.15 Marking a port not installable with BROKEN, FORBIDDEN, or IGNORE
12.15.1 Variables
12.15.2 Implementation Notes
12.16 Marking a port for removal with DEPRECATED or EXPIRATION_DATE
12.17 Avoid use of the .error construct
12.18 Usage of sysctl
12.19 Rerolling distfiles
12.20 Necessary workarounds
12.21 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 The FreeBSD Port Distfile Survey
14.6 The FreeBSD Ports Monitoring System
List of Tables
5-1. The USE_* variables
5-2. The 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 scons
6-4. Variables for ports that use perl
6-5. Variables for ports that use X
6-6. Variables for depending on individual parts of X11
6-7. Variables for ports that use KDE
6-8. Variables for ports that use Qt
6-9. Additional variables for ports that use Qt 4.x
6-10. Available Qt4 library components
6-11. Available Qt4 tool components
6-12. Available Qt4 plugin components
6-13. Variables that 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. Useful variables for ports that use Ruby
6-21. Selected read-only variables for ports that use Ruby
6-22. Variables to select wxWidgets versions
6-23. Available wxWidgets versions
6-24. wxWidgets version specifications
6-25. Variables to select preferred wxWidgets versions
6-26. Available wxWidgets components
6-27. Available wxWidgets dependency types
6-28. Default wxWidgets dependency types
6-29. Variables to select Unicode in wxWidgets versions
6-30. Variables defined for ports that use wxWidgets
6-31. Legal values for WX_CONF_ARGS
6-32. Variables to select Lua versions
6-33. Available Lua versions
6-34. Lua version specifications
6-35. Variables to select preferred Lua versions
6-36. Available Lua components
6-37. Available Lua dependency types
6-38. Default Lua dependency types
6-39. Variables defined for ports that use Lua
12-1. __FreeBSD_version values
List of Examples
5-1. Simplified use of MASTER_SITES:n with 1 file per site
5-2. Simplified use of MASTER_SITES:n with more than 1 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. Simple use of OPTIONS
5-9. Wrong handling of an option
5-10. Correct handling of an option
6-1. USE_XORG example
6-2. Using X11 related variables in port
6-3. Selecting Qt4 components
6-4. Example Makefile for PEAR class
6-5. Selecting wxWidgets components
6-6. Detecting installed wxWidgets versions and components
6-7. Using wxWidgets variables in commands
6-8. Selecting the Lua version
6-9. Selecting Lua components
6-10. Detecting installed Lua versions and components
6-11. Telling the port where to find Lua
6-12. Using Lua variables in commands
12-1. How to avoid using .error
For questions about the FreeBSD ports system, e-mail <ports@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.