test install creation script
[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
11my ($ezmlm_tarball, $build_dir_path, $install_to_path) = @ARGV;
12
13my $orig_cwd = io->dir(cwd);
14
15my $build_dir = io->dir(io->dir($build_dir_path)->rel2abs);
16my $install_to = io->dir(io->dir($install_to_path)->rel2abs);
17
18unless ($build_dir->exists) {
19 $build_dir->mkpath;
20 $build_dir->chdir;
21 run 'tar', '-xzf', $ezmlm_tarball;
22 $orig_cwd->chdir;
23}
24
25my ($src_dir) = ($build_dir->all_dirs)[0];
26
27die "No source dir found in ${build_dir}" unless $src_dir;
28
29foreach 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
35run make => 'clean';
36run 'make';
37run make => 'man';
38run './ezmlm-test';
39$install_to->catdir('bin')->mkpath;
40run make => 'install';