Revamping of porting.sgml part 1. This commit does not change the contents
of any paragraphs; it just moves stuff around so translators can easily see what really changed in the next commit.
This commit is contained in:
parent
18bc479983
commit
b87b75d332
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=3755
1 changed files with 280 additions and 280 deletions
|
@ -1,4 +1,4 @@
|
|||
<!-- $Id: porting.sgml,v 1.112 1998-10-09 10:50:56 asami Exp $ -->
|
||||
<!-- $Id: porting.sgml,v 1.113 1998-11-07 11:44:43 asami Exp $ -->
|
||||
<!-- The FreeBSD Documentation Project -->
|
||||
|
||||
<sect1><heading>Porting an existing piece of free software<label id="porting"></heading>
|
||||
|
@ -24,9 +24,6 @@ Please refer to that file for more details on the inner workings of
|
|||
the ports collection. Even if you don't hack Makefiles daily, it is
|
||||
well commented, and you will still gain much knowledge from it.
|
||||
|
||||
<sect2>
|
||||
<heading>Before Starting the Port<label id="porting:starting"></heading>
|
||||
|
||||
<p>Note: Only a fraction of the overridable variables
|
||||
(<tt>${..}</tt>) are mentioned in this document. Most
|
||||
(if not all) are documented at the start of
|
||||
|
@ -36,146 +33,6 @@ well commented, and you will still gain much knowledge from it.
|
|||
using the correct value by typing `<tt>:set tabstop=4</tt>'
|
||||
once the file has been loaded.
|
||||
|
||||
<p>You may come across code that needs modifications or
|
||||
conditional compilation based upon what version of UNIX it is
|
||||
running under. If you need to make such changes to the code
|
||||
for conditional compilation, make sure you make the changes as
|
||||
general as possible so that we can back-port code to FreeBSD
|
||||
1.x systems and cross-port to other BSD systems such as 4.4BSD
|
||||
from CSRG, BSD/386, 386BSD, NetBSD, and OpenBSD.
|
||||
|
||||
<p>The preferred way to tell 4.3BSD/Reno (1990) and newer versions of
|
||||
the BSD code apart is by using the `<tt>BSD</tt>' macro
|
||||
defined in <tt><sys/param.h></tt>. Hopefully that file
|
||||
is already included; if not, add the code:
|
||||
|
||||
<tscreen><verb>
|
||||
#if (defined(__unix__) || defined(unix)) && !defined(USG)
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
</verb></tscreen>
|
||||
|
||||
<p>to the proper place in the <tt>.c</tt> file. We believe that every
|
||||
system that defines these to symbols has sys/param.h. If you find
|
||||
a system that doesn't, we would like to know. Please send
|
||||
mail to &a.ports;.
|
||||
|
||||
<p>Another way is to use the GNU Autoconf style of doing this:
|
||||
|
||||
<tscreen><verb>
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
</verb></tscreen>
|
||||
|
||||
Don't forget to add <tt>-DHAVE_SYS_PARAM_H</tt> to the <tt>CFLAGS</tt>
|
||||
in the Makefile for this method.
|
||||
|
||||
Once you have <tt><sys/param.h></tt> included, you may use:
|
||||
|
||||
<tscreen><verb>
|
||||
#if (defined(BSD) && (BSD >= 199103))
|
||||
</verb></tscreen>
|
||||
|
||||
to detect if the code is being compiled on a 4.3 Net2 code
|
||||
base or newer (e.g. FreeBSD 1.x, 4.3/Reno, NetBSD 0.9, 386BSD,
|
||||
BSD/386 1.1 and below).
|
||||
|
||||
Use:
|
||||
|
||||
<tscreen><verb>
|
||||
#if (defined(BSD) && (BSD >= 199306))
|
||||
</verb></tscreen>
|
||||
|
||||
to detect if the code is being compiled on a 4.4 code base or
|
||||
newer (e.g. FreeBSD 2.x, 4.4, NetBSD 1.0, BSD/386 2.0 or
|
||||
above).
|
||||
|
||||
The value of the BSD macro is 199506 for the 4.4BSD-Lite2 code
|
||||
base. This is stated for informational purposes only. It should
|
||||
not be used to distinguish between version of FreeBSD based only
|
||||
on 4.4-Lite vs. versions that have merged in changes from 4.4-Lite2.
|
||||
The __FreeBSD__ macro should be used instead.
|
||||
|
||||
<p>Use sparingly:
|
||||
|
||||
<itemize>
|
||||
<item><tt>__FreeBSD__</tt> is defined in all versions of
|
||||
FreeBSD. Use it if the change you are making ONLY affects
|
||||
FreeBSD. Porting gotchas like the use of
|
||||
<tt>sys_errlist[]</tt> vs <tt>strerror()</tt> are
|
||||
Berkeleyisms, not FreeBSD changes.
|
||||
|
||||
<item>In FreeBSD 2.x, <tt>__FreeBSD__</tt> is defined to be
|
||||
<tt>2</tt>. In earlier versions, it is <tt>1</tt>. Later
|
||||
versions will bump it to match their major version number.
|
||||
|
||||
<item>If you need to tell the difference between a FreeBSD 1.x
|
||||
system and a FreeBSD 2.x or 3.x system, usually the right answer is
|
||||
to use the <tt>BSD</tt> macros described above. If there
|
||||
actually is a FreeBSD specific change (such as special
|
||||
shared library options when using `<tt>ld</tt>') then it is
|
||||
OK to use <tt>__FreeBSD__</tt> and `<tt>#if __FreeBSD__ >
|
||||
1</tt>' to detect a FreeBSD 2.x and later system.
|
||||
|
||||
If you need more granularity in detecting FreeBSD systems since
|
||||
2.0-RELEASE you can use the following:
|
||||
|
||||
<tscreen><verb>
|
||||
#if __FreeBSD__ >= 2
|
||||
#include <osreldate.h>
|
||||
# if __FreeBSD_version >= 199504
|
||||
/* 2.0.5+ release specific code here */
|
||||
# endif
|
||||
#endif
|
||||
</verb></tscreen>
|
||||
<tt>__FreeBSD_version</tt> values:
|
||||
<tscreen><verb>
|
||||
2.0-RELEASE: 199411
|
||||
2.1-current's: 199501, 199503
|
||||
2.0.5-RELEASE: 199504
|
||||
2.2-current before 2.1: 199508
|
||||
2.1.0-RELEASE: 199511
|
||||
2.2-current before 2.1.5: 199512
|
||||
2.1.5-RELEASE: 199607
|
||||
2.2-current before 2.1.6: 199608
|
||||
2.1.6-RELEASE: 199612
|
||||
2.1.7-RELEASE: 199612
|
||||
2.2-RELEASE: 220000
|
||||
2.2.1-RELEASE: 220000 (yes, no change)
|
||||
2.2-STABLE after 2.2.1-RELEASE: 220000 (yes, still no change)
|
||||
2.2-STABLE after texinfo-3.9: 221001
|
||||
2.2-STABLE after top: 221002
|
||||
2.2.2-RELEASE: 222000
|
||||
2.2-STABLE after 2.2.2-RELEASE: 222001
|
||||
2.2.5-RELEASE: 225000
|
||||
2.2-STABLE after 2.2.5-RELEASE: 225001
|
||||
2.2-STABLE after ldconfig -R merge: 225002
|
||||
2.2.6-RELEASE: 226000
|
||||
2.2.7-RELEASE: 227000
|
||||
2.2-STABLE after 2.2.7-RELEASE: 227001
|
||||
3.0-current before mount(2) change: 300000
|
||||
3.0-current as of Nov 1997: 300001
|
||||
</verb></tscreen>
|
||||
(Note that 2.2-STABLE sometimes identifies itself as
|
||||
"2.2.5-STABLE" after the 2.2.5-RELEASE.)
|
||||
The pattern used to be year followed by the month, but we
|
||||
decided to change it to a more straightforward major/minor
|
||||
system starting from 2.2. This is because the parallel
|
||||
development on several branches made it infeasible to
|
||||
classify the releases simply by their real release dates.
|
||||
(Note that if you are making a port now, you don't have to
|
||||
worry about old -current's; they are listed here just for
|
||||
your reference.)
|
||||
|
||||
</itemize>
|
||||
|
||||
<p>In the hundreds of ports that have been done, there have
|
||||
only been one or two cases where <tt>__FreeBSD__</tt>
|
||||
should have been used. Just because an earlier port
|
||||
screwed up and used it in the wrong place does not mean
|
||||
you should do so too.
|
||||
|
||||
<sect2>
|
||||
<heading>Quick Porting</heading>
|
||||
|
||||
|
@ -862,48 +719,35 @@ FETCH_DEPENDS= ncftp2:${PORTSDIR}/net/ncftp2
|
|||
addition, the author of the original port should be
|
||||
shot. <tt>:></tt>
|
||||
|
||||
<sect2>
|
||||
<heading>Ports that require Motif</heading>
|
||||
|
||||
<p>There are many programs that require a Motif library
|
||||
(available from several commercial vendors, while there is (at
|
||||
least) one effort to create a free clone) to compile. Since
|
||||
it is a popular toolkit and their licenses usually permit
|
||||
redistribution of statically linked binaries, we have made
|
||||
special provisions for handling ports that require Motif in a
|
||||
way that we can easily compile binaries linked either
|
||||
dynamically or statically.
|
||||
|
||||
<sect3>
|
||||
<heading>REQUIRES_MOTIF</heading>
|
||||
<heading>ldconfig</heading>
|
||||
|
||||
<p>If your port requires Motif, define this variable in the
|
||||
Makefile. This will prevent people who don't own a copy of
|
||||
Motif from even attempting to build it.
|
||||
<p>If your port installs a shared library, add a
|
||||
<tt>post-install</tt> target to your Makefile that runs
|
||||
`<tt>/sbin/ldconfig -m</tt>' on the directory where the new
|
||||
library is installed (usually <tt>${PREFIX}/lib</tt>)
|
||||
to register it into the shared library cache.
|
||||
|
||||
<sect3>
|
||||
<heading>${MOTIFLIB}</heading>
|
||||
<p>Also, add an <tt>@exec</tt> line to your <tt>pkg/PLIST</tt>
|
||||
file so that a user who installed the package can start
|
||||
using the shared library immediately. This line should
|
||||
immediately follow the line for the shared library itself,
|
||||
as in:
|
||||
<tscreen><verb>
|
||||
lib/libtcl80.so.1.0
|
||||
@exec /sbin/ldconfig -m %D/lib
|
||||
</verb></tscreen>
|
||||
|
||||
<p>This variable will be set by <tt>bsd.port.mk</tt> to be the
|
||||
appropriate reference to the Motif library. Please patch
|
||||
the source to use this wherever the Motif library is
|
||||
referenced in the Makefile or Imakefile.
|
||||
|
||||
<p>There are two common cases:
|
||||
<enum>
|
||||
<item>If the port refers to the Motif library as
|
||||
`<tt>-lXm</tt>' in its Makefile or Imakefile, simply
|
||||
substitute `<tt>${MOTIFLIB}</tt>' for it.
|
||||
|
||||
<item>If the port uses `<tt>XmClientLibs</tt>' in its
|
||||
Imakefile, change it to `<tt>${MOTIFLIB}
|
||||
${XTOOLLIB} ${XLIB}</tt>'.
|
||||
</enum>
|
||||
|
||||
<p>Note that <tt>${MOTIFLIB}</tt> (usually) expands to
|
||||
`<tt>-L/usr/X11R6/lib -lXm</tt>' or
|
||||
`<tt>/usr/X11R6/lib/libXm.a</tt>', so there is no need to
|
||||
add `<tt>-L</tt>' or `<tt>-l</tt>' in front.
|
||||
<p>Never, ever, <em>ever</em> add a line that says
|
||||
`<tt>ldconfig</tt>' without any arguments to your Makefile
|
||||
or pkg/PLIST. This will reset the shared library cache to
|
||||
the contents of <tt>/usr/lib</tt> only, and will royally
|
||||
screw up the user's machine ("Help, xinit does not run
|
||||
anymore after I install this port!"). Anybody who does this
|
||||
will be shot and cut into 65,536 pieces by a rusty knife and
|
||||
have his liver chopped out by a bunch of crows and will
|
||||
eternally rot to death in the deepest bowels of hell (not
|
||||
necessarily in that order)....
|
||||
|
||||
<sect2>
|
||||
<heading>ELF support</heading>
|
||||
|
@ -1048,6 +892,77 @@ ${SETENV} OBJFORMAT=${PORTOBJFORMAT} ${LDCONFIG} -m ....
|
|||
called depending on the format of the package, not the
|
||||
default format of the system.
|
||||
|
||||
<sect3>
|
||||
<heading>Correctly Install Manpages</heading>
|
||||
|
||||
<p>Do use the <tt/MAN[1-9LN]/ variables. These variables,
|
||||
will automatically add any manpages to <tt>pkg/PLIST</tt>
|
||||
(this means you must <em/not/ list manpages in the
|
||||
<tt/PLIST/) and automatically compress manpages (unless
|
||||
<tt>NOMANCOMPRESS</tt> is set in /etc/make.conf). If
|
||||
your port installs pre-compressed manpages, you must
|
||||
define the <tt/MANCOMPRESSED/ variable.
|
||||
|
||||
<tscreen><verb>
|
||||
MAN1= foo.1 bar.1
|
||||
MAN5= foo.conf.5
|
||||
MAN8= baz.8
|
||||
</verb></tscreen>
|
||||
|
||||
<p>Note that this is not usually necessary with ports that are X
|
||||
applications and use Imake to build.
|
||||
|
||||
<p>If your port anchors its man tree somewhere other than
|
||||
<tt>PREFIX</tt>, you can use the <tt>MANPREFIX</tt> to set it.
|
||||
Also, if only manpages in certain section go in a
|
||||
non-standard place, such as many Perl modules ports, you
|
||||
can set individual man paths using
|
||||
<tt>MAN<em>sect</em>PREFIX</tt> (where <em>sect</em> is one
|
||||
of 1-9, L or N).
|
||||
|
||||
<sect2>
|
||||
<heading>Ports that require Motif</heading>
|
||||
|
||||
<p>There are many programs that require a Motif library
|
||||
(available from several commercial vendors, while there is (at
|
||||
least) one effort to create a free clone) to compile. Since
|
||||
it is a popular toolkit and their licenses usually permit
|
||||
redistribution of statically linked binaries, we have made
|
||||
special provisions for handling ports that require Motif in a
|
||||
way that we can easily compile binaries linked either
|
||||
dynamically or statically.
|
||||
|
||||
<sect3>
|
||||
<heading>REQUIRES_MOTIF</heading>
|
||||
|
||||
<p>If your port requires Motif, define this variable in the
|
||||
Makefile. This will prevent people who don't own a copy of
|
||||
Motif from even attempting to build it.
|
||||
|
||||
<sect3>
|
||||
<heading>${MOTIFLIB}</heading>
|
||||
|
||||
<p>This variable will be set by <tt>bsd.port.mk</tt> to be the
|
||||
appropriate reference to the Motif library. Please patch
|
||||
the source to use this wherever the Motif library is
|
||||
referenced in the Makefile or Imakefile.
|
||||
|
||||
<p>There are two common cases:
|
||||
<enum>
|
||||
<item>If the port refers to the Motif library as
|
||||
`<tt>-lXm</tt>' in its Makefile or Imakefile, simply
|
||||
substitute `<tt>${MOTIFLIB}</tt>' for it.
|
||||
|
||||
<item>If the port uses `<tt>XmClientLibs</tt>' in its
|
||||
Imakefile, change it to `<tt>${MOTIFLIB}
|
||||
${XTOOLLIB} ${XLIB}</tt>'.
|
||||
</enum>
|
||||
|
||||
<p>Note that <tt>${MOTIFLIB}</tt> (usually) expands to
|
||||
`<tt>-L/usr/X11R6/lib -lXm</tt>' or
|
||||
`<tt>/usr/X11R6/lib/libXm.a</tt>', so there is no need to
|
||||
add `<tt>-L</tt>' or `<tt>-l</tt>' in front.
|
||||
|
||||
<sect2>
|
||||
<heading>Info files</heading>
|
||||
<p>The new version of texinfo (included in 2.2.2-RELEASE and
|
||||
|
@ -1299,6 +1214,33 @@ diff -u -r1.15 PLIST
|
|||
each step.
|
||||
</enum>
|
||||
|
||||
<sect3>
|
||||
<heading>INSTALL package script</heading>
|
||||
<p>If your port needs execute commands when the binary package
|
||||
is installed with pkg_add you can do with via the pkg/INSTALL
|
||||
script. This script will automatically be added to the
|
||||
package, and will be run twice by pkg_add. The first time
|
||||
will as `<tt>INSTALL ${PKGNAME} PRE-INSTALL</tt>'
|
||||
and the second time as `<tt>INSTALL ${PKGNAME} POST-INSTALL</tt>'.
|
||||
`<tt>$2</tt>' can be tested to determine which mode
|
||||
the script is being run in.
|
||||
The `<tt>PKG_PREFIX</tt>' environmental variable will be set to
|
||||
the package installation directory. See man <tt>pkg_add(1)</tt>
|
||||
for additional information.
|
||||
Note, that this script is not run automatically if you install
|
||||
the port with `<tt>make install</tt>'. If you are depending
|
||||
on it being run, you will have to explicitly call it on your
|
||||
port's Makefile.
|
||||
|
||||
<sect3>
|
||||
<heading>REQ package script</heading>
|
||||
<p>If your port needs to determine if it should install or not, you
|
||||
can create a pkg/REQ ``requirements'' script. It will be invoked
|
||||
automatically at installation/deinstallation time to determine
|
||||
whether or not installation/deinstallation should proceed.
|
||||
See man <tt>pkg_create(1)</tt> and man <tt>pkg_add(1)</tt> for
|
||||
more information.
|
||||
|
||||
<sect2>
|
||||
<heading>Changing the PLIST based on make variables</heading>
|
||||
|
||||
|
@ -1413,13 +1355,6 @@ diff -u -r1.15 PLIST
|
|||
and use the <tt>post-extract</tt> target to
|
||||
copy them to the <tt>work</tt> subdirectory.
|
||||
|
||||
<sect3>
|
||||
<heading>Portlint Clean</heading>
|
||||
|
||||
<p>Do use <tt>portlint</tt>! The <tt>
|
||||
<htmlurl url="http://www.freebsd.org/cgi/ports.cgi?portlint"
|
||||
name="portlint"></tt> program is part of the ports collection.
|
||||
|
||||
<sect3>
|
||||
<heading>Strip Binaries</heading>
|
||||
|
||||
|
@ -1436,34 +1371,6 @@ diff -u -r1.15 PLIST
|
|||
to check whether the binary is stripped or not. If it
|
||||
does not say `not stripped', it is stripped.
|
||||
|
||||
<sect3>
|
||||
<heading>Correctly Install Manpages</heading>
|
||||
|
||||
<p>Do use the <tt/MAN[1-9LN]/ variables. These variables,
|
||||
will automatically add any manpages to <tt>pkg/PLIST</tt>
|
||||
(this means you must <em/not/ list manpages in the
|
||||
<tt/PLIST/) and automatically compress manpages (unless
|
||||
<tt>NOMANCOMPRESS</tt> is set in /etc/make.conf). If
|
||||
your port installs pre-compressed manpages, you must
|
||||
define the <tt/MANCOMPRESSED/ variable.
|
||||
|
||||
<tscreen><verb>
|
||||
MAN1= foo.1 bar.1
|
||||
MAN5= foo.conf.5
|
||||
MAN8= baz.8
|
||||
</verb></tscreen>
|
||||
|
||||
<p>Note that this is not usually necessary with ports that are X
|
||||
applications and use Imake to build.
|
||||
|
||||
<p>If your port anchors its man tree somewhere other than
|
||||
<tt>PREFIX</tt>, you can use the <tt>MANPREFIX</tt> to set it.
|
||||
Also, if only manpages in certain section go in a
|
||||
non-standard place, such as many Perl modules ports, you
|
||||
can set individual man paths using
|
||||
<tt>MAN<em>sect</em>PREFIX</tt> (where <em>sect</em> is one
|
||||
of 1-9, L or N).
|
||||
|
||||
<sect3>
|
||||
<heading>INSTALL_* macros</heading>
|
||||
<p>Do use the macros provided in <tt>bsd.port.mk</tt> to
|
||||
|
@ -1485,32 +1392,148 @@ MAN8= baz.8
|
|||
the appropriate flags. See below for an example on how to
|
||||
use them.
|
||||
|
||||
<sect3>
|
||||
<heading>INSTALL package script</heading>
|
||||
<p>If your port needs execute commands when the binary package
|
||||
is installed with pkg_add you can do with via the pkg/INSTALL
|
||||
script. This script will automatically be added to the
|
||||
package, and will be run twice by pkg_add. The first time
|
||||
will as `<tt>INSTALL ${PKGNAME} PRE-INSTALL</tt>'
|
||||
and the second time as `<tt>INSTALL ${PKGNAME} POST-INSTALL</tt>'.
|
||||
`<tt>$2</tt>' can be tested to determine which mode
|
||||
the script is being run in.
|
||||
The `<tt>PKG_PREFIX</tt>' environmental variable will be set to
|
||||
the package installation directory. See man <tt>pkg_add(1)</tt>
|
||||
for additional information.
|
||||
Note, that this script is not run automatically if you install
|
||||
the port with `<tt>make install</tt>'. If you are depending
|
||||
on it being run, you will have to explicitly call it on your
|
||||
port's Makefile.
|
||||
<sect2>
|
||||
<heading>Before Starting the Port<label id="porting:starting"></heading>
|
||||
|
||||
<sect3>
|
||||
<heading>REQ package script</heading>
|
||||
<p>If your port needs to determine if it should install or not, you
|
||||
can create a pkg/REQ ``requirements'' script. It will be invoked
|
||||
automatically at installation/deinstallation time to determine
|
||||
whether or not installation/deinstallation should proceed.
|
||||
See man <tt>pkg_create(1)</tt> and man <tt>pkg_add(1)</tt> for
|
||||
more information.
|
||||
<p>You may come across code that needs modifications or
|
||||
conditional compilation based upon what version of UNIX it is
|
||||
running under. If you need to make such changes to the code
|
||||
for conditional compilation, make sure you make the changes as
|
||||
general as possible so that we can back-port code to FreeBSD
|
||||
1.x systems and cross-port to other BSD systems such as 4.4BSD
|
||||
from CSRG, BSD/386, 386BSD, NetBSD, and OpenBSD.
|
||||
|
||||
<p>The preferred way to tell 4.3BSD/Reno (1990) and newer versions of
|
||||
the BSD code apart is by using the `<tt>BSD</tt>' macro
|
||||
defined in <tt><sys/param.h></tt>. Hopefully that file
|
||||
is already included; if not, add the code:
|
||||
|
||||
<tscreen><verb>
|
||||
#if (defined(__unix__) || defined(unix)) && !defined(USG)
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
</verb></tscreen>
|
||||
|
||||
<p>to the proper place in the <tt>.c</tt> file. We believe that every
|
||||
system that defines these to symbols has sys/param.h. If you find
|
||||
a system that doesn't, we would like to know. Please send
|
||||
mail to &a.ports;.
|
||||
|
||||
<p>Another way is to use the GNU Autoconf style of doing this:
|
||||
|
||||
<tscreen><verb>
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
</verb></tscreen>
|
||||
|
||||
Don't forget to add <tt>-DHAVE_SYS_PARAM_H</tt> to the <tt>CFLAGS</tt>
|
||||
in the Makefile for this method.
|
||||
|
||||
Once you have <tt><sys/param.h></tt> included, you may use:
|
||||
|
||||
<tscreen><verb>
|
||||
#if (defined(BSD) && (BSD >= 199103))
|
||||
</verb></tscreen>
|
||||
|
||||
to detect if the code is being compiled on a 4.3 Net2 code
|
||||
base or newer (e.g. FreeBSD 1.x, 4.3/Reno, NetBSD 0.9, 386BSD,
|
||||
BSD/386 1.1 and below).
|
||||
|
||||
Use:
|
||||
|
||||
<tscreen><verb>
|
||||
#if (defined(BSD) && (BSD >= 199306))
|
||||
</verb></tscreen>
|
||||
|
||||
to detect if the code is being compiled on a 4.4 code base or
|
||||
newer (e.g. FreeBSD 2.x, 4.4, NetBSD 1.0, BSD/386 2.0 or
|
||||
above).
|
||||
|
||||
The value of the BSD macro is 199506 for the 4.4BSD-Lite2 code
|
||||
base. This is stated for informational purposes only. It should
|
||||
not be used to distinguish between version of FreeBSD based only
|
||||
on 4.4-Lite vs. versions that have merged in changes from 4.4-Lite2.
|
||||
The __FreeBSD__ macro should be used instead.
|
||||
|
||||
<p>Use sparingly:
|
||||
|
||||
<itemize>
|
||||
<item><tt>__FreeBSD__</tt> is defined in all versions of
|
||||
FreeBSD. Use it if the change you are making ONLY affects
|
||||
FreeBSD. Porting gotchas like the use of
|
||||
<tt>sys_errlist[]</tt> vs <tt>strerror()</tt> are
|
||||
Berkeleyisms, not FreeBSD changes.
|
||||
|
||||
<item>In FreeBSD 2.x, <tt>__FreeBSD__</tt> is defined to be
|
||||
<tt>2</tt>. In earlier versions, it is <tt>1</tt>. Later
|
||||
versions will bump it to match their major version number.
|
||||
|
||||
<item>If you need to tell the difference between a FreeBSD 1.x
|
||||
system and a FreeBSD 2.x or 3.x system, usually the right answer is
|
||||
to use the <tt>BSD</tt> macros described above. If there
|
||||
actually is a FreeBSD specific change (such as special
|
||||
shared library options when using `<tt>ld</tt>') then it is
|
||||
OK to use <tt>__FreeBSD__</tt> and `<tt>#if __FreeBSD__ >
|
||||
1</tt>' to detect a FreeBSD 2.x and later system.
|
||||
|
||||
If you need more granularity in detecting FreeBSD systems since
|
||||
2.0-RELEASE you can use the following:
|
||||
|
||||
<tscreen><verb>
|
||||
#if __FreeBSD__ >= 2
|
||||
#include <osreldate.h>
|
||||
# if __FreeBSD_version >= 199504
|
||||
/* 2.0.5+ release specific code here */
|
||||
# endif
|
||||
#endif
|
||||
</verb></tscreen>
|
||||
<tt>__FreeBSD_version</tt> values:
|
||||
<tscreen><verb>
|
||||
2.0-RELEASE: 199411
|
||||
2.1-current's: 199501, 199503
|
||||
2.0.5-RELEASE: 199504
|
||||
2.2-current before 2.1: 199508
|
||||
2.1.0-RELEASE: 199511
|
||||
2.2-current before 2.1.5: 199512
|
||||
2.1.5-RELEASE: 199607
|
||||
2.2-current before 2.1.6: 199608
|
||||
2.1.6-RELEASE: 199612
|
||||
2.1.7-RELEASE: 199612
|
||||
2.2-RELEASE: 220000
|
||||
2.2.1-RELEASE: 220000 (yes, no change)
|
||||
2.2-STABLE after 2.2.1-RELEASE: 220000 (yes, still no change)
|
||||
2.2-STABLE after texinfo-3.9: 221001
|
||||
2.2-STABLE after top: 221002
|
||||
2.2.2-RELEASE: 222000
|
||||
2.2-STABLE after 2.2.2-RELEASE: 222001
|
||||
2.2.5-RELEASE: 225000
|
||||
2.2-STABLE after 2.2.5-RELEASE: 225001
|
||||
2.2-STABLE after ldconfig -R merge: 225002
|
||||
2.2.6-RELEASE: 226000
|
||||
2.2.7-RELEASE: 227000
|
||||
2.2-STABLE after 2.2.7-RELEASE: 227001
|
||||
3.0-current before mount(2) change: 300000
|
||||
3.0-current as of Nov 1997: 300001
|
||||
</verb></tscreen>
|
||||
(Note that 2.2-STABLE sometimes identifies itself as
|
||||
"2.2.5-STABLE" after the 2.2.5-RELEASE.)
|
||||
The pattern used to be year followed by the month, but we
|
||||
decided to change it to a more straightforward major/minor
|
||||
system starting from 2.2. This is because the parallel
|
||||
development on several branches made it infeasible to
|
||||
classify the releases simply by their real release dates.
|
||||
(Note that if you are making a port now, you don't have to
|
||||
worry about old -current's; they are listed here just for
|
||||
your reference.)
|
||||
|
||||
</itemize>
|
||||
|
||||
<p>In the hundreds of ports that have been done, there have
|
||||
only been one or two cases where <tt>__FreeBSD__</tt>
|
||||
should have been used. Just because an earlier port
|
||||
screwed up and used it in the wrong place does not mean
|
||||
you should do so too.
|
||||
|
||||
<sect3>
|
||||
<heading>Install additional documentation</heading>
|
||||
|
@ -1574,14 +1597,6 @@ MAN8= baz.8
|
|||
<p>Note this does not affect the <tt>${MASTER_SITES}</tt>
|
||||
you define in your Makefile.
|
||||
|
||||
<sect3>
|
||||
<heading>Feedback</heading>
|
||||
|
||||
<p>Do send applicable changes/patches to the original
|
||||
author/maintainer for inclusion in next release of the code.
|
||||
This will only make your job that much easier for the next
|
||||
release.
|
||||
|
||||
<sect3>
|
||||
<heading>RCS strings</heading>
|
||||
|
||||
|
@ -1667,36 +1682,6 @@ MAN8= baz.8
|
|||
They may use <tt>${PREFIX}/news</tt> as a destination
|
||||
for their files.
|
||||
|
||||
<sect3>
|
||||
<heading>ldconfig</heading>
|
||||
|
||||
<p>If your port installs a shared library, add a
|
||||
<tt>post-install</tt> target to your Makefile that runs
|
||||
`<tt>/sbin/ldconfig -m</tt>' on the directory where the new
|
||||
library is installed (usually <tt>${PREFIX}/lib</tt>)
|
||||
to register it into the shared library cache.
|
||||
|
||||
<p>Also, add an <tt>@exec</tt> line to your <tt>pkg/PLIST</tt>
|
||||
file so that a user who installed the package can start
|
||||
using the shared library immediately. This line should
|
||||
immediately follow the line for the shared library itself,
|
||||
as in:
|
||||
<tscreen><verb>
|
||||
lib/libtcl80.so.1.0
|
||||
@exec /sbin/ldconfig -m %D/lib
|
||||
</verb></tscreen>
|
||||
|
||||
<p>Never, ever, <em>ever</em> add a line that says
|
||||
`<tt>ldconfig</tt>' without any arguments to your Makefile
|
||||
or pkg/PLIST. This will reset the shared library cache to
|
||||
the contents of <tt>/usr/lib</tt> only, and will royally
|
||||
screw up the user's machine ("Help, xinit does not run
|
||||
anymore after I install this port!"). Anybody who does this
|
||||
will be shot and cut into 65,536 pieces by a rusty knife and
|
||||
have his liver chopped out by a bunch of crows and will
|
||||
eternally rot to death in the deepest bowels of hell (not
|
||||
necessarily in that order)....
|
||||
|
||||
<sect3>
|
||||
<heading>UIDs</heading>
|
||||
|
||||
|
@ -1757,6 +1742,21 @@ msql:*:87:87:mSQL-2 pseudo-user:/var/db/msqldb:/bin/sh
|
|||
If it doesn't, please add `<tt>NO_PACKAGE=ignores cflags</tt>'
|
||||
to the Makefile.
|
||||
|
||||
<sect3>
|
||||
<heading>Portlint Clean</heading>
|
||||
|
||||
<p>Do use <tt>portlint</tt>! The <tt>
|
||||
<htmlurl url="http://www.freebsd.org/cgi/ports.cgi?portlint"
|
||||
name="portlint"></tt> program is part of the ports collection.
|
||||
|
||||
<sect3>
|
||||
<heading>Feedback</heading>
|
||||
|
||||
<p>Do send applicable changes/patches to the original
|
||||
author/maintainer for inclusion in next release of the code.
|
||||
This will only make your job that much easier for the next
|
||||
release.
|
||||
|
||||
<sect3>
|
||||
<heading>Miscellanea</heading>
|
||||
|
||||
|
|
Loading…
Reference in a new issue