Skip to content

Commit

Permalink
Some maintenance on the building stuff. Works pretty good now
Browse files Browse the repository at this point in the history
  • Loading branch information
Blaizer committed Oct 3, 2011
1 parent 52d8e49 commit 5ddc2fe
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -6,7 +6,9 @@ _build*
*.bak *.bak
MANIFEST MANIFEST
META.yml META.yml
META.json
MYMETA.yml MYMETA.yml
MYMETA.json
img* img*
blb* blb*
blbconv* blbconv*
Expand Down
3 changes: 3 additions & 0 deletions Build.PL
Expand Up @@ -25,6 +25,9 @@ my $build = My::Module::Build->new(
}, },
add_to_cleanup => [ add_to_cleanup => [
'MANIFEST', 'MANIFEST',
'META.yml',
'META.json',
'lib/Games/Neverhood/typemap',
], ],
); );


Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.skip
Expand Up @@ -7,6 +7,7 @@
\.bak$ \.bak$
^MANIFEST\.skip$ ^MANIFEST\.skip$
^MYMETA\.yml$ ^MYMETA\.yml$
^MYMETA\.json$
^img/ ^img/
^blb/ ^blb/
^blbconv/ ^blbconv/
Expand All @@ -16,3 +17,4 @@
^unshare/ ^unshare/
\.[co]$ \.[co]$
^lib/Games/Neverhood/typemap$ ^lib/Games/Neverhood/typemap$
^nhc.pl$
14 changes: 8 additions & 6 deletions inc/My/Module/Build.pm
Expand Up @@ -4,15 +4,16 @@ use warnings;
use base 'Module::Build'; use base 'Module::Build';
use autodie ':all'; use autodie ':all';


$ENV{SDL_VIDEODRIVER} = 'dummy';
$ENV{SDL_AUDIODRIVER} = 'dummy';

sub ACTION_uninstall { sub ACTION_uninstall {
require File::ShareDir; require File::ShareDir;
require File::Spec; require File::Spec;
eval { require Games::Neverhood }; eval { require Games::Neverhood };
$! and leave("Games::Neverhood wouldn't load: $@. Maybe install before uninstalling?"); $! and leave("Games::Neverhood wouldn't load: $@. Maybe install before uninstalling?");
my $packlist = File::Spec->catfile( my $dir = File::ShareDir::module_dir('Games::Neverhood');
File::ShareDir::module_dir('Games::Neverhood'), my $packlist = File::Spec->catfile($dir, '.packlist');
'.packlist'
);
open LIST, ">>$packlist"; #Just makin' sure we can write in it later open LIST, ">>$packlist"; #Just makin' sure we can write in it later
open LIST, $packlist; open LIST, $packlist;
my $leftover; my $leftover;
Expand All @@ -33,20 +34,21 @@ sub ACTION_uninstall {
} }
$total++; $total++;
} }
print "$deleted of $total files successfully deleted\n";
if(defined $leftover and $deleted) { if(defined $leftover and $deleted) {
print "$deleted of $total files successfully deleted\n";
print "Updating .packlist with remaining files\n"; print "Updating .packlist with remaining files\n";
open LIST, ">$packlist"; open LIST, ">$packlist";
print LIST $leftover; print LIST $leftover;
print ".packlist updated with remaining files\n"; print ".packlist updated with remaining files\n";
} }
else { else {
print "all files successfully deleted\n";
if(do { no autodie; unlink $packlist }) { if(do { no autodie; unlink $packlist }) {
print ".packlist deleted\n"; print ".packlist deleted\n";
} }
else { else {
print "Emptying .packlist\n";
open LIST, ">$packlist"; open LIST, ">$packlist";
print ".packlist emptied\n";
} }
} }
close LIST; close LIST;
Expand Down

0 comments on commit 5ddc2fe

Please sign in to comment.