1*6dbdd20aSAndroid Build Coastguard Worker# Copyright (C) 2021 The Android Open Source Project 2*6dbdd20aSAndroid Build Coastguard Worker# 3*6dbdd20aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); 4*6dbdd20aSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License. 5*6dbdd20aSAndroid Build Coastguard Worker# You may obtain a copy of the License at 6*6dbdd20aSAndroid Build Coastguard Worker# 7*6dbdd20aSAndroid Build Coastguard Worker# http://www.apache.org/licenses/LICENSE-2.0 8*6dbdd20aSAndroid Build Coastguard Worker# 9*6dbdd20aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 10*6dbdd20aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, 11*6dbdd20aSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*6dbdd20aSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and 13*6dbdd20aSAndroid Build Coastguard Worker# limitations under the License. 14*6dbdd20aSAndroid Build Coastguard Worker 15*6dbdd20aSAndroid Build Coastguard Worker# This is the init script that is passed to `emcc --em-config=.emscripten` 16*6dbdd20aSAndroid Build Coastguard Worker# (Wasm toolchain). It sets vars to locate the various emsdk / llvm dirs. 17*6dbdd20aSAndroid Build Coastguard Worker 18*6dbdd20aSAndroid Build Coastguard Workerimport os 19*6dbdd20aSAndroid Build Coastguard Workerimport sys 20*6dbdd20aSAndroid Build Coastguard Workerfrom platform import system 21*6dbdd20aSAndroid Build Coastguard Worker 22*6dbdd20aSAndroid Build Coastguard Worker# We cannot use __file__ here. 23*6dbdd20aSAndroid Build Coastguard Workerthis_file = os.getenv('EM_CONFIG') 24*6dbdd20aSAndroid Build Coastguard Workerif this_file is None: 25*6dbdd20aSAndroid Build Coastguard Worker sys.stderr.write('Could not find EM_CONFIG in .emscripten\n') 26*6dbdd20aSAndroid Build Coastguard Worker sys.exit(1) 27*6dbdd20aSAndroid Build Coastguard Worker 28*6dbdd20aSAndroid Build Coastguard Workerroot_dir = os.path.dirname(os.path.dirname(os.path.dirname(this_file))) 29*6dbdd20aSAndroid Build Coastguard Workerbuildools_os = 'mac' if system().lower() == 'darwin' else 'linux64' 30*6dbdd20aSAndroid Build Coastguard Workernode_path = os.path.join(root_dir, 'buildtools', buildools_os, 'nodejs') 31*6dbdd20aSAndroid Build Coastguard Workeremsdk_path = os.path.join(root_dir, 'buildtools', buildools_os, 'emsdk') 32*6dbdd20aSAndroid Build Coastguard Worker 33*6dbdd20aSAndroid Build Coastguard Worker# Exported vars. 34*6dbdd20aSAndroid Build Coastguard WorkerNODE_JS = os.path.join(node_path, 'bin', 'node') 35*6dbdd20aSAndroid Build Coastguard WorkerLLVM_ROOT = os.path.join(emsdk_path, 'bin') 36*6dbdd20aSAndroid Build Coastguard WorkerBINARYEN_ROOT = emsdk_path 37*6dbdd20aSAndroid Build Coastguard WorkerEMSCRIPTEN_ROOT = os.path.join(emsdk_path, 'emscripten') 38*6dbdd20aSAndroid Build Coastguard WorkerCOMPILER_ENGINE = NODE_JS 39*6dbdd20aSAndroid Build Coastguard WorkerJS_ENGINES = [NODE_JS] 40