Advertisement
Raphux

Untitled

May 17th, 2011
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.95 KB | None | 0 0
  1. # Copyright 1999-2011 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # $Header: /var/cvsroot/gentoo-x86/www-misc/zoneminder/zoneminder-1.24.2.ebuild,v 1.4 2011/02/27 20:09:33 ssuominen Exp $
  4.  
  5. inherit eutils autotools depend.php depend.apache multilib flag-o-matic
  6.  
  7. MY_PV=${PV/_/-}
  8. MY_PN="ZoneMinder"
  9.  
  10. PATCH_PV="1.24.3"
  11.  
  12. DESCRIPTION="ZoneMinder allows you to capture, analyse, record and monitor any cameras attached to your system."
  13. HOMEPAGE="http://www.zoneminder.com/"
  14. SRC_URI="http://www.zoneminder.com/downloads/${MY_PN}-${MY_PV}.tar.gz"
  15.  
  16. LICENSE="GPL-2"
  17. KEYWORDS="~amd64 ~ppc ~x86"
  18. IUSE="debug ffmpeg"
  19. #IUSE="debug ffmpeg mmap"
  20. SLOT="0"
  21.  
  22. DEPEND="app-admin/sudo
  23.     dev-libs/libpcre
  24.     virtual/jpeg
  25.     net-libs/gnutls
  26.     >=dev-lang/perl-5.6.0
  27.     virtual/perl-Archive-Tar
  28.     dev-perl/Archive-Zip
  29.     dev-perl/DateManip
  30.     dev-perl/DBD-mysql
  31.     dev-perl/DBI
  32.     dev-perl/Device-SerialPort
  33.     dev-perl/libwww-perl
  34.     dev-perl/MIME-Lite
  35.     dev-perl/MIME-tools
  36.     dev-perl/PHP-Serialization
  37.     virtual/perl-Getopt-Long
  38.     virtual/perl-libnet
  39.     virtual/perl-Module-Load
  40.     virtual/perl-Sys-Syslog
  41.     virtual/perl-Time-HiRes"
  42.  
  43. RDEPEND="dev-perl/DBD-mysql
  44.     ffmpeg? ( >=media-video/ffmpeg-0.5-r1 )
  45.     media-libs/netpbm"
  46.  
  47.  
  48. # we cannot use need_httpd_cgi here, since we need to setup permissions for the
  49. # webserver in global scope (/etc/zm.conf etc), so we hardcode apache here.
  50. need_apache
  51. need_php_httpd
  52.  
  53. S=${WORKDIR}/${MY_PN}-${MY_PV}
  54.  
  55. pkg_setup() {
  56.     require_php_with_use mysql sockets apache2
  57. }
  58.  
  59. src_unpack() {
  60.     unpack ${A}
  61.     cd "${S}"
  62.  
  63.     eautoreconf
  64. }
  65.  
  66. src_compile() {
  67.     local myconf
  68.  
  69. # To enable mmap support we need a dependancy of Sys::Mmap
  70. # It installs fine via g-cpan, but there's no ebuild currently in portage.
  71. #       if use mmap; then
  72. #          myconf="${myconf} --enable-mmap=yes"
  73. #       else
  74. #          myconf="${myconf} --enable-mmap=no"
  75. #       fi
  76.     append-flags "-D__STDC_CONSTANT_MACROS"
  77.     if use debug; then
  78.         myconf="${myconf} --enable-debug=yes --enable-crashtrace=yes"
  79.     else
  80.         myconf="${myconf} --enable-debug=no --enable-crashtrace=no"
  81.     fi
  82.  
  83.     econf   --with-libarch=$(get_libdir) \
  84.         --with-mysql=/usr \
  85.         $(use_with ffmpeg) \
  86.         --with-webdir="${ROOT}var/www/zoneminder/htdocs" \
  87.         --with-cgidir="${ROOT}var/www/zoneminder/cgi-bin" \
  88.         --with-webuser=apache \
  89.         --with-webgroup=apache \
  90.         --disable-mmap \
  91.         --with-webhost=zm.localdomain \
  92.         ${myconf}
  93.  
  94.     einfo "${PN} does not parallel build... using forcing make -j1..."
  95.     emake -j1 || die "emake failed"
  96. }
  97.  
  98. src_install() {
  99.     keepdir /var/run/zm
  100.     emake -j1 DESTDIR="${D}" install || die "emake install failed"
  101.  
  102.     fperms 0640 /etc/zm.conf
  103.  
  104.     keepdir /var/log/${PN}
  105.     fowners apache:apache /var/log/${PN}
  106.     fowners apache:apache /var/run/zm
  107.  
  108.     newinitd "${FILESDIR}"/init.d zoneminder
  109.     newconfd "${FILESDIR}"/conf.d zoneminder
  110.  
  111.     dodoc AUTHORS ChangeLog INSTALL NEWS README TODO
  112.  
  113.     insinto /usr/share/${PN}/db
  114.     doins db/zm_u* db/zm_create.sql
  115.  
  116.     insinto /etc/apache2/vhosts.d
  117.     doins "${FILESDIR}"/10_zoneminder.conf
  118.  
  119.     for DIR in events images sound; do
  120.         dodir "${ROOT}"/var/www/zoneminder/htdocs/${DIR}
  121.     done
  122. }
  123.  
  124. pkg_postinst() {
  125.     elog ""
  126.     elog "0. If this is a new installation, you will need to create a MySQL database"
  127.     elog "   for ${PN} to use. (see http://www.gentoo.org/doc/en/mysql-howto.xml)."
  128.     elog "   Once you completed that you should execute the following:"
  129.     elog ""
  130.     elog " cd /usr/share/${PN}"
  131.     elog " mysql -u <my_database_user> -p<my_database_pass> <my_zoneminder_db> < db/zm_create.sql"
  132.     elog ""
  133.     elog "1.  Set your database settings in /etc/zm.conf"
  134.     elog ""
  135.     elog "2.  Start the ${PN} daemon:"
  136.     elog ""
  137.     elog "  /etc/init.d/${PN} start"
  138.     elog ""
  139.     elog "3. Finally point your browser to http://localhost/${PN}"
  140.     elog ""
  141.     elog ""
  142.     elog "If you are upgrading, you will need to run the zmupdate.pl script:"
  143.     elog ""
  144.     elog " /usr/bin/zmupdate.pl version=<from version> [--user=<my_database_user> --pass=<my_database_pass>]"
  145.     elog ""
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement