LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File ccnet.spec of Package ccnet (Project home:Yali0n)

#
# spec file for package ccnet
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name:           ccnet
%define         libname   lib%{name}
%define         libsoname %{libname}0

Summary:        Seafile ccnet Client
Version:        6.0.1
Release:        0
License:        GPL-3.0+
Group:          Productivity/Networking/File-Sharing
Url:            https://github.com/haiwen/ccnet
Source0:        %{name}-%{version}.tar.gz
Source10:       %{name}-init_helper.sh
Source11:       %{name}-init.service
Source12:       %{name}.service
Source13:       %{name}-server-init.service
Source14:       %{name}-server.service
Source15:       %{name}.tmpfile
# PATCH-SuSE: several fixes (sysconfdir, logdir)
# Patch100:       my_ccnet.patch
# Patch101:       my_ccnet_work.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtool
BuildRequires:  glib2-devel >= 2.16.0
BuildRequires:  python-devel >= 2.6
BuildRequires:  libevent-devel
BuildRequires:  libjansson-devel
BuildRequires:  libsearpc-devel
BuildRequires:  libuuid-devel
BuildRequires:  libzdb-devel >= 2.10.2
BuildRequires:  openssl-devel
BuildRequires:  pkgconfig
BuildRequires:  sqlite3-devel
BuildRequires:  mysql-devel
BuildRequires:  vala >= 0.8
#
Requires:       %{name}-common = %{version}-%{release}
Requires:       %{libsoname} = %{version}-%{release}

%if 0%{?suse_version} >= 1210
BuildRequires:  systemd
%{?systemd_requires}
%define has_systemd 1
%endif

%description
Ccnet is a framework for writing networked applications in C
This package includes files for the Client

%package common
Summary:        Seafile ccnet common files
Group:          Productivity/Networking/File-Sharing
Requires: shadow

%description common
Ccnet is a framework for writing networked applications in C
This package includes files for the Server

%package server
Summary:        Seafile ccnet Server
Group:          Productivity/Networking/File-Sharing
Requires:       %{name}-common = %{version}-%{release}

%description server
Ccnet is a framework for writing networked applications in C
This package includes files for the Server

%package -n %{libsoname}
Summary:        Shared library for ccnet
Group:          System/Libraries

%description -n %{libsoname}
A simple C language RPC framework

This package contains the shared ccnet library.

%package devel
Summary:        Development files for ccnet
Group:          Development/Libraries/C and C++
Requires:       %{libsoname} = %{version}
Provides:       %{libname}-devel = %{version}-%{release}

%description devel
The libraries and header files for developing applications that
 use ccnet

%prep
%setup -q
# %patch100 -p1
# %patch101 -p1
sed -i -e /\(DESTDIR\)/d %{libname}.pc.in

%build
%{_sbindir}/groupadd -r seafile 2>/dev/null || :
%{_sbindir}/useradd -c "Seafile User" -d /srv/seafile -G seafile -g seafile \
  -r -s /bin/false seafile 2>/dev/null || :
./autogen.sh
%configure --disable-static \
  --disable-compile-demo \
  --enable-server
#  --enable-cluster \
make
#make %{?_smp_mflags}

%install

# get rid of an error like '/dev/fd/62: No such file or directory'
#ln -s /proc/self/fd /dev/fd
export NO_BRP_STRIP_DEBUG=true

%make_install

%{__install} -d -m 0750 %{buildroot}%{_sysconfdir}/%{name}
%{__install} -d -m 0750 %{buildroot}/srv/seafile

# install systemd stuff
%if 0%{?has_systemd}
%{__install} -D -m 0755 %{S:10} %{buildroot}%{_bindir}/%{name}-init_helper.sh
%{__install} -D -m 0644 %{S:11} %{buildroot}%{_unitdir}/%{name}-init.service
%{__install} -D -m 0644 %{S:12} %{buildroot}%{_unitdir}/%{name}.service
%{__install} -D -m 0644 %{S:13} %{buildroot}%{_unitdir}/%{name}-server-init.service
%{__install} -D -m 0644 %{S:14} %{buildroot}%{_unitdir}/%{name}-server.service
# systemd need to create a tmp dir: /run/proftpd
%{__install} -D -m 0644 %{S:15} %{buildroot}%{_prefix}/lib/tmpfiles.d/%{name}.conf
%if 0%{?suse_version} <= 1220
%{__install} -d -m 0755 %{buildroot}/run/seafile
%{__install} -d -m 0750 %{buildroot}%{_localstatedir}/log/seafile
%endif
%endif

