# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="1" inherit autotools eutils qt3 fdo-mime DESCRIPTION="Gambas is a free development environment based on a Basic interpreter with object extensions" HOMEPAGE="http://gambas.sourceforge.net/" RESTRICT="mirror" SLOT="2" MY_PN="${PN}${SLOT}" MY_P="${MY_PN}-${PV}" SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.bz2" LICENSE="GPL-2" KEYWORDS="~amd64 ~x86" IUSE="bzip2 corba curl debug firebird gtk kde mysql odbc opengl pcre pdf postgres qt3 sdl smtp sqlite sqlite3 svg v4l xml zlib" DEPEND="" RDEPEND="bzip2? ( >=app-arch/bzip2-1.0.5 ) corba? ( >=net-misc/omniORB-4.1.0 ) curl? ( >=net-misc/curl-7.15.5-r1 ) firebird? ( >=dev-db/firebird-2.1.0.17755_rc2-r1 ) gtk? ( >=x11-libs/gtk+-2.10.14 ) kde? ( >=kde-base/kdelibs-3.5.9-r1 ) mysql? ( >=virtual/mysql-5.0 ) odbc? ( >=dev-db/unixODBC-2.2.12 ) opengl? ( >=media-libs/mesa-7.0.2 ) pcre? ( >=dev-libs/libpcre-7.6-r1 ) pdf? ( >=app-text/poppler-0.5.3 ) postgres? ( >=virtual/postgresql-base-8.2 ) qt3? ( >=x11-libs/qt-3.2:3 ) sdl? ( >=media-libs/sdl-image-1.2.6-r1 >=media-libs/sdl-mixer-1.2.7 ) smtp? ( >=dev-libs/glib-2.16.2 ) sqlite? ( =dev-db/sqlite-2* ) sqlite3? ( >=dev-db/sqlite-3.5.6 ) svg? ( >=gnome-base/librsvg-2.16.1-r2 ) v4l? ( >=media-libs/libpng-1.2.26 >=media-libs/jpeg-6b-r8 ) xml? ( >=dev-libs/libxml2-2.6.31 >=dev-libs/libxslt-1.1.22 ) zlib? ( >=sys-libs/zlib-1.2.3-r1 )" S="${WORKDIR}/${MY_P}" pkg_setup() { if ( !(built_with_use sys-devel/gcc libffi) ); then die "gcc needs to be build with the USE flag libffi" fi if ( !( use gtk ) ); then use svg && die "SVG support depends on GTK being enabled" fi } my_reduce_eautoreconf () { sed -i -e "/^GB_CONFIG_SUBDIRS(${1}, gb./d" \ configure.ac \ || die "my_reduce_eautoreconf: sed on configure.ac failed with ${1}" sed -i -e "/^SUBDIRS/s/@${1}_dir@\ //1" \ Makefile.am \ || die "my_reduce_eautoreconf: sed on Makefile.am failed with ${1}" } src_unpack() { unpack ${A} cd "${S}" ebegin "Applying sed no-automagic-patch" sed -i -e 's/gb_enable_\$1=yes/gb_enable_\$1=no/' \ acinclude.m4 \ || die "sed no-automagic-patch failed" eend 0 epatch "${FILESDIR}/${PN}-2.5.0-gcc-libffi-path.patch" epatch "${FILESDIR}/${PN}-2.5.0-sdl.patch" epatch "${FILESDIR}/${PN}-2.5.0-mimetype-registration.patch" # gb.qt needs this patch because it does not use GB_COMPONENT_PKG_CONFIG in qt.gb/configure.ac epatch "${FILESDIR}/${PN}-2.7.0-r1-gb.qt-QT_LDFLAGS.patch" # help does not appear to need libtool, see acinclude.m4 for more info epatch "${FILESDIR}/${PN}-2.7.0-r1-help-GB_INIT_SHORT.patch" # libtool compatibility, split previous 2.7.0-r1-libtool-and-FLAGS.patch epatch "${FILESDIR}/${PN}-2.7.0-r1-remove-libltdl-from-main.patch" epatch "${FILESDIR}/${PN}-2.8.0-libtool.patch" epatch "${FILESDIR}/${PN}-2.8.0-FLAGS.patch" epatch "${FILESDIR}/${PN}-2.8.0-help-path.patch" epatch "${FILESDIR}/${PN}-2.8.0-sdl-component-name.patch" ebegin "Applying sed remove-libtool-patch" # remove embedded libtool.m4 file sed -i -e '/[-][*][-]Autoconf[-][*][-]$/,/^dnl\ Like\ AC_CHECK_HEADER,\ but/d' \ acinclude.m4 \ || die "sed remove-libtool-patch failed" eend 0 ebegin "Removing provided libtool/libltdl" rm -R ./main/libltdl \ && rm config.guess config.sub install-sh ltmain.sh \ && rm */config.guess */config.sub */install-sh */ltmain.sh \ || die "removing libtool failed" eend 0 ebegin "Reducing eautoreconf" # keep synchronized with myconf in src_compile use bzip2 || my_reduce_eautoreconf bzlib2 use zlib || my_reduce_eautoreconf zlib use mysql || my_reduce_eautoreconf mysql use odbc || my_reduce_eautoreconf odbc use postgres || my_reduce_eautoreconf postgresql use sqlite || my_reduce_eautoreconf sqlite2 use sqlite3 || my_reduce_eautoreconf sqlite3 use firebird || my_reduce_eautoreconf firebird use gtk || my_reduce_eautoreconf gtk use svg || my_reduce_eautoreconf gtksvg use pdf || my_reduce_eautoreconf pdf #net use curl || my_reduce_eautoreconf curl use smtp || my_reduce_eautoreconf smtp use pcre || my_reduce_eautoreconf pcre use qt3 || my_reduce_eautoreconf qt my_reduce_eautoreconf qte use kde || my_reduce_eautoreconf kde use sdl || my_reduce_eautoreconf sdl use sdl || my_reduce_eautoreconf sdl_sound use xml || my_reduce_eautoreconf xml use v4l || my_reduce_eautoreconf v4l #crypt use opengl || my_reduce_eautoreconf opengl use corba || my_reduce_eautoreconf corba use qt3 || my_reduce_eautoreconf image (use qt3 \ || use gtk) || my_reduce_eautoreconf desktop eend 0 eautoreconf || die "eautoreconf failed" } src_compile() { local myconf local myconf_main local myconf_qt local myconf_xml myconf="$(use_enable bzip2 bzlib2) $(use_enable zlib) $(use_enable mysql) $(use_enable odbc) $(use_enable postgres postgresql) $(use_enable sqlite sqlite2) $(use_enable sqlite3) $(use_enable firebird) $(use_enable gtk) $(use_enable svg gtksvg) $(use_enable pdf) --enable-net $(use_enable curl) $(use_enable smtp) $(use_enable pcre) $(use_enable qt3 qt) --disable-qte $(use_enable kde) $(use_enable sdl) $(use_enable sdl sdl_sound) $(use_enable xml) $(use_enable v4l) --enable-crypt $(use_enable opengl) $(use_enable corba) $(use_enable qt3 image)" if (use qt3 || use gtk); then myconf="${myconf} --enable-desktop" fi myconf_main="--enable-intl --enable-conv --enable-ffi --enable-preloading" if (use qt3); then myconf_qt="$(use_enable opengl qtopengl) --enable-qt-translation " fi myconf_xml="$(use_enable xml xslt)" econf --config-cache \ ${myconf} ${myconf_main} ${myconf_qt} ${myconf_xml} \ $(use_enable debug) --disable-profiling \ --docdir=/usr/share/doc/${PF} --htmldir=/usr/share/doc/${PF}/html \ || die "econf failed" emake || die "emake failed" } src_install() { emake DESTDIR="${D}" install -j1 || die "emake install failed" dodoc AUTHORS ChangeLog NEWS README || die "dodoc failed" if (use qt3 || use gtk); then make_desktop_entry "${MY_PN}" "Gambas" "/usr/share/icons/hicolor/128x128/apps/${MY_PN}.png" "Development" \ || die "make_desktop_entry failed" insinto /usr/share/icons/hicolor/128x128/apps newins comp/src/gb.report/new-logo.png ${MY_PN}.png \ || die "newins failed" fi insinto /usr/share/icons/hicolor/64x64/mimetypes doins app/mime/application-x-gambasscript.png main/mime/application-x-gambas.png \ || die "doins failed" insinto /usr/share/mime/application doins app/mime/application-x-gambasscript.xml main/mime/application-x-gambas.xml \ || die "doins failed" dosym "/usr/share/${MY_PN}/help" "/usr/share/doc/${PF}/html" \ || die "dosym failed" } my_fdo_update() { fdo-mime_desktop_database_update fdo-mime_mime_database_update } pkg_postinst() { my_fdo_update } pkg_postrm() { my_fdo_update }