Mercurial > projects > dwt2
diff rakefile @ 47:65761bc28ab2
swt linux again compilable for d1.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 27 Mar 2009 11:43:53 +0100 |
parents | d5dd1c5b90a9 |
children | e2ca9bdc80f2 |
line wrap: on
line diff
--- a/rakefile Fri Mar 27 11:10:45 2009 +0100 +++ b/rakefile Fri Mar 27 11:43:53 2009 +0100 @@ -24,12 +24,11 @@ ########################################################################## # Constants # -DMD = "dmd" -OBJDIR = File.expand_path("obj") -DIMPDIR = File.expand_path("imp") -LIBDIR = File.expand_path("lib") +DIR_OBJ = File.expand_path("obj") +DIR_IMP = File.expand_path("imp") +DIR_LIB = File.expand_path("lib") BINDIR = File.expand_path("bin") -RSPNAME = File.expand_path("rsp") +FILE_RSP = File.expand_path("rsp") ALL_RESDIRS = [ "base/res", "res" ] LOG_STDOUT = File.expand_path("olog.txt") @@ -38,16 +37,19 @@ if isWindows BASEDIR_SWT = "org.eclipse.swt.win32.win32.x86" - LIBEXT = ".lib" - OBJEXT = ".obj" - EXEEXT = ".exe" - MAPEXT = ".map" + LIBEXT = ".lib" + OBJEXT = ".obj" + EXEEXT = ".exe" + MAPEXT = ".map" + PROG_LIB = "lib.exe" else BASEDIR_SWT = "org.eclipse.swt.gtk.linux.x86" - LIBEXT = ".a" - OBJEXT = ".o" - EXEEXT = "" + LIBEXT = ".a" + OBJEXT = ".o" + EXEEXT = "" + PROG_LIB = "ar" end +PROG_DMD = "dmd#{EXEEXT}" ALL_RESDIRS << File.join(BASEDIR_SWT, "res" ) @@ -99,14 +101,14 @@ resdir_abs = File.expand_path( File.join( basedir, resdir )) srcdir_abs = File.expand_path( File.join( basedir, srcdir )) - FileUtils.mkdir_p DIMPDIR - FileUtils.mkdir_p OBJDIR + FileUtils.mkdir_p DIR_IMP + FileUtils.mkdir_p DIR_OBJ - rsp = File.new( RSPNAME, "w+" ) + rsp = File.new( FILE_RSP, "w+" ) rsp.puts "-H" - #rsp.puts "-Hd#{DIMPDIR.to_path}" + #rsp.puts "-Hd#{DIR_IMP.to_path}" rsp.puts "-I#{srcdir_abs.to_path}" - rsp.puts "-I#{DIMPDIR.to_path}" + rsp.puts "-I#{DIR_IMP.to_path}" rsp.puts "-J#{resdir_abs.to_path}" if dcargs != nil rsp.puts dcargs @@ -125,9 +127,9 @@ Dir.chdir(srcdir_abs) do if isWindows - cmd = "#{DMD} @#{RSPNAME.to_path}" + cmd = "#{PROG_DMD} @#{FILE_RSP.to_path}" else - cmd = "cat #{RSPNAME.to_path} | xargs #{DMD}" + cmd = "cat #{FILE_RSP.to_path} | xargs #{PROG_DMD}" end sh cmd, :verbose => false do |ok, res| if !ok then @@ -144,7 +146,7 @@ Find.find( srcdir_abs ) do |path| if FileTest.file?(path) && path =~ /\.di$/ then - trgfile = File.join( DIMPDIR, path[ srcdir_abs.length+1 .. -1 ]) + trgfile = File.join( DIR_IMP, path[ srcdir_abs.length+1 .. -1 ]) FileUtils.mkdir_p File.dirname(trgfile) FileUtils.mv path, trgfile end @@ -155,8 +157,8 @@ Find.find( srcdir_abs ) do |path| if FileTest.file?(path) && path =~ /\.o(bj)?$/ then trgfile = split_all( path )[ srcdirparts .. -1 ].join( "-" ) - FileUtils.mv path, File.join( OBJDIR, trgfile ) - libobjs << File.join( OBJDIR, trgfile ) + FileUtils.mv path, File.join( DIR_OBJ, trgfile ) + libobjs << File.join( DIR_OBJ, trgfile ) end end @@ -164,14 +166,24 @@ end def createLib( libobjs, name ) - FileUtils.mkdir_p LIBDIR.to_path - rsp = File.new( RSPNAME, "w+" ) - rsp.puts "-p512 -n -c #{LIBDIR}/#{name}#{LIBEXT}" - libobjs.each do |obj| - rsp.puts obj.to_path + FileUtils.mkdir_p DIR_LIB.to_path + rsp = File.new( FILE_RSP, "w+" ) + if isWindows + rsp.puts "-p512" + rsp.puts "-n" + rsp.puts "-c #{DIR_LIB}/#{name}#{LIBEXT}" + libobjs.each do |obj| + rsp.puts obj.to_path + end + else + rsp.puts "-r" + rsp.puts "-c #{DIR_LIB}/#{name}#{LIBEXT}" + libobjs.each do |obj| + rsp.puts obj.to_path + end end rsp.close - cmd = "lib @#{RSPNAME} > #{LOG_STDOUT}" + cmd = "#{PROG_LIB} @#{FILE_RSP} > #{LOG_STDOUT}" sh cmd, :verbose => false do |ok, res| if !ok then raise "librarian error" @@ -189,9 +201,9 @@ srcdir_abs = File.expand_path( File.join( basedir, srcdir)) resdir_abs = File.expand_path( File.join( basedir, resdir)) - rsp = File.new( RSPNAME, "w+" ) + rsp = File.new( FILE_RSP, "w+" ) rsp.puts "-I#{srcdir_abs.to_path}" - rsp.puts "-I#{DIMPDIR.to_path}" + rsp.puts "-I#{DIR_IMP.to_path}" rsp.puts "-J#{resdir_abs.to_path}" if dflags.size > 0 then rsp.puts dflags @@ -206,10 +218,10 @@ end rsp.puts "-L+dwt-base.lib" rsp.puts "-L+#{BASEDIR_SWT}.lib" - rsp.puts "-L+#{LIBDIR.to_path}\\" + rsp.puts "-L+#{DIR_LIB.to_path}\\" rsp.puts "-op" - rsp.puts "-od#{OBJDIR.to_path}" + rsp.puts "-od#{DIR_OBJ.to_path}" applfile = File.join(BINDIR,appname+EXEEXT) rsp.puts "-of#{applfile.to_path}" filelist.each do |path| @@ -219,9 +231,9 @@ Dir.chdir(srcdir_abs) do if isWindows - cmd = "#{DMD} @#{RSPNAME.to_path}" + cmd = "#{PROG_DMD} @#{FILE_RSP.to_path}" else - cmd = "cat #{RSPNAME.to_path} | xargs #{DMD}" + cmd = "cat #{FILE_RSP.to_path} | xargs #{PROG_DMD}" end sh cmd, :verbose => false do |ok, res| if !ok then @@ -240,10 +252,10 @@ desc "Clean" task :clean do puts "Cleaning" - FileUtils.rm_rf DIMPDIR - FileUtils.rm_rf OBJDIR - FileUtils.rm_rf LIBDIR - FileUtils.rm RSPNAME, :force => true + FileUtils.rm_rf DIR_IMP + FileUtils.rm_rf DIR_OBJ + FileUtils.rm_rf DIR_LIB + FileUtils.rm FILE_RSP, :force => true FileUtils.rm LOG_STDOUT, :force => true FileUtils.rm LOG_STDERR, :force => true end