-
Notifications
You must be signed in to change notification settings - Fork 0
/
dune
131 lines (119 loc) · 7.3 KB
/
dune
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
(ocamllex
(modules lexer)
)
(menhir
(modules mfcalc)
(flags -la 2)
)
(executable
(name openstellina)
(modes js)
(modules_without_implementation calc target)
(modules target horizons simbad search jsoo_alt_az error_dialog error_status target_selector version secure geolocate comets table_update utils location tabbed_dialog altaz astro_utils trans hidemsg msgs messier_catalogue calc mfcalc lexer expr abell_cnv telescope base_locations openstellina)
(libraries js_of_ocaml-lwt js_of_ocaml-tyxml yojson base64 cohttp-lwt-jsoo xml-light js_of_ocaml unix str)
(preprocess (pps lwt_ppx js_of_ocaml-ppx))
)
(rule
(alias build_js)
(targets my_program.js my_program.wasm)
(deps src/listTools/ltMemory.c src/listTools/ltStringProc.c src/listTools/ltDict.c src/listTools/ltList.c src/partial_file.c src/settings/settings.c src/argparse/argparse.c src/coreUtils/makeRasters.c src/coreUtils/errorReport.c src/coreUtils/asciiDouble.c src/main.c src/ephemCalc/jpl.c src/ephemCalc/magnitudeEstimate.c src/ephemCalc/meeus.c src/ephemCalc/orbitalElements.c src/ephemCalc/constellations.c src/mathsTools/precess_equinoxes.c src/mathsTools/sphericalAst.c src/mathsTools/julianDate.c src/asteroids.c)
(action (progn
(run sh -c "emcc ../../src/main.c -I ../../src -I ../../gsl-2.8 -D DEBUG=0 -D MEMDEBUG1=0 -D MEMDEBUG2=0 -D DCFVERSION=4.0 -D DATE=26/11/2024 -D DATADIR=\\\"data\\\" ../../src/partial_file.c ../../src/argparse/argparse.c ../../src/coreUtils/asciiDouble.c ../../src/coreUtils/errorReport.c ../../src/coreUtils/makeRasters.c ../../src/ephemCalc/magnitudeEstimate.c ../../src/ephemCalc/jpl.c ../../src/ephemCalc/orbitalElements.c ../../src/listTools/ltDict.c ../../src/listTools/ltList.c ../../src/listTools/ltMemory.c ../../src/listTools/ltStringProc.c ../../src/mathsTools/julianDate.c ../../src/mathsTools/precess_equinoxes.c ../../src/mathsTools/sphericalAst.c ../../src/settings/settings.c ../../gsl-2.8/sys/infnan.c ../../gsl-2.8/sys/pow_int.c ../../gsl-2.8/sys/hypot.c ../../gsl-2.8/sys/fdiv.c ../../gsl-2.8/err/error.c ../../gsl-2.8/err/stream.c -lm \
-s WASM=1 -s EXPORTED_FUNCTIONS=[_myFunction,_myFloat,_myAscii,_main,_malloc] \
-s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB \
-s STACK_SIZE=1048576 -s FORCE_FILESYSTEM=1 \
-s FETCH=1 -s EXIT_RUNTIME=0 \
-s 'EXPORTED_RUNTIME_METHODS=[\"FS\",\"ccall\", \"cwrap\" ]' -o my_program.js")
)))
(rule
(alias generate_binary)
(targets ephem_test.exe)
(deps src/listTools/ltMemory.c src/listTools/ltStringProc.c src/listTools/ltDict.c src/listTools/ltList.c src/partial_file.c src/settings/settings.c src/argparse/argparse.c src/coreUtils/makeRasters.c src/coreUtils/errorReport.c src/coreUtils/asciiDouble.c src/main.c src/ephemCalc/jpl.c src/ephemCalc/magnitudeEstimate.c src/ephemCalc/meeus.c src/ephemCalc/orbitalElements.c src/ephemCalc/constellations.c src/mathsTools/precess_equinoxes.c src/mathsTools/sphericalAst.c src/mathsTools/julianDate.c src/asteroids.c)
(action
(progn
(run sh -c "cc -Wall -Wno-unknown-pragmas -g -I ../../src -I ../../gsl-2.8 -D myfclose=fclose -D myfeof=feof -D myferror=ferror -D myfopen=fopen -D myfread=fread -D myfseek=fseek -D myftell=ftell -D MYFILE=FILE -D DEBUG=1 -D MEMDEBUG1=0 -D MEMDEBUG2=0 -D DCFVERSION=\\\"4.0\\\" -D DATE=\\\"23/09/2024\\\" -D DATADIR=\\\"../../data\\\" ../../src/argparse/argparse.c ../../src/coreUtils/asciiDouble.c ../../src/coreUtils/errorReport.c ../../src/coreUtils/makeRasters.c ../../src/ephemCalc/magnitudeEstimate.c ../../src/ephemCalc/jpl.c ../../src/ephemCalc/orbitalElements.c ../../src/listTools/ltDict.c ../../src/listTools/ltList.c ../../src/listTools/ltMemory.c ../../src/listTools/ltStringProc.c ../../src/mathsTools/julianDate.c ../../src/mathsTools/precess_equinoxes.c ../../src/mathsTools/sphericalAst.c ../../src/settings/settings.c ../../src/main.c -o ephem_test.exe ../../gsl-2.8/sys/infnan.c ../../gsl-2.8/sys/pow_int.c ../../gsl-2.8/sys/hypot.c ../../gsl-2.8/sys/fdiv.c ../../gsl-2.8/err/error.c ../../gsl-2.8/err/stream.c -lm"))))
(rule
(alias generate_dcfbin)
(targets dcfbinary.cmt dcfbinary.430 dcfbinary.plt)
(deps ephem_test.exe)
(action
(progn
(run ln -s ../../data/dcfbinary.cmt)
(run ln -s ../../data/dcfbinary.plt)
(run ln -s ../../data/dcfbinary.430)
(run ./ephem_test.exe --use_orbital_elements=1 --jd_min=2451544.5 --jd_max=2451544.6 --jd_step=1 --objects=mars)
(run ./ephem_test.exe --jd_min=2451544.5 --jd_max=2451544.6 --jd_step=1 --objects=1P/Halley)
)))
(rule
(targets version.ml)
(deps (universe))
(action
(with-stdout-to
%{targets}
(bash "git rev-parse HEAD > git_rev.txt \
&& git log -1 --format='%an' > git_author.txt \
&& date > build_date.txt \
&& echo '(* Auto-generated by dune *)\n' \
'let version = \"openstellina-%%VERSION%%\"\n' \
'let git_commit = \"%%GIT_COMMIT%%\"\n' \
'let git_author = \"%%GIT_AUTHOR%%\"\n' \
'let build_date = \"%%BUILD_DATE%%\"\n' \
| sed -e s/%%VERSION%%/2.004/ -e \"s/%%GIT_COMMIT%%/$(cat git_rev.txt)/\" -e \"s/%%GIT_AUTHOR%%/$(cat git_author.txt)/\" -e \"s/%%BUILD_DATE%%/$(cat build_date.txt)/\""))))
(rule
(alias deploy)
(deps openstellina.bc.js my_program.js my_program.wasm index.html dcfbinary.cmt dcfbinary.430 dcfbinary.plt)
(action
(progn
(run mkdir -p %{env:DEPLOY_PATH=../../docs}/js)
(run mkdir -p %{env:DEPLOY_PATH=../../docs}/data)
(run cp -f openstellina.bc.js %{env:DEPLOY_PATH=../../docs}/js/)
(run cp -f my_program.js my_program.wasm %{env:DEPLOY_PATH=../../docs}/js/)
(run cp -f ../../data/header.430 ../../data/dcfbinary.430 ../../data/dcfbinary.cmt ../../data/dcfbinary.plt ../../catalog.txt ../../data/table3.dat ../../data/ngc2000.dat %{env:DEPLOY_PATH=../../docs}/data/)
(run cp -f index.html %{env:DEPLOY_PATH=../../docs}/)
)))
(rule
(alias remote)
(deps openstellina.bc.js my_program.js my_program.wasm index.html dcfbinary.cmt dcfbinary.430 dcfbinary.plt)
(action
(progn
(run mkdir -p %{env:DEPLOY_PATH=../../www/openstellina}/js)
(run mkdir -p %{env:DEPLOY_PATH=../../www/openstellina}/data)
(run cp -f openstellina.bc.js %{env:DEPLOY_PATH=../../www/openstellina}/js/)
(run cp -f my_program.js my_program.wasm %{env:DEPLOY_PATH=../../www/openstellina}/js/)
(run cp -f ../../data/header.430 ../../data/dcfbinary.430 ../../data/dcfbinary.cmt ../../data/dcfbinary.plt ../../catalog.txt ../../data/table3.dat ../../data/ngc2000.dat %{env:DEPLOY_PATH=../../www/openstellina}/data/)
(run cp -f index.html %{env:DEPLOY_PATH=../../www/openstellina}/)
(run rsync ../../favicon.ico kimmitt.co.uk:/var/www)
(run rsync -az ../../www/openstellina/ kimmitt.co.uk:/var/www/openstellina)
)))
(rule
(target index.html)
(action
(with-stdout-to
%{target}
(echo "<!DOCTYPE html>
<html>
<head>
<meta charset=\"utf-8\">
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
<title>OpenStellina</title>
</head>
<body>
<div id=\"openstellina\"></div>
<script src=\"js/my_program.js\"></script>
<script src=\"js/openstellina.bc.js\"></script>
</body>
</html>
"))))
(alias
(name default)
(deps openstellina.bc.js my_program.js my_program.wasm index.html)
)
(env
(dev
(flags (:standard -g -w -16 -w -32 -w -52 -w -21 -w -26 -w -27 -w -37 -w -11 -w -33))
(js_of_ocaml
(compilation_mode whole_program)
(flags --pretty --disable genprim --noinline --debug-info)
)
)
)