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 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 DEPENDS
5.7.8 USE_*
5.7.9 Minimal version of a dependency
5.7.10 Notes on dependencies
5.7.11 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.12 Specifying the working directory
5.12.1 WRKSRC
5.12.2 NO_WRKSUBDIR
5.13 CONFLICTS
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.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 perl
6.6 Using X11
6.6.1 Variable definitions
6.6.2 Ports that require Motif
6.6.3 X11 fonts
6.6.4 Getting fake DISPLAY using Xvfb
6.6.5 Desktop entries
6.7 Using GNOME
6.8 Using KDE
6.9 Using Java
6.9.1 Variable definitions
6.9.2 Building with Ant
6.9.3 Best practices
6.10 Using Apache and PHP
6.10.1 Apache
6.10.2 PHP
6.10.3 PEAR modules
6.11 Using Python
6.12 Using Emacs
6.13 Using Ruby
6.14 Using SDL
6.15 Starting and stopping services (rc scripts)
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 PREFIX
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 Stripping Binaries
12.3 INSTALL_* macros
12.4 WRKDIR
12.5 WRKDIRPREFIX
12.6 Differentiating operating systems and OS versions
12.7 __FreeBSD_version values
12.8 Writing something after bsd.port.mk
12.9 Install additional documentation
12.10 Subdirectories
12.11 Use the exec statement in wrapper scripts
12.12 UIDs and GIDs
12.13 Do things rationally
12.14 Respect both CC and CXX
12.15 Respect CFLAGS
12.16 Threading libraries
12.17 Feedback
12.18 README.html
12.19 Marking a port not installable with BROKEN, FORBIDDEN, or IGNORE
12.19.1 Variables
12.19.2 Implementation Notes
12.20 Marking a port for removal with DEPRECATED or EXPIRATION_DATE
12.21 Avoid use of the .error construct
12.22 Necessary workarounds
12.23 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 perl
6-4. Variables for ports that use X
6-5. Variables for depending on individual parts of X11
6-6. Variables for ports that use KDE
6-7. Variables that may be set by ports that use Java
6-8. Variables provided to ports that use Java
6-9. Constants defined for ports that use Java
6-10. Variables for ports that use Apache
6-11. Useful variables for porting Apache modules
6-12. Variables for ports that use PHP
6-13. Most useful variables for ports that use Python
6-14. Useful variables for ports that use Ruby
6-15. Selected read-only variables for ports that use Ruby
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
6-1. Using X11 related variables in port
6-2. Example Makefile for PEAR class
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>.