#
# spec file for package libconfig
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


%define _soversion 11
Name:           libconfig
Version:        1.7.2
Release:        1.8
Summary:        A library for manipulating structured configuration files
License:        LGPL-2.1-or-later
Group:          Development/Libraries/C and C++
URL:            https://hyperrealm.github.io/libconfig
Source:         https://hyperrealm.github.io/libconfig/dist/%{name}-%{version}.tar.gz
Source1:        baselibs.conf
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  makeinfo
BuildRequires:  pkgconfig

%description
libconfig is a library for manipulating structured configuration
files. The supported file format is more compact and more readable
than XML. Unlike XML, it is type-aware, so it is not necessary to do
string parsing in application code.

The library includes bindings for both the C and C++ languages.

%package -n libconfig%{_soversion}
Summary:        C API of libconfig
Group:          System/Libraries

%description -n libconfig%{_soversion}
libconfig is a library for manipulating structured configuration
files. The supported file format is more compact and more readable
than XML. Unlike XML, it is type-aware, so it is not necessary to do
string parsing in application code.

This package contains the shared libraries for libconfig.

%package devel
Summary:        C bindings development files for libconfig
Group:          Development/Languages/C and C++
Requires:       libconfig%{_soversion} = %{version}
Recommends:     libconfig-doc = %{version}

%description devel
libconfig is a library for manipulating structured configuration
files. The supported file format is more compact and more readable
than XML. Unlike XML, it is type-aware, so it is not necessary to do
string parsing in application code.

This package contains the C bindings development files.

%package -n libconfig++%{_soversion}
Summary:        C++ API of libconfig
Group:          System/Libraries

%description -n libconfig++%{_soversion}
libconfig is a library for manipulating structured configuration
files. The supported file format is more compact and more readable
than XML. Unlike XML, it is type-aware, so it is not necessary to do
string parsing in application code.

This package contains the shared libraries for libconfig.

%package -n libconfig++-devel
Summary:        C++ bindings development files for libconfig
Group:          Development/Languages/C and C++
Requires:       libconfig++%{_soversion} = %{version}
Requires:       libconfig-devel = %{version}
Recommends:     libconfig-doc = %{version}

%description -n libconfig++-devel
libconfig is a library for manipulating structured configuration
files. The supported file format is more compact and more readable
than XML. Unlike XML, it is type-aware, so it is not necessary to do
string parsing in application code.

This package contains the C++ bindings development files.

%prep
%setup -q

%build
%configure \
  --disable-silent-rules \
  --disable-static
make %{?_smp_mflags}

%install
%make_install
find %{buildroot} -type f -name "*.la" -delete -print
%fdupes -s %{buildroot}%{_docdir}

%check
make %{?_smp_mflags} check

%post -n libconfig%{_soversion} -p /sbin/ldconfig
%postun -n libconfig%{_soversion} -p /sbin/ldconfig
%post -n libconfig++%{_soversion} -p /sbin/ldconfig
%postun -n libconfig++%{_soversion} -p /sbin/ldconfig

%files -n libconfig%{_soversion}
%license COPYING*
%doc AUTHORS README
%{_libdir}/libconfig.so.*

%files -n libconfig++%{_soversion}
%license COPYING*
%doc AUTHORS README
%{_libdir}/libconfig++.so.*

%files devel
%doc ChangeLog TODO
%{_includedir}/libconfig.h
%{_libdir}/libconfig.so
%{_libdir}/pkgconfig/libconfig.pc

%post -n libconfig++-devel
%install_info --info-dir=%{_infodir} %{_infodir}/libconfig.info%{ext_info}

%postun -n libconfig++-devel
%install_info_delete --info-dir=%{_infodir} %{_infodir}/libconfig.info%{ext_info}

%files -n libconfig++-devel
%doc ChangeLog TODO
%{_includedir}/libconfig.h++
%{_libdir}/libconfig++.so
%{_libdir}/pkgconfig/libconfig++.pc
%{_infodir}/libconfig.info%{?ext_info}
%dir %{_libdir}/cmake
%dir %{_libdir}/cmake/libconfig
%dir %{_libdir}/cmake/libconfig++
%{_libdir}/cmake/libconfig++/libconfig++Config.cmake
%{_libdir}/cmake/libconfig/libconfigConfig.cmake

%changelog
* Fri Sep 21 2018 astieger@suse.com
- libconfig 1.7.2:
  * fix a slow memory leak
