Rakefile modifications. Nothing, really.

This commit is contained in:
Alexander Yakovlev 2011-09-21 09:09:28 +07:00
parent f2563a7579
commit 7c42679395
4 changed files with 85 additions and 27 deletions

1
README
View File

@ -30,6 +30,5 @@ You can use "rake -T" to see list of available build options.
Known problems
==============
- Does not clears up when Alt+Q _and_ game is unpacked [INSTEAD bug]
- Free Software Foundation insists on placing GPL preamble in every file; this is not the case.
- Does not clears up downloaded game archives

View File

@ -110,10 +110,9 @@ namespace :test do
puts "Testing SDL... fail"
puts "Please install sources for sdl, sdl_ttf, sdl_mixer and sdl_image C libraries."
exit
else
puts "Testing SDL... success"
sh "rm -f /tmp/sdl-test"
end
puts "Testing SDL... success"
rm("/tmp/sdl-test")
end
desc "Test Iconv for encoding conversions"
@ -144,34 +143,101 @@ namespace :test do
end
namespace :packaging do
desc "Packaging for Android"
task :android do
desc "Packaging for Android (debug)"
task :androiddbg do
puts "Not implemented yet."
end
desc "Packaging for Windows (mingw)"
task :windows do
Rake::Task["rake:clean"].invoke
print "Enter version [#{VERSION}]"
version = STDIN.gets.chomp
if version.empty? then version = VERSION end
#print "Enter version [#{VERSION}]"
#version = STDIN.gets.chomp
version = VERSION
#if version.empty? then version = VERSION end
compiler = detect_mingw()
$cc = compiler + "-mingw32-gcc"
$ar = compiler + "-mingw32-ar rc"
$ranlib = compiler + "-mingw32-ranlib"
$cflags.push("-I/usr/#{compiler}/include -I../windows -I../windows/SDL")
$cflags.push("-Dwindows -D_SDL_MOD_BUG")
$cc = compiler + "-gcc"
$ar = compiler + "-ar"
$ranlib = compiler + "-ranlib"
$cflags.push("-I/usr/#{compiler}/include -I/usr/#{compiler}/include/SDL -Dwindows -D_SDL_MOD_BUG")
$prefix = "./package/windows"
$cflags.push(%Q!-DLANG_PATH='"./lang"' -DSTEAD_PATH='"./stead"' -DGAMES_PATH='"./games"' -DTHEMES_PATH='"./themes"' -DVERSION='"#{version}"' -DICON_PATH='"./icon"'!)
configure()
sh "pkg-config --version >/dev/null" do |ok, res|
if !ok then
puts "Error: there is no pkg-config in $PATH."
exit
end
end
sh "pkg-config --cflags libsoup-2.4 >/dev/null" do |ok,res|
if (ok) then
$cflags.push "-D_USE_HTTP"
$cflags.push(`pkg-config --cflags libsoup-2.4`.chomp())
$libs.push(`pkg-config --libs libsoup-2.4`.chomp())
end
end
sh "pkg-config --cflags lua >/dev/null" do |ok,res|
if (ok) then
$cflags.push(`pkg-config --cflags lua`.chomp())
$libs.push(`pkg-config --libs lua`.chomp())
else
sh "pkg-config --cflags lua5.1 >/dev/null" do |ok,res|
if (ok) then
$cflags.push(`pkg-config --cflags lua5.1`.chomp())
$libs.push(`pkg-config --libs lua5.1`.chomp())
else
puts "Error: lua not found. Please install lua 5.1."
exit
end
end
end
end
Dir.chdir("src/zlib") do
sources = FileList["*.c"]
sources.each do|src|
sh %Q(#{$cc} -g -Wall -c #{src} -o #{src.ext("o")})
end
sh "#{$ar} -q libz.a #{sources.ext("o").join(" ")}"
sh "#{$ranlib} libz.a"
end
print "Enter your mingw prefix (used when compiling iconv and SDL):"
mingw_prefix = STDIN.gets.chomp
unless File.exist?("#{mingw_prefix}/include/iconv.h")
$cflags.push("-D_HAVE_ICONV")
$libs.push("-liconv")
end
unless File.exist?("#{mingw_prefix}/include/SDL/SDL.h")
puts ("SDL not found. You should download and compile SDL for mingw.")
exit
end
$cflags.push(`#{mingw_prefix}/bin/sdl-config --cflags`)
$libs.push(`#{mingw_prefix}/bin/sdl-config --libs`)
$libs.push("-lSDL_ttf -lSDL_mixer -lSDL_image")
sh "#{$cc} ./tests/sdl.c #{$cflags.join(" ")} #{$libs.join(" ")} -mwindows -o /tmp/sdl-test.exe"
unless File.exist? '/tmp/sdl-test.exe' then
puts "Please install sources for sdl, sdl_ttf, sdl_mixer and sdl_image C libraries."
exit
end
rm("/tmp/sdl-test.exe")
Dir.chdir("src/steed") do
sources = FileList["graphics.c","input.c","game.c","main.c","instead.c","sound.c","SDL_*.c","config.c","themes.c","menu.c","util.c","cache.c","unzip.c","ioapi.c","unpack.c","lfs.c","idf.c"]
sources.push ("windows.c iowin32.c")
sources.push ("windows.c")
sources.push ("iowin32.c")
sources.each do|src|
sh %Q(#{$cc} -c #{src} #{$cflags.join(" ")})
end
sh "#{$cc} #{$cflags.join(" ")} #{sources.ext("o").join(" ")} #{$libs.join(" ")} -o #{prefix}/steed.exe"
end
copy_files_local()
#copy_files_local()
end
desc "Packaging for Linux (generic)"
@ -188,6 +254,7 @@ namespace :packaging do
desc "Packaging for Debian and Ubuntu"
task :debian do
puts "Not implemented yet."
end
desc "Packaging for Arch Linux"

View File

@ -114,7 +114,6 @@ def configure #detects $cflags and $libs for every build
$cflags.push(`pkg-config --cflags gtk+-2.0`.chomp())
$cflags.push "-D_USE_GTK -D_USE_BROWSE"
$libs.push(`pkg-config --libs gtk+-2.0`.chomp())
$libs.push("-lSDL_mixer -lSDL_image -lSDL_ttf")
else
puts "not found"
end
@ -144,7 +143,6 @@ def configure #detects $cflags and $libs for every build
puts "found"
$cflags.push(`pkg-config --cflags lua5.1`.chomp())
$libs.push(`pkg-config --libs lua5.1`.chomp())
$libs.push("-lSDL_ttf -lSDL_mixer -lSDL_image")
else
puts "not found"
puts "Error: lua not found. Please install lua 5.1."
@ -154,6 +152,8 @@ def configure #detects $cflags and $libs for every build
end
end
$libs.push("-lSDL_mixer -lSDL_image -lSDL_ttf")
Rake::Task["rake:test:sdl"].invoke #if we are still alive everything is perfect
$cflags.unshift(`sdl-config --cflags`.chomp())
$libs.unshift(`sdl-config --libs`.chomp())

View File

@ -1,8 +0,0 @@
#!/bin/bash
cd ../games
zip -r ../test.zip tutorial*
cd ..
./sdl-instead test.zip 2>tests/stderr-output.txt &
sleep 0.6
xdotool key --clearmodifiers alt+q
rm -f test.zip