Add Z3 cmake files required by find_package

So far, Z3 is not found when using cmake find_package(Z3).
The following files have been added, to enable find_package(Z3):
  Z3Config.cmake
  Z3ConfigVersion.cmake
  Z3Targets.cmake
  Z3Targets-release.cmake

Remarks:
- Z3 has a build system using CMake. However, it does not support
  building OCaml bindings yet. Therefore, stay with the classical
  configure and make build in the spec file here and provide the
  required cmake files manually.
- Version, lib and bitness are updated in above .cmake template files
  during the rpm prep stage using sed.
This commit is contained in:
Wolfgang Stöggl 2020-05-15 07:28:09 +02:00
parent dd0859c8cf
commit 40a2541855
2 changed files with 27 additions and 2 deletions

BIN
Z3_cmake_files.tar.gz Normal file

Binary file not shown.

29
z3.spec
View File

@ -2,12 +2,16 @@
Name: z3
Version: 4.8.8
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Satisfiability Modulo Theories (SMT) solver
License: MIT
URL: https://github.com/Z3Prover/z3
Source0: https://github.com/Z3Prover/z3/archive/%{name}-%{version}.tar.gz
# Z3 has a build system using CMake. However, it does not support building OCaml bindings yet.
# Therefore, stay with the classical configure and make build and provide the required
# cmake files manually, which allow Z3 to be found by find_package(Z3)
Source1: Z3_cmake_files.tar.gz
BuildRequires: doxygen
BuildRequires: gcc-c++
@ -85,7 +89,8 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Python 3 interface to z3.
%prep
%autosetup -p1 -n %{name}-%{name}-%{version}
# Unpack Source1 too, using -a 1
%autosetup -p1 -n %{name}-%{name}-%{version} -a 1
# Install python objects into the right place, enable verbose builds, use
# Fedora CFLAGS, preserve timestamps when installing, include the entire
@ -113,6 +118,18 @@ iconv -f iso8859-1 -t utf-8 RELEASE_NOTES > RELEASE_NOTES.utf8
touch -r RELEASE_NOTES RELEASE_NOTES.utf8
mv -f RELEASE_NOTES.utf8 RELEASE_NOTES
# Prepare the cmake files
sed -i -e 's/@CMAKE_INSTALL_LIBDIR@/%{_lib}/g' \
-e 's/@VERSION@/%{version}/g' \
-e 's/@Z3_VERSION_MAJOR@/%(echo %{version} | cut -d. -f1)/g' \
-e 's/@Z3_VERSION_MINOR@/%(echo %{version} | cut -d. -f2)/g' \
-e 's/@Z3_VERSION_PATCH@/%(echo %{version} | cut -d. -f3)/g' \
./Z3_cmake_files/*
%if 0%{__isa_bits} == 32
# Adjust Z3ConfigVersion.cmake in case of 32-bit builds
sed -i 's/\"8/\"4/g' ./Z3_cmake_files/Z3ConfigVersion.cmake
%endif
%build
export CXXFLAGS="$RPM_OPT_FLAGS"
export LANG="C.UTF-8"
@ -167,6 +184,10 @@ mv %{buildroot}%{_prefix}/lib/*.jar %{buildroot}%{_jnidir}
ln -s %{_jnidir}/com.microsoft.z3.jar %{buildroot}%{_libdir}/%{name}
mv %{buildroot}%{_prefix}/lib/lib%{name}java.so %{buildroot}%{_libdir}/%{name}
# Install the provided cmake files
mkdir -p %{buildroot}%{_libdir}/cmake/%{name}/
install -D -m 644 Z3_cmake_files/Z3*.cmake %{buildroot}%{_libdir}/cmake/%{name}/
#%%check
# Some of the tests require more memory than the koji builders have available.
#
@ -187,6 +208,7 @@ mv %{buildroot}%{_prefix}/lib/lib%{name}java.so %{buildroot}%{_libdir}/%{name}
%files devel
%{_includedir}/%{name}/
%{_libdir}/lib%{name}.so
%{_libdir}/cmake/%{name}/
%files doc
%doc doc/api/html examples
@ -214,6 +236,9 @@ mv %{buildroot}%{_prefix}/lib/lib%{name}java.so %{buildroot}%{_libdir}/%{name}
%{python3_sitearch}/%{name}/
%changelog
* Thu May 14 2020 Wolfgang Stöggl <c72578@yahoo.de> - 4.8.8-2
- Add Z3 cmake files required by find_package(Z3)
* Sat May 9 2020 Jerry James <loganjerry@gmail.com> - 4.8.8-1
- Version 4.8.8
- Drop all patches; all have been upstreamed