--- ../../../gentoo/media-libs/openimageio/openimageio-1.6.13.ebuild 2017-04-23 22:57:47.000000000 +0200 +++ openimageio-1.7.13.ebuild 2017-04-29 15:58:39.913728648 +0200 @@ -13,8 +13,15 @@ LICENSE="BSD" SLOT="0" -KEYWORDS="amd64 ~ppc64 x86" -IUSE="colorio ffmpeg gif jpeg2k opencv opengl python qt4 raw ssl +truetype" +KEYWORDS="~amd64 ~ppc64 ~x86" + +X86_CPU_FEATURES=( + sse2:sse2 sse3:sse3 ssse3:ssse3 sse4_1:sse4.1 sse4_2:sse4.2 + avx:avx avx2:avx2 avx512f:avx512f f16c:f16c +) +CPU_FEATURES=( ${X86_CPU_FEATURES[@]/#/cpu_flags_x86_} ) +IUSE="colorio ffmpeg field3d gif jpeg2k jpegturbo opencv opengl ptex python qt4 raw ssl +truetype ${CPU_FEATURES[@]%:*}" + REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" RESTRICT="test" #431412 @@ -28,10 +35,12 @@ media-libs/openexr:= media-libs/tiff:0= sys-libs/zlib:= - virtual/jpeg:0 + virtual/jpeg:0= colorio? ( >=media-libs/opencolorio-1.0.7:= ) ffmpeg? ( media-video/ffmpeg:= ) + field3d? ( media-libs/field3d:= ) gif? ( media-libs/giflib:0= ) + jpegturbo? ( media-libs/libjpeg-turbo ) jpeg2k? ( >=media-libs/openjpeg-1.5:0= ) opencv? ( >=media-libs/opencv-2.3:= @@ -41,6 +50,7 @@ virtual/glu virtual/opengl ) + ptex? ( media-libs/ptex ) python? ( ${PYTHON_DEPS} dev-libs/boost:=[python,${PYTHON_USEDEP}] @@ -58,7 +68,9 @@ #S=${WORKDIR}/${P}/src -DOCS=( CHANGES CREDITS README.rst src/doc/${PN}.pdf ) +PATCHES=( "${FILESDIR}/${P}-fix-python-on-gentoo.patch" ) + +DOCS=( CHANGES.md CREDITS.md README.md src/doc/${PN}.pdf ) pkg_setup() { use python && python-single-r1_pkg_setup @@ -70,34 +82,67 @@ use python && python_fix_shebang . } +# Source: http://stackoverflow.com/questions/1527049/join-elements-of-an-array#17841619 +join_by() { + local IFS="$1" + shift + echo "$*" +} + src_configure() { + # Build with SIMD support + local cpufeature + local mysimd=() + for cpufeature in "${CPU_FEATURES[@]}"; do + use "${cpufeature%:*}" && mysimd+=("${cpufeature#*:}") + done + + # If no CPU SIMDs were used, completely disable them + [[ -z "${mysimd}" ]] && mysimd=("OFF") + local mycmakeargs=( -DLIB_INSTALL_DIR="/usr/$(get_libdir)" -DBUILDSTATIC=OFF -DLINKSTATIC=OFF -DINSTALL_DOCS=OFF -DOIIO_BUILD_TESTS=OFF # as they are RESTRICTed - $(use python && echo -DPYLIB_INSTALL_DIR="$(python_get_sitedir)") -DSTOP_ON_WARNING=OFF + -DUSE_CPP14=ON -DUSE_EXTERNAL_PUGIXML=ON - -DUSE_FIELD3D=OFF # missing in Portage - -DUSE_FREETYPE=$(usex truetype) -DUSE_FFMPEG=$(usex ffmpeg) + -DUSE_FIELD3D=$(usex field3d) + -DUSE_FREETYPE=$(usex truetype) -DUSE_GIF=$(usex gif) + -DUSE_JPEGTURBO=$(usex jpegturbo) + -DUSE_NUKE=NO # Missing in Gentoo -DUSE_OCIO=$(usex colorio) -DUSE_OPENCV=$(usex opencv) -DUSE_OPENGL=$(usex opengl) -DUSE_OPENJPEG=$(usex jpeg2k) -DUSE_OPENSSL=$(usex ssl) - -DUSE_PYTHON=$(usex python) + -DUSE_PTEX=$(usex ptex) -DUSE_LIBRAW=$(usex raw) -DUSE_QT=$(usex qt4) + -DUSE_SIMD=$(join_by , "${mysimd[@]}") + -DVERBOSE=ON ) - if [[ ${EPYTHON} == python3* ]]; then - mycmakeargs+=( -DUSE_PYTHON3=ON ) - else - mycmakeargs+=( -DUSE_PYTHON3=OFF ) + if use python ; then + if [[ "${EPYTHON}" = python2* ]] ; then + mycmakeargs+=( + -DPYLIB_INSTALL_DIR="$(python_get_sitedir)" + -DPYTHON_VERSION="${EPYTHON#python}" + -DUSE_PYTHON=ON + -DUSE_PYTHON3=OFF + ) + elif [[ "${EPYTHON}" = python3* ]] ; then + mycmakeargs+=( + -DPYLIB3_INSTALL_DIR="$(python_get_sitedir)" + -DPYTHON3_VERSION="${EPYTHON#python}" + -DUSE_PYTHON=OFF + -DUSE_PYTHON3=ON + ) + fi fi cmake-utils_src_configure