From 87724dc6e1a9e45bd820535078a4d07c963257f0 Mon Sep 17 00:00:00 2001 From: Andreas Sturmlechner Date: Wed, 27 Nov 2019 00:50:50 +0100 Subject: [PATCH] media-libs/vigra: Fix cmake module install dir, backport python3_7 Use shipped documentation as building fails right now. Closes: https://bugs.gentoo.org/701208 Package-Manager: Portage-2.3.79, Repoman-2.3.18 Signed-off-by: Andreas Sturmlechner --- .../files/vigra-1.11.1-cmake-module-dir.patch | 17 ++ .../vigra/files/vigra-1.11.1-python3.7.patch | 30 ++++ media-libs/vigra/vigra-1.11.1-r3.ebuild | 151 ++++++++++++++++++ media-libs/vigra/vigra-9999.ebuild | 6 +- 4 files changed, 201 insertions(+), 3 deletions(-) create mode 100644 media-libs/vigra/files/vigra-1.11.1-cmake-module-dir.patch create mode 100644 media-libs/vigra/files/vigra-1.11.1-python3.7.patch create mode 100644 media-libs/vigra/vigra-1.11.1-r3.ebuild diff --git a/media-libs/vigra/files/vigra-1.11.1-cmake-module-dir.patch b/media-libs/vigra/files/vigra-1.11.1-cmake-module-dir.patch new file mode 100644 index 000000000000..cfc56b34722f --- /dev/null +++ b/media-libs/vigra/files/vigra-1.11.1-cmake-module-dir.patch @@ -0,0 +1,17 @@ +CMake modules must be in cmake subdir. + +--- a/CMakeLists.txt 2017-05-19 17:01:08.000000000 +0200 ++++ b/CMakeLists.txt 2019-11-26 23:50:40.660462479 +0100 +@@ -368,10 +368,10 @@ + + # export targets: + INSTALL(EXPORT vigra-targets +- DESTINATION lib${LIB_SUFFIX}/vigra) ++ DESTINATION lib${LIB_SUFFIX}/cmake/vigra) + INSTALL(FILES ${PROJECT_BINARY_DIR}/lib/vigra/CMake/VigraConfig.cmake + ${PROJECT_BINARY_DIR}/lib/vigra/CMake/VigraConfigVersion.cmake +- DESTINATION lib${LIB_SUFFIX}/vigra) ++ DESTINATION lib${LIB_SUFFIX}/cmake/vigra) + EXPORT(TARGETS vigraimpex FILE vigra-targets.cmake) + + ################################################## diff --git a/media-libs/vigra/files/vigra-1.11.1-python3.7.patch b/media-libs/vigra/files/vigra-1.11.1-python3.7.patch new file mode 100644 index 000000000000..2e6cd3469f8e --- /dev/null +++ b/media-libs/vigra/files/vigra-1.11.1-python3.7.patch @@ -0,0 +1,30 @@ +From a6fa62663c6a6b752ed0707e95f643e25867a0f9 Mon Sep 17 00:00:00 2001 +From: John Kirkham +Date: Fri, 19 Oct 2018 11:32:42 -0400 +Subject: [PATCH] Receive `const char *` from `PyUnicode_AsUTF8` + +In Python 3.7, `PyUnicode_AsUTF8` was changed to return a `const char *` +instead of a `char *`. This broke VIGRA as we were accepting a `char *` +in this case instead. Fortunately we do not need it to be mutable for +our use case. So just type the variable storing the result from +`PyUnicode_AsUTF8` as a `const char *`. Should still work on older +Python 3 versions that return `char *` as well. + +ref: https://bugs.python.org/issue28769 +--- + vigranumpy/src/core/vigranumpycore.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/vigranumpy/src/core/vigranumpycore.cxx b/vigranumpy/src/core/vigranumpycore.cxx +index ec38d3636..c81c6ae52 100644 +--- a/vigranumpy/src/core/vigranumpycore.cxx ++++ b/vigranumpy/src/core/vigranumpycore.cxx +@@ -61,7 +61,7 @@ UInt32 pychecksum(python::str const & s) + return checksum(data, size); + #else + Py_ssize_t size = 0; +- char * data = PyUnicode_AsUTF8AndSize(s.ptr(), &size); ++ const char * data = PyUnicode_AsUTF8AndSize(s.ptr(), &size); + return checksum(data, size); + #endif + } diff --git a/media-libs/vigra/vigra-1.11.1-r3.ebuild b/media-libs/vigra/vigra-1.11.1-r3.ebuild new file mode 100644 index 000000000000..f2b096eaf519 --- /dev/null +++ b/media-libs/vigra/vigra-1.11.1-r3.ebuild @@ -0,0 +1,151 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{6,7} ) +PYTHON_REQ_USE="threads(+),xml" +inherit cmake-utils python-r1 + +DESCRIPTION="C++ computer vision library emphasizing customizable algorithms and structures" +HOMEPAGE="https://ukoethe.github.io/vigra/" + +if [[ ${PV} == *9999 ]] ; then + EGIT_REPO_URI="https://github.com/ukoethe/${PN}.git" + inherit git-r3 +else + SRC_URI="https://github.com/ukoethe/${PN}/releases/download/Version-${PV//\./-}/${P}-src.tar.gz" + KEYWORDS="~amd64 ~arm64 ~sparc ~x86 ~amd64-linux ~x86-linux ~sparc-solaris ~x64-solaris ~x86-solaris" +fi + +LICENSE="MIT" +SLOT="0" +IUSE="doc +fftw +hdf5 +jpeg mpi openexr +png +python test +tiff valgrind +zlib" + +REQUIRED_USE=" + python? ( hdf5 ${PYTHON_REQUIRED_USE} ) + test? ( hdf5 python fftw )" + +BDEPEND=" + test? ( + >=dev-python/nose-1.1.2-r1[${PYTHON_USEDEP}] + valgrind? ( dev-util/valgrind ) + ) +" +# runtime dependency on python is required by the vigra-config script +DEPEND=" + fftw? ( sci-libs/fftw:3.0 ) + hdf5? ( >=sci-libs/hdf5-1.8.0:=[mpi=] ) + jpeg? ( virtual/jpeg:0 ) + openexr? ( + media-libs/ilmbase:= + media-libs/openexr:= + ) + png? ( media-libs/libpng:0= ) + python? ( + ${PYTHON_DEPS} + dev-libs/boost:=[python?,${PYTHON_USEDEP}] + dev-python/numpy[${PYTHON_USEDEP}] + ) + tiff? ( media-libs/tiff:0= ) + zlib? ( sys-libs/zlib ) +" +RDEPEND="${PYTHON_DEPS} + ${DEPEND} +" + +# Severely broken, also disabled in Fedora, bugs #390447, #653442 +RESTRICT="test" + +PATCHES=( + # git master + "${FILESDIR}/${P}-fix-incorrect-template-parameter-type.patch" + "${FILESDIR}/${P}-boost-python.patch" + "${FILESDIR}/${P}-python3.7.patch" # bug 701208 + # TODO: upstream + "${FILESDIR}/${P}-lib_suffix.patch" + "${FILESDIR}/${P}-cmake-module-dir.patch" + "${FILESDIR}/${P}-sphinx.ext.pngmath.patch" # thanks to Debian; bug 678308 +) + +pkg_setup() { + use python && python_setup +} + +src_prepare() { + vigra_disable() { + if ! use ${1}; then + sed -e "/^VIGRA_FIND_PACKAGE.*${2:-$1}/Is/^/#disabled by USE=${1}: /" \ + -i CMakeLists.txt || die "failed to disable ${1}" + fi + } + + cmake-utils_src_prepare + + vigra_disable fftw fftw3 + vigra_disable fftw fftw3f + vigra_disable jpeg + vigra_disable png + vigra_disable tiff + vigra_disable zlib + + # Don't use python_fix_shebang because we can't put this behind USE="python" + sed -i -e '/env/s:python:python3:' config/vigra-config.in || die + + use doc || cmake_comment_add_subdirectory docsrc + use test || cmake_comment_add_subdirectory test +} + +src_configure() { + vigra_configure() { + local mycmakeargs=( + -DAUTOEXEC_TESTS=OFF + -DDOCINSTALL="share/doc/${PF}/html" + -DWITH_HDF5=$(usex hdf5) + -DWITH_OPENEXR=$(usex openexr) + -DWITH_VALGRIND=$(usex valgrind) + -DWITH_VIGRANUMPY=$(usex python) + ) + cmake-utils_src_configure + } + + if use python; then + python_foreach_impl vigra_configure + else + vigra_configure + fi +} + +src_compile() { + local VIGRA_BUILD_DIR + vigra_compile() { + cmake-utils_src_compile + VIGRA_BUILD_DIR="${BUILD_DIR}" + } + if use python; then + python_foreach_impl vigra_compile + else + vigra_compile + fi +} + +src_install() { + if use python; then + python_foreach_impl cmake-utils_src_install + python_optimize + else + cmake-utils_src_install + fi +} + +src_test() { + # perhaps disable tests (see #390447) + vigra_test() { + PYTHONPATH="${BUILD_DIR}/vigranumpy/vigra" cmake-utils_src_test + } + if use python; then + python_foreach_impl vigra_test + else + vigra_test + fi +} diff --git a/media-libs/vigra/vigra-9999.ebuild b/media-libs/vigra/vigra-9999.ebuild index 6d9d2266b163..c1094b892655 100644 --- a/media-libs/vigra/vigra-9999.ebuild +++ b/media-libs/vigra/vigra-9999.ebuild @@ -3,8 +3,6 @@ EAPI=7 -MY_P="${P}-src" -MY_V="${PV//\./-}" PYTHON_COMPAT=( python3_{6,7} ) PYTHON_REQ_USE="threads(+),xml" inherit cmake-utils python-r1 @@ -16,7 +14,7 @@ if [[ ${PV} == *9999 ]] ; then EGIT_REPO_URI="https://github.com/ukoethe/${PN}.git" inherit git-r3 else - SRC_URI="https://github.com/ukoethe/${PN}/releases/download/Version-${MY_V}/${MY_P}.tar.gz" + SRC_URI="https://github.com/ukoethe/${PN}/releases/download/Version-${PV//\./-}/${P}-src.tar.gz" KEYWORDS="~amd64 ~arm64 ~sparc ~x86 ~amd64-linux ~x86-linux ~sparc-solaris ~x64-solaris ~x86-solaris" fi @@ -67,6 +65,7 @@ RESTRICT="test" PATCHES=( # TODO: upstream "${FILESDIR}/${PN}-1.11.1-lib_suffix.patch" + "${FILESDIR}/${PN}-1.11.1-cmake-module-dir.patch" "${FILESDIR}/${PN}-1.11.1-sphinx.ext.pngmath.patch" # thanks to Debian; bug 678308 ) @@ -140,6 +139,7 @@ src_compile() { if use doc; then einfo "Generating Documentation" + doxygen -u ${VIGRA_BUILD_DIR}/docsrc/Doxyfile 2>/dev/null || die # use build dir from last compile command VARTEXFONTS="${T}/fonts" BUILD_DIR="${VIGRA_BUILD_DIR}" cmake-utils_src_make doc fi -- 2.26.2