# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ ESVN_REPO_URI="http://svn.opengroupware.org/SOPE/releases/4.5.6-morecore/" inherit eutils flag-o-matic subversion depend.apache GMAKE_VERSION="1.12.0" DESCRIPTION="OpenGroupware, the leading open source groupware server" HOMEPAGE="http://www.opengroupware.org" SRC_URI="http://ftp.gnustep.org/pub/gnustep/core/gnustep-make-${GMAKE_VERSION}.tar.gz" SLOT="0" LICENSE="GPL-2" KEYWORDS="~x86 ~amd64" IUSE="debug ffcall gcc-libffi reentrant sasl ssl strip verbose" # This is a complex package stuff, because OGo need GNUstep-make # for its own, and will NOT be installed OGO_PATH="/usr/local" OGO_GNUSTEP="${OGO_PATH}/GNUstep" OGO_LOCAL_GNUSTEP="${S}${OGO_GNUSTEP}" OGO_VERSION="opengroupware.org-1.1" DEPEND=">=dev-db/postgresql-7.4 apache2? ( ${APACHE2_DEPEND} ) >=net-nds/openldap-2.1 sys-libs/zlib sys-devel/flex sys-devel/bison app-admin/sudo app-pda/pilot-link" RDEPEND=">=dev-db/postgresql-7.4 apache2? ( ${APACHE2_DEPEND} ) >=net-nds/openldap-2.1" pkg_setup() { # ObjC extension detection. From the GNUstep eclass export OBJC_TEST="${TMP}/objc_test.m" cat > "${OBJC_TEST}" << EOF /** * This example taken from the tutorial at: * http://gnustep.made-it.com/GSPT/xml/Tutorial_en.html A GNUstep Programming Tutorial Time is on our side... Yen-Ju Chen Dennis Leeuw Copyright © 2003 Yen-Ju Chen, Dennis Leeuw Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. */ #include @interface Greeter:Object { /* This is left empty on purpose: * Normally instance variables would be declared here, * but these are not used in our example. */ } - (void)greet; @end #include @implementation Greeter - (void)greet { printf("Hello, World!\n"); } @end #include int main(void) { id myGreeter; myGreeter=[Greeter new]; [myGreeter greet]; [myGreeter free]; return EXIT_SUCCESS; } EOF local objc_available objc_available="yes" eval $(tc-getCC) ${OBJC_TEST} -o ${OBJC_TEST}-out -lobjc || objc_available="no" if [ "${objc_available}" == "no" ]; then einfo 'ObjC Compiler is missing. Please re-emerge gcc with USE="objc"' die fi # Create a user account for OGo enewgroup skyrix enewuser ogo -1 /bin/bash /var/lib/opengroupware skyrix } src_unpack() { # Get GNU-make from GNU software S=${WORKDIR}/${P}/ mkdir -p ${S} cd ${S} unpack ${A} # Get SOPE source from SVN ESVN_REPO_URI="http://svn.opengroupware.org/SOPE/releases/4.5.6-morecore/" ESVN_PROJECT="OGo-SOPE" S=${WORKDIR}/${P}/SOPE mkdir -p ${S} subversion_src_unpack # Get OpenGroupware source from SVN ESVN_REPO_URI="http://svn.opengroupware.org/OpenGroupware.org/releases/1.1.3-moveon/" ESVN_PROJECT="OGo" S=${WORKDIR}/${P}/OpenGroupware.org mkdir -p ${S} subversion_src_unpack # Restore base source S=${WORKDIR}/${P} } src_compile() { ###############[ SOPE ]############### einfo "GNUstep-make" cd ${S}/gnustep-make-${GMAKE_VERSION} local myconf myconf="--prefix=${OGO_GNUSTEP}" myconf="${myconf} --disable-importing-config-file" myconf="${myconf} --sysconfdir=/etc" # myconf="${myconf} --with-config-file=${OGO_PATH}/etc/GNUstep.conf" myconf="${myconf} --with-system-root=${OGO_GNUSTEP}" myconf="${myconf} --with-network-root=${OGO_GNUSTEP}" myconf="${myconf} --with-local-root=${OGO_GNUSTEP}" myconf="${myconf} --with-user-root=${OGO_GNUSTEP}" myconf="${myconf} --with-library-combo=gnu-fd-nil" ./configure $myconf || die "configure failed" # The goal here is to install gnu-make in ${S} # so it will only used when making the OGo stuff local make_eval make_eval="special_prefix=${D}" make_eval="${make_eval} makedir=${OGO_LOCAL_GNUSTEP}/Library/Makefiles" make_eval="${make_eval} GNUSTEP_INSTALLATION_DIR=${OGO_LOCAL_GNUSTEP}" if use debug ; then make_eval="${make_eval} debug=yes" fi if use verbose ; then make_eval="${make_eval} verbose=yes" fi eval make ${make_eval} install \ || die "make failed" mkdir -p ${S}/${OGO_PATH}/include mkdir -p ${S}/${OGO_PATH}/lib mkdir -p ${S}/${OGO_PATH}/bin # Backup org files for later installation sed -i-org "s#${OGO_PATH}#${S}${OGO_PATH}#" \ ${OGO_LOCAL_GNUSTEP}/Library/Makefiles/GNUstep.sh sed -i-org "s#GS_HEADER_PATH = #GS_HEADER_PATH = ${S}${OGO_PATH}/include #" \ ${OGO_LOCAL_GNUSTEP}/Library/Makefiles/common.make sed -i-org "s#GS_LIBRARY_PATH = #GS_LIBRARY_PATH = ${S}${OGO_PATH}/lib #" \ ${OGO_LOCAL_GNUSTEP}/Library/Makefiles/common.make # Now we have GNUstep-make installed in $S/$OGO_LOCAL_GNUSTEP einfo "Finished gnustep-make, now setting up environnement variables" GNUSTEP_SYSTEM_ROOT=${OGO_LOCAL_GNUSTEP} source ${OGO_LOCAL_GNUSTEP}/Library/Makefiles/GNUstep.sh GNUSTEP_USER_ROOT=${GNUSTEP_LOCAL_ROOT} #----- Libobjc einfo "libobjc" cd ${S}/SOPE/gnustep-objc local make_eval make_eval="FHS_INSTALL_ROOT=${S}/${OGO_PATH}" make_eval="${make_eval} GNUSTEP_INSTALLATION_DIR=${OGO_LOCAL_GNUSTEP}" if use debug ; then make_eval="${make_eval} debug=yes" fi if use verbose ; then make_eval="${make_eval} debug=yes" fi eval make ${make_eval} install \ || die "make failed" #----- libFoundation einfo "libFoundation" cd ${S}/SOPE/libFoundation # BUG about libFoundation configure that look in wrong place # the clean_cpu.sh GNUstep script sed -i "s#/Makefiles/clean_cpu.sh #/Library/Makefiles/clean_cpu.sh #" \ ${S}/SOPE/libFoundation/configure sed -i "s#/Makefiles/clean_cpu.sh#/Library/Makefiles/clean_cpu.sh #" \ ${S}/SOPE/libFoundation/configure.in local myconf myconf="--with-gnustep" if use ffcall; then einfo "Using ffcall for FFI, not libffi" myconf="${myconf} --disable-libffi --enable-ffcall" else einfo "Using libffi for FFI, not ffcall" myconf="${myconf} --enable-libffi --disable-ffcall" if use gcc-libffi; then myconf="${myconf} --with-ffi-library=$(gcc-config -L)" myconf="${myconf} --with-ffi-include=$(gcc-config -L | sed 's/:.*//')/include" else myconf="${myconf} --with-ffi-library=/usr/lib/libffi" myconf="${myconf} --with-ffi-include=/usr/include/libffi" fi fi econf $myconf || die "configure failed" # BUG about libFoundation configure that look in wrong place # the clean_cpu.sh GNUstep script - after configure, still wrong sed -i "s#/Makefiles/clean_cpu.sh#/Library/Makefiles/clean_cpu.sh #" \ ${S}/SOPE/libFoundation/configure sed -i "s#/Makefiles/clean_cpu.sh#/Library/Makefiles/clean_cpu.sh #" \ ${S}/SOPE/libFoundation/configure.in local make_eval make_eval="FHS_INSTALL_ROOT=${S}/${OGO_PATH}" make_eval="${make_eval} GNUSTEP_INSTALLATION_DIR=${OGO_LOCAL_GNUSTEP}" make_eval="${make_eval} INSTALL_DATA=install" if use debug ; then make_eval="${make_eval} debug=yes" fi if use verbose ; then make_eval="${make_eval} verbose=yes" fi eval make ${make_eval} install \ || die "make failed" #----- SOPE einfo "SOPE" cd ${S}/SOPE local myconf myconf="--with-gnustep" ./configure $myconf || die "configure failed" local make_eval make_eval="FHS_INSTALL_ROOT=${S}/${OGO_PATH}" make_eval="${make_eval} GNUSTEP_INSTALLATION_DIR=${OGO_LOCAL_GNUSTEP}" if use debug ; then make_eval="${make_eval} debug=yes" fi if use reentrant ; then make_eval="${make_eval} reentrant=yes" fi if use sasl ; then make_eval="${make_eval} sasl=yes" fi if use ssl ; then make_eval="${make_eval} ssl=yes" fi if use strip ; then make_eval="${make_eval} strip=yes" fi eval make ${make_eval} install \ || die "make failed" ###############[ OpenGroupware.org ]############### einfo "OpenGroupware" LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${S}${OGO_PATH}/lib cd ${S}/OpenGroupware.org local myconf myconf="--with-gnustep" ./configure $myconf || die "configure failed" local make_eval make_eval="FHS_INSTALL_ROOT=${S}/${OGO_PATH}" make_eval="${make_eval} GNUSTEP_INSTALLATION_DIR=${OGO_LOCAL_GNUSTEP}" if use debug ; then make_eval="${make_eval} debug=yes" fi if use strip ; then make_eval="${make_eval} strip=yes" fi eval make ${make_eval} install \ || die "make failed" ###############[ Apache Connector ]############### einfo "Apache connector" cd ${S}/SOPE/sope-appserver/mod_ngobjweb local make_eval make_eval="apxs=${APXS2}" make_eval="${make_eval} HTTPD=/usr/sbin/apache2" make_eval="${make_eval} FHS_INSTALL_ROOT=${S}/${OGO_PATH}" make_eval="${make_eval} GNUSTEP_INSTALLATION_DIR=${OGO_LOCAL_GNUSTEP}" if use debug ; then make_eval="${make_eval} debug=yes" fi if use strip ; then make_eval="${make_eval} strip=yes" fi eval make ${make_eval} \ || die "make failed" einfo "Finished Compiling" } src_install() { einfo "Prepare installation" # Restore original GNUstep configuration files cp ${OGO_LOCAL_GNUSTEP}/Library/Makefiles/GNUstep.sh-org \ ${OGO_LOCAL_GNUSTEP}/Library/Makefiles/GNUstep.sh cp ${OGO_LOCAL_GNUSTEP}/Library/Makefiles/common.make-org \ ${OGO_LOCAL_GNUSTEP}/Library/Makefiles/common.make rm -r ${S}/${OGO_PATH}/share/${OGO_VERSION}/translations rm -r ${S}/${OGO_PATH}/share/${OGO_VERSION}/templates dodir /var/log/opengroupware dodir /var/lib/opengroupware dodir -p /var/lib/opengroupware/.libFoudation/Defaults chown -R ogo:skyrix /var/log/opengroupware chown -R ogo:skyrix /var/lib/opengroupware # Install main OGo files cd ${S}${OGO_PATH} into /usr/local dobin bin/* dosbin sbin/* insinto ${OGO_PATH}/include doins -r include/* insinto ${OGO_PATH}/lib doins -r lib/* insinto ${OGO_PATH}/man doins -r man/* insinto ${OGO_PATH}/share doins -r share/* # Install specific translations, templates and web files insinto ${OGO_PATH}/share/${OGO_VERSION}/translations cd ${S}/OpenGroupware.org/WebUI/Resources doins -r * insinto ${OGO_PATH}/share/${OGO_VERSION}/templates cd ${S}/OpenGroupware.org/WebUI/Templates doins -r * insinto ${OGO_PATH}/share/${OGO_VERSION}/www cd ${S}/OpenGroupware.org/Themes/WebServerResources doins -r * insinto ${OGO_PATH}/share/${OGO_VERSION}/database cd ${S}/OpenGroupware.org/Database/PostgreSQL doins pg-build-schema.psql pg-build-schema.psql.constraints doins pg-fill-objinfo.psql pg-rename-root-to-cyrus.psql pg-update-schema.psql # System files exeinto /etc/init.d/ newexe ${FILESDIR}/opengroupware.startscript opengroupware || die insinto /etc/conf.d/ newins ${FILESDIR}/opengroupware.conf.d opengroupware || die insinto ${APACHE2_MODULES_CONFDIR} newins ${FILESDIR}/50_opengroupware.conf 50_opengroupware.conf || die # Install apache module einfo "Copy apache module" cd ${S}/SOPE/sope-appserver/mod_ngobjweb insinto ${APACHE2_MODULESDIR} doins mod_ngobjweb.so # Documentation files einfo "Prepare documentation" cd ${S}/OpenGroupware.org dodoc COPYRIGHT ChangeLog INSTALL OVERVIEW README mkdir -p ${D}/usr/share/doc/${PF}/gnustep-make cd ${S}/gnustep-make-${GMAKE_VERSION} cp ANNOUNCE COPYING ChangeLog* FAQ INSTALL NEWS README Version \ ${D}/usr/share/doc/${PF}/gnustep-make mkdir -p ${D}/usr/share/doc/${PF}/SOPE/objc cd ${S}/SOPE/gnustep-objc cp COPYING COPYING.LIB ChangeLog README* THREADS \ ${D}/usr/share/doc/${PF}/SOPE/objc mkdir -p ${D}/usr/share/doc/${PF}/SOPE/libFoundation cd ${S}/SOPE/libFoundation cp ANNOUNCE AUTHORS COPYING ChangeLog INSTALL.txt NEWS README* TODO \ ${D}/usr/share/doc/${PF}/SOPE/libFoundation cd ${S}/SOPE cp COPYRIGHT INSTALL PROJECTLEAD README TODO.txt Version \ ${D}/usr/share/doc/${PF}/SOPE mkdir -p ${D}/usr/share/doc/${PF}/SOPE/mod_ngobjweb cd ${S}/SOPE/sope-appserver/mod_ngobjweb cp CHANGES COPYRIGHT ChangeLog README \ ${D}/usr/share/doc/${PF}/SOPE/mod_ngobjweb } pkg_postinst() { einfo "OpenGoupware is now installed on your computer !" einfo "" einfo "Make sure that you enable PostgreSQL TCP/IP Sockets and Port" einfo "To finish your installation, you need to setup your database :" einfo "psql -h YourDBHost -U postgres -d template1" einfo " template1=# CREATE USER ogoadmin WITH PASSWORD 'test';" einfo " template1=# CREATE DATABASE ogodb;" einfo " template1=# GRANT ALL ON DATABASE ogodb TO ogoadmin;" einfo "" einfo "Then load default database (the next command should be one line);" einfo " psql -h YourDBHost -U ogoadmin -d ogodb -f \\" einfo " ${OGO_PATH}/share/${OGO_VERSION}/database/pg-build-schema.psql" einfo "" einfo "Now, as ogo user, setup defaults to point out the correct database :" einfo "su ogo" einfo " ${OGO_PATH}/bin/Defaults write NSGlobalDomain TimeZoneName GMT" einfo " ${OGO_PATH}/bin/Defaults write NSGlobalDomain LSAdaptor PostgreSQL" einfo " ${OGO_PATH}/bin/Defaults write NSGlobalDomain Defaults write NSGlobalDomain \\" einfo " LSConnectionDictionary '{databaseName = ogodb; hostName = YourDBHost; \\" einfo " password = \"test\"; port = 5432; userName = ogoadmin}' # on one line" einfo "" einfo "Apache Setup : " einfo " Add '-D OGo' in the APACHE2_OPTS" einfo " Restart Apache, start OGo and connect to http://localhost/OpenGroupware" }