Peertube-dl/Makefile.PL

60 lines
1.8 KiB
Makefile
Raw Normal View History

2020-12-26 03:21:12 +01:00
use ExtUtils::MakeMaker;
use File::Basename;
use Const::Fast;
const my $CONFIG_FILE => dirname(__FILE__) . '/peertube-dl-web.conf';
2020-12-26 03:21:12 +01:00
WriteMakefile(
NAME => 'Peertube::DL',
VERSION => '0.1',
INST_SCRIPT => './bin',
INST_BIN => './bin',
test => { TESTS => 't/*.t' },
test => { TESTS => 't/*/*.t' },
2021-01-06 20:47:33 +01:00
DIR => [ 'src', 'javascript_interpreter_xs/' ],
2020-12-26 03:21:12 +01:00
);
package MY {
sub top_targets {
my $self = shift;
my $return = $self->SUPER::top_targets(@_);
$return = [ split /\n/, $return ];
for my $i ( keys @$return ) {
$return->[$i] .= ' install_config build_frontend install_frontend'
if $return->[$i] =~ /^all :/;
}
return join "\n", @$return;
}
sub const_config {
my $self = shift;
my $return = $self->SUPER::const_config(@_);
2021-01-06 20:47:33 +01:00
open my $fh, '<', $CONFIG_FILE or die "No config file";
my $config = eval( join ' ', <$fh> );
close $fh;
chomp $return;
return $return . '
THEME = ' . ( $config->{theme} // 'default' ) . "\n";
}
sub postamble {
return
"\n"
. "install_frontend : build_frontend\n"
. "\tif [ ! -e lib/Peertube/DL/public/ ];"
. " then mkdir -pv lib/Peertube/DL/public/;" . " fi\n"
. "\tcp -rfv themes/\${THEME}/public/dist/* lib/Peertube/DL/public/\n"
. "build_frontend :\n"
. "\tcd themes/\${THEME}/public && yarn install && yarn build\n"
. "install_config :\n"
. "\tinstall peertube-dl-web.conf bin/peertube-dl-web.conf\n"
. "src: src/Makefile\n"
. "\tcd src && $(MAKE) $(PASSTHRU)\n"
. "javascript_interpreter_xs: javascript_interpreter_xs/Makefile\n"
. "\tcd javascript_interpreter_xs/ && $(MAKE) $(PASSTHRU)\n";
}
}