changeset 3722:a49d49d945c9

fixing openssl compilation
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 05 Mar 2020 19:48:19 +0100
parents c575fb0adf91
children cc6d4edfe8fe
files Resources/CMake/DcmtkConfigurationStatic-3.6.5.cmake Resources/CMake/OpenSslConfigurationStatic-1.1.1.cmake Resources/Patches/dcmtk-3.6.5.patch Resources/Patches/openssl-1.1.1d-conf.h.in
diffstat 4 files changed, 174 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/DcmtkConfigurationStatic-3.6.5.cmake	Thu Mar 05 18:34:25 2020 +0100
+++ b/Resources/CMake/DcmtkConfigurationStatic-3.6.5.cmake	Thu Mar 05 19:48:19 2020 +0100
@@ -187,7 +187,9 @@
 
 if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND
     CMAKE_COMPILER_IS_GNUCXX)
+  # This is MinGW
   add_definitions(
     -DDCMTK_LOG4CPLUS_AVOID_WIN32_FLS
+    -DDCMTK_LOG4CPLUS_SINGLE_THREADED
     )
 endif()
--- a/Resources/CMake/OpenSslConfigurationStatic-1.1.1.cmake	Thu Mar 05 18:34:25 2020 +0100
+++ b/Resources/CMake/OpenSslConfigurationStatic-1.1.1.cmake	Thu Mar 05 19:48:19 2020 +0100
@@ -21,12 +21,10 @@
   file(WRITE ${OPENSSL_SOURCES_DIR}/crypto/include/internal/bn_conf.h "")
   file(WRITE ${OPENSSL_SOURCES_DIR}/crypto/include/internal/dso_conf.h "")
 
-  # Enabling deprecated API is needed for civetweb
-  # file(WRITE ${OPENSSL_SOURCES_DIR}/include/openssl/opensslconf.h "
-  # #define DEPRECATEDIN_1_2_0(f) f;
-  # #define DEPRECATEDIN_1_1_0(f) f;
-  # #define DEPRECATEDIN_0_9_8(f) f;
-  # ")
+  configure_file(
+    ${ORTHANC_ROOT}/Resources/Patches/openssl-1.1.1d-conf.h.in
+    ${OPENSSL_SOURCES_DIR}/include/openssl/opensslconf.h
+    )
 
   # Apply the patches
   execute_process(
@@ -73,16 +71,9 @@
   -DOPENSSL_NO_RIPEMD
 
   -DOPENSSLDIR="/usr/local/ssl"
-  -DOPENSSL_NO_ERR
   )
 
 
-if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
-  # In order for "crypto/mem_sec.c" to compile on LSB
-  add_definitions(-DOPENSSL_NO_SECURE_MEMORY)
-endif()
-
-
 include_directories(
   ${OPENSSL_SOURCES_DIR}
   ${OPENSSL_SOURCES_DIR}/crypto
@@ -210,6 +201,8 @@
   ${OPENSSL_SOURCES_DIR}/crypto/ppccap.c
   ${OPENSSL_SOURCES_DIR}/crypto/s390xcap.c
   ${OPENSSL_SOURCES_DIR}/crypto/sparcv9cap.c
+  ${OPENSSL_SOURCES_DIR}/crypto/poly1305/poly1305_base2_44.c  # Cannot be compiled with MinGW
+  ${OPENSSL_SOURCES_DIR}/crypto/poly1305/poly1305_ieee754.c  # Cannot be compiled with MinGW
   )
 
 # Check out "${OPENSSL_SOURCES_DIR}/Configurations/README": "This is
@@ -223,11 +216,29 @@
   set(OPENSSL_DEFINITIONS
     "${OPENSSL_DEFINITIONS};OPENSSL_SYSNAME_WIN32;SO_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;NO_WINDOWS_BRAINDEATH")
   
-  if (ENABLE_OPENSSL_ENGINES)
-    link_libraries(crypt32)
+  #if (ENABLE_OPENSSL_ENGINES)
+  #  link_libraries(crypt32)
+  #endif()
+
+  add_definitions(
+    -DOPENSSL_RAND_SEED_OS  # ${OPENSSL_SOURCES_DIR}/crypto/rand/rand_win.c
+    )
+
+  if (CMAKE_COMPILER_IS_GNUCXX)  # MinGW
+    add_definitions(
+      -DOPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
+      )
   endif()
+  
+elseif ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
+  # In order for "crypto/mem_sec.c" to compile on LSB
+  add_definitions(
+    -DOPENSSL_NO_SECURE_MEMORY
+    -DOPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
+    )
 endif()
 
