Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac OS X Compatibility [WIP] #203

Open
wants to merge 61 commits into
base: darwin
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
8bbe69f
Uses JPEG CMake Module
anuragagarwal561994 Aug 16, 2016
b40b91b
Uses PNG cmake module
anuragagarwal561994 Aug 16, 2016
b367b70
Uses XML2 CMake module
anuragagarwal561994 Aug 16, 2016
2578d4c
Uses CURL CMake module
anuragagarwal561994 Aug 16, 2016
ecaeb68
Merge branch 'cmake_modules' into darwin
anuragagarwal561994 Aug 16, 2016
9a36bac
Corrects include extras path for png and jpeg header files
anuragagarwal561994 Aug 16, 2016
fd699a8
Uses GNUTLS CMakeModule and adds GCrypt CMakeModule
anuragagarwal561994 Aug 16, 2016
cea5f66
Removes repetative found messages from cmake
anuragagarwal561994 Aug 16, 2016
5aab575
Adds SQlite3 CMake Module and uses it
anuragagarwal561994 Aug 16, 2016
46f8eea
Adds HiRedis CMake Module and uses it
anuragagarwal561994 Aug 16, 2016
b7ab9d5
Adds Cairo CMake Module and uses it
anuragagarwal561994 Aug 16, 2016
60eb9d9
Adds Systemd CMake Module and uses it
anuragagarwal561994 Aug 16, 2016
09d8d19
Adds defination of different CMakeModules used
anuragagarwal561994 Aug 17, 2016
bc1e358
Adds Bohem GC CMake Module and uses it
anuragagarwal561994 Aug 17, 2016
2451a76
Merge branch 'cmake_modules' into darwin
anuragagarwal561994 Aug 17, 2016
45ed577
Uses Intl CMakeModule for GetText
anuragagarwal561994 Aug 17, 2016
e06346c
Fixes #194, removes pam_misc
anuragagarwal561994 Aug 17, 2016
d59e298
Fixes #195, Removes dependency of PNG for Cairo
anuragagarwal561994 Aug 17, 2016
0725f23
Merge branch 'master' into cmake_modules with fixes #194, #195
anuragagarwal561994 Aug 17, 2016
cd4a5d6
Adds PAM CMake Module and uses it
anuragagarwal561994 Aug 17, 2016
00c929c
Merge branch 'cmake_modules' into darwin
anuragagarwal561994 Aug 17, 2016
0baf6b6
Merge pull request #193 from anuragagarwal561994/cmake_modules
davidmoreno Aug 17, 2016
4516eca
Merge branch 'master' of https://github.com/davidmoreno/onion
anuragagarwal561994 Aug 17, 2016
8575ea3
Added missing Find*.cmake files.
davidmoreno Aug 17, 2016
ee55962
Adds LibEv CMake Module and uses it. Fixes #198
anuragagarwal561994 Aug 17, 2016
6aac73c
Fix compile on ubuntu precise. Can use cmake 2.8
davidmoreno Aug 17, 2016
57c5875
Adds Event2 CMake Module and uses it. Fixes #199
anuragagarwal561994 Aug 17, 2016
d286942
Merge branch 'master' into darwin
anuragagarwal561994 Aug 17, 2016
662a4e2
Uses cross compatible S_ISDIR instead of DT_DIR to detect if a name r…
anuragagarwal561994 Aug 17, 2016
8a6962a
Adds a missing header file to resolve ssize_t problem during compila…
anuragagarwal561994 Aug 17, 2016
e319868
Adds _DARWIN_C_SOURCE to make RTLD_NODELETE available
anuragagarwal561994 Aug 17, 2016
16f0717
Fixes #202
anuragagarwal561994 Aug 17, 2016
2b7c4fd
Adds the include directory and library of GetText or Intl
anuragagarwal561994 Aug 17, 2016
ddf93a8
Merge branch 'master' of https://github.com/davidmoreno/onion
anuragagarwal561994 Aug 17, 2016
bfd3976
Uses Cairo CMake Module
anuragagarwal561994 Aug 17, 2016
18f672e
Fixes #200, uses ZLIB CMake Module
anuragagarwal561994 Aug 17, 2016
06ee7ac
Fixes #201, corrects otemplate help menu
anuragagarwal561994 Aug 17, 2016
9d54bce
Properly handles the Cairo example problem, Fixes #195
anuragagarwal561994 Aug 17, 2016
ad07e9a
Fixes typo in FindBoehmGC.cmake
anuragagarwal561994 Aug 17, 2016
72ad690
Merge branch 'master' into darwin
anuragagarwal561994 Aug 17, 2016
ac2fb36
Adds alternatives to SOCK_CLOEXEC in tests/01-internal/util.c
anuragagarwal561994 Aug 17, 2016
3d41df2
Specifies for gnutls-certtool as osx itself has its own certtool and …
anuragagarwal561994 Aug 17, 2016
49ce3a6
Replaces deprecated malloc.h with stdlib.h in tests/01-internal/06-on…
anuragagarwal561994 Aug 17, 2016
05a07cf
Links test 01-internal no. 13 with external library
anuragagarwal561994 Aug 17, 2016
1259e72
Links external library gettext with 07-tools
anuragagarwal561994 Aug 17, 2016
798d76b
Includes CTest to compile target make test
anuragagarwal561994 Aug 17, 2016
a88a1a1
Corrects Boehm-GC example by removing GC prefix from some functions a…
anuragagarwal561994 Aug 18, 2016
2aa3e76
Makes SOCK_CLOEXEC 0 when SOCK_CLOEXEC is not defined to pass test ca…
anuragagarwal561994 Aug 18, 2016
3390bd7
Uses PAM CMake Module
anuragagarwal561994 Aug 18, 2016
dcbdce5
Fixes a typo in PAM found status message
anuragagarwal561994 Aug 18, 2016
2693ba2
Fixes #204
anuragagarwal561994 Aug 18, 2016
ec1c9ea
Fixes #206
anuragagarwal561994 Aug 18, 2016
192de85
Fixes typo in looking out for Cairo
anuragagarwal561994 Aug 18, 2016
e4b4c45
Merge branch 'master' into darwin
anuragagarwal561994 Aug 18, 2016
c61454f
Adds FindIntl.cmake for supporting earlier versions of CMake
anuragagarwal561994 Aug 18, 2016
49aeb70
Adds a condition for certtool, in linux gnutls certtool is saved with…
anuragagarwal561994 Aug 19, 2016
381c76f
Changes condition of LibIntl as is not needed in linux
anuragagarwal561994 Aug 19, 2016
80f6577
Adds osx in .travis.yml
anuragagarwal561994 Aug 19, 2016
af87d33
onioncpp_static links to correct library
anuragagarwal561994 Aug 20, 2016
fce7f0f
Adds an extra if to check if the user has enabled PAM to avoid unnece…
anuragagarwal561994 Aug 20, 2016
e84c52e
Sets the value of CMAKE_MACOSX_RPATH to True
anuragagarwal561994 Aug 20, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
language: cpp

