Fixing build to tolerate some missing dependencies.

Be able to build without nodejs and d8.
This commit is contained in:
Brad Nelson
2024-02-24 10:03:09 -08:00
parent aa69b68412
commit f9d1b6102f
3 changed files with 38 additions and 22 deletions

View File

@ -111,11 +111,14 @@ WIN_LFLAGS64 = [
'/LIBPATH:"c:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/ucrt/x64"',
] + WIN_LIBS
WEB_ENABLED = False
PICO_ICE_ENABLED = False
WINDOWS_ENABLED = False
D8_AVAILABLE = False
D8 = 'UNSUPPORTED'
WINDOWS_ENABLED = False
WINTMP = '/UNSUPPORTED'
ARDUINO_CLI = 'UNSUPPORTED'
WIN_CL32 = 'UNSUPPORTED'
WIN_CL64 = 'UNSUPPORTED'
WIN_LINK32 = 'UNSUPPORTED'
@ -123,6 +126,8 @@ WIN_LINK64 = 'UNSUPPORTED'
WIN_RC32 = 'UNSUPPORTED'
WIN_RC64 = 'UNSUPPORTED'
ARDUINO_CLI = 'UNSUPPORTED'
# Mutable global state.
build_files = []
output = ''
@ -169,24 +174,26 @@ def DetectWindowsTools(args):
def DetectGenericTools(args):
global D8, NODEJS, PICO_ICE_ENABLED
global D8, D8_AVAILABLE, WEB_ENABLED, PICO_ICE_ENABLED
try:
D8 = LSQ('${HOME}/src/v8/v8/out/x64.release/d8')
D8_AVAILABLE = True
except:
if not args.quiet:
sys.stderr.write('V8 checkout in $HOME/src/v8 not found, ignoring.\n')
sys.stderr.write('V8 checkout in $HOME/src/v8 not found, '
'disabling asm.js tests.\n')
try:
NODEJS = LSQ('/usr/bin/nodejs')
LSQ('/usr/bin/nodejs')
WEB_ENABLED = True
except:
if not args.quiet:
sys.stderr.write('/usr/bin/nodejs not found, required!\n')
sys.exit(1)
sys.stderr.write('/usr/bin/nodejs not found, disabling web.\n')
try:
LSQ('/usr/bin/arm-none-eabi-gcc')
PICO_ICE_ENABLED = True
except:
if not args.quiet:
sys.stderr.write('Missing package gcc-arm-none-eabi, pico-ice diabled!\n')
sys.stderr.write('Missing package gcc-arm-none-eabi, pico-ice disabled.\n')
def FastOption():
@ -232,7 +239,6 @@ WIN_RC32 = {WIN_RC32}
WIN_RC64 = {WIN_RC64}
D8 = {D8}
NODEJS = {NODEJS}
WIN_CFLAGS = {' '.join(WIN_CFLAGS)}
WIN_LFLAGS32 = {' '.join(WIN_LFLAGS32)}

View File

@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if not WEB_ENABLED:
Return()
OPTIONS = '-I $src/site'
UE_OPTIONS = OPTIONS + ' -DFORTH=uEForth'
ESP_OPTIONS = OPTIONS + ' -DFORTH=ESP32forth'

View File

@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if not WEB_ENABLED:
Return()
Importation('$dst/gen/web_boot.js', '$src/web/web_boot.fs', header_mode='web', name='boot')
Compile('$dst/gen/dump_web_opcodes', '$src/web/dump_web_opcodes.c')
GenRun('$dst/gen/web_cases.js', '$dst/gen/dump_web_opcodes', 'cases', [])
@ -31,21 +34,25 @@ WEB_ITEMS = [
Copy('$dst/web/script_lite_test.html', '$src/web/script_lite_test.html'),
Copy('$dst/web/script_test.html', '$src/web/script_test.html'),
Copy('$dst/web/script_test.fs', '$src/web/script_test.fs'),
TestCommand('$dst/tests/web_sanity_test.out',
' '.join([
'$dst/web/ueforth.js',
'$src/tools/check_web_sanity.py',
]),
'echo "120 3 + . cr bye" | ' + D8 + ' $dst/web/ueforth.js | '
'$src/tools/check_web_sanity.py $dst/tests/web_sanity_test.out'),
]
if D8_AVAILABLE:
WEB_ITEMS += [
TestCommand('$dst/tests/web_sanity_test.out',
' '.join([
'$dst/web/ueforth.js',
'$src/tools/check_web_sanity.py',
]),
'echo "120 3 + . cr bye" | ' + D8 + ' $dst/web/ueforth.js | '
'$src/tools/check_web_sanity.py ' +
'$dst/tests/web_sanity_test.out'),
]
Alias('web', ' '.join(WEB_ITEMS))
Default('web')
D8 = '~/src/v8/v8/out/x64.release/d8 $dst/web/ueforth.js'
OneShot('d8',
'$dst/web/ueforth.js',
D8 + ' $in',
pool='console')
if D8_AVAILABLE:
OneShot('d8',
'$dst/web/ueforth.js',
D8 + ' $dst/web/ueforth.js $in',
pool='console')