diff --git a/app-editors/xemacs/files/xemacs-21.5.36-cus-dep.patch b/app-editors/xemacs/files/xemacs-21.5.36-cus-dep.patch new file mode 100644 index 0000000000000..e909fffa370e1 --- /dev/null +++ b/app-editors/xemacs/files/xemacs-21.5.36-cus-dep.patch @@ -0,0 +1,27 @@ +changeset: 7825:d1d026a0f073 +tag: tip +user: Aidan Kehoe +date: Wed Nov 26 07:16:47 2025 +0000 +summary: Avoid generating a lock file when generating custom-load.el, cus-dep.el + +diff -r c562b019a23b -r d1d026a0f073 lisp/cus-dep.el +--- a/lisp/cus-dep.el Tue Nov 25 13:38:30 2025 +0000 ++++ b/lisp/cus-dep.el Wed Nov 26 07:16:47 2025 +0000 +@@ -119,12 +119,11 @@ + (return nil)))) + (message "(No changes need to be written)") + (when (file-exists-p cusload-file) +- (let ((buf (find-file-noselect cusload-file))) +- (with-current-buffer buf +- (goto-char (point-min)) +- (when (search-forward cusload-hash-table-marker nil t) +- (setq old-hash (read buf)))) +- (kill-buffer buf))) ++ (with-temp-buffer ++ (insert-file-contents-internal cusload-file) ++ (goto-char (point-min)) ++ (when (search-forward cusload-hash-table-marker nil t) ++ (setq old-hash (read (current-buffer)))))) + ;; Process directory + (dolist (file files) + (let ((old-cache (if (hash-table-p old-hash) diff --git a/app-editors/xemacs/xemacs-21.5.36-r4.ebuild b/app-editors/xemacs/xemacs-21.5.36-r4.ebuild new file mode 100644 index 0000000000000..e54e3b01a628c --- /dev/null +++ b/app-editors/xemacs/xemacs-21.5.36-r4.ebuild @@ -0,0 +1,257 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# Note: xemacs currently does not work with position independent code +# so the build forces the use of the -no-pie option + +EAPI=8 + +inherit flag-o-matic xdg-utils desktop autotools + +DESCRIPTION="highly customizable open source text editor and application development system" +HOMEPAGE="https://www.xemacs.org/" + +SRC_URI="http://ftp.xemacs.org/pub/xemacs/xemacs-$(ver_cut 1-2)/${P}.tar.gz + neXt? ( http://www.malfunction.de/afterstep/files/NeXT_XEmacs.tar.gz )" + +LICENSE="GPL-3+" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~sparc ~x86" +IUSE="alsa debug gif gpm pop postgres ldap xface nas X jpeg tiff png motif xft xim athena neXt Xaw3d gdbm berkdb +bignum" + +X_DEPEND="x11-libs/libXt x11-libs/libXmu x11-libs/libXext x11-misc/xbitmaps" + +# If sys-libs/db:5.3 is removed from tree 4.8 can be used. +RDEPEND=" + berkdb? ( sys-libs/db:5.3= ) + gdbm? ( >=sys-libs/gdbm-1.8.3:=[berkdb(+)] ) + >=virtual/zlib-1.1.4:= + >=dev-libs/openssl-0.9.6:0= + >=media-libs/audiofile-0.2.3 + gpm? ( >=sys-libs/gpm-1.19.6 ) + postgres? ( dev-db/postgresql:= ) + ldap? ( net-nds/openldap:= ) + alsa? ( media-libs/alsa-lib ) + nas? ( media-libs/nas ) + X? ( $X_DEPEND !Xaw3d? ( !neXt? ( x11-libs/libXaw ) ) ) + motif? ( >=x11-libs/motif-2.3:0[xft=] ) + athena? ( x11-libs/libXaw ) + Xaw3d? ( x11-libs/libXaw3d[unicode(+)] ) + xft? ( media-libs/freetype:2 x11-libs/libXft x11-libs/libXrender >=media-libs/fontconfig-2.5.0 ) + neXt? ( x11-libs/neXtaw ) + xface? ( media-libs/compface ) + tiff? ( media-libs/tiff:= ) + png? ( >=media-libs/libpng-1.2:0 ) + jpeg? ( media-libs/libjpeg-turbo:= ) + >=sys-libs/ncurses-5.2:= + >=app-eselect/eselect-emacs-1.15 + bignum? ( dev-libs/openssl )" + +DEPEND="${RDEPEND} + virtual/pkgconfig" + +BDEPEND="sys-apps/texinfo" + +PDEPEND="app-xemacs/xemacs-base + app-xemacs/mule-base" + +src_unpack() { + default_src_unpack +} + +src_prepare() { + use neXt && cp "${WORKDIR}"/NeXT.XEmacs/xemacs-icons/* "${S}"/etc/toolbar/ + find "${S}"/lisp -name '*.elc' -exec rm {} \; || die + eapply "${FILESDIR}/${PN}-21.5.35-unknown-command-test.patch" + eapply "${FILESDIR}/${P}-failing-tests.patch" + eapply "${FILESDIR}/${P}-failing-tests-2.patch" + eapply "${FILESDIR}/${P}-configure-postgresql.patch" + eapply "${FILESDIR}/${P}-berkdb-5.3.patch" + eapply "${FILESDIR}/${P}-cus-dep.patch" + eapply_user + + eautoconf + + # Some binaries and man pages are installed under suffixed names + # to avoid collions with their GNU Emacs counterparts (see below). + # Fix internal filename references. + sed -i -e 's/exec gnuclient/&-xemacs/' lib-src/gnudoit || die + sed -i -e '/^\.so/s/etags/&-xemacs/' etc/ctags.1 || die + sed -i -e '/^\.so/s/gnuserv/&-xemacs/' etc/gnu{client,doit,attach}.1 || die +} + +src_configure() { + local myconf="" + + # bug #639642 + test-flags -no-pie >/dev/null && append-flags -no-pie + filter-flags -pie + + if use X; then + + myconf="${myconf} --with-widgets=athena" + myconf="${myconf} --with-dialogs=athena" + myconf="${myconf} --with-menubars=lucid" + myconf="${myconf} --with-scrollbars=lucid" + if use motif ; then + myconf="--with-widgets=motif" + myconf="${myconf} --with-dialogs=motif" + myconf="${myconf} --with-scrollbars=motif" + myconf="${myconf} --with-menubars=lucid" + fi + if use athena or use Xaw3d ; then + myconf="--with-scrollbars=athena" + fi + + if use Xaw3d; then + myconf="${myconf} --with-athena=3d" + elif use neXt; then + myconf="${myconf} --with-athena=next" + else + myconf="${myconf} --with-athena=xaw" + fi + + myconf="${myconf} $(use_with tiff )" + myconf="${myconf} $(use_with png )" + myconf="${myconf} $(use_with jpeg )" + myconf="${myconf} $(use_with xface )" + + use xft && myconf="${myconf} --with-xft=emacs,tabs,menubars,gauges" || + myconf="${myconf} --with-xft=no" + + else + myconf="${myconf} + --without-x + --without-xpm + --without-dragndrop + --with-xft=no + --with-gif=no" + fi + + if use xim ; then + if use motif ; then + myconf="${myconf} --with-xim=motif" + else + myconf="${myconf} --with-xim=xlib" + fi + else + myconf="${myconf} --with-xim=no" + fi + + myconf="${myconf} --without-wnn" + + # This determines the type of sounds we are playing + local soundconf="native" + + # This determines how these sounds should be played + use nas && soundconf="${soundconf},nas" + use alsa && soundconf="${soundconf},alsa" + + myconf="${myconf} --with-sound=${soundconf}" + + if use gdbm || use berkdb ; then + local mydb="nodbm" + use gdbm && mydb="${mydb},gdbm" || mydb="${mydb},nogdbm" + use berkdb && mydb="${mydb},berkdb" || mydb="${mydb},noberkdb" + myconf="${myconf} --with-database=${mydb}" + else + myconf="${myconf} --without-database" + fi + + if use debug ; then + myconf="${myconf} --with-debug" + # bug #924339 + append-flags -fno-strict-aliasing + else + myconf="${myconf} --with-optimization --with-cflags-debugging=" + fi + + use bignum && myconf="${myconf} --with-bignum=openssl" || + myconf="${myconf} --with-bignum=no" + + econf ${myconf} \ + $(use_with gif ) \ + $(use_with gpm ) \ + $(use_with postgres postgresql ) \ + $(use_with ldap ) \ + $(use_with pop ) \ + --prefix=/usr \ + --with-unicode-internal \ + --without-canna \ + --with-ncurses \ + --with-msw=no \ + --with-mail-locking=flock \ + --with-site-lisp=yes \ + --with-site-modules=yes \ + --enable-option-checking=no \ + --with-last-packages=/usr/lib/xemacs +} + +src_compile() { + # bug #959756 + local -x CCACHE_DISABLE=1 + emake EMACSLOADPATH="${S}"/lisp +} + +src_install() { + emake prefix="${ED}"/usr \ + mandir="${ED}"/usr/share/man/man1 \ + infodir="${ED}"/usr/share/info \ + libdir="${ED}"/usr/$(get_libdir) \ + datadir="${ED}"/usr/share \ + install + + # Rename some applications installed in bin so that it is clear + # which application installed them and so that conflicting + # packages (emacs) can't clobber the actual applications. + # Addresses bug #62991. + for i in ctags etags gnuclient gnudoit gnuattach; do + mv "${ED}"/usr/bin/${i} "${ED}"/usr/bin/${i}-xemacs || die "mv ${i} failed" + done + + # rename man pages + for i in ctags etags gnuserv gnuclient gnudoit gnuattach; do + mv "${ED}"/usr/share/man/man1/${i}{,-xemacs}.1 || die "mv ${i}.1 failed" + done + + # install base packages directories + dodir /usr/lib/xemacs/xemacs-packages/ + dodir /usr/lib/xemacs/site-packages/ + dodir /usr/lib/xemacs/site-modules/ + dodir /usr/lib/xemacs/site-lisp/ + dodir /usr/lib/xemacs/mule-packages + + # remove extraneous info files + cd "${ED}"/usr/share/info + rm -f dir info.info texinfo* termcap* standards* + + cd "${S}" + dodoc CHANGES-* ChangeLog INSTALL Installation PROBLEMS README* + + domenu "${S}"/etc/${PN}.desktop + newicon "${S}"/etc/${PN}-icon.xpm ${PN}.xpm +} + +pkg_postinst() { + eselect emacs update ifunset + eselect gnuclient update ifunset + xdg_desktop_database_update + + einfo "If you are upgrading from XEmacs 21.4 you should note the following" + einfo "incompatibilities:" + einfo "- Mule-UCS is no longer supported due to proper UTF-8 support in XEmacs 21.5" + einfo "- The X resource class has changed from Emacs to XEmacs," + einfo " settings in your .Xdefaults file should be updated accordingly." + + if use xft; + then + einfo "You have enabled Xft font support. Xft requires font names to be provided" + einfo "in a different way, so you may need to adjust your .Xdefaults accordingly." + fi +} + +pkg_postrm() { + eselect emacs update ifunset + eselect gnuclient update ifunset + xdg_desktop_database_update +} diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 8fc92cf4fca5c..5980cc47e5f74 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -415,6 +415,28 @@ unset -f _distutils_set_globals # } # @CODE +# @ECLASS_VARIABLE: DISTUTILS_CONFIG_SETTINGS_JSON +# @DEFAULT_UNSET +# @DESCRIPTION: +# The JSON object deserialized into config_settings dictionary passed +# to the build backend. +# +# Allowed only for DISTUTILS_USE_PEP517=standalone. Use DISTUTILS_ARGS +# for other backends. +# +# Example: +# @CODE +# python_configure_all() { +# DISTUTILS_CONFIG_SETTINGS_JSON=' +# { +# "verbose": true, +# "targets": ["foo", "bar"], +# "build-type": "release" +# } +# ' +# } +# @CODE + # @FUNCTION: distutils_enable_sphinx # @USAGE: [--no-autodoc | ...] # @DESCRIPTION: @@ -1197,6 +1219,12 @@ distutils_pep517_install() { ;; esac + if [[ ${DISTUTILS_USE_PEP517} == standalone ]]; then + config_settings=${DISTUTILS_CONFIG_SETTINGS_JSON} + elif [[ -n ${DISTUTILS_CONFIG_SETTINGS_JSON} ]]; then + die "DISTUTILS_CONFIG_SETTINGS_JSON supported only for standalone backends" + fi + # https://pyo3.rs/latest/building-and-distribution.html#cross-compiling if tc-is-cross-compiler; then local -x PYO3_CROSS_LIB_DIR=${SYSROOT}/$(python_get_stdlib) @@ -1486,8 +1514,8 @@ distutils-r1_run_phase() { local -x PATH=${BUILD_DIR}/install${EPREFIX}/usr/bin:${PATH} # Set up build environment, bug #513664. - local -x AR=${AR} CC=${CC} CPP=${CPP} CXX=${CXX} - tc-export AR CC CPP CXX + local -x AR=${AR} CC=${CC} CPP=${CPP} CXX=${CXX} PKG_CONFIG=${PKG_CONFIG} + tc-export AR CC CPP CXX PKG_CONFIG # Perform additional environment modifications only for python_compile # phase. This is the only phase where we expect to be calling the Python diff --git a/media-libs/openimageio/files/openimageio-3.0.8.1-avcodec_close.patch b/media-libs/openimageio/files/openimageio-3.0.8.1-avcodec_close.patch new file mode 100644 index 0000000000000..190040e607582 --- /dev/null +++ b/media-libs/openimageio/files/openimageio-3.0.8.1-avcodec_close.patch @@ -0,0 +1,25 @@ +From 575a3ae620409971cf1693a802d062a6e75f1c69 Mon Sep 17 00:00:00 2001 +From: "Vlad (Kuzmin) Erium" +Date: Wed, 23 Jul 2025 19:13:57 +0900 +Subject: [PATCH] Replace avcodec_close with avcodec_free_context + +avcodec_close (AVCodecContext *avctx) removing in ffmpeg 7.2 and was deprecated for couple years + +Signed-off-by: Vlad (Kuzmin) Erium +--- + src/ffmpeg.imageio/ffmpeginput.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/ffmpeg.imageio/ffmpeginput.cpp b/src/ffmpeg.imageio/ffmpeginput.cpp +index 1e78f77c72..7cfaf601b2 100644 +--- a/src/ffmpeg.imageio/ffmpeginput.cpp ++++ b/src/ffmpeg.imageio/ffmpeginput.cpp +@@ -581,7 +581,7 @@ bool + FFmpegInput::close(void) + { + if (m_codec_context) +- avcodec_close(m_codec_context); ++ avcodec_free_context(&m_codec_context); + if (m_format_context) { + avformat_close_input(&m_format_context); + av_free(m_format_context); // will free m_codec and m_codec_context diff --git a/media-libs/openimageio/openimageio-3.0.8.1-r2.ebuild b/media-libs/openimageio/openimageio-3.0.8.1-r2.ebuild new file mode 100644 index 0000000000000..6b6eeffee9759 --- /dev/null +++ b/media-libs/openimageio/openimageio-3.0.8.1-r2.ebuild @@ -0,0 +1,448 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{11..14} ) + +TEST_OIIO_IMAGE_COMMIT="75099275c73a6937d40c69f9e14a006aa49fa201" +TEST_OEXR_IMAGE_COMMIT="e38ffb0790f62f05a6f083a6fa4cac150b3b7452" +inherit cuda cmake flag-o-matic python-single-r1 toolchain-funcs + +# TODO +# investigate defaulting back to CMAKE_BUILD_TYPE=Release + +DESCRIPTION="A library for reading and writing images" +HOMEPAGE=" + https://sites.google.com/site/openimageio/ + https://github.com/AcademySoftwareFoundation/OpenImageIO +" +SRC_URI=" + https://github.com/AcademySoftwareFoundation/OpenImageIO/archive/v${PV}.tar.gz + -> ${P}.tar.gz + test? ( + https://github.com/AcademySoftwareFoundation/OpenImageIO-images/archive/${TEST_OIIO_IMAGE_COMMIT}.tar.gz + -> ${PN}-oiio-test-image-${TEST_OIIO_IMAGE_COMMIT}.tar.gz + https://github.com/AcademySoftwareFoundation/openexr-images/archive/${TEST_OEXR_IMAGE_COMMIT}.tar.gz + -> ${PN}-oexr-test-image-${TEST_OEXR_IMAGE_COMMIT}.tar.gz + jpeg2k? ( + https://www.itu.int/wftp3/Public/t/testsignal/SpeImage/T803/v2002_11/J2KP4files.zip + ) + fits? ( + https://www.cv.nrao.edu/fits/data/tests/ftt4b/file001.fits + https://www.cv.nrao.edu/fits/data/tests/ftt4b/file002.fits + https://www.cv.nrao.edu/fits/data/tests/ftt4b/file003.fits + https://www.cv.nrao.edu/fits/data/tests/ftt4b/file009.fits + https://www.cv.nrao.edu/fits/data/tests/ftt4b/file012.fits + https://www.cv.nrao.edu/fits/data/tests/pg93/tst0001.fits + https://www.cv.nrao.edu/fits/data/tests/pg93/tst0003.fits + https://www.cv.nrao.edu/fits/data/tests/pg93/tst0005.fits + https://www.cv.nrao.edu/fits/data/tests/pg93/tst0006.fits + https://www.cv.nrao.edu/fits/data/tests/pg93/tst0007.fits + https://www.cv.nrao.edu/fits/data/tests/pg93/tst0008.fits + https://www.cv.nrao.edu/fits/data/tests/pg93/tst0013.fits + ) + ) +" +S="${WORKDIR}/OpenImageIO-${PV}" + +LICENSE="Apache-2.0" +SLOT="0/$(ver_cut 1-2)" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv" + +X86_CPU_FEATURES=( + aes:aes + 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="cuda debug dicom doc ffmpeg fits gif gui jpeg2k jpegxl libcxx opencv openvdb ptex python raw test +tools +truetype ${CPU_FEATURES[*]%:*}" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} ) gui? ( tools ) test? ( tools truetype )" + +RESTRICT="!test? ( test )" + +BDEPEND=" + jpeg2k? ( app-arch/unzip ) + doc? ( + app-text/doxygen + dev-texlive/texlive-bibtexextra + dev-texlive/texlive-fontsextra + dev-texlive/texlive-fontutils + dev-texlive/texlive-latex + dev-texlive/texlive-latexextra + ) +" + +# >=media-libs/libuhdr-1.3 +RDEPEND=" + app-arch/bzip2:= + dev-cpp/robin-map + dev-libs/pugixml + media-libs/libheif:= + media-libs/libjpeg-turbo:= + media-libs/libpng:= + media-libs/libwebp:= + media-libs/opencolorio:= + media-libs/openexr:= + media-libs/tiff:= + virtual/zlib:= + dicom? ( sci-libs/dcmtk ) + ffmpeg? ( media-video/ffmpeg:= ) + fits? ( sci-libs/cfitsio:= ) + gif? ( media-libs/giflib:= ) + jpeg2k? ( media-libs/openjpeg:= ) + jpegxl? ( media-libs/libjxl:= ) + opencv? ( media-libs/opencv:= ) + openvdb? ( + dev-cpp/tbb:= + media-gfx/openvdb:= + ) + ptex? ( media-libs/ptex:= ) + python? ( + ${PYTHON_DEPS} + $(python_gen_cond_dep ' + dev-python/numpy:=[${PYTHON_USEDEP}] + dev-python/pybind11[${PYTHON_USEDEP}] + ') + ) + gui? ( + media-libs/libglvnd + dev-qt/qtbase:6[gui,widgets,opengl] + ) + raw? ( media-libs/libraw:= ) + truetype? ( media-libs/freetype ) +" +DEPEND=" + dev-libs/imath:= + dev-libs/libfmt:= + ${RDEPEND} + test? ( media-fonts/droid ) +" + +DOCS=( + CHANGES.md + CREDITS.md + README.md +) + +PATCHES=( + # "${FILESDIR}/${PN}-2.5.8.0-fix-tests.patch" + "${FILESDIR}/${PN}-2.5.12.0-heif-find-fix.patch" + "${FILESDIR}/${PN}-2.5.18.0-tests-optional.patch" + # in src_prepare + # "${FILESDIR}/${PN}-2.5.12.0_heif_test.patch" + # Fix bug 965279: https://bugs.gentoo.org/965279 + "${FILESDIR}/${PN}-3.0.8.1-libheif_new.patch" + # Fix bug 965569: https://bugs.gentoo.org/965569 + "${FILESDIR}/${PN}-3.0.8.1-avcodec_close.patch" +) + +pkg_setup() { + use python && python-single-r1_pkg_setup +} + +src_prepare() { + if ! use dicom; then + rm "src/dicom.imageio" -r || die + fi + + if ! use gif; then + rm src/gif.imageio -r || die + fi + + if ! use jpeg2k; then + rm src/jpeg2000.imageio -r || die + fi + + if ! use raw; then + rm src/raw.imageio -r || die + fi + + cmake_src_prepare + cmake_comment_add_subdirectory src/fonts + + if use test ; then + ln -s "${WORKDIR}/OpenImageIO-images-${TEST_OIIO_IMAGE_COMMIT}" "${WORKDIR}/oiio-images" || die + ln -s "${WORKDIR}/openexr-images-${TEST_OEXR_IMAGE_COMMIT}" "${WORKDIR}/openexr-images" || die + + if use fits; then + mkdir -p "${WORKDIR}/fits-images/"{ftt4b,pg93} || die + for a in ${A}; do + if [[ "${a}" == file*.fits ]]; then + ln -s "${DISTDIR}/${a}" "${WORKDIR}/fits-images/ftt4b/" || die + fi + if [[ "${a}" == tst*.fits ]]; then + ln -s "${DISTDIR}/${a}" "${WORKDIR}/fits-images/pg93/" || die + fi + done + fi + + if use jpeg2k; then + ln -s "${WORKDIR}/J2KP4files" "${WORKDIR}/j2kp4files_v1_5" || die + fi + + cp testsuite/heif/ref/out-libheif1.1{2,5}-orient.txt || die + eapply "${FILESDIR}/${PN}-2.5.12.0_heif_test.patch" + fi + + mkdir "${T}/cmake" || die + + local libdir="${ESYSROOT}/usr/$(get_libdir)" + + # generate our own WebPConfig.cmake via pkg-config # 937031 + cat <<-EOF > "${T}/cmake/WebPConfig.cmake" || die + set(WebP_VERSION $(pkg-config --modversion libwebp)) + set(WEBP_VERSION \${WebP_VERSION}) + + set_and_check(WebP_INCLUDE_DIR "$(pkg-config --variable includedir libwebp)") + set(WebP_INCLUDE_DIRS \${WebP_INCLUDE_DIR}) + set(WEBP_INCLUDE_DIRS \${WebP_INCLUDE_DIR}) + set(WebP_LIBRARIES "webp") + set(WEBP_LIBRARIES "\${WebP_LIBRARIES}") + + # Create imported target WebP::sharpyuv + add_library(WebP::sharpyuv STATIC IMPORTED) + + set_target_properties(WebP::sharpyuv PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "\${WebP_INCLUDE_DIR};\${WebP_INCLUDE_DIR}/webp" + INTERFACE_LINK_LIBRARIES "m" + ) + + # Create imported target WebP::webp + add_library(WebP::webp STATIC IMPORTED) + + set_target_properties(WebP::webp PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "\${WebP_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "WebP::sharpyuv;Threads::Threads;m" + ) + + # Create imported target WebP::webpdemux + add_library(WebP::webpdemux STATIC IMPORTED) + + set_target_properties(WebP::webpdemux PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "\${WebP_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "WebP::webp" + ) + + # Import target "WebP::webp" for configuration "RelWithDebInfo" + set_property(TARGET WebP::webp APPEND PROPERTY IMPORTED_CONFIGURATIONS RELWITHDEBINFO) + set_target_properties(WebP::webp PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELWITHDEBINFO "C" + IMPORTED_LOCATION_RELWITHDEBINFO "${libdir}/libwebp.so" + ) + + list(APPEND _cmake_import_check_targets WebP::webp ) + list(APPEND _cmake_import_check_files_for_WebP::webp "${libdir}/libwebp.so" ) + + # Import target "WebP::webpdemux" for configuration "RelWithDebInfo" + set_property(TARGET WebP::webpdemux APPEND PROPERTY IMPORTED_CONFIGURATIONS RELWITHDEBINFO) + set_target_properties(WebP::webpdemux PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELWITHDEBINFO "C" + IMPORTED_LOCATION_RELWITHDEBINFO "${libdir}/libwebpdemux.so" + ) + + list(APPEND _cmake_import_check_targets WebP::webpdemux ) + list(APPEND _cmake_import_check_files_for_WebP::webpdemux "${libdir}/libwebpdemux.so" ) + + # Import target "WebP::sharpyuv" for configuration "RelWithDebInfo" + set_property(TARGET WebP::sharpyuv APPEND PROPERTY IMPORTED_CONFIGURATIONS RELWITHDEBINFO) + set_target_properties(WebP::sharpyuv PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELWITHDEBINFO "C" + IMPORTED_LOCATION_RELWITHDEBINFO "${libdir}/libsharpyuv.so" + ) + + list(APPEND _cmake_import_check_targets WebP::sharpyuv ) + list(APPEND _cmake_import_check_files_for_WebP::sharpyuv "${libdir}/libsharpyuv.so" ) + + check_required_components(WebP) + EOF +} + +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=("0") + + # This is currently needed on arm64 to get the NEON SIMD wrapper to compile the code successfully + # Even if there are no SIMD features selected, it seems like the code will turn on NEON support if it is available. + use arm64 && append-flags -flax-vector-conversions + + append-cflags "$(usex debug '-DDEBUG' '-DNDEBUG')" + append-cxxflags "$(usex debug '-DDEBUG' '-DNDEBUG')" + + local mycmakeargs=( + -DVERBOSE="no" + -DLINKSTATIC="no" + + -DTEX_BATCH_SIZE="16" # AVX512 -> 16 + -DSTOP_ON_WARNING="no" + + -DCMAKE_CXX_STANDARD="17" + -DDOWNSTREAM_CXX_STANDARD="17" + + -DCMAKE_UNITY_BUILD=OFF + # -DCMAKE_UNITY_BUILD_MODE="BATCH" + # -DCMAKE_UNITY_BUILD_BATCH_SIZE="$(nproc)" + + -DBUILD_DOCS="$(usex doc)" + # -DBUILD_OIIOUTIL_ONLY="no" + -DBUILD_TESTING="$(usex test)" + + -DINSTALL_FONTS="no" + -DINSTALL_DOCS="$(usex doc)" + + -DENABLE_DCMTK="$(usex dicom)" + -DENABLE_FFmpeg="$(usex ffmpeg)" + -DENABLE_FITS="$(usex fits)" + -DENABLE_FREETYPE="$(usex truetype)" + -DENABLE_GIF="$(usex gif)" + -DENABLE_LibRaw="$(usex raw)" + -DENABLE_Nuke="no" # not in Gentoo + -DENABLE_OpenCV="$(usex opencv)" + -DENABLE_OpenJPEG="$(usex jpeg2k)" + -DENABLE_OpenVDB="$(usex openvdb)" + -DENABLE_TBB="$(usex openvdb)" + -DENABLE_Ptex="$(usex ptex)" + + -DENABLE_libuhdr="no" # not in Gentoo + -DENABLE_WebP="yes" # missing cmake files + + -DOIIO_BUILD_TESTS="$(usex test)" + -DOIIO_BUILD_TOOLS="$(usex tools)" + -DOIIO_DOWNLOAD_MISSING_TESTDATA="no" + -DOIIO_INTERNALIZE_FMT="no" + -DOIIO_USE_CUDA="$(usex cuda)" + # -DOIIO_USE_EXR_C_API="yes" + + -DOPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH="yes" + + # -DOpenImageIO_ALWAYS_PREFER_CONFIG="yes" # breaks openexr detection + -DOpenImageIO_BUILD_STATIC_UTIL_LIBRARY="no" + + -DUSE_CCACHE="no" + -DUSE_EXTERNAL_PUGIXML="yes" + -DUSE_JXL="$(usex jpegxl)" + -DUSE_R3DSDK="no" # not in Gentoo + -DUSE_PYTHON="$(usex python)" + -DUSE_QT="$(usex gui)" + -DUSE_SIMD="$(local IFS=','; echo "${mysimd[*]}")" + + -DWebP_DIR="${T}/cmake" + ) + + if use gui; then + mycmakeargs+=( + -DUSE_IV="yes" + -DUSE_OPENGL="yes" + # -DUSE_CCACHE="yes" + # needs local -x CCACHE_CPP2=1 + # CXX_COMPILER_LAUNCHER + ) + fi + + if use python; then + mycmakeargs+=( + "-DPYTHON_VERSION=${EPYTHON#python}" + "-DPYTHON_SITE_DIR=$(python_get_sitedir)" + ) + fi + + if use test; then + mycmakeargs+=( + -DENABLE_LIBRAW="$(usex raw)" + -DENABLE_OPENJPEG="$(usex jpeg2k)" + -DENABLE_PTEX="$(usex ptex)" + ) + fi + + # checks CMAKE_COMPILER_IS_CLANG + if tc-is-clang; then + mycmakeargs+=( + -DUSE_LIBCPLUSPLUS="$(usex libcxx)" + ) + fi + + cmake_src_configure +} + +src_test() { + # A lot of tests needs to have access to the installed data files. + # So install them into the image directory now. + DESTDIR="${T}" cmake_build install + + if use cuda; then + cuda_add_sandbox -w + addwrite "/proc/self/task/" + addpredict "/dev/char/" + fi + + CMAKE_SKIP_TESTS=( + "-broken$" + + "texture-interp-bilinear.batch$" + "texture-interp-closest.batch$" + "texture-levels-stochaniso.batch$" + "texture-levels-stochmip.batch$" + + "texture-mip-onelevel.batch$" + "texture-mip-stochastictrilinear.batch$" + "texture-mip-stochasticaniso.batch$" + + "^python-imagebufalgo$" + + "^bmp$" + "^dds$" + "^ico$" + "^jpeg2000$" + "^psd$" + "^ptex$" + ) + + sed -e "s#../../../testsuite#../../../OpenImageIO-${PV}/testsuite#g" \ + -i "${CMAKE_USE_DIR}/testsuite/python-imagebufalgo/ref/out.txt" || die + + # NOTE testsuite/runtest.py + local -x CI=true + # local -x OPENIMAGEIO_CUDA=0 # prevent trying to access gpu devices + # local -x OIIO_USE_CUDA=0 + local -x CMAKE_PREFIX_PATH="${T}/usr" + local -x LD_LIBRARY_PATH + LD_LIBRARY_PATH="${T}/usr/$(get_libdir)" + # local -x OPENIMAGEIO_DEBUG_FILE + local -x OPENIMAGEIO_DEBUG=0 + + # find ${CMAKE_USE_DIR}/src/fonts -mindepth 1 -type d + local -x OPENIMAGEIO_FONTS="${CMAKE_USE_DIR}/src/fonts/Droid_Serif" + + if use python; then + local -x PYTHONPATH="${T}$(python_get_sitedir)" + fi + + cmake_src_test + + # Clean up the image directory for src_install + rm -fr "${T:?}"/usr || die +} + +src_install() { + cmake_src_install + + # remove Windows loader file + if use python; then + rm "${D}$(python_get_sitedir)/__init__.py" || die + fi +}