forked from Perl/perl5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.cosmo
87 lines (61 loc) · 2.89 KB
/
README.cosmo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
If you read this file _as_is_, just ignore the funny characters you see.
It is written in the POD format (see pod/perlpod.pod) which is specially
designed to be readable as is.
=head1 NAME
perlcosmo - Build-once run-anywhere Perl using the Cosmopolitan Libc
=head1 DESCRIPTION
The cosmo platform addition eases building Perl with the Cosmopolitan
Libc. When you build with the Cosmopolitan Libc, the libc is the
platform as the Cosmopolitan Libc targets building simultaneous support
for multiple operating systems (Unixes, Windows, etc) into the same
binary.
To get the most benefits of the cosmo platform, you likely want to
build Actually Portable Perl (APPerl) instead of this directly. See
L<Perl::Dist::APPerl> ; APPerl Manager (apperlm) includes a front-end
for building perl from source with the Cosmopolitan Libc. The
instructions in this document only cover building perl, not building or
packaging into APPerl (single executable perl with perl modules
embedded inside).
=head1 BUILD
Download the Cosmopolitan Libc and build with the desired MODE:
git clone https://github.com/jart/cosmopolitan ../cosmopolitan
make -C ../cosmopolitan -j4 MODE=
Run Configure, but with some environment variables to point it at
cosmopolitan; update COSMO_MODE to the MODE you set before and
COSMO_REPO to the absolute path of the cosmopolitan repo. Then, make
and install like usual.
COSMO_MODE= COSMO_REPO="/home/gavin/cosmopolitan" ./Configure -de
make
make install
Note the installed binary is assimilated (see Cosmopolitan Libc
--assimilate flag), meaning it only runs on the current operating
system. The perl.com in the perl repo, however, is actually portable
and will run on several operating systems. For a solution that builds
on this, by packaging perl modules and scripts inside of the executable
and more, see L<Perl::Dist::APPerl>.
=head1 KNOWN PROBLEMS
cosmo perl is a work in progress, many major issues are present.
=over 4
=item *
C<system> behavior when a shell is required, depends on the currently
running operating system. On most systems it uses, C<sh>, but on
Windows it uses C<cmd.exe>. Therefore, it's still hard to use portably.
However, it is sufficient for pulling up a pager for L<perldoc> .
=item *
After building, only Pure Perl modules may be added as perl is built
statically.
=item *
Some magic only works when the binary is assimilated. For example,
modifying C<$0>. Running with C<--assimilate> will bind the binary to
the current operating system.
=back
=head1 ACKNOWLEDGEMENTS
The L<Cosmopolitan Libc|https://github.com/jart/cosmopolitan>
contributors, especially L<Justine Tunney|https://justine.lol/> and
L<Gautham Venkatasubramanian|https://ahgamut.github.io>.
Gautham's
L<Python port|https://ahgamut.github.io/2021/07/13/ape-python/>
to the Cosmopolitan Libc inspired this port.
=head1 CONTACT
The port in-progress is being done by Gavin Hayes <gahayes@cpan.org>
Last update: 2022-10-11