Mac OS X 10.4.3(Tiger) へ perl 5.8.7 をインストール

OS X 10.4.3 のデフォルトでは perl 5.8.6 がデフォルトでインストールされているのですが、いろいろ確認したいことがあったので最新の perl 5.8.7 をソースからインストールした時のメモを。

  • ソースのダウンロード〜解凍

まず、O'Reilly の perl サイトよりソースパッケージをダウンロード。

iBook-G4:~ mayachan$ curl -O http://www.perl.com/CPAN/src/stable.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 11.9M  100 11.9M    0     0   103k      0  0:01:58  0:01:58 --:--:-- 79973

続いて解凍。

iBook-G4:~ mayachan$ gunzip -c stable.tar.gz | tar xf -
  • make 前の環境設定

configure するといろいろ質問されますが、途中の "Use which C compiler?" で "gcc" を指定する以外は全てデフォルトでオーケー。

iBook-G4:~ mayachan$ cd perl-5.8.7
iBook-G4:~/perl-5.8.7 mayachan$ ./configure 
 
Beginning of configuration questions for perl5.
 
Checking echo to see how to suppress newlines...
...using -n.
The star should be here-->*
 
First let's make sure your kit is complete.  Checking...
Looks good...
〜中略〜

Nor is it Venix...
Use which C compiler? [cc] gcc

〜中略〜
Updating GNUmakefile...
Now you must run 'make'.

If you compile perl5 on a different machine or from a different object
directory, copy the Policy.sh file from this object directory to the
new one before you run Configure -- this will help you with most of
the policy defaults.
  • make する

locale のテストで "FAILED at test 99" というエラーが表示されるが、PERL_BADLANG 環境変数を設定する解決法があるので気にしない。

iBook-G4:~/perl-5.8.7 mayachan$ sudo make
iBook-G4:~/perl-5.8.7 mayachan$ sudo make test
〜中略〜
lib/locale................................FAILED at test 99
〜中略〜
Failed 1 test script out of 883, 99.89% okay.
### Since not all tests were successful, you may want to run some of
### them individually and examine any diagnostic messages they produce.
### See the INSTALL document's section on "make test".
### You have a good chance to get more information by running
###   ./perl harness
### in the 't' directory since most (>=80%) of the tests succeeded.
### You may have to set your dynamic library search path,
### DYLD_LIBRARY_PATH, to point to the build directory:
###   setenv DYLD_LIBRARY_PATH `pwd`; cd t; ./perl harness
###   DYLD_LIBRARY_PATH=`pwd`; export DYLD_LIBRARY_PATH; cd t; ./perl harness
###   export DYLD_LIBRARY_PATH=`pwd`; cd t; ./perl harness
### for csh-style shells, like tcsh; or for traditional/modern
### Bourne-style shells, like bash, ksh, and zsh, respectively.
u=4.62  s=4.24  cu=269.43  cs=70.44  scripts=883  tests=100132
make[2]: *** [_test_tty] Error 1
make[1]: *** [_test] Error 2
make: *** [test] Error 2
iBook-G4:~/perl-5.8.7 mayachan$ sudo make install
  • 動作確認

perl 5.8.7 は "/usr/local/bin" にインストールされるので、以下のようにして確認。

iBook-G4:/usr/local/bin mayachan$ /usr/local/bin/perl -v

This is perl, v5.8.7 built for darwin-2level

Copyright 1987-2005, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

iBook-G4:/usr/local/bin mayachan$ /usr/local/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
  Platform:
    osname=darwin, osvers=8.3.0, archname=darwin-2level
    uname='darwin ibook-g4.local 8.3.0 darwin kernel version 8.3.0: mon oct 3 20:04:04 pdt 2005; root:xnu-792.6.22.obj~2release_ppc power macintosh powerpc '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/include',
    optimize='-O3',
    cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/include'
    ccversion='', gccversion='4.0.0 20041026 (Apple Computer, Inc. build 4061)', gccosandvers='darwin8'
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib
    libs=-ldbm -ldl -lm -lc
    perllibs=-ldl -lm -lc
    libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: USE_LARGE_FILES
  Built under darwin
  Compiled at Nov  7 2005 23:42:54
  %ENV:
    PERL5LIB="/sw/lib/perl5:/sw/lib/perl5/darwin"
  @INC:
    /sw/lib/perl5
    /sw/lib/perl5/darwin
    /usr/local/lib/perl5/5.8.7/darwin-2level
    /usr/local/lib/perl5/5.8.7
    /usr/local/lib/perl5/site_perl/5.8.7/darwin-2level
    /usr/local/lib/perl5/site_perl/5.8.7
    /usr/local/lib/perl5/site_perl
    .
  • mt を動かしてみたり

mt-check.cgiperl パスを "#!/usr/local/bin/perl -w" に書き換えて確認してみる。