Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvements of make-pp #802

Merged
merged 3 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- make-pp now requires the input to be specified with `-i` or `--input`.

0.98
- Released at 2023-08-11T22:54:38+0900
- Remove the support of cperl from `available` and `install` command. Github PR: #777. cperl can still be installed by specifying the tarball, just not by their short names.
Expand Down
27 changes: 15 additions & 12 deletions lib/App/perlbrew.pm
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ sub parse_cmdline {
'notest|n',
'quiet|q',
'verbose|v',
'input|i=s',
'output|o=s',
'as=s',
'append=s',
Expand Down Expand Up @@ -2777,25 +2778,27 @@ sub run_command_make_shim {
sub run_command_make_pp {
my ($self, $program) = @_;

unless ($program) {
my $current_env = $self->current_env
or die "ERROR: perlbrew is not activated. make-pp requires an perlbrew environment to be activated.\nRead the usage by running: perlbrew help make-pp\n";
my $path_pp = $self->whereis_in_env("pp", $current_env)
or die "ERROR: pp cannot be found in $current_env";

my $input = $self->{input};
my $output = $self->{output};

unless ($input && $output) {
$self->run_command_help("make-pp");
return;
}

my $current_env = $self->current_env
or die "ERROR: perlbrew is not activated. make-pp requires an perlbrew environment to be activated.\nRead the usage by running: perlbrew help make-pp\n";

my $output = $self->{output} || $program;
unless (-f $input) {
die "ERROR: The specified input $input do not exists\n";
}

if (-f $output) {
die "ERROR: $program already exists under current directory.\n";
die "ERROR: $output already exists.\n";
}

my $path_program = $self->whereis_in_env($program, $current_env)
or die "ERROR: $program cannot be found in $current_env";
my $path_pp = $self->whereis_in_env("pp", $current_env)
or die "ERROR: pp cannot be found in $current_env";

my $sitelib = $self->do_capture_current_perl(
'-MConfig',
'-e',
Expand Down Expand Up @@ -2831,7 +2834,7 @@ sub run_command_make_pp {
($locallib ? ("-a", "$locallib;$perlversion") : ()),
"-z", "9",
"-o", $output,
$path_program,
$input,
);

$self->do_system(@cmd);
Expand Down
11 changes: 5 additions & 6 deletions script/perlbrew
Original file line number Diff line number Diff line change
Expand Up @@ -689,17 +689,16 @@ This C<~/.local/bin/tldr> is a shell-wrapper of the actual C<tldr> program, and

Usage:

perlbrew make-pp <program>
perlbrew make-pp -o <name> <program>
perlbrew make-pp --output <name> <program>
perlbrew make-pp -i <path> -o <path>
perlbrew make-pp --input <path> --output <path>

This commands produce an executable file under current directory named C<program>, or C<name> if given after C<--output> (or C<-o> for short). The output is a PAR-packed version of the named program inside current perlbrew environment.
This command takes a path of a perl program (the input), and produce a PAR-packed version of that program to the specified path (the output).

This requires the current perlbrew environment to have L<PAR> and L<PAR::Packer> installed first. Otherwise C<make-pp> bails out. In addition, if current perl is not a perlbrew-managed perl, <make-pp> also bails out.
This requires the current perlbrew environment to have L<PAR> and L<PAR::Packer> installed first. Otherwise C<make-pp> bails out. In addition, if the current perl is not a perlbrew-managed perl, or if <make-pp> also bails out.

The produced file is a standalone binary executable containing these content:

1. The named program
1. The input perl program
2. perl runtime
3. all core perl libs of current perl
4. the entire site lib
Expand Down
Loading