Mercurial > projects > dwt2
comparison rakefile @ 57:e2ca9bdc80f2
[samples] build now also on D1 linux
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 28 Mar 2009 01:28:11 +0100 |
parents | 65761bc28ab2 |
children | 7e0547d89731 |
comparison
equal
deleted
inserted
replaced
56:b65696de7e3a | 57:e2ca9bdc80f2 |
---|---|
22 end | 22 end |
23 | 23 |
24 ########################################################################## | 24 ########################################################################## |
25 # Constants | 25 # Constants |
26 # | 26 # |
27 DIR_OBJ = File.expand_path("obj") | 27 DIR_OBJ = File.expand_path("obj") |
28 DIR_IMP = File.expand_path("imp") | 28 DIR_IMP = File.expand_path("imp") |
29 DIR_LIB = File.expand_path("lib") | 29 DIR_LIB = File.expand_path("lib") |
30 BINDIR = File.expand_path("bin") | 30 BINDIR = File.expand_path("bin") |
31 FILE_RSP = File.expand_path("rsp") | 31 FILE_RSP = File.expand_path("rsp") |
32 ALL_RESDIRS = [ "base/res", "res" ] | 32 ALL_RESDIRS = [ "base/res", "res" ] |
33 | 33 |
34 LOG_STDOUT = File.expand_path("olog.txt") | 34 LOG_STDOUT = File.expand_path("olog.txt") |
35 LOG_STDERR = File.expand_path("elog.txt") | 35 LOG_STDERR = File.expand_path("elog.txt") |
36 | 36 |
58 "shell32", "ole32", "oleaut32", "olepro32", "oleacc", | 58 "shell32", "ole32", "oleaut32", "olepro32", "oleacc", |
59 "user32", "usp10", "msimg32", "opengl32", "shlwapi", | 59 "user32", "usp10", "msimg32", "opengl32", "shlwapi", |
60 "zlib", "dwt-base" ] | 60 "zlib", "dwt-base" ] |
61 | 61 |
62 else | 62 else |
63 LIBNAMES_BASIC = [ "gtk-x11-2.0", "gdk-x11-2.0", "atk-1.0", "gdk_pixbuf-2.0", | 63 SONAMES_BASIC = [ "gtk-x11-2.0", "gdk-x11-2.0", "atk-1.0", "gdk_pixbuf-2.0", |
64 "gthread-2.0", "pangocairo-1.0", "fontconfig", "Xtst", | 64 "gthread-2.0", "pangocairo-1.0", "fontconfig", "Xtst", |
65 "Xext", "Xrender", "Xinerama", "Xi", "Xrandr", "Xcursor", | 65 "Xext", "Xrender", "Xinerama", "Xi", "Xrandr", "Xcursor", |
66 "Xcomposite", "Xdamage", "X11", "Xfixes", "pango-1.0", | 66 "Xcomposite", "Xdamage", "X11", "Xfixes", "pango-1.0", |
67 "gobject-2.0", "gmodule-2.0", "dl", "glib-2.0", "cairo", | 67 "gobject-2.0", "gmodule-2.0", "dl", "glib-2.0", "cairo", |
68 "dwt-base" ] | 68 "gnomeui-2" ] |
69 LIBNAMES_BASIC = [ "dwt-base" ] | |
69 | 70 |
70 end | 71 end |
71 LIBNAMES_SWT = [ BASEDIR_SWT ] | 72 LIBNAMES_SWT = [ BASEDIR_SWT ] |
72 LIBNAMES_EQUINOX = [ "org.eclipse.osgi", | 73 LIBNAMES_EQUINOX = [ "org.eclipse.osgi", |
73 "org.eclipse.osgi.supplement", | 74 "org.eclipse.osgi.supplement", |
169 FileUtils.mkdir_p DIR_LIB.to_path | 170 FileUtils.mkdir_p DIR_LIB.to_path |
170 rsp = File.new( FILE_RSP, "w+" ) | 171 rsp = File.new( FILE_RSP, "w+" ) |
171 if isWindows | 172 if isWindows |
172 rsp.puts "-p512" | 173 rsp.puts "-p512" |
173 rsp.puts "-n" | 174 rsp.puts "-n" |
174 rsp.puts "-c #{DIR_LIB}/#{name}#{LIBEXT}" | 175 rsp.puts "-c #{DIR_LIB}\\#{name}#{LIBEXT}" |
175 libobjs.each do |obj| | 176 libobjs.each do |obj| |
176 rsp.puts obj.to_path | 177 rsp.puts obj.to_path |
177 end | 178 end |
178 else | 179 else |
179 rsp.puts "-r" | 180 rsp.puts "-r" |
191 end | 192 end |
192 FileUtils.rm libobjs | 193 FileUtils.rm libobjs |
193 | 194 |
194 end | 195 end |
195 | 196 |
196 def buildApp( basedir, srcdir, resdir, dflags, appname, filelist, libnames ) | 197 def buildApp( basedir, srcdir, resdir, dflags, appnameprefix, appname, filelist, libnames ) |
197 if filelist == nil | 198 if filelist == nil |
198 filelist = FileList[ "**/#{appname}.d" ] | 199 filelist = FileList[ "**/#{appname}.d" ] |
199 end | 200 end |
200 | 201 |
201 srcdir_abs = File.expand_path( File.join( basedir, srcdir)) | 202 srcdir_abs = File.expand_path( File.join( basedir, srcdir)) |
210 end | 211 end |
211 ALL_RESDIRS.each do | dir | | 212 ALL_RESDIRS.each do | dir | |
212 rsp.puts "-J#{File.expand_path(dir).to_path}" | 213 rsp.puts "-J#{File.expand_path(dir).to_path}" |
213 end | 214 end |
214 | 215 |
215 rsp.puts "-L/NOM" | |
216 libnames.each do | libname | | |
217 rsp.puts "-L+#{libname}#{LIBEXT}" | |
218 end | |
219 rsp.puts "-L+dwt-base.lib" | |
220 rsp.puts "-L+#{BASEDIR_SWT}.lib" | |
221 rsp.puts "-L+#{DIR_LIB.to_path}\\" | |
222 | |
223 rsp.puts "-op" | 216 rsp.puts "-op" |
224 rsp.puts "-od#{DIR_OBJ.to_path}" | 217 rsp.puts "-od#{DIR_OBJ.to_path}" |
225 applfile = File.join(BINDIR,appname+EXEEXT) | 218 applfile = File.join(BINDIR,appnameprefix+appname+EXEEXT) |
226 rsp.puts "-of#{applfile.to_path}" | 219 rsp.puts "-of#{applfile.to_path}" |
227 filelist.each do |path| | 220 filelist.each do |path| |
228 rsp.puts File.expand_path(path).to_path[ srcdir_abs.size+1 .. -1 ] | 221 rsp.puts File.expand_path(path).to_path[ srcdir_abs.size+1 .. -1 ] |
229 end | 222 end |
223 | |
224 if isWindows | |
225 rsp.puts "-L/NOM" | |
226 libnames.each do | libname | | |
227 rsp.puts "-L+#{libname}#{LIBEXT}" | |
228 end | |
229 rsp.puts "-L+dwt-base.lib" | |
230 rsp.puts "-L+#{BASEDIR_SWT}.lib" | |
231 rsp.puts "-L+#{DIR_LIB.to_path}\\" | |
232 else | |
233 rsp.puts "-L-L#{DIR_LIB.to_path}" | |
234 libnames.reverse.each do | libname | | |
235 absname = File.join( DIR_LIB, "#{libname}#{LIBEXT}" ); | |
236 rsp.puts absname | |
237 end | |
238 SONAMES_BASIC.reverse.each do | soname | | |
239 rsp.puts "-L-l#{soname}" | |
240 end | |
241 end | |
242 | |
230 rsp.close | 243 rsp.close |
231 | 244 |
232 Dir.chdir(srcdir_abs) do | 245 Dir.chdir(srcdir_abs) do |
233 if isWindows | 246 if isWindows |
234 cmd = "#{PROG_DMD} @#{FILE_RSP.to_path}" | 247 cmd = "#{PROG_DMD} @#{FILE_RSP.to_path}" |
318 task :swtsnippets, :explicit_snp do | t, args | | 331 task :swtsnippets, :explicit_snp do | t, args | |
319 | 332 |
320 libnames = LIBNAMES_BASIC + LIBNAMES_SWT | 333 libnames = LIBNAMES_BASIC + LIBNAMES_SWT |
321 snps_browser = [ "Snippet128", "Snippet136" ] | 334 snps_browser = [ "Snippet128", "Snippet136" ] |
322 snps_opengl = [ "Snippet174", "Snippet195" ] | 335 snps_opengl = [ "Snippet174", "Snippet195" ] |
323 | 336 snps_ole = [ "Snippet81" ] |
324 snps_exclude = snps_browser + snps_opengl | 337 |
338 if isWindows | |
339 snps_exclude = snps_browser + snps_opengl + snps_ole | |
340 else | |
341 snps_exclude = snps_browser + snps_opengl + snps_ole | |
342 end | |
343 | |
344 PREFIX = "Swt" | |
325 allsnippets = FileList[ File.join("org.eclipse.swt.snippets", "src", "**/Snippet*.d" )] | 345 allsnippets = FileList[ File.join("org.eclipse.swt.snippets", "src", "**/Snippet*.d" )] |
326 if args.explicit_snp != nil | 346 if args.explicit_snp != nil |
327 snpname = args.explicit_snp | 347 snpname = args.explicit_snp |
328 puts "Building swtsnippets[#{snpname}]" | 348 puts "Building swtsnippets[#{snpname}]" |
329 buildApp( "org.eclipse.swt.snippets", "src", "res", "", snpname, nil, libnames ) | 349 buildApp( "org.eclipse.swt.snippets", "src", "res", "", PREFIX, snpname, nil, libnames ) |
330 else | 350 else |
331 allsnippets.each do | snp | | 351 allsnippets.each do | snp | |
332 if snp =~ /.*(Snippet\w+)\.d$/ | 352 if snp =~ /.*(Snippet\w+)\.d$/ |
333 snpname = $1 | 353 snpname = $1 |
334 puts "Building swtsnippets[#{snpname}]" | 354 puts "Building swtsnippets[#{snpname}]" |
335 if !snps_exclude.include? snpname | 355 if !snps_exclude.include? snpname |
336 buildApp( "org.eclipse.swt.snippets", "src", "res", "", snpname, nil, libnames ) | 356 buildApp( "org.eclipse.swt.snippets", "src", "res", "", PREFIX, snpname, nil, libnames ) |
337 end | 357 end |
338 else | 358 else |
339 raise "Name does not match #{snp}" | 359 raise "Name does not match #{snp}" |
340 end | 360 end |
341 end | 361 end |
343 end | 363 end |
344 | 364 |
345 desc "Build JFace Snippet Collection" | 365 desc "Build JFace Snippet Collection" |
346 task :jfacesnippets, :explicit_snp do | t, args | | 366 task :jfacesnippets, :explicit_snp do | t, args | |
347 | 367 |
368 PREFIX = "JFace" | |
369 SRCPATH = "EclipseJfaceSnippets" | |
370 BASEPATH = "org.eclipse.jface.snippets" | |
348 libnames = LIBNAMES_BASIC + LIBNAMES_SWT + LIBNAMES_EQUINOX + LIBNAMES_CORE + LIBNAMES_JFACE | 371 libnames = LIBNAMES_BASIC + LIBNAMES_SWT + LIBNAMES_EQUINOX + LIBNAMES_CORE + LIBNAMES_JFACE |
349 snps_exclude = [] | 372 snps_exclude = [] |
350 allsnippets = FileList[ File.join("org.eclipse.jface.snippets", "EclipseJfaceSnippets", "**/*.d" )] | 373 allsnippets = FileList[ File.join(BASEPATH, SRCPATH, "**/*.d" )] |
351 if args.explicit_snp != nil | 374 if args.explicit_snp != nil |
352 snpname = args.explicit_snp | 375 snpname = args.explicit_snp |
353 puts "Building jfacesnippets[#{snpname}]" | 376 puts "Building jfacesnippets[#{snpname}]" |
354 buildApp( "org.eclipse.jface.snippets", "src", "res", "", args.explicit_snp, nil, libnames ) | 377 buildApp( BASEPATH, SRCPATH, "res", "", PREFIX, args.explicit_snp, nil, libnames ) |
355 else | 378 else |
356 allsnippets.each do | snp | | 379 allsnippets.each do | snp | |
357 if snp =~ /.*[\\\/](\w+)\.d$/ | 380 if snp =~ /.*[\\\/](\w+)\.d$/ |
358 snpname = $1 | 381 snpname = $1 |
359 puts "Building jfacesnippets[#{snpname}]" | 382 puts "Building jfacesnippets[#{snpname}]" |
360 if !snps_exclude.include? snpname | 383 if !snps_exclude.include? snpname |
361 buildApp( "org.eclipse.jface.snippets", "src", "res", "", snpname, nil, libnames ) | 384 buildApp( BASEPATH, SRCPATH, "res", "", PREFIX, snpname, nil, libnames ) |
362 end | 385 end |
363 else | 386 else |
364 puts snp | 387 puts snp |
365 raise "Name does not match #{snp}" | 388 raise "Name does not match #{snp}" |
366 end | 389 end |