-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move win32 font support in a new directory, and use Imager::Probe
change i_utf8_advance to accept the working length as a size_t and propagate that change through anything that uses it
- Loading branch information
Tony Cook
committed
Sep 16, 2010
1 parent
6725cca
commit 718b8c9
Showing
23 changed files
with
456 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
#!perl -w | ||
use strict; | ||
use ExtUtils::MakeMaker qw(WriteMakefile WriteEmptyMakefile); | ||
use Getopt::Long; | ||
use Config; | ||
|
||
my $verbose = $ENV{IM_VERBOSE}; | ||
my @libpaths; | ||
my @incpaths; | ||
|
||
GetOptions("incpath=s", \@incpaths, | ||
"libpath=s" => \@libpaths, | ||
"verbose|v" => \$verbose); | ||
|
||
our $BUILDING_IMAGER; | ||
|
||
$DB::single = 1; | ||
|
||
my $MM_ver = eval $ExtUtils::MakeMaker::VERSION; | ||
|
||
my %opts = | ||
( | ||
NAME => 'Imager::Font::W32', | ||
VERSION_FROM => 'W32.pm', | ||
OBJECT => 'W32.o win32.o', | ||
); | ||
|
||
my @inc; | ||
if ($BUILDING_IMAGER) { | ||
push @inc, "-I.."; | ||
unshift @INC, "../lib"; | ||
} | ||
else { | ||
unshift @INC, "inc"; | ||
print "Win32: building independently\n"; | ||
require Imager::ExtUtils; | ||
push @inc, Imager::ExtUtils->includes; | ||
$opts{TYPEMAPS} = [ Imager::ExtUtils->typemap ]; | ||
|
||
# Imager required configure through use | ||
my @Imager_req = ( Imager => "0.77" ); | ||
if ($MM_ver >= 6.46) { | ||
$opts{META_MERGE} = | ||
{ | ||
configure_requires => | ||
{ | ||
@Imager_req, | ||
}, | ||
build_requires => | ||
{ | ||
@Imager_req, | ||
"Test::More" => "0.47", | ||
}, | ||
resources => | ||
{ | ||
homepage => "http://imager.perl.org/", | ||
repository => | ||
{ | ||
url => "http://imager.perl.org/svn/trunk/Imager-Font-W32", | ||
web => "http://imager.perl.org/svnweb/public/browse/trunk/Imager-Font-W32", | ||
type => "svn", | ||
}, | ||
}, | ||
}; | ||
$opts{PREREQ_PM} = | ||
{ | ||
@Imager_req, | ||
}; | ||
} | ||
} | ||
|
||
require Imager::Probe; | ||
|
||
my %probe = | ||
( | ||
name => "Win32", | ||
inccheck => sub { -e File::Spec->catfile($_[0], "windows.h") }, | ||
libbase => "gdi32", | ||
testcode => _win32_test_code(), | ||
testcodeheaders => [ "stdio.h", "string.h", "windows.h" ], | ||
incpath => join($Config{path_sep}, @incpaths), | ||
libpath => join($Config{path_sep}, @libpaths), | ||
); | ||
|
||
my $probe_res = Imager::Probe->probe(\%probe); | ||
if ($probe_res) { | ||
push @inc, $probe_res->{INC}; | ||
$opts{LIBS} = $probe_res->{LIBS}; | ||
|
||
$opts{INC} = "@inc"; | ||
|
||
if ($MM_ver > 6.06) { | ||
$opts{AUTHOR} = 'Tony Cook <[email protected]>'; | ||
$opts{ABSTRACT} = 'Win32 font file support for Imager'; | ||
} | ||
|
||
WriteMakefile(%opts); | ||
} | ||
else { | ||
if ($BUILDING_IMAGER) { | ||
WriteEmptyMakefile(%opts); | ||
} | ||
else { | ||
# fail in good way | ||
die "OS unsupported: Win32 libraries or headers not found\n"; | ||
} | ||
} | ||
|
||
sub _win32_test_code { | ||
return <<'CODE'; | ||
HDC dc = GetDC(NULL); | ||
HDC bmpDc = CreateCompatibleDC(dc); | ||
DeleteDC(bmpDc); | ||
ReleaseDC(NULL, dc); | ||
return 0; | ||
CODE | ||
} |
Oops, something went wrong.