components/mysql-5-7/patches/disable_static_opt.patch
author Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
Tue, 04 Apr 2017 17:27:12 -0700
changeset 7830 a19af6ab1a9c
parent 7472 6cc4607cf459
permissions -rw-r--r--
25816799 Remove more excess FOSS from Desktop gate [PSARC 2016/088 - b122 subset] PSARC/2016/088 EOF of more excess FOSS from Desktop consolidation (scrubbing the decks harder)

This patch adds an "cmake" option DISABLE_STATIC that prevent
static libraries built from being installed.

--- a/cmake/libutils.cmake
+++ b/cmake/libutils.cmake
@@ -267,7 +267,7 @@ MACRO(MERGE_LIBRARIES)
   ELSE()
     MESSAGE(FATAL_ERROR "Unknown library type")
   ENDIF()
-  IF(NOT ARG_NOINSTALL)
+  IF(NOT ARG_NOINSTALL AND NOT ( DISABLE_STATIC AND ARG_STATIC ) )
     IF(ARG_COMPONENT)
       SET(COMP COMPONENT ${ARG_COMPONENT}) 
     ENDIF()

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -214,6 +214,8 @@ ELSE()
   OPTION(WITH_RAPID
     "Build additonal code(plugins) that is located in rapid directory" OFF)
 ENDIF()
+OPTION(DISABLE_STATIC
+ "Don't build static libraries" OFF)
 OPTION(DISABLE_SHARED 
  "Don't build shared libraries, compile code as position-dependent" OFF)
 IF(DISABLE_SHARED)
@@ -231,7 +233,7 @@ IF(NOT WITHOUT_SERVER)
   OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON)
 ENDIF()
 OPTION(FORCE_UNSUPPORTED_COMPILER "Disable compiler version checks" OFF)
-MARK_AS_ADVANCED(WITHOUT_SERVER DISABLE_SHARED FORCE_UNSUPPORTED_COMPILER)
+MARK_AS_ADVANCED(WITHOUT_SERVER DISABLE_STATIC DISABLE_SHARED FORCE_UNSUPPORTED_COMPILER)
 
 
 include(CheckCSourceCompiles)

--- a/libservices/CMakeLists.txt
+++ b/libservices/CMakeLists.txt
@@ -35,4 +35,6 @@ SET(MYSQLSERVICES_SOURCES
   mysql_keyring_service.c)
 
 ADD_CONVENIENCE_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES})
-INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR} COMPONENT Development)
+IF(NOT DISABLE_STATIC)
+  INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR} COMPONENT Development)
+ENDIF()