File klee.spec of Package klee

# spec file for package klee
# Copyright (c) 2020 SUSE LLC
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

%define llvm_version_major 10
%define llvm_version %{llvm_version_major}

%define version_unconverted 2.1+20200921

%ifarch %{ix86} x86_64
%define with_uclibc 1
%define with_uclibc 0

Name:           klee
Summary:        LLVM Execution Engine
License:        NCSA
Group:          Development/Languages/Other
Version:        2.1+20200921
Release:        0
Source0:        %{name}-%{version}.tar.xz
Source1:        %{name}-rpmlintrc

BuildRequires:  clang%{llvm_version}
BuildRequires:  cmake
BuildRequires:  gperftools-devel
%if %{with_uclibc}
BuildRequires:  klee-uclibc-devel-static(llvm%{llvm_version})
BuildRequires:  libacl-devel
BuildRequires:  libcap-devel
BuildRequires:  libselinux-devel
BuildRequires:  llvm%{llvm_version}-devel
BuildRequires:  ninja
BuildRequires:  python3
BuildRequires:  python3-lit
BuildRequires:  python3-setuptools
BuildRequires:  python3-tabulate
# tests need sqlite3
BuildRequires:  sqlite3-devel
BuildRequires:  stp-devel
BuildRequires:  xz
BuildRequires:  zlib-devel
# 32 bit doesn't build and won't be fixed
ExcludeArch:    %{ix86} %{arm}

KLEE is a symbolic virtual machine built on top of the LLVM compiler
infrastructure, and available under the UIUC open source license. For more
information on what KLEE is and what it can do, see the OSDI 2008 paper. 

%setup -q
%autopatch -p1

mkdir -p build/test/
cp %{SOURCE2} build/test/
cp %{SOURCE3} build/test/

sed -i '1s@/usr/bin/env python3*@/usr/bin/python3@' \
	test/Concrete/ \
	tools/klee-stats/klee-stats \
	tools/klee-zesti/klee-zesti \

# Make _lto_cflags compatible with Clang. On some arches, it doesn't work.
%ifarch x86_64 %{ix86} ppc64le s390x
%define _lto_cflags "-flto=thin"
%define _lto_cflags %{nil}
%define __builder ninja
# they use -DNDEBUG, but we cannot, hence setting CMAKE_C*_FLAGS
# SHARED libs do not work at all yet
%cmake \
	-DCMAKE_AR=%{_bindir}/llvm-ar \
	-DCMAKE_RANLIB=%{_bindir}/llvm-ranlib \
	-DCMAKE_C_FLAGS="%optflags" \
	-DCMAKE_CXX_FLAGS="%optflags" \
%if %{with_uclibc}
	-DKLEE_UCLIBC_PATH=%{_libdir}/klee-uclibc/ \

%ifarch x86_64
cd build
ninja check


%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%doc NEWS
%license LICENSE.TXT
%dir %{_libdir}/klee/
%dir %{_libdir}/klee/runtime/
%if %{with_uclibc}