--- /dev/null
+--- librets-1.5.3/project/build/java.mk
++++ librets-1.5.3/project/build/java.mk
+@@ -46,7 +46,7 @@
+ ${JAVA_DYNAMICLINK} -o ${JAVA_DLL} ${JAVA_OBJ_DIR}/librets_wrap.o ${SWIG_LIBRETS_LIBS} ${SWIG_BRIDGE_OBJ}
+
+ ${JAVA_OBJ_DIR}/librets_wrap.o: ${JAVA_OBJ_DIR}/librets_wrap.cpp
+- ${CXX} ${JAVA_CXX_FLAGS} -I${LIBRETS_INC_DIR} -I${SWIG_DIR} ${BOOST_CFLAGS} ${JAVA_INCLUDES} -c $< -o $@
++ ${CXX} ${CXXFLAGS} ${JAVA_CXX_FLAGS} -I${LIBRETS_INC_DIR} -I${SWIG_DIR} ${BOOST_CFLAGS} ${JAVA_INCLUDES} -c $< -o $@
+
+
+ ifneq (${SWIG_OSNAME}, MSWin32)
+--- librets-1.5.3/project/build/rules.mk
++++ librets-1.5.3/project/build/rules.mk
+@@ -3,7 +3,7 @@
+ SRC_TGZ = librets-$(VERSION).tar.gz
+ SRC_ZIP = librets-$(VERSION).zip
+
+-CFLAGS += $(TARGET_CFLAGS) -DLIBRETS_VERSION='"$(VERSION)"'
++CPPFLAGS += $(TARGET_CFLAGS) -DLIBRETS_VERSION='"$(VERSION)"'
+
+ LIBRETS_LDFLAGS = $(BOOST_LIBS) $(BOOST_FILESYSTEM) $(BOOST_SYSTEM) \
+ $(BOOST_THREAD) $(CURL_LDFLAGS) $(EXPAT_LDFLAGS) $(ANTLR_LDFLAGS)
+--- librets-1.5.3/project/build/swig.mk
++++ librets-1.5.3/project/build/swig.mk
+@@ -13,13 +13,13 @@
+ SWIG_OBJ_DIR = ${BUILD}/swig
+ SWIG_OSNAME = $(shell perl -e 'use Config; print $$Config{osname};')
+
+-SWIG_BRIDGE_CFLAGS = `${SWIG_LIBRETS_CONFIG} --cflags` ${CFLAGS}
++SWIG_BRIDGE_CFLAGS = `${SWIG_LIBRETS_CONFIG} --cflags` ${CXXFLAGS}
+ SWIG_BRIDGE_H = ${SWIG_DIR}/librets_bridge.h
+ SWIG_BRIDGE_SRC = ${SWIG_DIR}/librets_bridge.cpp
+ SWIG_BRIDGE_OBJ = ${SWIG_OBJ_DIR}/librets_bridge.o
+
+ DLL = so
+-SWIG_LINK = ${CXX} -shared
++SWIG_LINK = ${CXX} ${LDFLAGS} -shared
+
+ ifeq (${SWIG_OSNAME}, darwin)
+ SWIG_LINK = ${CXX} -bundle -undefined suppress -flat_namespace
+--- librets-1.5.3/project/build/sources.mk
++++ librets-1.5.3/project/build/sources.mk
+@@ -37,7 +37,7 @@
+ LookupTreeParser.cpp LookupColumnsTreeParser.cpp)
+ LIBRETS_ANTLR_OBJECTS := $(LIBRETS_ANTLR_SRC_FILES:.cpp=.o)
+ LIBRETS_ANTLR_DEPENDS := $(LIBRETS_ANTLR_SRC_FILES:.cpp=.d)
+-LIBRETS_ANTLR_CFLAGS = $(CFLAGS) $(CPPFLAGS) $(BOOST_CFLAGS) $(ARCH_CFLAGS)
++LIBRETS_ANTLR_CFLAGS = $(CXXFLAGS) $(CPPFLAGS) $(BOOST_CFLAGS) $(ARCH_CFLAGS)
+
+ ANTLR_FLAGS = -o $(LIBRETS_ANTLR_SRC_DIR)
+ ANTLR_TREE_FLAGS = $(ANTLR_FLAGS) -glib $(LIBRETS_ANTLR_PARSER)
+@@ -68,7 +68,7 @@
+
+ #####
+
+-LIBRETS_CFLAGS = $(CFLAGS) $(CPPFLAGS) $(CURL_CFLAGS) $(EXPAT_CFLAGS) \
++LIBRETS_CFLAGS = $(CXXFLAGS) $(CPPFLAGS) $(CURL_CFLAGS) $(EXPAT_CFLAGS) \
+ ${LIBRETS_THREAD_FLAGS} $(BOOST_CFLAGS) -I$(LIBRETS_INC_DIR)
+
+ ifeq ($(USE_SQL_COMPILER),1)
+--- librets-1.5.3/configure.ac
++++ librets-1.5.3/configure.ac
+@@ -158,6 +158,7 @@
+
+ if test "$my_use_pic" = "yes"; then
+ CFLAGS="$CFLAGS -fPIC"
++ CXXFLAGS="$CXXFLAGS -fPIC"
+ LIBRETS_CFLAGS="$LIBRETS_CFLAGS -fPIC"
+ fi
+
+--- librets-1.5.3/Makefile.in
++++ librets-1.5.3/Makefile.in
+@@ -23,6 +23,7 @@
+ CC=@CC@
+ CXX=@CXX@
+ CFLAGS=@CFLAGS@ @DEFS@
++CXXFLAGS=@CXXFLAGS@ @DEFS@
+ CPPFLAGS=@CPPFLAGS@
+ LIBS=@LIBS@
+ LDFLAGS=@LDFLAGS@
+--- librets-1.5.3/project/build/php.mk
++++ librets-1.5.3/project/build/php.mk
+@@ -21,5 +21,5 @@
+ ${SWIG_LINK} -o ${PHP_DLL} ${PHP_OBJ_DIR}/librets_wrap.o ${SWIG_LIBRETS_LIBS} ${SWIG_BRIDGE_OBJ}
+
+ ${PHP_OBJ_DIR}/librets_wrap.o: ${PHP_OBJ_DIR}/librets_wrap.cpp
+- ${CXX} ${PHP_CXX_FLAGS} -g -DLIBRETS_VERSION='"$(VERSION)"' -I${LIBRETS_INC_DIR} -I${PHP_SRC_DIR} \
++ ${CXX} ${CXXFLAGS} ${PHP_CXX_FLAGS} -DLIBRETS_VERSION='"$(VERSION)"' -I${LIBRETS_INC_DIR} -I${PHP_SRC_DIR} \
+ -I${SWIG_DIR} ${BOOST_CFLAGS} ${PHP_INCLUDES} -c $< -o $@
+--- librets-1.5.3/project/build/dotnet.mk
++++ librets-1.5.3/project/build/dotnet.mk
+@@ -83,10 +83,10 @@
+ ${SWIG_LINK} -o ${DOTNET_UNMANAGED_DLL} ${DOTNET_UNMANAGED_OBJ} ${SWIG_LIBRETS_LIBS}
+
+ ${DOTNET_OBJ_DIR}/%.o: ${DOTNET_OBJ_DIR}/%.cpp
+- ${CXX} ${DOTNET_CXX_FLAGS} -I${LIBRETS_INC_DIR} -I${DOTNET_OBJ_DIR} -I${DOTNET_DIR} -I${SWIG_DIR} -c $< -o $@
++ ${CXX} ${CXXFLAGS} ${DOTNET_CXX_FLAGS} -I${LIBRETS_INC_DIR} -I${DOTNET_OBJ_DIR} -I${DOTNET_DIR} -I${SWIG_DIR} -c $< -o $@
+
+ ${DOTNET_OBJ_DIR}/%.o: ${DOTNET_DIR}/%.cpp
+- ${CXX} ${DOTNET_CXX_FLAGS} -I${LIBRETS_INC_DIR} -I${DOTNET_OBJ_DIR} -I${DOTNET_DIR} -I${SWIG_DIR} -c $< -o $@
++ ${CXX} ${CXXFLAGS} ${DOTNET_CXX_FLAGS} -I${LIBRETS_INC_DIR} -I${DOTNET_OBJ_DIR} -I${DOTNET_DIR} -I${SWIG_DIR} -c $< -o $@
+
+ ifneq (${SWIG_OSNAME}, MSWin32)
+ ########
\ No newline at end of file
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
-EAPI="4"
+EAPI="5"
PHP_EXT_OPTIONAL_USE="php"
PHP_EXT_NAME="librets"
PHP_EXT_SKIP_PHPIZE="yes"
-# Will add php5-4 support as soon as someone fixes gentoo bug 404453
+# Will add php5-4 support as soon as someone fixes gentoo bug 404453 with swig 2.0.4
+# or upstream fixes the build error with swig >= 2.0.8
USE_PHP="php5-3"
-PYTHON_DEPEND="python? 2"
-PYTHON_MODNAME="librets.py"
+PYTHON_COMPAT=( python2_{6,7} )
USE_RUBY="ree18 ruby18 ruby19"
RUBY_OPTIONAL="yes"
-inherit autotools distutils eutils java-pkg-opt-2 mono multilib perl-module php-ext-source-r2 ruby-ng versionator
+inherit autotools eutils java-pkg-opt-2 mono perl-module php-ext-source-r2 python-r1 ruby-ng toolchain-funcs versionator
DESCRIPTION="A library that implements the RETS 1.8, 1.7, 1.5 and 1.0 standards"
HOMEPAGE="http://www.crt.realtors.org/projects/rets/librets/"
LICENSE="BSD-NAR"
SLOT="0"
KEYWORDS="~amd64 ~x86"
-IUSE="debug doc java mono perl php python ruby sql-compiler threads"
+IUSE="doc java mono perl php python ruby sql-compiler threads"
# Enabling threads for perl, php, python or ruby causes segmentation faults in cli scripts but not through apache
REQUIRED_USE="perl? ( !threads )
php? ( !threads )
python? ( !threads )
ruby? ( !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
-
-RDEPEND="
- >=dev-libs/boost-1.46
+SWIG_RDEPEND="dev-libs/libgcrypt
+ dev-libs/libgpg-error
+ dev-libs/libtasn1
+ net-dns/libidn
+ net-libs/gnutls"
+
+RDEPEND=">=dev-libs/boost-1.46
dev-libs/expat
>=dev-util/boost-build-1.46
- java? ( >=virtual/jdk-1.6.0 )
- mono? ( dev-lang/mono )
net-misc/curl
- ruby? ( $(ruby_implementations_depend) )
sql-compiler? ( dev-java/antlr:0[script] )
sys-libs/zlib
- ${SWIG_RDEPEND}"
+ java? ( >=virtual/jdk-1.6.0 ${SWIG_RDEPEND} )
+ mono? ( dev-lang/mono ${SWIG_RDEPEND} )
+ php? ( ${SWIG_RDEPEND} )
+ python? ( ${SWIG_RDEPEND} )
+ ruby? ( $(ruby_implementations_depend) ${SWIG_RDEPEND} )"
+
+# An upstream bug prevents the php extension from building with swig >= 2.0.5
+DEPEND="java? ( >=dev-lang/swig-1.3.40-r1 )
+ mono? ( >=dev-lang/swig-1.3.40-r1 )
+ php? ( <dev-lang/swig-2.0.5 >=dev-lang/swig-1.3.40-r1 )
+ python? ( >=dev-lang/swig-1.3.40-r1 )
+ ruby_targets_ruby18? ( >=dev-lang/swig-1.3.40-r1 )
+ ruby_targets_ruby18? ( >=dev-lang/swig-1.3.40-r1 )
+ ruby_targets_ruby19? ( >=dev-lang/swig-2.0.4-r1 )
+ ${RDEPEND}"
-DEPEND="${RDEPEND} ${SWIG_DEPEND}"
# Reset to the default $S since ruby-ng overrides it
S="${WORKDIR}/${P}"
-unset SWIG_DEPEND
unset SWIG_RDEPEND
-unset i
# Since php-ext-source-r2_src_install tries to install non-existant headers
# and a bad emake fails on EAPI 4, a copied subset must be used instead (bug 404307).
-_php-ext-source-r2_src_install() {
+my_php-ext-source-r2_src_install() {
local slot
for slot in $(php_get_slots); do
php_init_slot_env ${slot}
php-ext-source-r2_createinifiles
}
-_php-move_swig_build_to_modules_dir() {
+my_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"
}
-_php-replace_config_with_selected_config() {
+my_php-replace_config_with_selected_config() {
php_init_slot_env ${1}
cd "${S}" || die "cannot change to source directory"
# Replace the reference to php-config with the current slotted one
sed -i -e "s|${2}|${PHPCONFIG}|g" project/build/php.mk || die "sed php-config change failed"
}
-_ruby-move_swig_build_to_impl_dir() {
+my_ruby-move_swig_build_to_impl_dir() {
mkdir -p "${1}"/${P} || die "Could not create directory for ruby implementation"
mv build/swig/ruby/* "${1}"/${P} || die "Could not move ruby implementation 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
use ruby && ruby-ng_pkg_setup
}
}
src_prepare() {
- # Patch to fix compilation errors by removing the java exmaples target when building for java
- epatch "${FILESDIR}"/java.mk.patch
# Patch to allow the ruby extension to compile when multiple versions of boost are installed
- epatch "${FILESDIR}"/extconf.rb.patch
- local myboostpackage=$(best_version ">=dev-libs/boost-1.46")
- local myboostpackagever=${myboostpackage/*boost-/}
- local myboostver=$(get_version_component_range 1-2 ${myboostpackagever})
- local myboostslot=$(replace_version_separator 1 _ ${myboostver})
- sed -i -e "s|boost_include_dir=\"include\"|boost_include_dir=\"include/boost-${myboostslot}\"|g" project/build/ac-macros/boost.m4 || die
- sed -i -e "s|/lib/libboost|/lib/boost-${myboostslot}/libboost|g" project/build/ac-macros/boost.m4 || die
- sed -i -e "s|-L\${BOOST_PREFIX}/lib|-L\${BOOST_PREFIX}/lib/boost-${myboostslot}|g" project/build/ac-macros/boost.m4 || die
- einfo "Using boost version ${myboostver}"
+ epatch "${FILESDIR}"/${P}-extconf.rb.patch
+ # Patch to fix compilation errors by removing the java examples target when building for java
+ epatch "${FILESDIR}"/${P}-java.mk.patch
+ # add missing LDFLAGS and change CFLAGS to CXXFLAGS
+ epatch "${FILESDIR}"/${P}-build.patch
eautoreconf
+
+ # Change the path to librets-config-inplace for python slotted build support
+ if use python; then
+ sed -i -e "s|../../..|${S}|" project/swig/python/setup.py || die
+ fi
+
use php && php-ext-source-r2_src_prepare
}
src_configure() {
- local myconf
local myphpprefix
- use java || myconf="--disable-java"
- use mono || myconf="${myconf} --disable-dotnet"
- 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"
-
- if use doc; then
- myconf="${myconf} --enable-maintainer-documentation"
fi
- use threads && myconf="${myconf} --enable-thread-safe"
+ # The build system just finds "python", which could be python3.2 if EPYTHON is unset.
+ use python && python_export_best EPYTHON
if use ruby; then
MYRUBYIMPLS=($(ruby_get_use_implementations))
# Set RUBY value in config to the first ruby implementation to build
RUBY=$(ruby_implementation_command ${MYRUBYFIRSTIMPL})
MYRUBYIMPLS=(${MYRUBYIMPLS[@]:1})
- myconf="${myconf} RUBY=${RUBY}"
- else
- myconf="${myconf} --disable-ruby"
fi
+ # Allow cross-compiling between operating systems since ar is not portable
+ tc-export AR
econf \
--enable-shared_dependencies \
--enable-depends \
--enable-default-search-path="/usr /opt ${myphpprefix}" \
--disable-examples \
- $(use_enable debug) \
+ --disable-debug \
+ $(usex doc "--enable-maintainer-documentation") \
+ $(usex java "" "--disable-java") \
+ $(usex mono "" "--disable-dotnet") \
+ $(usex perl "" "--disable-perl") \
+ $(usex php "" "--disable-php") \
+ $(usex python "" "--disable-python") \
+ $(usex threads "--enable-thread-safe") \
$(use_enable sql-compiler) \
$(use_with mono "snk-file" "${FILESDIR}"/${PN}.snk) \
- ${myconf}
+ $(usex ruby " RUBY=${RUBY}" "--disable-ruby")
}
src_compile() {
local slot myphpconfig="php-config"
# Shift off the first slot so it doesn't get built again
local myphpslots=($(php_get_slots)) myphpfirstslot="${myphpslots[@]:0:1}" myphpslots=(${myphpslots[@]:1})
- _php-replace_config_with_selected_config ${myphpfirstslot} ${myphpconfig}
+ my_php-replace_config_with_selected_config ${myphpfirstslot} ${myphpconfig}
myphpconfig="${PHPCONFIG}"
fi
emake
if use php; then
# Move the current slotted build of php to another dir so other slots can be built
- _php-move_swig_build_to_modules_dir "${WORKDIR}/${myphpfirstslot}"
+ my_php-move_swig_build_to_modules_dir "${WORKDIR}/${myphpfirstslot}"
# Build the remaining slots
for slot in ${myphpslots[@]}; do
- _php-replace_config_with_selected_config ${slot} ${myphpconfig}
+ my_php-replace_config_with_selected_config ${slot} ${myphpconfig}
myphpconfig="${PHPCONFIG}"
# Build the current slot
emake build/swig/php5/${PN}.so
- _php-move_swig_build_to_modules_dir ${PHP_EXT_S}
+ my_php-move_swig_build_to_modules_dir "${PHP_EXT_S}"
done
fi
+
+ # Build the remaining python implementations
+ use python && python_foreach_impl emake
+
if use ruby; then
# Move the current implementation build of ruby to another dir so other implementations can be built
- _ruby-move_swig_build_to_impl_dir "${WORKDIR}/${MYRUBYFIRSTIMPL}"
+ my_ruby-move_swig_build_to_impl_dir "${WORKDIR}/${MYRUBYFIRSTIMPL}"
unset MYFIRSTRUBYIMPL
unset RUBY
local impl
MYRUBYIMPL="$(ruby_implementation_command ${impl})"
# Build the current implementation
emake build/swig/ruby/${PN}_native.bundle
- _ruby-move_swig_build_to_impl_dir "${WORKDIR}/${impl}"
+ my_ruby-move_swig_build_to_impl_dir "${WORKDIR}/${impl}"
done
+ unset MYRUBYIMPL
unset MYRUBYIMPLS
+ unset impl
fi
}
dobin "${PN}-config"
if use php; then
- _php-ext-source-r2_src_install
+ my_php-ext-source-r2_src_install
insinto /usr/share/php
doins "${WORKDIR}"/php"${PHP_CURRENTSLOT}"/modules/${PN}.php
fi
fi
if use python; then
- cd "${S}"/build/swig/python || die
- distutils_src_install
+ python_install() {
+ pushd "${S}"/build/swig/python || die
+ "${PYTHON}" setup.py install --root="${D}" || die
+ popd
+ }
+ python_foreach_impl python_install
fi
}
}
pkg_postinst() {
- use python && distutils_pkg_postinst
use perl && perl-module_pkg_postinst
}
}
pkg_postrm() {
- use python && distutils_pkg_postrm
use perl && perl-module_pkg_postrm
}