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