+
 set_source_files_properties(
   ${OPENSSL_SOURCES}
     PROPERTIES COMPILE_DEFINITIONS
--- a/Resources/Patches/dcmtk-3.6.5.patch	Thu Mar 05 18:34:25 2020 +0100
+++ b/Resources/Patches/dcmtk-3.6.5.patch	Thu Mar 05 19:48:19 2020 +0100
@@ -1,6 +1,6 @@
 diff -urEb dcmtk-3.6.5.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h dcmtk-3.6.5/dcmdata/include/dcmtk/dcmdata/dcdict.h
---- dcmtk-3.6.5.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h	2020-03-05 14:04:24.601846050 +0100
-+++ dcmtk-3.6.5/dcmdata/include/dcmtk/dcmdata/dcdict.h	2020-03-05 14:05:12.517692125 +0100
+--- dcmtk-3.6.5.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h	2020-03-05 19:43:37.678302817 +0100
++++ dcmtk-3.6.5/dcmdata/include/dcmtk/dcmdata/dcdict.h	2020-03-05 19:43:41.198312828 +0100
 @@ -152,6 +152,12 @@
      /// returns an iterator to the end of the repeating tag dictionary
      DcmDictEntryListIterator repeatingEnd() { return repDict.end(); }
@@ -15,8 +15,8 @@
  
      /** private undefined assignment operator
 diff -urEb dcmtk-3.6.5.orig/dcmdata/libsrc/dcdict.cc dcmtk-3.6.5/dcmdata/libsrc/dcdict.cc
---- dcmtk-3.6.5.orig/dcmdata/libsrc/dcdict.cc	2020-03-05 14:04:24.605846037 +0100
-+++ dcmtk-3.6.5/dcmdata/libsrc/dcdict.cc	2020-03-05 14:05:37.605611405 +0100
+--- dcmtk-3.6.5.orig/dcmdata/libsrc/dcdict.cc	2020-03-05 19:43:37.682302828 +0100
++++ dcmtk-3.6.5/dcmdata/libsrc/dcdict.cc	2020-03-05 19:43:41.198312828 +0100
 @@ -900,3 +900,6 @@
    wrlock().clear();
    wrunlock();
@@ -25,8 +25,8 @@
 +
 +#include "dcdict_orthanc.cc"
 diff -urEb dcmtk-3.6.5.orig/dcmdata/libsrc/dcpxitem.cc dcmtk-3.6.5/dcmdata/libsrc/dcpxitem.cc
---- dcmtk-3.6.5.orig/dcmdata/libsrc/dcpxitem.cc	2020-03-05 14:04:24.605846037 +0100
-+++ dcmtk-3.6.5/dcmdata/libsrc/dcpxitem.cc	2020-03-05 14:06:10.033506933 +0100
+--- dcmtk-3.6.5.orig/dcmdata/libsrc/dcpxitem.cc	2020-03-05 19:43:37.682302828 +0100
++++ dcmtk-3.6.5/dcmdata/libsrc/dcpxitem.cc	2020-03-05 19:43:41.198312828 +0100
 @@ -36,6 +36,9 @@
  #include "dcmtk/dcmdata/dcostrma.h"    /* for class DcmOutputStream */
  #include "dcmtk/dcmdata/dcwcache.h"    /* for class DcmWriteCache */
@@ -38,8 +38,8 @@
  // ********************************
  
 diff -urEb dcmtk-3.6.5.orig/oflog/include/dcmtk/oflog/thread/syncpub.h dcmtk-3.6.5/oflog/include/dcmtk/oflog/thread/syncpub.h
---- dcmtk-3.6.5.orig/oflog/include/dcmtk/oflog/thread/syncpub.h	2020-03-05 14:04:24.609846024 +0100
-+++ dcmtk-3.6.5/oflog/include/dcmtk/oflog/thread/syncpub.h	2020-03-05 14:06:52.469370023 +0100
+--- dcmtk-3.6.5.orig/oflog/include/dcmtk/oflog/thread/syncpub.h	2020-03-05 19:43:37.686302839 +0100
++++ dcmtk-3.6.5/oflog/include/dcmtk/oflog/thread/syncpub.h	2020-03-05 19:43:41.198312828 +0100
 @@ -63,7 +63,7 @@
  
  DCMTK_LOG4CPLUS_INLINE_EXPORT
@@ -85,9 +85,23 @@
  { }
  
  
+diff -urEb dcmtk-3.6.5.orig/oflog/libsrc/oflog.cc dcmtk-3.6.5/oflog/libsrc/oflog.cc
+--- dcmtk-3.6.5.orig/oflog/libsrc/oflog.cc	2020-03-05 19:43:37.690302851 +0100
++++ dcmtk-3.6.5/oflog/libsrc/oflog.cc	2020-03-05 19:43:54.622350144 +0100
+@@ -19,6 +19,10 @@
+  *
+  */
+ 
++#ifdef __MINGW32__
++#  include <winsock.h>
++#endif
++
+ #include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */
+ #include "dcmtk/oflog/oflog.h"
+ 
 diff -urEb dcmtk-3.6.5.orig/ofstd/include/dcmtk/ofstd/offile.h dcmtk-3.6.5/ofstd/include/dcmtk/ofstd/offile.h
---- dcmtk-3.6.5.orig/ofstd/include/dcmtk/ofstd/offile.h	2020-03-05 14:04:24.637845935 +0100
-+++ dcmtk-3.6.5/ofstd/include/dcmtk/ofstd/offile.h	2020-03-05 14:07:17.097290468 +0100
+--- dcmtk-3.6.5.orig/ofstd/include/dcmtk/ofstd/offile.h	2020-03-05 19:43:37.714302919 +0100
++++ dcmtk-3.6.5/ofstd/include/dcmtk/ofstd/offile.h	2020-03-05 19:43:41.198312828 +0100
 @@ -575,7 +575,7 @@
     */
    void setlinebuf()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Patches/openssl-1.1.1d-conf.h.in	Thu Mar 05 19:48:19 2020 +0100
@@ -0,0 +1,122 @@
+/*
+ * {- join("\n * ", @autowarntext) -}
+ *
+ * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the OpenSSL license (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include <openssl/opensslv.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+#ifdef OPENSSL_ALGORITHM_DEFINES
+# error OPENSSL_ALGORITHM_DEFINES no longer supported
+#endif
+
+
+/*
+ * Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers
+ * don't like that.  This will hopefully silence them.
+ */
+#define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy;
+
+/*
+ * Applications should use -DOPENSSL_API_COMPAT=<version> to suppress the
+ * declarations of functions deprecated in or before <version>. Otherwise, they
+ * still won't see them if the library has been built to disable deprecated
+ * functions.
+ */
+#ifndef DECLARE_DEPRECATED
+# define DECLARE_DEPRECATED(f)   f;
+# ifdef __GNUC__
+#  if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
+#   undef DECLARE_DEPRECATED
+#   define DECLARE_DEPRECATED(f)    f __attribute__ ((deprecated));
+#  endif
+# endif
+#endif
+
+#ifndef OPENSSL_FILE
+# ifdef OPENSSL_NO_FILENAMES
+#  define OPENSSL_FILE ""
+#  define OPENSSL_LINE 0
+# else
+#  define OPENSSL_FILE __FILE__
+#  define OPENSSL_LINE __LINE__
+# endif
+#endif
+
+#ifndef OPENSSL_MIN_API
+# define OPENSSL_MIN_API 0
+#endif
+
+#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < OPENSSL_MIN_API
+# undef OPENSSL_API_COMPAT
+# define OPENSSL_API_COMPAT OPENSSL_MIN_API
+#endif
+
+/*
+ * Do not deprecate things to be deprecated in version 1.2.0 before the
+ * OpenSSL version number matches.
+ */
+#if OPENSSL_VERSION_NUMBER < 0x10200000L
+# define DEPRECATEDIN_1_2_0(f)   f;
+#elif OPENSSL_API_COMPAT < 0x10200000L
+# define DEPRECATEDIN_1_2_0(f)   DECLARE_DEPRECATED(f)
+#else
+# define DEPRECATEDIN_1_2_0(f)
+#endif
+
+#if OPENSSL_API_COMPAT < 0x10100000L
+# define DEPRECATEDIN_1_1_0(f)   DECLARE_DEPRECATED(f)
+#else
+# define DEPRECATEDIN_1_1_0(f)
+#endif
+
+#if OPENSSL_API_COMPAT < 0x10000000L
+# define DEPRECATEDIN_1_0_0(f)   DECLARE_DEPRECATED(f)
+#else
+# define DEPRECATEDIN_1_0_0(f)
+#endif
+
+#if OPENSSL_API_COMPAT < 0x00908000L
+# define DEPRECATEDIN_0_9_8(f)   DECLARE_DEPRECATED(f)
+#else
+# define DEPRECATEDIN_0_9_8(f)
+#endif
+
+
+#define OPENSSL_UNISTD <unistd.h>
+
+#if 0
+/* Generate 80386 code? */
+{- ${processor} eq "386" ? "#define" : "#undef" -} I386_ONLY
+
+#undef OPENSSL_UNISTD
+#define OPENSSL_UNISTD {- ${unistd} -}
+
+{- ${export_var_as_fn} ? "#define" : "#undef" -} OPENSSL_EXPORT_VAR_AS_FUNCTION
+
+/*
+ * The following are cipher-specific, but are part of the public API.
+ */
+#if !defined(OPENSSL_SYS_UEFI)
+{- ${bn_ll} ? "# define" : "# undef" -} BN_LLONG
+/* Only one for the following should be defined */
+{- ${b64l} ? "# define" : "# undef" -} SIXTY_FOUR_BIT_LONG
+{- ${b64}  ? "# define" : "# undef" -} SIXTY_FOUR_BIT
+{- ${b32}  ? "# define" : "# undef" -} THIRTY_TWO_BIT
+#endif
+
+#define RC4_INT {- ${rc4_int} -}
+#endif
+
+#ifdef  __cplusplus
+}
+#endif