rakelib/compile.rake
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 24 Sep 2018 20:55:06 +0100
changeset 258 65caf0201157
parent 246 687c4889e2e6
child 261 9312db25c9f8
permissions -rw-r--r--
Fix missing `smalltalk.svg` and `smalltalkx.desktop` in toy archive ...which caused a warning when run on system without these already installed: cp: cannot stat './smalltalkx.svg': No such file or directory cp: cannot stat './smalltalkx.desktop': No such file or directory Thanks Pocho for reporting.
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',
237
69ab924b97bf Rakefiles: fixes to make it working on SWING build slaves
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 234
diff changeset
    76
    'librun-gdb.py',
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
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
    78
    # 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
    79
    '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
    80
    '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
    81
    '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
    82
    '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
    83
    'makefile',
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
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
    85
    # 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
    86
    '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
    87
    '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
    88
    '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
    89
    '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
    90
    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
    91
    File.join('objmingw' , 'librun.lib'),
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
    92
]
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
    94
def cleanup_stc
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
    95
  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
    96
    puts 'Cleaning up stc...'
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    97
    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
    98
      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
    99
    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
   100
      # 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
   101
      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
   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
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   105
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   106
def cleanup_librun
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   107
  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
   108
    puts 'Cleaning up librun...'
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   109
    begin
188
02b7bd705334 Rakefiles: fixed bug in `cleanup_librun()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 181
diff changeset
   110
      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
   111
    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
   112
      # 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
   113
      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
   114
    end
0
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
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   117
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   118
namespace :compile do
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   119
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   120
  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
   121
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   122
  task :pre
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   123
  task :post
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   124
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   125
  task :prereq => %i(setup)
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   126
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   127
  task :main => %i(
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   128
      config
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   129
      stc
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   130
      librun
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   131
      application
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   132
  )
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   133
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   134
  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
   135
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   136
  directory STX_TOP_DIR / 'include'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   137
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   138
  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
   139
650412e81596 Automatically extract package dependencies from project definition file
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
   140
138
Patrik Svestka <patrik.svestka@gmail.com>
parents: 137 136
diff changeset
   141
  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
   142
  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
   143
  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
   144
  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
   145
122
6fcb351d23a7 Use our own make configuration files rather than eXept's
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
   146
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   147
  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
   148
    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
   149
  end
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   150
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
   151
  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
   152
    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
   153
    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
   154
      f.puts "BUILD_TARGET ?= #{BUILD_TARGET}"
246
687c4889e2e6 Rakefiles: allow to specify C compiler on a command line / in environment
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 237
diff changeset
   155
      if ENV['CC'] != nil then
687c4889e2e6 Rakefiles: allow to specify C compiler on a command line / in environment
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 237
diff changeset
   156
        f.puts "ifeq ($(origin CC),default)"
687c4889e2e6 Rakefiles: allow to specify C compiler on a command line / in environment
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 237
diff changeset
   157
        f.puts "  CC = #{CC}"
687c4889e2e6 Rakefiles: allow to specify C compiler on a command line / in environment
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 237
diff changeset
   158
        f.puts "endif"
232
85c422506875 Makefiles: allow to specify C compiler on a command line
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 204
diff changeset
   159
      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
   160
    end
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   161
  end
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   162
234
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   163
  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
   164
    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
   165
      chdir BUILD_DIR / 'stx' / 'rules' do
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   166
        # 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
   167
        # paths. Sigh,     
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   168
        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
   169
      end
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   170
    end
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   171
  end
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   172
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   173
  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
   174
    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
   175
    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
   176
      f.puts <<-CONTENTS      
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   177
# 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
   178
#
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   179
!IF !defined(TOP) 
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   180
TOP=#{top}
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   181
!ENDIF
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   182
MAKELIB = $(TOP)\\..\\..\\makelib
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   183
!INCLUDE $(MAKELIB)\\definitions-w.make
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   184
CONTENTS
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   185
    end
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   186
  end
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   187
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   188
  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
   189
    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
   190
    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
   191
      f.puts <<-CONTENTS      
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   192
# 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
   193
#
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   194
!IF !defined(TOP) 
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   195
TOP=#{top}
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   196
!ENDIF
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   197
MAKELIB = $(TOP)\\..\\..\\makelib
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   198
!INCLUDE $(MAKELIB)\\rules-w.make
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   199
CONTENTS
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   200
    end        
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   201
  end
05943c900d5e Rakefiles: added new target `artifacts:source`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 232
diff changeset
   202
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   203
  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
   204
    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
   205
      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
   206
    end
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   207
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   208
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   209
  task :stc do
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   210
    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
   211
      begin
169
f9f519bb10b6 Use GNU target triplets to specify build targets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 168
diff changeset
   212
        make
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   213
        cleanup_stc
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   214
      rescue Exception => e
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   215
        cleanup_stc
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   216
        cleanup_librun
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   217
        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
   218
      end
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   219
    end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   220
138
Patrik Svestka <patrik.svestka@gmail.com>
parents: 137 136
diff changeset
   221
    (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
   222
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   223
    unless File.exist? STC
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   224
      cleanup_stc
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   225
      cleanup_librun
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   226
      error 'Cannot compile stx:stc'
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   227
    end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   228
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   229
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   230
  task :librun do
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   231
    chdir STX_TOP_DIR / 'librun' do
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   232
      begin
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   233
        begin
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   234
          if win32_wine?
138
Patrik Svestka <patrik.svestka@gmail.com>
parents: 137 136
diff changeset
   235
            (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
   236
          end
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   237
          # 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
   238
          # 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
   239
          # 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
   240
          (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
   241
          make
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   242
          cleanup_librun
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   243
        rescue Exception => e
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   244
          cleanup_stc
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   245
          cleanup_librun
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 122
diff changeset
   246
          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
   247
        end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   248
      end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   249
    end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   250
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   251
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   252
  if unix?
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   253
    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
   254
    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
   255
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   256
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   257
  if win32? and TOOLCHAIN == 'bcc'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   258
    directory STX_TOP_DIR / 'lib' / 'bc'
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   259
    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
   260
  end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   261
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   262
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   263
133
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   264
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
   265
97
33cf3197acb5 Added hack for compiling 32bit stx:libdb/libodbc on 64bit Linux
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   266
#
33cf3197acb5 Added hack for compiling 32bit stx:libdb/libodbc on 64bit Linux
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   267
# 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
   268
#
133
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   269
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
   270
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
   271
  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
   272
  if unix?
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   273
    # 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
   274
    # 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
   275
    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
   276
    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
   277
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   278
    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
   279
      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
   280
      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
   281
    end
181
3aaf65a5541c Rakefiles: removed tasks to build VOGL
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   282
  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
   283
    # 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
   284
    # 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
   285
    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
   286
    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
   287
    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
   288
      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
   289
    end
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   290
  end
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   291
  task.reenable()
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   292
end
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   293
97
33cf3197acb5 Added hack for compiling 32bit stx:libdb/libodbc on 64bit Linux
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 94
diff changeset
   294
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
   295
  # 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
   296
  # 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
   297
  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
   298
	  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
   299
  end
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   300
end
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   301
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
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   304
133
8229af6e81df Rakefiles: update VM's symbol database after a package compiled
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 122
diff changeset
   305