svn commit: r50190 - head/en_US.ISO8859-1/books/porters-handbook/porting-samplem
Mathieu Arnold
mat at FreeBSD.org
Fri Apr 21 13:42:13 UTC 2017
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></programlisting>
+
+ <sect1 xml:id="porting-samplem-order">
+ <title>Order of Variables in Port Makefiles</title>
+
+ <para>The first sections of the <filename>Makefile</filename>
+ 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.</para>
+
+ <para>The first line of a <filename>Makefile</filename> is always
+ a comment containing the <application>Subversion</application>
+ version control ID, followed by an empty line. In new ports, it
+ looks like this:</para>
+
+ <programlisting># $FreeBSD$
+ </programlisting>
+
+ <para>In existing ports, <application>Subversion</application>
+ has expanded it to look like this:</para>
+
+ <programlisting># $FreeBSD: head/ports-mgmt/pkg/Makefile 437007 2017-03-26 21:25:47Z bapt $
+ </programlisting>
+
+ <note>
+ <para>The sections and variables described here are mandatory in
+ a ordinary port. In a slave port, many sections variables and
+ can be skipped.</para>
+ </note>
+
+ <important>
+ <para>Each following block must be separated from the previous
+ block by a single blank line.</para>
+
+ <para>In the following blocks, only set the variables that are
+ required by the port. Define these variables in the order
+ they are shown here.</para>
+ </important>
+
+ <sect2 xml:id="porting-samplem-portname">
+ <title><varname>PORTNAME</varname> Block</title>
+
+ <para>This block is the most important. It defines the port
+ name, version, distribution file location, and category. The
+ variables must be in this order:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><link
+ linkend="makefile-portname"><varname>PORTNAME</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-portname"><varname>PORTVERSION</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-distversion"><varname>DISTVERSIONPREFIX</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-distversion"><varname>DISTVERSION</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-distversion"><varname>DISTVERSIONSUFFIX</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-portrevision"><varname>PORTREVISION</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-portepoch"><varname>PORTEPOCH</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-categories"><varname>CATEGORIES</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-master_sites"><varname>MASTER_SITES</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-master_sites-shorthand"><varname>MASTER_SITE_SUBDIR</varname></link>
+ (deprecated)</para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="porting-pkgnameprefix-suffix"><varname>PKGNAMEPREFIX</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="porting-pkgnameprefix-suffix"><varname>PKGNAMESUFFIX</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-distversion"><varname>DISTNAME</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-extract_sufx"><varname>EXTRACT_SUFX</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-distfiles-definition"><varname>DISTFILES</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-dist_subdir"><varname>DIST_SUBDIR</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-extract_only"><varname>EXTRACT_ONLY</varname></link></para>
+ </listitem>
+ </itemizedlist>
+
+ <important>
+ <para>Only one of <varname>PORTVERSION</varname> and
+ <varname>DISTVERSION</varname> can be used.</para>
+ </important>
+ </sect2>
+
+ <sect2 xml:id="porting-samplem-patch">
+ <title><varname>PATCHFILES</varname> Block</title>
+
+ <para>This block is optional. The variables are:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><link
+ linkend="porting-patchfiles"><varname>PATCH_SITES</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="porting-patchfiles"><varname>PATCHFILES</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="porting-patchfiles"><varname>PATCH_DIST_STRIP</varname></link></para>
+ </listitem>
+ </itemizedlist>
+ </sect2>
+
+ <sect2 xml:id="porting-samplem-maintainer">
+ <title><varname>MAINTAINER</varname> Block</title>
+
+ <para>This block is mandatory. The variables are:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><link
+ linkend="makefile-maintainer"><varname>MAINTAINER</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-comment"><varname>COMMENT</varname></link></para>
+ </listitem>
+ </itemizedlist>
+ </sect2>
+
+ <sect2 xml:id="porting-samplem-license">
+ <title><varname>LICENSE</varname> Block</title>
+
+ <para>This block is optional, although it is highly recommended.
+ The variables are:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><link
+ linkend="licenses-license"><varname>LICENSE</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="licenses-license_comb"><varname>LICENSE_COMB</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="licenses-license_groups"><varname>LICENSE_GROUPS</varname></link>
+ or
+ <varname>LICENSE_GROUPS_<replaceable>NAME</replaceable></varname></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="licenses-license_name"><varname>LICENSE_NAME</varname></link>
+ or
+ <varname>LICENSE_NAME_<replaceable>NAME</replaceable></varname></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="licenses-license_text"><varname>LICENSE_TEXT</varname></link>
+ or
+ <varname>LICENSE_TEXT_<replaceable>NAME</replaceable></varname></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="licenses-license_file"><varname>LICENSE_FILE</varname></link>
+ or
+ <varname>LICENSE_FILE_<replaceable>NAME</replaceable></varname></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="licenses-license_perms"><varname>LICENSE_PERMS</varname></link>
+ or
+ <varname>LICENSE_PERMS_<replaceable>NAME</replaceable></varname></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="licenses-license_distfiles"><varname>LICENSE_DISTFILES</varname></link>
+ or
+ <varname>LICENSE_DISTFILES_<replaceable>NAME</replaceable></varname></para>
+ </listitem>
+ </itemizedlist>
+
+ <para>If there are multiple licenses, sort the different
+ LICENSE_<replaceable>VAR</replaceable>_<replaceable>NAME</replaceable>
+ variables by license name.</para>
+ </sect2>
+
+ <sect2 xml:id="porting-samplem-depends">
+ <title>The Dependencies Block</title>
+
+ <para>This block is optional. The variables are:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><link
+ linkend="makefile-fetch_depends"><varname>FETCH_DEPENDS</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-extract_depends"><varname>EXTRACT_DEPENDS</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-patch_depends"><varname>PATCH_DEPENDS</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-build_depends"><varname>BUILD_DEPENDS</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-lib_depends"><varname>LIB_DEPENDS</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <para><link
+ linkend="makefile-run_depends"><varname>RUN_DEPENDS</varname></link></para>
+ </listitem>
+
+ <listitem>
+ <!-- FIXME: write a section about tests -->
+ <para><varname>TEST_DEPENDS</varname></para>
+ </listitem>
+ </itemizedlist>
+ </sect2>
+
+ <sect2 xml:id="porting-samplem-uses">
+ <title><varname>USES</varname> and
+ <varname>USE_<replaceable>x</replaceable></varname></title>
+
+ <para>Start this section with defining <varname>USES</varname>,
+ and then possible
+ <varname>USE_<replaceable>x</replaceable></varname>.</para>
+
+ <para>Keep related variables close together. For example, if
+ using <link
+ linkend="makefile-master_sites-github"><varname>USE_GITHUB</varname></link>,
+ always put the
+ <varname>GH_<replaceable>*</replaceable></varname> variables
+ right after it.</para>
+ </sect2>
+
+ <sect2 xml:id="porting-samplem-options">
+ <title>Options</title>
+
+ <para>If the port uses the <link
+ linkend="makefile-options">options framework</link>, define
+ <varname>OPTIONS_DEFINE</varname> and
+ <varname>OPTIONS_DEFAULT</varname> first, then the other
+ <varname>OPTIONS_<replaceable>*</replaceable></varname>
+ variables first, then the
+ <varname><replaceable>*</replaceable>_DESC</varname>
+ descriptions, then the options helpers. Try and sort all of
+ those alphabetically.</para>
+ </sect2>
+
+ <sect2 xml:id="porting-samplem-rest">
+ <title>The Rest of the Variables</title>
+
+ <para>And then, the rest of the variables that are not
+ mentioned in the previous blocks.</para>
+ </sect2>
+
+ <sect2 xml:id="porting-samplem-targets">
+ <title>The Targets</title>
+
+ <para>After all the variables are defined, the optional
+ &man.make.1; targets can be defined. Keep
+ <literal>pre-<replaceable>*</replaceable></literal> before
+ <literal>post-<replaceable>*</replaceable></literal> and in
+ the same order as the different stages run:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><varname>fetch</varname></para>
+ </listitem>
+
+ <listitem>
+ <para><varname>extract</varname></para>
+ </listitem>
+
+ <listitem>
+ <para><varname>patch</varname></para>
+ </listitem>
+
+ <listitem>
+ <para><varname>configure</varname></para>
+ </listitem>
+
+ <listitem>
+ <para><varname>build</varname></para>
+ </listitem>
+
+ <listitem>
+ <para><varname>install</varname></para>
+ </listitem>
+
+ <listitem>
+ <para><varname>test</varname></para>
+ </listitem>
+ </itemizedlist>
+ </sect2>
+ </sect1>
</chapter>
More information about the svn-doc-all
mailing list