comparison rakefile @ 40:9f32c409fe27

Fix compile problem and extend rakefile
author Frank Benoit <benoit@tionex.de>
date Wed, 25 Mar 2009 15:10:08 +0100
parents d46287db17ed
children ed96ea2a2764
comparison
equal deleted inserted replaced
39:0ecb2b338560 40:9f32c409fe27
39 if isWindows 39 if isWindows
40 BASEDIR_SWT = "org.eclipse.swt.win32.win32.x86" 40 BASEDIR_SWT = "org.eclipse.swt.win32.win32.x86"
41 LIBEXT = ".lib" 41 LIBEXT = ".lib"
42 OBJEXT = ".obj" 42 OBJEXT = ".obj"
43 EXEEXT = ".exe" 43 EXEEXT = ".exe"
44 MAPEXT = ".map"
44 else 45 else
45 BASEDIR_SWT = "org.eclipse.swt.gtk.linux.x86" 46 BASEDIR_SWT = "org.eclipse.swt.gtk.linux.x86"
46 LIBEXT = ".a" 47 LIBEXT = ".a"
47 OBJEXT = ".o" 48 OBJEXT = ".o"
48 EXEEXT = "" 49 EXEEXT = ""
101 FileUtils.mkdir_p DIMPDIR 102 FileUtils.mkdir_p DIMPDIR
102 FileUtils.mkdir_p OBJDIR 103 FileUtils.mkdir_p OBJDIR
103 104
104 rsp = File.new( RSPNAME, "w+" ) 105 rsp = File.new( RSPNAME, "w+" )
105 rsp.puts "-H" 106 rsp.puts "-H"
107 #rsp.puts "-Hd#{DIMPDIR.to_path}"
106 rsp.puts "-I#{srcdir_abs.to_path}" 108 rsp.puts "-I#{srcdir_abs.to_path}"
107 rsp.puts "-I#{DIMPDIR.to_path}" 109 rsp.puts "-I#{DIMPDIR.to_path}"
108 rsp.puts "-J#{resdir_abs.to_path}" 110 rsp.puts "-J#{resdir_abs.to_path}"
109 if dcargs != nil 111 if dcargs != nil
110 rsp.puts dcargs 112 rsp.puts dcargs
119 rsp.puts path.to_path 121 rsp.puts path.to_path
120 end 122 end
121 end 123 end
122 rsp.close 124 rsp.close
123 125
124 Dir.chdir(basedir) do 126 Dir.chdir(srcdir_abs) do
125 if isWindows 127 if isWindows
126 cmd = "#{DMD} @#{RSPNAME.to_path}" 128 cmd = "#{DMD} @#{RSPNAME.to_path}"
127 else 129 else
128 cmd = "cat #{RSPNAME.to_path} | xargs #{DMD}" 130 cmd = "cat #{RSPNAME.to_path} | xargs #{DMD}"
129 end 131 end
146 FileUtils.mkdir_p File.dirname(trgfile) 148 FileUtils.mkdir_p File.dirname(trgfile)
147 FileUtils.mv path, trgfile 149 FileUtils.mv path, trgfile
148 end 150 end
149 end 151 end
150 152
151 libobjs = Array.new 153 libobjs = FileList.new
152 srcdirparts = split_all( srcdir_abs ).length 154 srcdirparts = split_all( srcdir_abs ).length
153 Find.find( srcdir_abs ) do |path| 155 Find.find( srcdir_abs ) do |path|
154 if FileTest.file?(path) && path =~ /\.o(bj)?$/ then 156 if FileTest.file?(path) && path =~ /\.o(bj)?$/ then
155 trgfile = split_all( path )[ srcdirparts .. -1 ].join( "-" ) 157 trgfile = split_all( path )[ srcdirparts .. -1 ].join( "-" )
156 FileUtils.mv path, File.join( OBJDIR, trgfile ) 158 FileUtils.mv path, File.join( OBJDIR, trgfile )
173 sh cmd, :verbose => false do |ok, res| 175 sh cmd, :verbose => false do |ok, res|
174 if !ok then 176 if !ok then
175 raise "librarian error" 177 raise "librarian error"
176 end 178 end
177 end 179 end
180 FileUtils.rm libobjs
178 181
179 end 182 end
180 183
181 def buildApp( basedir, srcdir, resdir, dflags, appname, filelist, libnames ) 184 def buildApp( basedir, srcdir, resdir, dflags, appname, filelist, libnames )
182 puts "Building #{basedir}[#{appname}]"
183 if filelist == nil 185 if filelist == nil
184 filelist = FileList[ "**/#{appname}.d" ] 186 filelist = FileList[ "**/#{appname}.d" ]
185 end 187 end
186 188
187 srcdir_abs = File.expand_path( File.join( basedir, srcdir)) 189 srcdir_abs = File.expand_path( File.join( basedir, srcdir))
215 filelist.each do |path| 217 filelist.each do |path|
216 rsp.puts File.expand_path(path).to_path 218 rsp.puts File.expand_path(path).to_path
217 end 219 end
218 rsp.close 220 rsp.close
219 221
220 Dir.chdir(basedir) do 222 Dir.chdir(srcdir_abs) do
221 if isWindows 223 if isWindows
222 cmd = "#{DMD} @#{RSPNAME.to_path}" 224 cmd = "#{DMD} @#{RSPNAME.to_path}"
223 else 225 else
224 cmd = "cat #{RSPNAME.to_path} | xargs #{DMD}" 226 cmd = "cat #{RSPNAME.to_path} | xargs #{DMD}"
225 end 227 end
227 if !ok then 229 if !ok then
228 raise "compile error" 230 raise "compile error"
229 end 231 end
230 end 232 end
231 end 233 end
232 234 if isWindows
233 end 235 FileUtils.rm File.join(srcdir_abs,appname+MAPEXT), :force => true
234 236 end
237
238 end
235 ########################################################################## 239 ##########################################################################
236 # Targets 240 # Targets
237 # 241 #
238 desc "Clean" 242 desc "Clean"
239 task :clean do 243 task :clean do
276 end 280 end
277 281
278 desc "Build JFace.Text" 282 desc "Build JFace.Text"
279 task :jfacetext do 283 task :jfacetext do
280 buildTree( "org.eclipse.text", "src", "res" ) 284 buildTree( "org.eclipse.text", "src", "res" )
281 buildTree( "org.eclipse.jface.text", "projection", "res", "-Isrc", "org.eclipse.jface.text.projection" ) 285 buildTree( "org.eclipse.jface.text", "projection", "res", "-I../src", "org.eclipse.jface.text.projection" )
282 buildTree( "org.eclipse.jface.text", "src", "res" ) 286 buildTree( "org.eclipse.jface.text", "src", "res" )
283 end 287 end
284 288
285 desc "Build UI Forms" 289 desc "Build UI Forms"
286 task :uiforms do 290 task :uiforms do
308 snps_opengl = [ "Snippet174", "Snippet195" ] 312 snps_opengl = [ "Snippet174", "Snippet195" ]
309 313
310 snps_exclude = snps_browser + snps_opengl 314 snps_exclude = snps_browser + snps_opengl
311 allsnippets = FileList[ File.join("org.eclipse.swt.snippets", "src", "**/Snippet*.d" )] 315 allsnippets = FileList[ File.join("org.eclipse.swt.snippets", "src", "**/Snippet*.d" )]
312 if args.explicit_snp != nil 316 if args.explicit_snp != nil
313 puts "Building #{args.explicit_snp}" 317 snpname = args.explicit_snp
314 buildApp( "org.eclipse.swt.snippets", "src", "res", "", args.explicit_snp, nil, libnames ) 318 puts "Building swtsnippets[#{snpname}]"
319 buildApp( "org.eclipse.swt.snippets", "src", "res", "", snpname, nil, libnames )
315 else 320 else
316 allsnippets.each do | snp | 321 allsnippets.each do | snp |
317 puts "Building #{snp}"
318 if snp =~ /.*(Snippet\w+)\.d$/ 322 if snp =~ /.*(Snippet\w+)\.d$/
319 snpname = $1 323 snpname = $1
324 puts "Building swtsnippets[#{snpname}]"
320 if !snps_exclude.include? snpname 325 if !snps_exclude.include? snpname
321 buildApp( "org.eclipse.swt.snippets", "src", "res", "", snpname, nil, libnames ) 326 buildApp( "org.eclipse.swt.snippets", "src", "res", "", snpname, nil, libnames )
322 end 327 end
323 else 328 else
324 puts snp 329 raise "Name does not match #{snp}"
325 raise "Name does not match"
326 end 330 end
327 end 331 end
328 end 332 end
329 end 333 end
330 334
333 337
334 libnames = LIBNAMES_BASIC + LIBNAMES_SWT + LIBNAMES_EQUINOX + LIBNAMES_CORE + LIBNAMES_JFACE 338 libnames = LIBNAMES_BASIC + LIBNAMES_SWT + LIBNAMES_EQUINOX + LIBNAMES_CORE + LIBNAMES_JFACE
335 snps_exclude = [] 339 snps_exclude = []
336 allsnippets = FileList[ File.join("org.eclipse.jface.snippets", "EclipseJfaceSnippets", "**/*.d" )] 340 allsnippets = FileList[ File.join("org.eclipse.jface.snippets", "EclipseJfaceSnippets", "**/*.d" )]
337 if args.explicit_snp != nil 341 if args.explicit_snp != nil
338 puts "Building #{args.explicit_snp}" 342 snpname = args.explicit_snp
343 puts "Building jfacesnippets[#{snpname}]"
339 buildApp( "org.eclipse.jface.snippets", "src", "res", "", args.explicit_snp, nil, libnames ) 344 buildApp( "org.eclipse.jface.snippets", "src", "res", "", args.explicit_snp, nil, libnames )
340 else 345 else
341 allsnippets.each do | snp | 346 allsnippets.each do | snp |
342 if snp =~ /.*[\\\/](\w+)\.d$/ 347 if snp =~ /.*[\\\/](\w+)\.d$/
343 snpname = $1 348 snpname = $1
344 puts "Building #{snpname}" 349 puts "Building jfacesnippets[#{snpname}]"
345 if !snps_exclude.include? snpname 350 if !snps_exclude.include? snpname
346 buildApp( "org.eclipse.jface.snippets", "src", "res", "", snpname, nil, libnames ) 351 buildApp( "org.eclipse.jface.snippets", "src", "res", "", snpname, nil, libnames )
347 end 352 end
348 else 353 else
349 puts snp 354 puts snp
350 raise "Name does not match" 355 raise "Name does not match #{snp}"
351 end 356 end
352 end 357 end
353 end 358 end
354 end 359 end
355 360