A new user interface for you! Read more...

File elektra.spec of Package elektra

Version:        0.8.20
Release:        0
%define tempdocdir %{_prefix}/elektra
%define __libtoolize    /bin/true
%define _disable_ld_no_undefined 1
%define _disable_ld_as_needed 1
%ifarch amd64 x86_64 aarch64 ppc64
%define LIB_SUFFIX -DLIB_SUFFIX=64
%endif

Name:           elektra
Source:         http://www.libelektra.org/ftp/elektra/releases/%{name}_%{version}.orig.tar.bz2
Url:            http://www.libelektra.org
%define api     4
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Source1:        elektra-rpmlintrc
BuildRequires:  boost-devel
BuildRequires:  cmake
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  doxygen
BuildRequires:  gcc-c++
BuildRequires:  graphviz
BuildRequires:  libxml2-devel
#BuildRequires:  java-1.8.0-devel

%if 0%{?suse_version} > 0
# g-ir-compiler fails to build
# BuildRequires:  gobject-introspection-devel
%if 0%{?suse_version} > 1300
%define use_aug 1
%define use_glib 0
%define use_swig 0
BuildRequires:  augeas-devel
BuildRequires:  glib2-devel
BuildRequires:  gobject-introspection-devel
%endif
# not SLE 12
%if 0%{?suse_version} >= 1320
%define use_qt5 1
BuildRequires:  discount
BuildRequires:  libQt5DBus-devel
BuildRequires:  libQt5Test-devel
BuildRequires:  libgit2-devel
BuildRequires:  libmarkdown-devel
BuildRequires:  libqt5-qtdeclarative-devel
BuildRequires:  libqt5-qtsvg-devel
BuildRequires:  libyajl-devel
BuildRequires:  python3-devel
%if 0%{?suse_version} > 0
BuildRequires:  update-desktop-files
%endif
BuildRequires:  systemd-logger
%endif
%if 0%{?suse_version} > 1320 || 0%{?suse_version} == 1315
BuildRequires:  fish
%endif
#BuildRequires:  lua-devel
#BuildRequires:  python
#BuildRequires:  python-devel
#BuildRequires:  swig
%else
%if 0%{?fedora_version} < 21
BuildRequires:  yajl >= 2.1.0
BuildRequires:  yajl-devel >= 2.1.0
%endif
%endif

%if 0%{?fedora_version} >= 21
%define use_aug 1
%define use_glib 0
%define use_qt5 1
%define use_swig 0
BuildRequires:  augeas-devel
BuildRequires:  discount
BuildRequires:  glib2-devel
# BuildRequires:  gobject-introspection-devel
BuildRequires:  libmarkdown-devel
BuildRequires:  lua-devel
BuildRequires:  qt5-qtdeclarative-devel
BuildRequires:  qt5-qtbase-devel
#BuildRequires:  python
#BuildRequires:  python-devel
BuildRequires:  python3-devel
#BuildRequires:  swig
BuildRequires:  systemd
%endif
Patch:          0001-desktop-category.patch
Patch1:         patch-dbus-no-session.patch
Patch2:         patch-fix-augeas-config.patch

Summary:        A key/value pair database to store software configurations
License:        BSD-3-Clause
Group:          System/Management

%package -n lib%{name}%{api}
Summary:        Hierarchical key-value pair tree configuration library
Group:          System/Libraries
Requires(post):       %{name}

%if 0%{?use_qt5} > 0
%package -n %{name}-qt-gui
Summary:        Hierarchical key-value pair tree configuration gui
Group:          System/X11/Utilities
%endif

%if 0%{?use_aug} > 0
%package -n lib%{name}-augeas
Summary:        Augeas support for Elektra
Group:          System/Libraries
Requires:       lib%{name}%{api} = %{version}-%{release}
%endif

%if 0%{?use_glib} > 0
%package -n libg%{name}-%{api}.0
Summary:        Glib support for Elektra
Group:          System/Libraries
%endif

