Finally! It packages.

Some build errors on Debian - I'll fix 'em soon.
This commit is contained in:
Alexander Yakovlev 2011-09-08 19:42:39 +07:00
parent 7f7d86d93b
commit e51f8454c2
2 changed files with 70 additions and 47 deletions

4
README
View file

@ -4,7 +4,7 @@ Powerful text-oriented game engine in SDL and Lua.
Dependencies
============
- rake (for building sources)
- rake 1.9 (for building sources)
- gtk+-2.0
- sdl
- sdl-mixer
@ -24,7 +24,7 @@ Typically you just can use the following command (as root):
rake install --silent
It works even on Windows.
In some distros it's "rake1.9.1". It works even on Windows.
You can use "rake -T" to see list of available build options.

113
Rakefile
View file

@ -157,33 +157,38 @@ namespace :build do
end
end
directory "#{$prefix}/share/doc/steed/"
directory "#{$prefix}/bin"
directory "#{$prefix}"
directory "#{$prefix}/share/steed"
directory "#{$prefix}/share/man/man6"
task :man => "#{$prefix}/share/man/man6" do
Dir.chdir("doc") do
FileList["*.6"].each do |file|
cp file, "#{$prefix}/share/man/man6"
end
task :man do
mkdir_p "#{$prefix}/share/man/man6"
FileList["doc/*.6"].each do |file|
cp file, "#{$prefix}/share/man/man6"
end
end
task :data => "#{$prefix}/share/steed" do
FileList["lang/*.ini", "stead/*.lua", "themes/*/*.(ini|jpg|png|ogg|wav|ttf)"].each do |file|
cp file,"#{$prefix}/share/steed"
task :data do
mkdir_p "#{$prefix}/share/steed/lang"
mkdir_p "#{$prefix}/share/steed/stead"
FileList["lang/*.ini"].each do |file|
cp file,"#{$prefix}/share/steed/lang"
end
FileList["stead/*.lua"].each do |file|
cp file,"#{$prefix}/share/steed/stead"
end
FileList["themes/(*)/*.(ini|jpg|png|ogg|wav|ttf)"].each do |file|
mkdir_p "#{$prefix}/themes/#{$1}"
cp file,"#{$prefix}/themes/#{$1}"
end
end
task :steed => "#{$prefix}/bin" do #if I do that as file task it thinks it's already done
task :steed do #if I do that as file task it thinks it's already done
mkdir_p "#{$prefix}/bin"
cp "src/steed/steed", "#{$prefix}/bin"
File.chmod(0755, "#{$prefix}/bin/steed")
end
task :doc => "#{$prefix}/share/doc/steed/" do
Dir.chdir("doc") do
FileList["modules/*.txt","*.html", "*.txt", "*.pdf"].each do |file|
cp file, "#{$prefix}/share/doc/steed/"
end
task :doc do
mkdir_p "#{$prefix}/share/doc/steed/"
FileList["doc/*.(html|txt|pdf)"].each do |file|
cp file, "#{$prefix}/share/doc/steed/"
end
FileList["doc/modules/*.txt"].each do |file|
cp file, "#{$prefix}/share/doc/steed/modules"
end
end
@ -281,12 +286,13 @@ end
namespace :packaging do
desc "Packaging for Android"
task :android, [:version] do |t, args|
args.with_defaults(:version => VERSION)
task :android do
end
desc "Packaging for Windows (mingw)"
task :windows, [:version] do |t, args|
args.with_defaults(:version => VERSION)
task :windows do
print "Enter version [#{VERSION}]"
version = STDIN.gets.chomp
if version.empty? then version = VERSION end
$cc = "i486-mingw32-gcc"
$ar = "i486-mingw32-ar rc"
$ranlib = "i486-mingw32-ranlib"
@ -302,40 +308,57 @@ namespace :packaging do
end
sh "#{$cc} #{$cflags.join(" ")} #{sources.ext("o").join(" ")} #{$libs.join(" ")} -o steed"
end
Rake::Task[$prefix].invoke
FileList["lang/*.ini", "stead/*.lua", "themes/*/*.(ini|jpg|png|ogg|wav|ttf)"].each do |file|
cp file,"#{$prefix}"
end
FileList["modules/*.txt","*.html", "*.txt", "*.pdf"].each do |file|
cp file, "#{$prefix}/doc"
end
puts "Packaging complete."
#...
end
desc "Packaging for Linux (generic)"
task :linux, [:version] do |t, args|
args.with_defaults(:version => VERSION)
task :linux do
print "Enter version [#{VERSION}]"
version = STDIN.gets.chomp
if version.empty? then version = VERSION end
$prefix = "./package/unix"
Rake::Task[$prefix].invoke
FileList["lang/*.ini", "stead/*.lua", "themes/*/*.(ini|jpg|png|ogg|wav|ttf)"].each do |file|
cp file,"#{$prefix}"
Rake::Task["rake:clean"].invoke
mkdir_p "#{$prefix}/lang"
mkdir_p "#{$prefix}/stead"
mkdir_p "#{$prefix}/doc/modules"
FileList["lang/*.ini"].each do |file|
cp file,"#{$prefix}/lang"
end
FileList["modules/*.txt","*.html", "*.txt", "*.pdf"].each do |file|
FileList["stead/*.lua"].each do |file|
cp file,"#{$prefix}/stead"
end
FileList["doc/modules/*.txt"].each do |file|
cp file, "#{$prefix}/doc/modules"
end
FileList["doc/*.txt","doc/*.html","doc/*.pdf"].each do |file|
cp file, "#{$prefix}/doc"
end
FileList["src/*/*.(c|h)"].each do |file|
cp file, "#{$prefix}/src"
mkdir_p "#{$prefix}/src"
Dir.glob("src/*/*.{c,h}").each do |file|
mkdir_p $prefix + "/src/" + file.split("/").at(-2)
cp file, $prefix + "/src/" + file.split("/").at(-2)
end
Dir.glob("games/*/*.{ini,jpg,png,ogg,wav,ttf}").each do |file|
mkdir_p $prefix + "/games/" + file.split("/").at(-2)
cp file, $prefix + "/games/" + file.split("/").at(-2)
end
Dir.glob("themes/*/*.{ini,jpg,png,ogg,wav,ttf}").each do |file|
mkdir_p $prefix + "/themes/" + file.split("/").at(-2)
cp file, $prefix + "/themes/" + file.split("/").at(-2)
end
cp "Rakefile", $prefix
File.open("#{$prefix}/Rakefile", 'r+') { |f| newstr = f.read.gsub (Q(VERSION = "#{VERSION}"), Q(VERSION = "#{:version}")); f.rewind; f.puts(newstr) }
File.open("#{$prefix}/Rakefile", 'r+') do |f|
newstr = f.read.gsub("VERSION = \"#{VERSION}\"", "VERSION = \"#{version}\"")
f.rewind
f.puts(newstr)
end
puts "Packaging complete."
end
desc "Packaging for Debian and Ubuntu"
task :debian, [:version] do |t, args|
args.with_defaults(:version => VERSION)
task :debian do
end
desc "Packaging for Arch Linux"
task :arch, [:version] do |t, args|
args.with_defaults(:version => VERSION)
task :arch do
end
task :all => [:android, :windows, :linux, :debian, :arch] do
end