Almost done with rake

This commit is contained in:
Alexander Yakovlev 2011-09-05 17:12:44 +07:00
parent d2889f0ed6
commit 1ddaf4b67f
2 changed files with 26 additions and 11 deletions

View file

@ -3,7 +3,7 @@ task :default => 'build:linux'
require 'rake/clean'
verbose(false)
VERSION = "1.0" #causes error - wtf?!
VERSION = "1.0"
$cc = "cc"
$ar = "ar rc"
@ -14,7 +14,7 @@ $libs = Array.new
$has_iconv = 1
CLEAN.include('src/steed/*.o', 'src/zlib/*.o', 'desktop/*.desktop')
CLEAN.include('src/steed/*.o', 'src/zlib/*.o', 'src/zlib/libz.a', 'desktop/*.desktop')
namespace :build do
desc "Build from sources for Linux (generic) (default)"
task :linux do
@ -27,18 +27,28 @@ namespace :build do
$cflags.unshift(" -D_LOCAL_APPDATA") #i swear i would get rid of this s**t
$cflags.unshift("-g -Wall")
$cflags.unshift("-Dunix")
$cflags.push(%Q!-DLANG_PATH="./lang" -DSTEAD_PATH="./stead" -DGAMES_PATH="./games" -DTHEMES_PATH="./themes" -DVERSION="#{VERSION}" -DICON_PATH="./icon"!)
$cflags.push(%Q!-DLANG_PATH='"./lang"' -DSTEAD_PATH='"./stead"' -DGAMES_PATH='"./games"' -DTHEMES_PATH='"./themes"' -DVERSION='"#{VERSION}"' -DICON_PATH='"./icon"'!)
print "Building Steed.."
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.insert ("unix.c")
#sources = FileList["graphics.c","input.c","game.c","main.c","instead.c","sound.c","SDL_rotozoom.c","SDL_anigif.c","SDL_gfxBlitFunc.c","config.c","themes.c","menu.c","util.c","cache.c","unzip.c","ioapi.c","unpack.c","lfs.c","idf.c"]
sources.push ("unix.c")
print "."
sources.each do|src|
sh "#{$cc} -c #{src} #{$cflags.join(" ")}"
sh %Q(#{$cc} -c #{src} #{$cflags.join(" ")})
end
print "."
#sh "#{$cc} #{$cflags.join(" ")} #{$libs.join(" ")} *.o -o steed"
sh "#{$cc} #{$cflags.join(" ")} #{sources.ext("o").join(" ")} #{$libs.join(" ")} -o steed"
end
end
task :zlib do
if File.exist? 'src/zlib/libz.a' then next 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} libz.a #{sources.ext("o").join(" ")}"
end
end
def configure #detects $cflags and $libs for every build
@ -82,8 +92,10 @@ namespace :build do
else
if File.exist? '/usr/include/zlib.h' then
puts "own"
Rake::Task["rake:build:zlib"].invoke
$cflags.push("-D USE_UNPACK")
$libs.push("-lz")
$cflags.push("-I../zlib")
$libs.push("-lz ../zlib/libz.a")
else
puts "not found"
end
@ -126,6 +138,7 @@ namespace :build do
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."

View file

@ -1341,7 +1341,7 @@ static SDL_Surface *icon = NULL;
int gfx_video_init(void)
{
char title[4096];
char title[128] = "";//4096 chars?! my HD monitor is not THAT big, you know.
strcpy( title, "Steed v." );
strcat( title, VERSION );
@ -1356,8 +1356,10 @@ int gfx_video_init(void)
#ifndef ICON_PATH
#define ICON_PATH "./icon"
#endif
icon = IMG_Load( ICON_PATH"/sdl_instead.png" );
char iconpath[128];
strcpy( iconpath, ICON_PATH);
strcat( iconpath, "/sdl_instead.png");
icon = IMG_Load( iconpath );
if ( icon ) {
SDL_WM_SetIcon( icon, NULL );
}