%if 0%{?use_swig} > 0
%package -n lib%{name}-lua
Summary:        Lua support for Elektra
Group:          System/Libraries
Requires:       lib%{name}%{api} = %{version}-%{release}

%package -n python-%{name}
Summary:        Python support for Elektra
Group:          Development/Languages/Python
Requires:       lib%{name}%{api} = %{version}-%{release}
%endif

%package -n lib%{name}-devel
Summary:        Include files and libraries to build elektrified programs
Group:          Development/Libraries/C and C++
Requires:       pkgconfig lib%{name}%{api} = %{version}-%{release}

%package -n lib%{name}-devel-doc
Summary:        Development documentation for Elektra
Group:          Documentation/Man
Requires:       lib%{name}-devel = %{version}-%{release}

%description
Elektra provides a universal and secure framework to store configuration
parameters in a hierarchical key-value pair mechanism, instead of each
program using its own text configuration files. This allows any program
to read and save its configuration with a consistent API, and allows
them to be aware of other applications' configurations, permitting
easy application integration. While architecturally similar to other OS
registries, Elektra does not have most of the problems found in those
implementations.

%description -n lib%{name}%{api}
Elektra provides a universal and secure framework to store configuration
parameters in a hierarchical key-value pair tree.

%if 0%{?use_qt5} > 0
%description -n %{name}-qt-gui
Elektra provides a universal and secure framework to store configuration
parameters in a hierarchical key-value pair tree.

The Qt Gui.
%endif

%if 0%{?use_aug} > 0
%description -n lib%{name}-augeas
Elektra provides a universal and secure framework to store configuration
parameters in a hierarchical key-value pair tree.

The augeas backend for elektra.
%endif

%if 0%{?use_glib} > 0
%description -n libg%{name}-%{api}.0
Elektra provides a universal and secure framework to store configuration
parameters in a hierarchical key-value pair tree.

The glib binding for elektra.
%endif

%if 0%{?use_swig} > 0
%description -n lib%{name}-lua
Elektra provides a universal and secure framework to store configuration
parameters in a hierarchical key-value pair tree.

The lua binding for elektra.

%description -n python-%{name}
Elektra provides a universal and secure framework to store configuration
parameters in a hierarchical key-value pair tree.

The python binding for elektra.
%endif

%description -n lib%{name}-devel
Elektra provides a universal and secure framework to store configuration
parameters in a hierarchical key-value pair tree.

This package contains development specific things as include files and
static libraries to create elektrified programs.

%description -n lib%{name}-devel-doc
Elektra provides a universal and secure framework to store configuration
parameters in a hierarchical key-value pair tree.

This package contains development specific documentation.


%prep
%setup -q
%patch -p1
%patch1 -p1
%patch2 -p1

%build
export SUSE_ASNEEDED=0
mkdir build && cd build
cmake \
  -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG \
  -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG \
  -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-DNDEBUG \
  -DCMAKE_SKIP_RPATH:BOOL=ON \
  -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
  -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
  -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \
  -DLIB_INSTALL_DIR:PATH=%{_libdir} \
  -DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \
  -DSHARE_INSTALL_PREFIX:PATH=%{_datadir} \
  %{LIB_SUFFIX} \
  -DBUILD_SHARED_LIBS:BOOL=ON \
  -DTARGET_PLUGIN_FOLDER="elektra%{api}" \
  -DPLUGINS="ALL" \
  -DTOOLS="ALL" \
  -DBINDINGS="ALL" \
  -DENABLE_TESTING="OFF" \
  -DBUILD_TESTING="OFF" \
  -DTARGET_DOCUMENTATION_HTML_FOLDER="share/doc/elektra-doc/html" \
  -DBUILD_DOCUMENTATION=ON \
  -DTARGET_CMAKE_FOLDER=%{_lib}/cmake/elektra \
  -DCMAKE_C_FLAGS="-fPIC $CFLAGS" \
  -DCMAKE_CXX_FLAGS="-fPIC $CXXFLAGS" \
  ..
# get basics done, care about bindings later
  #-DPYTHON_INCLUDE_DIR=`python3  -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())"` \
  #-DPYTHON_LIBRARY=/usr/%{_lib}/libpython3.so \
