[build_cmake] use MODULE on Mac OS X (fixes #1761)

add instructions in INSTALL to build using CMake and Xcode on Mac OS X
  along with MacPorts
update CMake to link test_configfile with pcre

x-ref:
  "loadable-module naming on macosx + cmake"
  https://redmine.lighttpd.net/issues/1761
personal/stbuehler/mod-csrf-old
Glenn Strauss 2016-05-21 02:51:37 -04:00
parent e8dd8fdb53
commit bb93414a23
3 changed files with 39 additions and 1 deletions

22
INSTALL
View File

@ -54,3 +54,25 @@ static build using make
$ LIGHTTPD_STATIC=yes ./configure -C --enable-static=yes
$ make
$ sudo make install
build using CMake and Xcode on Mac OS X with MacPorts
-----------------------------------------------------
* upgrade to latest Mac OS X
* install Xcode from Apple Store (requires latest Mac OS X)
* install MacPorts from https://www.macports.org/install.php
$ xcodebuild --license
$ xcode-select --install
$ sudo port selfupdate
$ sudo port install autoconf automake cmake libtool m4 pcre pkgconfig zlib bzip2 openssl libxml sqlite3 openldap fcgi p5-cgi libunwind libunwind-headers mysql57 libev gdbm openldap ossp-uuid
# Note: some of the above require more fiddling to configure with CMake...
# cmake and build
# (all -DWITH_... flags below are optional)
$ cmake -Wno-dev -DWITH_OPENSSL=1 -DWITH_LUA=1 -DWITH_ZLIB=1 -DWITH_BZIP2=1 -DWITH_WEBDAV_PROPS=1 .
$ make -j 4
$ make test
# Note: many tests fail if not built with openssl
# lighttpd will not start up with tests/lighttpd.conf
# (mod_secdownload fails to configure hmac-sha1 and hmac-sha256)

View File

@ -5,7 +5,11 @@ macro(ADD_AND_INSTALL_LIBRARY LIBNAME SRCFILES)
add_library(${LIBNAME} STATIC ${SRCFILES})
target_link_libraries(lighttpd ${LIBNAME})
else()
add_library(${LIBNAME} SHARED ${SRCFILES})
if(APPLE)
add_library(${LIBNAME} MODULE ${SRCFILES})
else()
add_library(${LIBNAME} SHARED ${SRCFILES})
endif()
set(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} ${LIBNAME})
## Windows likes to link it this way back to app!
if(WIN32)

View File

@ -45,6 +45,8 @@ option(BUILD_STATIC "build a static lighttpd with all modules added")
if(BUILD_STATIC)
set(LIGHTTPD_STATIC 1)
elseif(APPLE)
set(CMAKE_SHARED_MODULE_PREFIX "")
else()
set(CMAKE_SHARED_LIBRARY_PREFIX "")
endif()
@ -221,7 +223,13 @@ else()
endif()
if(WITH_OPENSSL)
if(APPLE)
set(CMAKE_REQUIRED_INCLUDES /opt/local/include)
endif()
check_include_files(openssl/ssl.h HAVE_OPENSSL_SSL_H)
if(APPLE)
set(CMAKE_REQUIRED_INCLUDES)
endif()
if(HAVE_OPENSSL_SSL_H)
check_library_exists(crypto BIO_f_base64 "" HAVE_LIBCRYPTO)
if(HAVE_LIBCRYPTO)
@ -599,6 +607,8 @@ if(HAVE_PCRE_H)
add_target_properties(mod_redirect COMPILE_FLAGS ${PCRE_CFLAGS})
target_link_libraries(mod_trigger_b4_dl ${PCRE_LDFLAGS})
add_target_properties(mod_trigger_b4_dl COMPILE_FLAGS ${PCRE_CFLAGS})
target_link_libraries(test_configfile ${PCRE_LDFLAGS})
add_target_properties(test_configfile COMPILE_FLAGS ${PCRE_CFLAGS})
endif()
target_link_libraries(mod_magnet ${LUA_LDFLAGS})
@ -667,7 +677,9 @@ if(CMAKE_COMPILER_IS_GNUCC)
add_definitions(-D_GNU_SOURCE)
endif()
if((NOT APPLE) OR CMAKE_COMPILER_IS_GNUCC)
add_target_properties(lighttpd LINK_FLAGS "-Wl,-export-dynamic")
endif()
set_target_properties(lighttpd PROPERTIES CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})