From 7f7d86d93b6959b59d0d9a049de38005484d0650 Mon Sep 17 00:00:00 2001 From: Oreolek Date: Tue, 6 Sep 2011 14:04:27 +0700 Subject: [PATCH] Fixes for installing, now for packaging. --- Rakefile | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 70 insertions(+), 8 deletions(-) diff --git a/Rakefile b/Rakefile index cc0d21e..4751b80 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ task :default => 'build:linux' require 'rake/clean' -#verbose(false) +verbose(false) VERSION = "1.0" @@ -20,11 +20,7 @@ namespace :build do desc "Build from sources for Linux (generic) (default)" task :linux do puts "Building Steed for Linux." - configure() - - #puts $cflags.join (" ") - #puts $libs.join(" ") - + configure() $cflags.unshift(" -D_LOCAL_APPDATA") #i swear i would get rid of this s**t $cflags.unshift("-g -Wall") $cflags.unshift("-Dunix") @@ -163,6 +159,7 @@ end directory "#{$prefix}/share/doc/steed/" directory "#{$prefix}/bin" +directory "#{$prefix}" directory "#{$prefix}/share/steed" directory "#{$prefix}/share/man/man6" @@ -199,6 +196,16 @@ task :install do if ($prefix.empty?) then $prefix = "/usr" end $cflags.unshift("-Dunix") $cflags.push(%Q!-DLANG_PATH='"#{$prefix}/share/steed/lang"' -DSTEAD_PATH='"#{$prefix}/share/steed/stead"' -DGAMES_PATH='"#{$prefix}/share/steed/games"' -DTHEMES_PATH='"#{$prefix}/share/steed/themes"' -DVERSION='"#{VERSION}"' -DICON_PATH='"#{$prefix}/share/pixmaps"'!) + configure() + 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 ("unix.c") + sources.each do|src| + sh %Q(#{$cc} -c #{src} #{$cflags.join(" ")}) + end + sh "#{$cc} #{$cflags.join(" ")} #{sources.ext("o").join(" ")} #{$libs.join(" ")} -o steed" + sh "ln -fs src/steed/steed ./steed" + end #next are parallel Rake::Task["doc"].invoke Rake::Task["data"].invoke @@ -206,6 +213,29 @@ task :install do Rake::Task["man"].invoke puts "Installation complete." end + if (Win32.windows?) then + $cflags.unshift("-Dwindows -mwindows -D_SDL_MOD_BUG") + $prefix = "." + $cflags.push(%Q!-DLANG_PATH='"./lang"' -DSTEAD_PATH='"#{$prefix}/stead"' -DGAMES_PATH='"#{$prefix}/games"' -DTHEMES_PATH='"#{$prefix}/themes"' -DVERSION='"#{VERSION}"' -DICON_PATH='"#{$prefix}/icon"'!) + configure() + 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.each do|src| + sh %Q(#{$cc} -c #{src} #{$cflags.join(" ")}) + end + sh "#{$cc} #{$cflags.join(" ")} #{sources.ext("o").join(" ")} #{$libs.join(" ")} -o steed" + end + Rake::Task["steed"].invoke + $prefix = "./bin" + 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 "Installation complete." + end end namespace :test do @@ -260,12 +290,44 @@ namespace :packaging do $cc = "i486-mingw32-gcc" $ar = "i486-mingw32-ar rc" $ranlib = "i486-mingw32-ranlib" - + $cflags.push("-Dwindows -mwindows -D_SDL_MOD_BUG") + $prefix = "./package/windows" + $cflags.push(%Q!-DLANG_PATH='"./lang"' -DSTEAD_PATH='"#{$prefix}/stead"' -DGAMES_PATH='"#{$prefix}/games"' -DTHEMES_PATH='"#{$prefix}/themes"' -DVERSION='"#{:version}"' -DICON_PATH='"#{$prefix}/icon"'!) + configure() + 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.each do|src| + sh %Q(#{$cc} -c #{src} #{$cflags.join(" ")}) + 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) - $cflags.push("-Dunix") + $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}" + end + FileList["modules/*.txt","*.html", "*.txt", "*.pdf"].each do |file| + cp file, "#{$prefix}/doc" + end + FileList["src/*/*.(c|h)"].each do |file| + cp file, "#{$prefix}/src" + 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) } + puts "Packaging complete." end desc "Packaging for Debian and Ubuntu" task :debian, [:version] do |t, args|