Tellstick

I managed to get rid of the dependency on GCC, and patched some additional include statements. Patches are included, should just be to drop them into the files/ folder.

Detail 1: removed tr1:: as they seem to have become part of C++11.
Detail 2: added some includes which were not defined before.
 

Attachments

  • patchset.tgz
    605 bytes · Views: 260
Thanks!

I've added the patches to the port, the tr1 stuff as a conditional patch on >= 10.0. Would you mind testing it to make sure it applies properly?
 

Attachments

  • telldus-core.tar.gz
    4.9 KB · Views: 252
The make process complains about including <bsd.port.pre.mk>, so I changed it to <bsd.port.options.mk>.


Now it appears to be applying, and building, cleanly (at least without obvious errors). However my poudriere machine is still having trouble building it, can't find an ICONV library. Probably some dependency that is missing. I'll have a look into it and let you know.
 

Attachments

  • Makefile.patch.gz
    450 bytes · Views: 240
Hm, I might have made a mistake there; should probably be bsd.port.pre.mk, and the last line should be changed from bsd.port.mk to bsd.port.post.mk (ref http://www.freebsd.org/doc/en/books/porters-handbook/dads-after-port-mk.html). Can you try that instead of including options (which is probably not the correct thing to do)?

Weird about iconv, I can build it successfully in poudriere without that as an explicit dep.. However the binary is linked to iconv.. weird!
Should be a quick fix though, just add USES+=ICONV I think
 
Code:
-.include <bsd.port.pre.mk>
+.include <bsd.port.options.mk>

does a much better job for me than using bsd.port.pre.mk and bsd.port.post.mk

For some reason 'USES+=iconv' doesn't work for me. Very odd.

The errors from when ICONV isn't being found is below.
Code:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
ICONV_LIBRARY
    linked by target "TelldusCommon" in directory /wrkdirs/usr/ports/misc/telldus-core/work/telldus-core-2.1.2/common

-- Configuring incomplete, errors occurred!
See also "/wrkdirs/usr/ports/misc/telldus-core/work/telldus-core-2.1.2/CMakeFiles/CMakeOutput.log".
*** Error code 1

Stop.
make: stopped in /usr/ports/misc/telldus-core
===>  Cleaning for telldus-core-2.1.2_2
build of /usr/ports/misc/telldus-core ended at Wed Apr 30 13:09:11 CEST 2014
build time: 00:00:06
 
Okay, well that works on 9.2 as well, and http://lists.freebsd.org/pipermail/free ... 85982.html seems to indicate that it's fine.. So I guess we do that :)


USES+=iconv doesn't do anything neither good or bad here, except what I'd expect:
Code:
===>   telldus-core-2.1.2_2 depends on shared library: libiconv.so.3 - found

After cmake has executed, CMakeCache.txt in work dir has the following:
Code:
ICONV_LIBRARY:FILEPATH=/usr/local/lib/libiconv.so
 
jstrom said:
Okay, well that works on 9.2 as well, and http://lists.freebsd.org/pipermail/free ... 85982.html seems to indicate that it's fine.. So I guess we do that :)
Suits me.

After cmake has executed, CMakeCache.txt in work dir has the following:
ICONV_LIBRARY:FILEPATH=/usr/local/lib/libiconv.so

That works fine as long as I don't try to compile it with poudriere. It compiles properly on my other 10.0-RELEASE machine, just not with the package builder.
However I still think the port is quite good, probably the fault is somewhere in my settings.

EDIT: Adding libiconv as a dependency works with poudriere aswell, but it is an ugly hack as 10.0-RELEASE should have a native iconv installed.

Code:
# <HACK> to make building on poudriere easier. 
LIB_DEPENDS+=libiconv.so:${PORTSDIR}/converters/libiconv
 
Can you test this patch and see if it helps? (remove the LIB_DEPENDS hack in the Makefile):

Code:
--- common/CMakeLists.txt
+++ common/CMakeLists.txt
@@ -54,7 +54,7 @@ ELSEIF (WIN32)
        )
 ELSEIF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
        #### FreeBSD ####
