diff --git a/comms/telldus-core/Makefile b/comms/telldus-core/Makefile --- a/comms/telldus-core/Makefile +++ b/comms/telldus-core/Makefile @@ -3,6 +3,7 @@ PORTNAME= telldus-core PORTVERSION= 2.1.2 +PORTREVISION= 1 CATEGORIES= comms MASTER_SITES= http://download.telldus.se/TellStick/Software/telldus-core/ @@ -16,7 +17,9 @@ 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 +USE_LDCONFIG= yes + +USES= iconv cmake compiler:c++11-lang #CMAKE_VERBOSE=yes CMAKE_ARGS+=-DGENERATE_MAN=TRUE @@ -30,6 +33,8 @@ USE_RC_SUBR= telldusd USER= nobody GROUP= dialer +SUB_FILES= pkg-message + .include post-patch: diff --git a/comms/telldus-core/files/patch-common-CMakeLists.txt b/comms/telldus-core/files/patch-common-CMakeLists.txt --- a/comms/telldus-core/files/patch-common-CMakeLists.txt +++ b/comms/telldus-core/files/patch-common-CMakeLists.txt @@ -1,6 +1,6 @@ --- common/CMakeLists.txt +++ common/CMakeLists.txt -@@ -54,16 +54,22 @@ ELSEIF (WIN32) +@@ -54,16 +54,29 @@ ELSEIF (WIN32) ) ELSEIF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") #### FreeBSD #### @@ -18,7 +18,14 @@ - ) + + # FreeBSD 10 has iconv built in to libc -+ IF(FREEBSD_RELEASE LESS 10) ++ # However, if user has libiconv package installed, clang will find that header first, ++ # and we'd get a link error unless -liconv is added. This will at least let it build; we cannot ++ # force the user to NOT have libiconv installed. ++ # "proper" fix would be to force clang/gcc to use system header. How? ++ IF( (FREEBSD_RELEASE LESS 10) OR (EXISTS "/usr/local/include/iconv.h")) ++ IF(NOT (FREEBSD_RELEASE LESS 10)) ++ MESSAGE(WARNING "building with libiconv from package instead of base. Port will fail?") ++ ENDIF() + FIND_LIBRARY(ICONV_LIBRARY iconv) + LIST(APPEND telldus-common_LIBRARIES + ${ICONV_LIBRARY} diff --git a/comms/telldus-core/files/patch-common-Strings.cpp b/comms/telldus-core/files/patch-common-Strings.cpp new file mode 100644 --- /dev/null +++ b/comms/telldus-core/files/patch-common-Strings.cpp @@ -0,0 +1,11 @@ +--- common/Strings.cpp ++++ common/Strings.cpp +@@ -19,7 +19,7 @@ + #include + + +-#ifdef _MACOSX ++#if defined(_MACOSX) || defined(_FREEBSD) + #define WCHAR_T_ENCODING "UCS-4-INTERNAL" + #else + #define WCHAR_T_ENCODING "WCHAR_T" diff --git a/comms/telldus-core/files/patch-tdadmin-freebsd-devd-tellstick.conf b/comms/telldus-core/files/patch-tdadmin-freebsd-devd-tellstick.conf --- a/comms/telldus-core/files/patch-tdadmin-freebsd-devd-tellstick.conf +++ b/comms/telldus-core/files/patch-tdadmin-freebsd-devd-tellstick.conf @@ -1,12 +1,26 @@ --- 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 @@ +@@ -0,0 +1,26 @@ +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; ++ ++ # Devd variable $bus and $devaddr ought to be what we want to identify /dev/ugenN.N. ++ # Unfortunately devd overwrites $bus: ++ # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198015 ++ # ++ # Use this workaround instead.. Find device by serial and use that device name. -B14 should be stable: ++ # https://github.com/freebsd/freebsd/blob/master/usr.sbin/usbconfig/dump.c#L395 ++ # https://github.com/freebsd/freebsd/blob/master/lib/libusb/libusb20_desc.h#L220 ++ # ++ # $ usbconfig dump_device_desc | grep $sernum -B14|grep ugen ++ # ugen0.2: at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (90mA) ++ # ++ # Old command: ++ # action "chgrp dialer /dev/ugen$bus.$devaddr; chmod 660 /dev/ugen$bus.$devaddr; ++ action "dev=`usbconfig dump_device_desc | grep $sernum -B14|grep ugen|cut -f1 -d':'`; chgrp dialer /dev/$$dev; chmod 660 /dev/$$dev; + @CMAKE_INSTALL_PREFIX@/sbin/tdadmin --pid $product --vid $vendor --serial $sernum controller connect"; +}; + diff --git a/comms/telldus-core/files/pkg-message.in b/comms/telldus-core/files/pkg-message.in new file mode 100644 --- /dev/null +++ b/comms/telldus-core/files/pkg-message.in @@ -0,0 +1,19 @@ + +====== +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 %%PREFIX%%/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-message b/comms/telldus-core/pkg-message deleted file mode 100644 --- a/comms/telldus-core/pkg-message +++ /dev/null @@ -1,20 +0,0 @@ - -====== -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 --- a/comms/telldus-core/pkg-plist +++ b/comms/telldus-core/pkg-plist @@ -1,10 +1,11 @@ bin/tdtool +@mode 775 +@owner nobody @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 +@dir /var/telldus +@exec [ -f /var/telldus/telldus-core.conf ] || touch /var/telldus/telldus-core.conf && chown nobody:dialer /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 || : +@mode 664 @sample etc/tellstick.conf.sample @group @mode