| 1 | If you read this file _as_is_, just ignore the funny characters you see.
|
|---|
| 2 | It is written in the POD format (see pod/perlpod.pod) which is specially
|
|---|
| 3 | designed to be readable as is.
|
|---|
| 4 |
|
|---|
| 5 | =head1 NAME
|
|---|
| 6 |
|
|---|
| 7 | README.macosx - Perl under Mac OS X
|
|---|
| 8 |
|
|---|
| 9 | =head1 SYNOPSIS
|
|---|
| 10 |
|
|---|
| 11 | This document briefly describes perl under Mac OS X.
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 | =head1 DESCRIPTION
|
|---|
| 15 |
|
|---|
| 16 | The latest Perl release (5.8.8 as of this writing) builds without changes
|
|---|
| 17 | under Mac OS X. Under 10.3 "Panther" and newer OS versions, all self-tests
|
|---|
| 18 | pass, and all standard features are supported.
|
|---|
| 19 |
|
|---|
| 20 | Earlier Mac OS X releases (10.2 "Jaguar" and older) did not include a
|
|---|
| 21 | completely thread-safe libc, so threading is not fully supported. Also,
|
|---|
| 22 | earlier releases included a buggy libdb, so some of the DB_File tests
|
|---|
| 23 | are known to fail on those releases.
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 | =head2 Installation Prefix
|
|---|
| 27 |
|
|---|
| 28 | The default installation location for this release uses the traditional
|
|---|
| 29 | UNIX directory layout under /usr/local. This is the recommended location
|
|---|
| 30 | for most users, and will leave the Apple-supplied Perl and its modules
|
|---|
| 31 | undisturbed.
|
|---|
| 32 |
|
|---|
| 33 | Using an installation prefix of '/usr' will result in a directory layout
|
|---|
| 34 | that mirrors that of Apple's default Perl, with core modules stored in
|
|---|
| 35 | '/System/Library/Perl/${version}', CPAN modules stored in
|
|---|
| 36 | '/Library/Perl/${version}', and the addition of
|
|---|
| 37 | '/Network/Library/Perl/${version}' to @INC for modules that are stored
|
|---|
| 38 | on a file server and used by many Macs.
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 | =head2 SDK support
|
|---|
| 42 |
|
|---|
| 43 | First, export the path to the SDK into the build environment:
|
|---|
| 44 |
|
|---|
| 45 | export SDK=/Developer/SDKs/MacOSX10.3.9.sdk
|
|---|
| 46 |
|
|---|
| 47 | Use an SDK by exporting some additions to Perl's 'ccflags' and '..flags'
|
|---|
| 48 | config variables:
|
|---|
| 49 |
|
|---|
| 50 | ./Configure -Accflags="-nostdinc -B$SDK/usr/include/gcc \
|
|---|
| 51 | -B$SDK/usr/lib/gcc -isystem$SDK/usr/include \
|
|---|
| 52 | -F$SDK/System/Library/Frameworks" \
|
|---|
| 53 | -Aldflags="-Wl,-syslibroot,$SDK" \
|
|---|
| 54 | -de
|
|---|
| 55 |
|
|---|
| 56 | =head2 Universal Binary support
|
|---|
| 57 |
|
|---|
| 58 | To compile perl as a universal binary (built for both ppc and intel), export
|
|---|
| 59 | the SDK variable as above, selecting the 10.4u SDK:
|
|---|
| 60 |
|
|---|
| 61 | export SDK=/Developer/SDKs/MacOSX10.4u.sdk
|
|---|
| 62 |
|
|---|
| 63 | In addition to the compiler flags used to select the SDK, also add the flags
|
|---|
| 64 | for creating a universal binary:
|
|---|
| 65 |
|
|---|
| 66 | ./Configure -Accflags="-arch i686 -arch ppc -nostdinc -B$SDK/usr/include/gcc \
|
|---|
| 67 | -B$SDK/usr/lib/gcc -isystem$SDK/usr/include \
|
|---|
| 68 | -F$SDK/System/Library/Frameworks" \
|
|---|
| 69 | -Aldflags="-arch i686 -arch ppc -Wl,-syslibroot,$SDK" \
|
|---|
| 70 | -de
|
|---|
| 71 |
|
|---|
| 72 | Keep in mind that these compiler and linker settings will also be used when
|
|---|
| 73 | building CPAN modules. For XS modules to be compiled as a universal binary, any
|
|---|
| 74 | libraries it links to must also be universal binaries. The system libraries that
|
|---|
| 75 | Apple includes with the 10.4u SDK are all universal, but user-installed libraries
|
|---|
| 76 | may need to be re-installed as universal binaries.
|
|---|
| 77 |
|
|---|
| 78 | =head2 libperl and Prebinding
|
|---|
| 79 |
|
|---|
| 80 | Mac OS X ships with a dynamically-loaded libperl, but the default for
|
|---|
| 81 | this release is to compile a static libperl. The reason for this is
|
|---|
| 82 | pre-binding. Dynamic libraries can be pre-bound to a specific address in
|
|---|
| 83 | memory in order to decrease load time. To do this, one needs to be aware
|
|---|
| 84 | of the location and size of all previously-loaded libraries. Apple
|
|---|
| 85 | collects this information as part of their overall OS build process, and
|
|---|
| 86 | thus has easy access to it when building Perl, but ordinary users would
|
|---|
| 87 | need to go to a great deal of effort to obtain the information needed
|
|---|
| 88 | for pre-binding.
|
|---|
| 89 |
|
|---|
| 90 | You can override the default and build a shared libperl if you wish
|
|---|
| 91 | (S<Configure ... -Duseshrlib>), but the load time on pre-10.4 OS
|
|---|
| 92 | releases will be greater than either the static library, or Apple's
|
|---|
| 93 | pre-bound dynamic library.
|
|---|
| 94 |
|
|---|
| 95 | With 10.4 "Tiger" and newer, Apple has all but eliminated the performance
|
|---|
| 96 | penalty for non-prebound libraries.
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 | =head2 Updating Apple's Perl
|
|---|
| 100 |
|
|---|
| 101 | In a word - don't, at least without a *very* good reason. Your scripts
|
|---|
| 102 | can just as easily begin with "#!/usr/local/bin/perl" as with
|
|---|
| 103 | "#!/usr/bin/perl". Scripts supplied by Apple and other third parties as
|
|---|
| 104 | part of installation packages and such have generally only been tested
|
|---|
| 105 | with the /usr/bin/perl that's installed by Apple.
|
|---|
| 106 |
|
|---|
|
|---|