support prefix list for bindir
[scpubgit/App-EzPz.git] / bin / ezpz-create-test-ezmlm-install
CommitLineData
710038da 1#!/usr/bin/env perl
2
3use strictures 1;
4use IO::All;
5use Cwd;
6use IPC::System::Simple qw(run);
7
8die "Usage: ezpz-create-test-ezmlm-install ezmlm-source.tgz build-dir install-dir"
9 unless @ARGV == 3;
10
9ec9210e 11my ($ezmlm_tarball_path, $build_dir_path, $install_to_path) = @ARGV;
12
13my $ezmlm_tarball = io->file(io->file($ezmlm_tarball_path)->rel2abs);
710038da 14
15my $orig_cwd = io->dir(cwd);
16
17my $build_dir = io->dir(io->dir($build_dir_path)->rel2abs);
18my $install_to = io->dir(io->dir($install_to_path)->rel2abs);
19
20unless ($build_dir->exists) {
21 $build_dir->mkpath;
22 $build_dir->chdir;
9ec9210e 23 run 'tar', 'xzf', $ezmlm_tarball;
710038da 24 $orig_cwd->chdir;
25}
26
27my ($src_dir) = ($build_dir->all_dirs)[0];
28
29die "No source dir found in ${build_dir}" unless $src_dir;
30
31foreach my $type (qw(bin etc lib man qmail)) {
32 $src_dir->catfile("conf-${type}")->print($install_to->catdir($type)."\n");
33}
34
35$src_dir->chdir;
36
37run make => 'clean';
38run 'make';
39run make => 'man';
40run './ezmlm-test';
41$install_to->catdir('bin')->mkpath;
42run make => 'install';