Page 1 of 1

Gentoo ebuild

Posted: Mon Apr 19, 2004 5:13 pm
by r.j.hall
I am trying to modify the ebuild that is currently in the gentoo portage tree to work in my overlay directory for the latest stable version of zoneminder.

I have got it working to the point where it does the make install, but I get the following error:

Code: Select all

+ src_install
+ make DESTDIR=/var/tmp/portage/zoneminder-1.19.1/image/ install
Making install in src
make[1]: Entering directory `/var/tmp/portage/zoneminder-1.19.1/work/zm-1.19.1/src'
make[2]: Entering directory `/var/tmp/portage/zoneminder-1.19.1/work/zm-1.19.1/src'
/bin/sh ../mkinstalldirs /var/tmp/portage/zoneminder-1.19.1/image//usr/bin
mkdir /var/tmp/portage/zoneminder-1.19.1/image/usr
mkdir /var/tmp/portage/zoneminder-1.19.1/image/usr/bin
  /bin/install -c zmc /var/tmp/portage/zoneminder-1.19.1/image//usr/bin/zmc
  /bin/install -c zma /var/tmp/portage/zoneminder-1.19.1/image//usr/bin/zma
  /bin/install -c zmu /var/tmp/portage/zoneminder-1.19.1/image//usr/bin/zmu
  /bin/install -c zms /var/tmp/portage/zoneminder-1.19.1/image//usr/bin/zms
  /bin/install -c zmf /var/tmp/portage/zoneminder-1.19.1/image//usr/bin/zmf
  /bin/install -c zmfix /var/tmp/portage/zoneminder-1.19.1/image//usr/bin/zmfix
make  install-exec-hook
make[3]: Entering directory `/var/tmp/portage/zoneminder-1.19.1/work/zm-1.19.1/src'
( cd /usr/bin; mv zms /home/httpd/cgi-bin )
mv: cannot stat `zms': No such file or directory
make[3]: *** [install-exec-hook] Error 1
make[3]: Leaving directory `/var/tmp/portage/zoneminder-1.19.1/work/zm-1.19.1/src'
make[2]: *** [install-exec-am] Error 2
make[2]: Leaving directory `/var/tmp/portage/zoneminder-1.19.1/work/zm-1.19.1/src'
make[1]: *** [install-am] Error 2
make[1]: Leaving directory `/var/tmp/portage/zoneminder-1.19.1/work/zm-1.19.1/src'
make: *** [install-recursive] Error 1
+ diefunc src_install 69 2
+ local funcname=src_install lineno=69 exitcode=2
+ shift 3
+ echo

+ echo '!!! ERROR: net-www/zoneminder-1.19.1 failed.'
!!! ERROR: net-www/zoneminder-1.19.1 failed.
+ echo '!!! Function src_install, Line 69, Exitcode 2'
!!! Function src_install, Line 69, Exitcode 2
+ echo '!!! (no error message)'
!!! (no error message)
+ echo

+ exit 1
As far as I can see the problem is in the src/Makefile line 512 -> 515:

Code: Select all

install-exec-hook:
        ( cd ${exec_prefix}/bin; mv zms $(cgidir) )
        ( cd $(cgidir); chown $(webuser):$(webgroup) zms; ln -f zms nph-zms )
        ( cd ${exec_prefix}/bin; chmod u+s zmfix )
it doesn't take into account the DESTDIR variable. If I modify it to:

Code: Select all

install-exec-hook:
        ( cd $(DESTDIR)${exec_prefix}/bin; mv zms $(cgidir) )
        ( cd $(DESTDIR)$(cgidir); chown $(webuser):$(webgroup) zms; ln -f zms nph-zms )
        ( cd $(DESTDIR)${exec_prefix}/bin; chmod u+s zmfix )
it seems to complete.

The other thing that seems to fail non terminally is the DB creation phase. The ebuild I am basing this new one on gets a file from http://mkeadle.org/distfiles/zoneminder-gentoo.tar.bz2 which has a patch, which I editd out of the ebuild and a zmconfig-gentoo.txt file. After the .configure phase the ebuild runs:

Code: Select all

perl zmconfig.pl -f zmconfig-gentoo.txt -noi
which does the following:

Code: Select all

+ perl zmconfig.pl -f zmconfig-gentoo.txt -noi
Loading config from 'zmconfig-gentoo.txt'
No option 'ZM_FAST_RGB_DIFFS' found, removing at zmconfig.pl line 1442, <CONFIG> chunk 100.
No option 'ZM_WEB_H_STREAM_IDLE_DELAY' found, removing at zmconfig.pl line 1442, <CONFIG> chunk 100.
No option 'ZM_WEB_H_STREAM_FRAME_DELAY' found, removing at zmconfig.pl line 1442, <CONFIG> chunk 100.
No option 'ZM_WEB_H_STREAM_EVENT_DELAY' found, removing at zmconfig.pl line 1442, <CONFIG> chunk 100.
No option 'ZM_WEB_M_STREAM_IDLE_DELAY' found, removing at zmconfig.pl line 1442, <CONFIG> chunk 100.
No option 'ZM_WEB_M_STREAM_FRAME_DELAY' found, removing at zmconfig.pl line 1442, <CONFIG> chunk 100.
No option 'ZM_WEB_M_STREAM_EVENT_DELAY' found, removing at zmconfig.pl line 1442, <CONFIG> chunk 100.
No option 'ZM_WEB_L_STREAM_IDLE_DELAY' found, removing at zmconfig.pl line 1442, <CONFIG> chunk 100.
No option 'ZM_WEB_L_STREAM_FRAME_DELAY' found, removing at zmconfig.pl line 1442, <CONFIG> chunk 100.
No option 'ZM_WEB_L_STREAM_EVENT_DELAY' found, removing at zmconfig.pl line 1442, <CONFIG> chunk 100.
Loading config from DB
DBI connect('database=zoneminder;host=localhost','zoneminder_admin',...) failed: Access denied for user: 'zoneminder_admin@localhost' (Using password: YES) at zmconfig.pl line 1476
Error: unable to load options from database: Access denied for user: 'zoneminder_admin@localhost' (Using password: YES)
Saving config to 'zmconfig-gentoo.txt'
Saving config to DB
DBI connect('database=zoneminder;host=localhost','zoneminder_admin',...) failed: Access denied for user: 'zoneminder_admin@localhost' (Using password: YES) at zmconfig.pl line 1380
Error: unable to save options to database: Access denied for user: 'zoneminder_admin@localhost' (Using password: YES)
Generating 'src/zm_config_defines.h'
Processing 'src/zm_config.h'
Processing 'web/zm_config.php'
Processing 'scripts/zmdc.pl'
Processing 'scripts/zmwatch.pl'
Processing 'scripts/zmaudit.pl'
Processing 'scripts/zmfilter.pl'
Processing 'scripts/zmx10.pl'
Processing 'scripts/zmpkg.pl'
Processing 'scripts/zmupdate.pl'
Processing 'scripts/zmvideo.pl'
Processing 'scripts/zm'
Processing 'db/zmschema.sql'
now there seems to be a couple of issues there, but are they anything to worry about do you think?

the current ebuild I have is as follows:

Code: Select all

# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /home/cvsroot/gentoo-x86/net-www/zoneminder/zoneminder-0.9.12.ebuild,v 1.2 2003/09/06 01:54:09 msterret Exp $

DESCRIPTION="ZoneMinder allows you to capture, analyse, record and monitor any cameras attached to your system."
HOMEPAGE="http://www.zoneminder.com/"
SRC_URI="http://www.zoneminder.com/fileadmin/downloads/zm-${PV}.tar.gz
        http://mkeadle.org/distfiles/${PN}-gentoo.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE="mpeg"

DEPEND="
        >=dev-db/mysql-3*
        >=media-libs/jpeg-6b
        >=net-www/apache-1.3.27-r3
        dev-lang/perl
"
RDEPEND="
        mpeg? ( media-video/ffmpeg )
        virtual/php
        media-libs/netpbm
"
S=${WORKDIR}/zm-${PV}

src_compile() {
        cd ${S}
        #epatch ${WORKDIR}/${PN}-gentoo/zm-0.9.12-gentoo.patch

        # Apache is flexible, so we should follow suit
        local datadir=`grep ^apache: /etc/passwd | cut -d: -f6`
        if [ -z "$datadir" ]
        then
                datadir="/home/httpd"
                eerror ":: Cannot find the apache user on your system! ::"
                eerror "If you would like to customize where ${PN} installs its web related"
                eerror "files please create the apache user and set its home directory."
                ewarn "Defaulting to \"/home/httpd\"."
        else
                einfo "$datadir is your Apache data directory ..."
        fi

        HTTPD_DOCROOT="${datadir}/htdocs"
        HTTPD_CGIROOT="${datadir}/cgi-bin"
        HTTPD_USER="apache"
        HTTPD_GROUP="apache"

        ./configure \
                --host=${CHOST} \
                --prefix=/usr \
                --infodir=/usr/share/info \
                --mandir=/usr/share/man \
                --with-ffmpeg=/usr/bin \
                --with-lame=/usr/bin \
                --with-mysql=/usr \
                --with-webdir=${HTTPD_DOCROOT}/zoneminder \
                --with-cgidir=${HTTPD_CGIROOT} \
                --with-webuser=${HTTPD_USER} \
                --with-webgroup=${HTTPD_GROUP} || die "./configure failed"

        cp "${WORKDIR}/${PN}-gentoo/zmconfig-gentoo.txt" ${S}
        cd ${S} && perl zmconfig.pl -f zmconfig-gentoo.txt -noi

        emake || die
}

src_install() {
        make DESTDIR=${D} install || die
        dodoc AUTHORS COPYING ChangeLog INSTALL NEWS README README.html TODO
}