Annotation of htdocs/docs/pkgsrc/creating.html, revision 1.130

1.120     sevan       1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
1.1       dsieger     2: <html>
                      3: <head>
                      4: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
1.128     rillig      5: <title>Chapter 12. Creating a new pkgsrc package from scratch</title>
1.26      spz         6: <link rel="stylesheet" type="text/css" href="/global.css">
1.1       dsieger     7: <meta name="generator" content="DocBook XSL Stylesheets VX.X.X">
1.15      rillig      8: <link rel="home" href="index.html" title="The pkgsrc guide">
1.1       dsieger     9: <link rel="up" href="developers-guide.html" title="Part II. The pkgsrc developer's guide">
1.128     rillig     10: <link rel="prev" href="help-devel.html" title="Chapter 11. Getting help">
                     11: <link rel="next" href="components.html" title="Chapter 13. Package components - files, directories and contents">
1.1       dsieger    12: </head>
                     13: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
                     14: <div class="navheader">
                     15: <table width="100%" summary="Navigation header">
1.128     rillig     16: <tr><th colspan="3" align="center">Chapter 12. Creating a new pkgsrc package from scratch</th></tr>
1.1       dsieger    17: <tr>
                     18: <td width="20%" align="left">
1.128     rillig     19: <a accesskey="p" href="help-devel.html">Prev</a> </td>
1.1       dsieger    20: <th width="60%" align="center">Part II. The pkgsrc developer's guide</th>
                     21: <td width="20%" align="right"> <a accesskey="n" href="components.html">Next</a>
                     22: </td>
                     23: </tr>
                     24: </table>
                     25: <hr>
                     26: </div>
1.42      asau       27: <div class="chapter">
1.1       dsieger    28: <div class="titlepage"><div><div><h2 class="title">
1.128     rillig     29: <a name="creating"></a>Chapter 12. Creating a new pkgsrc package from scratch</h2></div></div></div>
1.1       dsieger    30: <div class="toc">
                     31: <p><b>Table of Contents</b></p>
1.100     leot       32: <dl class="toc">
1.128     rillig     33: <dt><span class="sect1"><a href="creating.html#creating.common">12.1. Common types of packages</a></span></dt>
1.1       dsieger    34: <dd><dl>
1.128     rillig     35: <dt><span class="sect2"><a href="creating.html#creating.perl-module">12.1.1. Perl modules</a></span></dt>
                     36: <dt><span class="sect2"><a href="creating.html#creating.python-module">12.1.2. Python modules and programs</a></span></dt>
1.130   ! brook      37: <dt><span class="sect2"><a href="creating.html#creating.R-package">12.1.3. R packages</a></span></dt>
        !            38: <dt><span class="sect2"><a href="creating.html#creating.TeX-package">12.1.4. TeXlive packages</a></span></dt>
1.1       dsieger    39: </dl></dd>
1.128     rillig     40: <dt><span class="sect1"><a href="creating.html#creating.examples">12.2. Examples</a></span></dt>
                     41: <dd><dl><dt><span class="sect2"><a href="creating.html#creating.nvu">12.2.1. How the www/nvu package came into pkgsrc</a></span></dt></dl></dd>
1.1       dsieger    42: </dl>
                     43: </div>
                     44: <p>When you find a package that is not yet in pkgsrc, you
                     45: most likely have a URL from where you can download the source
                     46: code. Starting with this URL, creating a package involves only a
                     47: few steps.</p>
1.24      wiz        48: <div class="procedure"><ol class="procedure" type="1">
1.126     leot       49: <li class="step"><p>First, install the packages <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/url2pkg/README.html" target="_top"><code class="filename">pkgtools/url2pkg</code></a> and <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>.</p></li>
1.42      asau       50: <li class="step"><p>Then, choose one of the top-level directories as the
1.1       dsieger    51: category in which you want to place your package. You can also create a
                     52: directory of your own (maybe called <code class="filename">local</code>). In that
                     53: category directory, create another directory for your package and change
                     54: into it.</p></li>
