Computoid
| About | APPerlNAME
Actually Portable Perl (APPerl)
DESCRIPTION
Actually Portable Perl (APPerl) is a distribution of Perl that runs on several x86_64 operating systems (most Unix-like and Windows) via the same binary. It builds to a single binary with perl modules packed inside of it.
Cross-platform, single binary, standalone Perl applications can be made by building custom versions of APPerl, with and without compiling Perl from scratch, so it can be used an alternative to PAR::Packer. APPerl could also easily be added to development SDKs, carried on your USB drive, or just allow you to run the exact same perl on all your PCs multiple computers.
Information on the creation of APPerl can be found in this blogpost.
Actually Portable Perl was presented at TPRC 2024: Video | Slides
FEATURES
- Runs on six operating systems with the same binary!
- Full build of Perl 5, perl modules, C extensions, and all under 24 MiB, Small build under 5 MiB
- Polygot binary format is also a ZIP file allowing for easy inspection and modification with standard tools
- Scripts can be embedded and ran from inside the executable:
./perl.com /zip/bin/perldoc Perl::Dist::APPerl
argv[0]
script execution allows for easy creation of single file applications:ln -s perl.com perldoc.com && ./perldoc.com Perl::Dist::APPerl
apperlm
tool enables building custom APPerl versions and applications with and without building Perl from source
RELEASES
Latest Release Builds
perl.com
- The full release of APPerl, perl v5.36.3, built with all default modules and C extensions.perl-small.com
- Slimmed down build of APPerl, perl v5.36.3, no perldoc.perl-vista.com
- Full APPerl, perl v5.36.3, with Vista/7 support from a Cosmo fork.perl-small-vista.com
- Small APPerl, perl v5.36.3, with Vista/7 support from a Cosmo fork.
apperlm
(APPerl Manager) is available on CPAN: Perl::Dist::APPerl
apperlm
is also packaged inside of full builds
of APPerl for convenience; see BOOTSTRAPPING.
Releases (on GitHub)
- v0.6.1 - Fix bootstrapped builds
- v0.6.0 - Build with cosmocc 3.3.10, fix some extensions not being linked with install_modules
- v0.5.0 - Revert updating cosmo, build with perl 5.36.3
v0.4.0 - Build full and small targets with cosmo 3.0.2 and perl 5.36.1- v0.3.0 - Added installing CPAN distributions from disk, more script execution shortcuts
- v0.2.1 - Remove dependency on Env module.
- v0.2.0 - Enable cross-platform builds of `nobuild` configs (even on Windows).
- v0.1.1 - Fix 5.10 support and broken pod link, thanks to MJGARDNER GH#1
- v0.1.0 - Fix issues with Time-HiRes Configure. Pin Perl version to configs.
- v0.0.3 / v0.0.4 - Add leading '-' support to config parsing to remove items from an existing set.
- v0.0.2 - add small builds
- v0.0.1 - first release
USAGE NOTES
unix-like notes and troubleshooting
You must make the binary executable before it can be ran:chmod +x perl.com
Actually Portable Executables(APEs) such as APPerl, must be run from a Thompson Shell compatible shell such as bash
. On some Linux environments (such as WSL), you may need to fiddle with binfmt_misc
. Cosmopolitan Libc README
APEs automatically extract and install the APE Loader if it is not found. Usually, the APE Loader is installed to $HOME/.ape
. In order to run an APE, the APE Loader must be executable (not stored on a noexec
mount). See APE Loader.
APEs can sidestep the APE loader by converting to the native binary format (e.g. ELF, Mach-O):cp perl.com perl && ./perl --assimilate
. Of course, this makes them no longer APEs.
Running under pledge
If running third-party binaries makes you nervous, APPerl can be ran with pledge under Linux (pledge.com
can be built from the source in the Cosmopolitan Libc repo).
cp perl.com perl
./perl --assimilate
./pledge.com -p 'stdio rpath tty' ./perl -e 'print("hello world\n");'
./pledge.com -p 'stdio rpath tty cpath proc exec prot_exec tmppath' ./perl /zip/bin/perldoc Perl::Dist::APPerl
DOCUMENTATION, SOURCE CODE, AND SUPPORT
- Perl::Dist::APPerl documentation - APPerl usage info,
apperlm
documentation, instructions on building APPerl from source, and tutorials on creating custom applications and APPerl builds with and without compiling Perl from source. - Perl::Dist::APPerl repository -
apperlm
source code - perl5 fork for the Cosmopolitan Libc - perl5 patched to support building with the Cosmopolitan Libc, see perlcosmo
- Cosmopolitan Libc - build system for producing Actually Portable Executables with syscall polyfills
Support and bug reports should be filed as issues at the Perl::Dist::APPerl repo. Pull Requests are welcome at the repos. The Cosmopolitan Libc is a third-party project, be sure to read the guidelines there if contributing there.
Fixes to the cosmo platform in the perl source should be done on top of the cosmo
branch. Improvements to APPerl, but unfit to be merged into official perl should be done
on top of the cosmo-apperl
branch. Ideally someday we'll get the cosmo platform merged into official perl.
COMMUNITY
APPerl shares the Cosmopolitan Libc discord.
ACKNOWLEDGEMENTS
The Cosmopolitan Libc contributors, especially Justine Tunney and Gautham Venkatasubramanian. APPerl wouldn't be possible without Actually Portable Executables and polyfills of several Linux and POSIX APIs for other platforms. Gautham's Python port inspired this project.
AUTHOR
Gavin Hayes - my email and profiles are in the footer.
LICENSE AND COPYRIGHT
This software is copyright (c) 2022 by Gavin Hayes.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.