Skip to content

Commit

Permalink
gwenview: fix the build
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 committed Jul 14, 2024
1 parent 8e1b91f commit 101ed3a
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 3 deletions.
14 changes: 11 additions & 3 deletions kde/gwenview/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PortGroup kde4 1.1

name gwenview
version 4.14.3
revision 8
revision 9
categories kde kde4
license GPL-2+
maintainers nomaintainer
Expand All @@ -19,8 +19,8 @@ checksums rmd160 493754167864154be07772bc85be168fb5a2b755 \
sha256 2032d18bc20ea490f3d1298e015ffac2a7b96eb7a76c02578df0713c1ab427a0 \
size 2910652

#Binaries do not link directly to openssl, nor use the ssl backend of kdelibs4,
#nor links to libkimap or libmailtransport from kdepimlibs4
# Binaries do not link directly to openssl, nor use the ssl backend of kdelibs4,
# nor links to libkimap or libmailtransport from kdepimlibs4
license_noconflict openssl

depends_lib-append port:exiv2 \
Expand All @@ -35,6 +35,14 @@ depends_lib-append port:exiv2 \

patchfiles patch-fileutils.diff

# /opt/local/include/exiv2/slice.hpp: error: exception handling disabled, use -fexceptions to enable
patchfiles-append patch-fexceptions.diff

patchfiles-append patch-exiv2.diff

compiler.cxx_standard \
2011

# kde4-baseapps is not universal
universal_variant no

Expand Down
73 changes: 73 additions & 0 deletions kde/gwenview/files/patch-exiv2.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
--- lib/exiv2imageloader.cpp 2014-09-30 17:11:42.000000000 +0800
+++ lib/exiv2imageloader.cpp 2024-07-14 14:12:10.000000000 +0800
@@ -57,17 +57,8 @@
try {
d->mImage = Exiv2::ImageFactory::open((unsigned char*)data.constData(), data.size());
d->mImage->readMetadata();
-#if EXIV2_VERSION >= EXIV2_MAKE_VERSION(0, 14, 0)
- // For some unknown reason, trying to catch Exiv2::Error fails with Exiv2
- // >=0.14. For now, just catch std::exception. I would welcome any
- // explanation.
} catch (const std::exception& error) {
d->mErrorMessage = error.what();
-#else
- // In libexiv2 0.12, Exiv2::Error::what() returns an std::string.
- } catch (const Exiv2::Error& error) {
- d->mErrorMessage = error.what().c_str();
-#endif
return false;
}
return true;

--- lib/imagemetainfomodel.cpp 2014-09-30 17:11:42.000000000 +0800
+++ lib/imagemetainfomodel.cpp 2024-07-14 14:13:06.000000000 +0800
@@ -280,7 +280,7 @@
} else {
hash.insert(key, new MetaInfoGroup::Entry(key, label, value));
}
- } catch (const Exiv2::Error& error) {
+ } catch (const std::exception& error) {
kWarning() << "Failed to read some meta info:" << error.what();
}
}

--- lib/timeutils.cpp 2014-09-30 17:11:42.000000000 +0800
+++ lib/timeutils.cpp 2024-07-14 14:25:02.000000000 +0800
@@ -125,7 +125,7 @@

realTime = dt;
return true;
- } catch (const Exiv2::Error& error) {
+ } catch (const std::exception& error) {
kWarning() << "Failed to read date from exif header of" << path << ". Error:" << error.what();
return false;
}

--- lib/jpegcontent.cpp 2014-09-30 17:11:42.000000000 +0800
+++ lib/jpegcontent.cpp 2024-07-14 14:22:28.000000000 +0800
@@ -540,12 +540,8 @@
{
QImage image;
if (!d->mExifData.empty()) {
-#if(EXIV2_TEST_VERSION(0,17,91))
Exiv2::ExifThumbC thumb(d->mExifData);
Exiv2::DataBuf thumbnail = thumb.copy();
-#else
- Exiv2::DataBuf thumbnail = d->mExifData.copyThumbnail();
-#endif
image.loadFromData(thumbnail.pData_, thumbnail.size_);
}
return image;
@@ -566,12 +562,8 @@
return;
}

-#if (EXIV2_TEST_VERSION(0,17,91))
Exiv2::ExifThumb thumb(d->mExifData);
thumb.setJpegThumbnail((unsigned char*)array.data(), array.size());
-#else
- d->mExifData.setJpegThumbnail((unsigned char*)array.data(), array.size());
-#endif
}

bool JpegContent::save(const QString& path)
12 changes: 12 additions & 0 deletions kde/gwenview/files/patch-fexceptions.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- CMakeLists.txt 2014-09-30 17:11:42.000000000 +0800
+++ CMakeLists.txt 2024-07-14 13:59:01.000000000 +0800
@@ -84,6 +84,9 @@
)
endif()

+string(REGEX REPLACE "-fno-exceptions -DQT_NO_EXCEPTIONS" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
+
## dirs to build
add_subdirectory(lib)
add_subdirectory(app)

0 comments on commit 101ed3a

Please sign in to comment.