-
Notifications
You must be signed in to change notification settings - Fork 4
94 lines (82 loc) · 4.03 KB
/
compile-libqalculate.yml
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
name: Compile libqalculate
on:
workflow_dispatch:
push:
branches:
- main
- libqalculate-compile
env:
GMP_VERSION: 6.3.0
MPFR_VERSION: 4.2.1
LIBXML2_VERSION: 2.9.12
LIBQALCULATE_VERSION: 5.2.0
EM_VERSION: 3.1.67
EM_CACHE_FOLDER: 'emsdk-cache'
jobs:
compile:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎
uses: actions/checkout@v4
- name: Setup emsdk cache
id: cache-system-libraries
uses: actions/cache@v2
with:
path: ${{env.EM_CACHE_FOLDER}}
key: ${{env.EM_VERSION}}-${{ runner.os }}
- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{env.EM_VERSION}}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
- name: Setup dependency cache
id: cache-dependencies
uses: actions/cache@v2
with:
path: |
~/opt/lib
~/opt/include
key: ${{env.LIBQALCULATE_VERSION}}-gmp${{env.GMP_VERSION}}-mpfr${{env.MPFR_VERSION}}-libxml2${{env.LIBXML2_VERSION}}-em${{env.EM_VERSION}}-${{ runner.os }}
- name: Setup dependencies
run: |
sudo apt install build-essential lzip binutils autoconf intltool libtool automake lbzip2 lzip
mkdir -p ~/opt/src
cd ~/opt/src
wget https://ftp.gnu.org/gnu/gmp/gmp-${GMP_VERSION}.tar.lz
tar xf gmp-${GMP_VERSION}.tar.lz
cd gmp-${GMP_VERSION}
emconfigure ./configure --disable-assembly --host none --enable-cxx --prefix=${HOME}/opt # no, the "none" host is not obsolete.
make
make install
cd ..
wget https://ftp.gnu.org/gnu/mpfr/mpfr-${MPFR_VERSION}.tar.xz
# wget https://www.mpfr.org/mpfr-current/allpatches # if available
tar xf mpfr-${MPFR_VERSION}.tar.xz
cd mpfr-${MPFR_VERSION}
emconfigure ./configure --prefix=${HOME}/opt --with-gmp=${HOME}/opt
make
make install
cd ..
wget http://xmlsoft.org/download/libxml2-${LIBXML2_VERSION}.tar.gz -O libxml2-${LIBXML2_VERSION}.tar.gz
tar xf libxml2-${LIBXML2_VERSION}.tar.gz
cd libxml2-${LIBXML2_VERSION}
emconfigure ./configure --prefix=${HOME}/opt --disable-shared --without-python
make
make install
ln -s ${HOME}/opt/include/libxml2/libxml ${HOME}/opt/include/libxml
cd ..
wget https://github.com/Qalculate/libqalculate/archive/refs/tags/v${LIBQALCULATE_VERSION}.tar.gz -O libqalculate-${LIBQALCULATE_VERSION}.tar.gz
tar xf libqalculate-${LIBQALCULATE_VERSION}.tar.gz
cd libqalculate-${LIBQALCULATE_VERSION}
# the following command is supposed to fail, since it's also running the configure script
./autogen.sh || true
sed -i 's/PKG_CHECK_MODULES(LIBCURL, libcurl)/#PKG_CHECK_MODULES(LIBCURL, libcurl)/' configure
sed -i 's/PKG_CHECK_MODULES(ICU, icu-uc)/#PKG_CHECK_MODULES(ICU, icu-uc)/' configure
sed -i 's/PKG_CHECK_MODULES(LIBXML, libxml-2.0/#PKG_CHECK_MODULES(LIBXML, libxml-2.0/' configure
sed -i 's/#define HAVE_LIBCURL 1//' configure
sed -i 's/#define HAVE_ICU 1//' configure
sed -i 's/#define HAVE_PIPE2 1/#define HAVE_PIPE2 0/' configure
emconfigure ./configure --prefix=${HOME}/opt CPPFLAGS=-I${HOME}/opt/include LDFLAGS="-L${HOME}/opt/lib -lxml2" --without-libcurl --enable-compiled-definitions --disable-nls --disable-shared
make
make install
cd ..