os:
- linux
- osx

compiler:
- gcc
- clang
Expand All @@ -9,44 +13,39 @@ sudo: false
git:
depth: 1

env:
global:
- LLVM_VERSION=3.7.0
- LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz

before_install:
- wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH
- mkdir $HOME/clang+llvm
- tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang+llvm --strip-components 1
- export PATH=$HOME/clang+llvm/bin:$PATH
- ln -s $HOME/clang+llvm/bin/clang++ $HOME/clang+llvm/bin/clang++-3.7
- gem install md2man --no-rdoc --no-ri
- chmod +x ./install-dependencies.sh
- ./install-dependencies.sh

addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
packages:
- g++-5
- gcc-5
- g++-5
- clang-3.7
- gettext
- libhiredis-dev

install:
# install some packages from Ubuntu's default sources
- if [ "$CXX" = "g++" ]; then export CXX="g++-5" CC="gcc-5"; fi
- if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi
- if [[ $CXX == 'g++' ]]; then export CXX="g++-5" CC="gcc-5"; fi
- if [[ $CXX == 'clang++' ]]; then export CXX="clang++-3.7"; fi

#FIXME: removes -Werror flag for osx check
script:
# make distcheck still does not work on travis
- mkdir build
&& cd build
&& cmake ..
-DCMAKE_C_FLAGS="-Werror"
-DCMAKE_CXX_FLAGS="-Werror"
&& make VERBOSE=1
&& (make test || true)

