The version of libmicrohttpd that ships with FreeBSD has a bug that causes the server to hang on shutdown. This patch adds on-demand fetching and compiling of the library on FreeBSD systems.

This commit is contained in:
casey langen 2017-12-21 05:16:05 +00:00
parent 88b7e994a5
commit 70a8aad86d
2 changed files with 29 additions and 16 deletions

2
.gitignore vendored
View File

@ -25,6 +25,8 @@ src/3rdparty/obj
src/contrib src/contrib
src/core/obj src/core/obj
src/plugins/oggdecoder/obj src/plugins/oggdecoder/obj
src/plugins/server/libmicrohttpd-prefix
src/plugins/server/microhttpd
src/plugins/waveout/obj src/plugins/waveout/obj
src/plugins/taglib_plugin/obj src/plugins/taglib_plugin/obj
src/plugins/taglib_plugin/taglib-1.11 src/plugins/taglib_plugin/taglib-1.11

View File

@ -4,36 +4,47 @@ set (server_SOURCES
Transcoder.cpp Transcoder.cpp
TranscodingDataStream.cpp TranscodingDataStream.cpp
Util.cpp Util.cpp
WebSocketServer.cpp WebSocketServer.cpp)
)
set (BOOST_LIBS set (BOOST_LIBS
system system
filesystem filesystem
thread thread)
)
find_package(Boost 1.55.0 REQUIRED ${BOOST_LIBS}) find_package(Boost 1.55.0 REQUIRED ${BOOST_LIBS})
add_definitions (-DHAVE_BOOST -D_FILE_OFFSET_BITS=64) add_definitions (-DHAVE_BOOST -D_FILE_OFFSET_BITS=64)
set (BOOST_LINK_LIBS ${Boost_LIBRARIES}) set (BOOST_LINK_LIBS ${Boost_LIBRARIES})
#message(STATUS "boost libs: " ${BOOST_LINK_LIBS}) add_library(server SHARED ${server_SOURCES})
#message(STATUS "boost includes: " ${Boost_INCLUDE_DIRS})
set (server_LINK_LIBS ${BOOST_LINK_LIBS}) set (server_LINK_LIBS ${BOOST_LINK_LIBS})
include_directories ( include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/include")
"${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/include"
)
add_library(server SHARED ${server_SOURCES})
# prefer static libraries on mac to make redist easier if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
if (${LINK_STATICALLY} MATCHES "true") # the version of libmicrohttpd that ships with FreeBSD hangs during shutdown,
# but newer versions is fine. snag the sources and compile them on-demand.
include (ExternalProject)
ExternalProject_Add(libmicrohttpd
URL https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.58.tar.gz
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ./configure --enable-https=no --disable-curl --prefix=${CMAKE_CURRENT_SOURCE_DIR}/microhttpd/
BUILD_COMMAND make
INSTALL_COMMAND make install
TEST_COMMAND "")
add_dependencies(server libmicrohttpd)
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/microhttpd/include")
file(GLOB OBJS "${CMAKE_CURRENT_SOURCE_DIR}/libmicrohttpd-prefix/src/libmicrohttpd/src/microhttpd/.libs/*.o")
target_link_libraries(server ${server_LINK_LIBS} "${OBJS}" z)
elseif (${LINK_STATICALLY} MATCHES "true")
# prefer static libraries on mac to make redist easier
find_library(MICROHTTPDLIB NAMES libmicrohttpd.a microhttpd) find_library(MICROHTTPDLIB NAMES libmicrohttpd.a microhttpd)
find_library(MP3LAMELIB NAMES libmp3lame.a mp3lame) target_link_libraries(server ${server_LINK_LIBS} ${MICROHTTPDLIB} z)
target_link_libraries(server ${server_LINK_LIBS} ${MICROHTTPDLIB} ${MP3LAMELIB} z)
else() else()
target_link_libraries(server ${server_LINK_LIBS} microhttpd mp3lame z) target_link_libraries(server ${server_LINK_LIBS} microhttpd z)
endif() endif()