## remove static libs
find %{buildroot} -name '*.la' -exec rm -f {} \;

### ----- Client -----
%pre
# on `rpm -ivh` PARAM is 1
# on `rpm -Uvh` PARAM is 2
%if 0%{?has_systemd}
%service_add_pre %{name}-init.service
%service_add_pre %{name}.service
%endif

%preun
# on `rpm -e` PARAM is 0
%if 0%{?has_systemd}
%service_del_preun %{name}-init.service
%service_del_preun %{name}.service
%endif

%post
# on `rpm -ivh` PARAM is 1
# on `rpm -Uvh` PARAM is 2
%if 0%{?has_systemd}
%service_add_post %{name}-init.service
%service_add_post %{name}.service
%endif

%postun
# on `rpm -e` PARAM is 0
%if 0%{?has_systemd}
%service_del_postun %{name}-init.service
%service_del_postun %{name}.service
%endif

### ----- Common -----
%pre common
# on `rpm -ivh` PARAM is 1
# on `rpm -Uvh` PARAM is 2
if [ -z  "`%{_bindir}/getent group seafile 2>/dev/null`" ]; then
  %{_sbindir}/groupadd -r seafile 2>/dev/null
fi
if
[ -z "`%{_bindir}/getent passwd seafile 2>/dev/null`" ]; then
  %{_sbindir}/useradd -c "Seafile User" -d /srv/seafile -G seafile -g seafile \
  -r -s /bin/false seafile 2>/dev/null
fi

%post common
# on `rpm -ivh` PARAM is 1
# on `rpm -Uvh` PARAM is 2
%if 0%{?has_systemd}
# Create our dirs immediatly, after a manual package install.
# After a reboot systemd/aaa_base will take care.
%{__install} -d /run/seafile
%{__install} -d %{_localstatedir}/log/seafile
%endif

### ----- Server -----
%pre server
# on `rpm -ivh` PARAM is 1
# on `rpm -Uvh` PARAM is 2
%if 0%{?has_systemd}
%service_add_pre %{name}-server-init.service
%service_add_pre %{name}-server.service
%endif

%preun server
# on `rpm -e` PARAM is 0
%if 0%{?has_systemd}
%service_del_preun %{name}-server-init.service
%service_del_preun %{name}-server.service
%endif

%post server
# on `rpm -ivh` PARAM is 1
# on `rpm -Uvh` PARAM is 2
%if 0%{?has_systemd}
%service_add_post %{name}-server-init.service
%service_add_post %{name}-server.service
%endif

%postun server
# on `rpm -e` PARAM is 0
%if 0%{?has_systemd}
%service_del_postun %{name}-server-init.service
%service_del_postun %{name}-server.service
%endif

%post   -n %{libsoname} -p /sbin/ldconfig

%postun -n %{libsoname} -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc LICENCE.txt
%{_bindir}/%{name}-tool
%{_bindir}/%{name}
%if 0%{?has_systemd}
%{_unitdir}/%{name}-init.service
%{_unitdir}/%{name}.service
%endif

%files common
%defattr(-,root,root)
%doc COPYRIGHT LICENCE.txt README.markdown
%attr(0750,seafile,root) %dir %{_sysconfdir}/%{name}
%{_bindir}/%{name}-init_helper.sh
%{_bindir}/%{name}-init
%{python_sitearch}/%{name}
%if 0%{?has_systemd}
%{_prefix}/lib/tmpfiles.d/%{name}.conf
%attr(0755,seafile,seafile) %ghost %dir /run/seafile
%attr(0750,seafile,seafile) %ghost %dir %{_localstatedir}/log/seafile
%endif
%attr(0750,seafile,seafile) %dir /srv/seafile

%files server
%defattr(-,root,root)
%doc LICENCE.txt
%{_bindir}/%{name}-servtool
%{_bindir}/%{name}-server
%if 0%{?has_systemd}
%{_unitdir}/%{name}-server-init.service
%{_unitdir}/%{name}-server.service
%endif

%files -n %{libsoname}
%defattr(-,root,root)
%{_libdir}/%{libname}.so.*

%files devel
%defattr(-,root,root)
%doc COPYRIGHT LICENCE.txt README.markdown
%{_includedir}/*
%{_libdir}/%{libname}.so
%{_libdir}/pkgconfig/%{libname}.pc

%changelog