summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2024-01-12 16:51:53 +0000
committerSam James <sam@gentoo.org>2024-01-12 16:52:00 +0000
commit7008130fcca0eb7a631eececdf121bd7e1d90fa8 (patch)
tree0536b5112a161c3db7269e85603340595cc0d395 /media-libs/lensfun
parentsys-process/runit: remove accidentally committed file (diff)
downloadgentoo-7008130fcca0eb7a631eececdf121bd7e1d90fa8.tar.gz
gentoo-7008130fcca0eb7a631eececdf121bd7e1d90fa8.tar.bz2
gentoo-7008130fcca0eb7a631eececdf121bd7e1d90fa8.zip
media-libs/lensfun: add 0.3.4, fix Python handling
Closes: https://bugs.gentoo.org/901997 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'media-libs/lensfun')
-rw-r--r--media-libs/lensfun/Manifest1
-rw-r--r--media-libs/lensfun/files/lensfun-0.3.4-python-egg.patch11
-rw-r--r--media-libs/lensfun/files/lensfun-0.3.4-python.patch66
-rw-r--r--media-libs/lensfun/lensfun-0.3.4.ebuild68
4 files changed, 146 insertions, 0 deletions
diff --git a/media-libs/lensfun/Manifest b/media-libs/lensfun/Manifest
index 9e7627debe2a..57067af3c912 100644
--- a/media-libs/lensfun/Manifest
+++ b/media-libs/lensfun/Manifest
@@ -1 +1,2 @@
+DIST lensfun-0.3.4.tar.gz 1058791 BLAKE2B e68cb72eb730a23c3e2dd691a49606ea92a8b89c4665d62dff126404010c8c7e1162d5906a69fce52eb8fb121da8930bb2e42d74bbd8bb6d2631ed4e97405fa3 SHA512 4db9a08d51ba50c7c2ff528d380bb28e34698b2bb5c40e5f3deeaa5544c888ac7e0f638bbc3f33a4f75dbb67e0425ca36ce6d8cd1d8c043a4173a2df47de08c6
DIST lensfun-0.3.4_rc1.tar.gz 1045616 BLAKE2B fee14b97dcda98be4e8a32443ff71347ba75e46192f8437be580cb6697f6ef2eca92ef57cfcb2de5bd87fe7ba96542a6b5551b12f50fec09a035c69d6f4b427f SHA512 0d034c6996e5650b022d33a7e00ef7e0e00dfa99155aa62c6c3ab48b9ac936e46f812ceea46e2070514e2c77150a1d7c827831686b1cf73e2acf88b6b3dfb6c5
diff --git a/media-libs/lensfun/files/lensfun-0.3.4-python-egg.patch b/media-libs/lensfun/files/lensfun-0.3.4-python-egg.patch
new file mode 100644
index 000000000000..292a0e4186d5
--- /dev/null
+++ b/media-libs/lensfun/files/lensfun-0.3.4-python-egg.patch
@@ -0,0 +1,11 @@
+https://bugs.gentoo.org/901997
+https://sources.debian.org/patches/lensfun/0.3.4-1/python-setuptools.diff/
+--- a/apps/CMakeLists.txt
++++ b/apps/CMakeLists.txt
+@@ -48,5 +48,5 @@ IF(INSTALL_PYTHON_MODULE)
+ IF(NOT DEFINED SETUP_PY_INSTALL_PREFIX)
+ SET(SETUP_PY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
+ ENDIF()
+- INSTALL(CODE "execute_process(COMMAND ${Python3_EXECUTABLE} ${SETUP_PY} install --prefix=\$ENV{DESTDIR}${SETUP_PY_INSTALL_PREFIX})")
++ INSTALL(CODE "execute_process(COMMAND ${Python3_EXECUTABLE} ${SETUP_PY} install --prefix=${SETUP_PY_INSTALL_PREFIX} --single-version-externally-managed --root=\$ENV{DESTDIR})")
+ ENDIF()
diff --git a/media-libs/lensfun/files/lensfun-0.3.4-python.patch b/media-libs/lensfun/files/lensfun-0.3.4-python.patch
new file mode 100644
index 000000000000..2520a99e0b8e
--- /dev/null
+++ b/media-libs/lensfun/files/lensfun-0.3.4-python.patch
@@ -0,0 +1,66 @@
+https://bugs.gentoo.org/901997
+https://github.com/lensfun/lensfun/commit/6e0e92b03f90a264d764f696ba02344ab96b5576
+https://github.com/lensfun/lensfun/commit/c54d9bfda1397d3b9deaac1e27d94b0231fdd26a
+https://github.com/lensfun/lensfun/commit/011de2e85813ff496a85404b30891352555de077
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,5 +1,5 @@
+-# require at least cmake 2.8.12
+-CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR )
++# require at least cmake 3.12
++CMAKE_MINIMUM_REQUIRED(VERSION 3.12 FATAL_ERROR)
+
+ # path for helper modules
+ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/cmake/modules")
+--- a/apps/CMakeLists.txt
++++ b/apps/CMakeLists.txt
+@@ -20,27 +20,33 @@ ENDIF(INSTALL_HELPER_SCRIPTS)
+
+
+ # Inspired by http://bloerg.net/2012/11/10/cmake-and-distutils.html
++IF(INSTALL_PYTHON_MODULE)
++ FIND_PACKAGE (Python3 COMPONENTS Interpreter REQUIRED)
++ # Windows has a dummy python.exe in the PATH which opens the Microsoft Store, so check if Python is real.
++ EXECUTE_PROCESS(COMMAND ${Python3_EXECUTABLE} --version RESULT_VARIABLE PY_RESULT OUTPUT_QUIET)
++ IF (NOT PY_RESULT EQUAL 0)
++ MESSAGE(FATAL_ERROR "Python3 not found, it might be a dummy python.exe")
++ ENDIF()
+
+-FIND_PROGRAM(PYTHON "python3")
+-IF(PYTHON)
+ SET(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in")
+ SET(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
+ SET(DEPS_IN "${CMAKE_CURRENT_SOURCE_DIR}/lensfun/__init__.py.in")
+ SET(DEPS "${CMAKE_CURRENT_BINARY_DIR}/lensfun/__init__.py")
+ SET(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp")
+
++ FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}" PY_PACKAGE_DIR)
+ CONFIGURE_FILE(${SETUP_PY_IN} ${SETUP_PY})
+ CONFIGURE_FILE(${DEPS_IN} ${DEPS})
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${OUTPUT}
+- COMMAND ${PYTHON} ${SETUP_PY} build
++ COMMAND ${Python3_EXECUTABLE} ${SETUP_PY} build
+ COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
+- DEPENDS ${DEPS_IN})
++ DEPENDS ${SETUP_PY_IN} ${DEPS_IN})
+
+ ADD_CUSTOM_TARGET(python-package ALL DEPENDS ${OUTPUT})
+
+ IF(NOT DEFINED SETUP_PY_INSTALL_PREFIX)
+ SET(SETUP_PY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
+ ENDIF()
+- INSTALL(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} install --prefix=\$ENV{DESTDIR}${SETUP_PY_INSTALL_PREFIX})")
+-ENDIF(PYTHON)
++ INSTALL(CODE "execute_process(COMMAND ${Python3_EXECUTABLE} ${SETUP_PY} install --prefix=\$ENV{DESTDIR}${SETUP_PY_INSTALL_PREFIX})")
++ENDIF()
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -29,5 +29,5 @@ ADD_EXECUTABLE(test_modifier_coord_geometry test_modifier_coord_geometry.cpp)
+ TARGET_LINK_LIBRARIES(test_modifier_coord_geometry lensfun ${COMMON_LIBS})
+ ADD_TEST(Modifier_coord_geometry test_modifier_coord_geometry)
+
+-FIND_PACKAGE(PythonInterp REQUIRED)
+-ADD_TEST(NAME Database_integrity COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/check_database/check_database.py ${CMAKE_SOURCE_DIR}/data/db)
++FIND_PACKAGE(Python3 COMPONENTS Interpreter REQUIRED)
++ADD_TEST(NAME Database_integrity COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/check_database/check_database.py ${CMAKE_SOURCE_DIR}/data/db)
diff --git a/media-libs/lensfun/lensfun-0.3.4.ebuild b/media-libs/lensfun/lensfun-0.3.4.ebuild
new file mode 100644
index 000000000000..d5a949263eb4
--- /dev/null
+++ b/media-libs/lensfun/lensfun-0.3.4.ebuild
@@ -0,0 +1,68 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..11} )
+inherit python-single-r1 cmake
+
+DESCRIPTION="Library for rectifying and simulating photographic lens distortions"
+HOMEPAGE="https://lensfun.github.io"
+SRC_URI="https://github.com/${PN}/${PN}/archive/refs/tags/v${PV/_rc/-RC}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/${P/_rc/-RC}"
+
+LICENSE="LGPL-3 CC-BY-SA-3.0" # See README for reasoning.
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc cpu_flags_x86_sse cpu_flags_x86_sse2 test"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ ${PYTHON_DEPS}
+ >=dev-libs/glib-2.40
+ media-libs/libpng:=
+ sys-libs/zlib
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+ doc? (
+ app-text/doxygen
+ dev-python/docutils
+ )
+"
+
+DOCS=( README.md docs/mounts.txt ChangeLog )
+
+PATCHES=(
+ "${FILESDIR}"/lensfun-0.3.4-python.patch
+ "${FILESDIR}"/lensfun-0.3.4-python-egg.patch
+)
+
+src_configure() {
+ local mycmakeargs=(
+ -DCMAKE_INSTALL_DOCDIR="${EPREFIX}"/usr/share/doc/${PF}/html
+ -DPython3_EXECUTABLE="${PYTHON}"
+ -DSETUP_PY_INSTALL_PREFIX=/usr
+ -DBUILD_LENSTOOL=ON
+ -DBUILD_STATIC=OFF
+ -DBUILD_DOC=$(usex doc)
+ -DBUILD_FOR_SSE=$(usex cpu_flags_x86_sse)
+ -DBUILD_FOR_SSE2=$(usex cpu_flags_x86_sse2)
+ -DBUILD_TESTS=$(usex test)
+ )
+ cmake_src_configure
+}
+
+src_test() {
+ mkdir -p "${T}/db/lensfun" || die
+ cp data/db/* "${T}/db/lensfun/" || die
+
+ XDG_DATA_HOME="${T}/db" cmake_src_test
+}
+
+src_install() {
+ cmake_src_install
+ python_fix_shebang "${ED}"/usr/bin
+ python_optimize
+}