# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils webapp DESCRIPTION="mnoGoSearch is a full-featured web search engine software for intranet and internet servers." HOMEPAGE="http://www.mnogosearch.org" SRC_URI="http://www.mnogosearch.org/Download/${P}.tar.gz" LICENSE="GPL-2" SLOT="0" WEBAPP_MANUAL_SLOT="yes" KEYWORDS="~amd64 ~x86" IUSE="chasen cjk db2 doc firebird iodbc mecab msoffice mssql mysql mysqlfulltext odbc pdf pic postgres readline sapdb solid sqlite ssl sybase unicode zlib" DEPEND="chasen? ( app-text/chasen ) db2? ( >=dev-db/unixODBC-1.8.13 ) doc? ( app-text/openjade app-text/docbook-sgml-utils ) firebird? ( dev-db/firebird ) iodbc? ( dev-db/libiodbc >=dev-db/unixODBC-1.8.13 ) mecab? ( app-text/mecab ) mssql? ( dev-db/freetds ) mysql? ( virtual/mysql ) odbc? ( >=dev-db/unixODBC-1.8.13 ) postgres? ( >=dev-db/libpq-7.1 ) readline? ( sys-libs/readline ) sapdb? ( >=dev-db/unixODBC-1.8.13 ) solid? ( >=dev-db/unixODBC-1.8.13 ) sqlite? ( >=dev-db/sqlite-3.3.12 ) ssl? ( dev-libs/openssl ) sybase? ( dev-db/freetds ) zlib? ( sys-libs/zlib )" RDEPEND="${DEPEND} msoffice? ( app-text/catdoc ) pdf? ( virtual/ghostscript )" src_unpack() { unpack ${A} epatch ${FILESDIR}/${P}-indexer.conf.patch # fix the documentation install path sed -i \ -e 's/\/doc/\/share\/doc\/mnogosearch-${PV}\/html/' ${S}/doc/Makefile.am \ -e 's/\/doc/\/share\/doc\/mnogosearch-${PV}\/html/' ${S}/doc/Makefile.in || die "sed failed!" # modify the search.cgi to support vhosts sed -i \ -e 's:UdmStrdup(UDM_CONF_DIR):UdmStrdup("../mnogosearch/"):' \ ${S}/src/search.c || die "sed of search.c failed" # modify the conf.c to support vhosts sed -i \ -e 's:UDM_CONF_DIR:"../mnogosearch/":' \ ${S}/src/conf.c || die "sed of conf.c failed" # enable external parser for msoffice word and excel documents use msoffice && { sed -i \ -e "s:^#Mime application/msword \"text/plain:Mime application/msword \"text/plain:" \ -e "s:^#Mime application/vnd.ms-excel:Mime application/vnd.ms-excel:" \ ${S}/etc/indexer.conf-dist || die "sed of indexer.conf-dist failed" ; } # enable external parser for pdf and ps documents use pdf && { sed -i \ -e "s:^#Mime text/x-postscript:Mime text/x-postscript:" \ -e "s:^#Mime application/pdf:Mime application/pdf:" \ ${S}/etc/indexer.conf-dist || die "sed of indexer.conf-dist failed" ; } # modify external parser to index in utf8 use unicode && { sed -i \ -e "s:text/x-postscript text/plain :text/x-postscript \"text/plain; charset=utf-8\" :" \ -e "s:application/pdf text/plain :application/pdf \"text/plain; charset=utf-8\" :" \ ${S}/etc/indexer.conf-dist || die "sed of indexer.conf-dist failed" ; } # modify indexer.conf to index in utf8 use unicode && { sed -i \ -e "s:^#LocalCharset UTF-8:LocalCharset UTF-8:" \ ${S}/etc/indexer.conf-dist || die "sed of indexer.conf-dist failed" ; } # modify the search.htm to display in utf8 use unicode && { sed -i \ -e "s:^LocalCharset iso-8859-1:LocalCharset UTF-8:" \ -e "s:^BrowserCharset iso-8859-1:BrowserCharset UTF-8:" \ ${S}/etc/search.htm-dist || die "sed of search.htm-dist failed" ; } # rename the config files to prodived a (working) default installation find ${S} -name 'Makefile.??' -exec \ sed -i \ -e "s:-dist::" \{\} \; || die "sed -dist failed" cd ${S}/etc/ rename -dist '' *-dist || \ ewarn "rename failed... You'll have to rename -dist files by yourself." } src_compile() { # disabled for now since they cause configure problems #$(use_with chasen ) #$(use_with mecab ) #$(use_with sqlite sqlite3 ) #$(use_with pic ) econf \ $(use_with cjk extra-charsets all) \ $(use_with db2 db2 /usr ) \ $(use_with doc docs ) \ $(use_with firebird ibase /usr ) \ $(use_with iodbc iodbc /usr ) \ $(use_with mssql freetds /usr ) \ $(use_with mysql ) \ $(use_with mysqlfulltext mysql-fulltext-plugin ) \ $(use_with odbc unixODBC /usr ) \ $(use_with postgres pgsql) \ $(use_with sapdb sapdb /usr ) \ $(use_with readline ) \ $(use_with solid solid /usr ) \ $(use_with ssl openssl ) \ $(use_with sybase freetds /usr ) \ $(use_with zlib ) \ --datadir=/usr/share/${PN} \ --sysconfdir=${MY_HOSTROOTDIR}/${PN} \ --libdir=/usr/lib/${PN} \ --includedir=/usr/include/${PN} \ || die "econf failed!" emake || die "emake failed!" } src_install() { webapp_src_preinst emake DESTDIR="${D}" install || die "Install failed!" mv ${D}/usr/bin/search.cgi ${D}/${MY_CGIBINDIR} for CFG in $(find ${D}${MY_HOSTROOTDIR}/mnogosearch/*) ; do local configfile=${CFG/${D}/} webapp_configfile ${configfile} done webapp_src_install } pkg_postinst() { webapp_pkg_postinst }