FreeBSD Porter's Handbook

The FreeBSD Documentation Project


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.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 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.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 Conflict handling
5.13.1 CONFLICTS_INSTALL
5.13.2 CONFLICTS_BUILD
5.13.3 CONFLICTS
5.14 Installing files
5.14.1 INSTALL_* macros
5.14.2 Stripping Binaries and shared libraries
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 Parallel ports building
6.3.2 make, gmake, and imake
6.3.3 configure script
6.3.4 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 Qt
6.9.1 Ports that require Qt
6.9.2 Component selection (Qt 4.x only)
6.9.3 Additional considerations
6.10 Using KDE
6.10.1 Variable definitions (KDE 3.x only)
6.10.2 KDE 4 variable definitions
6.11 Using Java
6.11.1 Variable definitions
6.11.2 Building with Ant
6.11.3 Best practices
6.12 Web applications, Apache and PHP
6.12.1 Apache
6.12.2 Web applications
6.12.3 PHP
6.12.4 PEAR modules
6.13 Using Python
6.14 Using Tcl/Tk
6.15 Using Emacs
6.16 Using Ruby
6.17 Using SDL
6.18 Using wxWidgets
6.18.1 Introduction
6.18.2 Version selection
6.18.3 Component selection
6.18.4 Unicode
6.18.5 Detecting installed versions
6.18.6 Defined variables
6.18.7 Processing in bsd.port.pre.mk
6.18.8 Additional configure arguments
6.19 Using Lua
6.19.1 Introduction
6.19.2 Version selection
6.19.3 Component selection
6.19.4 Detecting installed versions
6.19.5 Defined variables
6.19.6 Processing in bsd.port.pre.mk
6.20 Using Xfce
6.21 Using databases
6.22 Starting and stopping services (rc scripts)
6.22.1 Stopping services at deinstall
6.23 Adding users and groups
6.24 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.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 an individual port
10.1 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
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 Do things rationally
12.9 Respect both CC and CXX
12.10 Respect CFLAGS
12.11 Threading libraries
12.12 Feedback
12.13 README.html
12.14 Marking a port not installable with BROKEN, FORBIDDEN, or IGNORE
12.14.1 Variables
12.14.2 Implementation Notes
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 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 Ports Distfile Scanner
14.6 The FreeBSD Ports Monitoring System
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 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 Qt
6-8. Additional variables for ports that use Qt 4.x
6-9. Available Qt4 library components
6-10. Available Qt4 tool components
6-11. Available Qt4 plugin components
6-12. Variables for ports that use KDE 3.x
6-13. Available KDE4 components
6-14. Variables that may be set by ports that use Java
6-15. Variables provided to ports that use Java
6-16. Constants defined for ports that use Java
6-17. Variables for ports that use Apache
6-18. Useful variables for porting Apache modules
6-19. Variables for ports that use PHP
6-20. Most useful variables for ports that use Python
6-21. The most useful variables for ports that use Tcl/Tk
6-22. Useful variables for ports that use Ruby
6-23. Selected read-only variables for ports that use Ruby
6-24. Variables to select wxWidgets versions
6-25. Available wxWidgets versions
6-26. wxWidgets version specifications
6-27. Variables to select preferred wxWidgets versions
6-28. Available wxWidgets components
6-29. Available wxWidgets dependency types
6-30. Default wxWidgets dependency types
6-31. Variables to select Unicode in wxWidgets versions
6-32. Variables defined for ports that use wxWidgets
6-33. Legal values for WX_CONF_ARGS
6-34. Variables to select Lua versions
6-35. Available Lua versions
6-36. Lua version specifications
6-37. Variables to select preferred Lua versions
6-38. Available Lua components
6-39. Available Lua dependency types
6-40. Default Lua dependency types
6-41. Variables defined for ports that use Lua
6-42. Variables for ports using databases
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. Old style use of OPTIONS
5-10. Wrong handling of an option
5-11. 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. USE_KDE4 example
6-5. Example Makefile for PEAR class
6-6. Selecting wxWidgets components
6-7. Detecting installed wxWidgets versions and components
6-8. Using wxWidgets variables in commands
6-9. Selecting the Lua version
6-10. Selecting Lua components
6-11. Detecting installed Lua versions and components
6-12. Telling the port where to find Lua
6-13. Using Lua variables in commands
12-1. How to avoid using .error
For questions about the FreeBSD ports system, e-mail <[email protected]>.
For questions about this documentation, e-mail <[email protected]>.