|
|
|
@ -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"
|
|
|
|
|