mirror of
				https://github.com/rubyjs/therubyracer
				synced 2023-03-27 23:21:42 -04:00 
			
		
		
		
	set GCC_VERSION flag on scons build. convert v8 build to makefile instead of ruby script.
This commit is contained in:
		
							parent
							
								
									1024c6ebaf
								
							
						
					
					
						commit
						6c0b150046
					
				
					 5 changed files with 56 additions and 25 deletions
				
			
		
							
								
								
									
										6
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,11 +1,11 @@
 | 
			
		|||
Makefile
 | 
			
		||||
 | 
			
		||||
v8.bundle
 | 
			
		||||
*.o
 | 
			
		||||
*.log
 | 
			
		||||
*~
 | 
			
		||||
docs/cpp/html/*
 | 
			
		||||
 | 
			
		||||
ext/v8/upstream/scons/build
 | 
			
		||||
ext/v8/upstream/scons/install
 | 
			
		||||
ext/v8/upstream/build
 | 
			
		||||
 | 
			
		||||
pkg/
 | 
			
		||||
tmp/
 | 
			
		||||
							
								
								
									
										7
									
								
								Rakefile
									
										
									
									
									
								
							
							
						
						
									
										7
									
								
								Rakefile
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -16,7 +16,7 @@ begin
 | 
			
		|||
    gemspec.homepage = "http://github.com/cowboyd/therubyracer"
 | 
			
		||||
    gemspec.authors = ["Charles Lowell", "Bill Robertson"]
 | 
			
		||||
    gemspec.extra_rdoc_files = ["README.rdoc"]
 | 
			
		||||
    gemspec.files.exclude "ext/**/test/*", "ext/**/samples/*", "ext/**/benchmarks/*", "ext/**/*.o", "ext/**/*.o", "#{SCONS}/build", "#{SCONS}/install"      
 | 
			
		||||
    gemspec.files.exclude "ext/**/test/*", "ext/**/samples/*", "ext/**/benchmarks/*", "#{UPSTREAM}/build"
 | 
			
		||||
  end
 | 
			
		||||
rescue LoadError
 | 
			
		||||
  puts "Jeweler not available. Install it with: gem install jeweler"
 | 
			
		||||
| 
						 | 
				
			
			@ -42,10 +42,7 @@ task :build
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
task "clean-v8" => "clean" do
 | 
			
		||||
  sh "rm -f #{V8_SRC}/libv8.a"
 | 
			
		||||
  sh "rm -rf #{SCONS}/build"
 | 
			
		||||
  sh "rm -rf #{SCONS}/install"
 | 
			
		||||
  sh "rm -rf #{V8_SRC}/obj"
 | 
			
		||||
  sh "cd #{UPSTREAM} && make clean"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
task :clean do
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,25 +1,15 @@
 | 
			
		|||
require 'mkmf'
 | 
			
		||||
 | 
			
		||||
UPSTREAM = File.expand_path(File.dirname(__FILE__) + "/upstream")
 | 
			
		||||
BUILD = "#{UPSTREAM}/build/v8"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
puts "Compiling V8"
 | 
			
		||||
 | 
			
		||||
arch = ['foo'].pack('p').size == 8 ? 'x64' : 'ia32'
 | 
			
		||||
system("cd #{UPSTREAM} && make") or raise "Error compiling V8"
 | 
			
		||||
 | 
			
		||||
UPSTREAM_SRC = File.expand_path(File.dirname(__FILE__) + "/upstream")
 | 
			
		||||
SCONS_SRC = "#{UPSTREAM_SRC}/scons"
 | 
			
		||||
V8_SRC = "#{UPSTREAM_SRC}/2.0.6"
 | 
			
		||||
CCSC = "cd #{SCONS_SRC} && python setup.py install --prefix=#{SCONS_SRC}/install"
 | 
			
		||||
unless File.exists?("#{SCONS_SRC}/install")
 | 
			
		||||
puts CCSC
 | 
			
		||||
