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