You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

157 lines
4.1 KiB

Name: shadowsocks-libev
Version: VERSION
Release: 1%{?dist}
Summary: A lightweight and secure socks5 proxy
Group: Applications/Internet
License: GPLv3+
URL: https://github.com/shadowsocks/%{name}
Source0: %{url}/archive/v%{version}.tar.gz
AutoReq: no
Conflicts: python-shadowsocks python3-shadowsocks
BuildRequires: make gcc pcre-devel asciidoc xmlto automake libtool mbedtls-devel libsodium-devel >= 1.0.4 libev-devel udns-devel
Requires: pcre mbedtls libsodium >= 1.0.4
Requires: libev udns
%if 0%{?suse_version}
Requires: libopenssl1_0_0
BuildRequires: libopenssl-devel
%else
Requires: openssl
BuildRequires: openssl-devel
%endif
%if 0%{?fedora} >= 15 || 0%{?rhel} >=7 || 0%{?suse_version} >= 1210
%global use_systemd 1
%else
%global use_systemd 0
%endif
%if 0%{?use_systemd}
%{?systemd_requires}
%if 0%{?suse_version}
BuildRequires: systemd-rpm-macros
%else
BuildRequires: systemd
%endif
%endif
%description
shadowsocks-libev is a lightweight secured scoks5 proxy for embedded devices and low end boxes.
%prep
%setup -q
%build
./autogen.sh
%if 0%{?use_system_lib}
%configure --enable-shared --enable-system-shared-lib
%else
%configure --enable-shared
%endif
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot}
mkdir -p %{buildroot}/etc/shadowsocks-libev
%if ! 0%{?use_systemd}
mkdir -p %{buildroot}%{_initddir}
install -m 755 %{_builddir}/%{buildsubdir}/rpm/SOURCES/etc/init.d/shadowsocks-libev %{buildroot}%{_initddir}/shadowsocks-libev
%else
mkdir -p %{buildroot}%{_sysconfdir}/default
mkdir -p %{buildroot}%{_unitdir}
install -m 644 %{_builddir}/%{buildsubdir}/debian/shadowsocks-libev.default %{buildroot}%{_sysconfdir}/default/shadowsocks-libev
install -m 644 %{_builddir}/%{buildsubdir}/debian/shadowsocks-libev.service %{buildroot}%{_unitdir}/shadowsocks-libev.service
install -m 644 %{_builddir}/%{buildsubdir}/debian/shadowsocks-libev-*.service %{buildroot}%{_unitdir}/
%endif
install -m 644 %{_builddir}/%{buildsubdir}/debian/config.json %{buildroot}%{_sysconfdir}/shadowsocks-libev/config.json
mkdir -p %{buildroot}%{_datadir}/bash-completion/completions/
install -m 644 %{_builddir}/%{buildsubdir}/completions/bash/* %{buildroot}%{_datadir}/bash-completion/completions/
%pre
%if 0%{?use_systemd} && 0%{?suse_version}
%service_add_pre shadowsocks-libev.service
%endif
%post
/sbin/ldconfig
%if ! 0%{?use_systemd}
/sbin/chkconfig --add shadowsocks-libev > /dev/null 2>&1 || :
%else
%if 0%{?suse_version}
%service_add_post shadowsocks-libev.service
%else
%systemd_post shadowsocks-libev.service
%endif
%endif
%preun
%if ! 0%{?use_systemd}
if [ $1 -eq 0 ]; then
/sbin/service shadowsocks-libev stop > /dev/null 2>&1 || :
/sbin/chkconfig --del shadowsocks-libev > /dev/null 2>&1 || :
fi
%else
%if 0%{?suse_version}
%service_del_preun shadowsocks-libev.service
%else
%systemd_preun shadowsocks-libev.service
%endif
%endif
%postun
/sbin/ldconfig
%if 0%{?use_systemd}
%if 0%{?suse_version}
%service_del_postun shadowsocks-libev.service
%else
%systemd_postun_with_restart shadowsocks-libev.service
%endif
%endif
%files
/usr/share/doc/shadowsocks-libev/shadowsocks-libev.html
/usr/share/doc/shadowsocks-libev/ss-local.html
/usr/share/doc/shadowsocks-libev/ss-manager.html
/usr/share/doc/shadowsocks-libev/ss-nat.html
/usr/share/doc/shadowsocks-libev/ss-redir.html
/usr/share/doc/shadowsocks-libev/ss-server.html
/usr/share/doc/shadowsocks-libev/ss-tunnel.html
%{_bindir}/*
%{_libdir}/*.so.*
%config(noreplace) %{_sysconfdir}/shadowsocks-libev/config.json
%{_datadir}/bash-completion/completions/*
%doc %{_mandir}/*
%if ! 0%{?use_systemd}
%{_initddir}/shadowsocks-libev
%else
%{_unitdir}/shadowsocks-libev.service
%{_unitdir}/shadowsocks-libev-*.service
%config(noreplace) %{_sysconfdir}/default/shadowsocks-libev
%endif
%package devel
Summary: Development files for shadowsocks-libev
Group: Applications/Internet
License: GPLv3+
Requires: shadowsocks-libev == %{version}-%{release}
%description devel
Development files for shadowsocks-libev
%files devel
%{_includedir}/*
%{_libdir}/pkgconfig/*.pc
%{_libdir}/libshadowsocks-libev.la
%{_libdir}/libshadowsocks-libev.so
%changelog