10.3: Patching and fixing Perl, PostFix and BerkeleyDB

Nov 14, '03 10:43:00AM

Contributed by: blakers

After upgrading to 10.3/Panther from 10.2.8 on my TiBook/800 without a hitch, I decided to 'clean up' a couple of frequently used items.

Specifically, Perl 5.8.1, PostFix 2.0.16 and BerkeleyDB 4.1.25.

Why?

Several folks have written to me to ask about this as well, So, here's the step-by-step ... don't forget to make sure you've installed the XCode tools!

Notes: [robg adds: Read the rest of the hint for the how-to's -- and note that I have NOT tested any of this hint, and it assumes a fairly high level of command-line knowledge.]

fyi:

dlcompat:
reference URL: dlcompat page @ Fink

% cvs -d :pserver:anonymous@anoncvs.opendarwin.org:/cvs/od login
% > password: (RETURN)
% cvs -d :pserver:anonymous@anoncvs.opendarwin.org:/cvs/od co -d dlcompat proj/dlcompat
% unsetenv CFLAGS CPPFLAGS CXX CXXFLAGS LDFLAGS LDDLFLAGS LD_PREBIND
% cd /usr/ports/dlcompat
% autoconf
%./configure --prefix=/usr
% make
% make install
If you're going to be building more unix apps, these are simply nice to have:


% vi /usr/local/sbin/remove_dlcompat
The contents of this file should be:
========================================

# REMOVE:
mv /usr/lib/libdl.1.dylib /usr/lib/libdl.1.dylibAPPLE ;\
mv /usr/lib/libdl.a /usr/lib/libdl.aAPPLE ;\
mv /usr/lib/libdl.dylib /usr/lib/libdl.dylibAPPLE ;\
mv /usr/include/dlfcn.h /usr/include/dlfcn.hAPPLE
========================================


% vi /usr/local/sbin/restore_dlcompat
The contents of this file should be:
========================================

# RESTORE:
mv /usr/lib/libdl.1.dylibAPPLE /usr/lib/libdl.1.dylib ;\
mv /usr/lib/libdl.aAPPLE /usr/lib/libdl.a ;\
mv /usr/lib/libdl.dylibAPPLE /usr/lib/libdl.dylib ;\
mv /usr/include/dlfcn.hAPPLE /usr/include/dlfcn.h
========================================

% chmod 770 /usr/local/sbin/remove_dlcompat;\
% chmod 770 /usr/local/sbin/restore_dlcompat
fileutils-4.1:
reference URL: coreutils Downloads: fileutils-4.1.tar.gz

% unsetenv CFLAGS CPPFLAGS CXX CXXFLAGS LDFLAGS LDDLFLAGS ;\
% setenv CFLAGS "-no-cpp-precomp"

% gnutar zxf fileutils-4.1.tar.gz

% cd /usr/ports/fileutils-4.1

% ./configure \
--prefix=/usr/local/fileutils \
--disable-nls

% make
% make install

% mv /usr/local/fileutils/bin/dircolors /usr/local/bin/ ;\
% mv /usr/local/fileutils/bin/ls /bin/ ;\
% mv /usr/local/fileutils/bin/mv /bin/

% rehash
tcl/tk AquaBI-8.4.2.0-Jaguar:
reference URLs: Downloads: TclTkAquaBI-8.4.2.0.dmg

% rm -rf \
/System/Library/Tcl \
/usr/bin/tcl* \
/usr/include/tcl* \
/usr/lib/libtcl* \
/usr/share/vi/tcl
Mount the .dmg, then double-click the installer from the image to install berkeley-db-4.1.25 (w/ strong crypto):
reference URLs: Downloads: db-4.1.25.tar.gz

% unsetenv CFLAGS CPPFLAGS CXX CXXFLAGS LDFLAGS LDDLFLAGS ;\
% setenv CPPFLAGS "-I/Library/Frameworks/Tcl.framework/Headers" ;\
% setenv LDFLAGS "-F/Library/Frameworks -framework Tcl"

% gnutar zxf db-4.1.25.tar.gz

% rm -rf \
/usr/docs/api_c \
/usr/docs/api_java \
/usr/docs/api_cxx \
/usr/docs/api_tcl
(edit) configure

% vi /usr/ports/db-4.1.25/dist/
========================================

  _JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[^/]*$::'`
  case "$host_os" in
    ---            darwin*)   _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[^/]*$::'`
    +++            darwin*)   _JTOPDIR=/System/Library/Frameworks/JavaVM.framework/Versions/1.4.1
    _JINC="$_JTOPDIR/Headers";;
    *)   _JINC="$_JTOPDIR/include";;
  esac
========================================

(edit) fop_util.c

% vi /usr/ports/db-4.1.25/fileops/fop_util.c
======================================== ~ line: 40

    u_int32_t __lockval;          \
                                  \
    if (LOCKING_ON((ENV))) {      \
---   __lockval = 0;                                \
+++   __lockval = 1;                                \
      __dbt.data = &__lockval;                      \
      __dbt.size = sizeof(__lockval);               \
      if ((ret = (ENV)->lock_get((ENV), (ID),       \
========================================

% cd /usr/ports/db-4.1.25/build_unix

% ../dist/configure \
--prefix=/usr \
--enable-cxx \
--enable-java \
--enable-compat185 \
--enable-tcl \
--with-tcl=/Library/Frameworks/Tcl.framework

% make
% make install
perl-5.8.1:
reference URLs: Downloads: "STABLE" release (stable.tar.gz)

% unsetenv CFLAGS CPPFLAGS CXX CXXFLAGS LDFLAGS LDDLFLAGS LD_PREBIND LC_ALL LANG LINGUAS

% gnutar zxvf stable.tar.gz

% rm -rf \
/System/Library/Perl \
/Library/Perl \
/usr/bin/perl* \
/usr/bin/find2perl \
/usr/docs/ref/perl \
/var/root/.cpan* \
/usr/ports/cpan* \
/usr/local/lib/libdl*
# makesure these DIRs exist:

%        mkdir /usr/libexec/httpd ;\
      mkdir /usr/libexec/apache2

% setenv DYLD_LIBRARY_PATH /usr/ports/perl-5.8.1

% cd /usr/ports/perl-5.8.1

% ./Configure -Dfirstmakefile=GNUmakefile -Duseshrplib -Duseperlio \
  -Duseithreads -Dinstallusrbinperl -Dprefix=/usr \
  -Dperladmin=yourname@yourdomain.com -Dcf_email=yourname@yourdomain.com \
  -Dperllibs='-ldb -lc -lm -dl' -Dlibs='-ldb -lc -lm -ldl'
ENTER the configuration dialogue .... and accept all the defaults with

   Which of these apply, if any? [darwin] & -d
   (OK, I'll run with -d after this question.)
   Which of these apply, if any? [darwin] (RETURN)
(... continue on automatic ...)

% make
% make test
"make test" output should include something like:
=========================================================
"make test" output:
---------------------------------------------------------

...
       All tests successful.
 u=5.38  s=3.41  cu=416.61  cs=77.72  scripts=785  tests=77510
...
=========================================================

% make install
% unsetenv DYLD_LIBRARY_PATH
% rehash
FOR REFERENCE, the output of perl -V before & after the Panther replace:
=========================================================
PERL configuration summary:
% perl -V [DEFAULT Panther Install]:
---------------------------------------------------------

Summary of my perl5 (revision 5.0 version 8 subversion 1 RC3) configuration:
  Platform:
    osname=darwin, osvers=7.0, archname=darwin-thread-multi-2level
    uname='darwin hampsten 7.0 darwin kernel version 6.0: fri jul 25 16:58:41 pdt 2003;
     root:xnu-344.frankd.rootsxnu-344.frankd~objrelease_ppc power macintosh powerpc '
    config_args='-ds -e -Dprefix=/usr -Dccflags=-g  -pipe  -Dldflags=-Dman3ext=3pm -Duseithreads -Duseshrplib'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-g -pipe -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include',
    optimize='-Os',
    cppflags='-no-cpp-precomp -g -pipe -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build 1495)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='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=true, libperl=libperl.dylib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dyld.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: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
  Locally applied patches:
        RC3
  Built under darwin
  Compiled at Sep 12 2003 19:50:49
  @INC:
    /System/Library/Perl/5.8.1/darwin-thread-multi-2level
    /System/Library/Perl/5.8.1
    /Library/Perl/5.8.1/darwin-thread-multi-2level
    /Library/Perl/5.8.1
    /Library/Perl
    /Network/Library/Perl/5.8.1/darwin-thread-multi-2level
    /Network/Library/Perl/5.8.1
    /Network/Library/Perl
    .
=========================================================
PERL configuration summary:
% perl -V [New Install]:
---------------------------------------------------------

Summary of my perl5 (revision 5.0 version 8 subversion 1) configuration:
  Platform:
    osname=darwin, osvers=7.0.0, archname=darwin-thread-multi-2level
    uname='darwin myserver.mydomain.com 7.0.0 darwin kernel version 7.0.0: 
     wed sep 24 15:48:39 pdt 2003; root:xnuxnu-517.obj~1release_ppc power macintosh powerpc '
    config_args='-Dfirstmakefile=GNUmakefile -Duseshrplib -Duseperlio -Duseithreads -Dinstallusrbinperl -Dprefix=/usr -Dperladmin=yourname@yourdomain.com -Dcf_email=yourname@yourdomain.com -Dperllibs=-ldb -lc -lm -dl -Dlibs=-ldb -lc -lm -ldl'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include',
    optimize='-Os',
    cppflags='-no-cpp-precomp -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build 1495)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib
    libs=-ldb -lc -lm -ldl
    perllibs=-lc -lm -ldl
    libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, libperl=libperl.dylib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dyld.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: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
  Built under darwin
  Compiled at Oct 25 2003 16:45:48
  @INC:
    /System/Library/Perl/5.8.1/darwin-thread-multi-2level
    /System/Library/Perl/5.8.1
    /Library/Perl/5.8.1/darwin-thread-multi-2level
    /Library/Perl/5.8.1
    /Library/Perl
    /Network/Library/Perl/5.8.1/darwin-thread-multi-2level
    /Network/Library/Perl/5.8.1
    /Network/Library/Perl
    .
=========================================================
CPAN:
reference URLs: for convenience, set an alias of cpan == "perl -MCPAN -e shell", then

% cpan
run the config dialog as you choose; personally, I accept all the defaults except:

    CPAN build and cache directory?         /usr/ports/cpan_build
    Policy on building prerequisites (follow, ask or ignore)?       follow
    Parameters for the 'perl Makefile.PL' command? Your choice:   LINKTYPE=dynamic
    Parameters for the 'make install' command? Your choice:       UNINST=1

cpan> install URI LWP Bundle::CPAN
Make sure you answer these as follows, or you'll mess up your GET, HEAD and POST aliases:

     Do you want to install lwp-request?     y
     Do you want to install lwp-mirror?      y
     Do you want to install lwp-rget?        y
     Do you want to install lwp-download?    y
     Do you want to install the GET alias?   no
     Do you want to install the HEAD alias?  no
     Do you want to install the POST alias?  no

cpan> reload cpan
# I find these frequently useful, add/delete as you like:

cpan> install MD5 HTTP::Date Bundle::DBI MacOSX::File Bundle::XML Net::SSLeay Devel::CoreStack
when the install asks: "please note that SSLeay is no longer supported, see README) (C-c to abort):" enter,

    /usr
# query for newer versions of installed modules, and install them)

cpan> r
#in this case:

cpan> install Filter::Simple I18N::LangTags MIME::Base64 Net::Domain Pod::Perldoc Text::Soundex Unicode::Collate Unicode::Normalize
cpan> q
gawk-3.1.2:
reference URL: gawk @ gnu Downloads: gawk-3.1.2.tar.gz

% gnutar zxf gawk-3.1.2.tar.gz

% cd /usr/ports/gawk-3.1.2

% unsetenv CFLAGS CPPFLAGS CXX CXXFLAGS LDFLAGS LDDLFLAGS

% ./configure \
--prefix=/usr/local \
--disable-nls

% make
% make install
postfix-2.0.16:
reference URL: postfix home Downloads: postfix-2.0.16.tar.gz # keep the configs around for reference ...

% mv /etc/postfix /etc/postfixPANTHER
% gnutar zxf postfix-2.0.16.tar.gz
% cd /usr/ports/postfix-2.0.16


(edit) makedefs

% vi /usr/ports/postfix-2.0.16/makedefs
========================================

---      Rhapsody.5*|Darwin.*)
+++      Rhapsody.5*)
    SYSTYPE=RHAPSODY5
    # Use the native compiler by default
    : ${CC=cc}
    AWK=gawk
    case $RELEASE in
      1.[0-3]) ;;
      *) AWK=awk
      SYSLIBS=-flat_namespace
      ;;
    esac 
    ;;
---     "Mac OS".10*)   SYSTYPE=MACOSX
+++     "Mac OS".10*|Darwin.*)  SYSTYPE=MACOSX
    # Use the native compiler by default
    : ${CC=cc}
    AWK=gawk
+++               SYSLIBS="-ldl -flat_namespace"
    ;;
========================================

(edit) dns.h

% vi /usr/ports/postfix-2.0.16/src/dns/dns.h
========================================

 #include <netinet/in.h>
 #include <arpa/nameser.h>
+++    #include <arpa/nameser8_compat.h>
       #ifdef RESOLVE_H_NEEDS_STDIO_H
========================================

% unsetenv CFLAGS CPPFLAGS CXX CXXFLAGS LDFLAGS LDDLFLAGS LD_PREBIND

% make tidy

% make makefiles \
CCARGS="-DHAS_DB -I/usr/include/arpa -I/usr/include" \
AUXLIBS="-L/usr/lib -ldb -ldl -lm -lresolv"

% make

% cd /usr/ports/postfix-2.0.16/auxiliary/MacOSX/
% ./repair-oldsetup
% ./backup-sendmail-binaries
% ./niscript

% cd ../..

% make install
enter questionnaire ... make sure that you CHANGE the following .....

> setgid_group: [postdrop] maildrop

% cd /usr/ports/postfix-2.0.16/auxiliary/MacOSX/
% ./backup-postfix-binaries
edit /etc/postfix/main.cf to suit your requirements

./deactivate-postfix
./activate-postfix
PostFix should now be started ... check with "ps -ax | grep postfix"

% mkdir /etc/aliases
% newaliases

<b>(save the original Apple/Postfix startup items for reference)</b>
% mkdir /Library/StartupItemsDISABLED
% mv /Library/StartupItems/Postfix /Library/StartupItemsDISABLED
EDIT your NEW /System/Library/StartupItems/Postfix as necessary

If you want to launch on startup, make sure POSTFIX=-YES- in /etc/hostconfig

Comments (21)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20031106132742400