From c6eec582c412347deeb9681922c1c204c49d74b0 Mon Sep 17 00:00:00 2001
From: François Andriot <albator78@libertysurf.fr>
Date: Mon, 14 Jul 2014 00:03:38 +0200
Subject: RPM Packaging: build 3.5.13.2 for CentOS 7

---
 redhat/Makefile.v3.5.13-sru                        |  38 ++++++++++++---------
 .../bibletime-3.5.13.2-fix_sword_detection.patch   |  38 +++++++++++++++++++++
 .../applications/bibletime/bibletime-3.5.13.2.spec |   4 +--
 .../applications/kaffeine/kaffeine-3.5.13.2.spec   |   2 +-
 .../trinity-desktop/trinity-desktop-3.5.13.2.spec  |  14 ++++++--
 redhat/packages.el7                                |   1 +
 redhat/tdeartwork/tdeartwork-3.5.13.2.spec         |   2 ++
 redhat/tdebase/tdebase-3.5.13.2.spec               |   4 ++-
 redhat/tdebase/tdm.el7.pp                          | Bin 936 -> 931 bytes
 redhat/tdebase/tdm.el7.te                          |  11 ++++++
 10 files changed, 90 insertions(+), 24 deletions(-)
 create mode 100644 redhat/applications/bibletime/bibletime-3.5.13.2-fix_sword_detection.patch

diff --git a/redhat/Makefile.v3.5.13-sru b/redhat/Makefile.v3.5.13-sru
index c8f449346..c3ad3e7c5 100644
--- a/redhat/Makefile.v3.5.13-sru
+++ b/redhat/Makefile.v3.5.13-sru
@@ -120,20 +120,20 @@ ifneq ($(wildcard /etc/mageia-release /boot/vmlinuz*.el7*),)
 endif
 
 gnuchess:
-# Build on CentOS 5 only
-ifneq ($(wildcard /boot/vmlinuz*.el5*),)
+# Build on CentOS 5, CentOS 7
+ifneq ($(wildcard /boot/vmlinuz*.el5* /boot/vmlinuz*.el7*),)
 	$(call buildpkg,3rdparty/gnuchess)
 endif
 
 hal: hal-info
-# Do NOT build on CentOS
-ifeq ($(wildcard /etc/centos-release),)
+# Do NOT build on CentOS 5, CentOS 6
+ifeq ($(wildcard /boot/vmlinuz*.el5* /boot/vmlinuz*.el6*),)
 	$(call buildpkg,3rdparty/hal)
 endif
 
 hal-info:
-# Do NOT build on CentOS
-ifeq ($(wildcard /etc/centos-release),)
+# Do NOT build on CentOS 5, CentOS 6
+ifeq ($(wildcard /boot/vmlinuz*.el5* /boot/vmlinuz*.el6*),)
 	$(call buildpkg,3rdparty/hal-info)
 endif
 
@@ -160,20 +160,20 @@ ifneq ($(wildcard /boot/vmlinuz*.el5*),)
 endif
 
 libotr3:
-# Build on Mageia only
-ifneq ($(wildcard /etc/mageia-release),)
+# Build on Mageia, CentOS >= 7
+ifneq ($(wildcard /etc/mageia-release /boot/vmlinuz*.el7*),)
 	$(call buildpkg,3rdparty/libotr3)
 endif
 
 lilypond: mftrace
-# Build on CentOS only
-ifneq ($(wildcard /etc/centos-release),)
+# Build on CentOS 6 only
+ifneq ($(wildcard /boot/vmlinuz*.el6*),)
 	$(call buildpkg,3rdparty/lilypond)
 endif
 
 mftrace:
-# Build on CentOS only
-ifneq ($(wildcard /etc/centos-release),)
+# Build on CentOS 6 only
+ifneq ($(wildcard /boot/vmlinuz*.el6*),)
 	$(call buildpkg,3rdparty/mftrace)
 endif
 
@@ -199,8 +199,8 @@ ifneq ($(wildcard /boot/vmlinuz*.el5*),)
 endif
 
 sword:
-# Build on Fedora >= 20 only, or PCLinuxOS
-ifneq ($(wildcard /boot/vmlinuz*.fc20* /etc/pclinuxos-release),)
+# Build on Fedora >= 20, PCLinuxOS, CentOS >= 7
+ifneq ($(wildcard /boot/vmlinuz*.fc20* /etc/pclinuxos-release /boot/vmlinuz*.el7*),)
 	$(call buildpkg,3rdparty/sword)
 endif
 
@@ -341,9 +341,10 @@ kerry:	tdebase
 
 kgtk-qt3:	tdebase
 # Do NOT build on CentOS 5 (GTK2 is too old)
+# Do NOT build on CentOS >=7 (GTK2 is too new)
 # Do NOT build on Fedora >= 20 (GTK2 is too new)
 # Do NOT build on Mageia >= 4 (GTK2 is too new)
-ifeq ($(wildcard /boot/vmlinuz*.el5* /boot/vmlinuz*.fc20* /boot/vmlinuz*.mga4*),)
+ifeq ($(wildcard /boot/vmlinuz*.el5* /boot/vmlinuz*.el7* /boot/vmlinuz*.fc20* /boot/vmlinuz*.mga4*),)
 	$(call buildpkg,applications/kgtk-qt3)
 endif
 
@@ -447,8 +448,8 @@ potracegui:	tdebase
 	$(call buildpkg,applications/potracegui)
 
 rosegarden:	tdebase lilypond
-# Do NOT build on CentOS 5
-ifeq ($(wildcard /boot/vmlinuz*.el5*),)
+# Do NOT build on CentOS 5, CentOS 7
+ifeq ($(wildcard /boot/vmlinuz*.el5* /boot/vmlinuz*.el7*),)
 	$(call buildpkg,applications/rosegarden)
 endif
 
@@ -474,7 +475,10 @@ tdeio-umountwrapper:	tdebase
 	$(call buildpkg,applications/tdeio-umountwrapper)
 
 tderadio:	tdebase
+# Do NOT build on CentOS 7
+ifeq ($(wildcard /boot/vmlinuz*.el7*),)
 	$(call buildpkg,applications/tderadio)
+endif
 
 tde-style-lipstik:	tdebase
 	$(call buildpkg,applications/tde-style-lipstik)
