Skip to content

Instantly share code, notes, and snippets.

@abaez
Created January 15, 2013 05:55
Show Gist options
  • Save abaez/4536533 to your computer and use it in GitHub Desktop.
Save abaez/4536533 to your computer and use it in GitHub Desktop.
A binary builder for Love2D
#!/usr/bin/perl
#perl script to make a binary file for love game
#zip directory for all, but done on linux ;)
sub zip {
21chdir $_[0] or die "Can't change to $_[0] $!\n"; #failsafe
my $file ='../${PWD##*/}'; #need to do it this form so it gets the exact directory
system "zip -r $file.love * ";
}
#binary builder
sub operating {
my $type = $_[0];
my $file='../${PWD##*/}'; #used as the address of the game's name :)
#type of install
if ($type =~ /linux/i) {
system "cat /usr/bin/love $file.love > $file.bin && chmod +x $file.bin";
print "Finish making the executive for love\n";
} elsif ($type =~ /win/i) {
print "This is where windows stuff will go\n";
} else {
print "This is where mac stuff will go\n";
}
}
print "First give me the directory\n";
chomp ($dir= <STDIN>);
print "Next tell me if you want to make a zip or a binary?\n";
chomp ($what= <STDIN>);
if ($what =~ /zip/i) {
&zip($dir);
} elsif ($what =~ /bin|binary/i) { #using to get binary compression
&zip($dir); #still need to compress
print "Which OS you want?\n win|mac|linux\n";
chomp ($_ = <STDIN>);
($_ =~ /win|mac|linux/i) ? &operating($_) :
die "I told you to give me an OS that I can work with. -_-, I quit!\n";
} else {
die "You want to do nothing... I see\n" ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment