Permalink
Browse files

Switch to CMake build system

  • Loading branch information...
pp3345 committed Jul 11, 2015
1 parent 97a9424 commit 8d4cd47c1e8652ab02f861764a5a1689a50bb33c
Showing with 512 additions and 559 deletions.
  1. +6 −4 .gitignore
  2. +2 −7 Authentication/PancakeAuthentication.c
  3. +1 −5 Authentication/PancakeAuthentication.h
  4. +6 −0 Authentication/PancakeModule.cmake
  5. +0 −8 Authentication/module.m4
  6. +2 −6 AuthenticationFile/PancakeAuthenticationFile.c
  7. +2 −7 AuthenticationFile/PancakeAuthenticationFile.h
  8. +24 −0 AuthenticationFile/PancakeModule.cmake
  9. +0 −13 AuthenticationFile/module.m4
  10. +154 −0 CMakeLists.txt
  11. +9 −14 ConfigurationParser/PancakeConfigurationParser.c
  12. +14 −19 ConfigurationParser/grammar.y
  13. +75 −57 ConfigurationParser/scanner.h
  14. +4 −5 ConfigurationParser/scanner.l
  15. +7 −11 HTTP/PancakeHTTP.c
  16. +6 −10 HTTP/PancakeHTTP.h
  17. +1 −1 HTTP/PancakeHTTPS.c
  18. +8 −0 HTTP/PancakeModule.cmake
  19. +0 −8 HTTP/module.m4
  20. +4 −8 HTTPBasicAuthentication/PancakeHTTPBasicAuthentication.c
  21. +1 −5 HTTPBasicAuthentication/PancakeHTTPBasicAuthentication.h
  22. +9 −0 HTTPBasicAuthentication/PancakeModule.cmake
  23. +0 −10 HTTPBasicAuthentication/module.m4
  24. +2 −7 HTTPDeflate/PancakeHTTPDeflate.c
  25. +2 −6 HTTPDeflate/PancakeHTTPDeflate.h
  26. +23 −0 HTTPDeflate/PancakeModule.cmake
  27. +0 −9 HTTPDeflate/module.m4
  28. +6 −11 HTTPFastCGI/PancakeHTTPFastCGI.c
  29. +2 −6 HTTPFastCGI/PancakeHTTPFastCGI.h
  30. +8 −0 HTTPFastCGI/PancakeModule.cmake
  31. +0 −8 HTTPFastCGI/module.m4
  32. +2 −6 HTTPRewrite/PancakeHTTPRewrite.c
  33. +3 −8 HTTPRewrite/PancakeHTTPRewrite.h
  34. +1 −6 HTTPRewrite/PancakeHTTPRewriteDefaultVariables.c
  35. +2 −6 HTTPRewrite/PancakeHTTPRewriteDefaultVariables.h
  36. +1 −6 HTTPRewrite/PancakeHTTPRewriteVM.c
  37. +1 −5 HTTPRewrite/PancakeHTTPRewriteVM.h
  38. +8 −0 HTTPRewrite/PancakeModule.cmake
  39. +0 −8 HTTPRewrite/module.m4
  40. +2 −7 HTTPStatic/PancakeHTTPStatic.c
  41. +3 −5 HTTPStatic/PancakeHTTPStatic.h
  42. +8 −0 HTTPStatic/PancakeModule.cmake
  43. +0 −8 HTTPStatic/module.m4
  44. +4 −9 LinuxPoll/PancakeLinuxPoll.c
  45. +1 −4 LinuxPoll/PancakeLinuxPoll.h
  46. +8 −0 LinuxPoll/PancakeModule.cmake
  47. +0 −11 LinuxPoll/module.m4
  48. +1 −5 MIME/PancakeMIME.c
  49. +1 −5 MIME/PancakeMIME.h
  50. +6 −0 MIME/PancakeModule.cmake
  51. +0 −8 MIME/module.m4
  52. +28 −0 OpenSSL/PancakeModule.cmake
  53. +1 −6 OpenSSL/PancakeOpenSSL.c
  54. +4 −9 OpenSSL/PancakeOpenSSL.h
  55. +0 −20 OpenSSL/module.m4
  56. +1 −8 Pancake.c
  57. +2 −2 Pancake.h
  58. +4 −0 PancakeDebug.c
  59. +27 −0 PancakeModulesGenerator.c
  60. +3 −3 PancakeNetwork.c
  61. +1 −5 SharedDependencies/Base64Decode.c
  62. +1 −5 SharedDependencies/Base64Decode.h
  63. +0 −1 SharedDependencies/module.m4
  64. +0 −29 autogen.sh
  65. +0 −8 build/Makefile.am
  66. +0 −111 build/configure.ac
  67. +10 −0 config.h.in
