# Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit java-pkg eutils webapp DESCRIPTION="A Collaboration and Integration Server Environment" HOMEPAGE="http://www.open-xchange.org/" ox_rev=${PR/r/} SRC_URI="http://mirror.open-xchange.org/download/${P}-${ox_rev}.tar.bz2 http://www.mikefetherston.ca/OX/Crystal_OX_Theme.tgz" LICENSE="GPL-2" KEYWORDS="~x86" RESTRICT="primaryuri" DBMS="mysql postgres" # see pkg_setup() IUSE="ssl webdav ${DBMS}" S="${WORKDIR}/${PN}-${PV}-${ox_rev}" DEPEND=">=virtual/jdk-1.4 >=dev-java/java-config-1.2 dev-java/sun-javamail-bin sys-apps/findutils sys-apps/sed net-www/webapp-config dev-java/jdom dev-java/servletapi dev-perl/XML-NamespaceSupport dev-perl/XML-SAX-Base dev-perl/Authen-SASL dev-perl/Convert-ASN1 dev-perl/perl-ldap mysql? ( dev-java/jdbc-mysql ) postgres? ( >=dev-java/jdbc3-postgresql-7.4 ) ssl? ( dev-libs/openssl dev-perl/IO-Socket-SSL )" RDEPEND=">=virtual/jdk-1.4 >=dev-java/java-config-1.2 www-servers/tomcat dev-perl/Net-SSLeay dev-java/jdom mysql? ( dev-java/jdbc-mysql ) postgres? ( >=dev-java/jdbc3-postgresql-7.4 ) net-nds/openldap app-text/ispell" pkg_setup() { FAIL=0 # For future support of additional databases DBMS_COUNT=0 for db in ${DBMS} ; do if use ${db} ; then DBMS_COUNT=$[${DBMS_COUNT}+1] fi done if [ ${DBMS_COUNT} -gt 1 ] ; then echo ewarn "You have multiple database backends active in your USE flags." ewarn "The functionality of multiple DBMS is untested for now!" echo ewarn "If you use multiple DBMS and it seems to be stable," ewarn "please publish a short report on:" ewarn "http://bugs.gentoo.org/show_bug.cgi?id=62197" echo ewarn "If you want to build with another database backend, abort now and" ewarn "change your USE flags (e.g. \"-postgres\") then emerge again." ewarn "(Control-C to abort)..." einfo " "; echo -ne " >>> " for TICKER in 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1; do # Double beep here. echo -ne "$TICKER "; echo -ne "\a" ; sleep 0.1 &>/dev/null ; sleep 0,1 &>/dev/null; echo -ne "\a" ; sleep 1; done; sleep 5 echo " " elif [ ${DBMS_COUNT} -eq 0 ] ; then echo ewarn "You did not select any supported DBMS in your USE flags." ewarn "${PN} needs tohave one database backend for storing data." echo die "No database backend selected" fi if [ -z "${OX_DBNAME}" ] ; then einfo " " ewarn "The environment \$OX_DBNAME was not set. I will take the default" ewarn "value 'openexchange'." einfo " " OX_DBNAME="openexchange" FAIL=1 fi if [ -z "${OX_DBUSER}" ] ; then einfo " " ewarn "The environment \$OX_DBUSER was not set. I will take the default" ewarn "value 'openexchange'." einfo " " OX_DBUSER="openexchange" FAIL=1 fi if [ -z "${OX_DBPASS}" ] ; then einfo " " ewarn "The environment \$OX_DBPASS was not set. I will take the default" ewarn "value 'xxx'." einfo " " OX_DBPASS="xxx" FAIL=1 fi if [ ${FAIL} -eq 1 ] ; then ewarn "If you dont want to use the default values then hit " ewarn "to cancel and set the environment before emerging open-xchange." einfo " " echo -ne " >>> " for TICKER in 1 2 3 4 5 6 7 8; do # Double beep here. echo -ne "$TICKER " echo -ne "\a" ; sleep 0.1 &>/dev/null ; sleep 0,1 &>/dev/null echo -ne "\a" ; sleep 1 done sleep 5 echo " " fi webapp_pkg_setup } src_unpack() { unpack ${A} ; cd ${S} sed -i "s|touch @localstatedir@|touch \${DESTDIR}@localstatedir@|g" Makefile.am rm -rf ${S}/autom4te.cache aclocal -I m4/ && autoconf || die "reconfigure failed" libtoolize --copy --force } src_compile() { local myconf if use webdav ; then myconf="${myconf} $(use_enable webdav)" fi if use ssl ; then myconf="${myconf} $(use_enable ssl)" fi if use mysql ; then myconf="${myconf} --with-jdbcjar=$(java-config --classpath=$(java-config -l | sed -n "s:^\[\(jdbc[^-]*-mysql[^]]*\).*:\1:p" | head -n 1))"; fi if use postgres ; then myconf="${myconf} --with-jdbcjar=$(java-config --classpath=$(java-config -l | sed -n "s:^\[\(jdbc[^-]*-postgresql[^]]*\).*:\1:p" | head -n 1))"; fi # caused some trouble with compilation don't know why # --with-jsdkjar=$(java-config --classpath=$(java-config -l | sed -n "s:^\[\(servletapi-2\.[456789][^]]*\)\].*:\1:p" | head -n 1)) \ ./configure \ --with-mailjar=/usr/share/sun-javamail-bin/lib/mail.jar \ --with-activationjar=/usr/share/sun-jaf-bin/lib/activation.jar \ --with-jsdkjar=/usr/share/servletapi-2.4/lib/servlet-api.jar \ --with-jdomjar=$(java-config --classpath=$(java-config -l | sed -n "s:^\[\(jdom[^]]*\).*:\1:p" | head -n 1)) \ --with-xercesjar=/usr/share/xerces-2/lib/xercesImpl.jar \ --with-jni-dir=`java-config -O`/include \ --with-dbname=${OX_DBNAME} \ --with-dbuser=${OX_DBUSER} \ --with-dbpass=${OX_DBPASS} \ --with-runuid=apache \ --with-rungid=apache \ --with-servlerdir=/opt/tomcat5/webapps/servlet \ --with-htdocsdir=${MY_HTDOCSDIR}/open-xchange \ --with-cgibindir=${MY_CGIBINDIR}/open-xchange \ ${myconf} \ --prefix=/usr \ --sysconfdir=/etc/open-xchange \ --datadir=/usr/share/open-xchange \ --includedir=/usr/include/open-xchange \ --infodir=/usr/share/info \ --mandir=/usr/share/man \ --libdir=/usr/lib/open-xchange \ --localstatedir=/var/open-xchange \ || die "bad ./configure" # replace the string "jikes" with "modern". We dont want to see all jikes warnings sed -i "s|jikes|modern|g" build.xml make || die "make failed" # create user mailadmin, needed for mailsupport enewuser mailadmin -1 -1 /dev/null users _UID=`getent passwd mailadmin | awk -F : '{print $3}'` # get the default guid of the group 'users' OX_STDGID=`getent group users | awk -F : '{print $3}'` # replace the SuSE group id 500 of users with the gentoo group id of the group 'users' for the mailadmin in ldif + uid sed -i "s|500|${OX_STDGID}|g" system/setup/init_ldap.ldif sed -i "s|501|${_UID}|g" system/setup/init_ldap.ldif # replace the SuSE standard group id 500 with the gentoo group id of the group 'users' sed -i "s|500|${OX_STDGID}|g" conf/admintools.conf OX_STDGID=`expr ${OX_STDGID} + 1` sed -i "s|501|${OX_STDGID}|g" conf/admintools.conf } src_install() { webapp_src_preinst dodoc AUTHORS ChangeLog INSTALL NEWS README # Install this big thing cd ${S} make DESTDIR=${D} install || die "Failed on make install" # copy jar # java-pkg_dojar ${D}usr/lib/open-xchange/comfiretools.jar # java-pkg_dojar ${D}usr/lib/open-xchange/intranet.jar # java-pkg_dojar ${D}usr/lib/open-xchange/nas.jar # java-pkg_dojar ${D}usr/lib/open-xchange/sessiond.jar # java-pkg_dojar ${D}usr/lib/open-xchange/webmail.jar webapp_serverowned # Init script exeinto /etc/init.d insopts -m0755 newexe ${D}etc/open-xchange/init.d/openexchange openexchange # Change default icon theme insinto ${MY_HTDOCSDIR}/open-xchange/cfintranet/images/top/EN/ insopts -m0644 doins ${WORKDIR}/*.png insinto ${MY_HTDOCSDIR}/open-xchange/cfintranet/images/top/DE/ doins ${WORKDIR}/*.png # Install webapp webapp_src_install } pkg_postinst() { webapp_pkg_postinst chgrp -R apache /var/open-xchange/* einfo " " einfo " " einfo " ===========================================================" einfo " " einfo " You have successfully installed Open-Xchange" einfo " " einfo " ===========================================================" einfo " " einfo " o FILE LOCATIONS" einfo " 1. Configuration: /etc/open-xchange" einfo " 2. HTML Files: /usr/share/open-xchange" einfo " " einfo " o STARTING and STOPPING the Open-Xchange" einfo " /etc/init.d/openexchange start" einfo " /etc/init.d/openexchange stop" einfo " /etc/init.d/openexchange restart" einfo " " einfo "Execute the following command" einfo "ebuild /var/db/pkg/www-apps/${PF}/${PF}.ebuild config" einfo "to setup the initial open-xchange environment." einfo " " } pkg_config() { ln -s ../../openldap/ldap.conf /etc/open-xchange/groupware/ldap.conf ln -s ../../openldap/ldap.conf /etc/open-xchange/webmail/ldap.conf correctfilespool }