do not edit — generated by btf.
git.druid.rocksindexdruid520mpsrc/version.pl

src/version.pl


#!/usr/bin/env perl
use v5.16;
use strict;
use warnings FATAL => 'all';
use FindBin;
use lib "$FindBin::Bin";
use mplib::config qw($CFG);
 
# mp's own version, what mpx (the real compiled binary) was actually
# built with (cc/target/every cflag -- mpx itself reports these, from
# buildinfo.h, generated fresh by mk/b.sh at compile time, see
# src/version.c), and the full command/plugin list. a real mp.<command>
# like any other (mp.pl's own dispatch needs no special case for it
# beyond translating the "--version" flag spelling to this command's
# real name, "version", before dispatch -- see mp.pl's own $cmd
# normalization) -- unlike mp.pl itself, this can freely use
# mplib::config, same as any other real command.
my $VERSION = '4.1.0';
 
my $flags = mplib::config::parse_flags(\@ARGV);
mplib::config::load($flags);
 
print "mp $VERSION\n";
if(-x $CFG->{MPX})
{
	system($CFG->{MPX}, 'version') == 0
	    or print STDERR "warn: $CFG->{MPX} version exited nonzero.\n";
}
else
{
	print STDERR "warn: $CFG->{MPX} not found or not executable -- can't report what it was built with.\n";
}
 
# discover_cmds()/plugin_names(): mp.pl keeps its OWN copy of this exact
# logic for usage()'s sake -- this file needs the identical listing (a
# separate process, its own $FindBin::Bin), and duplicating ~15 lines
# here is simpler and more honest than reaching back into mp.pl (a
# script, not a module) to share it.
my @cmds;
opendir(my $dh, $FindBin::Bin) or @cmds = ();
if($dh)
{
	for my $f (sort readdir($dh))
	{
		next unless $f =~ /^mp\.(.+)$/;
		next unless -f "$FindBin::Bin/$f" && -x "$FindBin::Bin/$f";
		push @cmds, $1;
	}
	closedir($dh);
}
my %plugins;
if(open(my $pfh, '<', "$FindBin::Bin/plugins.list"))
{
	while(my $line = <$pfh>)
	{
		chomp $line;
		$plugins{$line} = 1 if $line =~ /\S/;
	}
	close($pfh);
}
my @core = grep { !$plugins{$_} } @cmds;
my @plug = grep { $plugins{$_} } @cmds;
print "commands: " . (@core ? join(' ', @core) : '(none found next to mp itself)') . "\n";
print "plugins: " . join(' ', @plug) . "\n" if @plug;
powered by btf.