File libmgec7.spec of Package libmgec7

#
# spec file for package libmgec7
#
# Copyright (C) 2022-2025 Mark Grant <m.grant.prg@gmail.com>
#
#

# openSUSE Leap has a peculiar release field and inconsistent versioning macros.
# Prior to 16.0 sle_version must be used to provide the version, it has the
# format 150600. For 16.0 and subsequent releases, suse_version must be used,
# it has the format 1600. N.B. This is all true of osc builds, OBS seems to work
# probably because it overrides the spec file Release field.
%if 0%{?is_opensuse}
	%if 0%{?suse_version} >= 1600
		%define major %(version=%{?suse_version}; echo ${version::2})
		%define minor %(version=%{?suse_version}; echo ${version:(-1)})
	%else
		%define major %(version=%{?sle_version}; echo ${version::2})
		%define minor %(version=%{?sle_version}; echo ${version:(-3):1})
	%endif
%endif



# Enter the Release numerics here.
%define pkg_release 0.0

Name:		libmgec7
Version:	1.9.0

%if 0%{?is_opensuse}
Release:	lp%{?major}%{?minor}.%{?pkg_release}
%else
Release:	%{?pkg_release}
%endif

License:	GPL-3.0
Summary:	MGE C Library
Url:		https://github.com/m-grant-prg/libmgec/wiki
Group:		Development/Tools/Building
Source0:	https://github.com/m-grant-prg/libmgec/release/%{name}-%{version}.tar.gz
BuildRequires:	autoconf, autoconf-archive, automake, libtool, make, valgrind
BuildRequires:	dia, doxygen, graphviz, graphviz-gd, tar, txt2manwrap
Requires:	tar
BuildRoot:	%{_tmppath}/%{name}-%{version}-build
%description
The MGE General C Library contains useful routines supportive of faster C
development. These include generic binary search trees and buffer / message
management.

# openSUSE >= 16.0 requires Link Time Optimisation (LTO) hence this flag.
%if 0%{?is_opensuse}
	%global _lto_cflags %{?_lto_cflags} -ffat-lto-objects
%endif

%package devel
Summary:	MGE C Library Development Package
Group:		Development/Tools/Building
Requires:	%{name} = %{version}-%{release}
%description devel
The MGE General C Library contains useful routines supportive of faster C
development. These include generic binary search trees and buffer / message
management.
This package contains the development files such as headers, man pages, static
libraries etc.


%package doc
Summary:	MGE C Library API Documentation Package
Group:		Development/Tools/Building
BuildArch:	noarch
%description doc
The MGE General C Library contains useful routines supportive of faster C
development. These include generic binary search trees and buffer / message
management.
This package contains the library API documentation.


%package -n %{name}-int-doc
Summary:	MGE C Library Internal Documentation Package
Group:		Development/Tools/Building
BuildArch:	noarch
%description -n %{name}-int-doc
The MGE General C Library contains useful routines supportive of faster C
development. These include generic binary search trees and buffer / message
management.
This package contains the library internal documentation.


%prep
%setup -q -n %{name}-%{version}

%build
autoreconf -if
%configure docdir=%{_docdir}/libmgec
make %{?jobs:-j%jobs}

%check
make check

%install
%make_install

%post -n %{name}
/sbin/ldconfig

%postun -n %{name}
/sbin/ldconfig

%files devel
%defattr(-,root,root,-)
%license COPYING
%doc AUTHORS ChangeLog NEWS README
/usr/include/*
%if 0%{?is_opensuse}
	%{_libdir}/libmgec.a
	%{_libdir}/libmgec.la
%else
	%{_libdir}/libmgec.a
%endif
%{_libdir}/libmgec.so
%{_libdir}/pkgconfig/libmgec.pc
%{_mandir}/man3/*
%{_docdir}/libmgec/AUTHORS
%{_docdir}/libmgec/COPYING
%{_docdir}/libmgec/ChangeLog
%{_docdir}/libmgec/NEWS
%{_docdir}/libmgec/README

%files doc
%defattr(-,root,root,-)
%license COPYING
%dir %{_docdir}/libmgec
%doc AUTHORS ChangeLog NEWS README
%{_docdir}/libmgec/api
%dir /usr/share/doc-base
/usr/share/doc-base/libmgec

%files -n %{name}-int-doc
%defattr(-,root,root,-)
%license COPYING
%dir %{_docdir}/libmgec
%{_docdir}/libmgec/int
%doc AUTHORS ChangeLog NEWS README
%dir /usr/share/doc-base
/usr/share/doc-base/libmgec-int

%files -n %{name}
%defattr(-,root,root,-)
%license COPYING
%doc AUTHORS ChangeLog NEWS README
%{_libdir}/libmgec.so.*

%changelog
openSUSE Build Service is sponsored by