Skip to content

Commit

Permalink
media-gfx/povray: Fix build system, add AX_BOOST_SYSTEM
Browse files Browse the repository at this point in the history
Gentoo-Bug: 550018
* EAPI=6
* Switch back to autoconf-archive macros, scrap boost.m4
* Fix underlinking caused by recent boost versions
  requiring linking to boost::system

Package-Manager: portage-2.2.28
  • Loading branch information
SoapGentoo committed Apr 3, 2016
1 parent b340d49 commit d0c6bb1
Show file tree
Hide file tree
Showing 2 changed files with 250 additions and 0 deletions.
108 changes: 108 additions & 0 deletions media-gfx/povray/files/povray-3.7.0.0-r1-boost-1.50.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
Remove bundled m4 macros, instead use system ones from
sys-devel/autoconf-archive. Use AX_BOOST_SYSTEM to prevent
underlinking issues with more recent boost versions.
See also: https://bugs.gentoo.org/show_bug.cgi?id=550018

--- povray-3.7.0.0/unix/configure.ac
+++ povray-3.7.0.0/unix/configure.ac
@@ -54,23 +54,7 @@
AC_CONFIG_SRCDIR([unix/disp_text.cpp])

# Additional autoconf macros.
-m4_include([unix/config/acx_pthread.m4])
-m4_include([unix/config/ax_arg_enable.m4])
-m4_include([unix/config/ax_arg_with.m4])
-m4_include([unix/config/ax_boost_base.m4])
-m4_include([unix/config/ax_boost_thread.m4])
-m4_include([unix/config/ax_test_compiler_flags.m4])
-m4_include([unix/config/ax_check_lib.m4])
-m4_include([unix/config/ax_check_libjpeg.m4])
-m4_include([unix/config/ax_check_libsdl.m4])
-m4_include([unix/config/ax_check_libtiff.m4])
-m4_include([unix/config/ax_check_openexr.m4])
-m4_include([unix/config/ax_compare_version.m4])
-m4_include([unix/config/ax_compiler_vendor.m4])
-m4_include([unix/config/ax_compiler_version.m4])
-m4_include([unix/config/ax_fix_incorrect_path.m4])
-m4_include([unix/config/ax_prog_ld_static.m4])
-m4_include([unix/config/ax_x86_arch.m4])
+AC_CONFIG_MACRO_DIR([unix/config])

# Required versions of the support libraries.
# Must be declared after AC_INIT.
@@ -166,7 +150,7 @@
AC_CANONICAL_BUILD
AC_CANONICAL_HOST

-AM_INIT_AUTOMAKE([1.9 dist-bzip2])
+AM_INIT_AUTOMAKE([1.9 dist-bzip2 subdir-objects])
AM_MAINTAINER_MODE

AX_FIX_INCORRECT_PATH(C_INCLUDE_PATH, ".", [pov_warn_path="$pov_warn_path C_INCLUDE_PATH"])
@@ -184,6 +168,7 @@
CFLAGS="$CFLAGS"
AC_PROG_CC
AC_PROG_CPP
+AM_PROG_AR

# Force checking essential (ANSI-compliant) headers.
AC_CHECK_HEADERS([stdlib.h])
@@ -292,13 +277,14 @@
fi

# Posix threads
-ACX_PTHREAD
+AX_PTHREAD
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" # append
LIBS="$LIBS $PTHREAD_CFLAGS $PTHREAD_LIBS" # append

# Boost; required library
# the following macro stops with error when boost is not found
AX_BOOST_BASE([$required_libboost_version])
+AX_BOOST_SYSTEM
AX_BOOST_THREAD
if test x"$ax_cv_boost_thread" != x"yes"; then
AC_MSG_ERROR([cannot find a suitable boost thread library])
@@ -307,19 +293,6 @@
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" # append
LIBS="$BOOST_THREAD_LIB $LIBS"
fi
-AC_MSG_CHECKING([whether the boost thread library is usable])
-AC_RUN_IFELSE(
- [AC_LANG_PROGRAM([[
-#include <boost/thread/thread.hpp>
- ]],
- [[boost::defer_lock_t(); return 0;]])],
- [AC_MSG_RESULT([yes])],
- [
- AC_MSG_RESULT([no])
- AC_MSG_FAILURE([cannot link with the boost thread library])
- ],
- [AC_MSG_RESULT([cross-compiling])] # FIXME
-)
AC_DEFINE([USE_OFFICIAL_BOOST], [], [Use the official Boost libraries.])

# Intel Math Kernel library
--- povray-3.7.0.0/unix/prebuild.sh
+++ povray-3.7.0.0/unix/prebuild.sh
@@ -439,7 +439,8 @@
# Beware: order does matter!
LDADD = \\
\$(top_builddir)/vfe/libvfe.a \\
- \$(top_builddir)/source/libpovray.a
+ \$(top_builddir)/source/libpovray.a \\
+ @BOOST_SYSTEM_LIB@
pbEOF
;;
esac
--- povray-3.7.0.0/vfe/unix/platformbase.cpp
+++ povray-3.7.0.0/vfe/unix/platformbase.cpp
@@ -68,7 +68,7 @@
#else
// taken from source/base/timer.cpp
boost::xtime t;
- boost::xtime_get(&t, boost::TIME_UTC);
+ boost::xtime_get(&t, POV_TIME_UTC);
POV_ULONG ns = (POV_ULONG)(t.sec) * (POV_ULONG)(1000000000) + (POV_ULONG)(t.nsec) + (POV_ULONG)(msec) * (POV_ULONG)(1000000);
t.sec = (boost::xtime::xtime_sec_t)(ns / (POV_ULONG)(1000000000));
t.nsec = (boost::xtime::xtime_nsec_t)(ns % (POV_ULONG)(1000000000));
142 changes: 142 additions & 0 deletions media-gfx/povray/povray-3.7.0.0-r1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6

