zoneminder-1.28.1.ebuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # TO DO:
  4. # * ffmpeg support can be disabled in CMakeLists.txt but it does not build then
  5. # $(cmake-utils_useno ffmpeg ZM_NO_FFMPEG)
  6. # * dependencies of unknown status:
  7. # dev-perl/Archive-Zip
  8. # dev-perl/Device-SerialPort
  9. # dev-perl/MIME-Lite
  10. # dev-perl/MIME-tools
  11. # dev-perl/PHP-Serialization
  12. # virtual/perl-Archive-Tar
  13. # virtual/perl-libnet
  14. # virtual/perl-Module-Load
  15. EAPI=5
  16. PERL_EXPORT_PHASE_FUNCTIONS=no
  17. inherit perl-module readme.gentoo eutils base cmake-utils depend.apache multilib flag-o-matic
  18. MY_PN="ZoneMinder"
  19. DESCRIPTION="ZoneMinder allows you to capture, analyse, record and monitor any cameras attached to your system"
  20. HOMEPAGE="http://www.zoneminder.com/"
  21. SRC_URI="https://github.com/${MY_PN}/${MY_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
  22. LICENSE="GPL-2"
  23. KEYWORDS="~amd64"
  24. IUSE="curl gcrypt gnutls +mmap +openssl vlc"
  25. SLOT="0"
  26. REQUIRED_USE="
  27. || ( openssl gnutls )
  28. "
  29. DEPEND="
  30. app-eselect/eselect-php[apache2]
  31. dev-lang/perl:=
  32. dev-lang/php[apache2,cgi,curl,inifile,pdo,mysql,mysqli,sockets]
  33. dev-libs/libpcre
  34. dev-perl/Archive-Zip
  35. dev-perl/Date-Manip
  36. dev-perl/DBD-mysql
  37. dev-perl/DBI
  38. dev-perl/URI-Encode
  39. dev-perl/libwww-perl
  40. sys-auth/polkit
  41. sys-libs/zlib
  42. virtual/ffmpeg
  43. virtual/httpd-php
  44. virtual/jpeg
  45. virtual/mysql
  46. virtual/perl-ExtUtils-MakeMaker
  47. virtual/perl-Getopt-Long
  48. virtual/perl-Sys-Syslog
  49. virtual/perl-Time-HiRes
  50. www-servers/apache
  51. curl? ( net-misc/curl )
  52. gcrypt? ( dev-libs/libgcrypt )
  53. gnutls? ( net-libs/gnutls )
  54. mmap? ( dev-perl/Sys-Mmap )
  55. openssl? ( dev-libs/openssl )
  56. vlc? ( media-video/vlc[live] )
  57. "
  58. RDEPEND="${DEPEND}"
  59. # we cannot use need_httpd_cgi here, since we need to setup permissions for the
  60. # webserver in global scope (/etc/zm.conf etc), so we hardcode apache here.
  61. need_apache
  62. S=${WORKDIR}/${MY_PN}-${PV}
  63. PATCHES=(
  64. "${FILESDIR}/${PN}-1.26.5"-automagic.patch
  65. )
  66. MY_ZM_WEBDIR=/usr/share/zoneminder/www
  67. pkg_setup() {
  68. :
  69. }
  70. src_configure() {
  71. append-cxxflags -D__STDC_CONSTANT_MACROS
  72. perl_set_version
  73. mycmakeargs=(
  74. -DZM_PERL_SUBPREFIX=${VENDOR_LIB#/usr}
  75. -DZM_TMPDIR=/var/tmp/zm
  76. -DZM_SOCKDIR=/var/run/zm
  77. -DZM_WEB_USER=apache
  78. -DZM_WEB_GROUP=apache
  79. -DZM_WEBDIR=${MY_ZM_WEBDIR}
  80. $(cmake-utils_useno mmap ZM_NO_MMAP)
  81. -DZM_NO_X10=OFF
  82. -DZM_NO_FFMPEG=OFF
  83. $(cmake-utils_useno curl ZM_NO_CURL)
  84. $(cmake-utils_useno vlc ZM_NO_LIBVLC)
  85. $(cmake-utils_useno openssl CMAKE_DISABLE_FIND_PACKAGE_OpenSSL)
  86. $(cmake-utils_use_has gnutls)
  87. $(cmake-utils_use_has gcrypt)
  88. )
  89. cmake-utils_src_configure
  90. }
  91. src_install() {
  92. cmake-utils_src_install
  93. # the log directory
  94. keepdir /var/log/zm
  95. fowners apache:apache /var/log/zm
  96. # now we duplicate the work of zmlinkcontent.sh
  97. dodir /var/lib/zoneminder /var/lib/zoneminder/images /var/lib/zoneminder/events
  98. fperms -R 0775 /var/lib/zoneminder
  99. fowners -R apache:apache /var/lib/zoneminder
  100. dosym /var/lib/zoneminder/images ${MY_ZM_WEBDIR}/images
  101. dosym /var/lib/zoneminder/events ${MY_ZM_WEBDIR}/events
  102. # bug 523058
  103. keepdir ${MY_ZM_WEBDIR}/temp
  104. fowners -R apache:apache ${MY_ZM_WEBDIR}/temp
  105. # the configuration file
  106. fperms 0640 /etc/zm.conf
  107. fowners root:apache /etc/zm.conf
  108. # init scripts etc
  109. newinitd "${FILESDIR}"/init.d zoneminder
  110. newconfd "${FILESDIR}"/conf.d zoneminder
  111. cp "${FILESDIR}"/10_zoneminder.conf "${T}"/10_zoneminder.conf
  112. sed -i "${T}"/10_zoneminder.conf -e "s:%ZM_WEBDIR%:${MY_ZM_WEBDIR}:g"
  113. dodoc AUTHORS BUGS ChangeLog INSTALL NEWS README.md TODO "${T}"/10_zoneminder.conf
  114. perl_delete_packlist
  115. readme.gentoo_src_install
  116. }
  117. pkg_postinst() {
  118. local myold=${REPLACING_VERSIONS}
  119. [ "${myold}" = ${PV} ] || elog "You have upgraded zoneminder and may have to upgrade your database now."
  120. }