source: for-distributions/trunk/bin/windows/perl/lib/Pod/perlmacosx.pod@ 14489

Last change on this file since 14489 was 14489, checked in by oranfry, 17 years ago

upgrading to perl 5.8

File size: 9.2 KB
Line 
1If you read this file _as_is_, just ignore the funny characters you see.
2It is written in the POD format (see pod/perlpod.pod) which is specially
3designed to be readable as is.
4
5=head1 NAME
6
7README.macosx - Perl under Mac OS X
8
9=head1 SYNOPSIS
10
11This document briefly describes perl under Mac OS X.
12
13
14=head1 DESCRIPTION
15
16The latest Perl release (5.8.8 as of this writing) builds without changes
17under Mac OS X. Under 10.3 "Panther" and newer OS versions, all self-tests
18pass, and all standard features are supported.
19
20Earlier Mac OS X releases (10.2 "Jaguar" and older) did not include a
21completely thread-safe libc, so threading is not fully supported. Also,
22earlier releases included a buggy libdb, so some of the DB_File tests
23are known to fail on those releases.
24
25
26=head2 Installation Prefix
27
28The default installation location for this release uses the traditional
29UNIX directory layout under /usr/local. This is the recommended location
30for most users, and will leave the Apple-supplied Perl and its modules
31undisturbed.
32
33Using an installation prefix of '/usr' will result in a directory layout
34that 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
38on a file server and used by many Macs.
39
40
41=head2 SDK support
42
43First, export the path to the SDK into the build environment:
44
45 export SDK=/Developer/SDKs/MacOSX10.3.9.sdk
46
47Use an SDK by exporting some additions to Perl's 'ccflags' and '..flags'
48config 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
58To compile perl as a universal binary (built for both ppc and intel), export
59the SDK variable as above, selecting the 10.4u SDK:
60
61 export SDK=/Developer/SDKs/MacOSX10.4u.sdk
62
63In addition to the compiler flags used to select the SDK, also add the flags
64for 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
72Keep in mind that these compiler and linker settings will also be used when
73building CPAN modules. For XS modules to be compiled as a universal binary, any
74libraries it links to must also be universal binaries. The system libraries that
75Apple includes with the 10.4u SDK are all universal, but user-installed libraries
76may need to be re-installed as universal binaries.
77
78=head2 libperl and Prebinding
79
80Mac OS X ships with a dynamically-loaded libperl, but the default for
81this release is to compile a static libperl. The reason for this is
82pre-binding. Dynamic libraries can be pre-bound to a specific address in
83memory in order to decrease load time. To do this, one needs to be aware
84of the location and size of all previously-loaded libraries. Apple
85collects this information as part of their overall OS build process, and
86thus has easy access to it when building Perl, but ordinary users would
87need to go to a great deal of effort to obtain the information needed
88for pre-binding.
89
90You 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
92releases will be greater than either the static library, or Apple's
93pre-bound dynamic library.
94
95With 10.4 "Tiger" and newer, Apple has all but eliminated the performance
96penalty for non-prebound libraries.
97
98
99=head2 Updating Apple's Perl
100
101In a word - don't, at least without a *very* good reason. Your scripts
102can just as easily begin with "#!/usr/local/bin/perl" as with
103"#!/usr/bin/perl". Scripts supplied by Apple and other third parties as
104part of installation packages and such have generally only been tested
105with the /usr/bin/perl that's installed by Apple.
106
107If you find that you do need to update the system Perl, one issue worth
108keeping in mind is the question of static vs. dynamic libraries. If you
109upgrade using the default static libperl, you will find that the dynamic
110libperl supplied by Apple will not be deleted. If both libraries are
111present when an application that links against libperl is built, ld will
112link against the dynamic library by default. So, if you need to replace
113Apple's dynamic libperl with a static libperl, you need to be sure to
114delete the older dynamic library after you've installed the update.
115
116
117=head2 Known problems
118
119If you have installed extra libraries such as GDBM through Fink
120(in other words, you have libraries under F</sw/lib>), or libdlcompat
121to F</usr/local/lib>, you may need to be extra careful when running
122Configure to not to confuse Configure and Perl about which libraries
123to use. Being confused will show up for example as "dyld" errors about
124symbol problems, for example during "make test". The safest bet is to run
125Configure as
126
127 Configure ... -Uloclibpth -Dlibpth=/usr/lib
128
129to make Configure look only into the system libraries. If you have some
130extra library directories that you really want to use (such as newer
131Berkeley DB libraries in pre-Panther systems), add those to the libpth:
132
133 Configure ... -Uloclibpth -Dlibpth='/usr/lib /opt/lib'
134
135The default of building Perl statically may cause problems with complex
136applications like Tk: in that case consider building shared Perl
137
138 Configure ... -Duseshrplib
139
140but remember that there's a startup cost to pay in that case (see above
141"libperl and Prebinding").
142
143Starting with Tiger (Mac OS X 10.4), Apple shipped broken locale files for
144the eu_ES locale (Basque-Spain). In previous releases of Perl, this resulted in
145failures in the C<lib/locale> test. These failures have been supressed
146in the current release of Perl by making the test ignore the broken locale.
147If you need to use the eu_ES locale, you should contact Apple support.
148
149=head2 MacPerl
150
151Quite a bit has been written about MacPerl, the Perl distribution for
152"Classic MacOS" - that is, versions 9 and earlier of MacOS. Because it
153runs in environment that's very different from that of UNIX, many things
154are done differently in MacPerl. Modules are installed using a different
155procedure, Perl itself is built differently, path names are different,
156etc.
157
158From the perspective of a Perl programmer, Mac OS X is more like a
159traditional UNIX than Classic MacOS. If you find documentation that
160refers to a special procedure that's needed for MacOS that's drastically
161different from the instructions provided for UNIX, the MacOS
162instructions are quite often intended for MacPerl on Classic MacOS. In
163that case, the correct procedure on Mac OS X is usually to follow the
164UNIX instructions, rather than the MacPerl instructions.
165
166
167=head2 Carbon
168
169MacPerl ships with a number of modules that are used to access the
170classic MacOS toolbox. Many of these modules have been updated to use
171Mac OS X's newer "Carbon" toolbox, and are available from CPAN in the
172"Mac::Carbon" module.
173
174
175=head2 Cocoa
176
177There are two ways to use Cocoa from Perl. Apple's PerlObjCBridge
178module, included with Mac OS X, can be used by standalone scripts to
179access Foundation (i.e. non-GUI) classes and objects.
180
181An alternative is CamelBones, a framework that allows access to both
182Foundation and AppKit classes and objects, so that full GUI applications
183can be built in Perl. CamelBones can be found on SourceForge, at
184L<http://www.sourceforge.net/projects/camelbones/>.
185
186
187=head1 Starting From Scratch
188
189Unfortunately it is not that difficult somehow manage to break one's
190Mac OS X Perl rather severely. If all else fails and you want to
191really, B<REALLY>, start from scratch and remove even your Apple Perl
192installation (which has become corrupted somehow), the following
193instructions should do it. B<Please think twice before following
194these instructions: they are much like conducting brain surgery to
195yourself. Without anesthesia.> We will B<not> come to fix your system
196if you do this.
197
198First, get rid of the libperl.dylib:
199
200 # cd /System/Library/Perl/darwin/CORE
201 # rm libperl.dylib
202
203Then delete every .bundle file found anywhere in the folders:
204
205 /System/Library/Perl
206 /Library/Perl
207
208You can find them for example by
209
210 # find /System/Library/Perl /Library/Perl -name '*.bundle' -print
211
212After this you can either copy Perl from your operating system media
213(you will need at least the /System/Library/Perl and /usr/bin/perl),
214or rebuild Perl from the source code with C<Configure -Dprefix=/usr
215-Dusershrplib> NOTE: the C<-Dprefix=/usr> to replace the system Perl
216works much better with Perl 5.8.1 and later, in Perl 5.8.0 the
217settings were not quite right.
218
219"Pacifist" from CharlesSoft (L<http://www.charlessoft.com/>) is a nice
220way to extract the Perl binaries from the OS media, without having to
221reinstall the entire OS.
222
223
224=head1 AUTHOR
225
226This README was written by Sherm Pendley E<lt>[email protected]<gt>,
227and subsequently updated by Dominic Dunlop E<lt>[email protected]<gt>.
228The "Starting From Scratch" recipe was contributed by John Montbriand
229E<lt>[email protected]<gt>.
230
231=head1 DATE
232
233Last modified 2005-11-07.
Note: See TracBrowser for help on using the repository browser.