specs/stx-jv.rbspec
changeset 0 f46260ba26b1
child 4 48ec8a59ced4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/specs/stx-jv.rbspec	Sun May 22 00:32:07 2016 +0100
@@ -0,0 +1,408 @@
+load "jv-branch.deps.rake"
+
+# Include Hudson build number of builded by Hudson"
+if ENV['BUILD_NUMBER']
+  build_id="build#{ENV['BUILD_NUMBER']}"
+else
+  build_id="#{Time.now.strftime("%Y%m%d")}"
+end
+
+project :'stx:jv-branch-core' do
+  # Core Smalltalk/X - does contain only standard libraries,
+  # and development tools. Does not contain any other 'features'
+  # like XML suite, Java support. Usable as a basis for standalone
+  # applications that needs some JV-branch features.
+  import :'stx:baseline'
+
+  # FORKED libraries
+  # ======================================================================
+  package "stx:libbasic", :repository => :'swing:hg', :branch => 'jv'
+  package "stx:libbasic2", :repository => :'swing:hg', :branch => 'jv'
+  package "stx:libbasic3", :repository => :'swing:hg', :branch => 'jv'
+  package "stx:libcomp", :repository => :'swing:hg', :branch => 'jv'
+  package "stx:libtool", :repository => :'swing:hg', :branch => 'jv'
+ 
+  package "stx:libview", :repository => :'swing:hg', :branch => 'jv'
+  package "stx:libview2", :repository => :'swing:hg', :branch => 'jv'
+  package "stx:libwidg", :repository => :'swing:hg', :branch => 'jv'
+  package "stx:libwidg2", :repository => :'swing:hg', :branch => 'jv'
+
+  package "stx:goodies/sunit", :repository => :'swing:hg'
+  package "stx:goodies/monticello", :repository => :'swing:hg', :branch => 'jv'
+  package "stx:goodies/refactoryBrowser", :repository => :'swing:hg', :branch => 'jv'
+  package "stx:libsvn", :repository => :'swing:hg', :branch => 'jv'
+
+  # Some more development tools to build and preload
+  # ======================================================================
+  package "stx:goodies/xml/vw", :repository => :'swing:baseline'
+  
+  # SmallSense
+  package "stx:goodies/regex", :repository => :'swing:baseline'
+  package "stx:goodies/smallsense", :repository => :'bitbucket:janvrany'
+  package "stx:goodies/smallsense/refactoring_custom"
+
+  
+  tasks do
+    # Build and install documentation for stx:libjava and stx:libscm/mercurial
+
+    task "stx:libjava:post" do 
+      chdir BUILD_DIR / 'stx' / 'libjava' do
+        make "doc-install"
+      end
+    end
+
+    task "stx:libscm/mercurial:post" do 
+      chdir BUILD_DIR / 'stx' / 'libscm' / 'mercurial' do
+        make "doc-install"
+      end
+    end
+
+
+    redefine BUILD_DIR / 'stx' / 'stc' => BUILD_DIR do | t |
+      checkout :'swing:private:hg', 'stx/stc', :branch => 'jv'
+    end
+
+    redefine BUILD_DIR / 'stx' / 'librun' => BUILD_DIR do | t |
+      checkout :'swing:private:hg', 'stx/librun', :branch => 'jv'
+    end
+
+    if win32?
+
+
+      task :'checkout:post' do
+        rm_f BUILD_DIR / 'stx' / 'projects' / 'smalltalk' / 'stx_splash.bmp'
+      end
+
+      file BUILD_DIR / 'stx' / 'projects' / 'smalltalk' / 'stx_splash.bmp' do
+        cp BUILD_DIR / 'misc' / 'distutils' / 'src' / 'lib' / "splash-smalltalkx-#{project.app_version.split(".")[0..2].join(".")}.bmp",
+           BUILD_DIR / 'stx' / 'projects' / 'smalltalk' / 'stx_splash.bmp'
+      end
+
+      task "stx:projects/smalltalk" => BUILD_DIR / 'stx' / 'projects' / 'smalltalk' / 'stx_splash.bmp'
+
+    end
+
+    # Try execute run the VM if it starts up
+    task :'compile:post' do
+      if PROJECT == 'stx:jv-branch' then  
+        chdir BUILD_DIR / 'stx' / 'projects' / 'smalltalk' do
+          if win32?
+            cmd = "smalltalk.bat -I --quick --eval \"Stdout nextPutLine:'OKay, VM runs'. Smalltalk exit: 0\""
+          else
+            cmd = "./smalltalk -I --quick --eval \"Stdout nextPutLine:'OKay, VM runs'. Smalltalk exit: 0\""
+          end
+          if not system cmd
+            raise Exception.new("Cannot run smalltalk!")
+          end
+        end
+      end
+    end
+  
+  if (TOOLCHAIN == "mingw32" || TOOLCHAIN == 'mingw') then
+    task :'compile:post' => BUILD_DIR / 'stx' / 'projects' / 'smalltalk' / 'libgcc_s_dw2-1.dll'
+    
+    file BUILD_DIR / 'stx' / 'projects' / 'smalltalk' / 'libgcc_s_dw2-1.dll' do
+        cp ENV['MINGW_DIR'] / 'bin' / 'libgcc_s_dw2-1.dll' , BUILD_DIR / 'stx' / 'projects' / 'smalltalk' / 'libgcc_s_dw2-1.dll'
+    end
+    end
+
+    # Build documentation for Mercurial & STX:LIBJAVA
+    task :'dist:pre' do
+        chdir (BUILD_DIR / 'stx' / 'libscm' / 'mercurial') do
+            make 'doc'
+            make 'doc-install'
+        end
+    end
+  
+  task :'stx:projects/smalltalk:pre' do   
+    chdir (BUILD_DIR / 'stx' / 'projects' / 'smalltalk') do         
+    # Hack for MINGW32 - must patch bc.mak ifdefs, sigh.
+    # use ruby instead of sed as ruby has to be installed anyway    
+    cmd = "ruby -ibkp -pe \"gsub /ifdef USEMINGW64/, 'if defined(USEMINGW64) || defined(USEMINGW32)'\" bc.mak"
+    #puts cmd
+    if not system(cmd)  then
+        raise Exception.new("Cannot patch bc.mak")
+    end      
+      end     
+  end
+
+    # Cross-compile hack for stx:libprofiler
+    if win32_wine?
+    task :'stx:libprofiler:pre' do
+      chdir (BUILD_DIR / 'stx' / 'libprofiler') do
+        sh "wine cmd /C config.bat"
+      end
+    end
+
+    task :'stx:projects/smalltalk:pre' do   
+      chdir (BUILD_DIR / 'stx' / 'projects' / 'smalltalk') do   
+        make "buildDate.h"    
+      end
+    end
+
+    task :'stx:goodies/xmlsuite/xmlreaderimpl:pre' do
+      chdir (BUILD_DIR / 'stx' / 'goodies' / 'xmlsuite' / 'xmlreaderimpl') do
+        [
+          'support' / 'expat-2.0.1' / 'bcb5' / 'release' /'obj' / 'xmlwf',
+          'support' / 'expat-2.0.1' / 'bcb5' / 'release' /'obj' / 'libexpat',
+          'support' / 'expat-2.0.1' / 'bcb5' / 'release' /'obj' / 'libexpatw',
+          'support' / 'expat-2.0.1' / 'bcb5' / 'release' /'obj' / 'libexpat_static',
+          'support' / 'expat-2.0.1' / 'bcb5' / 'release' /'obj' / 'libexpatw_static',
+          'support' / 'expat-2.0.1' / 'bcb5' / 'release' /'obj' / 'examples'
+        ].each do | f |
+          if not File.exists?(f)
+            mkdir_p f
+          end
+        end
+      end
+    end
+    end
+
+    # Hack for badly-named files in libtool
+    task :'stx:libtool:post' do
+      chdir (BUILD_DIR / 'stx' / 'libtool') do
+  # Windows does not support symlinks, copy the file
+  if win32?
+    if not File.exist? 'Tools_BrowserList.STH'
+      cp 'Tools__BrowserList.STH', 'Tools_BrowserList.STH'
+    end
+    if not File.exist? 'Tools_NavigatorModel.STH'
+      cp 'Tools__NavigatorModel.STH', 'Tools_NavigatorModel.STH'
+    end
+    if not File.exist? 'Tools_NavigationState.STH'
+      cp 'Tools__NavigationState.STH', 'Tools_NavigationState.STH'
+    end
+  else
+    if not File.exist? 'Tools_BrowserList.H'
+      ln_s 'Tools__BrowserList.H', 'Tools_BrowserList.H'
+    end
+    if not File.exist? 'Tools_NavigatorModel.H'
+      ln_s 'Tools__NavigatorModel.H', 'Tools_NavigatorModel.H'
+    end
+    if not File.exist? 'Tools_NavigationState.H'
+      ln_s 'Tools__NavigationState.H', 'Tools_NavigationState.H'
+    end
+  end
+      end
+    end
+  end
+
+end
+
+
+
+project :'stx:jv-branch' do
+  # Standard Smalltalk/X IDE with some nice libraries preloaded
+
+  import :'stx:jv-branch-core'
+
+
+  app_name "smalltalkx-jv-branch"
+  app_version "6.2.5.0_0"
+
+  # Forked PetitParser
+  package "stx:goodies/petitparser", :repository => :'bitbucket:janvrany', :link => false
+  package "stx:goodies/petitparser/tests", :link => false
+  package "stx:goodies/petitparser/analyzer",  :link => false
+  package "stx:goodies/petitparser/analyzer/tests",  :link => false
+
+  # Monticello
+  package "stx:libcompat", :repository => :'swing:baseline'
+  package "stx:goodies/communication", :repository => :'swing:baseline'
+
+  # Profiler
+  package "stx:libprofiler", :repository => :'swing'
+
+  # Java support
+  package "stx:libjava", :repository => :'bitbucket:janvrany'
+  package "stx:libjava/tools"
+  package "stx:libjava/experiments"
+  #package "stx:libjava/examples" :link => false
+
+  # Smalltalk/X IDE
+  application 'stx:projects/smalltalk', :repository => :'swing:hg', :branch => 'jv'
+
+  if (ENV['USER'] == 'builder') || ( ENV['USER'] == 'vranyj1')  || (ENV['USERNAME'] == 'builder') || ( ENV['USERNAME'] == 'vranyj1') then
+     stx_libjava_checkouter =
+         Proc.new do | pkg, build_dir |
+             repo = :'swing:hg'
+             puts "Checking out #{pkg.name} from #{repo} (cache / staging repo)..."
+             checkout repo, pkg.directory, :branch => pkg.branch, :package => pkg, :separator => '.'
+             puts "Checking out #{pkg.name} from #{repo} (cache)...done"
+
+             File.open(build_dir / 'stx' / 'libjava' / '.hg' / 'hgrc' , 'w') do | f |
+                 f.puts "[paths]"
+                 f.puts "default = https://bitbucket.org/janvrany/stx-libjava"
+             end
+
+             repo = pkg.repository
+             puts "Checking out #{pkg.name} from #{repo}..."
+             update repo, pkg.directory, :branch => pkg.branch, :package => pkg, :separator => pkg._separator
+             puts "Checking out #{pkg.name} from #{repo}...done"
+         end
+
+     stx_libjava_updater =
+         Proc.new do | pkg, build_dir |
+             repo = :'swing:hg'
+             puts "Updating #{pkg.name} from #{repo} (cache / staging repo)..."
+             update repo, pkg.directory, :branch => pkg.branch, :package => pkg, :separator => '.'
+             puts "Checking out #{pkg.name} from #{repo} (cache)...done"
+
+             repo = pkg.repository
+             puts "Checking out #{pkg.name} from #{repo}..."
+             update repo, pkg.directory, :branch => pkg.branch, :package => pkg, :separator => pkg._separator
+             puts "Checking out #{pkg.name} from #{repo}...done"
+         end
+
+
+     package "stx:libjava", :checkout => stx_libjava_checkouter, :update => stx_libjava_updater
+  end
+
+
+  # Other nice packages...
+  metacello_and_libscm_checkouter = Proc.new do | pkg, build_dir |
+    base = project.repository(pkg.repository).url
+    pkg_comps = pkg.name.sub(':', '/').split("/");
+    pkg_tail = pkg_comps.last
+    pkg_body = pkg_comps[0..(pkg_comps.size - 2)];
+    wc = build_dir / pkg.directory
+    FileUtils.mkdir_p(File.dirname(wc))
+    cmd = "svn co #{base}/#{pkg_body.join("/")}/#{pkg.branch == nil ? 'trunk' : pkg.branch}/#{pkg_tail} #{wc}"
+    puts "Issuing: #{cmd}"
+    if not system cmd
+      error "Cannot checkout #{pkg.name} using custom checkouter"
+    end
+  end
+
+
+  package 'stx:libscm', :repository => :'bitbucket:janvrany'
+  package 'stx:libscm/common', :repository => :'bitbucket:janvrany'
+  package 'stx:libscm/mercurial', :repository => :'bitbucket:janvrany'
+  package 'stx:libscm/mercurial/monticello', :repository => :'bitbucket:janvrany'
+  package 'stx:goodies/ring', :repository => :'bitbucket:janvrany', :link => false
+  package 'stx:goodies/libcairo', :repository => :'bitbucket:janvrany', :link => false
+  package 'stx:goodies/cypress', :repository => :'bitbucket:janvrany'
+  package "stx:goodies/xmlsuite", :repository => :'bitbucket:janvrany'  
+  package "stx:goodies/loggia", :repository => :'swing:baseline'
+  package 'stx:goodies/smaCC',:repository => :'swing'
+  package "squeak:graphviz",  :repository => :'swing'  
+
+  #package "stx:goodies/builder/reports", :repository => :'swing:baseline', :link => false
+
+
+
+  tasks do
+    task "stx:projects/smalltalk" => "stx:libwebkit"
+    task "stx:projects/smalltalk" => "stx:libjava"
+    task "stx:projects/smalltalk" => "stx:libjava/tools"
+    task "stx:projects/smalltalk" => "stx:libjava/experiments"
+    #task "stx:libjava/examples" => "stx:libjava"
+    #task "stx:projects/smalltalk" => "stx:libjava/examples"
+    task 'stx:projects/smalltalk' => 'stx:goodies/loggia'
+    task 'stx:projects/smalltalk' => 'stx:goodies/monticello'
+    task 'stx:projects/smalltalk' => 'stx:goodies/cypress'
+    task 'stx:projects/smalltalk' => 'stx:libscm/mercurial'
+    task 'stx:projects/smalltalk' => 'stx:libscm/mercurial/monticello'
+    task 'stx:projects/smalltalk' => 'stx:goodies/builder/reports'
+    task 'stx:projects/smalltalk' => 'stx:goodies/ring'
+    task 'stx:projects/smalltalk' => 'stx:goodies/libcairo'
+    task "stx:goodies/builder/reports" => 'stx:libbasic'
+
+    task :'dist:main' => :'dist:build-tree'
+    task :'dist:main' => :'dist:jv-branch'
+
+
+
+    task :'dist:jv:pre' => :'stx:jv-branch:extractver'
+
+    if win32?     	
+			app_name    = project.app_name      || (raise Exception.new("No app_name property specified"))
+	    app_version = project.app_version   || (raise Exception.new("No app_version property specified"))
+	    version = app_version.split('_').first
+
+	    install_dir = DIST_DIR / 'dist' / "#{app_name}-#{app_version}_#{ARCH}-#{PLATFORM}"
+	    bin_dir = install_dir / 'bin'
+
+	    cairo_dll_dir = nil
+    	cairo_dlls = nil
+    	if ARCH == 'i386'
+    		cairo_dll_dir = BUILD_DIR / 'stx' / 'goodies' / 'libcairo' / 'support' / 'win32' / 'i586'
+	      cairo_dlls =  [ 
+	      	'libcairo-2.dll' ,
+					'libfontconfig-1.dll' ,
+					'libfreetype-6.dll' ,
+					'liblzma-5.dll' ,
+					'libpixman-1-0.dll' ,
+					'libpng15-15.dll' ,
+					'libxml2-2.dll' ,
+					'zlib1.dll'
+					]
+			else
+				cairo_dll_dir = BUILD_DIR / 'stx' / 'goodies' / 'libcairo' / 'support' / 'win32' / 'x86_64'
+				cairo_dlls =  [ 
+	      	'fontconfig.dll' ,
+	      	'iconv.dll' ,
+	      	'libcairo-2.dll' ,
+	      	'libpng16.dll' ,
+	      	'libxml2.dll' ,
+	      	'pixman-1.dll' ,
+	      	'zlib1.dll'
+	      ]
+			end
+
+    	task :'dist:jv:post' => :'dist:jv:variables'
+    	cairo_dlls.each do | dll |
+    		task :'dist:jv:post' => bin_dir / dll
+				file bin_dir / dll do
+					mkdir_p bin_dir
+					cp cairo_dll_dir / dll , bin_dir / dll
+				end
+    	end
+    end
+
+    task :'dist:jv-branch' => [ :'dist:jv:all',
+                                :'dist:jv:archive',
+                                # Documentation
+                                :'dist:jv:doc' ,
+                                :'dist:jv:archive-doc' ]
+
+  end
+end
+
+task :'stx:jv-branch:extractver' do
+  ver = nil
+  if win32?
+    stx_exe = 'stx.com'
+  else
+    stx_exe = './stx'
+  end
+  chdir BUILD_DIR / 'stx' / 'projects' / 'smalltalk' do
+    ver = %x(#{stx_exe} --eval "Stdout nextPutAll: Smalltalk versionString")
+    if $?.exitstatus != 0
+      raise Exception.new("Failed extract version from stx")
+    end
+  end
+  ver = (ver.split(".")[0..2]).join(".")
+  project.app_version "#{ver}_#{build_id}"
+end
+
+
+project :'stx:jv-branch:for-reports-only' do
+  import :'stx:jv-branch'
+
+  tasks do
+    task :'stx:projects/smalltalk:pre' do
+      chdir BUILD_DIR / 'stx' / 'projects' / 'smalltalk' do
+         if win32?
+           system "bmake clobber"
+         else
+           system "make clobber"
+         end
+      end
+    end
+
+    clear :'dist:main' => :'dist:build-tree'
+    clear :'dist:main' => :'dist:jv-branch'
+  end
+end
+