diff --git a/redhat/applications/bibletime/bibletime-3.5.13.2-fix_sword_detection.patch b/redhat/applications/bibletime/bibletime-3.5.13.2-fix_sword_detection.patch
new file mode 100644
index 000000000..0f6364921
--- /dev/null
+++ b/redhat/applications/bibletime/bibletime-3.5.13.2-fix_sword_detection.patch
@@ -0,0 +1,38 @@
+commit 298da70ab4f6da3780c617a85957a80f2e7ae71b
+Author: Francois Andriot <francois.andriot@free.fr>
+Date:   1398949579 +0200
+
+    Fix FTBFS on Fedora 20
+    Fix custom-installed Sword detection
+
+diff --git a/bibletime/backend/clanguagemgr.cpp b/bibletime/backend/clanguagemgr.cpp
+index 8f73ec3..ac94790 100644
+--- a/bibletime/backend/clanguagemgr.cpp
++++ b/bibletime/backend/clanguagemgr.cpp
+@@ -95,10 +95,10 @@ const CLanguageMgr::LangMap& CLanguageMgr::availableLanguages() {
+ 
+ 		for (ListCSwordModuleInfo::iterator it(mods.begin()); it != end_it; ++it) {
+ 			//   for (CSwordModuleInfo* m = mods.first(); m; m = mods.next()) {
+-			abbrev = (*it)->module()->Lang();
++			const char* mod = (*it)->module()->Lang();
+ 
+-			if (abbrev && !abbrevs.contains(abbrev)) {
+-				abbrevs.append( abbrev );
++			if (mod && !abbrevs.contains(mod)) {
++				abbrevs.append( mod );
+ 			}
+ 		};
+ 
+diff --git a/sword.m4 b/sword.m4
+index 2f19b3f..8326ba3 100644
+--- a/sword.m4
++++ b/sword.m4
+@@ -28,7 +28,7 @@ AC_ARG_ENABLE(static-sword,
+ dnl try to find Sword library files
+ AC_MSG_CHECKING([for Sword library files])
+ AC_REQUIRE([AC_FIND_ZLIB])
+-ac_sword_library_dirs="$ac_sword_dir/lib $exec_prefix/lib $prefix/lib /usr/lib /usr/lib64 /usr/lib/sword /usr/local/lib /usr/local/lib/sword /usr/local/sword/lib"
++ac_sword_library_dirs="$ac_sword_dir/lib64 $ac_sword_dir/lib $exec_prefix/lib $prefix/lib64 $prefix/lib /usr/lib /usr/lib64 /usr/lib/sword /usr/local/lib /usr/local/lib/sword /usr/local/sword/lib"
+ 
+ if test "x$ac_static_sword" = "xYES"; then
+ 	SEARCH_LIBS="libsword.a";
diff --git a/redhat/applications/bibletime/bibletime-3.5.13.2.spec b/redhat/applications/bibletime/bibletime-3.5.13.2.spec
index 9a1848430..a6cac4a44 100644
--- a/redhat/applications/bibletime/bibletime-3.5.13.2.spec
+++ b/redhat/applications/bibletime/bibletime-3.5.13.2.spec
@@ -40,7 +40,7 @@ BuildRoot:		%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 Source0:		%{name}-%{tde_version}%{?preversion:~%{preversion}}.tar.gz
 
-Patch0:			bibletime-14.0.0-ftbfs.patch
+Patch0:			bibletime-3.5.13.2-fix_sword_detection.patch
 
 BuildRequires:	trinity-tqtinterface-devel >= %{tde_version}
 BuildRequires:	trinity-arts-devel >= 1:1.5.10
@@ -105,7 +105,7 @@ export PKG_CONFIG_PATH="%{tde_libdir}/pkgconfig:${PKG_CONFIG_PATH}"
   --enable-closure \
   --enable-rpath \
   \
-%if 0%{?fedora} >= 20 || 0%{?pclinuxos}
+%if 0%{?fedora} >= 20 || 0%{?pclinuxos} || 0%{?rhel} >= 7
   --with-sword-dir=%{tde_prefix}
 %endif
 
diff --git a/redhat/applications/kaffeine/kaffeine-3.5.13.2.spec b/redhat/applications/kaffeine/kaffeine-3.5.13.2.spec
index 0570ac1ac..298618821 100644
--- a/redhat/applications/kaffeine/kaffeine-3.5.13.2.spec
+++ b/redhat/applications/kaffeine/kaffeine-3.5.13.2.spec
@@ -56,7 +56,7 @@ BuildRequires:	libcdda-devel
 BuildRequires:	cdparanoia
 BuildRequires:	cdparanoia-devel
 %endif
-%if 0%{?suse_version} >= 1210 || 0%{?fedora} >= 19
+%if 0%{?suse_version} >= 1210 || 0%{?fedora} >= 19 || 0%{?rhel} >= 7
 BuildRequires:	libcdio-paranoia-devel
 %endif
 
diff --git a/redhat/extras/trinity-desktop/trinity-desktop-3.5.13.2.spec b/redhat/extras/trinity-desktop/trinity-desktop-3.5.13.2.spec
index 2a03dabce..3ebb6f2a1 100644
--- a/redhat/extras/trinity-desktop/trinity-desktop-3.5.13.2.spec
+++ b/redhat/extras/trinity-desktop/trinity-desktop-3.5.13.2.spec
@@ -161,7 +161,6 @@ Requires: trinity-tde-systemsettings
 Requires: trinity-tdeio-apt
 Requires: trinity-tdeio-locate
 Requires: trinity-tdeio-umountwrapper
-Requires: trinity-tderadio
 Requires: trinity-tdmtheme
 Requires: trinity-tellico
 Requires: trinity-wlassistant
@@ -178,12 +177,21 @@ Requires: trinity-tdesudo
 Requires: trinity-kpowersave
 # On RHEL 5, GTK2 version is too old for GTK stuff ...
 Requires: trinity-gtk-qt-engine
-# On RHEL 5, lilypond is not available, so no rosegarden :'-(
-Requires: trinity-rosegarden
 # RHEL5: kpilot library is too old
 Requires: trinity-kpilot
 %endif
 
+# On RHEL 5/7, lilypond is not available, so no rosegarden :'-(
+%if 0%{?rhel} == 5 || 0%{?rhel} == 7
+%else
+Requires: trinity-rosegarden
+%endif
+
+# On RHEL 7, lirc is not available, so not tderaiod :'-(
+%if 0%{?rhel} != 7
+Requires: trinity-tderadio
+%endif
+
 # This one causes several crashes . Obsolete.
 #Requires: trinity-kgtk-qt3
 #Obsoletes: trinity-kgtk-qt3
diff --git a/redhat/packages.el7 b/redhat/packages.el7
index 40be773cf..ba1ff1fa1 100644
--- a/redhat/packages.el7
+++ b/redhat/packages.el7
@@ -186,3 +186,4 @@ xscreensaver
 xscreensaver-extras
 xulrunner-devel
 xz-devel
+libcdio-paranoia-devel
diff --git a/redhat/tdeartwork/tdeartwork-3.5.13.2.spec b/redhat/tdeartwork/tdeartwork-3.5.13.2.spec
index bd3e91d21..332172181 100644
--- a/redhat/tdeartwork/tdeartwork-3.5.13.2.spec
+++ b/redhat/tdeartwork/tdeartwork-3.5.13.2.spec
@@ -65,6 +65,7 @@ BuildRequires:	libart_lgpl-devel
 
 # XSCREENSAVER support
 %if 0%{?fedora} >= 15 || 0%{?mgaversion} || 0%{?mdkversion} || 0%{?rhel} >= 6 || 0%{?suse_version}
+%if 0%{?rhel} == 0 || 0%{?rhel} <= 6
 %define with_xscreensaver 1
 %if 0%{?mgaversion} || 0%{?mdkversion}
 %if 0%{?mgaversion} >= 4
@@ -97,6 +98,7 @@ BuildRequires:	xscreensaver-data-extra
 %define with_webcollage 1
 %endif
 
+%endif
 %endif
 
 # JACK support
diff --git a/redhat/tdebase/tdebase-3.5.13.2.spec b/redhat/tdebase/tdebase-3.5.13.2.spec
index 83e9502a9..2de34ad5e 100644
--- a/redhat/tdebase/tdebase-3.5.13.2.spec
+++ b/redhat/tdebase/tdebase-3.5.13.2.spec
@@ -446,6 +446,7 @@ BuildRequires:	OpenEXR-devel
 # XSCREENSAVER support
 #  Disabled on RHEL4, RHEL >= 7
 %if 0%{?fedora} >= 15 || 0%{?mgaversion} || 0%{?mdkversion} || 0%{?rhel} >= 5 || 0%{?suse_version}
+%if 0%{?rhel} == 0 || 0%{?rhel} <= 6
 %define with_xscreensaver 1
 %if 0%{?rhel} == 5
 BuildRequires:	xorg-x11-proto-devel
@@ -466,6 +467,7 @@ BuildRequires:	libXScrnSaver-devel
 BuildRequires:	xscreensaver
 %endif
 %endif
+%endif
 
 # AVAHI support
 #  Disabled on RHEL4 and RHEL5
@@ -3601,7 +3603,7 @@ EOF
 
 # TDM configuration
 %__sed -i "%{?buildroot}%{_sysconfdir}/trinity/kdm/kdmrc" \
-%if 0%{?fedora} >= 16 || 0%{?suse_version} >= 1210
+%if 0%{?fedora} >= 16 || 0%{?suse_version} >= 1210 || 0%{?rhel} >= 7
 	-e "s/^#*MinShowUID=.*/MinShowUID=1000/"
 %else
 	-e "s/^#*MinShowUID=.*/MinShowUID=500/"
diff --git a/redhat/tdebase/tdm.el7.pp b/redhat/tdebase/tdm.el7.pp
index dec162d22..855c3860d 100644
Binary files a/redhat/tdebase/tdm.el7.pp and b/redhat/tdebase/tdm.el7.pp differ
diff --git a/redhat/tdebase/tdm.el7.te b/redhat/tdebase/tdm.el7.te
index e69de29bb..1c721d90b 100644
--- a/redhat/tdebase/tdm.el7.te
+++ b/redhat/tdebase/tdm.el7.te
@@ -0,0 +1,11 @@
+
+module tdm.el7 1.0;
+
+require {
+        type fprintd_t;
+        type init_t;
+        class dbus send_msg;
+}
+
+#============= fprintd_t ==============
+allow fprintd_t init_t:dbus send_msg;
-- 
cgit v1.2.3

