2
0

srs.spec 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. %define use_systemd (0%{?fedora} && 0%{?fedora} >= 18) || (0%{?rhel} && 0%{?rhel} >= 7) || (0%{?suse_version} == 1315)
  2. Name: srs
  3. Version: 3.0.168
  4. Release: 1%{?dist}
  5. Summary: a simple, high efficiency and realtime video server
  6. License: MIT
  7. URL: https://github.com/ossrs/srs
  8. Source0: %{name}-3.0-r8.tar.gz
  9. Source1: srs.conf
  10. Source2: srs.service
  11. Source3: srs.init
  12. Source4: srs.logrotate
  13. BuildRequires: python
  14. BuildRequires: rsync
  15. %if %{use_systemd}
  16. BuildRequires: systemd
  17. Requires: systemd
  18. %else
  19. BuildRequires: initscripts
  20. Requires: initscripts
  21. %endif
  22. %description
  23. SRS is a simple, high efficiency and realtime video server, supports RTMP/WebRTC/HLS/HTTP-FLV/SRT.
  24. %prep
  25. %setup -q -n srs-3.0-r8
  26. %build
  27. cd trunk
  28. ./configure --prefix=/usr
  29. make %{?_smp_mflags}
  30. %install
  31. rm -rf $RPM_BUILD_ROOT
  32. %{__mkdir_p} $RPM_BUILD_ROOT%{_bindir}
  33. %{__mkdir_p} $RPM_BUILD_ROOT%{_initrddir}
  34. %{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/%{name}
  35. %{__mkdir_p} $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}
  36. %{__mkdir_p} $RPM_BUILD_ROOT%{_localstatedir}/log/%{name}
  37. %{__install} -m 755 trunk/objs/srs $RPM_BUILD_ROOT%{_bindir}
  38. #http_server file
  39. rsync -aqL --delete trunk/objs/nginx/ $RPM_BUILD_ROOT%{_datadir}/%{name}/
  40. #%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
  41. %{__install} -D -m 644 trunk/packaging/redhat/srs.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/srs.conf
  42. #init files
  43. %if %{use_systemd}
  44. %{__mkdir} -p $RPM_BUILD_ROOT%{_unitdir}
  45. %{__install} -p -m 644 trunk/packaging/redhat/srs.service $RPM_BUILD_ROOT%{_unitdir}/srs.service
  46. %else
  47. %{__mkdir} -p $RPM_BUILD_ROOT%{_initrddir}
  48. %{__install} -p -m 755 trunk/packaging/redhat/srs.init $RPM_BUILD_ROOT%{_initrddir}/srs
  49. sed -i 's/daemon/{s/off/on/g}' %{_sysconfdir}/%{name}/srs.conf
  50. %endif
  51. #logrotate
  52. %{__install} -D -p -m 644 trunk/packaging/redhat/srs.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/srs
  53. %pre
  54. # Add the "srs" user
  55. # getent group srs >/dev/null || groupadd -r srs
  56. # getent passwd srs >/dev/null || useradd -r -g srs -s /sbin/nologin -d /var/lib/srs srs
  57. %post
  58. %if %{use_systemd}
  59. %systemd_post %{name}.service
  60. %endif
  61. %preun
  62. %if %{use_systemd}
  63. %systemd_preun %{name}.service
  64. %endif
  65. %files
  66. %defattr(-,root,root,-)
  67. %{_bindir}/*
  68. %config(noreplace) %{_sysconfdir}/srs/srs.conf
  69. %{_sysconfdir}/logrotate.d/srs
  70. %{_datadir}/%{name}
  71. %dir %attr(0755, nobody, nobody) %{_localstatedir}/log/%{name}
  72. %dir %attr(0755, nobody, nobody) %{_sharedstatedir}/%{name}
  73. %doc trunk/conf
  74. %license LICENSE
  75. %if %{use_systemd}
  76. %{_unitdir}/srs.service
  77. %else
  78. %{_initrddir}/%{name}
  79. %endif
  80. %changelog
  81. * Mon Nov 1 2021 Purple Grape <purplegrape4@gmail.com>
  82. - rpm init