# 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-src/maxdb-src-7.5.0.18.ebuild,v 1.4 2004/12/06 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_00_18.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-2.3.4 ) perl? ( >=dev-lang/perl-2.3.3 ) maxdb-devtools-bin ( =maxdb-devtools-src-528670 )" warning() { ewarn ewarn "!!! No update process supported (yet)" ewarn "!!! BE SURE THAT YOUR DATA FROM PREVIOUS" ewarn "!!! INSTALLATIONS HAS BEEN SAVED" ewarn "!!! THIS EBUILD WILL NOT COMPLETE AUTOMATICALLY" ewarn "!!! It will stop in the middle, tell you what to do" ewarn "!!! and wait for you to press ENTER." einfo einfo "You can specify the root directory for the installation" einfo "by setting the environment variable MAXDBROOT" einfo "(without the leading / please. i.e. opt/sdb" einfo einfo "MaxDB will be installed to:" einfo ${MAXDBROOT} einfo einfo "You can specify the directory where the needed DevTools are" einfo "by setting the environment variable DEVTOOLS" einfo einfo "DevTools should be in:" einfo ${DEVTOOLS} einfo einfo "Be shure that you did run ${DEVTOOLS}/bin/prepare_inst.pl as root" einfo "to create the global SAP DB registry," einfo "(or export NOREG=1 to build without registration)" einfo einfo "Workdir is:" einfo ${WORKDIR} einfo D is: einfo ${D} einfo ROOT is: einfo ${ROOT} einfo DISTDIR is: einfo ${DISTDIR} sleep 10 } pkg_setup() { sleep 10 if [ -z "${MAXDBROOT}" ]; then MAXDBROOT=opt/sdb fi if [ -z "${DEVTOOLS}" ]; then DEVTOOLS=${ROOT}${MAXDBROOT}/devtools fi warning INSTDATA_TMP=${WORKDIR}/V75_00_18/MaxDB_ORG/data INSTDATA_FIN=${D}${MAXDBROOT}/data INSTROOT_TMP=${WORKDIR}/V75_00_18/MaxDB_ORG/usr INSTROOT_FIN=${D}${MAXDBROOT}/programs } src_unpack() { unpack ${A} || die # Add the ini file for the Web-Administration EPATCH_OPTS="-p1 -d ${WORKDIR}" \ epatch ${FILESDIR}/maxdb-source-7_5_0_18_ini.patch # Add the missing files to the distribution and apply the patch for gcc-3.3 EPATCH_OPTS="-p1 -d ${WORKDIR}/V75_00_18" \ epatch ${FILESDIR}/maxdb-source-7_5_0_18_all.patch addwrite /etc/opt } 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_18/MaxDB_ORG # 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 # create a link for SQLDBC_C.cpp (new bug from V75_00_12 on ?) mkdir ${WORKDIR}/V75_00_18/MaxDB_ORG/sys/wrk ln -s ${WORKDIR}/V75_00_18/MaxDB_ORG/sys/src ${WORKDIR}/V75_00_18/MaxDB_ORG/sys/wrk/src # Build the targets (you have to build target all) # einfo "Building target: all" # imf all || die # create the build-script echo \#!/bin/sh > ${WORKDIR}/build.sh echo . devsapdb >> ${WORKDIR}/build.sh echo export PYTHON_INCLUDE=${WORKDIR}/Python-1.5/Include >> ${WORKDIR}/build.sh echo imf all >> ${WORKDIR}/build.sh chmod 755 ${WORKDIR}/build.sh einfo "" einfo "BUIL PROCESS CAN CURRENTLY NOT BE RUN WITHIN PORTAGE" einfo "(you have to start ist manualy following the steps below)" einfo "" einfo "To execute the make process do the following " einfo "in a second console (window) as root:" einfo "" ewarn "# cd ${WORKDIR}" ewarn "# ./build.sh" einfo "" einfo "When the build finishes (this will take very long)" einfo "go back to this window end press ENTER !" read } src_install() { # create the directories and copy the files dodir ${MAXDBROOT}/programs dodir ${MAXDBROOT}/data dodir ${MAXDBROOT}/data/fifo dodir /usr/spool/sql/ini dodir /usr/spool/sql/pid dodir /usr/spool/sql/pid/serverpids einfo "INSTROOT_TMP: ${INSTROOT_TMP}" einfo "INSTROOT_FIN: ${INSTROOT_FIN}" einfo "INSTDATA_TMP: ${INSTDATA_TMP}" einfo "INSTDATA_FIN: ${INSTDATA_FIN}" (cd ${INSTROOT_TMP} > /dev/null; tar cf - .) | (cd ${INSTROOT_FIN} >/dev/null; tar xvf -) (cd ${INSTDATA_TMP} > /dev/null; tar cf - .) | (cd ${INSTDATA_FIN} >/dev/null; tar xvf -) (cd ${WORKDIR}/usr/spool/sql/ini > /dev/null; tar cf - .) | (cd ${D}/usr/spool/sql/ini >/dev/null; tar xvf -) } 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 install -d -m0755 -o root -g root usr/spool/sql/ini/WebAgent75.ini install -d -m0755 -o root -g root usr/spool/sql/pid/serverpids 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 if [ ! -d /etc/opt ] then mkdir /etc/opt fi 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/config/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" }