# doxygen appears to have problems with multi level directory creation on elder distros
mkdir -p doc/html doc/man
make %{?_smp_mflags}

%install
%if 0%{?suse_version} > 1320
%suse_update_desktop_file -r org.libelektra.elektra-qt-editor "Settings;DesktopSettings;"
%endif
cd build
DESTDIR=%{buildroot} make install
# Remove statically linked kdb
#rm $RPM_BUILD_ROOT%{_bindir}/kdb-static
# not known by any package?
rm -r $RPM_BUILD_ROOT%{_datadir}/zsh/vendor-completions/
# add elektra modules paths
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d/
echo "%{_libdir}/elektra%{api}" > $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d/elektra.conf

%post -n lib%{name}%{api}
/sbin/ldconfig
# activate dbus messages on db changes
%{_bindir}/kdb global-mount dbus || :

%postun -n lib%{name}%{api} -p /sbin/ldconfig
%if 0%{?use_glib} > 0
%post -n libg%{name}-%{api}.0 -p /sbin/ldconfig
%postun -n libg%{name}-%{api}.0 -p /sbin/ldconfig
%endif

%files
%defattr(-,root,root,-)
%{_bindir}/kdb
%{_datadir}/bash-completion/completions/*
%if 0%{?suse_version} <= 1320
%dir %{_datadir}/fish
%dir %{_datadir}/fish/vendor_completions.d/
%endif
%{_datadir}/fish/vendor_completions.d/*
%doc doc/AUTHORS LICENSE.md README.md doc/INSTALL.md
%dir %{_libdir}/elektra/tool_exec
%{_libdir}/elektra/tool_exec/[b-p,r-z]*

%files -n lib%{name}%{api}
%defattr(-,root,root,-)
%{_libdir}/*elektr*.so.*
%dir %{_libdir}/elektra%{api}
# skip elektra-augeas
%{_libdir}/elektra%{api}/*elektra-[b-z]*.so
%dir %{_datadir}/doc/elektra
%{_datadir}/doc/elektra/*
%config %{_sysconfdir}/ld.so.conf.d/elektra.conf

%if 0%{?use_qt5} > 0
%files -n %{name}-qt-gui
%defattr(-,root,root,-)
%dir %{_libdir}/elektra%{api}
%{_bindir}/elektra-qt-editor
%{_libdir}/elektra/tool_exec/qt-gui
%{_datadir}/app*
%{_datadir}/icons/*
%endif

%if 0%{?use_aug} > 0
%files -n lib%{name}-augeas
%defattr(-,root,root,-)
%{_libdir}/elektra%{api}/libelektra-augeas.so
%endif

%if 0%{?use_glib} > 0
%files -n libg%{name}-%{api}.0
%defattr(-,root,root,-)
%{_libdir}/libgelektra-%{api}.0.so
%endif

%if 0%{?use_swig} > 0
%files -n lib%{name}-lua
%defattr(-,root,root,-)
%{_libdir}/lua/*

%files -n python-%{name}
%defattr(-,root,root,-)
%{_libdir}/python*
%endif

%files -n lib%{name}-devel
%defattr(-,root,root,-)
%{_includedir}/*
%dir %{_libdir}/elektra
%{_libdir}/libelektra*.so
%{_libdir}/pkgconfig/*
%dir %{_libdir}/cmake/elektra
%{_libdir}/cmake/elektra/*.cmake

%files -n lib%{name}-devel-doc
%defattr(-,root,root,-)
%dir %{_datadir}/doc/elektra-doc
%dir %{_datadir}/doc/elektra-doc/html
%{_datadir}/doc/elektra-doc/html/*
%{_mandir}/man1/*
%{_mandir}/man3/*
%{_mandir}/man7/*

%changelog
* Thu Sep 07 2006 - Avi Alkalay <avi@unix.sh> 0.6.4-1
- Version update

* Fri Jun 02 2006 - Avi Alkalay <avi@unix.sh> 0.6.2-1
- Initial packaging