Skip to content

Commit

Permalink
media-gfx/yafaray: Create 3.3.0 ebuild.
Browse files Browse the repository at this point in the history
Closes: https://bugs.gentoo.org/639046
Closes: gentoo#7530
Package-Manager: Portage-2.3.24, Repoman-2.3.6
  • Loading branch information
ObserverHerb authored and mgorny committed May 29, 2018
1 parent fa1379f commit 11bd409
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 0 deletions.
2 changes: 2 additions & 0 deletions media-gfx/yafaray/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DIST yafaray-blender-exporter-3.3.0.tar.gz 377928 BLAKE2B 7876c78ca6228282648909e566803b33304be0082fab48819340845e3927877b9734f7bc7e09702bf7cbf6477c68932637eb766dc98b9e8e4ab42ca99d2a3595 SHA512 70a1a806d97f6f3b43cdb5d6caac6104f0f63720d5920f6a623078e05e6977d065d2fabca4da1644deb97f09176b88347f0278e4bc699c783d807d3f530421d0
DIST yafaray-core-3.3.0.tar.gz 1135360 BLAKE2B 67f6956a3866bfe0b4167f30a7c2c7f05ee23556e9fff7041ff3937e90011e4c2538b706ae27e02351ae555d0d05531f3eb711257591d85f779683c9c42ac6f7 SHA512 32efb87872485c4a188483ae1172cac2eca2281e7b9ab29f184c047b94f3986d65da199a74c169d0e2fd6af59cf37b7deb69dcfb1cb4763bb1ebca30d46b5b90
15 changes: 15 additions & 0 deletions media-gfx/yafaray/files/yafaray-3.3.0-blender-exporter-paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/work/Blender-Exporter-3.3.0/__init__.py b/work/Blender-Exporter-3.3.0/__init__.py
index 85dc1c2..70a79e8 100644
--- a/__init__.py
+++ b/__init__.py
@@ -22,8 +22,8 @@ import sys
import os
import ctypes

-PLUGIN_PATH = os.path.join(__path__[0], 'bin', 'yafaray-plugins')
-BIN_PATH = os.path.join(__path__[0], 'bin')
+PLUGIN_PATH = '/usr/lib/yafaray-plugins'
+BIN_PATH = '/usr/bin'
YAF_ID_NAME = "YAFA_V3_RENDER"

# Version to be automatically populated during the cmake build process, getting the version from git tags
14 changes: 14 additions & 0 deletions media-gfx/yafaray/files/yafaray-3.3.0-respect-cflags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/work/Core-3.3.0/CMakeLists.txt b/work/Core-3.3.0/CMakeLists.txt
index 75fd2c6..94c2502 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -219,9 +219,6 @@ if(NOT WIN32)
set(YAF_BINDINGS_RUBY_DIR ${YAF_LIB_DIR})
endif(NOT YAF_BINDINGS_RUBY_DIR)

- # build flags
- set(CMAKE_CXX_FLAGS "-Wall" CACHE STRING "Default compiler flags" FORCE)
-
if(USER_RELEASE_OPTIMIZATION_FLAGS)
set(YAF_CXX_FLAGS_RELEASE ${USER_RELEASE_OPTIMIZATION_FLAGS})
else(USER_RELEASE_OPTIMIZATION_FLAGS)
12 changes: 12 additions & 0 deletions media-gfx/yafaray/files/yafaray-3.3.0-strip-debug-mode.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/work/Core-3.3.0/CMakeLists.txt b/work/Core-3.3.0/CMakeLists.txt
index 75fd2c6..52c6b3d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,7 +17,6 @@ option(WITH_YAF_PY_BINDINGS "Enable the YafaRay Python bindings" ON)
option(WITH_YAF_RUBY_BINDINGS "Enable the YafaRay Ruby bindings" OFF)
option(WITH_OSX_ADDON "Enable the use of blender's included python lib on OSX platforms" OFF)
option(WITH_OpenCV "Build OpenCV image processing support" ON)
-option(DEBUG_BUILD "Enable debug build mode" OFF)
option(EMBED_FONT_QT "Embed font for QT GUI (usefull for some buggy QT installations)" OFF)
option(FAST_MATH "Enable mathematic approximations to make code faster" ON)
option(FAST_TRIG "Enable trigonometric approximations to make code faster" ON)
23 changes: 23 additions & 0 deletions media-gfx/yafaray/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>[email protected]</email>
<name>Herb Miller Jr. (herbmillerjr)</name>
</maintainer>
<maintainer type="project">
<email>[email protected]</email>
<name>Proxy Maintainers</name>
</maintainer>
<longdescription lang="en">
YafaRay is a raytracing open source render engine. Raytracing is a rendering technique for generating realistic images by tracing the path of light through a 3D scene.
An render engine consists of a "faceless" computer program that interacts with a host 3D application to provide very specific raytracing capabilties "on demand". Blender 3D is the host application of YafaRay.
</longdescription>
<use>
<flag name="blender">Install addon for <pkg>media-gfx/blender</pkg></flag>
<flag name="fastmath">Enable mathematic approximations to make code faster</flag>
<flag name="fasttrig">Enable trigonometric approximations to make code faster</flag>
<flag name="opencv">Use <pkg>media-libs/opencv</pkg></flag>
</use>
</pkgmetadata>

