This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
SvRX() and SvRXOK() macros
[perl5.git] / Cross / README.new
1 You're reading ./Cross/README.new, describing Perl cross-compilation process.
2 NOTE: this file will replace ./Cross/README, after cross-compilation scheme
3 will stabilize;
4
5 =head1 Cross-compilation for linux
6
7 This is second approach to linux cross-compiling, which should allow building
8 full perl and entensions for target platform. Cross-compiling for linux
9 uses similar approach and share same files as cross-compiling for WINCE.
10
11 We refer to HOST as the platform where the build is performed, and to
12 TARGET as where final executables will run.
13
14 =head2 Basic ideas
15
16 =head3 common
17
18 Unlike WINCE, output files from GCC cross-compiler are produced in the same
19 directory where C files are. All TARGET binaries have different extensions
20 so to distinguish HOST and TARGET binaries. Namely, object files for C<arm>
21 cross-compilation will have extension C<.armo>, executable files will have
22 C<.arm>.
23
24 After typical cross-compilation the following files will be built, among
25 others:
26
27   sv.c
28   sv.o
29   sv.armo
30   libperl.arma
31
32 (this approach may be reconsidered, however.)
33
34 =head3 build process
35
36 C<miniperl> is built. This executable is intended to run on HOST, and it
37 will facilitate the remaining build process; all binaries built after it are
38 foreign (TARGET) and should not run locally (HOST).
39
40 Unlike HOST build, miniperl will not have C<Config.pm> of HOST within reach;
41 it rather will use the C<Config.pm> from the cross-compilation directories.
42 In fact, if the build process does have Config.pm within reach, this is only
43 an indication of a mistake somewhere in the middle.
44
45   # following command is okay:
46   ./miniperl -Ilib -MCross -MConfig -e 1
47   # following command should cluck, and it is bad if it does not:
48   ./miniperl -Ilib -MConfig -e 1
49
50 After C<miniperl> is built, C<configpm> is invoked to create right C<Config.pm>
51 in right place and its corresponding Cross.pm.
52
53 File C<Cross.pm> is dead simple: for given cross-architecture places in @INC
54 a path where perl modules are, and right C<Config.pm> in that place.
55
56 That said, C<miniperl -Ilib -MConfig -we 1> should report an error, because
57 it can not find C<Config.pm>. If it does not give an error -- wrong C<Config.pm>
58 is substituted, and resulting binaries will be a mess.
59
60 C<miniperl -MCross -MConfig -we 1> should run okay, and it will provide right
61 C<Config.pm> for further compilations.
62
63 During extensions build phase, the script C<./ext/util/make_ext_cross> is
64 invoked.
65
66 All invokes of C<Makefile.PL> are provided with C<-MCross> so to enable cross-
67 compile.
68
69 =head2 BUILD
70
71 =head3 Tools & SDK
72
73 For compiling, you need following:
74
75 =over 4
76
77 =item * TODO
78
79 =back
80
81 =head1 Things to be done
82
83 =over 4
84
85 =item * better distinguishing of config.h/xconfig.h, dependancies
86
87 =item * object files created in ./xlib/cross-name/ ?
88
89 =back