# Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils flag-o-matic toolchain MY_P=${P/_/-} DESCRIPTION="The OpenCA Project is a collaborative effort to develop a robust, full-featured and Open Source out-of-the-box Certification Authority implementing the most used protocols with full-strength cryptography world-wide." HOMEPAGE="http://www.openca.org/" SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz" LICENSE="BSD" SLOT="0" KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc x86 ~x86-fbsd" IUSE="uclibc doc dbm mysql postgres ldap vhosts" RDEPEND="virtual/libc" DEPEND="${RDEPEND} !dev-perl/OpenCA-X509 !dev-perl/OpenCA-REQ !dev-perl/OpenCA-OpenSSL !dev-perl/OpenCA-CRL >=dev-libs/openssl-0.9.7 net-www/apache dev-perl/XML-Parser >=perl-core/MIME-Base64-2.20 >=dev-perl/Digest-HMAC-1.01 >=dev-perl/Digest-SHA1-2.02 >=perl-core/Digest-MD5-2.24 >=dev-perl/libintl-perl-1.10 >=dev-perl/IO-stringy-2.108 >=dev-perl/MIME-Lite-3.01 >=dev-perl/MIME-tools-5.411 >=dev-perl/MailTools-1.58 >=dev-perl/Parse-RecDescent-1.94 >=dev-perl/X500-DN-0.28 >=dev-perl/XML-Twig-3.09 >=dev-perl/CGI-Session-3.95 >=dev-perl/net-server-0.86 >=dev-perl/Convert-ASN1-0.18 dbm? ( perl-core/DB_File ) mysql? ( dev-perl/DBD-mysql ) postgres? ( dev-perl/DBD-Pg ) !mysql? ( !postgres? ( perl-core/DB_File ) ) ldap? ( net-nds/openldap >=dev-perl/perl-ldap-0.28 >=dev-perl/IO-Socket-SSL-0.92 >=dev-perl/URI-1.23 ) sasl? ( >=dev-perl/Authen-SASL-2.04 ) !uclibc? ( sys-devel/bc )" S=${WORKDIR}/${MY_P} src_unpack() { unpack ${A} cd ${S} if ! use ldap ; then epatch ${FILESDIR}/openca-0.9.2_noldap.patch fi case $( gcc-version ) in 3.4 | 3.3 | 3.2 ) filter-flags -fprefetch-loop-arrays -freduce-all-givs -funroll-loops ;; esac econf } src_compile() { cd ${S} einfo "Compiling ${P}" myconf="--with-openca-user=openca \ --with-openca-group=openca \ --with-htdocs-fs-prefix=/var/www/localhost/htdocs/openca \ --with-cgi-fs-prefix=/var/www/localhost/cgi-bin \ --with-etc-prefix=/etc/openca \ --with-var-prefix=/var/openca \ --with-lib-prefix=/usr/lib/openca \ --with-httpd-user=apache \ --with-httpd-group=apache \ --disable-external-modules" if ! use vhosts ; then myconf="${myconf} --with-htdocs-url-prefix=/openca" fi if use ldap; then myconf="${myconf} --with-ldap-port=389 \ --with-ldap-root='cn=Manager,o=OpenCA,c=IT' \ --with-ldap-root-pwd='openca'" else myconf="${myconf} --disable-ldap" fi if ! use mysql && ! use postgres || use dbm; then myconf="${myconf} --enable-db" else myconf="${myconf} --disable-db" fi if use mysql; then einfo "Setting random user/password details for the mysql database" local dbpass="${RANDOM}${RANDOM}${RANDOM}${RANDOM}" sed -e "s/@dbpass@/${dbpass}/g" \ ${FILESDIR}/mysql-setup.sql.in > ${T}/mysql-setup.sql myconf="${myconf} --enable-dbi \ --with-db-type=mysql \ --with-db-name=openca \ --with-db-host=localhost \ --with-db-port=3306 \ --with-db-user=openca \ --with-db-passwd='${dbpass}'" fi if use postgres; then einfo "Setting random user/password details for the postgres database" local dbpass="${RANDOM}${RANDOM}${RANDOM}${RANDOM}" # sed -e "s/@dbpass@/${dbpass}/g" \ # ${FILESDIR}/postgres-setup.sql.in > ${T}/posgres-setup.sql myconf="${myconf} --enable-dbi \ --with-db-type=Pg \ --with-db-name=openca \ --with-db-host=localhost \ --with-db-port=5432 \ --with-db-user=openca \ --with-db-passwd='${dbpass}'" fi econf ${myconf} emake || die } src_install() { cd ${S} make install-online install-ca DESTDIR=${D} || die dodir /var/openca/tmp keepdir /var/openca/tmp dosym /var/openca/log /var/log/openca keepdir /var/openca/log dodir /var/openca/log/xml keepdir /var/openca/log/xml dodoc CHANGES* LICENSE README dodoc docs/*.txt doman docs/man3/*.3 if use doc; then dohtml -r docs/guide dohtml -r docs/howto docinto shared dodocs docs/shared/*.txt fi if use ldap; then docinto openldap dodocs contrib/openldap/openca.schema fi if ! use mysql && ! use postgres || use dbm ; then dodir /var/openca/db keepdir /var/openca/db fi if use vhosts; then insinto /etc/apache2/conf/vhosts #***more to come*** fi dosym /etc/openca/openca_rc /etc/init.d/openca } pkg_setup() { enewgroup openca enewuser openca -1 -1 /dev/null openca } pkg_postinst() { einfo "Please check file '/etc/openca/config.xml'" einfo "Then run '/etc/openca/configure_etc.sh' script" }