1
1
package (" thrift" )
2
-
3
2
set_homepage (" https://thrift.apache.org/" )
4
3
set_description (" Thrift is a lightweight, language-independent software stack for point-to-point RPC implementation." )
5
4
set_license (" Apache-2.0" )
6
5
7
- add_urls (" https://dlcdn.apache.org/thrift/0.16.0/thrift-0.16.0.tar.gz" , {version = function (version )
8
- return version :gsub (" v" , " " )
9
- end })
10
- add_urls (" https://github.com/apache/thrift.git" )
11
- add_versions (" v0.16.0" , " f460b5c1ca30d8918ff95ea3eb6291b3951cf518553566088f3f2be8981f6209" )
6
+ add_urls (" https://github.com/apache/thrift/archive/refs/tags/$(version).tar.gz" ,
7
+ " https://github.com/apache/thrift.git" )
8
+
9
+ add_versions (" v0.16.0" , " df2931de646a366c2e5962af679018bca2395d586e00ba82d09c0379f14f8e7b" )
10
+
11
+ add_patches (" >=0.16.0" , " patches/0.16.0/cmake.patch" , " 8dd82f54d52a37487e64aa3529f4dbcedcda671ab46fcb7a8c0f2c521ee0be9b" )
12
+
13
+ add_configs (" compiler" , {description = " Build compiler" , default = false , type = " boolean" })
12
14
13
15
add_deps (" cmake" , " boost" )
14
16
if is_plat (" windows" ) then
@@ -17,48 +19,53 @@ package("thrift")
17
19
add_deps (" flex" , " bison" )
18
20
end
19
21
20
- local configdeps = {glib = " glib" , libevent = " libevent" , ssl = " openssl" , zlib = " zlib " }
21
- for config , dep in pairs (configdeps ) do
22
- add_configs (config , {description = " Enable " .. config .. " support." , default = false , type = " boolean" })
22
+ local configdeps = {" glib" , " libevent" , " openssl" , " zlib" , " qt5 " }
23
+ for _ , dep in pairs (configdeps ) do
24
+ add_configs (dep , {description = " Enable " .. dep .. " support." , default = false , type = " boolean" })
23
25
end
24
26
25
27
on_load (function (package )
26
- for name , dep in pairs (configdeps ) do
27
- if package :config (name ) then
28
- if name == " libevent" and package :config (" ssl " ) then
28
+ for _ , dep in pairs (configdeps ) do
29
+ if package :config (dep ) then
30
+ if dep == " libevent" and package :config (" openssl " ) then
29
31
package :add (" deps" , " libevent" , {configs = {openssl = true }})
32
+ elseif dep == " openssl" then
33
+ package :add (" deps" , " openssl3" )
34
+ elseif dep == " qt5" then
35
+ package :add (" deps" , " qt5core" , " qt5network" )
30
36
else
31
37
package :add (" deps" , dep )
32
38
end
33
39
end
34
40
end
35
41
end )
36
42
37
- on_install (" linux" , " macosx" , " cross" , function (package )
43
+ on_install (" windows " , " linux" , " macosx" , " cross" , function (package )
38
44
local configs = {
39
45
" -DBUILD_TESTING=OFF" ,
40
- " -DWITH_STDTHREADS=ON" ,
41
- " -DBUILD_COMPILER=ON" ,
42
46
" -DBUILD_TUTORIALS=OFF" ,
43
- -- language support.
47
+
44
48
" -DBUILD_CPP=ON" ,
45
49
" -DBUILD_JAVA=OFF" ,
46
50
" -DBUILD_JAVASCRIPT=OFF" ,
47
51
" -DBUILD_NODEJS=OFF" ,
48
52
" -DBUILD_PYTHON=OFF" ,
49
53
}
50
54
51
- for config , dep in pairs (configdeps ) do
52
- -- Use WITH_OPENSSL instead of WITH_SSL, thus use dep:upper().
55
+ for _ , dep in pairs (configdeps ) do
53
56
local feat = dep :upper ()
54
- if config == " glib" then
57
+ if dep == " glib" then
55
58
feat = " C_GLIB"
56
59
end
57
- table.insert (configs , " -DWITH_" .. feat .. " =" .. (package :config (config ) and " ON" or " OFF" ))
60
+ table.insert (configs , " -DWITH_" .. feat .. " =" .. (package :config (dep ) and " ON" or " OFF" ))
58
61
end
59
62
60
- table.insert (configs , " -DCMAKE_BUILD_TYPE=" .. (package :debug () and " Debug" or " Release" ))
63
+ table.insert (configs , " -DCMAKE_BUILD_TYPE=" .. (package :is_debug () and " Debug" or " Release" ))
61
64
table.insert (configs , " -DBUILD_SHARED_LIBS=" .. (package :config (" shared" ) and " ON" or " OFF" ))
65
+ table.insert (configs , " -DBUILD_COMPILER=" .. (package :config (" compiler" ) and " ON" or " OFF" ))
66
+ if package :is_plat (" windows" ) then
67
+ table.insert (configs , " -DWITH_MT=" .. (package :has_runtime (" MT" ) and " ON" or " OFF" ))
68
+ end
62
69
import (" package.tools.cmake" ).install (package , configs )
63
70
end )
64
71
@@ -67,5 +74,5 @@ package("thrift")
67
74
apache::thrift::transport::TTransport* test() {
68
75
return new apache::thrift::transport::TSocket("localhost", 9090);
69
76
}
70
- ]] }, {configs = {languages = " c++11" }, includes = " thrift/transport/TSocket.h" }))
77
+ ]] }, {configs = {languages = " c++11" }, includes = " thrift/transport/TSocket.h" }))
71
78
end )
0 commit comments