| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | <!-- $NetBSD: build.xml,v 1.87 2022/05/21 11:42:29 nia Exp $ --> | | 1 | <!-- $NetBSD: build.xml,v 1.88 2022/07/25 05:42:22 rillig Exp $ --> |
2 | | | 2 | |
3 | <chapter id="build"> | | 3 | <chapter id="build"> |
4 | <title>The build process</title> | | 4 | <title>The build process</title> |
5 | | | 5 | |
6 | <sect1 id="build.intro"> | | 6 | <sect1 id="build.intro"> |
7 | <title>Introduction</title> | | 7 | <title>Introduction</title> |
8 | | | 8 | |
9 | <para>This chapter gives a detailed description on how a package is | | 9 | <para>This chapter gives a detailed description on how a package is |
10 | built. Building a package is separated into different | | 10 | built. Building a package is separated into different |
11 | <emphasis>phases</emphasis> (for example <varname>fetch</varname>, | | 11 | <emphasis>phases</emphasis> (for example <varname>fetch</varname>, |
12 | <varname>build</varname>, <varname>install</varname>), all of which are | | 12 | <varname>build</varname>, <varname>install</varname>), all of which are |
13 | described in the following sections. Each phase is split into | | 13 | described in the following sections. Each phase is split into |
14 | so-called <emphasis>stages</emphasis>, which take the name of the | | 14 | so-called <emphasis>stages</emphasis>, which take the name of the |
| @@ -112,28 +112,39 @@ | | | @@ -112,28 +112,39 @@ |
112 | <variablelist> | | 112 | <variablelist> |
113 | | | 113 | |
114 | <varlistentry><term><varname>PKGSRCDIR</varname></term> | | 114 | <varlistentry><term><varname>PKGSRCDIR</varname></term> |
115 | <listitem><para>This is an absolute pathname that points to the pkgsrc | | 115 | <listitem><para>This is an absolute pathname that points to the pkgsrc |
116 | root directory. Generally, you don't need | | 116 | root directory. Generally, you don't need |
117 | it.</para></listitem></varlistentry> | | 117 | it.</para></listitem></varlistentry> |
118 | | | 118 | |
119 | <varlistentry><term><varname>PKGDIR</varname></term> | | 119 | <varlistentry><term><varname>PKGDIR</varname></term> |
120 | <listitem><para>This is an absolute pathname that points to the | | 120 | <listitem><para>This is an absolute pathname that points to the |
121 | current package.</para></listitem></varlistentry> | | 121 | current package.</para></listitem></varlistentry> |
122 | | | 122 | |
123 | <varlistentry><term><varname>PKGPATH</varname></term> | | 123 | <varlistentry><term><varname>PKGPATH</varname></term> |
124 | <listitem><para>This is a pathname relative to | | 124 | <listitem><para>This is a pathname relative to |
125 | <varname>PKGSRCDIR</varname> that points to the current | | 125 | <varname>PKGSRCDIR</varname> that points to the current package. |
126 | package.</para></listitem></varlistentry> | | 126 | It is defined after including <filename>bsd.prefs.mk</filename> |
| | | 127 | and can be used in makefile fragments that are used by several |
| | | 128 | packages to distinguish between these packages. Other variables |
| | | 129 | that would serve the same purpose are <varname>PKGBASE</varname> |
| | | 130 | and <varname>PKGNAME</varname>, but these are only defined after |
| | | 131 | including <filename>bsd.pkg.mk</filename>, which is too |
| | | 132 | late.</para> |
| | | 133 | |
| | | 134 | <para>In &mk.conf;, the pkgsrc user can use |
| | | 135 | <varname>PKGPATH</varname> to tweak variables like |
| | | 136 | <varname>MAKE_JOBS</varname> and |
| | | 137 | <varname>CFLAGS</varname>.</para></listitem></varlistentry> |
127 | | | 138 | |
128 | <varlistentry><term><varname>WRKDIR</varname></term> | | 139 | <varlistentry><term><varname>WRKDIR</varname></term> |
129 | <listitem><para>This is an absolute pathname pointing to the directory | | 140 | <listitem><para>This is an absolute pathname pointing to the directory |
130 | where all work takes place. The distfiles are extracted to this | | 141 | where all work takes place. The distfiles are extracted to this |
131 | directory. It also contains temporary directories and log files used by | | 142 | directory. It also contains temporary directories and log files used by |
132 | the various pkgsrc frameworks, like <emphasis>buildlink</emphasis> or | | 143 | the various pkgsrc frameworks, like <emphasis>buildlink</emphasis> or |
133 | the <emphasis>wrappers</emphasis>.</para></listitem></varlistentry> | | 144 | the <emphasis>wrappers</emphasis>.</para></listitem></varlistentry> |
134 | | | 145 | |
135 | <varlistentry><term><varname>WRKSRC</varname></term> | | 146 | <varlistentry><term><varname>WRKSRC</varname></term> |
136 | <listitem><para>This is an absolute pathname pointing to the directory | | 147 | <listitem><para>This is an absolute pathname pointing to the directory |
137 | where the distfiles are extracted. It is usually a direct subdirectory | | 148 | where the distfiles are extracted. It is usually a direct subdirectory |
138 | of <varname>WRKDIR</varname>, and often it's the only directory entry | | 149 | of <varname>WRKDIR</varname>, and often it's the only directory entry |
139 | that isn't hidden. This variable may be changed by a package | | 150 | that isn't hidden. This variable may be changed by a package |
| @@ -145,30 +156,31 @@ | | | @@ -145,30 +156,31 @@ |
145 | the value <emphasis>yes</emphasis> or <emphasis>no</emphasis> and defaults | | 156 | the value <emphasis>yes</emphasis> or <emphasis>no</emphasis> and defaults |
146 | to <emphasis>no</emphasis>. It indicates whether a symbolic link to the | | 157 | to <emphasis>no</emphasis>. It indicates whether a symbolic link to the |
147 | <varname>WRKDIR</varname> is to be created in the pkgsrc entry's directory. | | 158 | <varname>WRKDIR</varname> is to be created in the pkgsrc entry's directory. |
148 | If users would like to have their pkgsrc trees behave in a | | 159 | If users would like to have their pkgsrc trees behave in a |
149 | read-only manner, then the value of | | 160 | read-only manner, then the value of |
150 | <varname>CREATE_WRKDIR_SYMLINK</varname> should be set to | | 161 | <varname>CREATE_WRKDIR_SYMLINK</varname> should be set to |
151 | <emphasis>no</emphasis>.</para> | | 162 | <emphasis>no</emphasis>.</para> |
152 | </sect1> | | 163 | </sect1> |
153 | | | 164 | |
154 | <sect1 id="build.running"> | | 165 | <sect1 id="build.running"> |
155 | <title>Running a phase</title> | | 166 | <title>Running a phase</title> |
156 | | | 167 | |
157 | <para>You can run a particular phase by typing <command>make | | 168 | <para>You can run a particular phase by typing <command>make |
158 | phase</command>, where <emphasis>phase</emphasis> is the name of the | | 169 | <replaceable>phase</replaceable></command>, where |
159 | phase. This will automatically run all phases that are required for this | | 170 | <replaceable>phase</replaceable> is the name of the phase. This will |
160 | phase. The default phase is <varname>build</varname>, that is, when you | | 171 | automatically run all phases that are required for this phase. The |
161 | run <command>make</command> without parameters in a package directory, | | 172 | default phase is <varname>build</varname>, that is, when you run |
| | | 173 | <command>make</command> without parameters in a package directory, |
162 | the package will be built, but not installed.</para> | | 174 | the package will be built, but not installed.</para> |
163 | | | 175 | |
164 | </sect1> | | 176 | </sect1> |
165 | | | 177 | |
166 | <sect1 id="build.fetch"> | | 178 | <sect1 id="build.fetch"> |
167 | <title>The <emphasis>fetch</emphasis> phase</title> | | 179 | <title>The <emphasis>fetch</emphasis> phase</title> |
168 | | | 180 | |
169 | <para>The first step in building a package is to fetch the | | 181 | <para>The first step in building a package is to fetch the |
170 | distribution files (distfiles) from the sites that are providing | | 182 | distribution files (distfiles) from the sites that are providing |
171 | them. This is the task of the <emphasis>fetch</emphasis> | | 183 | them. This is the task of the <emphasis>fetch</emphasis> |
172 | phase.</para> | | 184 | phase.</para> |
173 | | | 185 | |
174 | <sect2 id="build.fetch.what"> | | 186 | <sect2 id="build.fetch.what"> |