Debian Codegraph @

T1/Makefile.PL

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #!perl -w
2 use strict;
3 use ExtUtils::MakeMaker;
4 use Getopt::Long;
5 use Config;
6
7 my $verbose = $ENV{IM_VERBOSE};
8 my @libpaths;
9 my @incpaths;
10
11 GetOptions("incpath=s", \@incpaths,
12 "libpath=s" => \@libpaths,
13 "verbose|v" => \$verbose);
14
15 our $BUILDING_IMAGER;
16 our %IMAGER_LIBS;
17
18 my $MM_ver = eval $ExtUtils::MakeMaker::VERSION;
19
20 my %opts =
21 (
22 NAME => 'Imager::Font::T1',
23 VERSION_FROM => 'T1.pm',
24 OBJECT => 'T1.o imt1.o',
25 clean => { FILES => 'testout' },
26 );
27
28 if (eval { ExtUtils::MakeMaker->VERSION('6.46'); 1 }) {
29 $opts{LICENSE} = "perl_5";
30 $opts{AUTHOR} = 'Tony Cook <[email protected]>';
31 $opts{ABSTRACT} = 'T1Lib font driver for Imager';
32 $opts{META_MERGE} =
33 {
34 'meta-spec' =>
35 {
36 version => "2",
37 url => "https://metacpan.org/pod/CPAN::Meta::Spec",
38 },
39 resources =>
40 {
41 homepage => "http://imager.perl.org/",
42 repository =>
43 {
44 type => "git",
45 url => "git://github.com/tonycoz/imager.git",
46 web => "https://github.com/tonycoz/imager.git",
47 },
48 bugtracker =>
49 {
50 web => "https://github.com/tonycoz/imager/issues",
51 },
52 },
53 };
54 }
55
56 my @inc;
57 if ($BUILDING_IMAGER) {
58 push @inc, "-I..";
59 unshift @INC, "../lib";
60 }
61 else {
62 unshift @INC, "inc";
63 print "T1Lib: building independently\n";
64 require Imager::ExtUtils;
65 push @inc, Imager::ExtUtils->includes;
66 $opts{TYPEMAPS} = [ Imager::ExtUtils->typemap ];
67
68 # Imager required configure through use
69 my @Imager_req = ( Imager => "0.95" );
70 if (eval { ExtUtils::MakeMaker->VERSION('6.46'); 1 }) {
71 $opts{META_MERGE}{prereqs} =
72 {
73 configure =>
74 {
75 requires =>
76 {
77 @Imager_req,
78 },
79 },
80 build =>
81 {
82 requires =>
83 {
84 @Imager_req,
85 "Test::More" => "0.47",
86 }
87 },
88 runtime =>
89 {
90 requires =>
91 {
92 @Imager_req,
93 }
94 },
95 test =>
96 {
97 requires =>
98 {
99 "Test::More" => "0.47",
100 }
101 },
102 };
103 $opts{PREREQ_PM} =
104 {
105 @Imager_req,
106 XSLoader => 0,
107 };
108 }
109 }
110
111 require Imager::Probe;
112
113 my %probe =
114 (
115 name => "T1Lib",
116 inccheck =>
117 sub { -e File::Spec->catfile($_[0], "t1lib.h") },
118 libbase => "t1",
119 testcode => _t1_test_code(),
120 testcodeheaders => [ "stdio.h", "string.h", "t1lib.h" ],
121 incpath => \@incpaths,
122 libpath => \@libpaths,
123 verbose => $verbose,
124 );
125
126 my $probe_res = Imager::Probe->probe(\%probe);
127 if ($probe_res) {
128 $IMAGER_LIBS{T1} = 1;
129
130 push @inc, $probe_res->{INC};
131 $opts{LIBS} = $probe_res->{LIBS};
132 $opts{DEFINE} = $probe_res->{DEFINE};
133 $opts{INC} = "@inc";
134
135 WriteMakefile(%opts);
136 }
137 else {
138 $IMAGER_LIBS{T1} = 0;
139
140 if ($BUILDING_IMAGER) {
141 ExtUtils::MakeMaker::WriteEmptyMakefile(%opts);
142 }
143 else {
144 # fail in good way
145 die "OS unsupported: T1Lib headers/libraries not found\n";
146 }
147 }
148
149 sub _t1_test_code {
150 return <<'CODE';
151 int font_id;
152 if (T1_InitLib(IGNORE_CONFIGFILE|IGNORE_FONTDATABASE) == NULL) {
153 fprintf(stderr, "T1Lib: Cannot initialize\n");
154 return 1;
155 }
156 T1_CloseLib();
157 return 0;
158 CODE
159 }