@@ -25,6 +25,8 @@ def fail(msg)
2525vendor_path = cwd + '..'
2626zmq_path = vendor_path + 'zeromq'
2727czmq_path = vendor_path + 'czmq'
28+ libsodium_path = vendor_path + 'libsodium'
29+ libsodium_include_path = libsodium_path + 'include'
2830zmq_include_path = zmq_path + 'include'
2931czmq_include_path = czmq_path + 'include'
3032
@@ -96,6 +98,19 @@ def check_heads heads = [], fatal = false
9698 sys "cd ../.. && git submodule update --init" , "Checking out git submodules error!"
9799end
98100
101+ # build libsodium
102+ if with_config ( 'system-libs' )
103+ $stderr. puts "Warning -- using system version of libsodium."
104+ else
105+ lib = libs_path + "libsodium.#{ LIBEXT } "
106+ Dir . chdir libsodium_path do
107+ sys "./autogen.sh" , "libsodium autogen failed!" unless File . exist? ( libsodium_path + 'configure' )
108+ sys "./configure --prefix=#{ dst_path } --without-documentation --enable-shared" ,
109+ "libsodium configure failed" unless File . exist? ( libsodium_path + 'Makefile' )
110+ sys "make && make install" , "libsodium compile error!"
111+ end
112+ end
113+
99114# build libzmq
100115if with_config ( 'system-libs' )
101116 $stderr. puts "Warning -- using system version of libzmq."
@@ -106,7 +121,7 @@ def check_heads heads = [], fatal = false
106121 sys "./configure --prefix=#{ dst_path } --without-documentation --enable-shared" ,
107122 "ZeroMQ configure failed" unless File . exist? ( zmq_path + 'Makefile' )
108123 sys "make && make install" , "ZeroMQ compile error!"
109- end #unless File.exist?(lib)
124+ end
110125end
111126
112127# build libczmq
@@ -116,10 +131,10 @@ def check_heads heads = [], fatal = false
116131 lib = libs_path + "libczmq.#{ LIBEXT } "
117132 Dir . chdir czmq_path do
118133 sys "./autogen.sh" , "CZMQ autogen failed!" unless File . exist? ( czmq_path + 'configure' )
119- sys "./configure LDFLAGS=-L#{ libs_path } CFLAGS='#{ CZMQ_CFLAGS . join ( " " ) } ' --prefix=#{ dst_path } --with-libzmq=#{ dst_path } --disable-shared" ,
134+ sys "./configure LDFLAGS=-L#{ libs_path } CFLAGS='#{ CZMQ_CFLAGS . join ( " " ) } ' --prefix=#{ dst_path } --with-libzmq=#{ dst_path } --disable-shared" ,
120135 "CZMQ configure error!" unless File . exist? ( czmq_path + 'Makefile' )
121136 sys "make all && make install" , "CZMQ compile error!"
122- end #unless File.exist?(lib)
137+ end
123138end
124139
125140dir_config ( 'rbczmq' )
@@ -128,6 +143,7 @@ def check_heads heads = [], fatal = false
128143have_func ( 'rb_thread_blocking_region' )
129144have_func ( 'rb_thread_call_without_gvl' )
130145
146+ $INCFLAGS << " -I#{ libsodium_include_path } " if find_header ( "sodidum.h" , libsodium_include_path )
131147$INCFLAGS << " -I#{ zmq_include_path } " if find_header ( "zmq.h" , zmq_include_path )
132148$INCFLAGS << " -I#{ czmq_include_path } " if find_header ( "czmq.h" , czmq_include_path )
133149
0 commit comments