# Copyright 2018 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 inherit autotools DESCRIPTION="Tango is an Open Source solution for SCADA and DCS" HOMEPAGE="http://www.tango-controls.org/" SRC_URI="mirror://sourceforge/tango-cs/${P}.tar.gz" LICENSE="GPL-3" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="+dbserver doc +doxygen html java mariadb mmx +mysql zlib" REQUIRED_USE="dbserver? ( ^^ ( mariadb mysql ) ) !dbserver? ( !mariadb ) !dbserver? ( !mysql ) mmx? ( x86 ) html? ( doc )" COMMON_DEPEND=" dbserver? ( mariadb? ( >=dev-db/mariadb-10.0.0[server] dev-db/mariadb-connector-c ) mysql? ( >=dev-db/mysql-5.5[server] dev-db/mysql-connector-c ) ) doxygen? ( app-doc/doxygen ) java? ( >=virtual/jdk-1.7.0:* ) zlib? ( sys-libs/zlib ) >=net-libs/zeromq-4.0.5 >=net-misc/omniORB-4.2.2 " DEPEND="${COMMOM_DEPEND} doc? ( app-doc/doxygen media-gfx/graphviz ) virtual/pkgconfig" RDEPEND="${COMMON_DEPEND}" BDEPEND="${DEPEND}" DOCS=( AUTHORS README TANGO_CHANGES ) PATCHES=( "${FILESDIR}"/${P}-autoconf.patch ) pkg_setup() { if ! use dbserver ; then ewarn ewarn "In this way you lose most of Tango features but you can still" ewarn "use this configuration to develop a device server." ewarn fi } src_prepare() { default # don't install scripts (init scripts and the registration of the notification # service daemon in the tango database) because we use our custom version sed -ibak -e 's:scripts ::' Makefile.am \ || die "failed patching Makefile.am" if ! use doc ; then sed -i -e 's@^DOCS@#DOCS@' doc/Makefile.am \ || die "failed patching doc/Makefile.am" fi eautoreconf } src_configure() { # the database should be created later by the admin of the system and not # during the configuration process econf \ --with-omni="${EPREFIX}"/usr \ --with-zmq="${EPREFIX}"/usr \ --disable-dbcreate \ --disable-static \ --with-mariadbclient-include="${EPREFIX}"/usr/include/mysql \ $(use_enable mariadb) \ $(use_enable mmx jpegmmx) \ $(use_enable doc doxygen) \ $(use_enable doc dot) \ $(use_enable html html-docs) \ $(use_enable java) \ $(use_enable dbserver) \ $(use_with zlib zlib "${EPREFIX}"/usr) \ $(use_with doxygen) } src_install() { default find "${D}" -name '*.la' -delete || die if use dbserver ; then newinitd "${FILESDIR}"/tango9.init tango newconfd "${FILESDIR}"/tango9.conf tango insinto /usr/share/${PN}/db doins cppserver/database/*.sql doins cppserver/database/my.cnf exeinto /usr/share/${PN}/db doexe cppserver/database/*.sh fi } pkg_postinst() { einfo einfo "The default config filename is \"/etc/tangorc\"" einfo if use dbserver ; then einfo "The default mysql database which is going to be created is \"tango\"." einfo einfo "If this is a new installation please execute the script" einfo " /usr/share/${PN}/db/create_db.sh" einfo "from its folder. The /usr/share/${PN}/db/my.cnf shows an example" einfo "of configuration file for the database." einfo einfo "In case of an upgrade to a major release look at the instructions" einfo "in the README and use the scripts in /usr/share/${PN}/db" einfo einfo "At the end, grant the access to the database tables to the user" einfo "you like. For instance, give tango:tango credentials to the" einfo "database:" einfo " GRANT ALL PRIVILEGES ON tango.* TO 'tango'@'localhost' IDENTIFIED BY 'tango'"; einfo "Configure accordingly the init script in /etc/conf.d/tango!" einfo einfo "The default port for the Tango Database device server is 10000" einfo "To use the Tango system you need to set the environment variable" einfo "TANGO_HOST, for instance to localhost:10000" einfo einfo "To test the first installation please use the command" einfo " $ TangoTest test" einfo "and use \"jive\" to see if the server is working properly." einfo else einfo "To test the first installation please use the command" einfo " $ TangoTest test -nodb" einfo fi }