Alien-ghostty
view release on metacpan or search on metacpan
return 1;
ghostty_free(NULL, buf, len);
ghostty_formatter_free(fmt);
ghostty_terminal_free(term);
if (ghostty_build_info(GHOSTTY_BUILD_INFO_VERSION_STRING, &version) != GHOSTTY_SUCCESS)
return 1;
printf("ghostty-vt version %.*s\n", (int)version.len, (const char *)version.ptr);
return 0;
}
C
);
}
share {
meta->prop->{destdir} = 1;
my $source = $ENV{ALIEN_GHOSTTY_SOURCE};
if (defined $source && length $source) {
unless ($source =~ m{^[a-z][a-z0-9+.-]*://}i) {
(my $path = File::Spec->rel2abs($source)) =~ s{([^A-Za-z0-9/._~-])}{sprintf '%%%02X', ord $1}ge;
$source = "file://$path";
}
start_url $source;
} else {
start_url $SOURCE_URL;
}
plugin 'Download';
plugin 'Extract' => 'tar.gz';
build [
sub {
my ($build) = @_;
my $zig_dir = File::Spec->catdir($build->install_prop->{root}, 'zig');
my $zig = Alien::ghostty::Zig::find_or_fetch(
dir => $zig_dir,
network => $build->meta_prop->{network},
log => sub { $build->log(@_) },
);
open my $src_fh, '<', 'VERSION' or die "Alien::ghostty: no VERSION in the source\n";
chomp(my $source_version = <$src_fh>);
$build->install_prop->{ghostty_version} = $source_version;
my ($commit) = $source_version =~ /\+([0-9a-f]+)$/;
my ($lib_version) = do { local $/; open my $fh, '<', 'build.zig' or die $!; <$fh> }
=~ /^const lib_version = "([^"]+)";/m;
(my $app_version = $source_version) =~ s/-?\+/+/;
undef $app_version unless $app_version =~ /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
my $prefix = $build->install_prop->{prefix};
my @cmd = (
$zig, 'build',
'-Demit-lib-vt=true',
'-Demit-xcframework=false',
'-Doptimize=ReleaseFast',
'-Dcpu=baseline',
($app_version ? "-Dversion-string=$app_version" : ()),
($lib_version && $commit ? "-Dlib-version-string=$lib_version+$commit" : ()),
'--prefix', $prefix,
'--cache-dir', '.zig-cache',
'--global-cache-dir', '.zig-cache',
'--summary', 'failures',
);
$build->log("+ @cmd");
system(@cmd) == 0
or die "Alien::ghostty: zig build failed (wait status $?)\n";
File::Path::remove_tree('.zig-cache');
File::Path::remove_tree($zig_dir) if index($zig, $zig_dir) == 0;
my $pc = ($ENV{DESTDIR} // '') . "$prefix/share/pkgconfig/libghostty-vt.pc";
open my $pc_fh, '<', $pc or die "Alien::ghostty: $pc not installed\n";
my ($version) = join('', <$pc_fh>) =~ /^Version:\s*(\S+)/m
or die "Alien::ghostty: no Version in $pc\n";
$build->install_prop->{libghostty_vt_version} = $version;
},
];
plugin 'Gather::IsolateDynamic';
gather sub {
my ($build) = @_;
my $prefix = $build->runtime_prop->{prefix};
$build->runtime_prop->{version} = $build->install_prop->{libghostty_vt_version};
$build->runtime_prop->{ghostty_version} = $build->install_prop->{ghostty_version};
$build->runtime_prop->{cflags} = "-I$prefix/include -DGHOSTTY_STATIC";
$build->runtime_prop->{cflags_static} = "-I$prefix/include -DGHOSTTY_STATIC";
$build->runtime_prop->{libs} = "-L$prefix/lib -lghostty-vt$SYS_LIBS";
$build->runtime_prop->{libs_static} = "-L$prefix/lib -lghostty-vt$SYS_LIBS";
};
};
( run in 1.351 second using v1.01-cache-2.11-cpan-1236ad508bc )