polarssl-shared-and-static-library.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. Allow both shared and static PolarSSL library
  2. By default, PolarSSL is built as a static library. If the option
  3. USE_SHARED_POLARSSL_LIBRARY is set, then it is build as a shared
  4. library. But there is no way of building both the shared and static
  5. versions.
  6. This patch adds the USE_STATIC_POLARSSL_LIBRARY (which defaults to ON)
  7. in addition to the existing USE_SHARED_POLARSSL_LIBRARY (which
  8. defaults to OFF). Both options can be manipulated independently.
  9. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  10. Index: polarssl-1.1.1/library/CMakeLists.txt
  11. ===================================================================
  12. --- polarssl-1.1.1.orig/library/CMakeLists.txt
  13. +++ polarssl-1.1.1/library/CMakeLists.txt
  14. @@ -1,4 +1,5 @@
  15. option(USE_SHARED_POLARSSL_LIBRARY "Build PolarSSL as a shared library." OFF)
  16. +option(USE_STATIC_POLARSSL_LIBRARY "Build PolarSSL as a static library." ON)
  17. set(src
  18. aes.c
  19. @@ -40,17 +41,21 @@
  20. xtea.c
  21. )
  22. -if(NOT USE_SHARED_POLARSSL_LIBRARY)
  23. -
  24. -add_library(polarssl STATIC ${src})
  25. -
  26. -else(NOT USE_SHARED_POLARSSL_LIBRARY)
  27. +if(USE_SHARED_POLARSSL_LIBRARY)
  28. add_library(polarssl SHARED ${src})
  29. set_target_properties(polarssl PROPERTIES VERSION 1.1.1 SOVERSION 1)
  30. +set_target_properties(polarssl PROPERTIES OUTPUT_NAME polarssl)
  31. +
  32. +endif(USE_SHARED_POLARSSL_LIBRARY)
  33. +
  34. +if(USE_STATIC_POLARSSL_LIBRARY)
  35. +
  36. +add_library(polarssl-static STATIC ${src})
  37. +set_target_properties(polarssl-static PROPERTIES OUTPUT_NAME polarssl)
  38. -endif(NOT USE_SHARED_POLARSSL_LIBRARY)
  39. +endif(USE_STATIC_POLARSSL_LIBRARY)
  40. -install(TARGETS polarssl
  41. +install(TARGETS polarssl polarssl-static
  42. DESTINATION ${LIB_INSTALL_DIR}
  43. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)