[packages/exiv2] fix build on platforms without control flow protection
atler
atler at pld-linux.org
Wed Nov 4 01:21:18 CET 2020
commit 88991cbd2ebd2466c72381e23533b1c21a1f3798
Author: Jan Palus <atler at pld-linux.org>
Date: Wed Nov 4 01:00:52 2020 +0100
fix build on platforms without control flow protection
compiler_flags.patch | 31 +++++++++++++++++++++++++++++++
exiv2.spec | 2 ++
2 files changed, 33 insertions(+)
---
diff --git a/exiv2.spec b/exiv2.spec
index 106ac6b..1c18405 100644
--- a/exiv2.spec
+++ b/exiv2.spec
@@ -15,6 +15,7 @@ Source0: https://www.exiv2.org/builds/%{name}-%{version}-Source.tar.gz
# Source0-md5: 68a59595e8617284b2e1eee528ae1f77
Patch0: cmake.patch
Patch1: %{name}-no-xmpsdk-install.patch
+Patch2: compiler_flags.patch
URL: https://www.exiv2.org/
BuildRequires: cmake >= 3.3.2
%{?with_curl:BuildRequires: curl-devel}
@@ -65,6 +66,7 @@ Pliki programistyczne biblioteki do obróbki metadanych EXIF i IPTC.
%setup -q -n %{name}-%{version}-Source
%patch0 -p1
%patch1 -p1
+%patch2 -p1
%build
install -d build
diff --git a/compiler_flags.patch b/compiler_flags.patch
new file mode 100644
index 0000000..af74c71
--- /dev/null
+++ b/compiler_flags.patch
@@ -0,0 +1,31 @@
+--- exiv2-0.27.3-Source/cmake/compilerFlags.cmake.orig 2020-06-30 15:33:22.000000000 +0200
++++ exiv2-0.27.3-Source/cmake/compilerFlags.cmake 2020-11-04 00:53:19.007731270 +0100
+@@ -1,4 +1,5 @@
+ # These flags applies to exiv2lib, the applications, and to the xmp code
++include(CheckCXXCompilerFlag)
+
+ if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN
+ if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
+@@ -25,13 +26,16 @@
+
+ # This fails under Fedora, MinGW GCC 8.3.0 and CYGWIN/MSYS 9.3.0
+ if (NOT (MINGW OR CMAKE_HOST_SOLARIS OR CYGWIN OR MSYS) )
+- if (COMPILER_IS_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
+- add_compile_options(-fstack-clash-protection -fcf-protection)
++ check_cxx_compiler_flag(-fstack-clash-protection HAS_FSTACK_CLASH_PROTECTION)
++ check_cxx_compiler_flag(-fcf-protection HAS_FCF_PROTECTION)
++ check_cxx_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG)
++ if(HAS_FSTACK_CLASH_PROTECTION)
++ add_compile_options(-fstack-clash-protection)
+ endif()
+-
+- if( (COMPILER_IS_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 5.0) # Not in GCC 4.8
+- OR (COMPILER_IS_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 3.7) # Not in Clang 3.4.2
+- )
++ if(HAS_FCF_PROTECTION)
++ add_compile_options(-fcf-protection)
++ endif()
++ if(HAS_FSTACK_PROTECTOR_STRONG)
+ add_compile_options(-fstack-protector-strong)
+ endif()
+ endif()
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/exiv2.git/commitdiff/88991cbd2ebd2466c72381e23533b1c21a1f3798
More information about the pld-cvs-commit
mailing list