changeset 566:6a3e2ca7a7a0 laaw

the client library compiles with LSB 4.0
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 24 Sep 2013 15:12:51 +0200
parents 06119badb2b0
children 3f27814104f7
files Resources/CMake/Compiler.cmake Resources/CMake/OpenSslConfiguration.cmake Resources/Patches/openssl-lsb.diff
diffstat 3 files changed, 127 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/Compiler.cmake	Tue Sep 24 10:43:03 2013 +0200
+++ b/Resources/CMake/Compiler.cmake	Tue Sep 24 15:12:51 2013 +0200
@@ -30,9 +30,9 @@
 
 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
   if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
-    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${LSB_PATH}/include")
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdinc++ -I${LSB_PATH}/include -I${LSB_PATH}/include/c++ -I${LSB_PATH}/include/c++/backward -fpermissive")
-    SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -L${LSB_LIBPATH}")
+    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -I${LSB_PATH}/include")
+    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -nostdinc++ -I${LSB_PATH}/include -I${LSB_PATH}/include/c++ -I${LSB_PATH}/include/c++/backward -fpermissive")
+    SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH}")
   endif()
 
   add_definitions(
--- a/Resources/CMake/OpenSslConfiguration.cmake	Tue Sep 24 10:43:03 2013 +0200
+++ b/Resources/CMake/OpenSslConfiguration.cmake	Tue Sep 24 15:12:51 2013 +0200
@@ -186,6 +186,12 @@
       ${OPENSSL_SOURCES}
       PROPERTIES COMPILE_DEFINITIONS
       "OPENSSL_SYSNAME_WIN32;SO_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN")
+
+  elseif (${CMAKE_SYSTEM_VERSION} STREQUAL "LinuxStandardBase")
+    execute_process(
+      COMMAND patch ui_openssl.c ${CMAKE_SOURCE_DIR}/Resources/Patches/openssl-lsb.diff
+      WORKING_DIRECTORY ${OPENSSL_SOURCES_DIR}/crypto/ui
+      )
   endif()
 
   #add_library(OpenSSL STATIC ${OPENSSL_SOURCES})
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Patches/openssl-lsb.diff	Tue Sep 24 15:12:51 2013 +0200
@@ -0,0 +1,118 @@
+--- ui_openssl.c.orig	2013-09-24 15:06:54.264420779 +0200
++++ ui_openssl.c	2013-09-24 14:22:43.512312998 +0200
+@@ -291,7 +291,7 @@
+ static unsigned short channel = 0;
+ #else
+ #if !defined(OPENSSL_SYS_MSDOS) || defined(__DJGPP__)
+-static TTY_STRUCT tty_orig,tty_new;
++//static TTY_STRUCT tty_orig,tty_new;
+ #endif
+ #endif
+ static FILE *tty_in, *tty_out;
+@@ -475,106 +475,21 @@
+ /* Internal functions to open, handle and close a channel to the console.  */
+ static int open_console(UI *ui)
+ 	{
+-	CRYPTO_w_lock(CRYPTO_LOCK_UI);
+-	is_a_tty = 1;
+-
+-#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS)
+-	tty_in=stdin;
+-	tty_out=stderr;
+-#else
+-#  ifdef OPENSSL_SYS_MSDOS
+-#    define DEV_TTY "con"
+-#  else
+-#    define DEV_TTY "/dev/tty"
+-#  endif
+-	if ((tty_in=fopen(DEV_TTY,"r")) == NULL)
+-		tty_in=stdin;
+-	if ((tty_out=fopen(DEV_TTY,"w")) == NULL)
+-		tty_out=stderr;
+-#endif
+-
+-#if defined(TTY_get) && !defined(OPENSSL_SYS_VMS)
+- 	if (TTY_get(fileno(tty_in),&tty_orig) == -1)
+-		{
+-#ifdef ENOTTY
+-		if (errno == ENOTTY)
+-			is_a_tty=0;
+-		else
+-#endif
+-#ifdef EINVAL
+-		/* Ariel Glenn ariel@columbia.edu reports that solaris
+-		 * can return EINVAL instead.  This should be ok */
+-		if (errno == EINVAL)
+-			is_a_tty=0;
+-		else
+-#endif
+-			return 0;
+-		}
+-#endif
+-#ifdef OPENSSL_SYS_VMS
+-	status = sys$assign(&terminal,&channel,0,0);
+-	if (status != SS$_NORMAL)
+-		return 0;
+-	status=sys$qiow(0,channel,IO$_SENSEMODE,&iosb,0,0,tty_orig,12,0,0,0,0);
+-	if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL))
+-		return 0;
+-#endif
+ 	return 1;
+ 	}
+ 
+ static int noecho_console(UI *ui)
+ 	{
+-#ifdef TTY_FLAGS
+-	memcpy(&(tty_new),&(tty_orig),sizeof(tty_orig));
+-	tty_new.TTY_FLAGS &= ~ECHO;
+-#endif
+-
+-#if defined(TTY_set) && !defined(OPENSSL_SYS_VMS)
+-	if (is_a_tty && (TTY_set(fileno(tty_in),&tty_new) == -1))
+-		return 0;
+-#endif
+-#ifdef OPENSSL_SYS_VMS
+-	tty_new[0] = tty_orig[0];
+-	tty_new[1] = tty_orig[1] | TT$M_NOECHO;
+-	tty_new[2] = tty_orig[2];
+-	status = sys$qiow(0,channel,IO$_SETMODE,&iosb,0,0,tty_new,12,0,0,0,0);
+-	if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL))
+-		return 0;
+-#endif
+ 	return 1;
+ 	}
+ 
+ static int echo_console(UI *ui)
+ 	{
+-#if defined(TTY_set) && !defined(OPENSSL_SYS_VMS)
+-	memcpy(&(tty_new),&(tty_orig),sizeof(tty_orig));
+-	tty_new.TTY_FLAGS |= ECHO;
+-#endif
+-
+-#if defined(TTY_set) && !defined(OPENSSL_SYS_VMS)
+-	if (is_a_tty && (TTY_set(fileno(tty_in),&tty_new) == -1))
+-		return 0;
+-#endif
+-#ifdef OPENSSL_SYS_VMS
+-	tty_new[0] = tty_orig[0];
+-	tty_new[1] = tty_orig[1] & ~TT$M_NOECHO;
+-	tty_new[2] = tty_orig[2];
+-	status = sys$qiow(0,channel,IO$_SETMODE,&iosb,0,0,tty_new,12,0,0,0,0);
+-	if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL))
+-		return 0;
+-#endif
+ 	return 1;
+ 	}
+ 
+ static int close_console(UI *ui)
+ 	{
+-	if (tty_in != stdin) fclose(tty_in);
+-	if (tty_out != stderr) fclose(tty_out);
+-#ifdef OPENSSL_SYS_VMS
+-	status = sys$dassgn(channel);
+-#endif
+-	CRYPTO_w_unlock(CRYPTO_LOCK_UI);
+-
+ 	return 1;
+ 	}
+