1.42      asau       55: <li class="step"><p>Run the program <span class="command"><strong>url2pkg</strong></span>, which will ask
1.1       dsieger    56: you for a URL. Enter the URL of the distribution file (in most cases a
                     57: <code class="filename">.tar.gz</code> file) and watch how the basic ingredients
                     58: of your package are created automatically. The distribution file is
                     59: extracted automatically to fill in some details in the
                     60: <code class="filename">Makefile</code> that would otherwise have to be done
                     61: manually.</p></li>
1.42      asau       62: <li class="step">
1.1       dsieger    63: <p>Examine the extracted files to determine the dependencies of
                     64: your package. Ideally, this is mentioned in some
                     65: <code class="filename">README</code> file, but things may differ. For each of
                     66: these dependencies, look where it exists in pkgsrc, and if there is a
                     67: file called <code class="filename">buildlink3.mk</code> in that directory, add a
                     68: line to your package <code class="filename">Makefile</code> which includes that
                     69: file just before the last line. If the
1.26      spz        70: <code class="filename">buildlink3.mk</code> file does not exist, it must be
                     71: created first. The <code class="filename">buildlink3.mk</code> file makes sure that the package's include files and libraries are provided.</p>
                     72: <p>If you just need binaries from a package, add a
1.1       dsieger    73: <code class="varname">DEPENDS</code> line to the Makefile, which specifies the
                     74: version of the dependency and where it can be found in pkgsrc. This line
                     75: should be placed in the third paragraph. If the dependency is only
                     76: needed for building the package, but not when using it, use
1.129     leot       77: <code class="varname">TOOL_DEPENDS</code> or <code class="varname">BUILD_DEPENDS</code>
                     78: instead of <code class="varname">DEPENDS</code>.
                     79: The difference between <code class="varname">TOOL_DEPENDS</code> and
                     80: <code class="varname">BUILD_DEPENDS</code> occurs when cross-compiling:
                     81: <code class="varname">TOOL_DEPENDS</code> are <span class="emphasis"><em>native</em></span>
                     82: packages, i.e. packages for the architecture where the package
                     83: is built;
                     84: <code class="varname">BUILD_DEPENDS</code> are <span class="emphasis"><em>target</em></span>
                     85: packages, i.e. packages for the architecture for which the package
                     86: is built.
1.1       dsieger    87: Your package may then look like this:</p>
                     88: <pre class="programlisting">
                     89: [...]
                     90: 
1.129     leot       91: TOOL_DEPENDS+=  libxslt-[0-9]*:../../textproc/libxslt
1.1       dsieger    92: DEPENDS+=       screen-[0-9]*:../../misc/screen
                     93: DEPENDS+=       screen&gt;=4.0:../../misc/screen
                     94: 
                     95: [...]
                     96: 
                     97: .include "../../<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>package</code></em>/buildlink3.mk"
                     98: .include "../../devel/glib2/buildlink3.mk"
                     99: .include "../../mk/bsd.pkg.mk"
                    100: </pre>
                    101: </li>
1.42      asau      102: <li class="step"><p>Run <span class="command"><strong>pkglint</strong></span> to see what things still need
1.24      wiz       103: to be done to make your package a <span class="quote">&#8220;<span class="quote">good</span>&#8221;</span> one. If you don't
1.10      hubertf   104: know what pkglint's warnings want to tell you, try <span class="command"><strong>pkglint
                    105: --explain</strong></span> or <span class="command"><strong>pkglint
1.1       dsieger   106: -e</strong></span>, which outputs additional
                    107: explanations.</p></li>
1.42      asau      108: <li class="step"><p>In many cases the package is not yet ready to build. You can
1.128     rillig    109: find instructions for the most common cases in the next section, <a class="xref" href="creating.html#creating.common" title="12.1. Common types of packages">Section 12.1, &#8220;Common types of packages&#8221;</a>. After you have followed the instructions
1.1       dsieger   110: over there, you can hopefully continue here.</p></li>
1.42      asau      111: <li class="step"><p>Run <span class="command"><strong>bmake clean</strong></span> to clean the working
1.1       dsieger   112: directory from the extracted files. Besides these files, a lot of cache
                    113: files and other system information has been saved in the working
                    114: directory, which may become wrong after you edited the
                    115: <code class="filename">Makefile</code>.</p></li>
