forked from SnarkyClark/luafcgid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
101 lines (79 loc) · 3.55 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# $Id$
PROJECT (luafcgid)
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
OPTION (ENABLE_LUAJIT "Enable building with luajit")
IF (ENABLE_LUAJIT_STATIC OR ENABLE_LUAJIT)
INCLUDE (FindLuaJIT.cmake)
ELSE (ENABLE_LUAJIT_STATIC OR ENABLE_LUAJIT)
INCLUDE (FindLua.cmake)
ENDIF (ENABLE_LUAJIT_STATIC OR ENABLE_LUAJIT)
INCLUDE (FindFastCGI.cmake)
INCLUDE (CheckIncludeFiles)
INCLUDE (CheckFunctionExists)
CHECK_INCLUDE_FILES (alloca.h HAVE_ALLOCA_H)
CHECK_FUNCTION_EXISTS (strndup HAVE_STRNDUP)
CHECK_FUNCTION_EXISTS (daemon HAVE_DAEMON)
IF (HAVE_ALLOCA_H)
ADD_DEFINITIONS (-DHAVE_ALLOCA_H=1)
ENDIF (HAVE_ALLOCA_H)
IF (HAVE_STRNDUP)
ADD_DEFINITIONS (-DHAVE_STRNDUP=1)
ENDIF (HAVE_STRNDUP)
IF (HAVE_DAEMON)
ADD_DEFINITIONS (-DHAVE_DAEMON=1)
ENDIF (HAVE_DAEMON)
INCLUDE_DIRECTORIES (${LUA_INCLUDE_DIR} ${FASTCGI_INCLUDE_DIR} src)
LINK_DIRECTORIES (${LUA_LIBRARY_DIR})
SET (luafcgid_SOURCE_FILES
src/main.c
src/config.c
src/pool.c
src/buffer.c
src/request.c
)
ADD_EXECUTABLE (luafcgid ${luafcgid_SOURCE_FILES})
TARGET_LINK_LIBRARIES (luafcgid ${LUA_LIBRARIES} ${FASTCGI_LIBRARIES} rt)
INSTALL (TARGETS luafcgid DESTINATION bin)
INSTALL (PROGRAMS scripts/etc/init.d/luafcgid.debian DESTINATION /etc/init.d RENAME luafcgid)
INSTALL (FILES scripts/etc/config.debian.lua DESTINATION /etc/luafcgid RENAME config.lua)
INSTALL (FILES scripts/luafcgid.lua DESTINATION ${LUA_MODULE_DIR})
INSTALL (FILES docs/luafcgid.1.gz DESTINATION share/man/man1)
INSTALL (FILES docs/luafcgid-config.5.gz DESTINATION share/man/man5)
SET (CPACK_GENERATOR "DEB")
SET (CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
SET (CPACK_PACKAGE_VERSION_MAJOR "1")
SET (CPACK_PACKAGE_VERSION_MINOR "0")
SET (CPACK_PACKAGE_VERSION_PATCH "1")
SET (CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-6")
SET (CPACK_PACKAGE_CONTACT "Like Ma <likemartinma@gmail.com>")
FIND_PROGRAM(DPKG_CMD dpkg)
IF (DPKG_CMD)
EXECUTE_PROCESS (COMMAND "${DPKG_CMD}" --print-architecture
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE)
ELSE (DPKG_CMD)
MESSAGE (STATUS "CPackDeb: Can not find dpkg in your path, default to i386.")
SET (CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
ENDIF (DPKG_CMD)
SET (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
SET (CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Lua FastCGI Server
luafcgid is a multithreaded FastCGI server that runs under BSD/Linux.
.
It manages a number of independent, persistent Lua states, that are then
loaded with Lua scripts from the file system. These scripts are loaded/
initialized on demand, and held in memory for as long as possible. The Lua
scripts are also allowed to interface with the FastCGI libraries: thus
providing an extremely fast, streamlined and lightweight platform from
which to develop web-centric apps in Lua.")
SET (CPACK_DEBIAN_PACKAGE_SECTION "net")
SET (CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/STPeters/luafcgid")
SET (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
SET (CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/debian/postinst;${CMAKE_CURRENT_SOURCE_DIR}/debian/prerm;${CMAKE_CURRENT_SOURCE_DIR}/cmake_debian/conffiles")
IF (ENABLE_LUAJIT_STATIC OR ENABLE_LUAJIT)
SET (DEB_BUILDS_LUA_DEP libluajit-5.1-dev)
ELSE (ENABLE_LUAJIT_STATIC OR ENABLE_LUAJIT)
SET (DEB_BUILDS_LUA_DEP liblua5.1-dev)
ENDIF (ENABLE_LUAJIT_STATIC OR ENABLE_LUAJIT)
SET (DEBIAN_PACKAGE_BUILDS_DEPENDS "libfcgi-dev, ${DEB_BUILDS_LUA_DEP}, cmake (>=2.8.0)")
INCLUDE (CPack)