after_script:
- if test -f ./Testing/Temporary/LastTest.log; then
echo "cat test logs:";
cat ./Testing/Temporary/LastTest.log;
fi
fi
156 changes: 78 additions & 78 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ cmake_minimum_required (VERSION 2.8)
cmake_policy(VERSION 2.8)
project(libonion)

set(CMAKE_MACOSX_RPATH 1)

# Some tweak parameters
SET(ONION_USE_SSL true CACHE BOOL "Use SSL, requires GnuTLS")
SET(ONION_USE_PAM true CACHE BOOL "Compile PAM handler. Needs libpam")
Expand All @@ -19,7 +21,10 @@ SET(ONION_USE_BINDINGS_CPP true CACHE BOOL "Compile the CPP bindings")
SET(ONION_POLLER default CACHE string "Default poller to use: default | epoll | libev | libevent")
########

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules")

MESSAGE("CMAKE_SYSTEM_NAME is ${CMAKE_SYSTEM_NAME}")

execute_process(
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/git-version-gen" "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE ONION_VERSION)
Expand Down Expand Up @@ -79,36 +84,35 @@ endif (${ONION_POLLER} STREQUAL "default")

message(STATUS "Using ${ONION_POLLER} as poller")


if (${ONION_USE_SSL})
find_library(GNUTLS_LIB NAMES gnutls PATH ${LIBPATH})
find_library(GCRYPT_LIB NAMES gcrypt PATH ${LIBPATH})
if (GNUTLS_LIB AND GCRYPT_LIB)
find_package(GnuTLS)
find_package(GCrypt)
if (GNUTLS_FOUND AND GCRYPT_FOUND)
set(GNUTLS_ENABLED true)
message(STATUS "Gnutls found. SSL support is compiled in.")
else(GNUTLS_LIB AND GCRYPT_LIB)
message(STATUS "SSL support is compiled in.")
else(GNUTLS_FOUND AND GCRYPT_FOUND)
message("Gnutls or gcrypt not found. SSL support is not compiled in.")
endif(GNUTLS_LIB AND GCRYPT_LIB)
endif(GNUTLS_FOUND AND GCRYPT_FOUND)
endif(${ONION_USE_SSL})

if (${ONION_USE_SQLITE3})
find_library(SQLITE3_LIB NAMES sqlite3 PATH ${LIBPATH})
if (SQLITE3_LIB)
find_package(SQLite3)
if (SQLITE3_FOUND)
set(SQLITE3_ENABLED true)
message(STATUS "SQLite found. Sqlite session support is compiled in.")
else(SQLITE3_LIB)
message("SQLite not found. Sqlite session support is not compiled in.")
endif(SQLITE3_LIB)
message(STATUS "SQLite session support is compiled in.")
else(SQLITE3_FOUND)
message("SQLite session support is not compiled in.")
endif(SQLITE3_FOUND)
endif(${ONION_USE_SQLITE3})

if (${ONION_USE_REDIS})
find_library(REDIS_LIB NAMES hiredis PATH ${LIBPATH})
if(REDIS_LIB)
find_package(HiRedis)
if(HIREDIS_FOUND)
set(REDIS_ENABLED true)
message(STATUS "Hiredis found. Redis session support is compiled in.")
else(REDIS_LIB)
message(STATUS "Redis session support is compiled in.")
else(HIREDIS_FOUND)
message("Hiredis not found. Redis session support is not compiled in.")
endif(REDIS_LIB)
endif(HIREDIS_FOUND)
endif(${ONION_USE_REDIS})

if (${ONION_USE_PTHREADS})
Expand All @@ -122,97 +126,89 @@ if (${ONION_USE_PTHREADS})
endif(${ONION_USE_PTHREADS})

