Skip to content
Permalink
Browse files

Problem: Zyre out of sync with zproject

Solution: Re-generate it!
  • Loading branch information...
Kevin Sapper
Kevin Sapper committed May 24, 2019
1 parent c655a28 commit 191fe27d2a9739840ef151fda913fd44dce40b09
@@ -72,15 +72,17 @@ if (NOT HAVE_NET_IF_H)
CHECK_INCLUDE_FILE("net/if.h" HAVE_NET_IF_H)
endif()

file(WRITE "${SOURCE_DIR}/src/platform.h.in" "
file(REMOVE "${SOURCE_DIR}/src/platform.h")

file(WRITE "${CMAKE_BINARY_DIR}/platform.h.in" "
#cmakedefine HAVE_LINUX_WIRELESS_H
#cmakedefine HAVE_NET_IF_H
#cmakedefine HAVE_NET_IF_MEDIA_H
#cmakedefine HAVE_GETIFADDRS
#cmakedefine HAVE_FREEIFADDRS
")

configure_file("${SOURCE_DIR}/src/platform.h.in" "${SOURCE_DIR}/src/platform.h")
configure_file("${CMAKE_BINARY_DIR}/platform.h.in" "${CMAKE_BINARY_DIR}/platform.h")

#The MSVC C compiler is too out of date,
#so the sources have to be compiled as c++
@@ -181,7 +183,7 @@ install(FILES ${zyre_headers} DESTINATION include)
########################################################################


include_directories("${SOURCE_DIR}/src" "${SOURCE_DIR}/include")
include_directories("${SOURCE_DIR}/src" "${SOURCE_DIR}/include" "${CMAKE_BINARY_DIR}")
set (zyre_sources
src/zyre.c
src/zyre_event.c
@@ -556,7 +558,7 @@ set(cmake_generated ${CMAKE_BINARY_DIR}/CMakeCache.txt
${CMAKE_BINARY_DIR}/DartConfiguration.tcl
${CMAKE_BINARY_DIR}/Testing
${CMAKE_BINARY_DIR}/compile_commands.json
${CMAKE_BINARY_DIR}/src/platform.h
${CMAKE_BINARY_DIR}/platform.h
${CMAKE_BINARY_DIR}/src/libzyre.pc
${CMAKE_BINARY_DIR}/src/libzyre.so
${CMAKE_BINARY_DIR}/src/zyre_selftest
@@ -29,7 +29,7 @@ RUN sudo make install
RUN sudo ldconfig

WORKDIR /home/zmq
RUN git clone --quiet git://github.com/zeromq/zyre.git zyre
RUN git clone --quiet https://github.com/zeromq/zyre zyre
WORKDIR /home/zmq/zyre
RUN ./autogen.sh 2> /dev/null
RUN ./configure --quiet --without-docs
@@ -23,11 +23,71 @@ find_path (
HINTS ${PC_LIBZMQ_INCLUDE_HINTS}
)

find_library (
LIBZMQ_LIBRARIES
NAMES zmq
HINTS ${PC_LIBZMQ_LIBRARY_HINTS}
)
if (MSVC)
# libzmq dll/lib built with MSVC is named using the Boost convention.
# https://github.com/zeromq/czmq/issues/577
# https://github.com/zeromq/czmq/issues/1972
if (MSVC_IDE)
set(MSVC_TOOLSET "-${CMAKE_VS_PLATFORM_TOOLSET}")
else ()
set(MSVC_TOOLSET "")
endif ()

# Retrieve ZeroMQ version number from zmq.h
file(STRINGS "${LIBZMQ_INCLUDE_DIRS}/zmq.h" zmq_version_defines
REGEX "#define ZMQ_VERSION_(MAJOR|MINOR|PATCH)")
foreach(ver ${zmq_version_defines})
if(ver MATCHES "#define ZMQ_VERSION_(MAJOR|MINOR|PATCH) +([^ ]+)$")
set(ZMQ_VERSION_${CMAKE_MATCH_1} "${CMAKE_MATCH_2}" CACHE INTERNAL "")
endif()
endforeach()

set(_zmq_version ${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH})

set(_zmq_debug_names)
set(_zmq_release_names)

set(_zmq_debug_names
"libzmq${MSVC_TOOLSET}-mt-gd-${_zmq_version}" # Debug, BUILD_SHARED
"libzmq${MSVC_TOOLSET}-mt-sgd-${_zmq_version}" # Debug, BUILD_STATIC
"libzmq-mt-gd-${_zmq_version}" # Debug, BUILD_SHARED
"libzmq-mt-sgd-${_zmq_version}" # Debug, BUILD_STATIC
)

set(_zmq_release_names
"libzmq${MSVC_TOOLSET}-mt-${_zmq_version}" # Release|RelWithDebInfo|MinSizeRel, BUILD_SHARED
"libzmq${MSVC_TOOLSET}-mt-s-${_zmq_version}" # Release|RelWithDebInfo|MinSizeRel, BUILD_STATIC
"libzmq-mt-${_zmq_version}" # Release|RelWithDebInfo|MinSizeRel, BUILD_SHARED
"libzmq-mt-s-${_zmq_version}" # Release|RelWithDebInfo|MinSizeRel, BUILD_STATIC
)

find_library (ZeroMQ_LIBRARY_DEBUG
NAMES ${_zmq_debug_names}
)

find_library (ZeroMQ_LIBRARY_RELEASE
NAMES ${_zmq_release_names}
)

if (ZeroMQ_LIBRARY_RELEASE AND ZeroMQ_LIBRARY_DEBUG)
set(LIBZMQ_LIBRARIES
debug ${ZeroMQ_LIBRARY_DEBUG}
optimized ${ZeroMQ_LIBRARY_RELEASE}
)
elseif (ZeroMQ_LIBRARY_RELEASE)
set(LIBZMQ_LIBRARIES ${ZeroMQ_LIBRARY_RELEASE})
elseif (ZeroMQ_LIBRARY_DEBUG)
set(LIBZMQ_LIBRARIES ${ZeroMQ_LIBRARY_DEBUG})
endif ()
endif ()

if (NOT LIBZMQ_LIBRARIES)
find_library (
LIBZMQ_LIBRARIES
NAMES zmq libzmq
HINTS ${PC_LIBZMQ_LIBRARY_HINTS}
)
endif ()

include(FindPackageHandleStandardArgs)

Large diffs are not rendered by default.

@@ -31,7 +31,7 @@ dependencies {
testCompile 'org.hamcrest:hamcrest-all:1.3'
}

wrapper.gradleVersion = '5.0'
wrapper.gradleVersion = '5.4.1'

// ------------------------------------------------------------------
// Build section
@@ -55,7 +55,16 @@ task initCMake(type: Exec, dependsOn: 'generateJniHeaders') {
task buildNative(type: Exec, dependsOn: 'initCMake') {
commandLine "make"
}

task copyLibs(type: Copy) {
from "/usr/lib/libzyre.so", "/usr/local/lib/libzyre.so", "/tmp/lib/libzyre.so",
"/usr/lib/libzmq.so", "/usr/local/lib/libzmq.so", "/tmp/lib/libzmq.so",
"/usr/lib/libczmq.so", "/usr/local/lib/libczmq.so", "/tmp/lib/libczmq.so"
into "."
}

jar.dependsOn buildNative
jar.dependsOn copyLibs
test.dependsOn buildNative

jar {
@@ -133,5 +142,5 @@ bintray {

clean.doFirst {
delete "${rootDir}/CMakeCache.txt"
delete "${rootDir}/libczmqjni.so"
delete fileTree("${rootDir}") { include "*.so" }
}
@@ -6,6 +6,7 @@
*/
package org.zeromq.zyre;

import java.util.stream.Stream;
import org.scijava.nativelib.NativeLoader;
import org.zeromq.czmq.*;

@@ -14,6 +15,18 @@
if (System.getProperty("java.vm.vendor").contains("Android")) {
System.loadLibrary("zyrejni");
} else {
Stream.of(
"zmq",
"czmq",
"zyre"
)
.forEach(lib -> {
try {
NativeLoader.loadLibrary(lib);
} catch (Exception e) {
System.err.println("[WARN] " + e.getMessage() +" from jar. Assuming it is installed on the system.");
}
});
try {
NativeLoader.loadLibrary("zyrejni");
} catch (Exception e) {
@@ -6,6 +6,7 @@
*/
package org.zeromq.zyre;

import java.util.stream.Stream;
import org.scijava.nativelib.NativeLoader;
import org.zeromq.czmq.*;

@@ -14,6 +15,18 @@
if (System.getProperty("java.vm.vendor").contains("Android")) {
System.loadLibrary("zyrejni");
} else {
Stream.of(
"zmq",
"czmq",
"zyre"
)
.forEach(lib -> {
try {
NativeLoader.loadLibrary(lib);
} catch (Exception e) {
System.err.println("[WARN] " + e.getMessage() +" from jar. Assuming it is installed on the system.");
}
});
try {
NativeLoader.loadLibrary("zyrejni");
} catch (Exception e) {
@@ -0,0 +1,17 @@
################################################################################
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
# Read the zproject/README.md for information about making permanent changes. #
################################################################################
NAME = "zyre"
VERSION = "2.0.1"
LICENSE = "mplv2"
DESCRIPTION = """Python bindings of: an open-source framework for proximity-based p2p apps"""
URL = "https://github.com/zeromq/zyre"
PACKAGES = ["zyre"]
REQUIRES = [
"czmq",
]
################################################################################
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
# Read the zproject/README.md for information about making permanent changes. #
################################################################################
@@ -47,12 +47,12 @@ def set_name(self, name):
"""
utils.lib.zyre_set_name(self._p, utils.to_bytes(name))

def set_header(self, name, format, ):
def set_header(self, name, format, *format_args):
"""
Set node header; these are provided to other nodes during discovery
and come in each ENTER message.
"""
utils.lib.zyre_set_header(self._p, utils.to_bytes(name), format, )
utils.lib.zyre_set_header(self._p, utils.to_bytes(name), format, *format_args)

def set_verbose(self):
"""
@@ -111,7 +111,7 @@ def set_interface(self, value):
"""
utils.lib.zyre_set_interface(self._p, utils.to_bytes(value))

def set_endpoint(self, format, ):
def set_endpoint(self, format, *format_args):
"""
By default, Zyre binds to an ephemeral TCP port and broadcasts the local
host name using UDP beaconing. When you call this method, Zyre will use
@@ -122,7 +122,7 @@ def set_endpoint(self, format, ):
that is meaningful to remote as well as local nodes). Returns 0 if
the bind was successful, else -1.
"""
return utils.lib.zyre_set_endpoint(self._p, format, )
return utils.lib.zyre_set_endpoint(self._p, format, *format_args)

def set_contest_in_group(self, group):
"""
@@ -153,28 +153,28 @@ def set_zap_domain(self, domain):
"""
utils.lib.zyre_set_zap_domain(self._p, utils.to_bytes(domain))

def gossip_bind(self, format, ):
def gossip_bind(self, format, *format_args):
"""
Set-up gossip discovery of other nodes. At least one node in the cluster
must bind to a well-known gossip endpoint, so other nodes can connect to
it. Note that gossip endpoints are completely distinct from Zyre node
endpoints, and should not overlap (they can use the same transport).
"""
utils.lib.zyre_gossip_bind(self._p, format, )
utils.lib.zyre_gossip_bind(self._p, format, *format_args)

def gossip_connect(self, format, ):
def gossip_connect(self, format, *format_args):
"""
Set-up gossip discovery of other nodes. A node may connect to multiple
other nodes, for redundancy paths. For details of the gossip network
design, see the CZMQ zgossip class.
"""
utils.lib.zyre_gossip_connect(self._p, format, )
utils.lib.zyre_gossip_connect(self._p, format, *format_args)

def gossip_connect_curve(self, public_key, format, ):
def gossip_connect_curve(self, public_key, format, *format_args):
"""
Set-up gossip discovery with CURVE enabled.
"""
utils.lib.zyre_gossip_connect_curve(self._p, utils.to_bytes(public_key), format, )
utils.lib.zyre_gossip_connect_curve(self._p, utils.to_bytes(public_key), format, *format_args)

def gossip_unpublish(self, node):
"""
@@ -224,26 +224,26 @@ def whisper(self, peer, msg_p):
Send message to single peer, specified as a UUID string
Destroys message after sending
"""
return utils.lib.zyre_whisper(self._p, utils.to_bytes(peer), msg_p._p)
return utils.lib.zyre_whisper(self._p, utils.to_bytes(peer), utils.ffi.new("zmsg_t **", msg_p._p))

def shout(self, group, msg_p):
"""
Send message to a named group
Destroys message after sending
"""
return utils.lib.zyre_shout(self._p, utils.to_bytes(group), msg_p._p)
return utils.lib.zyre_shout(self._p, utils.to_bytes(group), utils.ffi.new("zmsg_t **", msg_p._p))

def whispers(self, peer, format, ):
def whispers(self, peer, format, *format_args):
"""
Send formatted string to a single peer specified as UUID string
"""
return utils.lib.zyre_whispers(self._p, utils.to_bytes(peer), format, )
return utils.lib.zyre_whispers(self._p, utils.to_bytes(peer), format, *format_args)

def shouts(self, group, format, ):
def shouts(self, group, format, *format_args):
"""
Send formatted string to a named group
"""
return utils.lib.zyre_shouts(self._p, utils.to_bytes(group), format, )
return utils.lib.zyre_shouts(self._p, utils.to_bytes(group), format, *format_args)

def peers(self):
"""
@@ -301,13 +301,15 @@ def print_py(self):
"""
utils.lib.zyre_print(self._p)

@staticmethod
def version():
"""
Return the Zyre version for run-time API detection; returns
major * 10000 + minor * 100 + patch, as a single integer.
"""
return utils.lib.zyre_version()

@staticmethod
def test(verbose):
"""
Self test of this class.
@@ -92,6 +92,7 @@ def print_py(self):
"""
utils.lib.zyre_event_print(self._p)

@staticmethod
def test(verbose):
"""
Self test of this class.

0 comments on commit 191fe27

Please sign in to comment.
You can’t perform that action at this time.