1.42      asau      116: <li class="step"><p>Now, run <span class="command"><strong>bmake</strong></span> to build the package. For
1.128     rillig    117: the various things that can go wrong in this phase, consult <a class="xref" href="fixes.html" title="Chapter 21. Making your package work">Chapter 21, <i>Making your package work</i></a>.</p></li>
1.42      asau      118: <li class="step"><p>When the package builds fine, the next step is to install
1.10      hubertf   119: the package. Run <span class="command"><strong>bmake install</strong></span> and hope that
1.1       dsieger   120: everything works.</p></li>
1.42      asau      121: <li class="step"><p>Up to now, the file <code class="filename">PLIST</code>, which
1.1       dsieger   122: contains a list of the files that are installed by the package, is
1.10      hubertf   123: nearly empty. Run <span class="command"><strong>bmake print-PLIST
1.1       dsieger   124: &gt;PLIST</strong></span> to generate a probably correct list. Check
                    125: the file using your preferred text editor to see if the list of
                    126: files looks plausible.</p></li>
1.42      asau      127: <li class="step"><p>Run <span class="command"><strong>pkglint</strong></span> again to see if the generated
1.1       dsieger   128: <code class="filename">PLIST</code> contains garbage or not.</p></li>
1.42      asau      129: <li class="step"><p>When you ran <span class="command"><strong>bmake install</strong></span>, the package
1.1       dsieger   130: has been registered in the database of installed files, but with an
1.10      hubertf   131: empty list of files. To fix this, run <span class="command"><strong>bmake deinstall</strong></span>
                    132: and <span class="command"><strong>bmake install</strong></span> again. Now the package is
1.1       dsieger   133: registered with the list of files from
                    134: <code class="filename">PLIST</code>.</p></li>
1.42      asau      135: <li class="step"><p>Run <span class="command"><strong>bmake package</strong></span> to create a binary
1.1       dsieger   136: package from the set of installed files.</p></li>
                    137: </ol></div>
1.42      asau      138: <div class="sect1">
1.1       dsieger   139: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.128     rillig    140: <a name="creating.common"></a>12.1. Common types of packages</h2></div></div></div>
1.42      asau      141: <div class="sect2">
1.1       dsieger   142: <div class="titlepage"><div><div><h3 class="title">
1.128     rillig    143: <a name="creating.perl-module"></a>12.1.1. Perl modules</h3></div></div></div>
1.1       dsieger   144: <p>Simple Perl modules are handled automatically by
1.10      hubertf   145: <span class="command"><strong>url2pkg</strong></span>, including dependencies.</p>
1.1       dsieger   146: </div>
1.42      asau      147: <div class="sect2">
1.1       dsieger   148: <div class="titlepage"><div><div><h3 class="title">
1.128     rillig    149: <a name="creating.python-module"></a>12.1.2. Python modules and programs</h3></div></div></div>
1.17      imil      150: <p>Python modules and programs packages are easily created using a
                    151: set of predefined variables.</p>
                    152: <p>
1.63      wiz       153: If some Python versions are not supported by the software, set the
                    154: <code class="varname">PYTHON_VERSIONS_INCOMPATIBLE</code> variable to the Python versions
                    155: that are not supported, e.g.
1.17      imil      156: </p>
                    157: <pre class="programlisting">
1.93      sevan     158: PYTHON_VERSIONS_INCOMPATIBLE=       27
1.17      imil      159: </pre>
                    160: <p>
1.103     wiz       161: If the packaged software is a Python module, include one of
                    162: <code class="filename">../../lang/python/egg.mk</code>,
                    163: <code class="filename">../../lang/python/distutils.mk</code>, or
                    164: <code class="filename">../../lang/python/extension.mk</code>.</p>
                    165: <p>Most Python packages use either <span class="quote">&#8220;<span class="quote">distutils</span>&#8221;</span> or
                    166: easy-setup/setuptools (<span class="quote">&#8220;<span class="quote">eggs</span>&#8221;</span>).
                    167: if the packaged software is using setuptools, you only need
                    168: to include <span class="quote">&#8220;<span class="quote"><code class="filename">../../lang/python/egg.mk</code></span>&#8221;</span>.
                    169: Otherwise, if the software uses <span class="quote">&#8220;<span class="quote">distutils</span>&#8221;</span>, include 
                    170: <span class="quote">&#8220;<span class="quote"><code class="filename">../../lang/python/distutils.mk</code></span>&#8221;</span>.
                    171: so pkgsrc will use this framework.
                    172: <span class="quote">&#8220;<span class="quote">distutils</span>&#8221;</span> uses a script called <code class="filename">setup.py</code>,
                    173: if the <span class="quote">&#8220;<span class="quote">distutils</span>&#8221;</span> driver is not called
                    174: <code class="filename">setup.py</code>, set the <code class="varname">PYSETUP</code> variable
                    175: to the name of the script.</p>
                    176: <p>Either way, the package directory should be called
1.24      wiz       177: <span class="quote">&#8220;<span class="quote">py-software</span>&#8221;</span> and <code class="varname">PKGNAME</code> should be set to
                    178: <span class="quote">&#8220;<span class="quote">${PYPKGPREFIX}-${DISTNAME}</span>&#8221;</span>, e.g.
1.17      imil      179: </p>
                    180: <pre class="programlisting">
                    181: DISTNAME=   foopymodule-1.2.10
                    182: PKGNAME=    ${PYPKGPREFIX}-${DISTNAME}
                    183: </pre>
1.63      wiz       184: <p>If it is an application, include
                    185: <span class="quote">&#8220;<span class="quote"><code class="filename">../../lang/python/application.mk</code></span>&#8221;</span>.
                    186: In order to correctly set the path to the Python interpreter, use the
1.17      imil      187: <code class="varname">REPLACE_PYTHON</code> variable and set it to the list of files
1.36      wiz       188: (paths relative to <code class="varname">WRKSRC</code>) that must be corrected.
1.63      wiz       189: For example:
1.17      imil      190: </p>
                    191: <pre class="programlisting">
1.36      wiz       192: REPLACE_PYTHON=   *.py
1.17      imil      193: </pre>
1.63      wiz       194: <p>Some Python modules have separate distributions for Python-2.x
                    195: and Python-3.x support. In pkgsrc this is handled by the
                    196: <code class="filename">versioned_dependencies.mk</code> file. Set
                    197: <code class="varname">PYTHON_VERSIONED_DEPENDENCIES</code> to the list of
                    198: packages that should be depended upon and include
                    199: <span class="quote">&#8220;<span class="quote"><code class="filename">../../lang/python/versioned_dependencies.mk</code></span>&#8221;</span>,
                    200: then the pkgsrc infrastructure will depend on the appropriate package
                    201: version. For example:
                    202: </p>
                    203: <pre class="programlisting">
1.125     wiz       204: PYTHON_VERSIONED_DEPENDENCIES=dialog
1.63      wiz       205: </pre>
                    206: <p>
                    207: Look inside <code class="filename">versioned_dependencies.mk</code> for a list
                    208: of supported packages.</p>
1.17      imil      209: </div>
1.130   ! brook     210: <div class="sect2">
        !           211: <div class="titlepage"><div><div><h3 class="title">
        !           212: <a name="creating.R-package"></a>12.1.3. R packages</h3></div></div></div>
        !           213: <p>Simple R packages from <a class="ulink" href="https://cran.r-project.org/web/packages/available_packages_by_name.html" target="_top">CRAN</a>
        !           214: are handled automatically by <span class="command"><strong>R2pkg</strong></span>, which is
        !           215: available in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/R2pkg/README.html" target="_top"><code class="filename">pkgtools/R2pkg</code></a>.
        !           216: Individual packages (and optionally their dependencies) may be created
        !           217: and updated.  R packages generally follow the same form, and most of
        !           218: the relevant information needed is contained in a
        !           219: <code class="filename">DESCRIPTION</code> file as part of each R package on
        !           220: <a class="ulink" href="https://cran.r-project.org/web/packages/available_packages_by_name.html" target="_top">CRAN</a>.
        !           221: Consequently, <span class="command"><strong>R2pkg</strong></span> downloads that information and
        !           222: creates or updates a package in the canonical form.  The resulting
        !           223: package should be reviewed for correctness.</p>
        !           224: </div>
        !           225: <div class="sect2">
        !           226: <div class="titlepage"><div><div><h3 class="title">
        !           227: <a name="creating.TeX-package"></a>12.1.4. TeXlive packages</h3></div></div></div>
        !           228: <p>TeXlive packages from <a class="ulink" href="https://www.ctan.org/" target="_top">CTAN</a> are handled automatically by
        !           229: <span class="command"><strong>texlive2pkg</strong></span>, which is available in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/texlive2pkg/README.html" target="_top"><code class="filename">pkgtools/texlive2pkg</code></a>.</p>
        !           230: <p>If the TeXlive package name is not known, it may be useful to
        !           231: search <a class="ulink" href="https://www.ctan.org/" target="_top">CTAN</a>.  A
        !           232: <span class="quote">&#8220;<span class="quote">Contained in</span>&#8221;</span> field on the package page typically
        !           233: identifies the basename of the package file in the <a class="ulink" href="https://www.ctan.org/tex-archive/systems/texlive/tlnet/archive" target="_top">TeXlive
        !           234: archive</a>.</p>
        !           235: <p>If the TeXlive package name is known, download the files from
        !           236: the <a class="ulink" href="https://www.ctan.org/tex-archive/systems/texlive/tlnet/archive" target="_top">TeXlive
        !           237: archive</a>.  For package <code class="filename">foo</code>, you will need
        !           238: to download <code class="filename">foo.tar.xz</code>.  Most TeXlive packages
        !           239: also have associated documentation packages, so download
        !           240: <code class="filename">foo.doc.tar.xz</code> at the same time.  These files
        !           241: should be placed in the appropriate category directory, which is often
        !           242: but not always <code class="filename">print</code>.  Then run the following
        !           243: command in the category directory.</p>
        !           244: <pre class="programlisting">
        !           245: texlive2pkg foo.tar.xz foo.doc.tar.xz
        !           246: </pre>
        !           247: <p>This will create two packages, <code class="filename">tex-foo</code> and
        !           248: <code class="filename">tex-foo-doc</code>.  Be sure to check that both packages
        !           249: are correct.</p>
        !           250: </div>
1.1       dsieger   251: </div>
1.42      asau      252: <div class="sect1">
1.1       dsieger   253: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.128     rillig    254: <a name="creating.examples"></a>12.2. Examples</h2></div></div></div>
1.42      asau      255: <div class="sect2">
1.1       dsieger   256: <div class="titlepage"><div><div><h3 class="title">
1.128     rillig    257: <a name="creating.nvu"></a>12.2.1. How the www/nvu package came into pkgsrc</h3></div></div></div>
1.42      asau      258: <div class="sect3">
1.1       dsieger   259: <div class="titlepage"><div><div><h4 class="title">
1.128     rillig    260: <a name="creating.nvu.init"></a>12.2.1.1. The initial package</h4></div></div></div>
1.1       dsieger   261: <p>Looking at the file <code class="filename">pkgsrc/doc/TODO</code>, I saw
1.24      wiz       262: that the <span class="quote">&#8220;<span class="quote">nvu</span>&#8221;</span> package has not yet been imported into
1.1       dsieger   263: pkgsrc. As the description says it has to do with the web, the obvious
1.24      wiz       264: choice for the category is <span class="quote">&#8220;<span class="quote">www</span>&#8221;</span>.</p>
1.1       dsieger   265: <pre class="programlisting">
                    266: <code class="prompt">$</code> mkdir www/nvu
                    267: <code class="prompt">$</code> cd www/nvu
                    268: </pre>
                    269: <p>The web site says that the sources are available as a tar file, so
1.10      hubertf   270: I fed that URL to the <span class="command"><strong>url2pkg</strong></span> program:</p>
1.1       dsieger   271: <pre class="programlisting">
                    272: <code class="prompt">$</code> url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
                    273: </pre>
                    274: <p>My editor popped up, and I added a <code class="varname">PKGNAME</code> line
                    275: below the <code class="varname">DISTNAME</code> line, as the package name should
1.24      wiz       276: not have the word <span class="quote">&#8220;<span class="quote">sources</span>&#8221;</span> in it. I also filled in the
1.1       dsieger   277: <code class="varname">MAINTAINER</code>, <code class="varname">HOMEPAGE</code> and
                    278: <code class="varname">COMMENT</code> fields. Then the package
                    279: <code class="filename">Makefile</code> looked like that:</p>
                    280: <pre class="programlisting">
1.121     sevan     281: # $NetBSD $
1.1       dsieger   282: #
                    283: 
                    284: DISTNAME=       nvu-1.0-sources
                    285: PKGNAME=        nvu-1.0
                    286: CATEGORIES=     www
                    287: MASTER_SITES=   http://cvs.nvu.com/download/
                    288: EXTRACT_SUFX=   .tar.bz2
                    289: 
                    290: MAINTAINER=     rillig@NetBSD.org
                    291: HOMEPAGE=       http://cvs.nvu.com/
                    292: COMMENT=        Web Authoring System
                    293: 
                    294: # url2pkg-marker (please do not remove this line.)
                    295: .include "../../mk/bsd.pkg.mk"
                    296: </pre>
1.123     wiz       297: <p>On the first line of output above, an artificial space has been added between NetBSD and $,
1.121     sevan     298: this is a workaround to prevent CVS expanding to the filename of the
                    299: guide.</p>
1.1       dsieger   300: <p>Then, I quit the editor and watched pkgsrc downloading a large
                    301: source archive:</p>
                    302: <pre class="programlisting">
                    303: url2pkg&gt; Running "make makesum" ...
                    304: =&gt; Required installed package digest&gt;=20010302: digest-20060826 found
                    305: =&gt; Fetching nvu-1.0-sources.tar.bz2
                    306: Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
                    307: 100% |*************************************| 28992 KB  150.77 KB/s00:00 ETA
                    308: 29687976 bytes retrieved in 03:12 (150.77 KB/s)
                    309: url2pkg&gt; Running "make extract" ...
                    310: =&gt; Required installed package digest&gt;=20010302: digest-20060826 found
                    311: =&gt; Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
                    312: =&gt; Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
                    313: work.bacc -&gt; /tmp/roland/pkgsrc/www/nvu/work.bacc
                    314: ===&gt; Installing dependencies for nvu-1.0
                    315: ===&gt; Overriding tools for nvu-1.0
                    316: ===&gt; Extracting for nvu-1.0
                    317: url2pkg&gt; Adjusting the Makefile.
                    318: 
                    319: Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
                    320: 
                    321: Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
                    322: </pre>
                    323: </div>
1.42      asau      324: <div class="sect3">
1.1       dsieger   325: <div class="titlepage"><div><div><h4 class="title">
1.128     rillig    326: <a name="creating.nvu.problems"></a>12.2.1.2. Fixing all kinds of problems to make the package work</h4></div></div></div>
1.1       dsieger   327: <p>Now that the package has been extracted, let's see what's inside
                    328: it. The package has a <code class="filename">README.txt</code>, but that only
                    329: says something about mozilla, so it's probably useless for seeing what
                    330: dependencies this package has. But since there is a GNU configure script
                    331: in the package, let's hope that it will complain about everything it
                    332: needs.</p>
                    333: <pre class="programlisting">
                    334: <code class="prompt">$</code> bmake
                    335: =&gt; Required installed package digest&gt;=20010302: digest-20060826 found
                    336: =&gt; Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
                    337: =&gt; Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
                    338: ===&gt; Patching for nvu-1.0
                    339: ===&gt; Creating toolchain wrappers for nvu-1.0
                    340: ===&gt; Configuring for nvu-1.0
                    341: [...]
                    342: configure: error: Perl 5.004 or higher is required.
                    343: [...]
                    344: WARNING: Please add USE_TOOLS+=perl to the package Makefile.
                    345: [...]
                    346: </pre>
                    347: <p>That worked quite well. So I opened the package Makefile in my
                    348: editor, and since it already has a <code class="varname">USE_TOOLS</code> line, I
1.24      wiz       349: just appended <span class="quote">&#8220;<span class="quote">perl</span>&#8221;</span> to it. Since the dependencies of the
1.1       dsieger   350: package have changed now, and since a perl wrapper is automatically
1.24      wiz       351: installed in the <span class="quote">&#8220;<span class="quote">tools</span>&#8221;</span> phase, I need to build the package
1.1       dsieger   352: from scratch.</p>
                    353: <pre class="programlisting">
                    354: <code class="prompt">$</code> bmake clean
                    355: ===&gt; Cleaning for nvu-1.0
                    356: <code class="prompt">$</code> bmake
                    357: [...]
                    358: *** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
                    359: GNU Make.  You will not be able to build Mozilla without GNU Make.
                    360: [...]
                    361: </pre>
1.24      wiz       362: <p>So I added <span class="quote">&#8220;<span class="quote">gmake</span>&#8221;</span> to the
1.1       dsieger   363: <code class="varname">USE_TOOLS</code> line and tried again (from scratch).</p>
                    364: <pre class="programlisting">
                    365: [...]
                    366: checking for GTK - version &gt;= 1.2.0... no
                    367: *** Could not run GTK test program, checking why...
                    368: [...]
                    369: </pre>
                    370: <p>Now to the other dependencies. The first question is: Where is the
                    371: GTK package hidden in pkgsrc?</p>
                    372: <pre class="programlisting">
                    373: <code class="prompt">$</code> echo ../../*/gtk*
                    374: [many packages ...]
                    375: <code class="prompt">$</code> echo ../../*/gtk
                    376: ../../x11/gtk
                    377: <code class="prompt">$</code> echo ../../*/gtk2
                    378: ../../x11/gtk2
                    379: <code class="prompt">$</code> echo ../../*/gtk2/bui*
                    380: ../../x11/gtk2/buildlink3.mk
                    381: </pre>
                    382: <p>The first try was definitely too broad. The second one had exactly
                    383: one result, which is very good. But there is one pitfall with GNOME
                    384: packages. Before GNOME 2 had been released, there were already many
                    385: GNOME 1 packages in pkgsrc. To be able to continue to use these
                    386: packages, the GNOME 2 packages were imported as separate packages, and
1.24      wiz       387: their names usually have a <span class="quote">&#8220;<span class="quote">2</span>&#8221;</span> appended. So I checked
1.1       dsieger   388: whether this was the case here, and indeed it was.</p>
                    389: <p>Since the GTK2 package has a <code class="filename">buildlink3.mk</code>
                    390: file, adding the dependency is very easy. I just inserted an
                    391: <code class="literal">.include</code> line before the last line of the package
                    392: <code class="filename">Makefile</code>, so that it now looks like this:</p>
                    393: <pre class="programlisting">
                    394: [...]
                    395: .include "../../x11/gtk2/buildlink3.mk"
                    396: .include "../../mk/bsd.pkg.mk
                    397: </pre>
1.10      hubertf   398: <p>After another <span class="command"><strong>bmake clean &amp;&amp; bmake</strong></span>, the answer
1.1       dsieger   399: was:</p>
                    400: <pre class="programlisting">
                    401: [...]
                    402: checking for gtk-config... /home/roland/pkg/bin/gtk-config
                    403: checking for GTK - version &gt;= 1.2.0... no
                    404: *** Could not run GTK test program, checking why...
                    405: *** The test program failed to compile or link. See the file config.log for the
                    406: *** exact error that occured. This usually means GTK was incorrectly installed
                    407: *** or that you have moved GTK since it was installed. In the latter case, you
                    408: *** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
                    409: configure: error: Test for GTK failed.
                    410: [...]
                    411: </pre>
1.24      wiz       412: <p>In this particular case, the assumption that <span class="quote">&#8220;<span class="quote">every package
                    413: prefers GNOME 2</span>&#8221;</span> had been wrong. The first of the lines above
1.1       dsieger   414: told me that this package really wanted to have the GNOME 1 version of
                    415: GTK. If the package had looked for GTK2, it would have looked for
1.10      hubertf   416: <span class="command"><strong>pkg-config</strong></span> instead of <span class="command"><strong>gtk-config</strong></span>.
1.1       dsieger   417: So I changed the <code class="literal">x11/gtk2</code> to
                    418: <code class="literal">x11/gtk</code> in the package <code class="filename">Makefile</code>,
                    419: and tried again.</p>
                    420: <pre class="programlisting">
                    421: [...]
1.59      jnemeth   422: cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\"  [...]
1.1       dsieger   423: In file included from xpidl.c:42:
                    424: xpidl.h:53:24: libIDL/IDL.h: No such file or directory
                    425: In file included from xpidl.c:42:
                    426: xpidl.h:132: error: parse error before "IDL_ns"
                    427: [...]
                    428: </pre>
                    429: <p>The package still does not find all of its dependencies. Now the
                    430: question is: Which package provides the
                    431: <code class="filename">libIDL/IDL.h</code> header file?</p>
                    432: <pre class="programlisting">
                    433: <code class="prompt">$</code> echo ../../*/*idl*
                    434: ../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
                    435: <code class="prompt">$</code> echo ../../*/*IDL*
                    436: ../../net/libIDL
                    437: </pre>
                    438: <p>Let's take the one from the second try. So I included the
                    439: <code class="filename">../../net/libIDL/buildlink3.mk</code> file and tried
                    440: again. But the error didn't change. After digging through some of the
                    441: code, I concluded that the build process of the package was broken and
                    442: couldn't have ever worked, but since the Mozilla source tree is quite
                    443: large, I didn't want to fix it. So I added the following to the package
                    444: <code class="filename">Makefile</code> and tried again:</p>
                    445: <pre class="programlisting">
                    446: CPPFLAGS+=              -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
1.127     leot      447: BUILDLINK_TRANSFORM+=   l:IDL:IDL-2
1.1       dsieger   448: </pre>
                    449: <p>The latter line is needed because the package expects the library
                    450: <code class="filename">libIDL.so</code>, but only
                    451: <code class="filename">libIDL-2.so</code> is available. So I told the compiler
                    452: wrapper to rewrite that on the fly.</p>
                    453: <p>The next problem was related to a recent change of the FreeType
1.126     leot      454: interface. I looked up in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/seamonkey/README.html" target="_top"><code class="filename">www/seamonkey</code></a>
1.1       dsieger   455: which patch files were relevant for this issue and copied them to the
                    456: <code class="filename">patches</code> directory. Then I retried, fixed the
                    457: patches so that they applied cleanly and retried again. This time,
                    458: everything worked.</p>
                    459: </div>
1.42      asau      460: <div class="sect3">
1.1       dsieger   461: <div class="titlepage"><div><div><h4 class="title">
1.128     rillig    462: <a name="creating.nvu.inst"></a>12.2.1.3. Installing the package</h4></div></div></div>
1.1       dsieger   463: <pre class="programlisting">
                    464: <code class="prompt">$</code> bmake CHECK_FILES=no install
                    465: [...]
                    466: <code class="prompt">$</code> bmake print-PLIST &gt;PLIST
                    467: <code class="prompt">$</code> bmake deinstall
                    468: <code class="prompt">$</code> bmake install
                    469: </pre>
                    470: </div>
                    471: </div>
                    472: </div>
                    473: </div>
                    474: <div class="navfooter">
                    475: <hr>
                    476: <table width="100%" summary="Navigation footer">
                    477: <tr>
                    478: <td width="40%" align="left">
1.128     rillig    479: <a accesskey="p" href="help-devel.html">Prev</a> </td>
1.1       dsieger   480: <td width="20%" align="center"><a accesskey="u" href="developers-guide.html">Up</a></td>
                    481: <td width="40%" align="right"> <a accesskey="n" href="components.html">Next</a>
                    482: </td>
                    483: </tr>
                    484: <tr>
1.128     rillig    485: <td width="40%" align="left" valign="top">Chapter 11. Getting help </td>
1.1       dsieger   486: <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
1.128     rillig    487: <td width="40%" align="right" valign="top"> Chapter 13. Package components - files, directories and contents</td>
1.1       dsieger   488: </tr>
                    489: </table>
                    490: </div>
                    491: </body>
                    492: </html>

CVSweb <webmaster@jp.NetBSD.org>