mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-11-02 07:53:43 +00:00
support packaging for openSUSE
This commit is contained in:
@@ -8,19 +8,39 @@ License: GPLv3+
|
||||
URL: https://github.com/shadowsocks/%{name}
|
||||
Source0: %{url}/archive/v%{version}.tar.gz
|
||||
|
||||
BuildRequires: make gcc openssl-devel pcre-devel asciidoc xmlto
|
||||
Requires: openssl
|
||||
AutoReq: no
|
||||
Conflicts: python-shadowsocks python3-shadowsocks
|
||||
BuildRequires: make gcc pcre-devel asciidoc xmlto
|
||||
Requires: pcre
|
||||
|
||||
%if 0%{?rhel} > 6
|
||||
Requires(post): systemd
|
||||
Requires(preun): systemd
|
||||
Requires(postun): systemd
|
||||
BuildRequires: systemd
|
||||
%if 0%{?suse_version}
|
||||
Requires: libopenssl1_0_0
|
||||
BuildRequires: libopenssl-devel
|
||||
%else
|
||||
Requires: openssl-libs
|
||||
BuildRequires: openssl-devel
|
||||
%endif
|
||||
|
||||
Conflicts: python-shadowsocks python3-shadowsocks
|
||||
%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
|
||||
|
||||
%if 0%{?use_system_lib}
|
||||
BuildRequires: libev-devel libsodium-devel >= 1.0.4 udns-devel
|
||||
Requires: libev libsodium >= 1.0.4 udns
|
||||
%endif
|
||||
|
||||
AutoReq: no
|
||||
|
||||
%description
|
||||
shadowsocks-libev is a lightweight secured scoks5 proxy for embedded devices and low end boxes.
|
||||
@@ -31,14 +51,18 @@ shadowsocks-libev is a lightweight secured scoks5 proxy for embedded devices and
|
||||
|
||||
|
||||
%build
|
||||
%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%{?rhel} == 6
|
||||
%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
|
||||
@@ -52,25 +76,37 @@ install -m 644 %{_builddir}/%{buildsubdir}/debian/config.json %{buildroot}%{_sys
|
||||
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
|
||||
%if 0%{?rhel} <= 6
|
||||
/sbin/chkconfig --add shadowsocks-libev
|
||||
%if ! 0%{?use_systemd}
|
||||
/sbin/chkconfig --add shadowsocks-libev > /dev/null 2>&1 || :
|
||||
%elif 0%{?suse_version}
|
||||
%service_add_post shadowsocks-libev.service
|
||||
%else
|
||||
%systemd_post shadowsocks-libev.service
|
||||
%endif
|
||||
|
||||
%preun
|
||||
%if 0%{?rhel} <= 6
|
||||
%if ! 0%{?use_systemd}
|
||||
if [ $1 -eq 0 ]; then
|
||||
/sbin/service shadowsocks-libev stop
|
||||
/sbin/chkconfig --del shadowsocks-libev
|
||||
/sbin/service shadowsocks-libev stop > /dev/null 2>&1 || :
|
||||
/sbin/chkconfig --del shadowsocks-libev > /dev/null 2>&1 || :
|
||||
fi
|
||||
%elif 0%{?suse_version}
|
||||
%service_del_preun shadowsocks-libev.service
|
||||
%else
|
||||
%systemd_preun shadowsocks-libev.service
|
||||
%endif
|
||||
|
||||
%if 0%{?rhel} > 6
|
||||
%postun
|
||||
%if ! 0%{?use_systemd}
|
||||
%elif 0%{?suse_version}
|
||||
%service_del_postun shadowsocks-libev.service
|
||||
%else
|
||||
%systemd_postun_with_restart shadowsocks-libev.service
|
||||
%endif
|
||||
|
||||
@@ -85,11 +121,10 @@ fi
|
||||
/usr/share/doc/shadowsocks-libev/ss-tunnel.html
|
||||
%{_bindir}/*
|
||||
%{_libdir}/*.so.*
|
||||
%{_libdir}/pkgconfig/*.pc
|
||||
%config(noreplace) %{_sysconfdir}/shadowsocks-libev/config.json
|
||||
%{_datadir}/bash-completion/completions/*
|
||||
%doc %{_mandir}/*
|
||||
%if 0%{?rhel} <= 6
|
||||
%if ! 0%{?use_systemd}
|
||||
%{_initddir}/shadowsocks-libev
|
||||
%else
|
||||
%{_unitdir}/shadowsocks-libev.service
|
||||
@@ -108,6 +143,7 @@ Development files for shadowsocks-libev
|
||||
|
||||
%files devel
|
||||
%{_includedir}/*
|
||||
%{_libdir}/pkgconfig/*.pc
|
||||
%{_libdir}/libshadowsocks-libev.la
|
||||
%{_libdir}/libshadowsocks-libev.so
|
||||
|
||||
|
||||
Reference in New Issue
Block a user