# Copyright 1999-2004 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: /home/cvsroot/gentoo-x86/dev-db/maxdb/maxdb-src-7.5.0.8.ebuild,v 1.4 2004/02/07 17:12:43 brad_mssw Exp $ inherit eutils DESCRIPTION="MaxDB - a enterpise grade, database server. This ebuild will compile maxdb from sources. It will take some time !" HOMEPAGE="http://www.mysql.com/products/maxdb" SRC_URI="ftp://ftp.sap.com/pub/maxdb/7.5.00/maxdb-source-7_5_0_8.tgz http://www.python.org/ftp/python/src/python-1.5.tar.gz" KEYWORDS="~x86" LICENSE="GPL-2" SLOT="0" IUSE="" DEPEND="gcc? ( >=sys-devel/gcc-3.3.2 ) bison? ( sys-devel/bison ) python? ( >=dev-lang/python-1.5.2 ) perl? ( >=dev-lang/perl-2.3.3 ) maxdb-devtools-src ( =dev-db/maxdb-devtools-src-7.5.0.8 )" warning() { ewarn ewarn "You can specify the root directory for the installation" ewarn "by setting the environment variable MAXDBROOT" ewarn "(without the leading / please. i.e. opt/sdb" ewarn ewarn "MaxDB will be installed to:" ewarn ${MAXDBROOT} ewarn ewarn "You can specify the directory where the needed DevTools are" ewarn "by setting the environment variable DEVTOOLS" ewarn ewarn "DevTools should be in:" ewarn ${DEVTOOLS} ewarn # ewarn "Python Include files have to be in:" # ewarn ${A_PYTHON_INCLUDE} # ewarn ewarn "Be shure that you did run ${DEVTOOLS}/bin/prepare_inst.pl as root" ewarn "to create the global SAP DB registry," ewarn "(or export NOREG=1 to build without registration)" ewarn einfo "Workdir is:" einfo ${WORKDIR} einfo D is: einfo ${D} einfo ROOT is: einfo ${ROOT} einfo DISTDIR is: einfo ${DISTDIR} sleep 10 } pkg_setup() { if [ -z "${MAXDBROOT}" ]; then MAXDBROOT=opt/sdb fi if [ -z "${DEVTOOLS}" ]; then DEVTOOLS=${ROOT}${MAXDBROOT}/devtools fi A_PYTHON_INCLUDE=/usr/include/python2.3 warning INSTDATA_TMP=${WORKDIR}/V75_00_08/MaxDB_ORG/data INSTDATA_FIN=${D}${MAXDBROOT}/data INSTROOT_FIN=${D}${MAXDBROOT}/programs } src_unpack() { unpack ${A} || die EPATCH_OPTS="-p1 -d ${WORKDIR}/V75_00_08" \ # Add the missing files to the distribution and apply the patch for gcc-3.3 epatch ${FILESDIR}/maxdb-source-7_5_0_8_all.patch addwrite /etc/opt/sdb epatch ${FILESDIR}/maxdb-source-7_5_0_8_etc.patch } src_compile() { # prepare the python sources cd ${WORKDIR}/Python-1.5 ./configure cp config.h Include # create the sandbox directories mkdir ${INSTDATA_TMP} mkdir ${INSTDATA_TMP}/wrk # we need write permission in the DevTools addwrite ${DEVTOOLS} cd ${WORKDIR} python ${DEVTOOLS}/bin/newSapdbSrc.py V75_00_08/MaxDB_ORG . devsapdb PYTHON_INCLUDE=${WORKDIR}/Python-1.5/Include # PYTHON_INCLUDE=${A_PYTHON_INCLUDE} export PYTHON_INCLUDE export PATH=${PATH}:${INSTROOT}/bin einfo "Sandbox INSTROOT is: ${INSTROOT}" einfo "Sandbox PYTHON_INCLUDE is: ${PYTHON_INCLUDE}" einfo "Sandbox PATH is: ${PATH}" sleep 5 # Setup the config file /etc/opt/sdb addwrite /etc/opt/sdb echo [Globals] > /etc/opt/sdb echo IndepData=${INSTDATA_TMP} >> /etc/opt/sdb echo IndepPrograms=${INSTROOT} >> /etc/opt/sdb echo SdbOwner=sdb >> /etc/opt/sdb echo SdbGroup=sdba >> /etc/opt/sdb # Copy the missing include files if [ ! -f ${INSTROOT}/incl/WINDOWS.H ] then mkdir ${INSTROOT}/incl cp ${WORKDIR}/V75_00_08/MaxDB_ORG/usr/incl/*.H ${INSTROOT}/incl/ cp ${WORKDIR}/V75_00_08/MaxDB_ORG/usr/incl/*.h ${INSTROOT}/incl/ fi # Build the targets (you have to build target all) einfo "Building target: all" imf all || die } src_install() { # Change some sandbox pathes in the config-files to the final ones # sed 's\${WORKDIR}/V75_00_08/MaxDB_ORG/usr\${ROOT}${MAXDBROOT}/programs\g' ${WORKDIR}/V75_00_08/MaxDB_ORG/usr/config/WebAgent75.ini.ready > ${WORKDIR}/V75_00_08/MaxDB_ORG/usr/config/WebAgent75.ini.ready2 # mv ${WORKDIR}/V75_00_08/MaxDB_ORG/usr/config/WebAgent75.ini.ready2 ${WORKDIR}/V75_00_08/MaxDB_ORG/usr/config/WebAgent75.ini.ready # create the directories and copy the files dodir ${MAXDBROOT}/programs dodir ${MAXDBROOT}/data dodir ${MAXDBROOT}/data/fifo einfo "INSTROOT: ${INSTROOT}" einfo "INSTROOT_FIN: ${INSTROOT_FIN}" einfo "INSTDATA_TMP: ${INSTDATA_TMP}" einfo "INSTDATA_FIN: ${INSTDATA_FIN}" (cd ${INSTROOT} > /dev/null; tar cf - .) | (cd ${INSTROOT_FIN} >/dev/null; tar xf -) (cd ${INSTDATA_TMP} > /dev/null; tar cf - .) | (cd ${INSTDATA_FIN} >/dev/null; tar xf -) } pkg_preinst() { if ! groupmod sdba; then groupadd sdba || die "problem adding group sdba" fi if ! id sdb; then useradd -g sdba -s /dev/null -d /opt/maxdb -c "sdb" sdb assert "problem adding user sdb" fi } pkg_postinst() { install -d -m0755 -o sdb -g sdba ${ROOT}${MAXDBROOT}/programs install -d -m0755 -o sdb -g sdba ${ROOT}${MAXDBROOT}/data chown -R sdb:sdba ${ROOT}${MAXDBROOT}/programs chown -R sdb:sdba ${ROOT}${MAXDBROOT}/data # Change the config file /etc/opt/sdb to the real values echo [Globals] > /etc/opt/sdb echo IndepData=${ROOT}${MAXDBROOT}/data >> /etc/opt/sdb echo IndepPrograms=${ROOT}${MAXDBROOT}/programs >> /etc/opt/sdb echo SdbOwner=sdb >> /etc/opt/sdb echo SdbGroup=sdba >> /etc/opt/sdb # Register the installation if [ -f ${ROOT}${MAXDBROOT}/data/Installations.ini ] then mv ${ROOT}${MAXDBROOT}/data/Installations.ini ${ROOT}${MAXDBROOT}/data/Installations.ini.orig fi if [ -f ${ROOT}${MAXDBROOT}/programs/bin/dbmcli ] then ${ROOT}${MAXDBROOT}/programs/bin/dbmcli -R ${ROOT}${MAXDBROOT}/programs inst_reg -k ${ROOT}${MAXDBROOT}/programs fi #your friendly public service announcement... einfo "MaxDb has been installed to" einfo ${MAXDBROOT} einfo ewarn "Check the file ${ROOT}${MAXDBROOT}/data/Installations.ini if your" ewarn "Installation to ${ROOT}${MAXDBROOT}/programs has been registered !" ewarn ewarn "If not you may want to run:" ewarn "dbmcli -R ${ROOT}${MAXDBROOT}/programs inst_reg -k ${ROOT}${MAXDBROOT}/programs" ewarn "now to register the installation!" ewarn ewarn "And you should add ${MAXDBROOT}/programs/bin to your PATH" }