File tidy.spec of Package tidy

%define realname tidy-html5
%define srcext   tar.bz2

%define so_ver   5

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

# Common info
Name:          tidy
Version:       0
Release:       %{?extraver:0.}1%{?dist}
License:       W3C
Group:         Productivity/Publishing/HTML/Tools
URL:           http://www.html-tidy.org/
Summary:       HTML Tidy with HTML5 support

# Install-time parameters
Provides:      %{realname} = %{version}

# Build-time parameters
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: libxslt%{?suse_version:-tools}
BuildRoot:     %{_tmppath}/%{name}-root
Source:        %{realname}-%{version}%{?extraver}.%{srcext}

%description
Tidy is a console application for Mac OS X, Linux, Windows, UNIX, and more.
It corrects and cleans up HTML and XML documents by fixing markup errors and
upgrading legacy code to modern standards.

%package -n lib%{name}%{?so_ver}
Group:         System/Libraries
Summary:       Shared library for HTML %{name}
Provides:      lib%{realname} = %{version}

%description -n lib%{name}%{?so_ver}
libtidy is a C static and dynamic library that developers can integrate into
their applications in order to bring all of Tidy’s power to your favorite tools.
libtidy is used today in desktop applications, web servers, and more.

%package -n lib%{name}-devel
Group:         Development/Languages/C and C++
Summary:       Development files for lib%{name}
Requires:      lib%{name}%{?so_ver} = %{version}
Provides:      lib%{name}%{?so_ver}-devel = %{version}
Provides:      %{name}-devel = %{version}
Provides:      %{realname}-devel = %{version}

%description -n lib%{name}-devel
Development files for lib%{name}.

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}

%build
%{__mkdir} tidy-build
cd tidy-build
cmake .. \
 -DCMAKE_INSTALL_PREFIX=%{_prefix} \
 -DCMAKE_BUILD_TYPE=Release \
 -DCMAKE_CXX_FLAGS_RELEASE="${CFLAGS}" \
 -DCMAKE_C_FLAGS_RELEASE="${CFLAGS}" \
 -DCMAKE_EXE_LINKER_FLAGS_RELEASE="-Wl,--as-needed -Wl,--strip-all" \
 -DCMAKE_MODULE_LINKER_FLAGS_RELEASE="-Wl,--as-needed -Wl,--strip-all" \
 -DCMAKE_SHARED_LINKER_FLAGS_RELEASE="-Wl,--as-needed -Wl,--strip-all -shared ${CURSES_LIB}" \
 -DCMAKE_SKIP_RPATH=YES \
 -DBUILD_SHARED_LIB=YES \
%if 0%{?__isa_bits} == 64
 -DLIB_SUFFIX=64
%endif

%{__make} %{?_smp_mflags}

%install
%{__make} -C tidy-build install DESTDIR=%{buildroot}

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%doc README/*
%{_bindir}/tidy
%doc %{_mandir}/man1/*

%files -n lib%{name}%{?so_ver}
%defattr(-,root,root)
%doc README/*
%{_libdir}/lib%{name}.so.%{?so_ver}*

%files -n lib%{name}-devel
%defattr(-,root,root)
%doc README/*
%{_libdir}/lib%{name}.so
%{_libdir}/lib%{name}s.a
%{_includedir}/*.h

%post   -n lib%{name}%{?so_ver} -p /sbin/ldconfig
%postun -n lib%{name}%{?so_ver} -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by