Thu Mar 5 13:08:02 2009 UTC ()
Added DESTDIR examples and section 10.1.3. Python modules and programs


(imil)
diff -r1.32 -r1.33 pkgsrc/doc/guide/files/configuring.xml
diff -r1.7 -r1.8 pkgsrc/doc/guide/files/creating.xml

cvs diff -r1.32 -r1.33 pkgsrc/doc/guide/files/configuring.xml (expand / switch to unified diff)

--- pkgsrc/doc/guide/files/configuring.xml 2009/01/28 23:31:39 1.32
+++ pkgsrc/doc/guide/files/configuring.xml 2009/03/05 13:08:02 1.33
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1<!-- $NetBSD: configuring.xml,v 1.32 2009/01/28 23:31:39 abs Exp $ --> 1<!-- $NetBSD: configuring.xml,v 1.33 2009/03/05 13:08:02 imil Exp $ -->
2 2
3<chapter id="configuring"> 3<chapter id="configuring">
4 <title>Configuring pkgsrc</title> 4 <title>Configuring pkgsrc</title>
5 5
6<anchor id="mk.conf" /> 6<anchor id="mk.conf" />
7 7
8<para>The whole pkgsrc system is configured in a single file, usually 8<para>The whole pkgsrc system is configured in a single file, usually
9called <filename>mk.conf</filename>. In which directory pkgsrc looks for 9called <filename>mk.conf</filename>. In which directory pkgsrc looks for
10that file depends on the installation. On NetBSD, when you use 10that file depends on the installation. On NetBSD, when you use
11&man.make.1; from the base system, it is in the directory 11&man.make.1; from the base system, it is in the directory
12<filename>/etc/</filename>. In all other cases the default location is 12<filename>/etc/</filename>. In all other cases the default location is
13<literal>${PREFIX}/etc/</literal>, depending on where you told the 13<literal>${PREFIX}/etc/</literal>, depending on where you told the
14bootstrap program to install the binary packages.</para> 14bootstrap program to install the binary packages.</para>
@@ -153,26 +153,65 @@ works. @@ -153,26 +153,65 @@ works.
153 support. <varname>USE_DESTDIR=full</varname> needs <filename 153 support. <varname>USE_DESTDIR=full</varname> needs <filename
154 role="pkg">pkgtools/pkg_install</filename> version 20070802 (or 154 role="pkg">pkgtools/pkg_install</filename> version 20070802 (or
155 newer). It might become the default DESTDIR support later.</para> 155 newer). It might become the default DESTDIR support later.</para>
156 <para>DESTDIR support changes the behaviour of various targets 156 <para>DESTDIR support changes the behaviour of various targets
157 slightly. To install a package after building it, use 157 slightly. To install a package after building it, use
158 <literal>package-install</literal>. <literal>package</literal> and 158 <literal>package-install</literal>. <literal>package</literal> and
159 <literal>install</literal> don't do that any 159 <literal>install</literal> don't do that any
160 longer. <literal>package-install</literal> can be used as 160 longer. <literal>package-install</literal> can be used as
161 <varname>DEPENDS_TARGET</varname>. <literal>bin-install</literal> 161 <varname>DEPENDS_TARGET</varname>. <literal>bin-install</literal>
162 will ask for the root password to install the package and fail, 162 will ask for the root password to install the package and fail,
163 <literal>package-install</literal> will ask again.</para> 163 <literal>package-install</literal> will ask again.</para>
164 <para>With basic DESTDIR support, <userinput>make 164 <para>With basic DESTDIR support, <userinput>make
165 clean</userinput> needs to be run as root.</para> 165 clean</userinput> needs to be run as root.</para>
 166
 167 <para>Considering the <filename>foo/bar</filename> package,
 168 DESTDIR full support can be tested using the following commands
 169
 170<programlisting>
 171&uprompt; id
 172uid=1000(myusername) gid=100(users) groups=100(users),0(wheel)
 173&uprompt; mkdir $HOME/packages
 174&uprompt; cd $PKGSRCDIR/foo/bar
 175</programlisting>
 176
 177 Verify <varname>DESTDIR</varname> full support, no root privileges
 178 should be needed
 179
 180<programlisting>
 181&uprompt; make USE_DESTDIR=full install
 182</programlisting>
 183
 184 Create a package without root privileges
 185
 186<programlisting>
 187&uprompt; make USE_DESTDIR=full PACKAGES=$HOME/packages package
 188</programlisting>
 189
 190 For the following command, you must be able to gain root
 191 privileges using &man.su.1;
 192
 193<programlisting>
 194&uprompt; make USE_DESTDIR=full PACKAGES=$HOME/packages package-install
 195</programlisting>
 196
 197 Then, as a simple user
 198
 199<programlisting>
 200&uprompt; make clean
 201</programlisting>
 202
 203 </para>
 204
166 </sect1> 205 </sect1>
167 206
168<sect1 id="conf.compiler"> 207<sect1 id="conf.compiler">
169<title>Selecting and configuring the compiler</title> 208<title>Selecting and configuring the compiler</title>
170 209
171 <sect2 id="selecting-the-compiler"> 210 <sect2 id="selecting-the-compiler">
172 <title>Selecting the compiler</title> 211 <title>Selecting the compiler</title>
173 212
174 <para>By default, pkgsrc will use GCC to build packages. This may be 213 <para>By default, pkgsrc will use GCC to build packages. This may be
175 overridden by setting the following variables in /etc/mk.conf:</para> 214 overridden by setting the following variables in /etc/mk.conf:</para>
176 215
177 <variablelist> 216 <variablelist>
178 <varlistentry> 217 <varlistentry>

