Debian Codegraph @

Makefile.PL

raw symbols ◀ ▶ SCIP
2 Debian patches touch this file
1 use strictscip-perl cpan Image-Scale 0.14 strict/;
2
3 use 5.008scip-perl cpan Image-Scale 0.14 `5.008`/;
4
5 use Configscip-perl cpan Image-Scale 0.14 Config/;
6 use ExtUtils::MakeMakerscip-perl cpan Image-Scale 0.14 ExtUtils/MakeMaker/ qw(WriteMakefile);
7 use File::Spec::Functionsscip-perl cpan Image-Scale 0.14 File/Spec/Functions/;
8 use Getopt::Longscip-perl cpan Image-Scale 0.14 Getopt/Long/;
9
10 my (@INC, @LIBPATH, @LIBS);
11 my ($JPEG, $PNG, $GIF, $MYEXTLIB);
12 my ($JPEG_VERSION, $PNG_VERSION, $GIF_VERSION);
13
14 my ($help, $jpeg_inc, $jpeg_lib, $png_inc, $png_lib, $gif_inc, $gif_lib);
15 my ($jpeg_static, $png_static, $gif_static);
16
17 my $DEFINES = '-O2';
18 $DEFINES .= ' -Wall' unless $^Oscip-perl cpan Image-Scale 0.14 main/`$^O`. =~ /sun|solaris/i;
19 $DEFINES .= ' -Wno-unused-value -Wno-format-security -Winline -ffast-math' unless $^Oscip-perl cpan Image-Scale 0.14 main/`$^O`. =~ /Win32|sun|solaris/i;
20
•21 # with gcc-16, it seems we need to link with m; see bug 1143758
22 pushscip-perl cpan Image-Scale 0.14 main/push(). @LIBS, '-lm';
23
24 if ( $^Oscip-perl cpan Image-Scale 0.14 main/`$^O`. !~ /Win32/i ) {
25 # Check for Sparc ReadyNAS to enable ASM code
26 if ( -e '/etc/raidiator_version' ) {
27 if ( $Configscip-perl cpan Image-Scale 0.14 main/`%Config`.{archname} eq 'sparc-linux' ) {
28 $DEFINES .= ' -DPADRE';
29 }
30 }
31
32 pushscip-perl cpan Image-Scale 0.14 main/push(). @LIBPATH, '-L/usr/local/lib';
33 }
34
35 my $result = GetOptionsscip-perl cpan Image-Scale 0.14 main/GetOptions().(
36 "help|h" => \$help,
37 "with-jpeg-includes=s" => \$jpeg_inc,
38 "with-jpeg-libs=s" => \$jpeg_lib,
39 "with-jpeg-static" => \$jpeg_static,
40 "with-png-includes=s" => \$png_inc,
41 "with-png-libs=s" => \$png_lib,
42 "with-png-static" => \$png_static,
43 "with-gif-includes=s" => \$gif_inc,
44 "with-gif-libs=s" => \$gif_lib,
45 "with-gif-static" => \$gif_static,
46 );
47
48 if ($help || !$result) {
49 print STDERR <<END;
50 Usage: perl Makefile.PL [options]
51
52 Configure Image::Scale module.
53
54 Options:
55 --with-jpeg-includes Path to directory containing jpeglib.h
56 --with-jpeg-libs Path to directory containing libjpeg
57 --with-jpeg-static Statically link libjpeg
58 --with-png-includes Path to directory containing png.h
59 --with-png-libs Path to directory containing libpng
60 --with-png-static Statically link libpng
61 --with-gif-includes Path to directory containing gif_lib.h
62 --with-gif-libs Path to directory containing libgif
63 --with-gif-static Statically link libgif
64
65 END
66
67 exitscip-perl cpan Image-Scale 0.14 main/exit(). 0;
68 }
69
70 my @check = qw(/usr/include /usr/local/include /opt/local/include);
71
72 # Check in environment-supplied locations before standard ones
73 unshiftscip-perl cpan Image-Scale 0.14 main/unshift(). @check, splitscip-perl cpan Image-Scale 0.14 main/split(). /:/, $ENVscip-perl cpan Image-Scale 0.14 main/`%ENV`.{INCLUDE};
74
75 if ( $^Oscip-perl cpan Image-Scale 0.14 main/`$^O`. =~ /Win32/i ) {
76 pushscip-perl cpan Image-Scale 0.14 main/push(). @check, '../libjpeg-turbo-1.1.1';
77 pushscip-perl cpan Image-Scale 0.14 main/push(). @check, '../lpng143';
78 pushscip-perl cpan Image-Scale 0.14 main/push(). @check, '../giflib-4.1.6/lib';
79 }
80
81 # Look for libjpeg
82 for my $incdir ( $jpeg_inc, @check ) {
83 if ( $incdir && -e catfilescip-perl cpan Image-Scale 0.14 main/catfile().($incdir, 'jpeglib.h') ) {
84 $JPEG = 1;
85 $jpeg_inc = $incdir;
86
87 unshiftscip-perl cpan Image-Scale 0.14 main/unshift(). @INC, '-I' . $jpeg_inc;
88 if ($jpeg_lib) {
89 unshiftscip-perl cpan Image-Scale 0.14 main/unshift(). @LIBPATH, '-L' . $jpeg_lib;
90 }
91
92 if ($jpeg_static) {
93 if ($jpeg_lib) {
94 $MYEXTLIB .= $jpeg_lib . '/' . 'libjpeg$(LIB_EXT) ';
95 }
96 else {
97 $MYEXTLIB .= $jpeg_inc . '/../lib/libjpeg$(LIB_EXT) ';
98 }
99 }
100 else {
101 pushscip-perl cpan Image-Scale 0.14 main/push(). @LIBS, '-ljpeg';
102 }
103
104 if ( $^Oscip-perl cpan Image-Scale 0.14 main/`$^O`. =~ /Win32/i ) {
105 $JPEG_VERSION = _re_findscip-perl cpan Image-Scale 0.14 main/_re_find().( catfilescip-perl cpan Image-Scale 0.14 main/catfile().($incdir, 'build', 'jconfig.h'), qr/JPEG_LIB_VERSION\s+(\d+)/ ) || 'unknown';
106 }
107 else {
108 $JPEG_VERSION = _re_findscip-perl cpan Image-Scale 0.14 main/_re_find().( catfilescip-perl cpan Image-Scale 0.14 main/catfile().($incdir, 'jpeglib.h'), qr/JPEG_LIB_VERSION\s+(\d+)/ ) || 'unknown';
109 if ( $JPEG_VERSION eq 'unknown' ) {
•110 # On Debian, with libjpeg-turbo headers are in a arch specific dir
111 my $arch_type = qx(dpkg-architecture -q DEB_HOST_MULTIARCH);
112 chompscip-perl cpan Image-Scale 0.14 main/chomp(). $arch_type;
113 # Also check jconfig.h as it contains the version when using libjpeg-turbo
•114 if ( -d catdirscip-perl cpan Image-Scale 0.14 main/catdir().($incdir, $arch_type) ) { # jconfig.h header is sometimes installed in a subdir
115 $JPEG_VERSION = _re_findscip-perl cpan Image-Scale 0.14 main/_re_find().( catfilescip-perl cpan Image-Scale 0.14 main/catfile().($incdir, $arch_type, 'jconfig.h'), qr/JPEG_LIB_VERSION\s+(\d+)/ ) || 'unknown';
116 }
117 else {
118 $JPEG_VERSION = _re_findscip-perl cpan Image-Scale 0.14 main/_re_find().( catfilescip-perl cpan Image-Scale 0.14 main/catfile().($incdir, 'jconfig.h'), qr/JPEG_LIB_VERSION\s+(\d+)/ ) || 'unknown';
119 }
120 }
121 }
122
123 $DEFINES .= " -DHAVE_JPEG -DJPEG_VERSION=$JPEG_VERSION";
124
125 last;
126 }
127 }
128
129 # Look for libpng
130 for my $incdir ( $png_inc, @check ) {
131 if ( $incdir && -e catfilescip-perl cpan Image-Scale 0.14 main/catfile().($incdir, 'png.h') ) {
132 $PNG = 1;
133 $png_inc = $incdir;
134
135 unshiftscip-perl cpan Image-Scale 0.14 main/unshift(). @INC, '-I' . $png_inc;
136 if ($png_lib) {
137 unshiftscip-perl cpan Image-Scale 0.14 main/unshift(). @LIBPATH, '-L' . $png_lib;
138 }
139
140 if ($png_static) {
141 if ($png_lib) {
142 $MYEXTLIB .= $png_lib . '/' . 'libpng$(LIB_EXT) ';
143 }
144 else {
145 $MYEXTLIB .= $png_inc . '/../lib/libpng$(LIB_EXT) ';
146 }
147
148 pushscip-perl cpan Image-Scale 0.14 main/push(). @LIBS, '-lz';
149 }
150 else {
151 pushscip-perl cpan Image-Scale 0.14 main/push(). @LIBS, '-lpng -lz';
152 }
153
154 $PNG_VERSION = _re_findscip-perl cpan Image-Scale 0.14 main/_re_find().( catfilescip-perl cpan Image-Scale 0.14 main/catfile().($incdir, 'png.h'), qr/PNG_LIBPNG_VER_STRING\s+"([\d\.]+)"/ ) || 'unknown';
155
156 $DEFINES .= " -DHAVE_PNG -DPNG_VERSION=$PNG_VERSION";
157
158 last;
159 }
160 }
161
162 # Look for giflib
163 for my $incdir ( $gif_inc, @check ) {
164 if ( $incdir && -e catfilescip-perl cpan Image-Scale 0.14 main/catfile().($incdir, 'gif_lib.h') ) {
165 $gif_inc = $incdir;
166
167 unshiftscip-perl cpan Image-Scale 0.14 main/unshift(). @INC, '-I' . $gif_inc;
168 if ($gif_lib) {
169 unshiftscip-perl cpan Image-Scale 0.14 main/unshift(). @LIBPATH, '-L' . $gif_lib;
170 }
171
172 if ($gif_static) {
173 if ($gif_lib) {
174 $MYEXTLIB .= $gif_lib . '/' . "libgif\$(LIB_EXT) ";
175 }
176 else {
177 $MYEXTLIB .= $gif_inc . "/../lib/libgif\$(LIB_EXT) ";
178 }
179 }
180 else {
181 pushscip-perl cpan Image-Scale 0.14 main/push(). @LIBS, "-lgif";
182 }
183
184 my $GIF_41 = _re_findscip-perl cpan Image-Scale 0.14 main/_re_find().( catfilescip-perl cpan Image-Scale 0.14 main/catfile().($incdir, 'gif_lib.h'), qr/GIF_LIB_VERSION " Version (4\.1), "/ );
185 my $GIF_MAJOR = _re_findscip-perl cpan Image-Scale 0.14 main/_re_find().( catfilescip-perl cpan Image-Scale 0.14 main/catfile().($incdir, 'gif_lib.h'), qr/GIFLIB_MAJOR (\d+)/ );
186 my $GIF_MINOR = _re_findscip-perl cpan Image-Scale 0.14 main/_re_find().( catfilescip-perl cpan Image-Scale 0.14 main/catfile().($incdir, 'gif_lib.h'), qr/GIFLIB_MINOR (\d+)/ );
187
188 if ( $GIF_MAJOR ) {
189 $GIF_VERSION = "${GIF_MAJOR}.${GIF_MINOR}";
190 if ( $GIF_VERSION >= 4.2 ) {
191 $GIF = 1;
192 $DEFINES .= " -DHAVE_GIF -DGIF_VERSION=$GIF_VERSION";
193
194 # giflib >= 5.1 changes DGifClose()
195 if ( $GIF_VERSION >= 5.1 ) {
196 $DEFINES .= " -DGIFLIB_API_51";
197 }
198
199 # giflib >= 5.0 change DGifOpen(), GifErrorString(), GifAddExtensionBlock() and struct SavedImage
200 if ( $GIF_VERSION >= 5.0 ) {
201 $DEFINES .= " -DGIFLIB_API_50";
202 }
203 }
204 }
205 elsif ( $GIF_41 ) {
206 $GIF = 1;
207 $GIF_VERSION = '4.1';
208 $DEFINES .= ' -DHAVE_GIF -DGIF_VERSION=4.1 -DGIFLIB_API_41';
209 }
210
211 last;
212 }
213 }
214
215 # Require at least one of jpeg or png
216 if ( !$JPEG && !$PNG ) {
217 my $err = "Image::Scale requires at least one of libjpeg or libpng, please install one or both and try again.\n";
218
219 if ( $^Oscip-perl cpan Image-Scale 0.14 main/`$^O`. =~ /Win32/i ) {
220 $err .= "\nPlease read the README.win32 file for build instructions on Windows.\n";
221 }
222
223 warnscip-perl cpan Image-Scale 0.14 main/warn(). $err;
224
225 exitscip-perl cpan Image-Scale 0.14 main/exit(). 0;
226 }
227
228 unshiftscip-perl cpan Image-Scale 0.14 main/unshift(). @INC, '-I. -I.. -Isrc -Iinclude';
229
230 printscip-perl cpan Image-Scale 0.14 main/print(). "\n";
231 printscip-perl cpan Image-Scale 0.14 main/print(). "Image::Scale will be built with:\n\n";
232 printscip-perl cpan Image-Scale 0.14 main/print(). " JPEG support: " . ( $JPEG ? "yes ($jpeg_inc, libjpeg version $JPEG_VERSION)" : "no, install libjpeg (v8 recommended)" ) . "\n";
233 printscip-perl cpan Image-Scale 0.14 main/print(). " PNG support: " . ( $PNG ? "yes ($png_inc, libpng version $PNG_VERSION)" : "no, install libpng (v1.4.x recommended)" ) . "\n";
234 printscip-perl cpan Image-Scale 0.14 main/print(). " GIF support: " . ( $GIF ? "yes ($gif_inc, giflib version $GIF_VERSION)" : "no, install giflib v4.1 or higher" ) . "\n";
235 printscip-perl cpan Image-Scale 0.14 main/print(). "\n";
236
237 if ( $^Oscip-perl cpan Image-Scale 0.14 main/`$^O`. =~ /Win32/i ) {
238 *MY::postamble = sub {};
239
240 if ($JPEG) {
241 pushscip-perl cpan Image-Scale 0.14 main/push(). @INC, '-I../libjpeg-turbo-1.1.1/build'; # for jconfig.h
242 $MYEXTLIB .= '../libjpeg-turbo-1.1.1/build/jpeg-static.lib ';
243 }
244
245 if ($PNG) {
246 pushscip-perl cpan Image-Scale 0.14 main/push(). @INC, '-I../zlib';
247 $MYEXTLIB .= '../lpng143/libpng.lib ../zlib/zlib.lib ';
248 }
249
250 if ($GIF) {
251 $MYEXTLIB .= '../giflib-4.1.6/windows/Release/giflib.lib ';
252 }
253 }
254
255 my $inc_files = joinscip-perl cpan Image-Scale 0.14 main/join().(' ', globscip-perl cpan Image-Scale 0.14 main/glob(). 'include/*.h');
256 my $src_files = joinscip-perl cpan Image-Scale 0.14 main/join().(' ', globscip-perl cpan Image-Scale 0.14 main/glob(). 'src/*.c');
257
258 WriteMakefilescip-perl cpan Image-Scale 0.14 main/WriteMakefile().(
259 NAME => 'Image::Scale',
260 VERSION_FROM => 'lib/Image/Scale.pm',
261 PREREQ_PM => { 'Test::NoWarnings' => 0 },
262 ABSTRACT_FROM => 'lib/Image/Scale.pm',
263 AUTHOR => 'Andy Grundman <[email protected]>',
264 INC => joinscip-perl cpan Image-Scale 0.14 main/join().(' ', @INC),
265 LIBS => [ joinscip-perl cpan Image-Scale 0.14 main/join().(' ', @LIBPATH, @LIBS) ],
266 DEFINE => $DEFINES,
267 MYEXTLIB => $MYEXTLIB,
268 depend => { 'Scale.c' => "$inc_files $src_files" },
269 META_MERGE => {
270 'meta-spec' => { version => 2 },
271 resources => {
272 repository => {
273 type => 'git',
274 url => 'https://github.com/andygrundman/Image-Scale.git',
275 web => 'https://github.com/andygrundman/Image-Scale',
276 },
277 },
278 },
279 MIN_PERL_VERSION => 5.008,
280 LICENSE => 'gpl_2',
281 );
282
283 sub _re_findscip-perl cpan Image-Scale 0.14 main/_re_find(). {
284 my ( $file, $re ) = @_scip-perl cpan Image-Scale 0.14 main/`@_`.;
285
286 my $result;
287
288 openscip-perl cpan Image-Scale 0.14 main/open(). my $fh, '<', $file or diescip-perl cpan Image-Scale 0.14 main/die(). "Unable to read $file\n";
289 while ( my $line = <$fh> ) {
290 if ( $line =~ $re ) {
291 $result = $1scip-perl cpan Image-Scale 0.14 main/$1.;
292 last;
293 }
294 }
295 closescip-perl cpan Image-Scale 0.14 main/close(). $fh;
296
297 return $result;
298 }