]> git.pld-linux.org Git - packages/exiv2.git/commitdiff
fix build on platforms without control flow protection
authorJan Palus <atler@pld-linux.org>
Wed, 4 Nov 2020 00:00:52 +0000 (01:00 +0100)
committerJan Palus <atler@pld-linux.org>
Wed, 4 Nov 2020 00:00:52 +0000 (01:00 +0100)
compiler_flags.patch [new file with mode: 0644]
exiv2.spec

diff --git a/compiler_flags.patch b/compiler_flags.patch
new file mode 100644 (file)
index 0000000..af74c71
--- /dev/null
@@ -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\r
++include(CheckCXXCompilerFlag)\r
\r
+ if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN\r
+     if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)\r
+@@ -25,13 +26,16 @@
\r
+         # This fails under Fedora, MinGW GCC 8.3.0 and CYGWIN/MSYS 9.3.0\r
+         if (NOT (MINGW OR CMAKE_HOST_SOLARIS OR CYGWIN OR MSYS) )\r
+-            if (COMPILER_IS_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)\r
+-                add_compile_options(-fstack-clash-protection -fcf-protection)\r
++            check_cxx_compiler_flag(-fstack-clash-protection HAS_FSTACK_CLASH_PROTECTION)\r
++            check_cxx_compiler_flag(-fcf-protection HAS_FCF_PROTECTION)\r
++            check_cxx_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG)\r
++            if(HAS_FSTACK_CLASH_PROTECTION)\r
++                add_compile_options(-fstack-clash-protection)\r
+             endif()\r
+-\r
+-            if( (COMPILER_IS_GCC   AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 5.0) # Not in GCC 4.8\r
+-            OR  (COMPILER_IS_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 3.7) # Not in Clang 3.4.2\r
+-            )\r
++            if(HAS_FCF_PROTECTION)\r
++                add_compile_options(-fcf-protection)\r
++            endif()\r
++            if(HAS_FSTACK_PROTECTOR_STRONG)\r
+                 add_compile_options(-fstack-protector-strong)\r
+             endif()\r
+         endif()\r
index 106ac6b83d758e5aff4581f8ce6136c9e6fc2e09..1c1840599f043b0e0041ee30a1168e14e5136c1f 100644 (file)
@@ -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
This page took 0.242656 seconds and 4 git commands to generate.