-       FIND_LIBRARY(ICONV_LIBRARY iconv)
+       FIND_LIBRARY(ICONV_LIBRARY iconv PATHS /usr/local/lib /usr/lib)
        ADD_DEFINITIONS( -D_FREEBSD )
        LIST(APPEND  telldus-common_SRCS
                Event_unix.cpp
 
Doesn't work.
I already tried something similar.

Seeing as the dependency on libiconv works, I think its best to run with that.
 
Looked into it a bit more, and got a 10.x box up and running to test on. The issue is that FreeBSD 10 does not have a libiconv.so, but rather ships the iconv code in libc. The following patch seems to build fine on both 10.0 and 9.2 (remove any previous iconv patches):

Code:
--- 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 ()

Regarding the poudriere issue, on a fresh 10.0 it fails to build outside too, so most likely your base system just have libiconv installed as a dep from some other port, which cmake found and used.

Full port attached, including above patch.
 

Attachments

  • telldus-core.tar.gz
    5.2 KB · Views: 255
On my 10.0-RELEASE FreeBSD 10.0-RELEASE #0 with generic amd64 kernel I am unable to get this to work. I have tried the patchset linked to here, both from the ports and the tar.gz above. It always fails while doing make on 88% progress (having compiled telldusd it wants to link it):

Code:
Linking CXX executable telldusd
../common/libTelldusCommon.a(Strings.cpp.o): In function `TelldusCore::charToWstring(char const*)':
/root/telldus/telldus-core/work/telldus-core-2.1.2/common/Strings.cpp:(.text+0xa2): undefined reference to `libiconv_open'

I have iconv and libiconv installed. What could be missing here?
 
I got this to work my adding
Code:
USES+=libtool
in the Makefile (just below USES+=iconv).

You will need the ports collection installed, at least this fix failed until I did portsnap fetch extract.

I was also required to change the user/group in /usr/local/etc/tellstick.conf. Without changing this (try root/wheel first), tdtool -l forever reported no sensors present.
 
fegu said:
I got this to work my adding
Code:
USES+=libtool
in the Makefile (just below USES+=iconv).

You will need the ports collection installed, at least this fix failed until I did portsnap fetch extract.

I was also required to change the user/group in /usr/local/etc/tellstick.conf. Without changing this (try root/wheel first), tdtool -l forever reported no sensors present.

Some googling on the libiconv_open error gives a possible conflict between iconv from ports and base. On FreeBSD 10.x, you shouldn't need to install iconv from ports at all, if I understand things correctly.

If you uninstall the iconv port, does it link properly (without the libtool fix)?

Regarding the tellstick.conf problem, can you try the following pkg-plist patch?

Code:
--- pkg-plist     2014-06-17 12:55:17.229192083 +0200
+++ pkg-plist   2014-06-17 13:07:35.227751723 +0200
@@ -1,13 +1,16 @@
 etc/devd/tellstick.conf

+@group dialer
+@mode 664
 @unexec if cmp %D/etc/tellstick.conf.sample %D/etc/tellstick.conf; then rm -vf %D/etc/tellstick.conf; fi
 etc/tellstick.conf.sample
 @exec [ -f %D/etc/tellstick.conf ] || cp -v %D/etc/tellstick.conf.sample %D/etc/tellstick.conf
-
 @exec mkdir -p %D/var/telldus && chown nobody:dialer %D/var/telldus
 @unexec if [ ! -s %D/var/telldus/telldus-core.conf ]; then rm -vf %D/var/telldus/telldus-core.conf; fi
 @exec [ -f %D/var/telldus/telldus-core.conf ] || touch %D/var/telldus/telldus-core.conf && chown nobody:dialer %D/var/telldus/telldus-core.conf
 @dirrmtry var/telldus
+@group
+@mode
 @dirrmtry var

 bin/tdtool

This should make sure that the conf files have group ID dialer, and 664 permissions... Should probably go for a specific telldus user but..
 
Back
Top