#!perl -w
my
$include
=
"-I. -Iinclude -Isrc"
;
my
$libs
;
my
$define
;
my
$DYNS
;
if
( os_is(
'MSWin32'
) ) {
$libs
=
'-lopengl32 -lgdi32 -lmsimg32'
;
$define
=
"-D_WIN32"
,
}
elsif
( os_is(
'Cygwin'
) ) {
$libs
=
'-lGL -lX11'
;
}
elsif
( os_is(
'MacOSX'
) ) {
$DYNS
= {
'OTHERLDFLAGS'
=>
'-framework OpenGL'
};
}
else
{
$libs
=
'-lGL -lX11'
;
}
WriteMakefile1(
NAME
=>
'OpenGL::Modern'
,
VERSION_FROM
=>
'lib/OpenGL/Modern.pm'
,
ABSTRACT_FROM
=>
'lib/OpenGL/Modern.pm'
,
AUTHOR
=>
'Chris Marshall <chm@cpan.org>'
,
LICENSE
=>
'perl'
,
META_MERGE
=> {
"meta-spec"
=> {
version
=> 2 },
resources
=> {
repository
=> {
type
=>
'git'
,
}
},
},
MIN_PERL_VERSION
=>
'5.006'
,
LIBS
=>
$libs
,
DEFINE
=>
$define
,
INC
=>
$include
,
XSPROTOARG
=>
'-prototypes'
,
depend
=> {
'Modern.c'
=>
'Modern.xs auto-xs.inc src/glew.c include/GL/glew.h include/GL/wglew.h'
,
},
$DYNS
? (
dynamic_lib
=>
$DYNS
) : (),
);
my
@names
= OpenGL::Modern::NameLists::MakefileAll::makefile_all();
ExtUtils::Constant::WriteConstants(
NAME
=>
'OpenGL::Modern'
,
NAMES
=> \
@names
,
DEFAULT_TYPE
=>
'UV'
,
C_FILE
=>
'const-c.inc'
,
XS_FILE
=>
'const-xs.inc'
,
);
generate_auto_xs();
sub
generate_auto_xs {
my
(
$out
,
$err
,
$res
) = capture {
system
"perl utils/generate-XS.pl"
};
die
"auto xs generation failed:\n$err"
if
$err
;
die
"auto xs generation failed:\n$out"
if
$res
;
print
$out
;
return
;
}
sub
WriteMakefile1 {
my
%params
=
@_
;
my
$eumm_version
=
$ExtUtils::MakeMaker::VERSION
;
$eumm_version
=
eval
$eumm_version
;
die
"EXTRA_META is deprecated"
if
exists
$params
{EXTRA_META};
die
"License not specified"
if
not
exists
$params
{LICENSE};
if
(
$params
{BUILD_REQUIRES} and
$eumm_version
< 6.5503 ) {
$params
{PREREQ_PM} = { %{
$params
{PREREQ_PM} || {} }, %{
$params
{BUILD_REQUIRES} } };
delete
$params
{BUILD_REQUIRES};
}
if
(
$params
{TEST_REQUIRES} and
$eumm_version
< 6.64 ) {
$params
{PREREQ_PM} = { %{
$params
{PREREQ_PM} || {} }, %{
$params
{TEST_REQUIRES} } };
delete
$params
{TEST_REQUIRES};
}
delete
$params
{CONFIGURE_REQUIRES}
if
$eumm_version
< 6.52;
delete
$params
{MIN_PERL_VERSION}
if
$eumm_version
< 6.48;
delete
$params
{META_MERGE}
if
$eumm_version
< 6.46;
delete
$params
{META_ADD}
if
$eumm_version
< 6.46;
delete
$params
{LICENSE}
if
$eumm_version
< 6.31;
delete
$params
{AUTHOR}
if
$] < 5.005;
delete
$params
{ABSTRACT_FROM}
if
$] < 5.005;
delete
$params
{BINARY_LOCATION}
if
$] < 5.005;
die
"$@\nOS unsupported\n"
if
not
eval
{ assert_lib
%params
; 1 };
WriteMakefile(
%params
);
}