diff options
author | John Marino <marino@FreeBSD.org> | 2014-08-15 14:43:47 +0000 |
---|---|---|
committer | John Marino <marino@FreeBSD.org> | 2014-08-15 14:43:47 +0000 |
commit | 941fc51733e660654dbfdd7569527d62ad712f26 (patch) | |
tree | 2fa9a4e91868a52a9a1688fcd06f608c9ae86fd9 /comms/telldus-core | |
parent | 40209a476a55d1812b5913c55de8186bd6a40900 (diff) | |
download | ports-941fc51733e660654dbfdd7569527d62ad712f26.tar.gz ports-941fc51733e660654dbfdd7569527d62ad712f26.zip |
Notes
Diffstat (limited to 'comms/telldus-core')
19 files changed, 379 insertions, 0 deletions
diff --git a/comms/telldus-core/Makefile b/comms/telldus-core/Makefile new file mode 100644 index 000000000000..6cb336b63464 --- /dev/null +++ b/comms/telldus-core/Makefile @@ -0,0 +1,46 @@ +# Created by: Johan Strom <johna@stromnet.se> +# $FreeBSD$ + +PORTNAME= telldus-core +PORTVERSION= 2.1.2 +CATEGORIES= comms +MASTER_SITES= http://download.telldus.se/TellStick/Software/telldus-core/ + +MAINTAINER= johan@stromnet.se +COMMENT= Tellstick Telldus daemon + library + +LICENSE= LGPL21 + +BUILD_DEPENDS= help2man:${PORTSDIR}/misc/help2man +LIB_DEPENDS= libftdi.so:${PORTSDIR}/devel/libftdi \ + libconfuse.so:${PORTSDIR}/devel/libconfuse \ + libargp.so:${PORTSDIR}/devel/argp-standalone + +USES= iconv cmake compiler:c++11-lang + +#CMAKE_VERBOSE=yes +CMAKE_ARGS+=-DGENERATE_MAN=TRUE +# Note: these are internal defines and shall NOT contain ${STAGEDIR} +CMAKE_ARGS+=-DSYSCONF_INSTALL_DIR="${PREFIX}/etc" +CMAKE_ARGS+=-DSTATE_INSTALL_DIR="/var/telldus" + +MAKE_JOBS_UNSAFE= yes + +USE_RC_SUBR= telldusd +USER= nobody +GROUP= dialer + +.include <bsd.port.pre.mk> + +post-patch: +# remove tr1 if using libc++ +.if ${COMPILER_FEATURES:Mlibc++} + @${REINPLACE_CMD} -e 's|tr1::||' ${WRKSRC}/common/Event.h +.endif + +post-install: + cd ${STAGEDIR}${PREFIX}/etc && \ + ${MV} tellstick.conf tellstick.conf.sample + ${RM} ${STAGEDIR}/var/telldus/telldus-core.conf + +.include <bsd.port.post.mk> diff --git a/comms/telldus-core/distinfo b/comms/telldus-core/distinfo new file mode 100644 index 000000000000..ede8d2be8e16 --- /dev/null +++ b/comms/telldus-core/distinfo @@ -0,0 +1,2 @@ +SHA256 (telldus-core-2.1.2.tar.gz) = a20f6c74814afc23312d2c93ebbb37fdea9deaaee05ae7b6a6275e11e4662014 +SIZE (telldus-core-2.1.2.tar.gz) = 169850 diff --git a/comms/telldus-core/files/patch-CMakeLists.txt b/comms/telldus-core/files/patch-CMakeLists.txt new file mode 100644 index 000000000000..07f80213185b --- /dev/null +++ b/comms/telldus-core/files/patch-CMakeLists.txt @@ -0,0 +1,62 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -42,8 +42,18 @@ ENDIF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + SET(BUILD_TDTOOL TRUE CACHE BOOL "Build tdtool") + SET(BUILD_TDADMIN ${TDADMIN_DEFAULT} CACHE BOOL "Build tdadmin") + ++SET(GENERATE_DOXYGEN FALSE CACHE BOOL "Enable generation of doxygen") + SET(GENERATE_MAN FALSE CACHE BOOL "Enable generation of man-files") + ++ ++IF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") ++ SET(MAN_DIR_DEFAULT "man") ++ELSE() ++ SET(MAN_DIR_DEFAULT "share/man") ++ENDIF() ++SET(MAN_DIR ${MAN_DIR_DEFAULT} CACHE PATH "The directory where man pages are located (related to ${CMAKE_INSTALL_PREFIX})") ++ ++ + ADD_SUBDIRECTORY(common) + ADD_SUBDIRECTORY(service) + ADD_SUBDIRECTORY(client) +@@ -61,20 +71,23 @@ ENDIF(BUILD_TDADMIN) + ENABLE_TESTING() + ADD_SUBDIRECTORY(tests) + +-FIND_PACKAGE(Doxygen) +- +-IF(DOXYGEN_FOUND) +- SET(DOXY_CONFIG ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) +- +- CONFIGURE_FILE( +- "${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in" +- ${DOXY_CONFIG} @ONLY +- ) +- +- ADD_CUSTOM_TARGET(docs +- ${DOXYGEN_EXECUTABLE} ${DOXY_CONFIG} +- DEPENDS ${DOXY_CONFIG} +- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +- COMMENT "Generating doxygen documentation" VERBATIM +- ) +-ENDIF() ++IF (GENERATE_DOXYGEN) ++ FIND_PACKAGE(Doxygen) ++ IF(DOXYGEN_FOUND) ++ SET(DOXY_CONFIG ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) ++ ++ CONFIGURE_FILE( ++ "${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in" ++ ${DOXY_CONFIG} @ONLY ++ ) ++ ++ ADD_CUSTOM_TARGET(docs ++ ${DOXYGEN_EXECUTABLE} ${DOXY_CONFIG} ++ DEPENDS ${DOXY_CONFIG} ++ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ++ COMMENT "Generating doxygen documentation" VERBATIM ++ ) ++ ELSE() ++ MESSAGE("Warn: doxygen not found, wont build") ++ ENDIF() ++ENDIF(GENERATE_DOXYGEN) diff --git a/comms/telldus-core/files/patch-common-CMakeLists.txt b/comms/telldus-core/files/patch-common-CMakeLists.txt new file mode 100644 index 000000000000..d8ee6992a540 --- /dev/null +++ b/comms/telldus-core/files/patch-common-CMakeLists.txt @@ -0,0 +1,29 @@ +--- common/CMakeLists.txt ++++ common/CMakeLists.txt +@@ -54,16 +54,22 @@ ELSEIF (WIN32) + ) + ELSEIF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + #### FreeBSD #### +- FIND_LIBRARY(ICONV_LIBRARY iconv) ++ string(REGEX MATCH "(([0-9]+)\\.([0-9]+))-([A-Z0-9])+" FREEBSD "${CMAKE_SYSTEM_VERSION}") ++ set( FREEBSD_RELEASE "${CMAKE_MATCH_1}" ) + ADD_DEFINITIONS( -D_FREEBSD ) + LIST(APPEND telldus-common_SRCS + Event_unix.cpp + EventHandler_unix.cpp + Socket_unix.cpp + ) +- LIST(APPEND telldus-common_LIBRARIES +- ${ICONV_LIBRARY} +- ) ++ ++ # FreeBSD 10 has iconv built in to libc ++ IF(FREEBSD_RELEASE LESS 10) ++ FIND_LIBRARY(ICONV_LIBRARY iconv) ++ LIST(APPEND telldus-common_LIBRARIES ++ ${ICONV_LIBRARY} ++ ) ++ ENDIF () + ELSE (APPLE) + #### Linux #### + ADD_DEFINITIONS( -D_LINUX ) diff --git a/comms/telldus-core/files/patch-common-Socket_unix.cpp b/comms/telldus-core/files/patch-common-Socket_unix.cpp new file mode 100644 index 000000000000..e1d4e48bb5e7 --- /dev/null +++ b/comms/telldus-core/files/patch-common-Socket_unix.cpp @@ -0,0 +1,24 @@ +--- common/Socket_unix.cpp ++++ common/Socket_unix.cpp +@@ -18,7 +18,7 @@ + #include "common/Strings.h" + + #define BUFSIZE 512 +-#if defined(_MACOSX) && !defined(SOCK_CLOEXEC) ++#if (defined(_MACOSX) || defined (__FreeBSD__)) && !defined(SOCK_CLOEXEC) + #define SOCK_CLOEXEC 0 + #endif + +@@ -130,8 +130,10 @@ std::wstring Socket::read(int timeout) { + + void Socket::stopReadWait() { + TelldusCore::MutexLocker locker(&d->mutex); +- d->connected = false; +- // TODO(stefan): somehow signal the socket here? ++ if(d->connected && d->socket != -1) { ++ d->connected = false; ++ shutdown(d->socket, SHUT_RDWR); ++ } + } + + void Socket::write(const std::wstring &msg) { diff --git a/comms/telldus-core/files/patch-common-Thread.h b/comms/telldus-core/files/patch-common-Thread.h new file mode 100644 index 000000000000..98aeb4d0676a --- /dev/null +++ b/comms/telldus-core/files/patch-common-Thread.h @@ -0,0 +1,12 @@ +--- common/Thread.h ++++ common/Thread.h +@@ -13,6 +13,9 @@ + #define TELLDUS_CORE_COMMON_THREAD_H_ + + #include <string> ++#ifdef __FreeBSD__ ++#include <pthread.h> ++#endif + #include "common/Mutex.h" + + namespace TelldusCore { diff --git a/comms/telldus-core/files/patch-service-CMakeLists.txt b/comms/telldus-core/files/patch-service-CMakeLists.txt new file mode 100644 index 000000000000..1e3352191d2c --- /dev/null +++ b/comms/telldus-core/files/patch-service-CMakeLists.txt @@ -0,0 +1,11 @@ +--- service/CMakeLists.txt ++++ service/CMakeLists.txt +@@ -249,7 +249,7 @@ IF (UNIX) + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating man file telldusd.1" + ) +- INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/telldusd.1 DESTINATION share/man/man1) ++ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/telldusd.1 DESTINATION ${MAN_DIR}/man1) + ENDIF (GENERATE_MAN) + ENDIF (UNIX) + diff --git a/comms/telldus-core/files/patch-service-ConnectionListener_unix.cpp b/comms/telldus-core/files/patch-service-ConnectionListener_unix.cpp new file mode 100644 index 000000000000..b2abd2f9ce1f --- /dev/null +++ b/comms/telldus-core/files/patch-service-ConnectionListener_unix.cpp @@ -0,0 +1,11 @@ +--- service/ConnectionListener_unix.cpp ++++ service/ConnectionListener_unix.cpp +@@ -17,7 +17,7 @@ + #include "service/ConnectionListener.h" + #include "common/Socket.h" + +-#if defined(_MACOSX) && !defined(SOCK_CLOEXEC) ++#if (defined(_MACOSX) || defined (__FreeBSD__)) && !defined(SOCK_CLOEXEC) + #define SOCK_CLOEXEC 0 + #endif + diff --git a/comms/telldus-core/files/patch-service-EventUpdateManager.cpp b/comms/telldus-core/files/patch-service-EventUpdateManager.cpp new file mode 100644 index 000000000000..1c84f10bd57b --- /dev/null +++ b/comms/telldus-core/files/patch-service-EventUpdateManager.cpp @@ -0,0 +1,13 @@ +--- service/EventUpdateManager.cpp ++++ service/EventUpdateManager.cpp +@@ -33,6 +33,10 @@ + #include "service/ConnectionListener.h" + #include "service/Log.h" + ++#ifdef __FreeBSD__ ++extern char **environ; ++#endif ++ + typedef std::list<TelldusCore::Socket *> SocketList; + typedef std::list<std::string> StringList; + diff --git a/comms/telldus-core/files/patch-service-Sensor.h b/comms/telldus-core/files/patch-service-Sensor.h new file mode 100644 index 000000000000..e550e7f1b20e --- /dev/null +++ b/comms/telldus-core/files/patch-service-Sensor.h @@ -0,0 +1,12 @@ +--- service/Sensor.h ++++ service/Sensor.h +@@ -8,6 +8,9 @@ + #define TELLDUS_CORE_SERVICE_SENSOR_H_ + + #include <string> ++#ifdef __FreeBSD__ ++#include <ctime> ++#endif + #include "common/Mutex.h" + + class Sensor : public TelldusCore::Mutex { diff --git a/comms/telldus-core/files/patch-service-SettingsConfuse.cpp b/comms/telldus-core/files/patch-service-SettingsConfuse.cpp new file mode 100644 index 000000000000..67b148107333 --- /dev/null +++ b/comms/telldus-core/files/patch-service-SettingsConfuse.cpp @@ -0,0 +1,11 @@ +--- service/SettingsConfuse.cpp ++++ service/SettingsConfuse.cpp +@@ -17,6 +17,8 @@ + + class Settings::PrivateData { + public: ++ PrivateData() ++ : cfg(NULL), var_cfg(NULL) {} + cfg_t *cfg; + cfg_t *var_cfg; + }; diff --git a/comms/telldus-core/files/patch-service-tellstick.conf b/comms/telldus-core/files/patch-service-tellstick.conf new file mode 100644 index 000000000000..544fc59bde49 --- /dev/null +++ b/comms/telldus-core/files/patch-service-tellstick.conf @@ -0,0 +1,9 @@ +--- service/tellstick.conf 2014-04-08 20:53:25.374751487 +0200 ++++ service/tellstick.conf 2014-04-08 20:53:36.055838124 +0200 +@@ -1,5 +1,5 @@ + user = "nobody" +-group = "plugdev" ++group = "dialer" + ignoreControllerConfirmation = "false" + device { + id = 1 diff --git a/comms/telldus-core/files/patch-tdadmin-CMakeLists.txt b/comms/telldus-core/files/patch-tdadmin-CMakeLists.txt new file mode 100644 index 000000000000..86455ae2b6f9 --- /dev/null +++ b/comms/telldus-core/files/patch-tdadmin-CMakeLists.txt @@ -0,0 +1,34 @@ +--- tdadmin/CMakeLists.txt ++++ tdadmin/CMakeLists.txt +@@ -52,13 +52,13 @@ IF (UNIX) + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating man file tdadmin.1" + ) +- INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tdadmin.1 DESTINATION share/man/man1) ++ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tdadmin.1 DESTINATION ${MAN_DIR}/man1) + ENDIF (GENERATE_MAN) + ENDIF (UNIX) + + INSTALL(TARGETS tdadmin RUNTIME DESTINATION sbin) + +-IF (UNIX AND NOT APPLE) ++IF (UNIX AND NOT APPLE AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + SET(UDEV_RULES_DIR "/etc/udev/rules.d" CACHE PATH "The directory where udev store its rules" ) + CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/05-tellstick.rules +@@ -76,4 +76,14 @@ IF (UNIX AND NOT APPLE) + INSTALL(PROGRAMS ${CMAKE_BINARY_DIR}/parsed/udev.sh + DESTINATION share/telldus-core/helpers/ + ) +-ENDIF (UNIX AND NOT APPLE) ++ELSEIF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") ++ SET(UDEV_RULES_DIR "/usr/local/etc/devd/" CACHE PATH "The directory where devd store its rules" ) ++ CONFIGURE_FILE( ++ ${CMAKE_CURRENT_SOURCE_DIR}/freebsd-devd-tellstick.conf ++ ${CMAKE_BINARY_DIR}/parsed/tellstick.conf ++ @ONLY ++ ) ++ INSTALL(FILES ${CMAKE_BINARY_DIR}/parsed/tellstick.conf ++ DESTINATION ${UDEV_RULES_DIR} ++ ) ++ENDIF () diff --git a/comms/telldus-core/files/patch-tdadmin-freebsd-devd-tellstick.conf b/comms/telldus-core/files/patch-tdadmin-freebsd-devd-tellstick.conf new file mode 100644 index 000000000000..8e8e627b1c86 --- /dev/null +++ b/comms/telldus-core/files/patch-tdadmin-freebsd-devd-tellstick.conf @@ -0,0 +1,15 @@ +--- tdadmin/freebsd-devd-tellstick.conf 2014-04-06 22:40:11.000000000 +0200 ++++ tdadmin/freebsd-devd-tellstick.conf 2014-04-06 20:37:50.501751596 +0200 +@@ -0,0 +1,12 @@ ++attach 10 { ++ device-name "uftdi[0-9]+"; ++ match "vendor" "0x1781"; ++ match "product" "0x0c30"; ++ ++ action "chgrp dialer /dev/ugen$port.$devaddr; chmod 660 /dev/ugen$port.$devaddr; ++ @CMAKE_INSTALL_PREFIX@/sbin/tdadmin --pid $product --vid $vendor --serial $sernum controller connect"; ++}; ++ ++ ++# Haven't managed to handle detach/disconnect events, seems they do not provide any information ++# at all so cannot distinguish different uftdi devices. diff --git a/comms/telldus-core/files/patch-tdtool-CMakeLists.txt b/comms/telldus-core/files/patch-tdtool-CMakeLists.txt new file mode 100644 index 000000000000..6aa40c276ee5 --- /dev/null +++ b/comms/telldus-core/files/patch-tdtool-CMakeLists.txt @@ -0,0 +1,11 @@ +--- tdtool/CMakeLists.txt ++++ tdtool/CMakeLists.txt +@@ -49,7 +49,7 @@ IF (UNIX) + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating man file tdtool.1" + ) +- INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tdtool.1 DESTINATION share/man/man1) ++ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tdtool.1 DESTINATION ${MAN_DIR}/man1) + ENDIF (GENERATE_MAN) + ENDIF (UNIX) + diff --git a/comms/telldus-core/files/telldusd.in b/comms/telldus-core/files/telldusd.in new file mode 100644 index 000000000000..b2cb5c1d6e20 --- /dev/null +++ b/comms/telldus-core/files/telldusd.in @@ -0,0 +1,28 @@ +#!/bin/sh + +# +# PROVIDE: telldusd +# Add the following lines to /etc/rc.conf to enable telldusd: +# telldusd_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable telldusd. +# telldusd_flags (str): Set to "" by default. +# telldusd_configfile (str): Set to "/usr/local/etc/tellstick.conf" by defult +# + +. /etc/rc.subr + +name="telldusd" +rcvar=telldusd_enable + +command="/usr/local/sbin/telldusd" +pidfile="/var/run/telldusd.pid" + +telldusd_enable=${telldusd_enable:-"NO"} +telldusd_flags=${telldusd_flags:-""} +telldusd_configfile=${telldusd_configfile:-"/usr/local/etc/tellstick.conf"} + +load_rc_config "${name}" + +required_files="${telldusd_configfile}" + +run_rc_command "$1" diff --git a/comms/telldus-core/pkg-descr b/comms/telldus-core/pkg-descr new file mode 100644 index 000000000000..3558dc5b2266 --- /dev/null +++ b/comms/telldus-core/pkg-descr @@ -0,0 +1,9 @@ +Allows access to Telldus Tellstick USB dongles for communicating with +433MHz devices in your home. + +Provides "telldusd", the daemon which keeps track of your tellstick +devices. Through a UNIX socket, the sensors and devices can be used/ +controlled from the command line tool "tdtool", or via the libtelldus-core +C client library. + +WWW: http://www.telldus.com/products/tellstick diff --git a/comms/telldus-core/pkg-message b/comms/telldus-core/pkg-message new file mode 100644 index 000000000000..f6328558b87f --- /dev/null +++ b/comms/telldus-core/pkg-message @@ -0,0 +1,20 @@ + +====== +NOTICE +====== + +A devd rule has been installed to automatically notify telldusd +when a new device has been detected. + +Please restart devd to activate this: + + /etc/rc.d/devd restart + +Edit /usr/local/etc/tellstick.conf to configure some devices, +and enable telldusd in rc.conf. + +Then start telldusd. + +When starting for the first time, you might need to unplug/plugin the device +to allow devd to fix the permissions on the /dev/ugenX.X device. + diff --git a/comms/telldus-core/pkg-plist b/comms/telldus-core/pkg-plist new file mode 100644 index 000000000000..d0a7ddf901b1 --- /dev/null +++ b/comms/telldus-core/pkg-plist @@ -0,0 +1,20 @@ +bin/tdtool +@group dialer +@mode 664 +@exec mkdir -p /var/telldus && chown nobody:dialer /var/telldus +@exec [ -f /var/telldus/telldus-core.conf ] || touch /var/telldus/telldus-core.conf && chown nobody:dialer %D/var/telldus/telldus-core.conf +@unexec if [ ! -s /var/telldus/telldus-core.conf ]; then rm -vf /var/telldus/telldus-core.conf; fi +@unexec rmdir /var/telldus >/dev/null 2>&1 || : +@sample etc/tellstick.conf.sample +@group +@mode +etc/devd/tellstick.conf +include/telldus-core.h +lib/libtelldus-core.so +lib/libtelldus-core.so.2 +lib/libtelldus-core.so.2.1.2 +man/man1/tdadmin.1.gz +man/man1/tdtool.1.gz +man/man1/telldusd.1.gz +sbin/tdadmin +sbin/telldusd |