Skip to content

Commit 00d68a7

Browse files
author
Tor Didriksen
committed
Bug#29055011 BACKPORT TO 5.6: BUNDLED LIBEVENT IS OUTDATED
Adapt cherry-pick from 5.7 Change-Id: Id6bd049dcde5c7c68b57ede4addda9281bbf45cc
1 parent 79a8d99 commit 00d68a7

File tree

6 files changed

+37
-31
lines changed

6 files changed

+37
-31
lines changed

cmake/libevent.cmake

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@
1414
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1515

1616
MACRO (MYSQL_USE_BUNDLED_LIBEVENT)
17-
SET(LIBEVENT_LIBRARY event)
18-
SET(LIBEVENT_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/libevent)
17+
SET(WITH_LIBEVENT "bundled" CACHE STRING "Use bundled libevent library")
18+
SET(LIBEVENT_LIBRARIES event)
19+
SET(LIBEVENT_INCLUDE_DIRS
20+
"${CMAKE_SOURCE_DIR}/extra/libevent/include"
21+
"${CMAKE_BINARY_DIR}/extra/libevent/include")
1922
SET(LIBEVENT_FOUND TRUE)
20-
ADD_DEFINITIONS("-DHAVE_LIBEVENT1")
21-
SET(WITH_LIBEVENT "bundled" CACHE STRING "Use bundled libevent")
22-
ADD_SUBDIRECTORY(libevent)
23-
GET_TARGET_PROPERTY(src libevent SOURCES)
24-
FOREACH(file ${src})
25-
SET(LIBEVENT_SOURCES ${LIBEVENT_SOURCES} ${CMAKE_SOURCE_DIR}/libevent/${file})
26-
ENDFOREACH()
23+
ADD_DEFINITIONS("-DHAVE_LIBEVENT2")
24+
ADD_SUBDIRECTORY(extra/libevent)
2725
ENDMACRO()
2826

2927
# MYSQL_CHECK_LIBEVENT
@@ -33,7 +31,7 @@ ENDMACRO()
3331
# If this is set,we use bindled libevent
3432
# If this is not set,search for system libevent.
3533
# if system libevent is not found, use bundled copy
36-
# LIBEVENT_LIBRARIES, LIBEVENT_INCLUDE_DIR and LIBEVENT_SOURCES
34+
# LIBEVENT_LIBRARIES, LIBEVENT_INCLUDE_DIRS
3735
# are set after this macro has run
3836

3937
MACRO (MYSQL_CHECK_LIBEVENT)
@@ -48,43 +46,43 @@ MACRO (MYSQL_CHECK_LIBEVENT)
4846
SET(LIBEVENT_FIND_QUIETLY TRUE)
4947

5048
IF (NOT LIBEVENT_INCLUDE_PATH)
51-
set(LIBEVENT_INCLUDE_PATH /usr/local/include /opt/local/include)
49+
SET(LIBEVENT_INCLUDE_PATH /usr/local/include /opt/local/include)
5250
ENDIF()
5351

54-
find_path(LIBEVENT_INCLUDE_DIR event.h PATHS ${LIBEVENT_INCLUDE_PATH})
52+
FIND_PATH(LIBEVENT_INCLUDE_DIR event.h PATHS ${LIBEVENT_INCLUDE_PATH})
5553

56-
if (NOT LIBEVENT_INCLUDE_DIR)
54+
IF (NOT LIBEVENT_INCLUDE_DIR)
5755
MESSAGE(SEND_ERROR "Cannot find appropriate event.h in /usr/local/include or /opt/local/include. Use bundled libevent")
58-
endif()
56+
ENDIF()
5957

6058
IF (NOT LIBEVENT_LIB_PATHS)
61-
set(LIBEVENT_LIB_PATHS /usr/local/lib /opt/local/lib)
59+
SET(LIBEVENT_LIB_PATHS /usr/local/lib /opt/local/lib)
6260
ENDIF()
6361

6462
## libevent.so is historical, use libevent_core.so if found.
65-
find_library(LIBEVENT_CORE event_core PATHS ${LIBEVENT_LIB_PATHS})
66-
find_library(LIBEVENT_LIB event PATHS ${LIBEVENT_LIB_PATHS})
63+
FIND_LIBRARY(LIBEVENT_CORE event_core PATHS ${LIBEVENT_LIB_PATHS})
64+
FIND_LIBRARY(LIBEVENT_EXTRA event_extra PATHS ${LIBEVENT_LIB_PATHS})
65+
FIND_LIBRARY(LIBEVENT_LIB event PATHS ${LIBEVENT_LIB_PATHS})
6766

68-
if (NOT LIBEVENT_LIB AND NOT LIBEVENT_CORE)
67+
IF (NOT LIBEVENT_LIB AND NOT LIBEVENT_CORE)
6968
MESSAGE(SEND_ERROR "Cannot find appropriate event lib in /usr/local/lib or /opt/local/lib. Use bundled libevent")
70-
endif()
69+
ENDIF()
7170

