diff --git a/znc-crashbug.patch b/znc-crashbug.patch deleted file mode 100644 index 0995b80..0000000 --- a/znc-crashbug.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff --git a/modules/webadmin.cpp b/modules/webadmin.cpp -index 40a28d3..90ddfd2 100644 ---- a/modules/webadmin.cpp -+++ b/modules/webadmin.cpp -@@ -668,13 +668,19 @@ class CWebAdminMod : public CModule { - return true; - } - -- if (pNetwork->FindChan(sChanName.Token(0))) { -- WebSock.PrintErrorPage("Channel [" + sChanName.Token(0) + "] already exists"); -+ // This could change the channel name and e.g. add a "#" prefix -+ pChan = new CChan(sChanName, pNetwork, true); -+ -+ if (pNetwork->FindChan(pChan->GetName())) { -+ WebSock.PrintErrorPage("Channel [" + pChan->GetName() + "] already exists"); -+ delete pChan; - return true; - } - -- pChan = new CChan(sChanName, pNetwork, true); -- pNetwork->AddChan(pChan); -+ if (!pNetwork->AddChan(pChan)) { -+ WebSock.PrintErrorPage("Could not add channel [" + pChan->GetName() + "]"); -+ return true; -+ } - } - - pChan->SetBufferCount(WebSock.GetParam("buffercount").ToUInt(), spSession->IsAdmin()); -@@ -700,7 +706,7 @@ class CWebAdminMod : public CModule { - - CTemplate TmplMod; - TmplMod["User"] = pUser->GetUserName(); -- TmplMod["ChanName"] = sChanName; -+ TmplMod["ChanName"] = pChan->GetName(); - TmplMod["WebadminAction"] = "change"; - FOR_EACH_MODULE(it, pNetwork) { - (*it)->OnEmbeddedWebRequest(WebSock, "webadmin/channel", TmplMod); diff --git a/znc-modperl.patch b/znc-modperl.patch deleted file mode 100644 index cd4276f..0000000 --- a/znc-modperl.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- znc-0.2-alpha1-original/modules/modperl/Makefile.inc 2011-08-05 16:27:44.000000000 -0500 -+++ znc-0.2-alpha1/modules/modperl/Makefile.inc 2011-08-05 17:24:25.658100254 -0500 -@@ -43,7 +43,7 @@ - @mkdir -p modperl - $(Q)$(PERL) $(srcdir)/modperl/codegen.pl $< $@ - --modperl_install: create_install_dir modperl.so -+modperl_install: install_datadir modperl.so - for i in $(wildcard $(srcdir)/*.pm); do \ - $(INSTALL_DATA) $$i $(DESTDIR)$(MODDIR); \ - done diff --git a/znc-modpython.patch b/znc-modpython.patch deleted file mode 100644 index c113c2e..0000000 --- a/znc-modpython.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- znc-0.2-alpha1-original/modules/modpython/Makefile.inc 2011-08-05 16:27:44.000000000 -0500 -+++ znc-0.2-alpha1/modules/modpython/Makefile.inc 2011-08-05 17:24:07.317001140 -0500 -@@ -58,7 +58,7 @@ - $(E) Building optimizer for python files... - $(Q)$(CXX) $(PYTHONCOMMON) -o $@ $< $(PY_LDFLAGS) - --modpython_install: create_install_dir modpython_all -+modpython_install: install_datadir modpython_all - -for i in *.pyc; do \ - $(INSTALL_DATA) $$i $(DESTDIR)$(MODDIR); \ - done diff --git a/znc-release.patch b/znc-release.patch deleted file mode 100644 index cacd27c..0000000 --- a/znc-release.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- znc-0.200-rc1-orig/znc.cpp 2011-08-13 01:36:13.000000000 -0500 -+++ znc-0.200-rc1/znc.cpp 2011-08-13 16:56:21.118177776 -0500 -@@ -84,7 +84,7 @@ - } - - char szBuf[128]; -- snprintf(szBuf, sizeof(szBuf), "ZNC %1.3f"VERSION_EXTRA" - http://znc.in", VERSION); -+ snprintf(szBuf, sizeof(szBuf), "ZNC %1.3f - http://znc.in", VERSION); - // If snprintf overflows (which I doubt), we want to be on the safe side - szBuf[sizeof(szBuf) - 1] = '\0'; - diff --git a/znc.spec b/znc.spec index c5aaa46..c530084 100644 --- a/znc.spec +++ b/znc.spec @@ -1,69 +1,72 @@ -# Define variables to use in conditionals -%define use_systemd 0 +# ZNC is a daemon application and that's why needs hardening +%global _hardened_build 1 -%if 0%{?fedora} >= 15 -%define use_systemd 1 -%endif +# Define variables to use in conditionals +%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 +%global use_systemd 1 +%endif # 0%{?fedora} >= 15 || 0%{?rhel} >= 7 -%global _hardened_build 1 +%if 0%{?fedora} || 0%{?rhel} >= 6 +%global with_modperl 1 +%endif # 0%{?fedora} || 0%{?rhel} >= 6 -%global __python %{__python3} +%if 0%{?fedora} >= 13 || 0%{?rhel} >= 8 +%global with_modpython 1 +%endif # 0%{?fedora} >= 13 || 0%{?rhel} >= 8 -Summary: An advanced IRC bouncer Name: znc Version: 1.4 -#Release: 0.1.20110801git%{?dist} -#Release: 0.4.rc2%{?dist} -Release: 4%{?dist} -License: ASL 2.0 +Release: 5%{?dist} +Summary: An advanced IRC bouncer Group: System Environment/Daemons + +License: ASL 2.0 URL: http://znc.in -Source0: http://znc.in/releases/znc-1.4.tar.gz -#Patch0: znc-crashbug.patch +Source0: %{url}/releases/%{name}-%{version}.tar.gz -%if %{use_systemd} +%if 0%{?use_systemd} Source1: znc.service -%endif - -%if !%{use_systemd} +%else # 0%{?use_systemd} Source1: znc.init -%endif +%endif # 0%{?use_systemd} -# git clone https://github.com/znc/znc.git -# cd znc -# git archive --prefix=znc/ HEAD | xz > ../znc-0.097.tar.gz +%if 0%{?rhel} && 0%{?rhel} <= 5 +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) +%endif # 0%{?rhel} && 0%{?rhel} <= 5 -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root -BuildRequires: perl gcc-c++ +BuildRequires: automake +BuildRequires: c-ares-devel +BuildRequires: cyrus-sasl-devel +BuildRequires: gettext-devel BuildRequires: openssl-devel >= 0.9.8 -BuildRequires: cyrus-sasl-devel gettext-devel -BuildRequires: c-ares-devel automake python3-devel -BuildRequires: perl(ExtUtils::Embed) swig tcl-devel +BuildRequires: perl(ExtUtils::Embed) + +%if (0%{?fedora} && 0%{?fedora} <= 24) || (0%{?rhel} && 0%{?rhel} <= 9) Obsoletes: znc-extra <= %{version}-%{release} +%endif # (0%{?fedora} && 0%{?fedora} <= 24) || (0%{?rhel} && 0%{?rhel} <= 9) -%if %{use_systemd} +%if 0%{?use_systemd} BuildRequires: systemd-units %endif Requires(pre): shadow-utils -%if %{use_systemd} +%if 0%{?use_systemd} Requires(post): systemd-units Requires(post): systemd-sysv Requires(preun): systemd-units Requires(postun): systemd-units -%endif - -%if !%{use_systemd} +%else # 0%{?use_systemd} Requires(post): chkconfig Requires(preun): chkconfig # This is for /sbin/service Requires(preun): initscripts -%endif +%endif # 0%{?use_systemd} %description ZNC is an IRC bouncer with many advanced features like detaching, multiple users, per channel playback buffer, SSL, IPv6, transparent DCC bouncing, Perl and C++ module support to name a few. + %package devel Summary: Development files needed to compile ZNC modules Group: Development/Libraries @@ -75,112 +78,138 @@ BuildRequires: pkgconfig All includes and program files you need to compile your own znc modules. + %package modtcl Summary: TCL module for ZNC Group: Development/Libraries + +BuildRequires: tcl-devel + Requires: %{name} = %{version}-%{release} Requires: tcl %description modtcl TCL module for ZNC + +%if 0%{?with_modperl} %package modperl Summary: perl module for ZNC Group: Development/Libraries + +BuildRequires: perl-devel +BuildRequires: swig + Requires: %{name} = %{version}-%{release} Requires: perl + Provides: perl(ZNC::Module) = %{version}-%{release} %description modperl perl module for ZNC +%endif # 0%{?with_modperl} + +%if 0%{?with_modpython} %package modpython Summary: python3 module for ZNC Group: Development/Libraries + +BuildRequires: python3-devel +BuildRequires: swig + Requires: %{name} = %{version}-%{release} Requires: python3 %description modpython python3 module for ZNC +%endif # 0%{?with_modpython} + %prep -%setup -q -n %{name}-%{version} -#%setup -q -n znc-1.2-rc2 -#%patch0 -p1 +%setup -q %__perl -pi.add_release -e 's|(?<="ZNC \%1\.3f)|-%{release}|' znc.cpp chmod -x modules/q.cpp + %build ./autogen.sh %configure \ --with-module-prefix=%{_libdir}/znc \ - --enable-ipv6 --enable-sasl --enable-python --enable-perl --enable-tcl +%if 0%{?with_modperl} + --enable-perl +%else + --disable-perl +%endif # 0%{?with_modperl} +%if 0%{?with_modpython} + --enable-python \ +%else # 0%{?with_modpython} + --disable-python \ +%endif # 0%{?with_modpython} + --enable-ipv6 --enable-sasl --enable-tcl %__make %{?_smp_mflags} -%pre -#%if %{use_systemd} -getent group znc >/dev/null || groupadd -r znc -getent passwd znc >/dev/null || \ - useradd -r -g znc -d /var/lib/znc -s /sbin/nologin \ - -c "Account for ZNC to run as" znc -mkdir -p /var/lib/znc -chown znc:znc /var/lib/znc -#exit 0 -#%endif %install +%if 0%{?rhel} && 0%{?rhel} <= 5 %__rm -Rf "%{buildroot}" +%endif # 0%{?rhel} && 0%{?rhel} <= 5 %__make install DESTDIR="%{buildroot}" -%if %{use_systemd} +%if 0%{?use_systemd} mkdir -p %buildroot%{_unitdir} install -m 0644 %{SOURCE1} %buildroot%{_unitdir}/znc.service -%endif -%if !%{use_systemd} +%else # 0%{?use_systemd} mkdir -p %buildroot%{_initrddir} install -Dp -m0755 %{SOURCE1} %{buildroot}%{_initrddir}/znc -%endif +%endif # 0%{?use_systemd} + +%if 0%{?rhel} && 0%{?rhel} <= 5 %clean %__rm -Rf "%{buildroot}" +%endif # 0%{?rhel} && 0%{?rhel} <= 5 -%post -%if %{use_systemd} -%systemd_post znc.service -%endif +%pre +getent group znc >/dev/null || groupadd -r znc +getent passwd znc >/dev/null || \ + useradd -r -g znc -d /var/lib/znc -s /sbin/nologin \ + -c "Account for ZNC to run as" znc +mkdir -p /var/lib/znc +chown znc:znc /var/lib/znc -%if !%{use_systemd} + +%post +%if 0%{?use_systemd} +%systemd_post znc.service +%else # 0%{?use_systemd} # This adds the proper /etc/rc*.d links for the script /sbin/chkconfig --add znc -%endif +%endif # 0%{?use_systemd} -%postun -%if %{use_systemd} +%postun +%if 0%{?use_systemd} %systemd_postun_with_restart znc.service -%endif - -%if !%{use_systemd} +%else # 0%{?use_systemd} if [ "$1" -ge "1" ] ; then /sbin/service znc condrestart >/dev/null 2>&1 || : fi -%endif +%endif # 0%{?use_systemd} -%preun -%if %{use_systemd} +%preun +%if 0%{?use_systemd} %systemd_preun znc.service -%endif - -%if !%{use_systemd} +%else # 0%{?use_systemd} if [ $1 -eq 0 ] ; then /sbin/service znc stop >/dev/null 2>&1 || : /sbin/chkconfig --del znc || : fi -%endif +%endif # 0%{?use_systemd} + %files -%defattr(-,root,root) %doc AUTHORS LICENSE README.md %{_bindir}/znc %{_mandir}/man1/* @@ -238,36 +267,44 @@ fi %{_libdir}/znc/watch.so %{_libdir}/znc/webadmin.so %{_datadir}/znc/ -%if %{use_systemd} +%if 0%{?use_systemd} %{_unitdir}/znc.service -%endif -%if !%{use_systemd} +%else # 0%{?use_systemd} %{_initrddir}/znc -%endif +%endif # 0%{?use_systemd} %files devel -%defattr(-,root,root) %{_bindir}/znc-buildmod #%{_bindir}/znc-config %{_libdir}/pkgconfig/%{name}.pc %{_includedir}/znc/ %files modtcl -%defattr(-,root,root) %{_libdir}/znc/modtcl.so +%if 0%{?with_modperl} %files modperl -%defattr(-,root,root) %{_libdir}/znc/modperl/ %{_libdir}/znc/modperl.so %{_libdir}/znc/perleval.pm +%endif # 0%{?with_modperl} +%if 0%{?with_modpython} %files modpython -%defattr(-,root,root) %{_libdir}/znc/modpython/ %{_libdir}/znc/modpython.so +%endif # 0%{?with_modpython} + %changelog +* Sun Aug 03 2014 Björn Esser - 1.4-5 +- skip the python-subpkg on EPEL <= 7 +- replaced %%define with %%global +- removed %%defattr, since it is not needed for recent releases +- conditionalized stuff for el <= 5 +- small cleanups +- purged unused patches + * Sat Jun 07 2014 Fedora Release Engineering - 1.4-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild