From becbc7adb37eeb7a6858458beb240259abf03d6d Mon Sep 17 00:00:00 2001 From: sigmaboy Date: Sun, 21 Apr 2019 13:41:47 +0200 Subject: [PATCH] Linux build script enhanced * now checks requirements for openSUSE --- build_linux.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/build_linux.sh b/build_linux.sh index 6166d0f..c262e26 100644 --- a/build_linux.sh +++ b/build_linux.sh @@ -1,2 +1,43 @@ +#!/bin/sh +HERE="$(dirname "$(readlink -f "${0}")")" + +# get distribution +if [ -e "/etc/os-release" ] +then + DISTRO=$(grep "^ID=" "/etc/os-release" | cut -d"=" -f2| sed 's/"//g') + DISTRO_VERSION=$(grep "^VERSION_ID=" "/etc/os-release" | cut -d"=" -f2) +else + echo "Linux distribution not found." + echo "Maybe the file \"/etc/os-release\" is just missing." + echo "Or your linux distribution is too old. Cannot check requirements." + echo "" +fi + +opensuse_requirements(){ + if ! which "protoc" > /dev/null 2>&1 + then + echo "protoc isn't installed." + echo "Please install \"protobuf-devel\" package and try again" + exit 1 + fi + if ! which "clang++" > /dev/null 2>&1 + then + echo "clang++ isn't installed." + echo "Please install \"clang5\" package and try again" + exit 1 + fi +} + +if [ -n "${DISTRO}" ] +then + case "${DISTRO}" in + opensuse|opensuse-leap) + opensuse_requirements + ;; + *) + ;; + esac +fi + protoc -I./dll/ --cpp_out=./dll/ ./dll/*.proto clang++ -shared -fPIC -o libsteam_api.so dll/*.cpp dll/*.cc -g3 -Wno-return-type -fsanitize=address -lasan -lprotobuf-lite -std=c++11 && echo built