git: c8cc97dbaae8 - main - x11/kickoff: fix build on big-endian architectures

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Fri, 24 Jun 2022 18:38:53 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c8cc97dbaae84014e481da2bcb3b52e3f3d562c7

commit c8cc97dbaae84014e481da2bcb3b52e3f3d562c7
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2022-06-24 18:36:37 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2022-06-24 18:38:36 +0000

    x11/kickoff: fix build on big-endian architectures
    
    Backport
    https://github.com/image-rs/image/commit/ed8337afc795571795482882236acf14196e10db
    to fix build.
    
    Approved by:    Tier 2 blanket
---
 .../patch-cargo-crates_image-0.24.2_Cargo.toml     | 11 +++++++++++
 ...cargo-crates_image-0.24.2_src_codecs_openexr.rs | 11 +++++++++++
 .../patch-cargo-crates_image-0.24.2_src_image.rs   | 22 ++++++++++++++++++++++
 ...o-crates_image-0.24.2_src_io_free__functions.rs | 22 ++++++++++++++++++++++
 .../patch-cargo-crates_image-0.24.2_src_lib.rs     | 12 ++++++++++++
 5 files changed, 78 insertions(+)

diff --git a/x11/kickoff/files/patch-cargo-crates_image-0.24.2_Cargo.toml b/x11/kickoff/files/patch-cargo-crates_image-0.24.2_Cargo.toml
new file mode 100644
index 000000000000..493e1258c9b5
--- /dev/null
+++ b/x11/kickoff/files/patch-cargo-crates_image-0.24.2_Cargo.toml
@@ -0,0 +1,11 @@
+--- cargo-crates/image-0.24.2/Cargo.toml.orig	1970-01-01 00:00:01 UTC
++++ cargo-crates/image-0.24.2/Cargo.toml
+@@ -60,7 +60,7 @@ optional = true
+ version = "0.4.0"
+ optional = true
+ 
+-[dependencies.exr]
++[target.'cfg(target_endian = "little")'.dependencies.exr]
+ version = "1.4.2"
+ optional = true
+ 
diff --git a/x11/kickoff/files/patch-cargo-crates_image-0.24.2_src_codecs_openexr.rs b/x11/kickoff/files/patch-cargo-crates_image-0.24.2_src_codecs_openexr.rs
new file mode 100644
index 000000000000..7809869caacc
--- /dev/null
+++ b/x11/kickoff/files/patch-cargo-crates_image-0.24.2_src_codecs_openexr.rs
@@ -0,0 +1,11 @@
+--- cargo-crates/image-0.24.2/src/codecs/openexr.rs.orig	1973-11-29 21:33:09 UTC
++++ cargo-crates/image-0.24.2/src/codecs/openexr.rs
+@@ -20,8 +20,6 @@
+ //!     - meta data is lost
+ //!     - dwaa/dwab compressed images not supported yet by the exr library
+ //!     - (chroma) subsampling not supported yet by the exr library
+-
+-extern crate exr;
+ use exr::prelude::*;
+ 
+ use crate::error::{DecodingError, EncodingError, ImageFormatHint};
diff --git a/x11/kickoff/files/patch-cargo-crates_image-0.24.2_src_image.rs b/x11/kickoff/files/patch-cargo-crates_image-0.24.2_src_image.rs
new file mode 100644
index 000000000000..0411aa804519
--- /dev/null
+++ b/x11/kickoff/files/patch-cargo-crates_image-0.24.2_src_image.rs
@@ -0,0 +1,22 @@
+--- cargo-crates/image-0.24.2/src/image.rs.orig	1973-11-29 21:33:09 UTC
++++ cargo-crates/image-0.24.2/src/image.rs
+@@ -290,7 +290,8 @@ pub enum ImageOutputFormat {
+     /// An Image in TGA Format
+     Tga,
+ 
+-    #[cfg(feature = "openexr")]
++    #[cfg(feature = "exr")]
++    #[cfg(target_endian = "little")]
+     /// An Image in OpenEXR Format
+     OpenExr,
+ 
+@@ -327,7 +328,8 @@ impl From<ImageFormat> for ImageOutputFormat {
+             ImageFormat::Farbfeld => ImageOutputFormat::Farbfeld,
+             #[cfg(feature = "tga")]
+             ImageFormat::Tga => ImageOutputFormat::Tga,
+-            #[cfg(feature = "openexr")]
++            #[cfg(feature = "exr")]
++            #[cfg(target_endian = "little")]
+             ImageFormat::OpenExr => ImageOutputFormat::OpenExr,
+             #[cfg(feature = "tiff")]
+             ImageFormat::Tiff => ImageOutputFormat::Tiff,
diff --git a/x11/kickoff/files/patch-cargo-crates_image-0.24.2_src_io_free__functions.rs b/x11/kickoff/files/patch-cargo-crates_image-0.24.2_src_io_free__functions.rs
new file mode 100644
index 000000000000..464899d7a12f
--- /dev/null
+++ b/x11/kickoff/files/patch-cargo-crates_image-0.24.2_src_io_free__functions.rs
@@ -0,0 +1,22 @@
+--- cargo-crates/image-0.24.2/src/io/free_functions.rs.orig	1973-11-29 21:33:09 UTC
++++ cargo-crates/image-0.24.2/src/io/free_functions.rs
+@@ -72,7 +72,8 @@ pub(crate) fn load_decoder<R: BufRead + Seek, V: Decod
+         image::ImageFormat::Ico => visitor.visit_decoder(ico::IcoDecoder::new(r)?),
+         #[cfg(feature = "hdr")]
+         image::ImageFormat::Hdr => visitor.visit_decoder(hdr::HdrAdapter::new(BufReader::new(r))?),
+-        #[cfg(feature = "openexr")]
++        #[cfg(feature = "exr")]
++        #[cfg(target_endian = "little")]
+         image::ImageFormat::OpenExr => visitor.visit_decoder(openexr::OpenExrDecoder::new(r)?),
+         #[cfg(feature = "pnm")]
+         image::ImageFormat::Pnm => visitor.visit_decoder(pnm::PnmDecoder::new(r)?),
+@@ -230,7 +231,8 @@ pub(crate) fn write_buffer_impl<W: std::io::Write + Se
+         ImageOutputFormat::Tga => {
+             tga::TgaEncoder::new(buffered_write).write_image(buf, width, height, color)
+         }
+-        #[cfg(feature = "openexr")]
++        #[cfg(feature = "exr")]
++        #[cfg(target_endian = "little")]
+         ImageOutputFormat::OpenExr => {
+             openexr::OpenExrEncoder::new(buffered_write).write_image(buf, width, height, color)
+         }
diff --git a/x11/kickoff/files/patch-cargo-crates_image-0.24.2_src_lib.rs b/x11/kickoff/files/patch-cargo-crates_image-0.24.2_src_lib.rs
new file mode 100644
index 000000000000..c5a56924cdd3
--- /dev/null
+++ b/x11/kickoff/files/patch-cargo-crates_image-0.24.2_src_lib.rs
@@ -0,0 +1,12 @@
+--- cargo-crates/image-0.24.2/src/lib.rs.orig	1973-11-29 21:33:09 UTC
++++ cargo-crates/image-0.24.2/src/lib.rs
+@@ -234,7 +234,8 @@ pub mod codecs {
+     pub mod ico;
+     #[cfg(feature = "jpeg")]
+     pub mod jpeg;
+-    #[cfg(feature = "openexr")]
++    #[cfg(feature = "exr")]
++    #[cfg(target_endian = "little")]
+     pub mod openexr;
+     #[cfg(feature = "png")]
+     pub mod png;