rakelib/compile.rake
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 09 Aug 2017 10:56:59 +0100
branchstx-8.0.0
changeset 167 d0beeb5b1927
parent 136 29bd0a3c4a31
child 168 37f3dd667f71
permissions -rw-r--r--
Retain `hmm.h` and `hmm.c` in binary distribution of `stx:librun` ...as these are MIT licensed.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
desc "Compile project"
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
task :'compile' => :'compile:all'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
STX_TOP_DIR = BUILD_DIR / 'stx'
136
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
     7
STX_CONF_DIR = BUILD_DIR
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
     8
STX_RULES_DIR = BUILD_DIR / '..' / 'makelib'
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
if win32?
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
  STC = STX_TOP_DIR / 'stc' / 'stc.exe'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
  LIBRUN = STX_TOP_DIR / 'librun' / 'objmingw' / 'librun.dll'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
else
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
  STC = STX_TOP_DIR / 'stc' / 'stc'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
  LIBRUN = STX_TOP_DIR / 'librun' / 'librun.so'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
91
76f23122e86a Added option (env var) to tell rakefiles to retain stc and librun sources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    17
# Return true if stx:stc and stx:librun sources should be removed as soon 
76f23122e86a Added option (env var) to tell rakefiles to retain stc and librun sources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    18
# as STC or librun is built. False otherwise (sources are not removed by 
76f23122e86a Added option (env var) to tell rakefiles to retain stc and librun sources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    19
# rakefiles)
76f23122e86a Added option (env var) to tell rakefiles to retain stc and librun sources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    20
#
76f23122e86a Added option (env var) to tell rakefiles to retain stc and librun sources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    21
# Indeed this is a feeble protection as it's easy to trick this method. But 
76f23122e86a Added option (env var) to tell rakefiles to retain stc and librun sources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    22
# the goal is not to protect sources but rather have a secondaty measure to
76f23122e86a Added option (env var) to tell rakefiles to retain stc and librun sources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    23
# avoid sources to leak (for exaple, due to a bug in packaging scripts).
76f23122e86a Added option (env var) to tell rakefiles to retain stc and librun sources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    24
# Unathorized subjects should not be able to checkout sources in first instance.
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
def should_remove_librun_and_stc_sources
107
e6d325dbc81b Oops, fixed `should_remove_stc_and_librun_sources()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
    26
    return ! (core_developer? or ENV['RETAIN_STX_AND_LIBRUN_SOURCE'] == 'yespleaseretain!')
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
def rm_rf_all_in_except(directory, exceptions = [])
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
  if File.directory? directory then
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
    Dir.foreach(directory) do | each |
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
      if each != '.' and each != '..' and not exceptions.include? each
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
        rm_rf File.join(directory, each)
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
      end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
    end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
  else
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
    rm_f directory
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
if unix? 
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
  STC_BINARY_FILES = [    
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
    'cpu_alpha.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
    'cpu_arm.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
    'cpu_hppa.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
    'cpu_i386.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
    'cpu_x86_64.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
    'cpu_ia64.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
    'cpu_mc68k.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
    'cpu_mc88k.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
    'cpu_mips.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
    'cpu_ns32k.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
    'cpu_power.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
    'cpu_s390.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
    'cpu_sparc.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
    'cpu_vax.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
    'stc.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
    'stcIntern.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
    'stcVMdata.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
    'stcVMoffsets.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
    'stxAsmMacros.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
    'stxNames.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
    'stxOSDefs.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
    'stxTypeMacros.h',     
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
    'symbols.stc.seed',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
    'version.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
    'README',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
    #unix specific
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
    'stx-config.sh',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
    'linuxIntern.h',
11
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
    72
    'macIntern.h',        
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
    'Make.proto',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
    'stc',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
    'stc.1',    
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
  ]
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
  LIBRUN_BINARY_FILES1 = [    
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
    'libffi-3.2.1',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
    'md5.h',
44
966a30552617 Added mcompiler.h to list files included in binary distribution of librun.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 39
diff changeset
    80
    'mcompiler.h',
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
    'main.c',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
    'librun.so',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
    'librun.a',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
    'symlist.c',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
    'Make.proto',
135
0325651d2b43 Makefiles: use our own makefiles rather than eXept's
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 133
diff changeset
    86
    'makefile',
167
d0beeb5b1927 Retain `hmm.h` and `hmm.c` in binary distribution of `stx:librun`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 136
diff changeset
    87
    'hmm.h',
d0beeb5b1927 Retain `hmm.h` and `hmm.c` in binary distribution of `stx:librun`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 136
diff changeset
    88
    'hmm.c',
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
  ]
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    90
  LIBRUN_BINARY_FILES2 = []
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    91
elsif win32?
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
  STC_BINARY_FILES = [    
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
    'cpu_alpha.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    94
    'cpu_arm.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    95
    'cpu_hppa.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
    'cpu_i386.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    97
    'cpu_x86_64.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98
    'cpu_ia64.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    99
    'cpu_mc68k.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   100
    'cpu_mc88k.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   101
    'cpu_mips.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   102
    'cpu_ns32k.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   103
    'cpu_power.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   104
    'cpu_s390.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   105
    'cpu_sparc.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   106
    'cpu_vax.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   107
    'stc.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   108
    'stcIntern.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   109
    'stcVMdata.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   110
    'stcVMoffsets.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   111
    'stxAsmMacros.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   112
    'stxNames.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   113
    'stxOSDefs.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   114
    'stxTypeMacros.h', 
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   115
    'symbols.stc.seed',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   116
    'version.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   117
    'README',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   118
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   119
    #windows specific
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   120
    'stx-config.bat',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   121
    'mingwmake.bat',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   122
    'ntIntern.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   123
    'nt.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   124
    'Make.proto',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   125
    'stc.exe',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   126
  ]  
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   127
  LIBRUN_BINARY_FILES1 = [    
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   128
    'libffi-3.2.1',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   129
    'md5.h',
45
5d8bcdc92f85 Oops, also keep mcompiler.h on Windows!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 44
diff changeset
   130
    'mcompiler.h',
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   131
    'main.c',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   132
    'objmingw', 
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   133
    'bc.mak',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   134
    'mingwmake.bat',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   135
    'buildDate.h',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   136
    'genDate.com',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   137
  ]
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   138
  LIBRUN_BINARY_FILES2 = [
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   139
    'librun.dll',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   140
    'librun.lib',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   141
  ]
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   142
else
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   143
  raise Exception.new("Unsupported platform")
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   144
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   145
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   146
def cleanup_stc()  
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   147
  if should_remove_librun_and_stc_sources()
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   148
    puts "Cleaning up stc..."
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   149
    begin
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   150
      rm_rf_all_in_except(STX_TOP_DIR / 'stc', STC_BINARY_FILES)    
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   151
    rescue
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   152
      # When something goes wrong, be safe and remove whole directory
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   153
      rm_rf STX_TOP_DIR / 'stc'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   154
    end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   155
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   156
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   157
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   158
def cleanup_librun()
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   159
  if should_remove_librun_and_stc_sources()
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   160
    puts "Cleaning up librun..."
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   161
    begin
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   162
      rm_rf_all_in_except(STX_TOP_DIR / 'librun', LIBRUN_BINARY_FILES1)
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   163
      if win32? then
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   164
        rm_rf_all_in_except(STX_TOP_DIR / 'librun' / 'objmingw', LIBRUN_BINARY_FILES2)
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   165
      end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   166
    rescue
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   167
      # When something goes wrong, be safe and remove whole directory
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   168
      rm_rf STX_TOP_DIR / 'librun'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   169
    end      
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   170
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   171
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   172
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   173
# Setup flags for GCC (both, real GCC and MinGW)
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   174
GCC_CFLAGS_OPT = ARCH == 'i386' ? '-O' : ''
11
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   175
GCC_CFLAGS_DBG = core_developer? ? '-ggdb3' : ''
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   176
GCC_CFLAGS_PIC = win32? ? '' : '-fPIC'
87
a4637233f94f Oops, hack to allow passing OPT & LIBRUN_OPT to make from command line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 52
diff changeset
   177
GCC_CFLAGS = "-pipe -fno-omit-frame-pointer -fno-stack-protector -fno-strict-aliasing -fwrapv #{GCC_CFLAGS_PIC} #{GCC_CFLAGS_OPT} #{GCC_CFLAGS_DBG}"
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   178
39
7a7c62fe520a Win32: Force C language when compiling Smalltalk sources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   179
# Sigh, for MINGW 5.x.x coming with MSYS2 we have to force C language as 
7a7c62fe520a Win32: Force C language when compiling Smalltalk sources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   180
# Borland make and build files are using funny suffixes to confuse GCC's 
7a7c62fe520a Win32: Force C language when compiling Smalltalk sources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   181
# language detection. Triple sigh here!
7a7c62fe520a Win32: Force C language when compiling Smalltalk sources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   182
GCC_CFLAGS += " -x c" if win32?
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   183
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   184
namespace :'compile' do
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   185
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   186
  task :'all' => [ :'prereq', :'pre', :'main', :'post' ]
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   187
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   188
  task :'pre'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   189
  task :'post'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   190
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   191
  task :'prereq' => [ :'setup' ]
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   192
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   193
  task :'main' => [ 
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   194
        :'config',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   195
        :'libraries',
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   196
        :'stc',       
93
650412e81596 Automatically extract package dependencies from project definition file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
   197
        :'librun',        
9
34274130f57a Removed some old, dead code.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
   198
        :'application',                
93
650412e81596 Automatically extract package dependencies from project definition file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
   199
      ]      
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   200
93
650412e81596 Automatically extract package dependencies from project definition file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
   201
  task :'config' => [ STX_TOP_DIR / 'include' ]
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   202
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   203
  directory STX_TOP_DIR / 'include'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   204
93
650412e81596 Automatically extract package dependencies from project definition file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
   205
  task :'application' => :'setup:dependencies'
650412e81596 Automatically extract package dependencies from project definition file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
   206
135
0325651d2b43 Makefiles: use our own makefiles rather than eXept's
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 133
diff changeset
   207
  
136
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   208
  task :'config' => [ STX_CONF_DIR / 'stx-config.make' ]
122
6fcb351d23a7 Use our own make configuration files rather than eXept's
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
   209
136
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   210
  directory STX_CONF_DIR do 
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   211
    mkdir_p STX_CONF_DIR
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   212
  end
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   213
    
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   214
  file STX_CONF_DIR / 'stx-config.make' => STX_CONF_DIR  do
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   215
    makelib_dir = Pathname.new(File.expand_path('makelib')).relative_path_from(Pathname.new(BUILD_DIR / 'stx' ))
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   216
    os = nil
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   217
    case 
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   218
    when linux? 
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   219
      os = 'linux'
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   220
    when win32?
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   221
      os = 'mingw32'
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   222
    else
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   223
      raise Exception.new("Unssuported operating system")
122
6fcb351d23a7 Use our own make configuration files rather than eXept's
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
   224
    end
6fcb351d23a7 Use our own make configuration files rather than eXept's
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
   225
136
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   226
    File.open(STX_CONF_DIR / 'stx-config.make', "w") do | f |
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   227
      f.puts "BUILD_TARGET ?= #{os}-#{ARCH}"
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   228
    end
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   229
  end 
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   230
136
29bd0a3c4a31 Makefiles: configure Smalltalk/X by defining TARGET rather then symlinking a file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 135
diff changeset
   231
  rule 'makefile' do | t |  
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   232
    chdir File.dirname(t.name) do
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   233
      sh "'#{STX_TOP_DIR / 'rules' / 'stmkmf'}'"
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   234
    end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   235
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   236
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   237
  task :stc do
3
18c56730fabf Renamed `amd64?` to `x86_64?` for consistency
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 0
diff changeset
   238
    if linux? and x86_64? and ARCH == 'i386'
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   239
      stx_make_flags="STC_LEXLIB=libfl/libfl_pic.a"
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   240
    else
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   241
      stx_make_flags=""
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   242
    end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   243
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   244
    chdir STX_TOP_DIR / 'stc' do      
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   245
      begin
91
76f23122e86a Added option (env var) to tell rakefiles to retain stc and librun sources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
   246
        make stx_make_flags
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   247
        cleanup_stc()
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   248
      rescue Exception => e
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   249
        cleanup_stc()
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   250
        cleanup_librun()
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   251
        error "Cannot compile stx:stc: #{e.description}"
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   252
      end  
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   253
    end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   254
  
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   255
    if not File.exist? STX_TOP_DIR / 'include' / 'stx-config.h' then
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   256
      cp STX_TOP_DIR / 'stc' / 'stx-config.h' , STX_TOP_DIR / 'include' / 'stx-config.h'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   257
    end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   258
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   259
    if not File.exist? STC
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   260
      cleanup_stc()
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   261
      cleanup_librun()
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   262
      error "Cannot compile stx:stc"
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   263
    end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   264
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   265
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   266
 task :librun do
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   267
    chdir STX_TOP_DIR / 'librun' do
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   268
      begin
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   269
        begin
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   270
            if win32_wine?
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   271
              if not File.exist? 'libffi' / 'build_win32' / 'objbc'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   272
                mkdir 'libffi' / 'build_win32' / 'objbc'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   273
              end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   274
            end
111
767f2ace9b82 Win32: A nasty workaround to avoid Borland make to crash under Windows 10
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   275
          # A workaround for Windows 10 & ancient Borland make which 
767f2ace9b82 Win32: A nasty workaround to avoid Borland make to crash under Windows 10
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   276
          # tend to crash there when trying to recompile already compiled
767f2ace9b82 Win32: A nasty workaround to avoid Borland make to crash under Windows 10
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   277
          # librun. Sigh, we have to move away from it as soon as possible!
767f2ace9b82 Win32: A nasty workaround to avoid Borland make to crash under Windows 10
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   278
          
767f2ace9b82 Win32: A nasty workaround to avoid Borland make to crash under Windows 10
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   279
          if win32? and (File.exist? 'stxmain.c') then
767f2ace9b82 Win32: A nasty workaround to avoid Borland make to crash under Windows 10
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   280
            touch "stxmain.c"
767f2ace9b82 Win32: A nasty workaround to avoid Borland make to crash under Windows 10
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   281
          end
91
76f23122e86a Added option (env var) to tell rakefiles to retain stc and librun sources.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
   282
          make
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   283
          cleanup_librun()
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   284
        rescue Exception => e
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   285
          cleanup_stc()
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   286
          cleanup_librun()
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   287
          error "Cannot compile stx:librun: #{e.description}"
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   288
        end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   289
      end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   290
    end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   291
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   292
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   293
  if unix?
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   294
    task :stc => STX_TOP_DIR / 'stc' / 'makefile'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   295
    task :librun => STX_TOP_DIR / 'librun' / 'makefile'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   296
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   297
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   298
  if win32? and TOOLCHAIN == 'bcc'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   299
    directory STX_TOP_DIR / 'lib' / 'bc'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   300
    task :librun => STX_TOP_DIR / 'lib' / 'bc'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   301
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   302
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   303
  task :'libraries'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   304
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   305
  if unix?
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   306
    vogl_dir = STX_TOP_DIR / 'support' / 'VGL' / 'vogl'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   307
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   308
    task 'libraries' => [ vogl_dir / 'src' / 'libvogl.a' ]
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   309
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   310
    file vogl_dir / 'src' / 'libvogl.a' => [ vogl_dir / 'makefile'  ] do
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   311
      chdir STX_TOP_DIR / 'support' / 'VGL' / 'vogl' do
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   312
        make
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   313
      end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   314
    end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   315
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   316
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   317
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   318
133
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   319
task "stx:librun:symbols"
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   320
97
33cf3197acb5 Added hack for compiling 32bit stx:libdb/libodbc on 64bit Linux
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   321
#
33cf3197acb5 Added hack for compiling 32bit stx:libdb/libodbc on 64bit Linux
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   322
# Various compilation hacks here and there (sigh)
33cf3197acb5 Added hack for compiling 32bit stx:libdb/libodbc on 64bit Linux
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   323
# 
133
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   324
desc "Update the VM symbol database"
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   325
task 'stx:librun:symbols' do | task |    
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   326
  symbols_stc = BUILD_DIR / 'stx' / 'include' / 'symbols.stc'
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   327
  if unix?
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   328
    # UNIX VMs have the symbol database built into the binary as
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   329
    # static data so we need to recompile the VM
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   330
    stx_librun = project.package('stx:librun')
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   331
    stx_librun_dll = BUILD_DIR / stx_librun.directory() / OBJ_DIR / stx_librun.dll_name()
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   332
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   333
    if not uptodate?(stx_librun_dll, [ symbols_stc ]) then
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   334
      Rake::Task["stx:librun"].reenable()
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   335
      Rake::Task["stx:librun"].invoke()
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   336
    end
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   337
  elsif win32? 
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   338
    # Windows VM reads the symbol database from a file `symbols.stc` located
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   339
    # alongside the program executable so we need to copy that file
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   340
    app = project.application
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   341
    symbols_stc_in_app_directory = BUILD_DIR / app.directory() / 'symbols.stc'
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   342
    if not uptodate?(symbols_stc_in_app_directory, [ symbols_stc ]) then
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   343
      cp symbols_stc, symbols_stc_in_app_directory
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   344
    end
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   345
  end
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   346
  task.reenable()
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   347
end
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   348
97
33cf3197acb5 Added hack for compiling 32bit stx:libdb/libodbc on 64bit Linux
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   349
if unix?
33cf3197acb5 Added hack for compiling 32bit stx:libdb/libodbc on 64bit Linux
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   350
  # A hack for Debian (and possibly other Linux distros) that does not ship
33cf3197acb5 Added hack for compiling 32bit stx:libdb/libodbc on 64bit Linux
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   351
  # 32bit libodbc.a / libodbcinst.a. Link directly against .so
33cf3197acb5 Added hack for compiling 32bit stx:libdb/libodbc on 64bit Linux
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   352
  task :'stx:libdb/libodbc:pre' do     
33cf3197acb5 Added hack for compiling 32bit stx:libdb/libodbc on 64bit Linux
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   353
	  sed('-lodbc -lodbcinst' , '-l:libodbc.so.2 -l:libodbcinst.so.2', BUILD_DIR / 'stx' / 'libdb' / 'libodbc' / 'Make.proto', true)
33cf3197acb5 Added hack for compiling 32bit stx:libdb/libodbc on 64bit Linux
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   354
  end  
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   355
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   356
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   357
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   358
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   359
133
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   360