rakelib/setup.rake
branchstx-8.0.0
changeset 169 f9f519bb10b6
parent 144 30d9a0025ae7
child 216 ca243e8d46c8
equal deleted inserted replaced
168:37f3dd667f71 169:f9f519bb10b6
     7 
     7 
     8 load BUILD_DIR / 'stx-config.rake' if File.exist?(BUILD_DIR / 'stx-config.rake')
     8 load BUILD_DIR / 'stx-config.rake' if File.exist?(BUILD_DIR / 'stx-config.rake')
     9 
     9 
    10 unless defined? PROJECT;       PROJECT = 'stx:jv-branch'; end
    10 unless defined? PROJECT;       PROJECT = 'stx:jv-branch'; end
    11 
    11 
    12 unless defined? ARCH
    12 
    13   if ENV.has_key? 'ARCH'
    13 
    14     ARCH = ENV['ARCH']
    14 # Guess the value of BUILD_TARGET for system on which we're currently running.
    15   else
    15 # Think of this as of `config.guess` script used in autotools.
    16     arch = RbConfig::CONFIG['host_cpu']
    16 # Returns the BUiLD_TARGET in form of GNU target triplet, such as 
    17     case arch
    17 # `x86_64-pc-linux-gnu`
    18       when 'i586', 'i686'
    18 def build_target_guess()
    19         ARCH = 'i386'
    19   RbConfig::CONFIG['target'] # Can't believe it's so easy...
    20       else
    20 end
    21         ARCH = arch
    21 
    22     end
    22 unless defined? BUILD_TARGET; BUILD_TARGET = ENV['BUILD_TARGET'] || build_target_guess(); end
    23   end
    23 
    24   raise Exception.new("Unsupported architecture #{ARCH}") if ARCH != 'i386' && ARCH != 'x86_64'
       
    25 end
       
    26 
    24 
    27 unless defined? TOOLCHAIN
    25 unless defined? TOOLCHAIN
    28   if ENV.has_key? 'TOOLCHAIN'
    26   if ENV.has_key? 'TOOLCHAIN'
    29     TOOLCHAIN = ENV['TOOLCHAIN']
    27     TOOLCHAIN = ENV['TOOLCHAIN']
    30   else
    28   else
    31     if unix?
    29     if unix?
    32       TOOLCHAIN='gcc'
    30       TOOLCHAIN='gcc'
    33     elsif win32?
    31     elsif win32?    
    34       if ARCH == 'x86_64'
    32       if /x86_64/ =~ BUILD_TARGET
    35         TOOLCHAIN='mingw64'
    33         TOOLCHAIN='mingw64'
    36       else
    34       else
    37         TOOLCHAIN='mingw32'
    35         TOOLCHAIN='mingw32'
    38       end
    36       end
    39     else
    37     else
    57 #
    55 #
    58 # This file SHOULD NOT be checked in a repository. 
    56 # This file SHOULD NOT be checked in a repository. 
    59 #
    57 #
    60 COMMENT
    58 COMMENT
    61       f.puts "unless defined? PROJECT; PROJECT='#{PROJECT}'; end"
    59       f.puts "unless defined? PROJECT; PROJECT='#{PROJECT}'; end"
    62       f.puts "unless defined? ARCH; ARCH='#{ARCH}'; end"
    60       f.puts "unless defined? BUILD_TARGET; BUILD_TARGET = '#{BUILD_TARGET}'; end"
    63       f.puts "unless defined? REPOSITORYSET; REPOSITORYSET='#{REPOSITORYSET}'; end"
    61       f.puts "unless defined? REPOSITORYSET; REPOSITORYSET='#{REPOSITORYSET}'; end"
    64       if defined? PROJECT_DIRS
    62       if defined? PROJECT_DIRS
    65         f.puts "unless defined? PROJECT_DIRS; PROJECT_DIRS='#{PROJECT_DIRS}'; end"
    63         f.puts "unless defined? PROJECT_DIRS; PROJECT_DIRS='#{PROJECT_DIRS}'; end"
    66       end
    64       end
    67     end
    65     end
   139   project! PROJECT.to_sym
   137   project! PROJECT.to_sym
   140   project.apply_imports
   138   project.apply_imports
   141   app_name = project.app_name || 'smalltalkx'
   139   app_name = project.app_name || 'smalltalkx'
   142   app_version = project.app_version || '6.2.5'
   140   app_version = project.app_version || '6.2.5'
   143 
   141 
   144   unless defined? BUILD_NAME; BUILD_NAME = "#{app_name}-#{app_version}_#{ARCH}-#{win32? ? 'win32' : RbConfig::CONFIG['host_os']}" end
   142   unless defined? BUILD_NAME; BUILD_NAME = "#{app_name}-#{app_version}_#{BUILD_TARGET}" end
   145 end
   143 end
   146 
   144 
   147 task :'setup:dependencies' => :checkout do
   145 task :'setup:dependencies' => :checkout do
   148   project.packages.each do |pkg|
   146   project.packages.each do |pkg|
   149     if pkg.name == 'stx:stc' or pkg.name == 'stx:librun' or File.exist? (BUILD_DIR / pkg.directory / pkg.project_definition_file_name)
   147     if pkg.name == 'stx:stc' or pkg.name == 'stx:librun' or File.exist? (BUILD_DIR / pkg.directory / pkg.project_definition_file_name)