`#{CCSC}`
 | 
			
		||||
end
 | 
			
		||||
unless File.exists?("#{V8_SRC}/libv8.a")
 | 
			
		||||
CCV8 = "cd #{V8_SRC} && #{SCONS_SRC}/install/bin/scons arch=#{arch}"
 | 
			
		||||
puts CCV8
 | 
			
		||||
`#{CCV8}`
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
dir_config('v8', "#{V8_SRC}/include", "#{V8_SRC}")
 | 
			
		||||
have_library('v8')
 | 
			
		||||
dir_config('v8', "#{BUILD}/include", "#{BUILD}")
 | 
			
		||||
have_library('v8') or raise "Unable to find libv8 in #{BUILD}, was there an error compiling it?"
 | 
			
		||||
 | 
			
		||||
$CPPFLAGS += " -Wall" unless $CPPFLAGS.split.include? "-Wall"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										31
									
								
								ext/v8/upstream/Makefile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								ext/v8/upstream/Makefile
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,31 @@
 | 
			
		|||
 | 
			
		||||
SCONS=build/scons/install/bin/scons
 | 
			
		||||
SCONSSRC=build/scons
 | 
			
		||||
V8SRC=build/v8
 | 
			
		||||
LIBV8=build/v8/libv8.a
 | 
			
		||||
GCC_VERSION=$(shell ruby -e 'puts %x{gcc --version} =~ /(\d)\.(\d)\.\d/ ? $$1 + $$2 : "UNKNOWN"')
 | 
			
		||||
ARCH=$(shell ruby -e "puts ['foo'].pack('p').size == 8 ? 'x64' : 'ia32'")
 | 
			
		||||
 | 
			
		||||
all: $(LIBV8)
 | 
			
		||||
 | 
			
		||||
$(LIBV8): $(SCONS) $(V8SRC)
 | 
			
		||||
	cd build/v8 && GCC_VERSION=$(GCC_VERSION) ../scons/install/bin/scons arch=$(ARCH)
 | 
			
		||||
 | 
			
		||||
$(SCONS): $(SCONSSRC)
 | 
			
		||||
	mkdir -p $(SCONSSRC)/install
 | 
			
		||||
	python build/scons/setup.py install --prefix=install
 | 
			
		||||
 | 
			
		||||
$(V8SRC): build
 | 
			
		||||
	cp -r 2.0.6 build/v8
 | 
			
		||||
	patch -td build/v8 -i ../../no-strict-aliasing.patch
 | 
			
		||||
 | 
			
		||||
$(SCONSSRC): build
 | 
			
		||||
	cp -r scons build
 | 
			
		||||
 | 
			
		||||
build:
 | 
			
		||||
	mkdir -p build
 | 
			
		||||
 | 
			
		||||
scons: $(SCONS)
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	rm -rf build
 | 
			
		||||
							
								
								
									
										13
									
								
								ext/v8/upstream/no-strict-aliasing.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								ext/v8/upstream/no-strict-aliasing.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
Index: SConstruct
 | 
			
		||||
===================================================================
 | 
			
		||||
--- SConstruct	(revision 3521)
 | 
			
		||||
+++ SConstruct	(working copy)
 | 
			
		||||
@@ -47,7 +47,7 @@
 | 
			
		||||
 # on linux we need these compiler flags to avoid crashes in the v8 test suite
 | 
			
		||||
 # and avoid dtoa.c strict aliasing issues
 | 
			
		||||
 if os.environ.get('GCC_VERSION') == '44':
 | 
			
		||||
-    GCC_EXTRA_CCFLAGS = ['-fno-tree-vrp']
 | 
			
		||||
+    GCC_EXTRA_CCFLAGS = ['-fno-tree-vrp', '-fno-strict-aliasing']
 | 
			
		||||
     GCC_DTOA_EXTRA_CCFLAGS = ['-fno-strict-aliasing']
 | 
			
		||||
 else:
 | 
			
		||||
     GCC_EXTRA_CCFLAGS = []
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue