Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 448 lines (373 sloc) 12.791 kB
7e5aed5 @jacius - Rakefile:
jacius authored
1 require 'rubygems'
2 Gem::manage_gems
3
4 require 'rake'
5 require 'rake/gempackagetask'
6 require 'rake/rdoctask'
7
828cb08 @jacius Merge changes from newbuild branch -r186:194 into trunk.
jacius authored
8 require "rbconfig"
9 include Config
9d2e5d4 @jacius Check ENV for CFLAGS, etc. in addition to CONFIG (helps win32 compile).
jacius authored
10
83288e9 @jacius Rakefile will complain loudly and exit with error if compile fails.
jacius authored
11 require 'English'
12
13 class ShellCommandError < RuntimeError
14 end
15
16 # Execute the block (which is supposed to perform a shell command),
17 # then raise ShellCommandError if the command failed.
18 def try_shell( &block )
19 result = yield
20
21 unless $CHILD_STATUS.exitstatus == 0
22 raise ShellCommandError, "Command failed. Aborting."
23 end
24
25 return result
26 end
27
28 def try_sdl_config( flag )
29 begin
30 if $options[:"sdl-config"]
31 return try_shell { `sdl-config #{flag}`.chomp }
32 else
33 return String.new
34 end
35 rescue ShellCommandError
36 warn "WARNING: 'sdl-config' failed."
37 warn "Continuing anyway, but compile may fail."
38 return String.new
39 end
40 end
41
9d2e5d4 @jacius Check ENV for CFLAGS, etc. in addition to CONFIG (helps win32 compile).
jacius authored
42 # Get a variable from ENV or CONFIG, with ENV having precedence.
43 # Returns "" if the variable didn't exist at all.
44 def from_env_or_config(string)
45 ([ENV[string], CONFIG[string]] - ["", nil])[0] or ""
46 end
47
48 OBJEXT = from_env_or_config("OBJEXT")
49 DLEXT = from_env_or_config("DLEXT")
828cb08 @jacius Merge changes from newbuild branch -r186:194 into trunk.
jacius authored
50
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
51 RUBYGAME_VERSION = [2,3,0]
d8085c2 @jacius Remove constants.o dependency, add rubygem compatibility code, RDoc t…
jacius authored
52
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
53 gem_spec = Gem::Specification.new do |s|
bc12ecf @jacius - Rakefile:
jacius authored
54 s.name = "rubygame"
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
55 s.version = RUBYGAME_VERSION.join(".")
bc12ecf @jacius - Rakefile:
jacius authored
56 s.author = "John Croisant"
828cb08 @jacius Merge changes from newbuild branch -r186:194 into trunk.
jacius authored
57 s.email = "jacius@users.sourceforge.net"
58 s.homepage = "http://rubygame.sourceforge.net/"
59 s.summary = "Clean and powerful library for game programming"
bc12ecf @jacius - Rakefile:
jacius authored
60 s.has_rdoc = true
61
30f5eaf @jacius Improved how Rakefile finds files to package and/or rdoc.
jacius authored
62 s.files = FileList.new do |fl|
63 fl.include("{lib,ext,samples,doc}/**/*")
64 fl.exclude(/svn/)
9732581 @jacius Copied releases/2.2.0 to branches/2.3.0.
jacius authored
65 #fl.exclude(/\.#{OBJEXT}/)
bc12ecf @jacius - Rakefile:
jacius authored
66 end
67
d8085c2 @jacius Remove constants.o dependency, add rubygem compatibility code, RDoc t…
jacius authored
68 s.require_paths = ["lib", "lib/rubygame/", "ext/rubygame/"]
bc12ecf @jacius - Rakefile:
jacius authored
69 s.autorequire = "rubygame.rb"
d8085c2 @jacius Remove constants.o dependency, add rubygem compatibility code, RDoc t…
jacius authored
70 s.extensions = ["Rakefile"]
bc12ecf @jacius - Rakefile:
jacius authored
71
30f5eaf @jacius Improved how Rakefile finds files to package and/or rdoc.
jacius authored
72 s.extra_rdoc_files = FileList.new do |fl|
73 fl.include "doc/*.rdoc"
f96a42f @jacius Renamed Changelog -> NEWS, TODO -> ROADMAP.
jacius authored
74 fl.include "README", "LICENSE", "CREDITS", "ROADMAP", "NEWS"
30f5eaf @jacius Improved how Rakefile finds files to package and/or rdoc.
jacius authored
75 end
53a7221 @jacius Merged changes in branches/prerelease-2.0.1 (r376:414, excepting r409…
jacius authored
76 end
77
78 task :linux do
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
79 gem_spec.platform = Gem::Platform::LINUX_586
53a7221 @jacius Merged changes in branches/prerelease-2.0.1 (r376:414, excepting r409…
jacius authored
80 end
81
82 task :macosx do
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
83 gem_spec.platform = Gem::Platform::DARWIN
53a7221 @jacius Merged changes in branches/prerelease-2.0.1 (r376:414, excepting r409…
jacius authored
84 end
85
86 task :win32 do
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
87 gem_spec.platform = Gem::Platform::WIN32
7e5aed5 @jacius - Rakefile:
jacius authored
88 end
89
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
90 Rake::GemPackageTask.new(gem_spec) do |pkg|
7e5aed5 @jacius - Rakefile:
jacius authored
91 pkg.need_tar_bz2 = true
92 end
93
94 Rake::RDocTask.new do |rd|
098089d @jacius Tweak RDoc settings
jacius authored
95 rd.main = "README"
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
96 rd.title = "Rubygame #{RUBYGAME_VERSION.join(".")} Docs"
99e041e @jacius Give better info/feedback to the user
jacius authored
97 rd.rdoc_files.include("ext/rubygame/*.c",
30f5eaf @jacius Improved how Rakefile finds files to package and/or rdoc.
jacius authored
98 "lib/rubygame/**/*.rb",
99e041e @jacius Give better info/feedback to the user
jacius authored
99 "doc/*.rdoc",
53a7221 @jacius Merged changes in branches/prerelease-2.0.1 (r376:414, excepting r409…
jacius authored
100 "README",
101 "LICENSE",
102 "CREDITS",
f96a42f @jacius Renamed Changelog -> NEWS, TODO -> ROADMAP.
jacius authored
103 "ROADMAP",
104 "NEWS")
7e5aed5 @jacius - Rakefile:
jacius authored
105 end
106
828cb08 @jacius Merge changes from newbuild branch -r186:194 into trunk.
jacius authored
107 task :default => [:build]
99e041e @jacius Give better info/feedback to the user
jacius authored
108 desc "Compile all of the extensions"
828cb08 @jacius Merge changes from newbuild branch -r186:194 into trunk.
jacius authored
109 task :build
110
111 require 'rake/clean'
99e041e @jacius Give better info/feedback to the user
jacius authored
112 task(:clean) { puts "Cleaning out temporary generated files" }
113 task(:clobber) { puts "Cleaning out final generated files" }
114
1c902e0 @jacius Replacing Rakefile option handling (2 of 2)
jacius authored
115 ##############################
116 ## BUILD OPTIONS ##
117 ##############################
118
119 $options = {
6e37567 @jacius Changed sdl_config to sdl-config.
jacius authored
120 :"sdl-gfx" => true,
121 :"sdl-image" => true,
122 :"sdl-ttf" => true,
123 :"sdl-mixer" => true,
124 :opengl => true,
125 :"sdl-config" => true,
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
126 :universal => false,
6e37567 @jacius Changed sdl_config to sdl-config.
jacius authored
127 :debug => false,
128 :verbose => false,
129 :sitearchdir => CONFIG["sitearchdir"],
130 :sitelibdir => CONFIG["sitelibdir"]
1c902e0 @jacius Replacing Rakefile option handling (2 of 2)
jacius authored
131 }
132
133 # Default behavior for win32 is to skip sdl_config,
134 # since it's usually not available. It can still be
135 # enabled through the options, though.
136 if PLATFORM =~ /win32/
6e37567 @jacius Changed sdl_config to sdl-config.
jacius authored
137 $options[:"sdl-config"] = false
1c902e0 @jacius Replacing Rakefile option handling (2 of 2)
jacius authored
138 end
139
140 # Define tasks to enable and disable bool options.
141 #
142 # rake option
143 # rake no-option
144 #
145 # task_name:: the task name to use
146 # option_name:: the option name (if different from
147 # the task name)
148 # desc:: a longer description, to fill
149 # "Enable ________.", if different
150 # from the task name.
151 #
152 def bool_option( task_name, option_name=nil, desc=nil )
153 option_name = task_name unless option_name
7d4f756 @jacius Fix string_option using rake's envvar capabilities.
jacius authored
154 option_name = option_name.intern if option_name.kind_of? String
155
156 desc = task_name.to_s unless desc
157
1c902e0 @jacius Replacing Rakefile option handling (2 of 2)
jacius authored
158 notask_name = "no-#{task_name.to_s}".intern
159
160 is_true = $options[option_name]
161
162 desc "Enable #{desc} #{'(default)' if is_true}"
163 task(task_name) { $options[option_name] = true }
164
165 desc "Disable #{desc} #{'(default)' unless is_true}"
166 task(notask_name) { $options[option_name] = false }
167 end
168
7d4f756 @jacius Fix string_option using rake's envvar capabilities.
jacius authored
169 # Gather a string option from an environment variable:
1c902e0 @jacius Replacing Rakefile option handling (2 of 2)
jacius authored
170 #
171 # rake option="the value of the option"
172 #
173 # task_name:: the task name to use
174 # option_name:: the option name (if different from
175 # the task name)
176 #
177 def string_option( task_name, option_name=nil )
7d4f756 @jacius Fix string_option using rake's envvar capabilities.
jacius authored
178 option_name = task_name unless option_name
179 option_name = option_name.intern if option_name.kind_of? String
1c902e0 @jacius Replacing Rakefile option handling (2 of 2)
jacius authored
180
544360f @jacius Only overwrite options from envvar if the envvar is defined.
jacius authored
181 $options[option_name] = ENV["#{task_name}"] if ENV["#{task_name}"]
1c902e0 @jacius Replacing Rakefile option handling (2 of 2)
jacius authored
182 end
183
6e37567 @jacius Changed sdl_config to sdl-config.
jacius authored
184 bool_option :"sdl-gfx", nil, "SDL_gfx support"
185 bool_option :"sdl-image", nil, "SDL_image support"
186 bool_option :"sdl-mixer", nil, "SDL_mixer support"
187 bool_option :"sdl-ttf", nil, "SDL_ttf support"
188 bool_option :"sdl-config", nil, "guess compiler flags for SDL"
189 bool_option :opengl, nil, "OpenGL support"
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
190 bool_option :debug, nil, "compile with debug symbols"
6e37567 @jacius Changed sdl_config to sdl-config.
jacius authored
191 bool_option :verbose, nil, "show compiler commands"
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
192 bool_option :universal, nil, "compile universal binary (MacOS X Intel)"
1c902e0 @jacius Replacing Rakefile option handling (2 of 2)
jacius authored
193
7d4f756 @jacius Fix string_option using rake's envvar capabilities.
jacius authored
194 string_option "RUBYARCHDIR", :sitearchdir
1c902e0 @jacius Replacing Rakefile option handling (2 of 2)
jacius authored
195 string_option :sitearchdir
196
7d4f756 @jacius Fix string_option using rake's envvar capabilities.
jacius authored
197 string_option "RUBYLIBDIR", :sitelibdir
1c902e0 @jacius Replacing Rakefile option handling (2 of 2)
jacius authored
198 string_option :sitelibdir
199
200
9d2e5d4 @jacius Check ENV for CFLAGS, etc. in addition to CONFIG (helps win32 compile).
jacius authored
201 CFLAGS = [from_env_or_config("CFLAGS"),
53a7221 @jacius Merged changes in branches/prerelease-2.0.1 (r376:414, excepting r409…
jacius authored
202 try_sdl_config("--cflags"),
98169f9 @smashwilson Use options.sdl_config properly, make 'rubygame' subdirectory
smashwilson authored
203 "-I. -I#{CONFIG['topdir']}",
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
204 ("-g" if $options[:debug]),
205 "-DRUBYGAME_MAJOR_VERSION=#{RUBYGAME_VERSION[0]}",
206 "-DRUBYGAME_MINOR_VERSION=#{RUBYGAME_VERSION[1]}",
207 "-DRUBYGAME_PATCHLEVEL=#{RUBYGAME_VERSION[2]}"
208 ].join(" ")
7e5aed5 @jacius - Rakefile:
jacius authored
209
9d2e5d4 @jacius Check ENV for CFLAGS, etc. in addition to CONFIG (helps win32 compile).
jacius authored
210 LINK_FLAGS = [from_env_or_config("LIBRUBYARG_SHARED"),
0bb2a6b @jacius Removed --cflags and --lflags config options; use CFLAGS and LDFLAGS …
jacius authored
211 from_env_or_config("LDFLAGS"),
53a7221 @jacius Merged changes in branches/prerelease-2.0.1 (r376:414, excepting r409…
jacius authored
212 try_sdl_config("--libs")].join(" ")
7e5aed5 @jacius - Rakefile:
jacius authored
213
993f5a4 @jacius Minor typo in Rakefile.
jacius authored
214 DEFAULT_EXTDIR = File.join('ext','rubygame','')
65169e5 @jacius More flexible system; extensions don't link to unneeded libs now
jacius authored
215
216 class ExtensionModule
217 @@libflag = " -l%s " # compiler flag for giving linked libraries
e367b5f @jacius Modularize build directories (don't assume ext/rubygame/).
jacius authored
218 attr_accessor :dynlib, :objs, :libs, :cflags, :lflags, :directory
65169e5 @jacius More flexible system; extensions don't link to unneeded libs now
jacius authored
219 def initialize(&block)
993f5a4 @jacius Minor typo in Rakefile.
jacius authored
220 @directory = DEFAULT_EXTDIR
65169e5 @jacius More flexible system; extensions don't link to unneeded libs now
jacius authored
221 @dynlib = ""
222 @objs = []
223 @libs = []
224 @lflags = ""
225 yield self if block_given?
226 end
227
228 def add_lib( lib )
229 @lflags << @@libflag%lib
230 end
231
232 def add_header( header )
233 #CFLAGS << " -DHAVE_#{header.upcase.gsub('.','_')} "
234 end
235
e367b5f @jacius Modularize build directories (don't assume ext/rubygame/).
jacius authored
236 def create_all_tasks()
237 create_obj_task
238 create_dl_task
239 CLEAN.include("#{@directory}/*.#{OBJEXT}")
240 CLOBBER.include("#{@directory}/*.#{DLEXT}")
241 end
242
65169e5 @jacius More flexible system; extensions don't link to unneeded libs now
jacius authored
243 # Create a file task for each dynamic library (.so) we want to generate.
53a7221 @jacius Merged changes in branches/prerelease-2.0.1 (r376:414, excepting r409…
jacius authored
244 #
245 # The file task invokes another task which does the actual compiling, and
246 # has the true prerequisites.
247 #
248 # This is done so that the prerequisites don't have to be compiled when
249 # the final product already exists (such as in the precompiled win32 gem).
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
250 #
65169e5 @jacius More flexible system; extensions don't link to unneeded libs now
jacius authored
251 def create_dl_task
53a7221 @jacius Merged changes in branches/prerelease-2.0.1 (r376:414, excepting r409…
jacius authored
252 dynlib_full = File.join( @directory, "#{dynlib}.#{DLEXT}" )
253 objs_full = @objs.collect { |obj|
254 File.join( @directory, "#{obj}.#{OBJEXT}" )
255 }
256
257 desc "Compile the #{@dynlib} extension"
2376300 @jacius Fix dependency checking in Rakefile
jacius authored
258 file dynlib_full => objs_full do |task|
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
259
53a7221 @jacius Merged changes in branches/prerelease-2.0.1 (r376:414, excepting r409…
jacius authored
260 link_command = "#{from_env_or_config('LDSHARED')} #{LINK_FLAGS} #{@lflags} -o #{dynlib_full} #{task.prerequisites.join(' ')}"
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
261
262
263 # If link command includes i386 arch, and we're not allowing universal
264 if( /-arch i386/ === link_command and not $options[:universal] )
265 # Strip "-arch ppc" to prevent building a universal binary.
266 link_command.gsub!("-arch ppc","")
267 end
268
9f70ce0 @jacius Cleaning up after replacing options system.
jacius authored
269 if( $options[:verbose] )
83288e9 @jacius Rakefile will complain loudly and exit with error if compile fails.
jacius authored
270 try_shell { sh link_command }
65169e5 @jacius More flexible system; extensions don't link to unneeded libs now
jacius authored
271 else
53a7221 @jacius Merged changes in branches/prerelease-2.0.1 (r376:414, excepting r409…
jacius authored
272 puts "Linking compiled files to create #{File.basename(@directory)}/#{File.basename(dynlib_full)}"
83288e9 @jacius Rakefile will complain loudly and exit with error if compile fails.
jacius authored
273 try_shell { `#{link_command}` }
65169e5 @jacius More flexible system; extensions don't link to unneeded libs now
jacius authored
274 end
275 end
53a7221 @jacius Merged changes in branches/prerelease-2.0.1 (r376:414, excepting r409…
jacius authored
276
277 task :build => [dynlib_full] # Add this as a prereq of the build
65169e5 @jacius More flexible system; extensions don't link to unneeded libs now
jacius authored
278 task :install_ext => [dynlib_full] # ...and install_ext tasks
279 end
e367b5f @jacius Modularize build directories (don't assume ext/rubygame/).
jacius authored
280
281 def create_obj_task
282 # A rule for object files (".o" on linux).
283 # This won't work for rake < 0.7.2, because the proc returns an Array.
284 # If it raises an exception, we'll try a more compatible way.
285 rule(/#{@directory}.+\.#{OBJEXT}$/ =>
286 [
287 # Generate dependencies for this .o file
288 proc do |objfile|
289 source = objfile.sub(".#{OBJEXT}", ".c") # the .c file
290 [source] + depends_headers( source ) # Array of .c + .h dependencies
291 end
292 ])\
293 do |t|
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
294
e367b5f @jacius Modularize build directories (don't assume ext/rubygame/).
jacius authored
295 compile_command = "#{from_env_or_config('CC')} -c #{CFLAGS} #{t.source} -o #{t.name}"
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
296
297 # If compile command includes i386 arch, and we're not allowing universal
298 if( /-arch i386/ === compile_command and not $options[:universal] )
299 # Strip "-arch ppc" to prevent building a universal binary.
300 compile_command.gsub!("-arch ppc","")
301 end
302
9f70ce0 @jacius Cleaning up after replacing options system.
jacius authored
303 if( $options[:verbose] )
83288e9 @jacius Rakefile will complain loudly and exit with error if compile fails.
jacius authored
304 try_shell { sh compile_command }
e367b5f @jacius Modularize build directories (don't assume ext/rubygame/).
jacius authored
305 else
306 puts "Compiling #{File.basename(@directory)}/#{File.basename(t.source)}"
83288e9 @jacius Rakefile will complain loudly and exit with error if compile fails.
jacius authored
307 try_shell { `#{compile_command}` }
e367b5f @jacius Modularize build directories (don't assume ext/rubygame/).
jacius authored
308 end
309 end
310 rescue
311 # Generate a .o rule for each .c file in the directory.
312 FileList.new("#{@directory}*.c").each do |source|
313 object = source.sub(".c", ".#{OBJEXT}")
314 file object => ([source] + depends_headers( source )) do |t|
315 compile_command = "#{CONFIG['CC']} -c #{CFLAGS} #{source} -o #{t.name}"
9f70ce0 @jacius Cleaning up after replacing options system.
jacius authored
316 if( $options[:verbose] )
83288e9 @jacius Rakefile will complain loudly and exit with error if compile fails.
jacius authored
317 try_shell { sh compile_command }
e367b5f @jacius Modularize build directories (don't assume ext/rubygame/).
jacius authored
318 else
319 puts "Compiling #{File.basename(@directory)}/#{File.basename(source)}"
83288e9 @jacius Rakefile will complain loudly and exit with error if compile fails.
jacius authored
320 try_shell { `#{compile_command}` }
e367b5f @jacius Modularize build directories (don't assume ext/rubygame/).
jacius authored
321 end
322 end
323 end
324 end
325
326 # Extracts the names of all the headers that the C file depends on.
327 def depends_headers( filename )
328 return [] # workaround for a bug
329 depends = []
330 File.open(filename, "r") do |file|
331 file.each_line do |line|
332 if /#include\s+"(\w+\.h)"/ =~ line
333 depends << @directory+$1
334 end
335 end
336 end
337 return depends
338 end
65169e5 @jacius More flexible system; extensions don't link to unneeded libs now
jacius authored
339 end
340
341 rubygame_core = ExtensionModule.new do |core|
342 core.dynlib = 'rubygame_core'
343 core.objs = ['rubygame_main',
344 'rubygame_shared',
345 'rubygame_event',
346 'rubygame_gl',
347 'rubygame_joystick',
348 'rubygame_screen',
349 'rubygame_surface',
350 'rubygame_time',
351 ]
e367b5f @jacius Modularize build directories (don't assume ext/rubygame/).
jacius authored
352 core.create_all_tasks()
7e5aed5 @jacius - Rakefile:
jacius authored
353 end
354
828cb08 @jacius Merge changes from newbuild branch -r186:194 into trunk.
jacius authored
355 # TODO: We should check if the libraries exist?
356
65169e5 @jacius More flexible system; extensions don't link to unneeded libs now
jacius authored
357 rubygame_gfx = ExtensionModule.new do |gfx|
358 gfx.dynlib = 'rubygame_gfx'
359 gfx.objs = ['rubygame_shared', 'rubygame_gfx']
360 gfx.add_lib( 'SDL_gfx' )
361 gfx.add_header( 'SDL_gfxPrimitives.h')
362 gfx.add_header( 'SDL_rotozoom.h' )
03059f5 @jacius More cleaning up.
jacius authored
363 gfx.create_all_tasks() if $options[:"sdl-gfx"]
65169e5 @jacius More flexible system; extensions don't link to unneeded libs now
jacius authored
364 end
365
366 rubygame_image = ExtensionModule.new do |image|
367 image.dynlib = 'rubygame_image'
368 image.objs = ['rubygame_shared', 'rubygame_image']
369 image.add_lib('SDL_image')
370 image.add_header('SDL_image.h')
03059f5 @jacius More cleaning up.
jacius authored
371 image.create_all_tasks() if $options[:"sdl-image"]
65169e5 @jacius More flexible system; extensions don't link to unneeded libs now
jacius authored
372 end
373
374 rubygame_mixer = ExtensionModule.new do |mixer|
375 mixer.dynlib = 'rubygame_mixer'
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
376 mixer.objs = ['rubygame_shared', 'rubygame_mixer', 'rubygame_sound', 'rubygame_music']
65169e5 @jacius More flexible system; extensions don't link to unneeded libs now
jacius authored
377 mixer.add_lib('SDL_mixer')
378 mixer.add_header('SDL_mixer.h')
03059f5 @jacius More cleaning up.
jacius authored
379 mixer.create_all_tasks() if $options[:"sdl-mixer"]
65169e5 @jacius More flexible system; extensions don't link to unneeded libs now
jacius authored
380 end
381
382 rubygame_ttf = ExtensionModule.new do |ttf|
383 ttf.dynlib = 'rubygame_ttf'
384 ttf.add_lib('SDL_ttf')
385 ttf.objs = ['rubygame_shared', 'rubygame_ttf']
386 ttf.add_header('SDL_ttf.h')
03059f5 @jacius More cleaning up.
jacius authored
387 ttf.create_all_tasks() if $options[:"sdl-ttf"]
65169e5 @jacius More flexible system; extensions don't link to unneeded libs now
jacius authored
388 end
389
9f70ce0 @jacius Cleaning up after replacing options system.
jacius authored
390 if $options[:opengl]
65169e5 @jacius More flexible system; extensions don't link to unneeded libs now
jacius authored
391 CFLAGS << " -DHAVE_OPENGL "
392 end
828cb08 @jacius Merge changes from newbuild branch -r186:194 into trunk.
jacius authored
393
53a7221 @jacius Merged changes in branches/prerelease-2.0.1 (r376:414, excepting r409…
jacius authored
394 desc "(Called when installing via Rubygems)"
395 task :extension => [:fix_filenames, :build]
396
397 task :fix_filenames do
398 unless DLEXT == 'so'
399 Rake::Task[:install_ext].prerequisites.each do |prereq|
400 prereq = prereq.ext('so')
401 if File.exist? prereq
402 mv prereq, prereq.ext(DLEXT)
403 end
404 end
405 end
406 end
407
0a04fbc @jacius Improved how the library is installed.
jacius authored
408 desc "Install just the extensions"
828cb08 @jacius Merge changes from newbuild branch -r186:194 into trunk.
jacius authored
409 task :install_ext do |task|
9f70ce0 @jacius Cleaning up after replacing options system.
jacius authored
410 puts "Installing extensions to #{$options[:sitearchdir]}"
411 mkdir_p $options[:sitearchdir]
412 cp task.prerequisites.to_a, $options[:sitearchdir]
828cb08 @jacius Merge changes from newbuild branch -r186:194 into trunk.
jacius authored
413 end
7e5aed5 @jacius - Rakefile:
jacius authored
414
0a04fbc @jacius Improved how the library is installed.
jacius authored
415 desc "Install just the library"
828cb08 @jacius Merge changes from newbuild branch -r186:194 into trunk.
jacius authored
416 task :install_lib do |task|
9f70ce0 @jacius Cleaning up after replacing options system.
jacius authored
417 puts "Installing library to #{$options[:sitelibdir]}"
ddc058c @jacius Smarter installing of library files.
jacius authored
418
419 files = FileList.new do |fl|
420 fl.include("lib/**/*.rb")
421 fl.exclude(/svn/)
422 end
423
424 files.each do |f|
425 dir = File.join($options[:sitelibdir], File.dirname(f).sub('lib',''), "")
426 mkdir_p dir
427 cp f, dir
428 end
828cb08 @jacius Merge changes from newbuild branch -r186:194 into trunk.
jacius authored
429 end
7e5aed5 @jacius - Rakefile:
jacius authored
430
99e041e @jacius Give better info/feedback to the user
jacius authored
431 desc "Install both the extensions and the library"
828cb08 @jacius Merge changes from newbuild branch -r186:194 into trunk.
jacius authored
432 task :install => [:install_ext, :install_lib]
304afe8 @jacius Copied over Rakefile from trunk (but changed version number).
jacius authored
433
434
435
436 begin
437 require 'spec/rake/spectask'
438
439 desc "Run all specs (tests)"
440 Spec::Rake::SpecTask.new do |t|
441 t.spec_files = FileList['test/*_spec.rb']
442 end
443 rescue LoadError
444 task :spec do
445 puts "ERROR: RSpec is not installed?"
446 end
447 end
Something went wrong with that request. Please try again.