perlos2.html
来自「perl教程」· HTML 代码 · 共 1,320 行 · 第 1/5 页
HTML
1,320 行
<a href="#perllib_prefix">PERLLIB_PREFIX</a>, <a href="#perl_sh_dir">PERL_SH_DIR</a>), some people may prefer
binary editing of paths inside the executables/DLLs.</p>
<p>
</p>
<hr />
<h1><a name="accessing_documentation">Accessing documentation</a></h1>
<p>Depending on how you built/installed perl you may have (otherwise
identical) Perl documentation in the following formats:</p>
<p>
</p>
<h2><a name="os_2__inf_file">OS/2 <em>.INF</em> file</a></h2>
<p>Most probably the most convenient form. Under OS/2 view it as</p>
<pre>
view perl
view perl <a href="../../lib/Pod/perlfunc.html">perlfunc</a>
view perl less
view perl ExtUtils::MakeMaker</pre>
<p>(currently the last two may hit a wrong location, but this may improve
soon). Under Win* see <a href="#synopsis">SYNOPSIS</a>.</p>
<p>If you want to build the docs yourself, and have <em>OS/2 toolkit</em>, run</p>
<pre>
pod2ipf > perl.ipf</pre>
<p>in <em>/perllib/lib/pod</em> directory, then</p>
<pre>
ipfc /inf perl.ipf</pre>
<p>(Expect a lot of errors during the both steps.) Now move it on your
BOOKSHELF path.</p>
<p>
</p>
<h2><a name="plain_text">Plain text</a></h2>
<p>If you have perl documentation in the source form, perl utilities
installed, and GNU groff installed, you may use</p>
<pre>
<a href="../../lib/Pod/perldoc.html">perldoc</a> <a href="../../lib/Pod/perlfunc.html">perlfunc</a>
<a href="../../lib/Pod/perldoc.html">perldoc</a> less
<a href="../../lib/Pod/perldoc.html">perldoc</a> ExtUtils::MakeMaker</pre>
<p>to access the perl documentation in the text form (note that you may get
better results using perl manpages).</p>
<p>Alternately, try running pod2text on <em>.pod</em> files.</p>
<p>
</p>
<h2><a name="manpages">Manpages</a></h2>
<p>If you have <em>man</em> installed on your system, and you installed perl
manpages, use something like this:</p>
<pre>
man <a href="../../lib/Pod/perlfunc.html">perlfunc</a>
man 3 less
man ExtUtils.MakeMaker</pre>
<p>to access documentation for different components of Perl. Start with</p>
<pre>
man perl</pre>
<p>Note that dot (<em>.</em>) is used as a package separator for documentation
for packages, and as usual, sometimes you need to give the section - <code>3</code>
above - to avoid shadowing by the <em>less(1) manpage</em>.</p>
<p>Make sure that the directory <strong>above</strong> the directory with manpages is
on our <code>MANPATH</code>, like this</p>
<pre>
<span class="variable">set</span> <span class="variable">MANPATH</span><span class="operator">=</span><span class="variable">c</span><span class="operator">:</span><span class="regex">/man;f:/perllib</span><span class="operator">/</span><span class="variable">man</span>
</pre>
<p>for Perl manpages in <code>f:/perllib/man/man1/</code> etc.</p>
<p>
</p>
<h2><a name="html">HTML</a></h2>
<p>If you have some WWW browser available, installed the Perl
documentation in the source form, and Perl utilities, you can build
HTML docs. Cd to directory with <em>.pod</em> files, and do like this</p>
<pre>
cd f:/perllib/lib/pod
pod2html</pre>
<p>After this you can direct your browser the file <em>perl.html</em> in this
directory, and go ahead with reading docs, like this:</p>
<pre>
explore <a href="file:///f:/perllib/lib/pod/perl.html">file:///f:/perllib/lib/pod/perl.html</a></pre>
<p>Alternatively you may be able to get these docs prebuilt from CPAN.</p>
<p>
</p>
<h2><a name="gnu_info_files">GNU <code>info</code> files</a></h2>
<p>Users of Emacs would appreciate it very much, especially with
<code>CPerl</code> mode loaded. You need to get latest <code>pod2texi</code> from <code>CPAN</code>,
or, alternately, the prebuilt info pages.</p>
<p>
</p>
<h2><a name="pdf_files"><em>PDF</em> files</a></h2>
<p>for <code>Acrobat</code> are available on CPAN (may be for slightly older version of
perl).</p>
<p>
</p>
<h2><a name="latex_docs"><code>LaTeX</code> docs</a></h2>
<p>can be constructed using <code>pod2latex</code>.</p>
<p>
</p>
<hr />
<h1><a name="build">BUILD</a></h1>
<p>Here we discuss how to build Perl under OS/2. There is an alternative
(but maybe older) view on <a href="http://www.shadow.net/~troc/os2perl.html">http://www.shadow.net/~troc/os2perl.html</a>.</p>
<p>
</p>
<h2><a name="the_short_story">The short story</a></h2>
<p>Assume that you are a seasoned porter, so are sure that all the necessary
tools are already present on your system, and you know how to get the Perl
source distribution. Untar it, change to the extract directory, and</p>
<pre>
gnupatch -p0 < os2\diff.configure
sh Configure -des -D prefix=f:/perllib
make
make test
make install
make aout_test
make aout_install</pre>
<p>This puts the executables in f:/perllib/bin. Manually move them to the
<a href="../../lib/Pod/perlrun.html#item_path"><code>PATH</code></a>, manually move the built <em>perl*.dll</em> to <code>LIBPATH</code> (here for
Perl DLL <em>*</em> is a not-very-meaningful hex checksum), and run</p>
<pre>
make installcmd INSTALLCMDDIR=d:/ir/on/path</pre>
<p>Assuming that the <code>man</code>-files were put on an appropriate location,
this completes the installation of minimal Perl system. (The binary
distribution contains also a lot of additional modules, and the
documentation in INF format.)</p>
<p>What follows is a detailed guide through these steps.</p>
<p>
</p>
<h2><a name="prerequisites">Prerequisites</a></h2>
<p>You need to have the latest EMX development environment, the full
GNU tool suite (gawk renamed to awk, and GNU <em>find.exe</em>
earlier on path than the OS/2 <em>find.exe</em>, same with <em>sort.exe</em>, to
check use</p>
<pre>
find --version
sort --version</pre>
<p>). You need the latest version of <em>pdksh</em> installed as <em>sh.exe</em>.</p>
<p>Check that you have <strong>BSD</strong> libraries and headers installed, and -
optionally - Berkeley DB headers and libraries, and crypt.</p>
<p>Possible locations to get the files:</p>
<pre>
<a href="ftp://hobbes.nmsu.edu/os2/unix/">ftp://hobbes.nmsu.edu/os2/unix/</a>
<a href="ftp://ftp.cdrom.com/pub/os2/unix/">ftp://ftp.cdrom.com/pub/os2/unix/</a>
<a href="ftp://ftp.cdrom.com/pub/os2/dev32/">ftp://ftp.cdrom.com/pub/os2/dev32/</a>
<a href="ftp://ftp.cdrom.com/pub/os2/emx09c/">ftp://ftp.cdrom.com/pub/os2/emx09c/</a></pre>
<p>It is reported that the following archives contain enough utils to
build perl: <em>gnufutil.zip</em>, <em>gnusutil.zip</em>, <em>gnututil.zip</em>, <em>gnused.zip</em>,
<em>gnupatch.zip</em>, <em>gnuawk.zip</em>, <em>gnumake.zip</em>, <em>gnugrep.zip</em>, <em>bsddev.zip</em> and
<em>ksh527rt.zip</em> (or a later version). Note that all these utilities are
known to be available from LEO:</p>
<pre>
<a href="ftp://ftp.leo.org/pub/comp/os/os2/leo/gnu">ftp://ftp.leo.org/pub/comp/os/os2/leo/gnu</a></pre>
<p>Note also that the <em>db.lib</em> and <em>db.a</em> from the EMX distribution
are not suitable for multi-threaded compile (even single-threaded
flavor of Perl uses multi-threaded C RTL, for
compatibility with XFree86-OS/2). Get a corrected one from</p>
<pre>
<a href="http://www.ilyaz.org/software/os2/db_mt.zip">http://www.ilyaz.org/software/os2/db_mt.zip</a></pre>
<p>If you have <em>exactly the same version of Perl</em> installed already,
make sure that no copies or perl are currently running. Later steps
of the build may fail since an older version of <em>perl.dll</em> loaded into
memory may be found. Running <code>make test</code> becomes meaningless, since
the test are checking a previous build of perl (this situation is detected
and reported by <em>lib/os2_base.t</em> test). Do not forget to unset
<code>PERL_EMXLOAD_SEC</code> in environment.</p>
<p>Also make sure that you have <em>/tmp</em> directory on the current drive,
and <em>.</em> directory in your <code>LIBPATH</code>. One may try to correct the
latter condition by</p>
<pre>
set BEGINLIBPATH .\.</pre>
<p>if you use something like <em>CMD.EXE</em> or latest versions of
<em>4os2.exe</em>. (Setting BEGINLIBPATH to just <code>.</code> is ignored by the
OS/2 kernel.)</p>
<p>Make sure your gcc is good for <code>-Zomf</code> linking: run <code>omflibs</code>
script in <em>/emx/lib</em> directory.</p>
<p>Check that you have link386 installed. It comes standard with OS/2,
but may be not installed due to customization. If typing</p>
<pre>
link386</pre>
<p>shows you do not have it, do <em>Selective install</em>, and choose <code>Link
object modules</code> in <em>Optional system utilities/More</em>. If you get into
link386 prompts, press <code>Ctrl-C</code> to exit.</p>
<p>
</p>
<h2><a name="getting_perl_source">Getting perl source</a></h2>
<p>You need to fetch the latest perl source (including developers
releases). With some probability it is located in</p>
<pre>
<a href="http://www.cpan.org/src/5.0">http://www.cpan.org/src/5.0</a>
<a href="http://www.cpan.org/src/5.0/unsupported">http://www.cpan.org/src/5.0/unsupported</a></pre>
<p>If not, you may need to dig in the indices to find it in the directory
of the current maintainer.</p>
<p>Quick cycle of developers release may break the OS/2 build time to
time, looking into</p>
<pre>
<a href="http://www.cpan.org/ports/os2/">http://www.cpan.org/ports/os2/</a></pre>
<p>may indicate the latest release which was publicly released by the
maintainer. Note that the release may include some additional patches
to apply to the current source of perl.</p>
<p>Extract it like this</p>
<pre>
tar vzxf perl5.00409.tar.gz</pre>
<p>You may see a message about errors while extracting <em>Configure</em>. This is
because there is a conflict with a similarly-named file <em>configure</em>.</p>
<p>Change to the directory of extraction.</p>
<p>
</p>
<h2><a name="application_of_the_patches">Application of the patches</a></h2>
<p>You need to apply the patches in <em>./os2/diff.*</em> like this:</p>
<pre>
gnupatch -p0 < os2\diff.configure</pre>
<p>You may also need to apply the patches supplied with the binary
distribution of perl. It also makes sense to look on the
perl5-porters mailing list for the latest OS/2-related patches (see
<a href="http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/">http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/</a>). Such
patches usually contain strings <code>/os2/</code> and <code>patch</code>, so it makes
sense looking for these strings.</p>
<p>
</p>
<h2><a name="handediting">Hand-editing</a></h2>
<p>You may look into the file <em>./hints/os2.sh</em> and correct anything
wrong you find there. I do not expect it is needed anywhere.</p>
<p>
</p>
<h2><a name="making">Making</a></h2>
<pre>
sh Configure -des -D prefix=f:/perllib</pre>
<p><code>prefix</code> means: where to install the resulting perl library. Giving
correct prefix you may avoid the need to specify <code>PERLLIB_PREFIX</code>,
see <a href="#perllib_prefix">PERLLIB_PREFIX</a>.</p>
<p><em>Ignore the message about missing <code>ln</code>, and about <a href="../../lib/Pod/perlrun.html#item__2dc"><code>-c</code></a> option to
tr</em>. The latter is most probably already fixed, if you see it and can trace
where the latter spurious warning comes from, please inform me.</p>
<p>Now</p>
<pre>
make</pre>
<p>At some moment the built may die, reporting a <em>version mismatch</em> or
<em>unable to run <em>perl</em></em>. This means that you do not have <em>.</em> in
your LIBPATH, so <em>perl.exe</em> cannot find the needed <em>perl67B2.dll</em> (treat
these hex digits as line noise). After this is fixed the build
should finish without a lot of fuss.</p>
<p>
</p>
<h2><a name="testing">Testing</a></h2>
<p>Now run</p>
<pre>
make test</pre>
<p>All tests should succeed (with some of them skipped). If you have the
same version of Perl installed, it is crucial that you have <code>.</code> early
in your LIBPATH (or in BEGINLIBPATH), otherwise your tests will most
probably test the wrong version of Perl.</p>
<p>Some tests may generate extra messages similar to</p>
<dl>
<dt><strong><a name="item_a_lot_of_bad_free">A lot of <code>bad free</code></a></strong>
<dd>
<p>in database tests related to Berkeley DB. <em>This should be fixed already.</em>
If it persists, you may disable this warnings, see <a href="#item_perl_badfree">PERL_BADFREE</a>.</p>
</dd>
</li>
<dt><strong><a name="item_process_terminated_by_sigterm_2fsigint">Process terminated by SIGTERM/SIGINT</a></strong>
<dd>
<p>This is a standard message issued by OS/2 applications. *nix
applications die in silence. It is considered to be a feature. One can
easily disable this by appropriate sighandlers.</p>
</dd>
<dd>
<p>However the test engine bleeds these message to screen in unexpected
moments. Two messages of this kind <em>should</em> be present during
testing.</p>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?