forked from Amtivo-Group/ODF-lpOD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.PL
129 lines (117 loc) · 4.13 KB
/
Makefile.PL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#=============================================================================
#
# Copyright (c) 2010 Ars Aperta, Itaapy, Pierlis, Talend.
# Copyright (c) 2014 Jean-Marie Gouarné.
# Author: Jean-Marie Gouarné <[email protected]>
#
#=============================================================================
use 5.010_001;
use strict;
#=============================================================================
# Packaging & installation for ODF::lpOD - 2014-05-21T10:32:13
#=============================================================================
use ExtUtils::MakeMaker;
use Getopt::Long;
#-----------------------------------------------------------------------------
sub default_version
{
'0.000'
}
sub default_author
{
'Jean-Marie Gouarne <[email protected]>'
}
sub default_date
{
my @lt = localtime();
return sprintf(
"%04d-%02d-%02dT%02d:%02d:%02d",
$lt[5] + 1900, $lt[4] + 1, $lt[3], $lt[2], $lt[1], $lt[0]
);
}
GetOptions
(
'version=s' => \(my $version = default_version),
'date=s' => \(my $dist_date = default_date),
'author=s' => \(my $author = default_author),
'build' => \(my $build = undef),
'prompt!' => \(my $prompt = 1)
);
#-----------------------------------------------------------------------------
if ($build)
{
require File::Copy;
if ($prompt)
{
my $ok = "N";
do {
$version = prompt("Version number ?", $version);
$dist_date = prompt("Build date ?", $dist_date);
$author = prompt("Packager ?", $author);
$ok = prompt("OK ? (Y/N)", "Y");
}
until (uc($ok) eq "Y")
}
else
{
say for (
"Version number : $version",
"Build date : $dist_date",
"Packager : $author"
);
}
File::Copy::copy("lib/ODF/lpOD.pm", "lib/ODF/lpOD.bak");
open LPOD, "<", "lib/ODF/lpOD.pm";
open TMP, ">", "lib/ODF/lpod.tmp";
my @lpod = ();
while (my $line = <LPOD>)
{
if ($line =~ /VERSION/) {
$line =~ s/".*"/"$version"/;
}
elsif ($line =~ /PACKAGE_DATE/) {
$line =~ s/".*"/"$dist_date"/;
}
print TMP $line;
}
close LPOD;
close TMP;
unlink("lib/ODF/lpOD.pm"); rename("lib/ODF/lpod.tmp", "lib/ODF/lpOD.pm");
}
#-----------------------------------------------------------------------------
WriteMakefile
(
'NAME' => 'ODF::lpOD',
'VERSION' => $version,
'ABSTRACT_FROM' => 'lib/ODF/lpOD.pod',
'AUTHOR' => $author,
'LICENSE' => 'GPL',
'MIN_PERL_VERSION' => '5.016000', # Needed for feature current_sub
META_MERGE => {
resources => {
repository => 'https://github.com/ctrlo/ODF-lpOD/',
bugtracker => 'https://rt.cpan.org/Public/Dist/Display.html?Name=ODF-lpOD',
homepage => 'https://github.com/ctrlo/ODF-lpOD/',
},
},
'PREREQ_PM' =>
{
'XML::Twig' => '3.34',
'Archive::Zip' => '1.30',
'File::Temp' => '0.12',
'File::Find' => '1.01',
'Time::Local' => '1.07',
'IO::File' => '1.14',
'File::Basename' => '2.76',
'File::Slurp' => '0',
'File::Type' => '0',
'Image::Size' => '0',
'LWP::Simple' => '0',
'experimental' => '0'
},
'EXE_FILES' =>
[
'bin/lpod_test'
]
);
#-----------------------------------------------------------------------------