-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile.PL
115 lines (105 loc) · 3.98 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
#!perl -w
use strict;
use ExtUtils::MakeMaker;
use ExtUtils::MakeMaker::CPANfile;
use Config '%Config';
use Devel::CheckOS 'os_is';
use lib 'lib';
use OpenGL::Modern::NameLists::MakefileAll;
use Capture::Tiny 'capture';
use ExtUtils::Constant ();
use Devel::CheckLib 'assert_lib';
my $include = "-I. -Iinclude -Isrc";
my $libs;
my $define;
my $DYNS;
if ( os_is( 'MSWin32' ) ) {
$libs = '-lopengl32 -lgdi32 -lmsimg32';
$define = "-D_WIN32", # XXX Platform specific
}
elsif ( os_is( 'Cygwin' ) ) {
$libs = '-lGL -lX11';
}
elsif ( os_is( 'MacOSX' ) ) {
$DYNS = { 'OTHERLDFLAGS' => '-framework OpenGL' };
}
else {
$libs = '-lGL -lX11';
}
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile1(
NAME => 'OpenGL::Modern',
VERSION_FROM => 'lib/OpenGL/Modern.pm',
ABSTRACT_FROM => 'lib/OpenGL/Modern.pm', # retrieve abstract from module
AUTHOR => 'Chris Marshall <[email protected]>',
LICENSE => 'perl',
META_MERGE => {
"meta-spec" => { version => 2 },
resources => {
bugtracker => {web=>'https://github.com/PDLPorters/pdl/issues'},
repository => {
web => 'https://github.com/devel-chm/OpenGL-Modern',
url => 'https://github.com/devel-chm/OpenGL-Modern.git',
type => 'git',
},
x_IRC => 'irc://irc.perl.org/#pogl',
},
},
MIN_PERL_VERSION => '5.006',
LIBS => $libs, # e.g., '-lm'
DEFINE => $define,
INC => $include,
XSPROTOARG => '-noprototypes',
depend => {
'Modern.c' => 'Modern.xs auto-xs.inc src/glew.c include/GL/glew.h include/GL/wglew.h',
},
$DYNS ? ( dynamic_lib => $DYNS ) : (),
);
# If you edit these definitions to change the constants used by this module,
# you will need to use the generated const-c.inc and const-xs.inc
# files to replace their "fallback" counterparts before distributing your
# changes.
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 { #Written by Alexandr Ciornii, version 0.21. Added by eumm-upgrade.
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 ) {
#EUMM 6.5502 has problems with BUILD_REQUIRES
$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 };
$params{LIBS} = ":nosearch $params{LIBS}";
WriteMakefile( %params );
}