101 changes: 101 additions & 0 deletions media-gfx/yafaray/yafaray-3.3.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

PYTHON_COMPAT=( python3_{5,6} )
inherit cmake-utils python-single-r1

DESCRIPTION="A free open-source montecarlo raytracing engine"
HOMEPAGE="http://www.yafaray.org"
SRC_URI="https://github.com/YafaRay/Core/archive/v${PV}.tar.gz -> ${PN}-core-${PV}.tar.gz
https://github.com/YafaRay/Blender-Exporter/archive/v${PV}.tar.gz -> ${PN}-blender-exporter-${PV}.tar.gz"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+blender +fastmath +fasttrig jpeg opencv openexr png +python tiff truetype"

RDEPEND="dev-libs/boost:=
dev-libs/libxml2
sys-libs/zlib
blender? ( media-gfx/blender )
jpeg? ( virtual/jpeg:0 )
opencv? ( >=media-libs/opencv-3.1.0:=[openexr?] )
openexr? ( >=media-libs/openexr-2.2.0:= )
png? ( media-libs/libpng:= )
python? ( ${PYTHON_DEPS} )
tiff? ( media-libs/tiff:0 )
truetype? ( media-libs/freetype )"
DEPEND="${RDEPEND}
dev-lang/swig"

S="${WORKDIR}/Core-${PV}"

src_prepare() {
cmake-utils_src_prepare

sed -i -e "s/@YAFARAY_BLENDER_EXPORTER_VERSION@/v${PV}/" "${WORKDIR}/Blender-Exporter-${PV}/__init__.py" || die

eapply "${FILESDIR}/${P}-strip-debug-mode.patch"
eapply "${FILESDIR}/${P}-respect-cflags.patch"
pushd "${WORKDIR}/Blender-Exporter-${PV}" || die
eapply "${FILESDIR}/${P}-blender-exporter-paths.patch"
popd || dir
eapply_user
}

src_configure() {
local mycmakeargs=(
-DYAF_LIB_DIR=$(get_libdir)
-DWITH_YAF_PY_BINDINGS=$(usex python)
-DWITH_YAF_RUBY_BINDINGS=OFF
-DBLENDER_ADDON=OFF # addon is a separate package called blender-exporter
-DCMAKE_SKIP_RPATH=ON # NULL DT_RUNPATH security problem
-DFAST_MATH=$(usex fastmath)
-DFAST_TRIG=$(usex fasttrig)
-DWITH_JPEG="$(usex jpeg)"
-DWITH_OpenCV="$(usex opencv)"
-DWITH_OpenEXR="$(usex openexr)"
-DWITH_PNG="$(usex png)"
-DWITH_QT=OFF # qt4 only at the moment
-DWITH_TIFF="$(usex tiff)"
-DWITH_Freetype="$(usex truetype)"
)

cmake-utils_src_configure
}

src_install() {
cmake-utils_src_install

python_domodule "${BUILD_DIR}/src/bindings/yafaray_v3_interface.py"
python_domodule "${BUILD_DIR}/src/bindings/_yafaray_v3_interface.so"
rm -v "${D}"usr/$(get_libdir)/{yafaray_v3_interface.py,_yafaray_v3_interface.so} || die

if use blender; then
pushd "${WORKDIR}/Blender-Exporter-${PV}" || die
rm README LICENSES INSTALL CHANGELOG .gitignore || die
# grab blender version number for plugin directory
local blender_plugin_dir=$(best_version media-gfx/blender)
blender_plugin_dir=${blender_plugin_dir##*/} # remove category
blender_plugin_dir=${blender_plugin_dir#*-} # remove package name
blender_plugin_dir=${blender_plugin_dir%%-*} # remove revision number if exists
insinto /usr/share/blender/${blender_plugin_dir}/scripts/addons/yafaray_v3
doins -r .
popd || die
fi
}

pkg_postinst() {
elog "To confirm your installation is working as expected, run"
elog "yafaray-xml with /usr/share/yafaray/tests/test01/test01.xml"
elog "as an input file, then compare the result to"
elog "'/usr/share/yafaray/tests/test01/test01 - expected render result.png'"
if use blender; then
elog
elog "To use within Blender, navigate to File -> User Preferences -> Add-ons (tab)"
elog "and enable 'Render: YafaRay v3 Exporter'. This will make YafaRay available"
elog "in the render engines drop-down."
fi
}

0 comments on commit 11bd409

Please sign in to comment.