PerlGameDev / SDL

Rehashing the old perl SDL binding on cpan.org
http://search.cpan.org/dist/SDL
GNU General Public License v2.0
81 stars 29 forks source link

Build.PL does not work with the option '--with-sdl-config' #261

Open jplesnik opened 10 years ago

jplesnik commented 10 years ago

I tried to update the module for Fedora, but I get following error

# perl Build.PL installdirs=vendor --with-sdl-config
Unknown option: with-sdl-config
Welcome to Alien::SDL module installation
...

It seems the problem was cause by using GetOptions at Build.PL directly. Previously was option processed by get_options.

The changes below fixed it for me.

diff -up Alien-SDL-1.442/Build.PL.orig Alien-SDL-1.442/Build.PL
--- Alien-SDL-1.442/Build.PL.orig       2014-04-22 23:46:58.000000000 +0200
+++ Alien-SDL-1.442/Build.PL    2014-04-29 14:10:55.743795008 +0200
@@ -6,9 +6,7 @@ use File::Spec::Functions qw(catdir catf
 use Config;
 use My::Utility qw(check_config_script check_prebuilt_binaries check_prereqs_libs check_prereqs_tools $source_packs);

-use Getopt::Long;
 my ( $ans, $travis ) = 0;
-GetOptions( "travis" => \$travis );

 print "Welcome to Alien::SDL module installation\n";
 print "-----------------------------------------\n";
@@ -97,7 +95,10 @@ my $build = $package->new(
       repository => 'http://github.com/PerlGameDev/Alien-SDL'
     }
   },
-  get_options => { 'with-sdl-config' => { qw(type :s  store) => \$sdl_config } },
+  get_options => { 
+    'with-sdl-config' => { qw(type :s  store) => \$sdl_config },
+    'travis' => { qw(type :n store) => \$travis },
+  },
   dynamic_config => 1,
   create_readme => 1,
   share_dir => 'sharedir',

Btw, if you want to get number for $travis you should do it this way

GetOptions( "travis=n" => \$travis );

Regards, Jitka