@@ -2,8 +2,10 @@ use strict;
22use warnings;
33use ExtUtils::MakeMaker;
44use ExtUtils::Liblist;
5+ use ExtUtils::Depends;
56use Config;
67use File::Spec::Functions;
8+ use File::Path qw( make_path) ;
79
810# Supported windowing interfaces
911our $is_valid_interface =
@@ -145,12 +147,24 @@ my $build_config =
145147
146148print " MakeMaker configuration:\n DEFINE=$DEFS \n INC=$INCS \n LIBS=$LIBS \n\n " if $verbose ;
147149
148- close (CONF) if (open (CONF," >" , " lib/OpenGL/Config.pm" )); # empty Config.pm
150+ { open my $fh , " >" , " lib/OpenGL/Config.pm" ; } # empty Config.pm
151+ my $eud = ExtUtils::Depends-> new(' OpenGL' );
152+ $eud -> set_inc(grep $_ , $INCS , $DEFS );
153+ $eud -> set_libs($LIBS ) if $LIBS ;
154+ $eud -> add_typemaps(' typemap' );
155+ $eud -> add_pm(map {
156+ (my $nl = $_ ) =~ s # ^lib/## ; $_ => " \$ (INST_LIB)/$nl "
157+ } glob ' lib/OpenGL.pm lib/OpenGL/*.pm lib/OpenGL/Shader/*.pm' );
158+ $eud -> add_xs(glob ' lib/OpenGL/*.xs' );
159+ make_path(' lib/OpenGL/Install' );
160+ $eud -> save_config(' lib/OpenGL/Install/Files.pm' );
161+ my %eud_vars = $eud -> get_makefile_vars;
149162WriteMakefile(
150163 NAME => ' OpenGL' ,
151164 VERSION_FROM => ' lib/OpenGL.pm' ,
152165 CONFIGURE_REQUIRES => {
153166 ' ExtUtils::MakeMaker' => 0,
167+ ' ExtUtils::Depends' => ' 0.8002' ,
154168 },
155169 PREREQ_PM => {
156170 ' OpenGL::Modern' => ' 0.0401' ,
@@ -188,8 +202,10 @@ WriteMakefile(
188202 " utils/glversion$Config {exe_ext} " .
189203 " utils/glversion$Config {obj_ext}"
190204 },
191- %$build_config ,
192- INC => $INCS . ' -I' .curdir(),
205+ !defined ($DYNS ) ? () : (dynamic_lib => $DYNS ),
206+ !defined ($OPTS ) ? () : (OPTIMIZE => $OPTS ),
207+ %eud_vars ,
208+ INC => $eud_vars {INC } . ' -I' .curdir(),
193209); # Generate the Makefile
194210WriteConfigPM( $build_config ); # Regenerate final Config.pm
195211
0 commit comments