Skip to content

Commit

Permalink
dg.spec.rpkg: Reflect changes in Fedora's CMake macros
Browse files Browse the repository at this point in the history
* Add docs to the package
* Do not set CMake buildtype as rpmbuild sets the default set of buildflags
* Fix some rpmlint errors and warnings
* Fix compatibility with openSUSE and Mageia

Closes: #327
  • Loading branch information
lzaoral authored and mchalupa committed Apr 13, 2021
1 parent e06077c commit 8a55ee2
Showing 1 changed file with 25 additions and 47 deletions.
72 changes: 25 additions & 47 deletions dg.spec.rpkg
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# vim: syntax=spec

# Do out-of-source build by default on Fedora
%undefine __cmake_in_source_build

Name: {{{ git_dir_name }}}
Version: {{{ git_dir_version }}}
Release: 1%{?dist}
Summary: Various program analyses, construction of dependence graphs and program slicing of LLVM bitcode
Summary: Analyses, construction of dependence graphs and slicing of LLVM bitcode

License: MIT
URL: https://github.com/mchalupa/dg
Expand All @@ -14,74 +17,49 @@ Source: {{{ git_dir_archive }}}
BuildRequires: clang
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: llvm-devel
BuildRequires: make
BuildRequires: ncurses-devel
BuildRequires: python3
BuildRequires: zlib-devel

# FIXME: dg should support dynamic linking with LLVM
BuildRequires: llvm-static

Requires: clang
Requires: llvm

%description
DG is a library containing various bits for program analysis. However, the main
motivation of this library is program slicing. The library contains implementation
of a pointer analysis, data dependence analysis, control dependence analysis,
and an analysis of relations between values in LLVM bitcode. All of the analyses
target LLVM bitcode, but most of them are written in a generic way, so they are
not dependent on LLVM in particular.
DG is a library containing various bits for program analysis. However, the
main motivation of this library is program slicing. The library contains
implementation of a pointer analysis, data dependence analysis, control
dependence analysis, and an analysis of relations between values in LLVM
bitcode. All of the analyses target LLVM bitcode, but most of them are written
in a generic way, so they are not dependent on LLVM in particular.

%prep
{{{ git_dir_setup_macro }}}
GIT_REVISION={{{ git rev-parse --short --sq HEAD }}}
sed -i "s/unknown/$GIT_REVISION/" tools/git-version.sh

%build
%if 0%{?fedora} || 0%{?rhel} || 0%{?centos}
%cmake . -DCMAKE_BUILD_TYPE=Release
%make_build
%endif

%if 0%{?mageia} == 7
%cmake -DCMAKE_BUILD_TYPE=Release
%make_build
%endif

%if 0%{?mageia} > 7 || 0%{?sle_version} || 0%{?suse_version}
%cmake -DCMAKE_BUILD_TYPE=Release
%cmake_build
%endif
GIT_VERSION={{{ git rev-parse --short --sq HEAD }}}
%cmake -DGIT_VERSION="$GIT_VERSION"
%cmake_build

%install
%if 0%{?fedora} || 0%{?rhel} || 0%{?centos}
%make_install
%endif

%if 0%{?mageia} == 7
cd %{_cmake_builddir}
%make_install
%endif

%if 0%{?mageia} > 7 || 0%{?sle_version} || 0%{?suse_version}
%cmake_install
%endif
%cmake_install

%check

%if 0%{?mageia} == 7
cd %{_cmake_builddir}
%endif

%if 0%{?mageia} > 7 || 0%{?sle_version} || 0%{?suse_version}
cd %{__builddir}
%if 0%{?suse_version}
%cmake_build -C %{__builddir} check
%else
%if 0%{?epel}
%cmake_build check
%else
%cmake_build --target check
%endif
%endif

make check %{?_smp_mflags}

%files
%license LICENSE
%doc doc/*
%{_bindir}/*
%{_includedir}/%{name}
%{_libdir}/*

0 comments on commit 8a55ee2

Please sign in to comment.