Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174004808
D10224.id26882.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
10 KB
Referenced Files
None
Subscribers
None
D10224.id26882.diff
View Options
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></programlisting>
+
+ <sect1 xml:id="porting-samplem-order">
+ <title>Order of Variables in Ports Makefiles</title>
+
+ <para>In first few sections of the <filename>Makefile</filename>
+ 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.</para>
+
+ <para>The first part of a <filename>Makefile</filename> is always
+ a comment containing the <application>Subversion</application>
+ RCS Id, followed by an empty line. In new ports, it will look
+ like this:</para>
+
+ <programlisting># $FreeBSD$
+ </programlisting>
+
+ <para>In existing ports, <application>Subversion</application>
+ will have expanded it and it will 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 only
+ mandatory in a normal 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 define the variables the
+ port really need. Keep the variables in the order they are
+ 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, the version, where it comes from, and its category. The
+ order of the variables must be:</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 two 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, though 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>
+ 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>Always 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
+ mentionned 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 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>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Sep 30, 10:15 PM (1 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39977472
Default Alt Text
D10224.id26882.diff (10 KB)
Attached To
Mode
D10224: Add a section about the order the variables must come in a Makefile.
Attached
Detach File
Event Timeline
Log In to Comment