-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile.PL
173 lines (144 loc) · 4.82 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
use strict;
use ExtUtils::MakeMaker;
use Config;
use IO::File;
use Getopt::Std;
our ($opt_d, $opt_r, $opt_v);
getopts('d:rv:');
$opt_v ||= 1;
my (@extras, @scripts, @theselibs, $fhi, $fho, $perlbin);
# Fix up inno script by substituting {perl: $var}
$perlbin = $Config{'sitebin'};
@scripts = grep {-f && !m/\./o && !m/~$/o } glob("scripts/*");
@scripts = grep {!m|/add[^_]|oi} @scripts unless ($^O eq 'MSWin32');
@theselibs = grep {-f } glob("lib/Font/Scripts/*");
if ($^O eq 'MSWin32') {
@extras = (dist => { 'TO_UNIX' => 'perl -Mtounix -e "tounix(\"$(DISTVNAME)\")"' });
*MY::postamble = sub
{
my (@files) = map {m|scripts/(.*)$|o; $1;} @scripts;
my ($res, $fh, $files, $compile);
$files = join (' ', grep {$_ ne 'addpath'} @files);
$files =~ s/addpath\.bat\s*//o; # remove addpath since don't need a .bat
$fh = IO::File->new("> addbats.pl") || die "Can't create addbats.pl";
$fh->print(<<"EOT");
#! perl
# This script automatically generated by Makefile.PL
foreach \$f (qw($files))
{
if (\$ARGV[0] eq '-r')
{
unlink "\$ARGV[1]\\\\\$f.bat";
}
else
{
open(FH, "> \$ARGV[0]\\\\\$f.bat") || die \$@;
print FH <<\"EOB\";
\\\@echo off
if "%OS%" == "Windows_NT" goto WinNT
"\$ARGV[0]\\\\fontutils.exe" \$f %1 %2 %3 %4 %5 %6 %7 %8 %9
goto end
:WinNT
"\$ARGV[0]\\\\fontutils.exe" \$f %*
:end
EOB
close(FH);
}
}
EOT
$fh->close();
push (@scripts, "addbats.pl");
my $Registry;
require Win32::TieRegistry;
Win32::TieRegistry->import (Delimiter=>"/") ;
$compile = $Registry->{'Classes/InnoSetupScriptFile/shell/Compile/command//'};
$compile =~ s/\s*"?%1"?.*$//;
$compile = "start \"compile\" /wait $compile";
$res .= "exe : TTFontUtils_\$(VERSION_SYM).exe\n\n";
$res .= "TTFontUtils_\$(VERSION_SYM).exe : fontutils.exe\n";
$res .= "\tiscc.exe \"/dMyVer=\$(VERSION)\" FontUtils.iss\n\n";
$res .= "fontutils.exe : fontutils.pl " . join(' ', @scripts);
$res .= "\n\tpp -B -c -o fontutils.exe -M Font::TTF::Useall -M Pod::Simple::TranscodeSmart -l libexpat-1_.dll fontutils.pl " . join(' ', @scripts);
$res .= "\n\n";
$res;
};
}
elsif ($^O eq 'linux')
{
*MY::postamble = sub
{
my ($self) = @_;
my ($res);
my ($package) = lc($self->{'NAME'});
my ($pversion) = $self->{'VERSION'};
my ($svn) = `svnversion`;
my ($sign) = '--auto-debsign' if ($opt_r);
my ($fpackage);
$svn =~ s/\s+$//o;
if ($svn and $svn ne "exported")
{
$svn =~ s/[0-9]*://og;
}
else
{
$svn = `hg identify -n`;
$svn =~ s/\+?\s+$//o;
}
$package =~ s/::/-/g;
$package = "lib${package}-perl";
$pversion .= "+$svn" unless ($opt_r);
$fpackage = "$package-$pversion";
$res = <<"EOT";
debsrc: dist
rm -fr $self->{'DISTVNAME'}
rm -fr $package
rm -fr $fpackage
tar xvzf $self->{'DISTVNAME'}.tar.gz
cp -r $self->{'DISTVNAME'} $package
tar cvzf ${package}_${pversion}.orig.tar.gz $package
cp -r $package $fpackage
cp -a debian $fpackage
cd $fpackage && dch -v $pversion "interim dev release" && dpkg-buildpackage -S
# make deb builds an interim deb from svn source for release
deb: debsrc
EOT
foreach my $d (split(' ', $opt_d))
{
$res .= <<"EOT";
mkdir -p dists/$d
#dch -D $d -v $pversion-$opt_v -m -b -c $fpackage/debian/changelog "Auto build from perl for $d"
#cd $fpackage && pdebuild --buildresult ../dists/$d -- --basetgz /var/cache/pbuilder/base-$d.tgz \$pbuilderopts{$d}
EOT
}
return $res;
};
}
WriteMakefile (
NAME => "Font::TTF::Scripts",
VERSION_FROM => 'lib/Font/TTF/Scripts.pm',
EXE_FILES => \@scripts,
# HTMLLIBPODS => {map {my $t = $_; $t=~s/\..*?$/.html/o; $t='blib/Html/'.$t; $_ => $t;} @theselibs},
# HTMLSCRIPTPODS => {map {my $t=$_; $t=~s/\..*?$/.html/o; $t='blib/Html/'.$t; $_ => $t;} @scripts},
AUTHOR => "martin_hosken\@sil.org",
ABSTRACT => "TTF font support scripts for Perl",
LICENSE => "artistic_2",
PREREQ_PM => {
'Algorithm::Diff' => 0,
'IO::String' => 0,
'Font::TTF' => '1.05',
'Text::PDF::File' => 0,
'Text::Unicode::Equivalents' => 0,
'XML::Parser' => 0
},
META_MERGE => {
'meta-spec' => { version => 2 },
resources => {
repository => {
type => 'git',
url => 'https://github.com/silnrsi/font-ttf-scripts.git',
web => 'https://github.com/silnrsi/font-ttf-scripts',
}
}
},
@extras
);