commit:     87724dc6e1a9e45bd820535078a4d07c963257f0
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 26 23:50:50 2019 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Wed Nov 27 00:12:47 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=87724dc6

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 <asturm <AT> gentoo.org>

 .../files/vigra-1.11.1-cmake-module-dir.patch      | 17 ++++++++++
 .../vigra/files/vigra-1.11.1-python3.7.patch       | 30 +++++++++++++++++
 .../{vigra-9999.ebuild => vigra-1.11.1-r3.ebuild}  | 38 +++++++---------------
 media-libs/vigra/vigra-9999.ebuild                 |  6 ++--
 4 files changed, 61 insertions(+), 30 deletions(-)

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 00000000000..cfc56b34722
--- /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 00000000000..2e6cd3469f8
--- /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 <[email protected]>
+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-9999.ebuild 
b/media-libs/vigra/vigra-1.11.1-r3.ebuild
similarity index 80%
copy from media-libs/vigra/vigra-9999.ebuild
copy to media-libs/vigra/vigra-1.11.1-r3.ebuild
index 6d9d2266b16..f2b096eaf51 100644
--- a/media-libs/vigra/vigra-9999.ebuild
+++ b/media-libs/vigra/vigra-1.11.1-r3.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
 
@@ -25,15 +23,10 @@ SLOT="0"
 IUSE="doc +fftw +hdf5 +jpeg mpi openexr +png +python test +tiff valgrind +zlib"
 
 REQUIRED_USE="
-       doc? ( hdf5 fftw ${PYTHON_REQUIRED_USE} )
        python? ( hdf5 ${PYTHON_REQUIRED_USE} )
        test? ( hdf5 python fftw )"
 
 BDEPEND="
-       doc? (
-               app-doc/doxygen
-               >=dev-python/sphinx-1.1.3-r5
-       )
        test? (
                >=dev-python/nose-1.1.2-r1[${PYTHON_USEDEP}]
                valgrind? ( dev-util/valgrind )
@@ -65,15 +58,18 @@ RDEPEND="${PYTHON_DEPS}
 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}/${PN}-1.11.1-lib_suffix.patch"
-       "${FILESDIR}/${PN}-1.11.1-sphinx.ext.pngmath.patch" # thanks to Debian; 
bug 678308
+       "${FILESDIR}/${P}-lib_suffix.patch"
+       "${FILESDIR}/${P}-cmake-module-dir.patch"
+       "${FILESDIR}/${P}-sphinx.ext.pngmath.patch" # thanks to Debian; bug 
678308
 )
 
 pkg_setup() {
-       if use python || use doc; then
-               python_setup
-       fi
+       use python && python_setup
 }
 
 src_prepare() {
@@ -86,10 +82,6 @@ src_prepare() {
 
        cmake-utils_src_prepare
 
-       if [[ ${PV} != *9999 ]]; then
-               rm -r doc || die "failed to remove shipped docs"
-       fi
-
        vigra_disable fftw fftw3
        vigra_disable fftw fftw3f
        vigra_disable jpeg
@@ -100,6 +92,7 @@ src_prepare() {
        # 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
 }
 
@@ -107,8 +100,7 @@ src_configure() {
        vigra_configure() {
                local mycmakeargs=(
                        -DAUTOEXEC_TESTS=OFF
-                       -DDOCDIR="${BUILD_DIR}/doc"
-                       -DDOCINSTALL="share/doc/${PF}"
+                       -DDOCINSTALL="share/doc/${PF}/html"
                        -DWITH_HDF5=$(usex hdf5)
                        -DWITH_OPENEXR=$(usex openexr)
                        -DWITH_VALGRIND=$(usex valgrind)
@@ -120,8 +112,6 @@ src_configure() {
        if use python; then
                python_foreach_impl vigra_configure
        else
-               # required for docdir
-               _cmake_check_build_dir init
                vigra_configure
        fi
 }
@@ -137,12 +127,6 @@ src_compile() {
        else
                vigra_compile
        fi
-
-       if use doc; then
-               einfo "Generating Documentation"
-               # use build dir from last compile command
-               VARTEXFONTS="${T}/fonts" BUILD_DIR="${VIGRA_BUILD_DIR}" 
cmake-utils_src_make doc
-       fi
 }
 
 src_install() {

diff --git a/media-libs/vigra/vigra-9999.ebuild 
b/media-libs/vigra/vigra-9999.ebuild
index 6d9d2266b16..c1094b89265 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

Reply via email to