View
@@ -213,10 +213,12 @@ pip-log.txt
.mr.developer.cfg
# config.h
config.h
# config
config/
.autotools
ConfigurationParser/scanner.c
ConfigurationParser/scanner.h
ConfigurationParser/grammar.c
ConfigurationParser/grammar.h
.autotools
.idea
@@ -1,10 +1,7 @@
#include "PancakeAuthentication.h"
#ifdef PANCAKE_AUTHENTICATION
#include "PancakeConfiguration.h"
#include "PancakeLogger.h"
#include "../PancakeConfiguration.h"
#include "../PancakeLogger.h"
PancakeModule PancakeAuthenticationModule = {
"Authentication",
@@ -135,5 +132,3 @@ PANCAKE_API inline UByte PancakeAuthenticate(PancakeAuthenticationConfiguration
return config->backend->authenticate(config, data);
}
#endif
@@ -2,9 +2,7 @@
#ifndef _PANCAKE_AUTHENTICATION_H
#define _PANCAKE_AUTHENTICATION_H
#include "Pancake.h"
#ifdef PANCAKE_AUTHENTICATION
#include "../Pancake.h"
UByte PancakeAuthenticationInitialize();
UByte PancakeAuthenticationShutdown();
@@ -45,5 +43,3 @@ PANCAKE_API void PancakeAuthenticationRegisterBackend(PancakeAuthenticationBacke
PANCAKE_API inline UByte PancakeAuthenticate(PancakeAuthenticationConfiguration *config, void *data);
#endif
#endif
@@ -0,0 +1,6 @@
option(PANCAKE_AUTHENTICATION "Enable Pancake Authentication module" OFF)
if(PANCAKE_AUTHENTICATION)
pancake_enable_module("Authentication" "PancakeAuthenticationModule" "Authentication/PancakeAuthentication.h")
set(PANCAKE_SOURCE_FILES ${PANCAKE_SOURCE_FILES} Authentication/PancakeAuthentication.c)
endif()
View

This file was deleted.

Oops, something went wrong.
@@ -1,10 +1,8 @@
#include "PancakeAuthenticationFile.h"
#ifdef PANCAKE_AUTHENTICATION_FILE
#include "PancakeConfiguration.h"
#include "PancakeLogger.h"
#include "../PancakeConfiguration.h"
#include "../PancakeLogger.h"
#include <openssl/sha.h>
#include <openssl/md5.h>
@@ -298,5 +296,3 @@ STATIC UByte PancakeAuthenticationFileAuthenticate(PancakeAuthenticationConfigur
// Password wrong
return 0;
}
#endif
@@ -2,11 +2,8 @@
#ifndef _PANCAKE_AUTHENTICATION_FILE_H
#define _PANCAKE_AUTHENTICATION_FILE_H
#include "Pancake.h"
#ifdef PANCAKE_AUTHENTICATION_FILE
#include "Authentication/PancakeAuthentication.h"
#include "../Pancake.h"
#include "../Authentication/PancakeAuthentication.h"
UByte PancakeAuthenticationFileInitialize();
@@ -29,5 +26,3 @@ extern PancakeModule PancakeAuthenticationFileModule;
#define PANCAKE_AUTHENTICATION_FILE_ENCRYPTION_MD5 3
#endif
#endif
@@ -0,0 +1,24 @@
option(PANCAKE_AUTHENTICATION_FILE "Enable Pancake File Authentication Backend module" OFF)
if(PANCAKE_AUTHENTICATION_FILE)
pancake_enable_module("AuthenticationFile" "PancakeAuthenticationFileModule" "AuthenticationFile/PancakeAuthenticationFile.h")
pancake_require_module("Authentication")
message(STATUS "Looking for OpenSSL")
include(FindOpenSSL)
if(NOT OPENSSL_FOUND)
message(FATAL_ERROR "OpenSSL library not found")
endif()
message(STATUS "Found OpenSSL ${OPENSSL_VERSION}")
require_include_file("openssl/md5.h")
require_include_file("openssl/sha.h")
foreach(LIBRARY ${OPENSSL_LIBRARIES})
pancake_link_library(${LIBRARY})
endforeach()
set(PANCAKE_SOURCE_FILES ${PANCAKE_SOURCE_FILES} AuthenticationFile/PancakeAuthenticationFile.c)
endif()

This file was deleted.

Oops, something went wrong.
View
@@ -0,0 +1,154 @@
cmake_minimum_required(VERSION 2.8.4)
project(Pancake2 C)
message(STATUS "${CMAKE_SYSTEM} on ${CMAKE_SYSTEM_PROCESSOR} processor")
include(CheckIncludeFile)
include(CheckIncludeFiles)
include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckTypeSize)
include(FindFLEX)
include(FindBISON)
macro(pancake_require_module NAME)
set(REQUIRED_MODULES ${REQUIRED_MODULES} ${NAME})
endmacro()
macro(pancake_enable_module NAME MODULE INCLUDE_FILE)
message(STATUS "Enabling module ${NAME}")
string(TOUPPER ${NAME} NAME_UPPER)
add_definitions(-DPANCAKE_${NAME_UPPER})
set(PANCAKE_MODULE_${NAME} 1)
set(MODULE_VARIABLES ${MODULE_VARIABLES} ${MODULE})
set(MODULE_INCLUDES ${MODULE_INCLUDES} ${INCLUDE_FILE})
endmacro()
macro(pancake_link_library LIBRARY)
message(STATUS "Linking with library ${LIBRARY}")
set(LINK_LIBRARIES ${LINK_LIBRARIES} ${LIBRARY})
endmacro()
macro(require_include_file NAME)
check_include_file("${NAME}" HAVE_INCLUDE_FILE)
if(NOT HAVE_INCLUDE_FILE)
unset(HAVE_INCLUDE_FILE CACHE)
message(FATAL_ERROR "${NAME} not found")
endif()
unset(HAVE_INCLUDE_FILE CACHE)
endmacro()
macro(require_library LIBRARY FUNCTION LOCATION)
check_library_exists(${LIBRARY} ${FUNCTION} "${LOCATION}" HAVE_LIBRARY)
if(NOT HAVE_LIBRARY)
unset(HAVE_LIBRARY CACHE)
message(FATAL_ERROR "${FUNCTION} not found in library ${LIBRARY} (or library not found)")
endif()
unset(HAVE_LIBRARY CACHE)
endmacro()
set(PANCAKE_SOURCE_FILES ConfigurationParser/PancakeConfigurationParser.c
ConfigurationParser/scanctx.c
ConfigurationParser/scanner.l
ConfigurationParser/strbuf.c
SharedDependencies/Base64Decode.c
Pancake.c
PancakeConfiguration.c
PancakeDateTime.c
PancakeDebug.c
PancakeLogger.c
PancakeNetwork.c
PancakeScheduler.c
PancakeWorkers.c
PancakeModules.c)
require_include_file("errno.h")
require_include_file("unistd.h")
require_include_file("stdlib.h")
require_include_file("stddef.h")
require_include_file("stdio.h")
require_include_file("string.h")
require_include_file("stdarg.h")
require_include_file("signal.h")
require_include_file("fcntl.h")
require_include_file("ctype.h")
require_include_file("limits.h")
require_include_file("time.h")
require_include_file("sys/stat.h")
require_include_file("sys/types.h")
require_include_file("sys/socket.h")
require_include_file("sys/un.h")
require_include_file("netinet/in.h")
if(NOT CYGWIN)
require_include_file("netinet/tcp.h") # Cygwin does not correctly include type definitions
endif()
require_include_file("arpa/inet.h")
check_include_file("valgrind/valgrind.h" HAVE_VALGRIND_H)
check_include_file("ucontext.h" HAVE_UCONTEXT_H)
check_include_file("execinfo.h" HAVE_EXECINFO_H)
check_include_file("xlocale.h" HAVE_XLOCALE_H)
check_type_size("long" SIZEOF_LONG)
check_function_exists("newlocale" HAVE_NEWLOCALE)
check_function_exists("uselocale" HAVE_USELOCALE)
check_function_exists("freelocale" HAVE_FREELOCALE)
find_package(BISON)
find_package(FLEX)
bison_target(ConfigurationParserGrammar ConfigurationParser/grammar.y ${CMAKE_CURRENT_SOURCE_DIR}/ConfigurationParser/grammar.c)
flex_target(ConfigurationParserScanner ConfigurationParser/scanner.l ${CMAKE_CURRENT_SOURCE_DIR}/ConfigurationParser/scanner.c)
add_flex_bison_dependency(ConfigurationParserScanner ConfigurationParserGrammar)
set(PANCAKE_SOURCE_FILES ${PANCAKE_SOURCE_FILES} ${BISON_ConfigurationParserGrammar_OUTPUTS} ${FLEX_ConfigurationParserScanner_OUTPUTS})
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Enabling Pancake debug mode")
set(PANCAKE_DEBUG 1)
endif()
file(GLOB FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
foreach(FILE ${FILES})
if(IS_DIRECTORY ${FILE})
if(EXISTS "${FILE}/PancakeModule.cmake")
message(STATUS "Found Pancake module ${FILE}")
include("${FILE}/PancakeModule.cmake")
endif()
endif()
endforeach()
foreach(MODULE ${REQUIRED_MODULES})
message(STATUS "Checking for required module ${MODULE}")
if(NOT DEFINED PANCAKE_MODULE_${MODULE})
message(FATAL_ERROR "Required module ${MODULE} was not enabled")
endif()
endforeach()
configure_file(${Pancake2_SOURCE_DIR}/config.h.in ${Pancake2_BINARY_DIR}/config.h)
add_executable(GeneratePancakeModules PancakeModulesGenerator.c)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/PancakeModules.c
COMMAND GeneratePancakeModules ${CMAKE_CURRENT_BINARY_DIR}/PancakeModules.c ${MODULE_INCLUDES} ${MODULE_VARIABLES}
DEPENDS GeneratePancakeModules
)
add_definitions(-DHAVE_CONFIG_H)
add_executable(Pancake ${PANCAKE_SOURCE_FILES})
if(LINK_LIBRARIES)
target_link_libraries(Pancake ${LINK_LIBRARIES})
endif()
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
@@ -32,10 +32,10 @@
#endif
#include "PancakeConfigurationParser.h"
#include "grammar.h"
#include "scanner.h"
#include "scanctx.h"
#include "parsectx.h"
#include "grammar.h"
#include "scanner.h"
#include <locale.h>
@@ -63,11 +63,6 @@ static void __config_write_setting(const config_setting_t *setting,
FILE *stream, int depth,
unsigned short tab_width);
extern int PancakeConfigurationParser_yyparse(void *scanner, struct parse_context *ctx,
struct scan_context *scan_ctx);
extern int PancakeConfigurationParser_yylex_init_extra(struct scan_context *scan_ctx,
yyscan_t *scanner);
/* ------------------------------------------------------------------------- */
static void __config_locale_override(void)
@@ -557,15 +552,15 @@ static int __config_read(config_t *config, FILE *stream, const char *filename,
scanctx_init(&scan_ctx, filename);
scan_ctx.config = config;
PancakeConfigurationParser_yylex_init_extra(&scan_ctx, &scanner);
yylex_init_extra(&scan_ctx, &scanner);
if(stream)
PancakeConfigurationParser_yyrestart(stream, scanner);
yyrestart(stream, scanner);
else /* read from string */
PancakeConfigurationParser_yy_scan_string(str, scanner);
yy_scan_string(str, scanner);
PancakeConfigurationParser_yyset_lineno(1, scanner);
r = PancakeConfigurationParser_yyparse(scanner, &parse_ctx, &scan_ctx);
yyset_lineno(1, scanner);
r = yyparse(scanner, &parse_ctx, &scan_ctx);
if(r != 0)
{
@@ -576,10 +571,10 @@ static int __config_read(config_t *config, FILE *stream, const char *filename,
/* Unwind the include stack, freeing the buffers and closing the files. */
while((buf = (YY_BUFFER_STATE)scanctx_pop_include(&scan_ctx)) != NULL)
PancakeConfigurationParser_yy_delete_buffer(buf, scanner);
yy_delete_buffer(buf, scanner);
}
PancakeConfigurationParser_yylex_destroy(scanner);
yylex_destroy(scanner);
config->filenames = scanctx_cleanup(&scan_ctx, &(config->num_filenames));
parsectx_cleanup(&parse_ctx);
Oops, something went wrong.

0 comments on commit 8d4cd47

Please sign in to comment.