new mkrelease script for OS X
This commit does a few things: 1. includes a new mkrelease script for OS X devs to bundle releases with 2. removes the old Perl scripts that sort of accomplished the same task 3. includes a README documenting how to use the new script The old scripts were brittle and inefficient. The new script is written in Ruby because it is what I'm familiar with and because OS X has shipped with Ruby since version 10.5.0.
This commit is contained in:
committed by
Jonathan Payne
parent
88f56cb0ec
commit
a40b7aa921
@@ -0,0 +1,15 @@
|
||||
StepMania Scripts For OS X
|
||||
=========
|
||||
|
||||
This script can be used to bundle a .dmg installer of StepMania.
|
||||
It assumes you have already built a StepMania.app using Xcode and
|
||||
that your stepmania directory structure is intact as you cloned it.
|
||||
|
||||
To use this script, open a terminal and cd to your stepmania directory,
|
||||
then run the following commands:
|
||||
|
||||
cd Xcode/scripts
|
||||
ruby mkrelease.rb
|
||||
|
||||
You'll see output as each stepmania sub-directory is copied into a tmp directory.
|
||||
If all goes well, you'll be notified that the dmg was created in your stepmania directory.
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
use File::Copy;
|
||||
|
||||
$ver = 0;
|
||||
if( open FH, '<ver.cpp' )
|
||||
{
|
||||
<FH> =~ /version_num = (\d+);/ and $ver = $1 + 1;
|
||||
close FH;
|
||||
}
|
||||
chop( $date = `date` );
|
||||
chop( $time = `time` );
|
||||
open FH, '>.ver.tmp' or die $!;
|
||||
print FH <<"EOF";
|
||||
extern const unsigned long version_num = $ver;
|
||||
extern const char *const version_date = "$date";
|
||||
extern const char *const version_time = "$time";
|
||||
EOF
|
||||
close FH;
|
||||
move '.ver.tmp', 'ver.cpp';
|
||||
@@ -1,112 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use File::Copy;
|
||||
use File::Path;
|
||||
use File::Basename;
|
||||
use File::Temp qw/tempfile tempdir/;
|
||||
use Cwd;
|
||||
|
||||
my @docs = (
|
||||
"Licenses.txt",
|
||||
"Changelog_sm5.txt",
|
||||
"Changelog_sm-ssc.txt",
|
||||
"Changelog_SSCformat.txt",
|
||||
"CommandLineArgs.txt",
|
||||
"credits.txt"
|
||||
);
|
||||
|
||||
my @themerdocs = (
|
||||
"actordef.txt",
|
||||
"conditional_music.txt",
|
||||
"fontini.txt",
|
||||
"gamecommands.txt",
|
||||
"included_scripts.txt",
|
||||
"moremsg.txt",
|
||||
"Noteskin elements Reference.txt",
|
||||
"recommended_practices.txt",
|
||||
"ScreenMessages.txt",
|
||||
"ScreenTextEntry.txt",
|
||||
"sm-ssc_themeguide.txt",
|
||||
"ThemePrefs.txt",
|
||||
"ThemePrefsRows.txt"
|
||||
);
|
||||
|
||||
# XXX
|
||||
my @songs = ( "Instructions.txt" );
|
||||
my @song_mechatribe = (
|
||||
"Mecha-Tribe Assault.ssc",
|
||||
"Mecha-Tribe Assault.ogg",
|
||||
"mechatribeassaultbg.png",
|
||||
"mechatribeassaultbn.png",
|
||||
"wyde cd-tital.png"
|
||||
);
|
||||
|
||||
my @song_springtime = (
|
||||
"Springtime.ssc",
|
||||
"Kommisar - Springtime.mp3",
|
||||
"spring.png",
|
||||
"springbn.png"
|
||||
);
|
||||
|
||||
# Passing a date for a CVS release gives StepMania-CVS-date.
|
||||
# Otherwise you get StepMania-ver.
|
||||
die "usage: $0 [date]\n" if @ARGV > 1;
|
||||
my $root = getcwd;
|
||||
my $scripts = dirname $0;
|
||||
my $srcdir = ( $scripts =~ m{^/} ? "$scripts/../.." :
|
||||
"$root/$scripts/../.." );
|
||||
my $family;
|
||||
my $id;
|
||||
my $ver;
|
||||
|
||||
open FH, "$srcdir/src/ProductInfo.h" or die "Where am I?\n";
|
||||
while( <FH> )
|
||||
{
|
||||
if( /^#define\s+PRODUCT_FAMILY_BARE\s+(.*?)\s*$/ ) {
|
||||
$family = $1;
|
||||
} elsif( /^#define\s+PRODUCT_ID_BARE\s+(.*?)\s*$/ ) {
|
||||
$id = $1;
|
||||
} elsif( /^#define\s+PRODUCT_VER_BARE\s+(.*?)\s*$/ ) {
|
||||
$ver = $1;
|
||||
}
|
||||
}
|
||||
close FH;
|
||||
|
||||
my $destname = @ARGV ? "$id-$ARGV[0]" : "$family-$ver";
|
||||
|
||||
$destname =~ s/\s+/-/g;
|
||||
|
||||
my $tmp = tempdir;
|
||||
|
||||
# Copy StepMania and make smzip
|
||||
system 'cp', '-r', "$srcdir/StepMania.app", $tmp and die "cp -r failed: $!\n";
|
||||
system 'strip', '-x', "$tmp/StepMania.app/Contents/MacOS/StepMania";
|
||||
|
||||
mkdir "$tmp/Packages";
|
||||
system "$srcdir/Utils/CreatePackage.pl", $srcdir, "$tmp/Packages" and die "mksmdata.pl failed: $!\n";
|
||||
|
||||
# Copy docs
|
||||
mkdir "$tmp/Docs";
|
||||
copy "$srcdir/Docs/$_", "$tmp/Docs/$_" for @docs;
|
||||
|
||||
# Copy themer docs
|
||||
mkdir "$tmp/Docs/Themerdocs";
|
||||
copy "$srcdir/Docs/Themerdocs/$_", "$tmp/Docs/Themerdocs/$_" for @themerdocs;
|
||||
|
||||
# Copy songs
|
||||
mkdir "$tmp/Songs";
|
||||
copy "$srcdir/Songs/$_", "$tmp/Songs/$_" for @songs;
|
||||
|
||||
# oh man, is this ugly or what
|
||||
mkdir "$tmp/Songs/StepMania 5";
|
||||
|
||||
mkdir "$tmp/Songs/StepMania 5/MechaTribe Assault";
|
||||
copy "$srcdir/Songs/StepMania 5/MechaTribe Assault/$_", "$tmp/Songs/StepMania 5/MechaTribe Assault/$_" for @song_mechatribe;
|
||||
|
||||
mkdir "$tmp/Songs/StepMania 5/Springtime";
|
||||
copy "$srcdir/Songs/StepMania 5/Springtime/$_", "$tmp/Songs/StepMania 5/Springtime/$_" for @song_springtime;
|
||||
|
||||
# Make a dmg
|
||||
system qw/hdiutil create -ov -format UDZO -imagekey zlib-level=9 -srcfolder/, $tmp, '-volname', $destname, "$root/$destname-mac.dmg";
|
||||
rmtree $tmp;
|
||||
@@ -0,0 +1,58 @@
|
||||
# 'fileutils' is used to recursively copy directories
|
||||
# 'tmpdir' is used to create and work with temporary directories
|
||||
require 'fileutils'
|
||||
require 'tmpdir'
|
||||
|
||||
# cd to the StepMania 5 src directory
|
||||
Dir.chdir "../../src"
|
||||
|
||||
# initialize empty strings
|
||||
family, version = ""
|
||||
|
||||
# open ProductInfo.h in read-only mode
|
||||
File.open("#{Dir.pwd}/ProductInfo.h", "r") do |f|
|
||||
# read each line, matching for product family and version
|
||||
f.each do |line|
|
||||
if line.match( /^#define\s+PRODUCT_FAMILY_BARE\s+(.*?)\s*$/ )
|
||||
family = $1;
|
||||
|
||||
elsif line.match( /^#define\s+PRODUCT_VER_BARE\s+(.*?)\s*$/ )
|
||||
version = $1;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# replace whitespace with hyphens in version string
|
||||
version.gsub!(/\s+/,"-")
|
||||
|
||||
# the name of the .dmg file
|
||||
name = "#{family}-#{version}-mac.dmg"
|
||||
|
||||
# a list of directories we want to include in our .dmg
|
||||
directories = [ "Announcers", "BackgroundEffects", "BackgroundTransitions",
|
||||
"BGAnimations", "Characters", "Courses", "Data", "Docs", "Manual",
|
||||
"NoteSkins", "Scripts", "Songs", "StepMania.app", "Themes" ]
|
||||
|
||||
# cd back to the root of the StepMania 5 directory
|
||||
Dir.chdir ".."
|
||||
|
||||
# create a temp directory; this will be automatically deleted when the block completes
|
||||
Dir.mktmpdir {|temp|
|
||||
|
||||
# nest two directories named by family and version within the temp directory
|
||||
# the outer will become the root of the dmg
|
||||
# the inner will neatly tidy all the contents together so users can easily drag/drop everything at once
|
||||
FileUtils.mkdir_p("#{temp}/#{family}-#{version}/#{family}-#{version}/")
|
||||
|
||||
# loop through the directories array
|
||||
directories.each do |directory|
|
||||
# recursively copy each directory into our temp directory
|
||||
FileUtils.cp_r directory, "#{temp}/#{family}-#{version}/#{family}-#{version}/", :verbose => true
|
||||
end
|
||||
|
||||
#construct the shell command that will create the dmg
|
||||
cmd = "hdiutil create #{Dir.pwd}/#{name} -srcfolder #{temp}/#{family}-#{version} -ov"
|
||||
|
||||
#execute the command in a subshell
|
||||
system( cmd )
|
||||
}
|
||||
Reference in New Issue
Block a user