]> Pileus Git - ~andy/sunrise/commitdiff
dev-libs/librets: New ebuild for bug 371707 thanks to mgorny for the review.
authorMatthew Schultz (mschultz) <mattsch@gmail.com>
Sat, 25 Jun 2011 20:48:16 +0000 (20:48 +0000)
committerMatthew Schultz (mschultz) <mattsch@gmail.com>
Sat, 25 Jun 2011 20:48:16 +0000 (20:48 +0000)
svn path=/sunrise/; revision=12158

dev-libs/librets/ChangeLog [new file with mode: 0644]
dev-libs/librets/Manifest [new file with mode: 0644]
dev-libs/librets/files/java.mk.patch [new file with mode: 0644]
dev-libs/librets/files/perl.mk.patch [new file with mode: 0644]
dev-libs/librets/files/python.mk.patch [new file with mode: 0644]
dev-libs/librets/librets-1.5.2.ebuild [new file with mode: 0644]
dev-libs/librets/metadata.xml [new file with mode: 0644]

diff --git a/dev-libs/librets/ChangeLog b/dev-libs/librets/ChangeLog
new file mode 100644 (file)
index 0000000..63ef9d0
--- /dev/null
@@ -0,0 +1,9 @@
+# ChangeLog for dev-libs/librets
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Header: $
+
+  25 Jun 2011; Matthew Schultz (mschultz) <mattsch@gmail.com>
+  +librets-1.5.2.ebuild, +files/java.mk.patch, +files/perl.mk.patch,
+  +files/python.mk.patch, +metadata.xml:
+  New ebuild for bug 371707 thanks to mgorny for the review.
+
diff --git a/dev-libs/librets/Manifest b/dev-libs/librets/Manifest
new file mode 100644 (file)
index 0000000..0089650
--- /dev/null
@@ -0,0 +1,7 @@
+AUX java.mk.patch 783 RMD160 1ba38cbea393c1646f1517665c515402a3834135 SHA1 049e24d2240fe8b3c22325f4e476afa4f901b063 SHA256 9709b787b2c55c9c390a22677fbe15d821beb588e6ccedb48e1277fff47345de
+AUX perl.mk.patch 1088 RMD160 7054d8bb712814434e3978c69c36ff267c102a5a SHA1 660fa197034f316aa7523a17c2a0ea065876e975 SHA256 200c4fa5f034478b406892fbac17156655be49164f46dcaba094e13745993198
+AUX python.mk.patch 758 RMD160 d6e34e296eaefe7dad02a79312c2ee2925d1bb55 SHA1 07c1a325c05c938660df975fc3340de1c12dc8fd SHA256 0f51951aeacd3be302eac03af56011bb02b1b684a1ceb3ed366d054eec143ceb
+DIST librets-1.5.2.tar.gz 1157546 RMD160 154a4fff9bbf994b739a1d30b3bb5eed9ecdd5d3 SHA1 cc856a41bc8120865937d199c918542bf3d82a95 SHA256 5d9c32eefd1a20b90c58ef117010768d8161c56ee0138efa4dd8b1ab82a433ce
+EBUILD librets-1.5.2.ebuild 5038 RMD160 424ab5b76bf4bf3a54baeb195f5450aaffc73f60 SHA1 b83fb3b3bdfb04e1188e8d7f4fe2d03ce99dbc9b SHA256 1766bb19cb1d332b1fad13aa63ec6e5bb093ed71e48bd56c5f53b3b7ea5ff720
+MISC ChangeLog 351 RMD160 4eebe269f9cdedf106e35080da93926b7770d118 SHA1 0cd2d53ae7b3866a25eb184d6ba0489e5b357354 SHA256 28d484abe4da95105c7e06b5fa87db80ac3cd351db8dd0e6251b601c61d8a093
+MISC metadata.xml 800 RMD160 d48297095a211ab283113ba6e523e891c28ca103 SHA1 fa4d97550c3635d2c82c90b203c402afb974825e SHA256 b1e957b8e2cc90cbab17953978c297fb87c63cf4abbbaf861a299e4f447aa63e
diff --git a/dev-libs/librets/files/java.mk.patch b/dev-libs/librets/files/java.mk.patch
new file mode 100644 (file)
index 0000000..b391b48
--- /dev/null
@@ -0,0 +1,26 @@
+--- project/build/java.mk.old  2011-06-25 13:50:54.074226602 -0500
++++ project/build/java.mk      2011-06-25 13:52:07.454837879 -0500
+@@ -2,7 +2,11 @@
+ # java of swig
+ #
++ifeq (${SWIG_OSNAME}, linux)
++JAVA_BUILD              = ${JAVA_DLL}
++else
+ JAVA_BUILD            = ${JAVA_DLL} ${JAVA_OBJ_DIR}/${JAVA_JAR} ${JAVA_EXAMPLES_CLASSES}
++endif
+ JAVA_BRIDGE           = ${JAVA_SRC_DIR}/CppInputStream.java
+ # delete the next line to enable the streams prototype for Java
+@@ -24,7 +28,11 @@
+ JAVA_DYNAMICLINK      = ${SWIG_LINK}
+ else
+ JAVA_CLASSPATH                = ${JAVA_OBJ_DIR}/${JAVA_JAR}
++ifeq (${SWIG_OSNAME}, linux)
++JAVA_DLL                = ${JAVA_OBJ_DIR}/librets.${DLL}
++else
+ JAVA_DLL              = ${JAVA_OBJ_DIR}/liblibrets.${DLL}
++endif
+ ifeq (${SWIG_OSNAME}, MSWin32)
+ JAVA_DLL              = ${JAVA_OBJ_DIR}/librets.${DLL}
+ endif
diff --git a/dev-libs/librets/files/perl.mk.patch b/dev-libs/librets/files/perl.mk.patch
new file mode 100644 (file)
index 0000000..7a2a75d
--- /dev/null
@@ -0,0 +1,29 @@
+Index: project/build/perl.mk
+===================================================================
+--- project/build/perl.mk      (revision 1513)
++++ project/build/perl.mk      (revision 1520)
+@@ -5,6 +5,7 @@
+ PERL_BUILD            = ${PERL_DLL}
+ PERL_CFLAGS           = `${top_srcdir}/librets-config-inplace --cflags`
++PERL_DLL_DIR          = ${PERL_OBJ_DIR}/blib/arch/auto/librets
+ PERL_LIB              = ${shell perl -e 'use Config; print $$Config{libperl};'}
+ PERL_INSTALL          = perl_install
+ PERL_LDFLAGS          = `${top_srcdir}/librets-config-inplace --libs`
+@@ -27,6 +28,8 @@
+ ifneq (${SWIG_OSNAME}, MSWin32)
++PERL_DLL              = ${PERL_DLL_DIR}/librets.so
++
+ ${PERL_OBJ_DIR}/${PERL_MAKEFILE_PL}: ${PERL_SRC_DIR}/${PERL_MAKEFILE_PL}
+       cp ${PERL_SRC_DIR}/${PERL_MAKEFILE_PL} ${PERL_OBJ_DIR}/${PERL_MAKEFILE_PL}
+       cp ${PERL_SRC_DIR}/${PERL_MANIFEST} ${PERL_OBJ_DIR}
+@@ -60,7 +63,6 @@
+                                 $$libdir=~s/\\/\//g;print $$libdir;'}/CORE
+ endif
+-PERL_DLL_DIR          = ${PERL_OBJ_DIR}/blib/arch/auto/librets
+ PERL_DLL              = ${PERL_DLL_DIR}/librets.${DLL}
+ PERL_INCLUDES         = ${PERL_LIB_DIR}
+ PERL_MAKEFILE_PL_MINGW        = Makefile.mingw
diff --git a/dev-libs/librets/files/python.mk.patch b/dev-libs/librets/files/python.mk.patch
new file mode 100644 (file)
index 0000000..82fa76a
--- /dev/null
@@ -0,0 +1,21 @@
+--- project/build/python.mk.old        2011-06-25 13:54:02.971786719 -0500
++++ project/build/python.mk    2011-06-25 13:54:40.032087701 -0500
+@@ -16,10 +16,17 @@
+       -outdir ${PYTHON_OBJ_DIR} ${SWIG_DIR}/librets.i
+ ifneq (${SWIG_OSNAME}, MSWin32)
++ifeq (${SWIG_OSNAME}, linux)
+ ${PYTHON_DLL}: ${PYTHON_WRAP} ${LIBRETS_LIB}
+       cd ${PYTHON_OBJ_DIR} ; \
+       CC="${CC}" CXX="${CXX}" CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" \
+-      ${PYTHON} setup.py build --build-lib=. 
++      ${PYTHON} setup.py build
++else
++${PYTHON_DLL}: ${PYTHON_WRAP} ${LIBRETS_LIB}
++      cd ${PYTHON_OBJ_DIR} ; \
++      CC="${CC}" CXX="${CXX}" CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" \
++      ${PYTHON} setup.py build --build-lib=.
++endif
+ else
+ PYTHON_CXX_FLAGS      = -mcygwin -mdll \
+                               `${SWIG_LIBRETS_CONFIG} --cflags`
diff --git a/dev-libs/librets/librets-1.5.2.ebuild b/dev-libs/librets/librets-1.5.2.ebuild
new file mode 100644 (file)
index 0000000..c5902f0
--- /dev/null
@@ -0,0 +1,189 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="3"
+
+PHP_EXT_OPTIONAL_USE="php"
+PHP_EXT_NAME="librets"
+PHP_EXT_SKIP_PHPIZE="yes"
+USE_PHP="php5-2 php5-3"
+
+PYTHON_DEPEND="python? 2"
+PYTHON_MODNAME="librets.py"
+
+LIBOPTIONS="-m755"
+
+inherit distutils eutils java-pkg-opt-2 perl-module php-ext-source-r2
+
+DESCRIPTION="A library that implements the RETS 1.7, RETS 1.5 and 1.0 standards"
+HOMEPAGE="http://www.crt.realtors.org/projects/rets/librets/"
+SRC_URI="http://www.crt.realtors.org/projects/rets/${PN}/files/${P}.tar.gz"
+
+LICENSE="BSD-NAR"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug doc java perl php python ruby sql-compiler threads"
+
+for i in java perl php python ruby; do
+       SWIG_DEPEND+=" ${i}? ( dev-lang/swig )"
+       SWIG_RDEPEND+=" ${i}? (
+               dev-libs/libgcrypt
+               dev-libs/libgpg-error
+               dev-libs/libtasn1
+               net-dns/libidn
+               net-libs/gnutls
+       )"
+done
+
+# Assuming this the proper way to depend on ruby interpreter when ruby is optional
+RDEPEND="
+       dev-libs/boost
+       dev-libs/expat
+       dev-util/boost-build
+       java? ( >=virtual/jdk-1.6.0 )
+       net-misc/curl
+       ruby? ( dev-lang/ruby:1.8 )
+       sql-compiler? ( dev-java/antlr:0[script] )
+       sys-libs/zlib
+       ${SWIG_RDEPEND}"
+
+DEPEND="${RDEPEND} ${SWIG_DEPEND}"
+
+unset SWIG_DEPEND
+unset SWIG_RDEPEND
+unset i
+
+_php-move_swig_build_to_modules_dir() {
+       mkdir "${1}"/modules || die "Could not create directory for php slot"
+       mv build/swig/php5/* "${1}"/modules || die "Could not move php slot build"
+}
+
+pkg_setup() {
+       use java && java-pkg-opt-2_pkg_setup
+       use perl && perl-module_pkg_setup
+       if use python; then
+               python_set_active_version 2
+               python_pkg_setup
+       fi
+}
+
+src_prepare() {
+       use php && php-ext-source-r2_src_prepare
+       #Patch upstream patch to allow perl to be built in the compile stage
+       use perl && epatch "${FILESDIR}"/perl.mk.patch
+       #Patch to fix java errors and allow compilation
+       use java && epatch "${FILESDIR}"/java.mk.patch
+       #Patch to stop python from building the extension again during install
+       use python && epatch "${FILESDIR}"/python.mk.patch
+}
+
+src_configure() {
+       local myconf
+       local myphpprefix
+
+       use java || myconf="--disable-java"
+       use perl || myconf="${myconf} --disable-perl"
+       if use php; then
+               # Enable php extension when it finds the current selected slot
+               myphpprefix="${PHPPREFIX}/include"
+       else
+               myconf="${myconf} --disable-php"
+       fi
+       use python || myconf="${myconf} --disable-python"
+       use ruby || myconf="${myconf} --disable-ruby"
+
+       if use doc; then
+               myconf="${myconf} --enable-maintainer-documentation"
+       fi
+
+       econf \
+               --enable-shared_dependencies \
+               --enable-depends \
+               --enable-default-search-path="/usr /opt ${myphpprefix}" \
+               --disable-examples \
+               $(use_enable debug) \
+               $(use_enable sql-compiler) \
+               $(use_enable threads thread-safe) \
+               ${myconf} || die
+}
+
+src_compile() {
+       emake || die "emake failed"
+       if use php; then
+               local slot myphpconfig="php-config" myphpselectedslot="php${PHP_CURRENTSLOT}"
+               #Move the current slotted build of php to another dir so other slots can be built
+               _php-move_swig_build_to_modules_dir "${WORKDIR}/${myphpselectedslot}"
+               for slot in $(php_get_slots); do
+                       # Don't build the selected slot since the build system already built it
+                       [[ "${slot}" != "${myphpselectedslot}" ]] || continue;
+                       php_init_slot_env ${slot}
+                       cd "${S}" || die "cannot change to source directory"
+                       # Replace the reference to php-config with the current slotted one
+                       sed -i -e "s|${myphpconfig}|${PHPCONFIG}|g" project/build/php.mk || die "sed php-config change failed"
+                       myphpconfig="${PHPCONFIG}"
+                       # Build the current slotted
+                       emake build/swig/php5/${PN}.so || die "Unable to make php${slot} extension"
+                       _php-move_swig_build_to_modules_dir ${PHP_EXT_S}
+               done
+       fi
+}
+
+src_install() {
+       dolib.a build/${PN}/lib/${PN}.a || die
+
+       insinto /usr/include
+       doins -r project/${PN}/include/${PN} || die
+
+       dobin "${PN}-config" || die
+
+       if use php; then
+               php-ext-source-r2_src_install
+               insinto /usr/share/php
+               doins "${WORKDIR}"/php"${PHP_CURRENTSLOT}"/modules/${PN}.php || die
+       fi
+
+       if use perl; then
+               #Install manually since the package install has sandbox violations
+               insinto ${SITE_ARCH}
+               insopts "-m755"
+               doins -r "${S}"/build/swig/perl/blib/arch/auto || die
+               insopts "-m644"
+               doins "${S}"/build/swig/perl/${PN}.pm || die
+       fi
+
+       if use java; then
+               java-pkg_dojar "${S}"/build/swig/java/${PN}.jar || die
+               java-pkg_doso "${S}"/build/swig/java/${PN}.so  || die
+       fi
+
+       if use ruby; then
+               insinto /usr/lib64/ruby/site_ruby/1.8/x86_64-linux
+               doexe "${S}"/build/swig/ruby/librets_native.so || die
+               insinto /usr/lib64/ruby/site_ruby/1.8
+               doins "${S}"/build/swig/ruby/librets.rb || die
+       fi
+
+       if use python; then
+               cd "${S}"/build/swig/python || die
+               distutils_src_install
+       fi
+}
+
+pkg_preinst() {
+       use perl && perl-module_pkg_preinst
+}
+
+pkg_postinst() {
+       use python && distutils_pkg_postinst
+       use perl && perl-module_pkg_postinst
+}
+
+pkg_prerm() {
+       use perl && perl-module_pkg_prerm
+}
+
+pkg_postrm() {
+       use python && distutils_pkg_postrm
+       use perl && perl-module_pkg_postrm
+}
diff --git a/dev-libs/librets/metadata.xml b/dev-libs/librets/metadata.xml
new file mode 100644 (file)
index 0000000..61262e9
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <herd>no-herd</herd>
+  <maintainer><email>maintainer-wanted@gentoo.org</email></maintainer>
+  <use>
+    <flag name="debug">Enable debug compile type</flag>
+    <flag name="doc">Add maintainer documentation</flag>
+    <flag name="java">Install java libraries</flag>
+    <flag name="perl">Install perl library extension</flag>
+    <flag name="php">Install php library extension</flag>
+    <flag name="python">Install python library extension</flag>
+    <flag name="ruby">Install ruby library extension</flag>
+    <flag name="sql-compiler">Enable SQL to DMQL compiler for java libraries</flag>
+    <flag name="threads">Enable thread safe support</flag>
+  </use>
+</pkgmetadata>