From a69c617f0d534f3a1687fabf92d0526086c7d74d Mon Sep 17 00:00:00 2001 From: Oreolek Date: Tue, 6 Sep 2011 13:39:10 +0700 Subject: [PATCH] Rakefile is ready for Linux. Yahoo! --- README | 10 ++++---- Rakefile | 71 +++++++++++++++++++++++++++++++------------------------- 2 files changed, 45 insertions(+), 36 deletions(-) diff --git a/README b/README index c20590b..a127460 100644 --- a/README +++ b/README @@ -17,12 +17,14 @@ Dependencies Also you'll need GNU C Compiler, bash and GNU make for building. -Building -======== +Installing +========== -Typically you just can use the following command: +Typically you just can use the following command (as root): -rake --silent +rake install --silent + +It works even on Windows. You can use "rake -T" to see list of available build options. diff --git a/Rakefile b/Rakefile index 67b70b4..cc0d21e 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ task :default => 'build:linux' require 'rake/clean' -verbose(false) +#verbose(false) VERSION = "1.0" @@ -161,44 +161,51 @@ namespace :build do end end -namespace :install do - desc "Install Steed (linux)" - task :linux do +directory "#{$prefix}/share/doc/steed/" +directory "#{$prefix}/bin" +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 + 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" + end +end +task :steed => "#{$prefix}/bin" do #if I do that as file task it thinks it's already done + 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 + end +end + +desc "Install Steed" +task :install do + $cflags.unshift("-g -Wall") + if (RUBY_PLATFORM =~ /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i) then print "Enter prefix path [/usr]:" $prefix = STDIN.gets.chomp - if (!$prefix) then $prefix = "/usr" end - $cflags.unshift("-g -Wall") + 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"'!) #next are parallel - Rake::Task["#{$prefix}/share/man/man6"].invoke - Rake::Task["#{$prefix}/share/steed"].invoke - Rake::Task["#{$prefix}/bin"].invoke - Rake::Task["#{$prefix}/share/doc/steed/"].invoke + Rake::Task["doc"].invoke + Rake::Task["data"].invoke + Rake::Task["steed"].invoke + Rake::Task["man"].invoke puts "Installation complete." end - Directory "#{$prefix}/share/man/man6" do - Dir.chdir("doc") do - FileList["*.6"].each do |file| - cp file, "#{$prefix}/share/man/man6" - end - end - end - Directory "#{$prefix}/share/steed" do - FileList["lang/*.ini", "stead/*.lua", "themes/*/*.(ini|jpg|png|ogg|wav|ttf)"].each do |file| - cp file,"#{$prefix}/share/steed" - end - end - Directory "#{$prefix}/bin" do - cp "src/steed/steed", "#{$prefix}/bin" - end - Directory "#{$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 - end - end end namespace :test do