[smartcardpp] Backported upstream patches to fix the build with gcc 4.7

Kalev Lember kalev at fedoraproject.org
Sat Feb 25 19:28:24 UTC 2012


commit 901add2d38216b1779994892e44672e6b636b21a
Author: Kalev Lember <kalevlember at gmail.com>
Date:   Sat Feb 25 21:26:16 2012 +0200

    Backported upstream patches to fix the build with gcc 4.7

 0001-Include-unistd.h-for-sleep.patch              |   33 ++++++++++++
 ...mpat_getopt-build-with-getopt.h-installed.patch |   52 ++++++++++++++++++++
 smartcardpp.spec                                   |   10 +++-
 3 files changed, 94 insertions(+), 1 deletions(-)
---
diff --git a/0001-Include-unistd.h-for-sleep.patch b/0001-Include-unistd.h-for-sleep.patch
new file mode 100644
index 0000000..576c45d
--- /dev/null
+++ b/0001-Include-unistd.h-for-sleep.patch
@@ -0,0 +1,33 @@
+From d0c529db8fee32fed96ac94d0c1cab9019c310b8 Mon Sep 17 00:00:00 2001
+From: kalevlember <kalevlember at 0d7e1ef0-d974-fc83-f0b3-ccc071561e0e>
+Date: Sat, 25 Feb 2012 19:21:05 +0000
+Subject: [PATCH 1/2] Include unistd.h for sleep()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+With GCC 4.7 the build failed with:
+CardBase.cpp: In member function ‘virtual ByteVec CardBase::execute(ByteVec, int)’:
+CardBase.cpp:234:12: error: ‘sleep’ was not declared in this scope
+
+git-svn-id: https://esteid.googlecode.com/svn/smartcardpp/trunk@3966 0d7e1ef0-d974-fc83-f0b3-ccc071561e0e
+---
+ CardBase.cpp |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git a/CardBase.cpp b/CardBase.cpp
+index 0041293..a40e0d1 100644
+--- a/CardBase.cpp
++++ b/CardBase.cpp
+@@ -20,6 +20,8 @@
+ 	#include <Windows.h>
+ 	#include <WinNT.h>
+ 	#include <Psapi.h>
++#else
++#include <unistd.h>
+ #endif
+ 
+ #define NULLWSTR(a) (a == NULL ? L"<NULL>" : a)
+-- 
+1.7.9.1
+
diff --git a/0002-Fix-compat_getopt-build-with-getopt.h-installed.patch b/0002-Fix-compat_getopt-build-with-getopt.h-installed.patch
new file mode 100644
index 0000000..6395aa0
--- /dev/null
+++ b/0002-Fix-compat_getopt-build-with-getopt.h-installed.patch
@@ -0,0 +1,52 @@
+From e766fb10fe300a1f6f5be72bd98446adbe098fe9 Mon Sep 17 00:00:00 2001
+From: kalevlember <kalevlember at 0d7e1ef0-d974-fc83-f0b3-ccc071561e0e>
+Date: Sat, 25 Feb 2012 19:21:10 +0000
+Subject: [PATCH 2/2] Fix compat_getopt build with getopt.h installed
+
+Use cmake to detect getopt.h presence and write out a config.h with the
+result.  compat_getopt.h includes config.h and disables the compat code
+when HAVE_GETOPT_H is defined.
+
+git-svn-id: https://esteid.googlecode.com/svn/smartcardpp/trunk@3967 0d7e1ef0-d974-fc83-f0b3-ccc071561e0e
+---
+ CMakeLists.txt |    6 ++++++
+ config.h.in    |    6 ++++++
+ 2 files changed, 12 insertions(+), 0 deletions(-)
+ create mode 100644 config.h.in
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index be915d6..210da16 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -21,10 +21,16 @@ if(MSVC)
+ endif(MSVC)
+ 
+ include_directories(
++    ${CMAKE_CURRENT_BINARY_DIR}
+     ${CMAKE_CURRENT_SOURCE_DIR}
+     ${PCSCLITE_INCLUDE_DIR}
+ )
+ 
++include(CheckIncludeFiles)
++check_include_files(getopt.h HAVE_GETOPT_H)
++configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
++add_definitions(-DHAVE_CONFIG_H)
++
+ if(MSVC AND USE_STATIC_RUNTIME)
+     message(STATUS "Building with static MSVC runtime")
+     foreach(flag_var
+diff --git a/config.h.in b/config.h.in
+new file mode 100644
+index 0000000..72b65bf
+--- /dev/null
++++ b/config.h.in
+@@ -0,0 +1,6 @@
++#ifndef CONFIG_H
++#define CONFIG_H
++
++#cmakedefine HAVE_GETOPT_H
++
++#endif //CONFIG_H
+-- 
+1.7.9.1
+
diff --git a/smartcardpp.spec b/smartcardpp.spec
index 16ffbbb..907eb94 100644
--- a/smartcardpp.spec
+++ b/smartcardpp.spec
@@ -1,12 +1,15 @@
 Name:           smartcardpp
 Version:        0.3.0
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        Library for accessing smart cards
 
 Group:          System Environment/Libraries
 License:        BSD
 URL:            http://code.google.com/p/esteid/
 Source0:        http://esteid.googlecode.com/files/%{name}-%{version}.tar.bz2
+# Upstream patches to fix build with gcc 4.7
+Patch0:         0001-Include-unistd.h-for-sleep.patch
+Patch1:         0002-Fix-compat_getopt-build-with-getopt.h-installed.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  cmake
@@ -31,6 +34,8 @@ developing applications that use %{name}.
 
 %prep
 %setup -q
+%patch0 -p1 -b .unistd_h
+%patch1 -p1 -b .getopt
 
 
 %build
@@ -70,6 +75,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Sat Feb 25 2012 Kalev Lember <kalevlember at gmail.com> - 0.3.0-3
+- Backported upstream patches to fix the build with gcc 4.7
+
 * Sat Jan 14 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.3.0-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 


More information about the scm-commits mailing list