@ -14,10 +14,15 @@ package("drogon")
add_patches ( " 1.6.0 " , path.join ( os.scriptdir ( ) , " patches " , " 1.6.0 " , " trantor.patch " ) , " 87e317bf5e45b3f3dfe781db8a0af9603ebdab057a6aedbc36d8aec9e0da58a7 " )
add_patches ( " 1.6.0 " , path.join ( os.scriptdir ( ) , " patches " , " 1.6.0 " , " resolv.patch " ) , " dc144ff1cdcfee413efbcdc568fed587318289e8fa1bb0da9d2ea94a15588b25 " )
add_configs ( " c_ares " , { description = " Enable async DNS query support. " , default = false , type = " boolean " } )
add_configs ( " mysql " , { description = " Enable mysql support. " , default = false , type = " boolean " } )
add_configs ( " openssl " , { description = " Enable openssl support. " , default = true , type = " boolean " } )
add_configs ( " postgresql " , { description = " Enable postgresql support. " , default = false , type = " boolean " } )
add_configs ( " sqlite3 " , { description = " Enable sqlite3 support. " , default = false , type = " boolean " } )
add_deps ( " cmake " )
add_deps ( " trantor " , " jsoncpp " , " brotli " , " zlib " )
add_deps ( " c-ares " , " sqlite3 " , " openssl " , " mysql " , { optional = true } )
add_deps ( " postgresql " , { optional = true , system = true } )
if is_plat ( " windows " ) then
add_syslinks ( " ws2_32 " , " rpcrt4 " , " crypt32 " , " advapi32 " )
else
@ -27,24 +32,49 @@ package("drogon")
end
end
on_load ( function ( package )
local configdeps = { c_ares = " c-ares " ,
mysql = " mysql " ,
openssl = " openssl " ,
postgresql = " postgresql " ,
sqlite3 = " sqlite3 " }
for name , dep in pairs ( configdeps ) do
if package : config ( name ) then
package : add ( " deps " , dep )
end
end
end )
on_install ( " windows|x64 " , " macosx " , " linux " , function ( package )
io.replace ( " cmake/templates/config.h.in " , " \" @COMPILATION_FLAGS@@DROGON_CXX_STANDARD@ \" " , " R \" (@COMPILATION_FLAGS@@DROGON_CXX_STANDARD@) \" " , { plain = true } )
local configs = { " -DBUILD_EXAMPLES=OFF " }
table.insert ( configs , " -DCMAKE_BUILD_TYPE= " .. ( package : debug ( ) and " Debug " or " Release " ) )
-- no support for windows shared library
if not package : is_plat ( " windows " ) then
table.insert ( configs , " -DBUILD_DROGON_SHARED= " .. ( package : config ( " shared " ) and " ON " or " OFF " ) )
end
if not package : dep ( " postgresql " ) : fetch ( ) then
table.insert ( configs , " -DBUILD_POSTGRESQL=OFF " )
end
if not package : dep ( " sqlite3 " ) : fetch ( ) then
table.insert ( configs , " -DBUILD_SQLITE=OFF " )
end
if not package : dep ( " mysql " ) : fetch ( ) then
table.insert ( configs , " -DBUILD_MYSQL=OFF " )
for name , enabled in pairs ( package : configs ( ) ) do
if not package : extraconf ( " configs " , name , " builtin " ) then
if enabled then
if name == " sqlite3 " then
table.insert ( configs , " -DBUILD_SQLITE=ON " )
else
table.insert ( configs , " -DBUILD_ " .. name : upper ( ) .. " =ON " )
end
else
if name == " sqlite3 " then
table.insert ( configs , " -DBUILD_SQLITE=OFF " )
else
table.insert ( configs , " -DBUILD_ " .. name : upper ( ) .. " =OFF " )
end
end
end
end
if package : config ( " pic " ) ~= false then
table.insert ( configs , " -DCMAKE_POSITION_INDEPENDENT_CODE=ON " )
end