rakelib/compile.rake
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 12 Jun 2018 21:27:24 +0000
changeset 236 5a4e789cdd40
parent 234 05943c900d5e
child 237 69ab924b97bf
permissions -rwxr-xr-x
Merged branch stx-8.0.0 into default.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
     1
desc 'Compile project'
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
     2
task :compile => :'compile:all'
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
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
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
     6
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
     7
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
     8
if win32?
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
  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
    10
  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
    11
else
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
  STC = STX_TOP_DIR / 'stc' / 'stc'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
  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
    14
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
    16
# Return true if stx:stc and stx:librun sources should be removed as soon
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
    17
# as STC or librun is built. False otherwise (sources are not removed by
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
    18
# 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
    19
#
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
    20
# Indeed this is a feeble protection as it's easy to trick this method. But
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
    21
# 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
    22
# 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
    23
# 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
    24
def should_remove_librun_and_stc_sources
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
    25
  !(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
    26
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
    28
STC_BINARY_FILES = [
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
    29
    'cpu_arm.h',
176
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    30
    'cpu_i386.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    31
    'cpu_x86_64.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    32
    'cpu_ia64.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    33
    'stc.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    34
    'stcIntern.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    35
    'stcVMdata.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    36
    'stcVMoffsets.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    37
    'stxAsmMacros.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    38
    'stxNames.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    39
    'stxOSDefs.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    40
    'stxTypeMacros.h',
184
cd1312f41a17 8.0.0: Fixups after merging new branch "feature-94-revamp-thinlocks"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 181
diff changeset
    41
    'thinlocks.h',
176
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    42
    'symbols.stc.seed',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    43
    'version.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    44
    'sha1.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    45
    'sha1.c',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    46
    'README',
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
176
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    48
    # UNIX specific
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    49
    'stx-config.sh',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    50
    'linuxIntern.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    51
    'freeBSDIntern.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    52
    'macIntern.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    53
    'Make.proto',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    54
    'stc',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    55
    'stc.1',
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
    56
176
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    57
    # Windows specific
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    58
    'stx-config.bat',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    59
    'mingwmake.bat',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    60
    'ntIntern.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    61
    'nt.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    62
    'Make.proto',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    63
    'stc.exe',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    64
]
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
    65
176
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    66
LIBRUN_BINARY_FILES = [
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    67
    'libffi-3.2.1',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    68
    'md5.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    69
    'mcompiler.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    70
    'main.c',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    71
    'hmm.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    72
    'hmm.c',
184
cd1312f41a17 8.0.0: Fixups after merging new branch "feature-94-revamp-thinlocks"
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 181
diff changeset
    73
    'jsupport.h',
204
1467c3e7c059 Rakefiles: keep `debug.h` and `debug.c` in pre-built stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
    74
    'debug.h',
1467c3e7c059 Rakefiles: keep `debug.h` and `debug.c` in pre-built stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
    75
    'debug.c',
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
176
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    77
    # UNIX specific
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    78
    'librun.so',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    79
    'librun.a',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    80
    'symlist.c',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    81
    'Make.proto',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    82
    'makefile',
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
176
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    84
    # Windows specific
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    85
    'bc.mak',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    86
    'mingwmake.bat',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    87
    'buildDate.h',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    88
    'genDate.com',
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    89
    File.join('objmingw' , 'librun.dll'),
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    90
    File.join('objmingw' , 'librun.lib'),
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
    91
]
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
    93
def cleanup_stc
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
    94
  if should_remove_librun_and_stc_sources
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
    95
    puts 'Cleaning up stc...'
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
    begin
176
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    97
      rm_rf_ex STX_TOP_DIR / 'stc', exceptions: STC_BINARY_FILES
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98
    rescue
176
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
    99
      # When something goes wrong, be safe and remove whole directory...
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
   100
      rm_rf    STX_TOP_DIR / 'stc'
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   101
    end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   102
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   103
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   104
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   105
def cleanup_librun
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   106
  if should_remove_librun_and_stc_sources
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   107
    puts 'Cleaning up librun...'
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   108
    begin
188
02b7bd705334 Rakefiles: fixed bug in `cleanup_librun()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 181
diff changeset
   109
      rm_rf_ex STX_TOP_DIR / 'librun', exceptions: LIBRUN_BINARY_FILES
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   110
    rescue
176
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
   111
      # When something goes wrong, be safe and remove whole directory...
84363aa38ff4 Rakefiles: use (new) `rm_rf_ex()` file utility to wipe-out stx:stc and stx:librun
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
   112
      rm_rf    STX_TOP_DIR / 'librun'
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   113
    end
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   114
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   115
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   116
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   117
namespace :compile do
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   118
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   119
  task :all => %i(prereq pre main post)
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   120
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   121
  task :pre
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   122
  task :post
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   123
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   124
  task :prereq => %i(setup)
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   125
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   126
  task :main => %i(
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   127
      config
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   128
      stc
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   129
      librun
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   130
      application
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   131
  )
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   132
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   133
  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
   134
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   135
  directory STX_TOP_DIR / 'include'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   136
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   137
  task :application => :'setup:dependencies'
93
650412e81596 Automatically extract package dependencies from project definition file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
   138
650412e81596 Automatically extract package dependencies from project definition file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
   139
138
Patrik Svestka <patrik.svestka@gmail.com>
parents: 137 136
diff changeset
   140
  task :config => [ STX_CONF_DIR / 'stx-config.make' ]
234
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   141
  task :config => [ BUILD_DIR / 'stx' / 'rules' / 'stmkmf' ] if unix?
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   142
  task :config => [ BUILD_DIR / 'stx' / 'rules' / 'stdHeader_bc' ] if win32?
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   143
  task :config => [ BUILD_DIR / 'stx' / 'rules' / 'stdRules_bc' ] if win32?
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   144
122
6fcb351d23a7 Use our own make configuration files rather than eXept's
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
   145
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   146
  directory STX_CONF_DIR do
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
   147
    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
   148
  end
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   149
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
   150
  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
   151
    makelib_dir = Pathname.new(File.expand_path('makelib')).relative_path_from(Pathname.new(BUILD_DIR / 'stx' ))
138
Patrik Svestka <patrik.svestka@gmail.com>
parents: 137 136
diff changeset
   152
    File.open(STX_CONF_DIR / 'stx-config.make', 'w') do | f |
169
f9f519bb10b6 Use GNU target triplets to specify build targets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 168
diff changeset
   153
      f.puts "BUILD_TARGET ?= #{BUILD_TARGET}"
232
85c422506875 Makefiles: allow to specify C compiler on a command line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 204
diff changeset
   154
      if defined? CC 
85c422506875 Makefiles: allow to specify C compiler on a command line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 204
diff changeset
   155
        f.puts "CC ?= #{CC}"
85c422506875 Makefiles: allow to specify C compiler on a command line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 204
diff changeset
   156
      end
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
   157
    end
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   158
  end
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   159
234
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   160
  file BUILD_DIR / 'stx' / 'rules' / 'stmkmf' => [ BUILD_DIR / 'stx' / 'rules' ] do
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   161
    if not File.exist? BUILD_DIR / 'stx' / 'rules' / 'stmkmf'
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   162
      chdir BUILD_DIR / 'stx' / 'rules' do
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   163
        # Argh, cannot use ln_s as it cannot make symlinks with relative
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   164
        # paths. Sigh,     
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   165
        sh "ln -s \'../../../bin/stmkmf.rb\' stmkmf"
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   166
      end
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   167
    end
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   168
  end
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   169
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   170
  file BUILD_DIR / 'stx' / 'rules' / 'stdHeader_bc' => [ BUILD_DIR / 'stx' / 'rules' ] do
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   171
    top = "#{File.absolute_path(BUILD_DIR).gsub("/", "\\")}\\stx"
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   172
    File.open(BUILD_DIR / 'stx' / 'rules' / 'stdHeader_bc', "w") do | f |
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   173
      f.puts <<-CONTENTS      
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   174
# Do not edit! Automatically generated by rake (rakelib/#{File.basename(__FILE__)})
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   175
#
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   176
!IF !defined(TOP) 
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   177
TOP=#{top}
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   178
!ENDIF
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   179
MAKELIB = $(TOP)\\..\\..\\makelib
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   180
!INCLUDE $(MAKELIB)\\definitions-w.make
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   181
CONTENTS
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   182
    end
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   183
  end
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   184
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   185
  file BUILD_DIR / 'stx' / 'rules' / 'stdRules_bc' => [ BUILD_DIR / 'stx' / 'rules' ] do
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   186
    top = "#{File.absolute_path(BUILD_DIR).gsub("/", "\\")}\\stx"
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   187
    File.open(BUILD_DIR / 'stx' / 'rules' / 'stdRules_bc', "w") do | f |
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   188
      f.puts <<-CONTENTS      
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   189
# Do not edit! Automatically generated by rake (specs/#{File.basename(__FILE__)})
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   190
#
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   191
!IF !defined(TOP) 
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   192
TOP=#{top}
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   193
!ENDIF
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   194
MAKELIB = $(TOP)\\..\\..\\makelib
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   195
!INCLUDE $(MAKELIB)\\rules-w.make
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   196
CONTENTS
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   197
    end        
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   198
  end
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   199
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   200
  rule 'makefile' do |t|
169
f9f519bb10b6 Use GNU target triplets to specify build targets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 168
diff changeset
   201
    chdir File.dirname(t.name) do
f9f519bb10b6 Use GNU target triplets to specify build targets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 168
diff changeset
   202
      sh "'#{STX_TOP_DIR / 'rules' / 'stmkmf'}'"
f9f519bb10b6 Use GNU target triplets to specify build targets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 168
diff changeset
   203
    end
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   204
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   205
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   206
  task :stc do
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   207
    chdir STX_TOP_DIR / 'stc' do
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   208
      begin
169
f9f519bb10b6 Use GNU target triplets to specify build targets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 168
diff changeset
   209
        make
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   210
        cleanup_stc
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   211
      rescue Exception => e
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   212
        cleanup_stc
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   213
        cleanup_librun
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   214
        error "Cannot compile stx:stc: #{e.message}"
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   215
      end
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   216
    end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   217
138
Patrik Svestka <patrik.svestka@gmail.com>
parents: 137 136
diff changeset
   218
    (cp STX_TOP_DIR / 'stc' / 'stx-config.h', STX_TOP_DIR / 'include' / 'stx-config.h') unless File.exist?(STX_TOP_DIR / 'include' / 'stx-config.h')
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   219
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   220
    unless File.exist? STC
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   221
      cleanup_stc
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   222
      cleanup_librun
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   223
      error 'Cannot compile stx:stc'
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   224
    end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   225
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   226
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   227
  task :librun do
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   228
    chdir STX_TOP_DIR / 'librun' do
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   229
      begin
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   230
        begin
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   231
          if win32_wine?
138
Patrik Svestka <patrik.svestka@gmail.com>
parents: 137 136
diff changeset
   232
            (mkdir 'libffi' / 'build_win32' / 'objbc') unless File.exist?('libffi' / 'build_win32' / 'objbc')
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   233
          end
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   234
          # A workaround for Windows 10 & ancient Borland make which
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
   235
          # 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
   236
          # librun. Sigh, we have to move away from it as soon as possible!
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   237
          (touch 'stxmain.c') if (win32? and File.exist? 'stxmain.c')
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
   238
          make
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   239
          cleanup_librun
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   240
        rescue Exception => e
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   241
          cleanup_stc
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   242
          cleanup_librun
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   243
          error "Cannot compile stx:librun: #{e.message}"
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   244
        end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   245
      end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   246
    end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   247
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   248
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   249
  if unix?
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   250
    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
   251
    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
   252
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   253
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   254
  if win32? and TOOLCHAIN == 'bcc'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   255
    directory STX_TOP_DIR / 'lib' / 'bc'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   256
    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
   257
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   258
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   259
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   260
133
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   261
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
   262
97
33cf3197acb5 Added hack for compiling 32bit stx:libdb/libodbc on 64bit Linux
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   263
#
33cf3197acb5 Added hack for compiling 32bit stx:libdb/libodbc on 64bit Linux
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   264
# Various compilation hacks here and there (sigh)
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   265
#
133
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   266
desc "Update the VM symbol database"
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   267
task 'stx:librun:symbols' do | task |
133
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   268
  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
   269
  if unix?
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   270
    # 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
   271
    # 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
   272
    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
   273
    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
   274
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   275
    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
   276
      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
   277
      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
   278
    end
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   279
  elsif win32?
133
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   280
    # 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
   281
    # 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
   282
    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
   283
    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
   284
    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
   285
      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
   286
    end
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   287
  end
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   288
  task.reenable()
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   289
end
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   290
97
33cf3197acb5 Added hack for compiling 32bit stx:libdb/libodbc on 64bit Linux
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   291
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
   292
  # 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
   293
  # 32bit libodbc.a / libodbcinst.a. Link directly against .so
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   294
  task :'stx:libdb/libodbc:pre' do
97
33cf3197acb5 Added hack for compiling 32bit stx:libdb/libodbc on 64bit Linux
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   295
	  sed('-lodbc -lodbcinst' , '-l:libodbc.so.2 -l:libodbcinst.so.2', BUILD_DIR / 'stx' / 'libdb' / 'libodbc' / 'Make.proto', true)
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   296
  end
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   297
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   298
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   299
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   300
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   301
133
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   302