forked from flintlib/python-flint
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyodide_build_dependencies.sh
More file actions
executable file
·126 lines (95 loc) · 2.79 KB
/
pyodide_build_dependencies.sh
File metadata and controls
executable file
·126 lines (95 loc) · 2.79 KB
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
#!/bin/bash
set -e
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
echo "bin/pyodide_build_dependencies.sh [options]"
echo
echo "Build local emscripten installs of python-flint's dependencies."
echo
echo "Supported options:"
echo " --help - show this help message"
echo " --wasm-library-dir <WASM_LIBRARY_DIR> - directory to install libraries"
echo " --flint-commit <FLINT_COMMIT> - flint commit to build"
echo
exit
;;
--wasm-library-dir)
# e.g. --wasm-library-dir /path/to/wasm-library-dir
WASM_LIBRARY_DIR="$2"
shift
shift
;;
--flint-commit)
# e.g. --flint-commit 3.3.1
FLINT_COMMIT="$2"
shift
shift
;;
*)
2>&1 echo "unrecognised argument:" $key
exit 1
;;
esac
done
if [ -z "$WASM_LIBRARY_DIR" ]; then
echo "WASM_LIBRARY_DIR not set"
exit 1
fi
# Sets versions of GMP, MPFR and FLINT:
source bin/build_variables.sh
# Download mirrored copy of source distributions for GMP and MPFR
git clone https://github.com/oscarbenjamin/gmp_mirror.git
cp gmp_mirror/gmp-$GMPVER.tar.xz .
cp gmp_mirror/mpfr-$MPFRVER.tar.gz .
tar -xf gmp-$GMPVER.tar.xz
tar -xf mpfr-$MPFRVER.tar.gz
# ---------------------------Build GMP ----------------------------------#
cd gmp-$GMPVER
emconfigure ./configure \
--disable-dependency-tracking \
--host none \
--disable-shared \
--enable-static \
--enable-cxx \
--prefix=$WASM_LIBRARY_DIR
emmake make -j $(nproc)
emmake make install
cd ..
# ---------------------------Build MPFR ----------------------------------#
cd mpfr-$MPFRVER
emconfigure ./configure \
--disable-dependency-tracking \
--disable-shared \
--with-gmp=$WASM_LIBRARY_DIR \
--prefix=$WASM_LIBRARY_DIR
emmake make -j $(nproc)
emmake make install
cd ..
# ---------------------------Build FLINT----------------------------------#
if [ -z "$FLINT_COMMIT" ]; then
curl -O -L https://github.com/flintlib/flint/releases/download/v$FLINTVER/flint-$FLINTVER.tar.gz
tar xf flint-$FLINTVER.tar.gz
cd flint-$FLINTVER
else
git clone https://github.com/flintlib/flint --branch $FLINT_COMMIT
cd flint
fi
# Patch needed for FLINT == 3.4.0
# This is https://github.com/flintlib/flint/pull/2594
patch -N -Z -p1 < ../bin/patch-flint-emscripten-profiler.diff
./bootstrap.sh
emconfigure ./configure \
--disable-dependency-tracking \
--disable-shared \
--prefix=$WASM_LIBRARY_DIR \
--with-gmp=$WASM_LIBRARY_DIR \
--with-mpfr=$WASM_LIBRARY_DIR \
--host=wasm32-unknown-emscripten \
--disable-assembly \
--disable-pthread
emmake make -j $(nproc)
emmake make install
cd ..