forked from lcompilers/lpython
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xsh
executable file
·62 lines (53 loc) · 2.16 KB
/
build.xsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env xonsh
# A platform independent Xonsh script to build LFortran. Works on Linux, macOS
# and Windows. The prerequisites such as bison, re2c or cython must be already
# installed.
#
# Some issues (with Xonsh):
#
# * Some output seems to be lost on Windows
# (https://github.com/xonsh/xonsh/issues/3291)
#
# * The commands that are executed are sometimes printed after the output,
# which makes the log unreadable (https://github.com/xonsh/xonsh/issues/3293)
#
# * This script is too slow (due to https://github.com/xonsh/xonsh/issues/3064)
# to be suitable for day to day development, but on the CI the few extra
# seconds do not matter much
$RAISE_SUBPROC_ERROR = True
trace on
echo "CONDA_PREFIX=$CONDA_PREFIX"
echo "PATH=$PATH"
llvm-config --components
# Generate the `version` file
bash ci/version.sh
# Generate a Fortran ASR from ASR.asdl (C++)
python grammar/asdl_cpp.py grammar/ASR.asdl src/libasr/asr.h
# Generate a Python AST from Python.asdl (C++)
python grammar/asdl_cpp.py grammar/Python.asdl src/lpython/python_ast.h
# Generate a Python AST from Python.asdl (Python)
python grammar/asdl_py.py
$lpython_version=$(cat version).strip()
$dest="lpython-" + $lpython_version
bash ci/create_source_tarball0.sh
tar xzf dist/lpython-$lpython_version.tar.gz
cd lpython-$lpython_version
mkdir test-bld
cd test-bld
# Note: we have to build in Release mode on Windows, because `llvmdev` is
# compiled in Release mode and we get link failures if we mix and match build
# modes:
BUILD_TYPE = "Release"
cmake -G $LFORTRAN_CMAKE_GENERATOR -DCMAKE_VERBOSE_MAKEFILE=ON -DWITH_LLVM=yes -DWITH_XEUS=yes -DCMAKE_PREFIX_PATH=$CONDA_PREFIX -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DWITH_LFORTRAN_BINARY_MODFILES=no -DCMAKE_BUILD_TYPE=@(BUILD_TYPE) ..
cmake --build . --target install
./src/lpython/tests/test_lfortran
#./src/bin/lpython < ../src/bin/example_input.txt
ctest --output-on-failure
cpack -V
cd ../..
jupyter kernelspec list --json
cp lpython-$lpython_version/test-bld/src/bin/lpython src/bin
if $WIN == "1":
cp lpython-$lpython_version/test-bld/src/runtime/lfortran_runtime* src/runtime/
else:
cp lpython-$lpython_version/test-bld/src/runtime/liblfortran_runtime* src/runtime/