if (${ONION_USE_XML2})
find_library(XML2_LIB NAMES xml2 PATH ${LIBPATH})
find_library(Z_LIB NAMES z PATH ${LIBPATH})
find_path(XML2_HEADERS NAMES libxml/xmlwriter.h HINTS ${INCLUDE_PATH} PATH_SUFFIXES libxml2)
if(XML2_HEADERS)
message(STATUS "libxml2 found. WebDAV support is compiled in.")
find_package(LibXml2)
if(LIBXML2_FOUND)
message(STATUS "WebDAV support is compiled in.")
set(XML2_ENABLED true)
else(XML2_HEADERS)
message("libxml2 not found. WebDAV is not supported. ${XML2_HEADERS} ${XML2_LIB}")
endif(XML2_HEADERS)
else(LIBXML2_FOUND)
message("libxml2 not found. WebDAV is not supported.")
endif(LIBXML2_FOUND)
endif(${ONION_USE_XML2})

if (${ONION_USE_PAM})
find_library(PAM_LIB NAMES pam pam_misc PATH ${LIBPATH})
if (PAM_LIB)
find_package(PAM)
if (PAM_FOUND)
set(PAM_ENABLED true)
message(STATUS "pam found. PAM support is compiled in in handlers.")
else (PAM_LIB)
message("pam not found. No PAM support.")
endif (PAM_LIB)
message(STATUS "PAM support is compiled in handlers.")
else (PAM_FOUND)
message("No PAM support.")
endif (PAM_FOUND)
endif (${ONION_USE_PAM})

if (${ONION_USE_PNG})
find_library(PNG_LIB NAMES png PATH ${LIBPATH})
find_file(PNG_HEADER png.h ${INCLUDE_PATH})
if (PNG_LIB)
find_package(PNG)
if (PNG_FOUND)
set(PNG_ENABLED true)
set(PNG_LIB ${PNG_LIB})
message(STATUS "libpng found. png support is compiled in at extras.")
find_library(CAIRO_LIB NAMES cairo PATH ${LIBPATH})
find_file(CAIRO_HEADER cairo/cairo.h ${INCLUDE_PATH})
if (CAIRO_HEADER)
find_package(Cairo)
if (CAIRO_FOUND)
set(CAIRO_ENABLED true)
set(CAIRO_LIB ${CAIRO_LIB})
message(STATUS "libcairo found. Adding cairo examples. ${CAIRO_LIB}")
else (CAIRO_HEADER)
message(STATUS "libcairo NOT found.")
endif (CAIRO_HEADER)
message(STATUS "Adding cairo examples.")
else (CAIRO_FOUND)
message(WARNING "Some examples are disabled as you dont have cairo: cairo")
endif (CAIRO_FOUND)
else (PNG_LIB)
message("libpng not found. No png support.")
endif (PNG_LIB)
endif (PNG_FOUND)
endif (${ONION_USE_PNG})

if (${ONION_USE_JPEG})
find_library(JPEG_LIB NAMES jpeg PATH ${LIBPATH})
find_file(JPEG_HEADER jpeg.h ${INCLUDE_PATH})
if (JPEG_LIB)
find_package(JPEG)
if (JPEG_FOUND)
set(JPEG_ENABLED true)
set(JPEG_LIB ${JPEG_LIB})
message(STATUS "libjpeg found. jpeg support is compiled in at extras.")
else (JPEG_LIB)
message(STATUS "jpeg support is compiled in at extras.")
else (JPEG_FOUND)
message("libjpeg not found. No jpeg support.")
endif (JPEG_LIB)
endif (JPEG_FOUND)
endif (${ONION_USE_JPEG})

if (${ONION_USE_GC})
find_library(GC_LIB NAMES gc PATH ${LIBPATH})
find_file(GC_HEADER gc.h ${INCLUDE_PATH})
if (GC_LIB AND GC_HEADER)
message(STATUS "libgc found, compiling Boehm GC examples")
find_package(BoehmGC)
if (BOEHM_GC_FOUND)
message(STATUS "compiling Boehm GC examples")
set(GC_ENABLED true)
else (GC_LIB AND GC_HEADER)
message(STATUS "libgc not found, NOT compiling Boehm GC examples")
endif (GC_LIB AND GC_HEADER)
else (BOEHM_GC_FOUND)
message(STATUS "NOT compiling Boehm GC examples")
endif (BOEHM_GC_FOUND)
endif (${ONION_USE_GC})


