diff options
Diffstat (limited to 'doc/guide/files/fixes.xml')
-rw-r--r-- | doc/guide/files/fixes.xml | 230 |
1 files changed, 116 insertions, 114 deletions
diff --git a/doc/guide/files/fixes.xml b/doc/guide/files/fixes.xml index 438341fed67..fd54bf2ed07 100644 --- a/doc/guide/files/fixes.xml +++ b/doc/guide/files/fixes.xml @@ -1,4 +1,4 @@ -<!-- $NetBSD: fixes.xml,v 1.86 2007/06/01 08:53:06 rillig Exp $ --> +<!-- $NetBSD: fixes.xml,v 1.87 2007/06/01 11:07:25 rillig Exp $ --> <chapter id="fixes"> <?dbhtml filename="fixes.html"?> <title>Making your package work</title> @@ -81,13 +81,13 @@ <filename>Makefile</filename>, e.g.:</para> <programlisting> - INTERACTIVE_STAGE= build +INTERACTIVE_STAGE= build </programlisting> <para>Multiple interactive stages can be specified:</para> <programlisting> - INTERACTIVE_STAGE= configure install +INTERACTIVE_STAGE= configure install </programlisting> <para>The user can then decide to skip this package by setting the @@ -147,7 +147,7 @@ role="pkg">graphics/xv</filename>:</para> <programlisting> - LICENSE= xv-license +LICENSE= xv-license </programlisting> <para>When trying to build, the user will get a notice that the @@ -155,12 +155,12 @@ <varname>ACCEPTABLE_LICENSES</varname> variable:</para> <programlisting> - &cprompt; <userinput>make</userinput> - ===> xv-3.10anb9 has an unacceptable license: xv-license. - ===> To view the license, enter "/usr/bin/make show-license". - ===> To indicate acceptance, add this line to your /etc/mk.conf: - ===> ACCEPTABLE_LICENSES+=xv-license - *** Error code 1 +&cprompt; <userinput>make</userinput> +===> xv-3.10anb9 has an unacceptable license: xv-license. +===> To view the license, enter "/usr/bin/make show-license". +===> To indicate acceptance, add this line to your /etc/mk.conf: +===> ACCEPTABLE_LICENSES+=xv-license +*** Error code 1 </programlisting> <para>The license can be viewed with <command>make @@ -170,7 +170,7 @@ that license:</para> <programlisting> - ACCEPTABLE_LICENSES+=xv-license +ACCEPTABLE_LICENSES+=xv-license </programlisting> <para>When adding a package with a new license, the license text @@ -306,7 +306,7 @@ <varname>DEPENDS</varname> definition is:</para> <programlisting> - <pre-req-package-name>:../../<category>/<pre-req-package> +<pre-req-package-name>:../../<category>/<pre-req-package> </programlisting> <para>Please note that the <quote>pre-req-package-name</quote> @@ -320,7 +320,7 @@ <filename>buildlink3.mk</filename> file available, use it:</para> <programlisting> - .include "../../graphics/jpeg/buildlink3.mk" +.include "../../graphics/jpeg/buildlink3.mk" </programlisting> </listitem> @@ -331,7 +331,7 @@ definition:</para> <programlisting> - BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf +BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf </programlisting> </listitem> @@ -343,13 +343,13 @@ <varname>DEPENDS</varname> definition. For example:</para> <programlisting> - DEPENDS+= xpm-3.4j:../../graphics/xpm +DEPENDS+= xpm-3.4j:../../graphics/xpm </programlisting> <para>You can also use wildcards in package dependences:</para> <programlisting> - DEPENDS+= xpm-[0-9]*:../../graphics/xpm +DEPENDS+= xpm-[0-9]*:../../graphics/xpm </programlisting> <para>Note that such wildcard dependencies are retained when @@ -368,7 +368,7 @@ pre-requisite:</para> <programlisting> - DEPENDS+= tiff>=3.5.4:../../graphics/tiff +DEPENDS+= tiff>=3.5.4:../../graphics/tiff </programlisting> <para>This means that the package will build against version @@ -385,7 +385,7 @@ <varname>ABI_DEPENDS</varname>:</para> <programlisting> - ABI_DEPENDS+= tiff>=3.6.1:../../graphics/tiff +ABI_DEPENDS+= tiff>=3.6.1:../../graphics/tiff </programlisting> <para>In addition to the above <varname>DEPENDS</varname> @@ -426,7 +426,7 @@ when it runs, and that is specified:</para> <programlisting> - DEPENDS+= teTeX-[0-9]*:../../print/teTeX +DEPENDS+= teTeX-[0-9]*:../../print/teTeX </programlisting> <para>The comment about wildcard dependencies from previous @@ -462,13 +462,13 @@ <filename>pkgsrc/x11/Xaw3d/Makefile</filename>:</para> <programlisting> - CONFLICTS= Xaw-Xpm-[0-9]* +CONFLICTS= Xaw-Xpm-[0-9]* </programlisting> <para>and in <filename>pkgsrc/x11/Xaw-Xpm/Makefile</filename>:</para> <programlisting> - CONFLICTS= Xaw3d-[0-9]* +CONFLICTS= Xaw3d-[0-9]* </programlisting> <para>Packages will automatically conflict with other packages @@ -555,8 +555,8 @@ <quote>.</quote> by the package tools. e.g.</para> <programlisting> - DISTNAME= foo-17.42 - PKGREVISION= 9 +DISTNAME= foo-17.42 +PKGREVISION= 9 </programlisting> <para>will result in a <varname>PKGNAME</varname> of @@ -570,7 +570,7 @@ minor release of the above package, things should be like:</para> <programlisting> - DISTNAME= foo-17.43 +DISTNAME= foo-17.43 </programlisting> <para><varname>PKGREVISION</varname> should be incremented for any @@ -585,21 +585,21 @@ changes that do not merit increasing <varname>PKGREVISION</varname> are:</para> - <programlisting> - Changing <varname>HOMEPAGE</varname>, <varname>MAINTAINER</varname>, - or comments in Makefile. - Changing build variables if the resulting binary package is the same. - Changing <filename>DESCR</filename>. - Adding <varname>PKG_OPTIONS</varname> if the default options don't change. - </programlisting> + <itemizedlist><listitem> + <para>Changing <varname>HOMEPAGE</varname>, <varname>MAINTAINER</varname>, + or comments in Makefile.</para></listitem><listitem><para> + Changing build variables if the resulting binary package is the same.</para></listitem><listitem><para> + Changing <filename>DESCR</filename>.</para></listitem><listitem><para> + Adding <varname>PKG_OPTIONS</varname> if the default options don't change.</para></listitem> + </itemizedlist> <para>Examples of changes that do merit an increase to <varname>PKGREVISION</varname> include:</para> - <programlisting> - Security fixes - Changes or additions to a patch file - Changes to the <filename>PLIST</filename> - </programlisting> + <itemizedlist><listitem><para> + Security fixes</para></listitem><listitem><para> + Changes or additions to a patch file</para></listitem><listitem><para> + Changes to the <filename>PLIST</filename></para></listitem> + </itemizedlist> <para>PKGREVISION must also be incremented when dependencies have ABI changes.</para> @@ -615,13 +615,13 @@ Example:</para> <programlisting> - SUBST_CLASSES+= fix-paths - SUBST_STAGE.fix-paths= pre-configure - SUBST_MESSAGE.fix-paths= Fixing absolute paths. - SUBST_FILES.fix-paths= src/*.c - SUBST_FILES.fix-paths+= scripts/*.sh - SUBST_SED.fix-paths= -e 's,"/usr/local,"${PREFIX},g' - SUBST_SED.fix-paths+= -e 's,"/var/log,"${VARBASE}/log,g' +SUBST_CLASSES+= fix-paths +SUBST_STAGE.fix-paths= pre-configure +SUBST_MESSAGE.fix-paths= Fixing absolute paths. +SUBST_FILES.fix-paths= src/*.c +SUBST_FILES.fix-paths+= scripts/*.sh +SUBST_SED.fix-paths= -e 's,"/usr/local,"${PREFIX},g' +SUBST_SED.fix-paths+= -e 's,"/var/log,"${VARBASE}/log,g' </programlisting> <para><varname>SUBST_CLASSES</varname> is a list of identifiers @@ -695,9 +695,9 @@ displayed to the user before aborting the build. Example:</para> <programlisting> - FETCH_MESSAGE= "Please download the files" - FETCH_MESSAGE+= " "${DISTFILES:Q} - FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"." +FETCH_MESSAGE= "Please download the files" +FETCH_MESSAGE+= " "${DISTFILES:Q} +FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"." </programlisting> </sect2> @@ -780,8 +780,11 @@ -Bshareable</quote> commands, and instead use:</para> <programlisting> - ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \ - -rpath ${PREFIX}/lib -version-info major:minor +${LIBTOOL} --mode=link \ + ${CC} -o ${.TARGET:.a=.la} \ + ${OBJS:.o=.lo} \ + -rpath ${PREFIX}/lib \ + -version-info major:minor </programlisting> <para>Note that the library is changed to have a @@ -799,22 +802,22 @@ <para>From the libtool manual:</para> <programlisting> - So, libtool library versions are described by three integers: +So, libtool library versions are described by three integers: - CURRENT - The most recent interface number that this library implements. +CURRENT +The most recent interface number that this library implements. - REVISION - The implementation number of the CURRENT interface. +REVISION +The implementation number of the CURRENT interface. - AGE - The difference between the newest and oldest interfaces that - this library implements. In other words, the library implements - all the interface numbers in the range from number `CURRENT - - AGE' to `CURRENT'. +AGE +The difference between the newest and oldest interfaces that +this library implements. In other words, the library implements +all the interface numbers in the range from number `CURRENT - +AGE' to `CURRENT'. - If two libraries have identical CURRENT and AGE numbers, then the - dynamic linker chooses the library with the greater REVISION number. +If two libraries have identical CURRENT and AGE numbers, then the +dynamic linker chooses the library with the greater REVISION number. </programlisting> <para>The <quote>-release</quote> option will produce @@ -857,13 +860,13 @@ <filename>.la</filename> file. e.g.</para> <programlisting> - ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib +${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib </programlisting> <para>should be changed to:</para> <programlisting> - ${LIBTOOL} --mode=link ${CC} -o <replaceable>someprog</replaceable> <replaceable>../somelib/somelib.la</replaceable> +${LIBTOOL} --mode=link ${CC} -o <replaceable>someprog</replaceable> <replaceable>../somelib/somelib.la</replaceable> </programlisting> <para>and it will do the right thing with the libraries.</para> @@ -876,7 +879,7 @@ <filename>.la</filename>. e.g.</para> <programlisting> - ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib +${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib </programlisting> <para>This will install the static <filename>.a</filename>, @@ -961,29 +964,28 @@ <para>For packages that need only autoconf:</para> <programlisting> - AUTOCONF_REQD= 2.50 # if default version is not good enough - USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13 - ... +AUTOCONF_REQD= 2.50 # if default version is not good enough +USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13 +... - pre-configure: - cd ${WRKSRC}; autoconf +pre-configure: + cd ${WRKSRC} && autoconf - ... +... </programlisting> <para>and for packages that need automake and autoconf:</para> <programlisting> - AUTOMAKE_REQD= 1.7.1 # if default version is not good enough - USE_TOOLS+= automake # use "automake14" for automake-1.4 - ... +AUTOMAKE_REQD= 1.7.1 # if default version is not good enough +USE_TOOLS+= automake # use "automake14" for automake-1.4 +... - pre-configure: - cd ${WRKSRC}; \ - aclocal; autoheader; \ - automake -a --foreign -i; autoconf +pre-configure: + set -e; cd ${WRKSRC}; \ + aclocal; autoheader; automake -a --foreign -i; autoconf - ... +... </programlisting> <para>Packages which use GNU Automake will almost certainly @@ -1117,26 +1119,26 @@ rest of the world, you should use the following code.</para> <programlisting> - #include <sys/param.h> - #if (defined(BSD) && BSD >= 199306) - /* BSD-specific code goes here */ - #else - /* non-BSD-specific code goes here */ - #endif +#include <sys/param.h> +#if (defined(BSD) && BSD >= 199306) +/* BSD-specific code goes here */ +#else +/* non-BSD-specific code goes here */ +#endif </programlisting> <para>If this distinction is not fine enough, you can also test for the following macros.</para> <programlisting> - FreeBSD __FreeBSD__ - DragonFly __DragonFly__ - Interix __INTERIX - IRIX __sgi (TODO: get a definite source for this) - Linux linux, __linux, __linux__ - NetBSD __NetBSD__ - OpenBSD __OpenBSD__ - Solaris sun, __sun +FreeBSD __FreeBSD__ +DragonFly __DragonFly__ +Interix __INTERIX +IRIX __sgi (TODO: get a definite source for this) +Linux linux, __linux, __linux__ +NetBSD __NetBSD__ +OpenBSD __OpenBSD__ +Solaris sun, __sun </programlisting> </sect3> @@ -1144,9 +1146,9 @@ <title>C preprocessor macros to identify the hardware architecture</title> <programlisting> - i386 i386, __i386, __i386__ - MIPS __mips - SPARC sparc, __sparc +i386 i386, __i386, __i386__ +MIPS __mips +SPARC sparc, __sparc </programlisting> </sect3> @@ -1154,10 +1156,10 @@ <title>C preprocessor macros to identify the compiler</title> <programlisting> - GCC __GNUC__ (major version), __GNUC_MINOR__ - MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41) - SunPro __SUNPRO_C (0x570 for Sun C 5.7) - SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8) +GCC __GNUC__ (major version), __GNUC_MINOR__ +MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41) +SunPro __SUNPRO_C (0x570 for Sun C 5.7) +SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8) </programlisting> </sect3> @@ -1215,18 +1217,18 @@ possibility. That compiler cannot handle the following code:</para> <programlisting> - extern int extern_func(int); +extern int extern_func(int); - static inline int - inline_func(int x) - { +static inline int +inline_func(int x) +{ return extern_func(x); - } +} - int main(void) - { +int main(void) +{ return 0; - } +} </programlisting> <para>It generates the code for <function>inline_func</function> even if @@ -1266,8 +1268,8 @@ of functions.</para> <literal>${INSTALL_*_DIR}</literal> like this:</para> <programlisting> - ${INSTALL_DATA_DIR} ${PREFIX}/dir1 - ${INSTALL_DATA_DIR} ${PREFIX}/dir2 +${INSTALL_DATA_DIR} ${PREFIX}/dir1 +${INSTALL_DATA_DIR} ${PREFIX}/dir2 </programlisting> <para>You can also just append <quote><literal>dir1 @@ -1345,11 +1347,11 @@ of functions.</para> shall use <command>tclsh</command> in this example):</para> <programlisting> - REPLACE_INTERPRETER+= tcl - REPLACE.tcl.old= .*/bin/tclsh - REPLACE.tcl.new= ${PREFIX}/bin/tclsh - REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed, - # relative to ${WRKSRC}, just as in REPLACE_PERL +REPLACE_INTERPRETER+= tcl +REPLACE.tcl.old= .*/bin/tclsh +REPLACE.tcl.new= ${PREFIX}/bin/tclsh +REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed, +# relative to ${WRKSRC}, just as in REPLACE_PERL </programlisting> <note><para>Before March 2006, these variables were called @@ -1380,7 +1382,7 @@ of functions.</para> paths to packlist files, e.g.:</para> <programlisting> - PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist +PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist </programlisting> <para>The variables <varname>PERL5_SITELIB</varname>, |