package third_party.qpid

@Build(stage=2,script="$(EXTERNAL_MAKE)")
@BuildArtifactPath(cppflags="-I$(abspath $(EXTERNAL_BUILD_DIR))/third_party/qpid/core/install/include -I$(abspath $(EXTERNAL_BUILD_DIR))/third_party/qpid/core/install/include/qpid",
		ldflags="-L$(abspath $(EXTERNAL_BUILD_DIR))/third_party/qpid/core/install/lib")
@BuildDepends(third_party.boost.libs)
@BuildDepends(third_party.e2fsprogs.core)
@BuildDepends(third_party.STLport.libstlportg)
/* NOTE this was static module, until some day I tried to connect to broker via tcp.
   TCPConnector class was missing, that registers tcp proto in static constructor of
   some artifical class. Since noone reference that, tcp was disabled.
   I turn this module into not static, and TCPConnector starts to register.
   Anton Kozlov
*/
module core {
	@AddPrefix("^BUILD/extbld/^MOD_PATH/install/lib")
	source "libqpidbroker.a", "libqpidclient.a",
		"libqpidcommon.a", "libqpidmessaging.a", "libqpidtypes.a"

	@NoRuntime depends embox.compat.posix.fs.fsop
	@NoRuntime depends embox.compat.posix.idx.pipe
	@NoRuntime depends embox.compat.posix.idx.poll
	@NoRuntime depends embox.compat.posix.idx.select
	@NoRuntime depends embox.compat.posix.net.gai_strerror
	@NoRuntime depends embox.compat.posix.net.getaddrinfo
	@NoRuntime depends embox.compat.posix.net.getnameinfo
	@NoRuntime depends embox.compat.posix.net.socket
	@NoRuntime depends embox.compat.posix.util.gethostname
	@NoRuntime depends embox.compat.posix.util.sleep
	@NoRuntime depends embox.compat.posix.util.utsname
	@NoRuntime depends embox.compat.libc.all
	@NoRuntime depends embox.net.lib.getifaddrs
	@NoRuntime depends third_party.boost.libs
	@NoRuntime depends third_party.e2fsprogs.core
	@NoRuntime depends third_party.STLport.libstlportg
	@NoRuntime depends embox.compat.posix.pthread_key
	@NoRuntime depends embox.compat.posix.regex_trex
	@NoRuntime depends embox.compat.posix.sys.mman.msync
}

@Build(stage=2,script="true")
@BuildDepends(core)
@Cmd(name = "qpidd",
	help = "qpidd",
	man = '''
		AUTHORS
			Alexander Kalmuk
	''')
module qpidd {
	@Rule(script="$(EXTERNAL_MAKE) -f $(abspath $(ROOT_DIR))/mk/main-stripping.mk TARGET_APP='$(module_id)' FILE_APP='$(abspath $@)'")
	@AddPrefix("^BUILD/extbld/third_party/qpid/core/install/bin")
	source "strip.QpiddBroker.o"

	@AddPrefix("^BUILD/extbld/third_party/qpid/core/install/bin")
	source "qpidd.o"

	@NoRuntime depends third_party.qpid.core
	depends embox.compat.posix.stubs
}

@Build(stage=2,script="true")
@BuildDepends(core)
@Cmd(name = "qpidd_hello",
	help = "simple qpid broker test",
	man = '''
		AUTHORS
			Alexander Kalmuk
	''')
module qpidd_hello {
	@Rule(script="$(EXTERNAL_MAKE) -f $(abspath $(ROOT_DIR))/mk/main-stripping.mk TARGET_APP='$(module_id)' FILE_APP='$(abspath $@)'")
	@AddPrefix("^BUILD/extbld/third_party/qpid/core/install/bin")
	source "strip.hello_world.o"

	@NoRuntime depends third_party.qpid.core
	depends embox.compat.posix.stubs
}