cvs diff -r1.7 -r1.8 pkgsrc/doc/guide/files/creating.xml (expand / switch to unified diff)

--- pkgsrc/doc/guide/files/creating.xml 2007/06/01 11:07:24 1.7
+++ pkgsrc/doc/guide/files/creating.xml 2009/03/05 13:08:02 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1<!-- $NetBSD: creating.xml,v 1.7 2007/06/01 11:07:24 rillig Exp $ --> 1<!-- $NetBSD: creating.xml,v 1.8 2009/03/05 13:08:02 imil Exp $ -->
2 2
3<chapter id="creating"> 3<chapter id="creating">
4<title>Creating a new pkgsrc package from scratch</title> 4<title>Creating a new pkgsrc package from scratch</title>
5 5
6<para>When you find a package that is not yet in pkgsrc, you 6<para>When you find a package that is not yet in pkgsrc, you
7most likely have a URL from where you can download the source 7most likely have a URL from where you can download the source
8code. Starting with this URL, creating a package involves only a 8code. Starting with this URL, creating a package involves only a
9few steps.</para> 9few steps.</para>
10 10
11<procedure> 11<procedure>
12 12
13<step><para>First, install the packages <filename 13<step><para>First, install the packages <filename
14role="pkg">pkgtools/url2pkg</filename> and <filename 14role="pkg">pkgtools/url2pkg</filename> and <filename
@@ -117,26 +117,79 @@ package from the set of installed files. @@ -117,26 +117,79 @@ package from the set of installed files.
117<command>url2pkg</command>, including dependencies.</para> 117<command>url2pkg</command>, including dependencies.</para>
118 118
119</sect2> 119</sect2>
120 120
121<sect2 id="creating.kde-app"> 121<sect2 id="creating.kde-app">
122<title>KDE applications</title> 122<title>KDE applications</title>
123 123
124<para>KDE applications should always include 124<para>KDE applications should always include
125<filename>meta-pkgs/kde3/kde3.mk</filename>, which contains numerous 125<filename>meta-pkgs/kde3/kde3.mk</filename>, which contains numerous
126settings that are typical of KDE packages.</para> 126settings that are typical of KDE packages.</para>
127 127
128</sect2> 128</sect2>
129 129
 130<sect2 id="creating.python-module">
 131<title>Python modules and programs</title>
 132
 133<para>Python modules and programs packages are easily created using a
 134set of predefined variables.</para>
 135
 136<para>Most Python packages use either <quote>distutils</quote> or
 137easy-setup (<quote>eggs</quote>).
 138If the software uses <quote>distutils</quote>, set the
 139<varname>PYDISTUTILSPKG</varname> variable to <quote>yes</quote> so
 140pkgsrc will make use of this framework.
 141<quote>distutils</quote> uses a script called <filename>setup.py</filename>,
 142if the <quote>distutils</quote> driver is not called
 143<filename>setup.py</filename>, set the <varname>PYSETUP</varname> variable
 144to the name of the script.</para>
 145
 146<para>
 147If the default Python versions are not supported by the software, set the
 148<varname>PYTHON_VERSIONS_ACCEPTED</varname> variable to the Python versions
 149the software is known to work with, from the most recent to the older
 150one, e.g.
 151<programlisting>
 152PYTHON_VERSIONS_ACCEPTED= 25 24 23
 153</programlisting></para>
 154
 155<para>
 156If the packaged software is a Python module, include
 157<quote><filename>../../lang/python/extension.mk</filename></quote>.
 158In this case, the package directory should be called
 159<quote>py-software</quote> and <varname>PKGNAME</varname> should be set to
 160<quote>${PYPKGPREFIX}-${DISTNAME}</quote>, e.g.
 161<programlisting>
 162DISTNAME= foopymodule-1.2.10
 163PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
 164</programlisting></para>
 165
 166<para>If it is an application, also include
 167<quote><filename>../../lang/python/application.mk</filename></quote>
 168before <quote>extension.mk</quote>.</para>
 169
 170<para>If the packaged software, either it is an application or a module, is
 171egg-aware, you only need to include
 172<quote><filename>../../lang/python/egg.mk</filename></quote>.</para>
 173
 174<para>In order to correctly set the path to the Python interpreter, use the
 175<varname>REPLACE_PYTHON</varname> variable and set it to the list of files
 176that must be corrected. For example :
 177<programlisting>
 178REPLACE_PYTHON= ${WRKSRC}/*.py
 179</programlisting></para>
 180
 181</sect2>
 182
130</sect1> 183</sect1>
131 184
132<sect1 id="creating.examples"> 185<sect1 id="creating.examples">
133<title>Examples</title> 186<title>Examples</title>
134 187
135<sect2 id="creating.nvu"> 188<sect2 id="creating.nvu">
136<title>How the www/nvu package came into pkgsrc</title> 189<title>How the www/nvu package came into pkgsrc</title>
137 190
138<sect3 id="creating.nvu.init"> 191<sect3 id="creating.nvu.init">
139<title>The initial package</title> 192<title>The initial package</title>
140 193
141<para>Looking at the file <filename>pkgsrc/doc/TODO</filename>, I saw 194<para>Looking at the file <filename>pkgsrc/doc/TODO</filename>, I saw
142that the <quote>nvu</quote> package has not yet been imported into 195that the <quote>nvu</quote> package has not yet been imported into