{"id":15015358,"url":"https://github.com/vadimkantorov/perlpack","last_synced_at":"2026-02-04T03:03:16.407Z","repository":{"id":252985313,"uuid":"842097874","full_name":"vadimkantorov/perlpack","owner":"vadimkantorov","description":"Primer on a fully self-contained, statically linked build of Perl embedding in the binary system .pm files and any other files","archived":false,"fork":false,"pushed_at":"2025-01-25T13:23:26.000Z","size":145,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-13T00:18:06.679Z","etag":null,"topics":["embed","io","perl","static","static-linking","virtual-file-system"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vadimkantorov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-13T17:04:47.000Z","updated_at":"2025-01-25T13:23:29.000Z","dependencies_parsed_at":"2024-08-13T20:58:51.078Z","dependency_job_id":"ce33614f-d16d-4f61-b20c-30fa03fb89a2","html_url":"https://github.com/vadimkantorov/perlpack","commit_stats":null,"previous_names":["vadimkantorov/perlpack"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vadimkantorov/perlpack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vadimkantorov%2Fperlpack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vadimkantorov%2Fperlpack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vadimkantorov%2Fperlpack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vadimkantorov%2Fperlpack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vadimkantorov","download_url":"https://codeload.github.com/vadimkantorov/perlpack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vadimkantorov%2Fperlpack/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263980009,"owners_count":23538917,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["embed","io","perl","static","static-linking","virtual-file-system"],"created_at":"2024-09-24T19:47:01.195Z","updated_at":"2026-02-04T03:03:16.354Z","avatar_url":"https://github.com/vadimkantorov.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Primer on a single-file, self-contained, fully statically-linked build of Perl, embedding a virtual, read-only file system (with all `*.pm` files and arbitrary files)\n- build Perl into a single, self-contained, fully statically-linked executable\n- builds all builtin modules statically and then links them statically\n- showcases using Alpine Linux and musl libc for static linking with libc\n- embeds `*.pm` modules into the executable\n- showcases embedding a user Perl script (for illustration is used `perlpack.pl`, see [`Makefile`](./Makefile))\n- showcases embedding arbitrary files along (see [`Makefile`](./Makefile) and add files into the `packfs` directory)\n- showcases the `--wrap` linker flag enabling the overrides of the libc's filesystem-related functions\n\n# Limitations\n- not all I/O function calls are reimplemented\n- it's only a proof-of-concept, very little tested\n\n# Files of interest\n- [`perlpack.c`](./perlpack.c) - the main C program which embeds Perl, includes [`perlpack.h`](./perlpack.h) and override I/O callback to enable transparent access to the embedded files\n- [`perlpack.pl`](./perlpack.pl) - generates in place a more non-empty [`perlpack.h`](./perlpack.h), default [`perlpack.h`](./perlpack.h) provided only from illustrative purposes\n- [`Makefile`](./Makefile) - showcases building of main binaries `perlpackstatic` (and embedded `myscript.o`, `perlpack.o`)\n- [`.github/workflows/perlpack.yml`](.github/workflows/perlpack.yml) - showcases testing command sequence\n- `perlpackstatic` - built in [`Makefile`](./Makefile), the main binary with embedded Perl (using `/mnt/packperl/` as the \"mount-point\" for the embedded, read-only virtual FS)\n\n# Overridden functions\n- `open`\n- `access`\n- `stat`\n- `fstat`\n- `lseek`\n- `read`\n- `close`\n- `fopen`\n- `fileno`\n\n# Prior complete, but also more complex approaches\n- https://metacpan.org/dist/App-Staticperl/view/staticperl.pod\n- http://staticperl.schmorp.de/smallperl.html\n- http://staticperl.schmorp.de/smallperl.bundle\n- http://staticperl.schmorp.de/bigperl.bundle\n- https://metacpan.org/pod/PAR::Packer\n\n# References and alternatives\n- https://metacpan.org/pod/PerlIO\n- https://perldoc.perl.org/perlembed\n- https://perldoc.perl.org/open\n- https://perl.mines-albi.fr/perl5.8.5/5.8.5/sun4-solaris/Encode/PerlIO.html\n- https://perldoc.perl.org/Encode::PerlIO\n- https://linux.die.net/man/1/perliol\n- https://docs.mojolicious.org/perliol\n- https://stackoverflow.com/questions/12729545/why-is-this-xs-code-that-returns-a-perlio-leaky\n- https://perldoc.perl.org/perlembed\n- https://perldoc.perl.org/perlguts\n- https://www.perlmonks.org/?node_id=385469\n- https://github.com/Perl/perl5/commit/0301e899536a22752f40481d8a1d141b7a7dda82\n- https://github.com/Perl/perl5/issues/16565\n- https://www.postgresql.org/message-id/23260.1527026547%40sss.pgh.pa.us\n- https://medium.com/booking-com-development/native-extensions-for-perl-without-smoke-and-mirrors-40479999dfc8\n- https://github.com/xsawyerx/xs-fun\n- https://perldoc.perl.org/perlxs\n- https://perldoc.perl.org/perlapi\n- https://stackoverflow.com/questions/10763394/how-to-build-a-c-program-using-a-custom-version-of-glibc-and-static-linking\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvadimkantorov%2Fperlpack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvadimkantorov%2Fperlpack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvadimkantorov%2Fperlpack/lists"}