from: AllJoyn Project (Qualcomm Innovation Center, Inc.) <maintain...@alljoyn.org>
Add AllJoyn v. 3.3.2 as a new package to OpenWrt. AllJoyn is a peer-to-peer networking technology. Project details can be found at http://www.alljoyn.org. Signed-off-by: Steve Kinneberg <ste...@quicinc.com> --- This fixes a build bug found by Felix Fietkau. On Fri, 2013-07-26 at 12:27 +0200, Felix Fietkau wrote: > The package does not build here (it seems to be using the native > ar/ranlib tools instead of the cross-tools). > Build log is attached. > > - Felix Index: package/network/services/alljoyn/files/alljoyn.init =================================================================== --- package/network/services/alljoyn/files/alljoyn.init (revision 0) +++ package/network/services/alljoyn/files/alljoyn.init (working copy) @@ -0,0 +1,224 @@ +#!/bin/sh /etc/rc.common + +# Copyright (C) 2013 Qualcomm Innovation Center, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +START=65 + +SERVICE_PID_FILE=/var/run/alljoyn.pid + +CONFIGFILE="/var/etc/alljoyn.conf" + + +check() { + local flag + + config_get_bool flag "$1" "$2" 0 + + test "$flag" == "1" + return $? +} + + +process_network() { + local network="$1" + local var="$2" + local ifname + + config_get ifname "$network" ifname + if [ -n "$ifname" ]; then + append "${var}" "${ifname}" "," + fi +} + +process_networks() { + local section="$1" + + if check "$section" all_networks; then + export "${section}_networks=*" + else + config_list_foreach "$section" networks process_network "${section}_networks" + + if [ "$section" == "ip" ]; then + # special case IP until multiple interfaces are properly supported for IP + local len + config_get len ip networks_LENGTH + + if [ "$len" == "1" ]; then + local network + config_get network ip networks_ITEM1 + config_get addr "$network" ipaddr + fi + fi + fi +} + + +process_unix_transport() { + if check unix enable; then + local path + local abstract + + + config_get path unix path "alljoyn" + config_get_bool abstract unix abstract "1" + + if [ -n "$abstract" ]; then + path="abstract=$path" + else + path="path=$path" + fi + export ${NO_EXPORT:+-n} listen_specs="${listen_specs} + <listen>unix:${path}</listen>" + + config_get unix_auth_timeout unix auth_timeout "$unix_auth_timeout" + fi +} + + +process_ip_transport() { + if check ip enable; then + local port + local addr="0.0.0.0" + + if check ip advertise_daemon; then + export ${NO_EXPORT:+-n} ip_advertise_daemon="<tcp> + <property router_advertisement_prefix=\"org.alljoyn.BusNode.\"/> + </tcp>" + fi + + process_networks ip + + config_get port ip bus_port 9955 + + export ${NO_EXPORT:+-n} listen_specs="${listen_specs} + <listen>tcp:addr=${addr},port=${port}</listen>" + + config_get ip_max_incomplete_conn ip max_incomplete_conn "$ip_max_incomplete_conn" + config_get ip_max_complete_conn ip max_complete_conn "$ip_max_complete_conn" + config_get ip_auth_timeout ip auth_timeout "$ip_auth_timeout" + fi +} + + +process_ice_transport() { + if check ice enable; then + local url + local addrport + local proto + + export ${NO_EXPORT:+-n} listen_specs="${listen_specs} + <listen>ice:</listen>" + + process_networks ice + + config_get url ice server + + proto="${url%%:*}" + addrport="${url##${proto}://}" + + export ice_server="${addrport%:*}" + + if [ "$proto" == "http" ]; then + export ice_protocol="HTTP" + else + export ice_protocol="HTTPS" + fi + + + config_get ice_max_incomplete_conn ice max_incomplete_conn "$ice_max_incomplete_conn" + config_get ice_max_complete_conn ice max_complete_conn "$ice_max_complete_conn" + config_get ice_auth_timeout ice auth_timeout "$ice_auth_timeout" + fi +} + + +process_bluetooth_transport() { + if check bluetooth enable; then + export ${NO_EXPORT:+-n} listen_specs="${listen_specs} + <listen>bluetooth:</listen>" + fi +} + + +generate_conf_file() { + local listen_specs="" + + local unix_auth_timeout=5000 + + local ip_max_incomplete_conn=16 + local ip_max_complete_conn=64 + local ip_auth_timeout=20000 + local ip_networks="" + local ip_advertise_daemon="" + + local ice_max_incomplete_conn=16 + local ice_max_complete_conn=64 + local ice_auth_timeout=40000 + local ice_networks="" + local ice_server + local ice_protocol + + include /lib/network + scan_interfaces + config_load alljoyn + + process_unix_transport + process_ip_transport + process_ice_transport + process_bluetooth_transport + + mkdir -p $(dirname $CONFIGFILE) + + cat > $CONFIGFILE <<EOF +<busconfig> + <type>alljoyn</type> + <fork/> + <syslog/> + <pidfile>${SERVICE_PID_FILE}</pidfile> + ${listen_specs} + ${ip_advertise_daemon} + <ip_name_service> + <property interfaces="${ip_networks}"/> + </ip_name_service> + <limit max_incomplete_connections="${ip_max_incomplete_conn}"/> + <limit max_completed_connections="${ip_max_complete_conn}"/> + <limit auth_timeout="${ip_auth_timeout}"/> + <ice> + <limit max_incomplete_connections="${ice_max_incomplete_conn}"/> + <limit max_completed_connections="${ice_max_complete_conn}"/> + <limit auth_timeout="${ice_auth_timeout}"/> + </ice> + <ice_discovery_manager> + <property interfaces="${ice_networks}"/> + <property protocol="${ice_protocol}"/> + <property server="${ice_server}"/> + <property enable_ipv6="false"/> + </ice_discovery_manager> + <property restrict_untrusted_clients="false"/> + <limit max_untrusted_clients="${ip_max_complete_conn}"/> +</busconfig> +EOF +} + + +start() { + generate_conf_file + service_start /usr/bin/alljoyn-daemon --config-file=$CONFIGFILE +} + +stop() { + service_stop /usr/bin/alljoyn-daemon +} Index: package/network/services/alljoyn/files/alljoyn.config =================================================================== --- package/network/services/alljoyn/files/alljoyn.config (revision 0) +++ package/network/services/alljoyn/files/alljoyn.config (working copy) @@ -0,0 +1,27 @@ + +config transport 'unix' + option enable '1' + option path 'alljoyn' + option abstract '1' + +config transport 'ip' + option enable '1' + option max_incomplete_conn '16' + option max_complete_conn '96' + option bus_port '9955' + option auth_timeout '20000' + option advertise_daemon '1' + option all_networks '0' + list networks 'lan' + +config transport 'ice' + option enable '1' + option max_incomplete_conn '16' + option max_complete_conn '64' + option server 'https://rdvs.alljoyn.org' + option auth_timeout '40000' + option all_networks '1' + +config transport 'bluetooth' + option enable '0' + Index: package/network/services/alljoyn/files/alljoyn.defaults =================================================================== --- package/network/services/alljoyn/files/alljoyn.defaults (revision 0) +++ package/network/services/alljoyn/files/alljoyn.defaults (working copy) @@ -0,0 +1,9 @@ +#! /bin/sh +uci batch <<EOF +add ucitrack alljoyn +set ucitrack.@alljoyn[-1].init=alljoyn +add_list ucitrack.@network[-1].affects=alljoyn +commit ucitrack +EOF +/etc/init.d/alljoyn enable +exit 0 Index: package/network/services/alljoyn/patches/001-Fix-archiver-and-archive-indexer.patch =================================================================== --- package/network/services/alljoyn/patches/001-Fix-archiver-and-archive-indexer.patch (revision 0) +++ package/network/services/alljoyn/patches/001-Fix-archiver-and-archive-indexer.patch (working copy) @@ -0,0 +1,23 @@ +diff --git a/build_core/conf/openwrt/openwrt/SConscript b/build_core/conf/openwrt/openwrt/SConscript +index c01a422..a18a5d1 100644 +--- a/build_core/conf/openwrt/openwrt/SConscript ++++ b/build_core/conf/openwrt/openwrt/SConscript +@@ -28,6 +28,9 @@ vars.Add('TARGET_CXX', 'OpenWRT C++ compiler', os.environ.get('TARGET_CXX')) + vars.Add('TARGET_LINK', 'OpenWRT Linker', os.environ.get('TARGET_CC')) # Normally use the C compiler for linking. + vars.Add('TARGET_LINKFLAGS', 'OpenWRT Linker flags', os.environ.get('TARGET_LDFLAGS')) + ++vars.Add('TARGET_AR', 'OpenWRT Archiver', os.environ.get('TARGET_AR')) ++vars.Add('TARGET_RANLIB', 'OpenWRT Archive Indexer', os.environ.get('TARGET_RANLIB')) ++ + vars.Add('STAGING_DIR', 'OpenWRT staging dir', os.environ.get('STAGING_DIR')) + + vars.Update(env) +@@ -53,6 +56,8 @@ env.MergeFlags(flags) + env.Replace(CC = env['TARGET_CC']) + env.Replace(CXX = env['TARGET_CXX']) + env.Replace(LINK = env['TARGET_LINK']) ++env.Replace(AR = env['TARGET_AR']) ++env.Replace(RANLIB = env['TARGET_RANLIB']) + + env['ENV']['PATH'] = env['TARGET_PATH'] + env['ENV']['STAGING_DIR'] = env['STAGING_DIR'] Index: package/network/services/alljoyn/Makefile =================================================================== --- package/network/services/alljoyn/Makefile (revision 0) +++ package/network/services/alljoyn/Makefile (working copy) @@ -0,0 +1,167 @@ +# Copyright 2012-2013, Qualcomm Innovation Center, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=alljoyn +PKG_VERSION:=3.3.2 +PKG_RELEASE:=2 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-src +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-src.tgz +PKG_SOURCE_URL:=https://www.alljoyn.org/sites/default/files/resources/ +PKG_MD5SUM:=c5711af5ef8a07470c2ae2e24a252b81 + +# SCons supports parallel builds but does not support make's jobserver +PKG_BUILD_PARALLEL:=$(if $(CONFIG_PKG_BUILD_USE_JOBSERVER),0,1) + +include $(INCLUDE_DIR)/package.mk + +define Package/alljoyn + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libopenssl +libpthread +librt +libstdcpp + TITLE:=AllJoyn Peer-to-Peer networking + URL:=http://www.alljoyn.org + MAINTAINER:=AllJoyn Open Source Project (Qualcomm Innovation Center, Inc.) <maintain...@alljoyn.org> +endef + +define Package/alljoyn/description +AllJoyn is a daemon and application framework for developing +ad hoc peer-to-peer applications. This includes the run-time +daemon and build-time C++ library. +endef + + +define Package/alljoyn-c + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=+alljoyn + TITLE:=AllJoyn Peer-to-Peer networking C binding + URL:=http://www.alljoyn.org + MAINTAINER:=AllJoyn Open Source Project (Qualcomm Innovation Center, Inc.) <maintain...@alljoyn.org> +endef + +define Package/alljoyn-c/description +AllJoyn C binding. This provides a C library for building +AllJoyn programs in C. Selecting this will create a package +containing the dynamic library for the C binding. +endef + + + +ifeq ($(CONFIG_DEBUG),y) + ALLJOYN_BUILD_VARIANT:=debug +else + ALLJOYN_BUILD_VARIANT:=release +endif + +# Only the core C++ binding is supported for this release of AllJoyn for OpenWrt. +ALLJOYN_BINDINGS=core,c + +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/build/openwrt/openwrt/$(ALLJOYN_BUILD_VARIANT)/dist + +define Build/Configure/Default +# Override default to do nothing +endef + +TARGET_CFLAGS+=-fPIC +TARGET_CPPFLAGS+=-fPIC + +define Build/Compile + rm -f $(PKG_BUILD_DIR)/alljoyn_core/inc/alljoyn/Status.h + scons -C $(PKG_BUILD_DIR) \ + $(PKG_JOBS) \ + WS=off \ + CPU=openwrt \ + OS=openwrt \ + BINDINGS=$(ALLJOYN_BINDINGS) \ + VARIANT=$(ALLJOYN_BUILD_VARIANT) \ + BD=off \ + "TARGET_CC=$$(TARGET_CC)" \ + "TARGET_CXX=$$(TARGET_CXX)" \ + "TARGET_CFLAGS=$$(TARGET_CFLAGS)" \ + "TARGET_CPPFLAGS=$$(TARGET_CPPFLAGS)" \ + "TARGET_PATH=$$(TARGET_PATH)" \ + "TARGET_LINKFLAGS=$$(TARGET_LDFLAGS)" \ + "TARGET_LINK=$$(TARGET_CC)" \ + "TARGET_AR=$$(TARGET_AR)" \ + "TARGET_RANLIB=$$(TARGET_RANLIB)" \ + "STAGING_DIR=$$(STAGING_DIR)" +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(INSTALL_DIR) $(1)/usr/include/qcc + $(CP) $(PKG_INSTALL_DIR)/cpp/inc/qcc/*.h $(1)/usr/include/qcc/ + $(INSTALL_DIR) $(1)/usr/include/qcc/posix + $(CP) $(PKG_INSTALL_DIR)/cpp/inc/qcc/posix/*.h $(1)/usr/include/qcc/posix/ + $(INSTALL_DIR) $(1)/usr/include/alljoyn + $(CP) $(PKG_INSTALL_DIR)/cpp/inc/alljoyn/*.h $(1)/usr/include/alljoyn/ + $(INSTALL_DIR) $(1)/usr/include/alljoyn_c + $(CP) $(PKG_INSTALL_DIR)/c/inc/alljoyn_c/*.h $(1)/usr/include/alljoyn_c/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/cpp/lib/liballjoyn.a $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/c/lib/liballjoyn_c.a $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/c/lib/liballjoyn_c.so $(1)/usr/lib/ +endef + +define Package/alljoyn/conffiles +/etc/config/alljoyn +endef + +define Package/alljoyn/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/alljoyn-daemon $(1)/usr/bin + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/alljoyn.init $(1)/etc/init.d/alljoyn + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) ./files/alljoyn.defaults $(1)/etc/uci-defaults/alljoyn + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/alljoyn.config $(1)/etc/config/alljoyn +endef + +define Package/alljoyn-c/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/c/lib/liballjoyn_c.so $(1)/usr/lib/ +endef + +define Package/alljoyn/postinst +#!/bin/sh +if [ -z "$${IPKG_INSTROOT}" ]; then + . /etc/uci-defaults/alljoyn + rm -f /etc/uci-defaults/alljoyn +fi +exit 0 +endef + +define Package/alljoyn/prerm +#!/bin/sh +if [ -z "$${IPKG_INSTROOT}" ]; then + /etc/init.d/alljoyn stop + /etc/init.d/alljoyn disable + uci batch <<EOF +del_list ucitrack.@network[-1].affects=alljoyn +delete ucitrack.@alljoyn[-1] +commit ucitrack +EOF +fi +exit 0 +endef + + +$(eval $(call BuildPackage,alljoyn)) +$(eval $(call BuildPackage,alljoyn-c)) + -- Steve Kinneberg Qualcomm Innovation Center, Inc. Email: ste...@quicinc.com Phone: +1 (206) 576-0107 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel