Index: en_US.ISO8859-1/books/porters-handbook/porting-samplem/chapter.xml =================================================================== --- en_US.ISO8859-1/books/porters-handbook/porting-samplem/chapter.xml +++ en_US.ISO8859-1/books/porters-handbook/porting-samplem/chapter.xml @@ -98,4 +98,369 @@ [and then the epilogue] .include <bsd.port.mk> + + + Order of Variables in Ports Makefiles + + In first few sections of the Makefile + must always come in the same order. This is so that everyone + can easily read any port without having to wonder what this or + that variable contains. + + The first part of a Makefile is always + a comment containing the Subversion + RCS Id, followed by an empty line. In new ports, it will look + like this: + + # $FreeBSD$ +  + + In existing ports, Subversion + will have expanded it and it will look like this: + + # $FreeBSD: head/ports-mgmt/pkg/Makefile 437007 2017-03-26 21:25:47Z bapt $ +  + + + The sections and variables described here are only + mandatory in a normal port. In a slave port, many sections + variables and can be skipped. + + + + Each following block must be separated from the previous + block by a single blank line. + + In the following blocks, only define the variables the + port really need. Keep the variables in the order they are + here. + + + + <varname>PORTNAME</varname> Block + + This block is the most important, it defines the port + name, the version, where it comes from, and its category. The + order of the variables must be: + + + + PORTNAME + + + + PORTVERSION + + + + DISTVERSIONPREFIX + + + + DISTVERSION + + + + DISTVERSIONSUFFIX + + + + PORTREVISION + + + + PORTEPOCH + + + + CATEGORIES + + + + MASTER_SITES + + + + MASTER_SITE_SUBDIR + (deprecated) + + + + PKGNAMEPREFIX + + + + PKGNAMESUFFIX + + + + DISTNAME + + + + EXTRACT_SUFX + + + + DISTFILES + + + + DIST_SUBDIR + + + + EXTRACT_ONLY + + + + + Only one of PORTVERSION and + DISTVERSION can be used. + + + + + <varname>PATCHFILES</varname> Block + + This block is optional. The variables are: + + + + PATCH_SITES + + + + PATCHFILES + + + + PATCH_DIST_STRIP + + + + + + <varname>MAINTAINER</varname> Block + + This block is mandatory. The two variables are: + + + + MAINTAINER + + + + COMMENT + + + + + + <varname>LICENSE</varname> Block + + This block is optional, though highly recommended. The + variables are: + + + + LICENSE + + + + LICENSE_COMB + + + + LICENSE_GROUPS + or + LICENSE_GROUPS_NAME + + + + LICENSE_NAME + or + LICENSE_NAME_NAME + + + + LICENSE_TEXT + or + LICENSE_TEXT_NAME + + + + LICENSE_FILE + or + LICENSE_FILE_NAME + + + + LICENSE_PERMS + or + LICENSE_PERMS_NAME + + + + LICENSE_DISTFILES + or + LICENSE_DISTFILES_NAME + + + + If there are multiple licenses, sort the different + LICENSE_VAR_NAME + by license name. + + + + The Dependencies Block + + This block is optional. The variables are: + + + + FETCH_DEPENDS + + + + EXTRACT_DEPENDS + + + + PATCH_DEPENDS + + + + BUILD_DEPENDS + + + + LIB_DEPENDS + + + + RUN_DEPENDS + + + + + TEST_DEPENDS + + + + + + <varname>USES</varname> and + <varname>USE_<replaceable>x</replaceable></varname> + + Start this section with defining USES, + and then possible + USE_x. + + Always keep related variables close together, for example, + if using USE_GITHUB, + always put the + GH_* variables + right after it. + + + + Options + + If the port uses the options framework, define + OPTIONS_DEFINE and + OPTIONS_DEFAULT first, then the other + OPTIONS_* + variables first, then the + *_DESC + descriptions, then the options helpers. Try and sort all of + those alphabetically. + + + + The Rest of the Variables + + And then, the rest of the variables that are not + mentionned in the previous blocks. + + + + The Targets + + After all the variables are defined, the optional + &man.make.1; targets can be defined. Keep + pre-* before + post-* and in + the same order the different stages run: + + + + fetch + + + + extract + + + + patch + + + + configure + + + + build + + + + install + + + + test + + + +