From owner-svn-doc-head@freebsd.org Fri Apr 21 13:42:13 2017 Return-Path: Delivered-To: svn-doc-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73E88D414BA; Fri, 21 Apr 2017 13:42:13 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38EE91DC6; Fri, 21 Apr 2017 13:42:13 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3LDgCGi013473; Fri, 21 Apr 2017 13:42:12 GMT (envelope-from mat@FreeBSD.org) Received: (from mat@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3LDgCse013472; Fri, 21 Apr 2017 13:42:12 GMT (envelope-from mat@FreeBSD.org) Message-Id: <201704211342.v3LDgCse013472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mat set sender to mat@FreeBSD.org using -f From: Mathieu Arnold Date: Fri, 21 Apr 2017 13:42:12 +0000 (UTC) To: doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org Subject: svn commit: r50190 - head/en_US.ISO8859-1/books/porters-handbook/porting-samplem X-SVN-Group: doc-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-doc-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the doc tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Apr 2017 13:42:13 -0000 Author: mat Date: Fri Apr 21 13:42:12 2017 New Revision: 50190 URL: https://svnweb.freebsd.org/changeset/doc/50190 Log: Add a section about the order the variables must come in a Makefile. Reviewed by: wblock Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D10224 Modified: head/en_US.ISO8859-1/books/porters-handbook/porting-samplem/chapter.xml Modified: head/en_US.ISO8859-1/books/porters-handbook/porting-samplem/chapter.xml ============================================================================== --- head/en_US.ISO8859-1/books/porters-handbook/porting-samplem/chapter.xml Fri Apr 21 13:42:08 2017 (r50189) +++ head/en_US.ISO8859-1/books/porters-handbook/porting-samplem/chapter.xml Fri Apr 21 13:42:12 2017 (r50190) @@ -98,4 +98,369 @@ pre-install: [and then the epilogue] .include <bsd.port.mk> + + + Order of Variables in Port Makefiles + + The first sections of the Makefile + must always come in the same order. This standard makes it so + everyone can easily read any port without having to search for + variables in a random order. + + The first line of a Makefile is always + a comment containing the Subversion + version control ID, followed by an empty line. In new ports, it + looks like this: + + # $FreeBSD$ +  + + In existing ports, Subversion + has expanded it to look like this: + + # $FreeBSD: head/ports-mgmt/pkg/Makefile 437007 2017-03-26 21:25:47Z bapt $ +  + + + The sections and variables described here are mandatory in + a ordinary 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 set the variables that are + required by the port. Define these variables in the order + they are shown here. + + + + <varname>PORTNAME</varname> Block + + This block is the most important. It defines the port + name, version, distribution file location, and category. The + variables must be in this order: + + + + 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 variables are: + + + + MAINTAINER + + + + COMMENT + + + + + + <varname>LICENSE</varname> Block + + This block is optional, although it is 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 + variables 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. + + 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 + mentioned 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 as the different stages run: + + + + fetch + + + + extract + + + + patch + + + + configure + + + + build + + + + install + + + + test + + + +