- includes changes from 1.7.1:
  * Fixed a bug that caused incorrect processing of strings with
    escape sequences.
  * Added a new 'fsync' configuration option.
- switch to upstream bootstrapped tarball
* Mon Mar 26 2018 kukuk@suse.de
- Use %%license instead of %%doc [bsc#1082318]
* Wed Feb  7 2018 jengelh@inai.de
- Ensure neutrality of description, and strip other OS mentions.
* Sat Nov 11 2017 aavindraa@gmail.com
- Update to 1.7:
  * Redesigned the directory-include feature to avoid using
    platform-specific directory scanning code, and to fix a bug in
    the handling of nested includes. The application can now do its
    own directory scanning and/or wildcard expansion by registering
    an include function.
  * Added new CONFIG_OPTION_ALLOW_SCIENTIFIC_NOTATION to allow
    either %%f or %%g-style formatting for floating point values.
  * Improved the options APIs in both the C and C++ libraries.
  * Improved the automatic conversion between int and int64 values.
  * Fixed build errors caused by out-of-sync generated lexer and
    parser source files.
  * Added an API to clear an existing configuration.
  * Fixed a problem where a group or list could be added to an array.
  * Changed default float precision from 2 to 6.
  * Modified grammar to allow trailing commas in lists and arrays.
  * Removed logic that clipped negative values to 0 in (unsigned int)
    cast operator.
  * Updated manual and added a new chapter on other libconfig
    implementations and bindings.
  * Various internal code cleanup.
  * Fixed failing unit tests.
  * Upgraded VS2015 solution/project files to VS2017.
- Use new project URL
- sonum updated from 8 to 11
* Thu Jul 13 2017 tchvatal@suse.com
- Update to 1.6.0:
  * Added include_dir feature (support for Debian-style conf.d/
    includes) (pull request #36)
  * Added octal_ints feature (support for integer expressed in octal,
    useful for permissions and masks in UNIX-like systems (pull req #42)
  * Fixed "Removing a setting removes all siblings" (issue #41)
    Props random85
  * Allow specifying the number of decimals wanted when outputting
    Based upon a suggestion by zhaopingsun (issue #31)
  * Make libconfig usable from CMake (pull request/issue #28)
    Props thfi
  * Documentation fixes
  - Copyright and examples
  - Included TeX patch from Debian (fixes FTBS with TeXlive)
  * Resync Debian packaging
    includes updated packages for GCC5 transition
* Sun Jun  7 2015 i@marguerite.su
- update version 1.5.0
  * lib/libconfig.c - Don't fclose() a null pointer.
  * lib/libconfig.c, lib/wincompat.h - check if file being
    opened is a directory
  * lib/libconfig.c, lib/libconfig.h, lib/libconfig.h++,
    doc/libconfig.texi - added config_set_options(),
    config_get_options(), setOptions(), getOptions().
  * lib/libconfig.c++, lib/libconfig.h++ - added patches
    from Matt Renaud (added iterators, removed throws()
    specifications); added Setting.lookup(); code cleanup;
    added patch from Yuri Dyachenko (made exception
    constructors public)
  * lib/libconfig.c, lib/libconfig.h - renamed
    config_setting_lookup_from() to config_setting_lookup()
    and documented it; patch from Alexander Klauer (floating
    point precision loss)
  * doc/libconfig.texi - documented new APIs, bumped version
  * lib/scanner.c, lib/scanner.h, lib/scanner.l, libconfig.c -
    scanner code cleanup; and regenerated with flex 2.5.39
  * lib/grammar.c, lib/grammar.h, lib/grammar.y - parser code
    cleanup; and regenerated with bison 3.0.2
  * lib/libconfig.c - bugfix; capture root filename
  * tests/Makefile.am - fix for out-of-source builds
  * ac_config.h.in, aclocal.m4 - updated to newer autotools
* Sun Oct  5 2014 jengelh@inai.de
- Make doc subpackage noarch; improve on RPM group classification
* Sat Dec 29 2012 p.drouand@gmail.com
- Update to 1.4.9 version:
  * lib/libconfigcpp.c++ - Fixed compiler warnings in constructor
    initializers
  * tinytest/tiytest.c, tinytest/tinytest.h - added tt_file_exists();
    added alternate implementations of some test macros since MSVC does
    not support C99 fully; added comparators for text files (ignoring
    line endings)
  * tests/tests.c - use tt_file_exists() rather than access(); alias
    snprintf to _snprintf for MSVC; compare files as text files rather
    than as binary files
  * lib/scanner.l - fixed parsing issue when backslash in string is
    followed by invalid escape character; reported by Jimmy Scott
  * lib/scanner.c - regenerated
  * lib/libconfig.h, lib/libconfig.h++, lib/Makefile.am,
    doc/libconfig.texi, configure.ac - bump version numbers
  * aclocal.m4, ac_config.h - regenerated
  * m4/*, aux-build/*, libtool - updated to newer
* Sat May 19 2012 davejplater@gmail.com
- Added baselibs.conf for 32 bit ffado
- Disabled pdf and html docs, moved info to devel package
* Wed Mar 14 2012 saschpe@suse.de
- Fix typo, it's %%{_smp_mflags}
- Remove unwanted description paragraphs
* Mon Mar 12 2012 saschpe@suse.de
- Fixed changes file markup
* Mon Feb 27 2012 saschpe@suse.de
- Spec file cleanup:
  * Use original tarball
  * Move COPYING, README into lib packages (legal requirement)
  * Move CHANGELOG and TODO into devel packages (not needed by users)
  * Move examples into doc package, and recommend it for both devel packages
  * Ran spec cleaner and removed unneeded rpmlintrc
* Sat Feb 25 2012 davejplater@gmail.com
- Renamed package to libconfig and updated to 1.4.8
- Upstream changes:
  * tests/Makefile.am - marked 'libconfig_tests' as non-installable
  * lib/scanner.l, lib/grammar.y - grammar changes to make trailing
    semicolons optional (and to allow commas as an alternative)
  * lib/libconfig.c - bugfixes for lack of auto-conversion handling in
    the config_lookup*() functions (reported by Feng Yu), and some
    fixes for compiler warnings
  * lib/Makefile.am - bump .so version
  * configure.ac - bump version, add '-Wno-unused-parameter' compiler
    switch to disable "unused parameter" warnings
  * doc/libconfig.texi - documentation updates; added a chapter that
    calls attention to the bundled example programs
  * lib/libconfig.h, lib/libconfig.h++ - bump versions
  * doc/libconfig.texi - fixed typo; updated docs
  * TODO - updated list
  * lib/libconfig.c, lib/libconfig.h, lib/libconfigcpp.c++,
    lib/libconfig.h++ - added config{get,set}_default_format(),
    Config::{get,set}DefaultFormat()
  * lib/libconfig.c - fixed memory leak when encountering a parse error
    in an @include'd file
  * lib/libconfig.h, lib/libconfig.h++, lib/Makefile.am, configure.ac,
    doc/libconfig.texi - bump versions
  * doc/libconfig.texi - documentation updates
  * lib/libconfig.c, lib/libconfigcpp.c++, lib/libconfig.h,
    lib/libconfig.h++, lib/wincompat.h, lib/scanctx.c - added support
    for specifying an include directory
  * m4/* - added local m4 directory
  * contrib/* - added user-contributed files
- See /usr/share/doc/packages/libconfig/ChangeLog for more.
* Fri Oct  1 2010 davejplater@gmail.com
- Created libconfig++ from the pacman source rpm and adapted the spec
  file to openSUSE also transfered the changes to a changes file
* Wed May  5 2010 toni@links2linux.de
- update to 1.4.5
- This release includes a bugfix and some code cleanup to eliminate compiler warnings.
* Tue Apr 13 2010 toni@links2linux.de
- update to 1.4.4
- new SO-name ==> libconfig9 and libconfig++9
- This release fixes several build issues.
* Mon Feb 15 2010 toni@links2linux.de
- update to 1.4.3
- This release fixes a problem with parsing indented '@include' directives.
* Fri Jan 29 2010 toni@links2linux.de
- update to 1.4.2
- new SO-name ==> libconfig8 and libconfig++8 (!!!)
- removed static libs
- This release fixes some problems with the ParseException class.
* Fri Jan  1 2010 toni@links2linux.de
- update to 1.4.1
- This release fixes a crash when reading a configuration from a string,
  and includes a few minor build improvements.
* Fri Nov 13 2009 toni@links2linux.de
- update to 1.4
- new SO-name ==> libconfig9 and libconfig++9
- This release includes some minor bugfixes
* Sat Feb 21 2009 toni@links2linux.de
- Initial release 1.3.2