7271
IF ((LIBEVENT_LIB OR LIBEVENT_CORE) AND LIBEVENT_INCLUDE_DIR)
73-
set(LIBEVENT_FOUND TRUE)
72+
SET(LIBEVENT_FOUND TRUE)
7473
IF (LIBEVENT_CORE)
75-
set(LIBEVENT_LIBS ${LIBEVENT_CORE})
74+
SET(LIBEVENT_LIBS ${LIBEVENT_CORE} ${LIBEVENT_EXTRA})
7675
ELSE()
77-
set(LIBEVENT_LIBS ${LIBEVENT_LIB})
76+
SET(LIBEVENT_LIBS ${LIBEVENT_LIB})
7877
ENDIF()
7978
ELSE()
80-
set(LIBEVENT_FOUND FALSE)
79+
SET(LIBEVENT_FOUND FALSE)
8180
ENDIF()
8281

8382
IF(LIBEVENT_FOUND)
84-
SET(LIBEVENT_SOURCES "")
8583
SET(LIBEVENT_LIBRARIES ${LIBEVENT_LIBS})
8684
SET(LIBEVENT_INCLUDE_DIRS ${LIBEVENT_INCLUDE_DIR})
87-
find_path(LIBEVENT2_INCLUDE_DIR event2 HINTS ${LIBEVENT_INCLUDE_PATH}/event)
85+
FIND_PATH(LIBEVENT2_INCLUDE_DIR event2 HINTS ${LIBEVENT_INCLUDE_PATH}/event)
8886
IF (LIBEVENT2_INCLUDE_DIR)
8987
ADD_DEFINITIONS("-DHAVE_LIBEVENT2")
9088
ELSE()
@@ -98,4 +96,6 @@ MACRO (MYSQL_CHECK_LIBEVENT)
9896
ENDIF()
9997

10098
ENDIF()
99+
MESSAGE(STATUS "LIBEVENT_INCLUDE_DIRS ${LIBEVENT_INCLUDE_DIRS}")
100+
MESSAGE(STATUS "LIBEVENT_LIBRARIES ${LIBEVENT_LIBRARIES}")
101101
ENDMACRO()

cmake/os/Linux.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
33
#
44
# This program is free software; you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -39,6 +39,7 @@ ENDIF()
3939

4040
# 64 bit file offset support flag
4141
SET(_FILE_OFFSET_BITS 64)
42+
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
4243

4344
# Linux specific HUGETLB /large page support
4445
CHECK_SYMBOL_EXISTS(SHM_HUGETLB sys/shm.h HAVE_DECL_SHM_HUGETLB)

cmake/os/SunOS.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -47,6 +47,7 @@ ENDIF()
4747

4848
# Enable 64 bit file offsets
4949
SET(_FILE_OFFSET_BITS 64)
50+
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
5051

5152
# Legacy option, without it my_pthread is having problems
5253
ADD_DEFINITIONS(-DHAVE_RWLOCK_T)

extra/libevent/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ else()
2424
cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)
2525
endif()
2626

27+
# This is only used by a plugin, so we need -fPIC
28+
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_SHARED_LIBRARY_C_FLAGS}")
29+
2730
# if(NOT CMAKE_BUILD_TYPE)
2831
# set(CMAKE_BUILD_TYPE Release
2932
# CACHE STRING "Set build type to Debug o Release (default Release)" FORCE)

extra/libevent/evconfig-private.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#cmakedefine __EXTENSIONS__
1919

2020
/* Number of bits in a file offset, on hosts where this is settable. */
21-
#cmakedefine _FILE_OFFSET_BITS 1
21+
/* #cmakedefine _FILE_OFFSET_BITS 1 */
2222
/* Define for large files, on AIX-style hosts. */
2323
#cmakedefine _LARGE_FILES 1
2424

plugin/innodb_memcached/daemon_memcached/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -14,8 +14,7 @@
1414
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1515

1616
# Common defines and includes
17-
INCLUDE_DIRECTORIES(${LIBEVENT_INCLUDE_DIR}
18-
${CMAKE_SOURCE_DIR}/include
17+
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
1918
${CMAKE_SOURCE_DIR}/sql
2019
${CMAKE_SOURCE_DIR}/bld/include
2120
${CMAKE_SOURCE_DIR}/regex
@@ -28,6 +27,8 @@ INCLUDE_DIRECTORIES(${LIBEVENT_INCLUDE_DIR}
2827

2928
)
3029

30+
INCLUDE_DIRECTORIES(SYSTEM ${LIBEVENT_INCLUDE_DIRS})
31+
3132
SET(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_SHARED_LIBRARY_C_FLAGS} -I${CMAKE_SOURCE_DIR}/plugin/innodb_memcached/daemon_memcached/utilities")
3233

3334
# If current CMAKE_C_FLAGS is with Werror, turn it off to compile successfully

0 commit comments

Comments
 (0)