update readme #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 libqalculate cache | |
id: cache-libqalculate | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/opt/lib | |
~/opt/include | |
key: libqalculate-${{env.LIBQALCULATE_VERSION}}-em${{env.EM_VERSION}}-${{ runner.os }} | |
- name: Setup emsdk cache | |
if: steps.cache-libqalculate.outputs.cache-hit != 'true' | |
id: cache-system-libraries | |
uses: actions/cache@v2 | |
with: | |
path: ${{env.EM_CACHE_FOLDER}} | |
key: ${{env.EM_VERSION}}-${{ runner.os }} | |
- name: Setup libqalculate prerequisite cache | |
if: steps.cache-libqalculate.outputs.cache-hit != 'true' | |
id: cache-prerequisites | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/opt-prerequisites/lib | |
~/opt-prerequisites/include | |
key: prerequisites-gmp${{env.GMP_VERSION}}-mpfr${{env.MPFR_VERSION}}-libxml2${{env.LIBXML2_VERSION}}-em${{env.EM_VERSION}}-${{ runner.os }} | |
- name: Setup emsdk | |
if: steps.cache-libqalculate.outputs.cache-hit != 'true' | |
uses: mymindstorm/setup-emsdk@v14 | |
with: | |
version: ${{env.EM_VERSION}} | |
actions-cache-folder: ${{env.EM_CACHE_FOLDER}} | |
- name: Setup GMP, MPFR & libxml2 | |
if: steps.cache-libqalculate.outputs.cache-hit != 'true' && steps.cache-prerequisites.outputs.cache-hit != 'true' | |
run: | | |
sudo apt install -y build-essential lzip binutils autoconf intltool libtool automake lbzip2 lzip | |
mkdir -p ~/opt-prerequisites/src | |
cd ~/opt-prerequisites/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-prerequisites | |
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-prerequisites --with-gmp=${HOME}/opt-prerequisites | |
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-prerequisites --disable-shared --without-python | |
make | |
make install | |
ln -s ${HOME}/opt-prerequisites/include/libxml2/libxml ${HOME}/opt-prerequisites/include/libxml | |
cd .. | |
- name: Setup libqalculate | |
if: steps.cache-libqalculate.outputs.cache-hit != 'true' | |
run: | | |
sudo apt install -y build-essential lzip binutils autoconf intltool libtool automake lbzip2 lzip | |
mkdir -p ~/opt/src | |
cd ~/opt/src | |
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} | |
export NOCONFIGURE=1 | |
export NO_AUTOMAKE=1 | |
./autogen.sh | |
export LIBXML_LIBS="-L${HOME}/opt-prerequisites/lib -lxml2" | |
export LIBXML_CFLAGS="-I${HOME}/opt-prerequisites/include" | |
emconfigure ./configure --prefix=${HOME}/opt CPPFLAGS=-I${HOME}/opt-prerequisites/include LDFLAGS=-L${HOME}/opt-prerequisites/lib --without-libcurl --without-icu --enable-compiled-definitions --disable-nls --disable-shared | |
make | |
make install | |
cd .. |