find_library(CURL_LIB NAMES curl PATH ${LIBPATH})
if(CURL_LIB)
message(STATUS "curl found. Some extra test are compiled.")
find_package(CURL)
if(CURL_FOUND)
message(STATUS "Some extra test are compiled.")
set(CURL true)
else(CURL_LIB)
else(CURL_FOUND)
message("curl not found. Some examples wil not be built.")
endif(CURL_LIB)
endif(CURL_FOUND)

if (${ONION_USE_SYSTEMD})
find_library(SD_DAEMON_LIB NAMES systemd PATH ${LIBPATH})
if (SD_DAEMON_LIB)
find_package(Systemd)
if (SYSTEMD_FOUND)
set(SYSTEMD_ENABLED true)
message(STATUS "libsystemd found. Systemd support compiled in.")
else(SD_DAEMON_LIB)
message("libsystemd not found. Systemd support is not compiled in. Install libsystemd-dev | systemd-devel")
endif(SD_DAEMON_LIB)
message(STATUS "Systemd support compiled in.")
else(SYSTEMD_FOUND)
message("Systemd support is not compiled in. Install libsystemd-dev | systemd-devel")
endif(SYSTEMD_FOUND)
endif(${ONION_USE_SYSTEMD})

find_library(GETTEXT_LIB NAMES gettext PATH ${LIBPATH})
if (GETTEXT_LIB)
find_package(Intl)
if (INTL_FOUND)
set(GETTEXT_ENABLED true)
message(STATUS "gettext found. gettext support is compiled in otemplate.")
else (GETTEXT_LIB)
message(STATUS "gettext not found. No gettext support.")
endif (GETTEXT_LIB)
include_directories(${INTL_INCLUDE_DIRS})
message(STATUS "gettext support is compiled in otemplate.")
else (INTL_FOUND)
message(STATUS "No gettext support.")
endif (INTL_FOUND)

FIND_PROGRAM(MD2MAN md2man-roff)
if(MD2MAN)
Expand All @@ -225,6 +221,7 @@ endif(MD2MAN)
# defines
if (GNUTLS_ENABLED)
add_definitions(-DHAVE_GNUTLS)
add_definitions(${GNUTLS_DEFINITIONS})
endif(GNUTLS_ENABLED)
if (PTHREADS)
add_definitions(-DHAVE_PTHREADS)
Expand All @@ -234,15 +231,18 @@ if (PAM_ENABLED)
endif(PAM_ENABLED)
if (XML2_ENABLED)
add_definitions(-DHAVE_WEBDAV)
add_definitions(${LIBXML2_DEFINITIONS})
endif(XML2_ENABLED)
if (SYSTEMD_ENABLED)
add_definitions(-DHAVE_SYSTEMD)
add_definitions(${SYSTEMD_DEFINITIONS})
endif (SYSTEMD_ENABLED)
if (GETTEXT_ENABLED)
add_definitions(-DHAVE_GETTEXT)
endif(GETTEXT_ENABLED)
if (SQLITE3_ENABLED)
add_definitions(-DHAVE_SQLITE3)
add_definitions(${SQLITE3_DEFINITIONS})
endif (SQLITE3_ENABLED)
if (REDIS_ENABLED)
add_definitions(-DHAVE_REDIS)
Expand All @@ -253,6 +253,7 @@ add_definitions(-D_POSIX_C_SOURCE=200112L)
add_definitions(-D_ISOC99_SOURCE)
if(PNG_ENABLED)
add_definitions(-DPNG_ENABLED)
add_definitions(${PNG_DEFINITIONS})
endif(PNG_ENABLED)
if(JPEG_ENABLED)
add_definitions(-DJPEG_ENABLED)
Expand All @@ -277,8 +278,7 @@ project (onion)

INCLUDE(CPackConfig.cmake)
INCLUDE(CPack)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules")
INCLUDE(CTest)

add_subdirectory(src)
add_subdirectory(tools)
Expand Down
22 changes: 22 additions & 0 deletions CMakeModules/COPYING-CMAKE-SCRIPTS
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading