Commit a93156c6 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Added script for installing tinyxml2 if it is not available on the system

parent f7a02fa8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -178,6 +178,9 @@ if [[ ${CMAKE_ONLY} == "yes" ]]; then
   exit 0
fi

# install dependencies into $PREFIX if they are not found system-wide
pkg-config --exists tinyxml2 || "$ROOT_DIR/scripts/install_tinyxml2" --prefix "$PREFIX"

# get the number of physical cores present on the system, even with multiple NUMA nodes
# see https://unix.stackexchange.com/a/279354
SYSTEM_CORES=$(lscpu --all --parse=CORE,SOCKET | grep -Ev "^#" | sort -u | wc -l)
+35 −0
Original line number Diff line number Diff line
#!/bin/bash

# exit as soon as there is an error
set -e

PREFIX=${HOME}/.local
for option in "$@"; do
    case $option in
        --prefix=*) PREFIX="${option#*=}" ;;
    esac
done

pkgname=tinyxml2
pkgver=8.0.0
url="https://github.com/leethomason/$pkgname/archive/$pkgver.tar.gz"
sha256sum='6ce574fbb46751842d23089485ae73d3db12c1b6639cda7721bf3a7ee862012c'

# prepare
mkdir -p "build-$pkgname"
pushd "build-$pkgname"

if [[ ! -f "$pkgver.tar.gz" ]]; then
   curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o "$pkgver.tar.gz" "$url"
fi
echo -e "$sha256sum\t$pkgver.tar.gz" > "$pkgname.checksum"
sha256sum --check "$pkgname.checksum"
tar -xf "$pkgver.tar.gz"

# build and install
cmake ./$pkgname-$pkgver \
   -DCMAKE_INSTALL_PREFIX="$PREFIX" \
   -DCMAKE_INSTALL_LIBDIR=lib \
   -DCMAKE_BUILD_TYPE=Release
make
make install