inherit autotools flag-o-matic versionator virtualx

POVRAY_MAJOR_VER=$(get_version_component_range 1-3)
POVRAY_MINOR_VER=$(get_version_component_range 4)
if [ -n "$POVRAY_MINOR_VER" ]; then
POVRAY_MINOR_VER=${POVRAY_MINOR_VER/rc/RC}
MY_PV="${POVRAY_MAJOR_VER}.${POVRAY_MINOR_VER}"
else
MY_PV=${POVRAY_MAJOR_VER}
fi

DESCRIPTION="The Persistence of Vision Raytracer"
HOMEPAGE="http://www.povray.org/"
SRC_URI="https://github.com/POV-Ray/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="AGPL-3"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
IUSE="debug +io-restrictions openexr static-libs tiff X"

DEPEND="
>=dev-libs/boost-1.50.0:=[threads(+)]
media-libs/libpng:0
sys-libs/zlib
virtual/jpeg:0
openexr? (
media-libs/ilmbase
media-libs/openexr )
tiff? ( media-libs/tiff:0 )
X? ( media-libs/libsdl )"
RDEPEND="${DEPEND}"
DEPEND="${DEPEND}
sys-devel/autoconf-archive"

S=${WORKDIR}/${PN}-${MY_PV}

PATCHES=(
"${FILESDIR}"/${P}-user-conf.patch
"${FILESDIR}"/${P}-automagic.patch
)

src_prepare() {
[[ ${CHOST} == *-darwin* ]] && \
PATCHES+=( "${FILESDIR}"/${PN}-3.7.0_rc6-darwin-defaults.patch )
eapply "${FILESDIR}"/${PF}-boost-1.50.patch

pushd unix
pushd config
rm -rf \
acx_pthread.m4 \
ax_boost_base.m4 \
ax_boost_thread.m4 \
ax_compare_version.m4 \
ax_compiler_vendor.m4 \
ax_compiler_version.m4 || die
popd
bash -x prebuild.sh || die
popd

rm -rf libraries || die

# Change some destination directories that cannot be adjusted via configure
sed \
-e 's:${povsysconfdir}/$PACKAGE/$VERSION_BASE:${povsysconfdir}/'${PN}':g' \
-e 's:${povdatadir}/$PACKAGE-$VERSION_BASE:${povdatadir}/'${PN}':g' \
-e 's:${povdatadir}/doc/$PACKAGE-$VERSION_BASE:${povdatadir}/doc/'${PF}':g' \
-e 's:BOOST_THREAD_LIBS $LIBS:BOOST_THREAD_LIBS $LIBS -lboost_date_time:g' \
-i configure.ac || die

sed \
-e "s:^povlibdir = .*:povlibdir = @datadir@/${PN}:" \
-e "s:^povdocdir = .*:povdocdir = @datadir@/doc/${PF}:" \
-e "s:^povconfdir = .*:povconfdir = @sysconfdir@/${PN}:" \
-e 's:mkdir_p:MKDIR_P:g' \
-i Makefile.am || die

# The "+p" option on the test command line causes a pause and
# prompts the user to interact, so remove it.
sed -i -e "s:biscuit.pov -f +d +p:biscuit.pov -f +d:" Makefile.am || die
default

eautoreconf
}

src_configure() {
# Fixes bug 71255
if [[ $(get-flag march) == k6-2 ]]; then
filter-flags -fomit-frame-pointer
fi

# The config files are installed correctly (e.g. povray.conf),
# but the code compiles using incorrect [default] paths
# (based on /usr/local...), so povray will not find the system
# config files without the following fix:
append-cppflags -DPOVLIBDIR=\\\"${EROOT}usr/share/${PN}\\\" -DPOVCONFDIR=\\\"${EROOT}etc/${PN}\\\"

econf \
COMPILED_BY="Portage (Gentoo $(uname)) on $(hostname -f)" \
$(use_enable debug) \
$(use_enable io-restrictions) \
$(use_with openexr openexr "${EPREFIX}/usr/$(get_libdir)") \
$(use_with tiff libtiff "${EPREFIX}/usr/$(get_libdir)") \
$(use_with X libsdl "${EPREFIX}/usr/$(get_libdir)") \
$(use_with X x "${EPREFIX}/usr/$(get_libdir)") \
$(use_enable static-libs static) \
$(usex tiff "" "NON_REDISTRIBUTABLE_BUILD=yes") \
--without-libmkl \
--disable-pipe \
--disable-strip \
--disable-optimiz \
--disable-optimiz-arch
}

src_test() {
# For the beta releases, we generate a license extension in case needed
VIRTUALX_COMMAND="autotools-utils_src_test"
virtualmake
}

pkg_preinst() {
# Copy the old config files if they are in the old location
# but do not yet exist in the new location.
# This way, they can be treated by CONFIG_PROTECT as normal.
local conf_file version_dir
for conf_file in "${ED}"/etc/"${PN}"/*; do
if [ ! -e "${EROOT}etc/${PN}/${conf_file}" ]; then
for version_dir in $(echo "${EROOT}"etc/"${PN}"/* | grep "^[0-9]" | sort -rn); do
if [ -e "${EROOT}etc/${PN}/${version_dir}/${conf_file}" ]; then
mv "${EROOT}etc/${PN}/${version_dir}/${conf_file}" "${EROOT}etc/${PN}" || die
elog "Note: ${conf_file} moved from ${EROOT}etc/povray/${version_dir}/ to ${EROOT}etc/povray/"
break
fi
done
fi
done
}

0 comments on commit d0c6bb1

Please sign in to comment.