From bee8bf58a13114d6f9503b6b4791f90dc95ddd4fa5ade08c1cd9d6548eb3f3a2 Mon Sep 17 00:00:00 2001
From: Guido Berhoerster <gber@opensuse.org>
Date: Thu, 20 Nov 2014 17:10:06 +0000
Subject: [PATCH] Accepting request 262467 from
 home:scarabeus_iv:branches:server:irc

- Remove sle11 support as now I don't need it anymore
- Use %cmake macro properly
- Document that there are tests that need extra pkg
- Split documentation into -doc subpackage

OBS-URL: https://build.opensuse.org/request/show/262467
OBS-URL: https://build.opensuse.org/package/show/server:irc/weechat?expand=0&rev=59
---
 weechat.changes |  8 +++++
 weechat.spec    | 91 ++++++++++++++++++-------------------------------
 2 files changed, 42 insertions(+), 57 deletions(-)

diff --git a/weechat.changes b/weechat.changes
index d628a89..dfde151 100644
--- a/weechat.changes
+++ b/weechat.changes
@@ -1,3 +1,11 @@
+-------------------------------------------------------------------
+Thu Nov 20 14:46:54 UTC 2014 - tchvatal@suse.com
+
+- Remove sle11 support as now I don't need it anymore
+- Use %cmake macro properly
+- Document that there are tests that need extra pkg
+- Split documentation into -doc subpackage
+
 -------------------------------------------------------------------
 Fri Oct 10 06:02:10 UTC 2014 - gber@opensuse.org
 
diff --git a/weechat.spec b/weechat.spec
index ef492a5..a5f467c 100644
--- a/weechat.spec
+++ b/weechat.spec
@@ -27,8 +27,11 @@ Source:         http://www.weechat.org/files/src/weechat-%{version}.tar.bz2
 Source1:        weechat.desktop
 # PATCH-FIX-UPSTREAM weechat-capath.patch https://savannah.nongnu.org/patch/index.php?8153 lnussel@suse.de -- use system's default certificate store
 Patch0:         weechat-capath.patch
+BuildRequires:  asciidoc
 BuildRequires:  cmake
 BuildRequires:  curl-devel
+BuildRequires:  docbook5-xsl-stylesheets
+BuildRequires:  enchant-devel
 BuildRequires:  gcc-c++
 BuildRequires:  grep
 BuildRequires:  guile-devel
@@ -37,30 +40,20 @@ BuildRequires:  libgcrypt-devel
 BuildRequires:  libgnutls-devel
 BuildRequires:  libgpg-error-devel
 BuildRequires:  libtool
+BuildRequires:  libxslt-tools
+BuildRequires:  lua51-devel
 BuildRequires:  lzo-devel
 BuildRequires:  ncurses-devel
 BuildRequires:  perl
 BuildRequires:  pkg-config
 BuildRequires:  python-devel
 BuildRequires:  ruby-devel
+BuildRequires:  source-highlight
 BuildRequires:  tcl-devel
 BuildRequires:  update-desktop-files
 Requires:       hicolor-icon-theme
+Suggests:       %{name}-doc
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-%if 0%{?suse_version} > 1220
-BuildRequires:  enchant-devel
-%endif
-%if 0%{?suse_version} > 1220
-BuildRequires:  lua51-devel
-%else
-BuildRequires:  lua-devel
-%endif
-%if 0%{?suse_version} > 1220
-BuildRequires:  asciidoc
-BuildRequires:  docbook5-xsl-stylesheets
-BuildRequires:  libxslt-tools
-BuildRequires:  source-highlight
-%endif
 
 %description
 WeeChat (Wee Enhanced Environment for Chat) is a fast and light cross-platform
@@ -70,29 +63,34 @@ several scripting languages.
 
 %lang_package
 
+%package doc
+Summary:        Documentation for %{name}
+Group:          Documentation/HTML
+Requires:       %{name} = %{version}
+
+%description doc
+Various documentation files for %{name}.
+
 %package devel
 Summary:        Development Environment for %{name} Plugins
 Group:          Development/Libraries/C and C++
-Requires:       %{name} = %{version}-%{release}
+Requires:       %{name} = %{version}
 
 %description devel
 Development environment for authoring %{name} plugins.
 
-%if 0%{?suse_version} > 1220
-
 %package guile
 Summary:        Guile Scripting Support for %{name}
 Group:          Productivity/Networking/IRC
-Requires:       %{name} = %{version}-%{release}
+Requires:       %{name} = %{version}
 
 %description guile
 Support for %{name} scripts written in the Guile language.
-%endif
 
 %package lua
 Summary:        Lua Scripting Support for %{name}
 Group:          Productivity/Networking/IRC
-Requires:       %{name} = %{version}-%{release}
+Requires:       %{name} = %{version}
 
 %description lua
 Support for %{name} scripts written in the Lua language.
@@ -100,7 +98,7 @@ Support for %{name} scripts written in the Lua language.
 %package perl
 Summary:        Perl Scripting Support for %{name}
 Group:          Productivity/Networking/IRC
-Requires:       %{name} = %{version}-%{release}
+Requires:       %{name} = %{version}
 %{?libperl_requires}
 
 %description perl
@@ -109,7 +107,7 @@ Support for %{name} scripts written in the Perl language.
 %package python
 Summary:        Python Scripting Support for %{name}
 Group:          Productivity/Networking/IRC
-Requires:       %{name} = %{version}-%{release}
+Requires:       %{name} = %{version}
 
 %description python
 Support for %{name} scripts written in the Python language.
@@ -117,7 +115,7 @@ Support for %{name} scripts written in the Python language.
 %package tcl
 Summary:        Tcl Scripting Support for %{name}
 Group:          Productivity/Networking/IRC
-Requires:       %{name} = %{version}-%{release}
+Requires:       %{name} = %{version}
 
 %description tcl
 Support for %{name} scripts written in the Tcl language.
@@ -125,21 +123,18 @@ Support for %{name} scripts written in the Tcl language.
 %package ruby
 Summary:        Ruby Scripting Support for %{name}
 Group:          Productivity/Networking/IRC
-Requires:       %{name} = %{version}-%{release}
+Requires:       %{name} = %{version}
 
 %description ruby
 Support for %{name} scripts written in the Ruby language.
 
-%if 0%{?suse_version} > 1220
-
 %package aspell
 Summary:        Aspell Spell-Checking Support for %{name}
 Group:          Productivity/Networking/IRC
-Requires:       %{name} = %{version}-%{release}
+Requires:       %{name} = %{version}
 
 %description aspell
 Spell-checking support for %{name}, using the aspell library.
-%endif
 
 %prep
 %setup -q
@@ -152,41 +147,31 @@ find .  -name '*.[ch]' |\
 
 %build
 export CFLAGS="%{optflags}"
-mkdir build
-pushd build
-cmake \
-    -DCMAKE_INSTALL_PREFIX="%{_prefix}" \
+# Tests require cpputest package
+# no-undefined for perl seem not to work as desired
+%cmake \
+    -DCMAKE_EXE_LINKER_FLAGS=-Wl,--as-needed -DCMAKE_MODULE_LINKER_FLAGS=-Wl,--as-needed -DCMAKE_SHARED_LINKER_FLAGS=-Wl,--as-needed \
     -DLIBDIR="%{_libdir}" \
     -DPYTHON_LIBRARY="%{_libdir}/libpython%{py_ver}.so" \
     -DENABLE_ENCHANT=ON \
     -DENABLE_DOC=ON \
-    -DENABLE_MAN=ON \
-    ..
-make %{?_smp_flags} VERBOSE=1
-popd #build
+    -DENABLE_MAN=ON
+make %{?_smp_mflags}
 
 %install
-pushd build
-make DESTDIR=%{buildroot} install %{?_smp_mflags}
-popd #build
+%cmake_install
 
 # due to an unknown race condition cmake does not always create a compatibility
 # symlink
 ln -sf %{_bindir}/weechat %{buildroot}%{_bindir}/weechat-curses
 
 install -D -m 0644 "%{SOURCE1}" "%{buildroot}%{_datadir}/applications/%{name}.desktop"
-%if 0%{?suse_version}
 %suse_update_desktop_file -r "%{name}" Network IRCClient
-%endif
 
-%if 0%{?suse_version} > 1220
 mv "%{buildroot}%{_datadir}/doc/weechat" html
-%endif
 
 %find_lang "%{name}" --with-man
 
-%if 0%{?suse_version} > 1220
-
 %post
 %desktop_database_post
 %icon_theme_cache_post
@@ -194,15 +179,15 @@ mv "%{buildroot}%{_datadir}/doc/weechat" html
 %postun
 %desktop_database_postun
 %icon_theme_cache_postun
-%endif
+
+%files doc
+%defattr(-,root,root)
+%doc html/
 
 %files
 %defattr(-,root,root)
 %doc AUTHORS.asciidoc ChangeLog.asciidoc Contributing.asciidoc COPYING
 %doc README.asciidoc ReleaseNotes.asciidoc
-%if 0%{?suse_version} > 1220
-%doc html/
-%endif
 %{_bindir}/weechat-curses
 %{_bindir}/weechat
 %dir %{_libdir}/weechat
@@ -217,9 +202,7 @@ mv "%{buildroot}%{_datadir}/doc/weechat" html
 %{_libdir}/weechat/plugins/script.so
 %{_libdir}/weechat/plugins/trigger.so
 %{_libdir}/weechat/plugins/xfer.so
-%if 0%{?suse_version} > 1220
 %{_mandir}/man1/weechat.1*
-%endif
 %{_datadir}/applications/weechat.desktop
 %{_datadir}/icons/hicolor/*/apps/weechat.png
 
@@ -231,12 +214,9 @@ mv "%{buildroot}%{_datadir}/doc/weechat" html
 %{_includedir}/weechat
 %{_libdir}/pkgconfig/weechat.pc
 
-%if 0%{?suse_version} > 1220
-
 %files guile
 %defattr(-,root,root)
 %{_libdir}/weechat/plugins/guile.so
-%endif
 
 %files lua
 %defattr(-,root,root)
@@ -258,11 +238,8 @@ mv "%{buildroot}%{_datadir}/doc/weechat" html
 %defattr(-,root,root)
 %{_libdir}/weechat/plugins/ruby.so
 
-%if 0%{?suse_version} > 1220
-
 %files aspell
 %defattr(-,root,root)
 %{_libdir}/weechat/plugins/aspell.so
-%endif
 
 %changelog