--- /dev/null
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=wview
+PKG_VERSION:=5.19.0-jgoerzen
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+PKG_SOURCE_URL:=git://github.com/jgoerzen/wview.git
+PKG_SOURCE_VERSION:=7bfac6c11e756290c38e7b5862a4c51b6bc6c51e
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/wview
+ SECTION:=utils
+ CATEGORY:=Utilities
+ DEPENDS:=+libcurl +zlib +libpng +libgd +libreadline +libsqlite3 +libusb-1.0 +radlib-sqlite +sqlite3-cli
+ TITLE:=Wview Weather Station Software
+ URL:=http://www.wviewweather.com/
+endef
+
+define Package/wview/description
+ Wview is a collection of linux/unix daemons which interface with a supported
+ weather station to retrieve archive records (if generated by the station) and
+ current conditions. If the station does not generate archive records
+ internally, wview will auto-generate archive records based on the sensor
+ readings collected for that interval. The archive records and High/Low (HILOW)
+ data are stored in SQLite3 databases. At a configurable interval, wview will
+ utilize the archive history and current conditions to generate weather images
+ (buckets, dials and graphs) and HTML web pages based on user-configurable HTML
+ templates.
+
+ After install you need to create a directory holding archive and create the
+ database there by running there
+ sqlite3 wview-archive.sdb '.read /etc/wview/wview-archive.sql'
+
+ Then copy all your theme files to the appropriate place (on a non-volatile
+ storage), and html-templates.conf to /etc/wview/; then wviewconfig to configure
+ the system.
+
+ Read and amend /etc/init.d/wview appropriately for your particular setup!
+endef
+
+define Package/wview/prerm
+#!/bin/sh
+if [ -z "$${IPKG_INSTROOT}" ]; then
+ echo "Removing rc.d symlink for wview"
+ /etc/init.d/wview disable
+fi
+exit 0
+endef
+
+define Package/wview/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/cwop/wvcwopd $(1)/usr/bin/wvcwopd
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/http/wvhttpd $(1)/usr/bin/wvhttpd
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/procmon/wvpmond $(1)/usr/bin/wvpmond
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/hilowcreate/hilowcreate $(1)/usr/bin/hilowcreate
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/sqlite2wlk/sqlite2wlk $(1)/usr/bin/sqlite2wlk
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/htmlgenerator/htmlgend $(1)/usr/bin/htmlgend
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/VantagePro/vpconfig/vpinstall $(1)/usr/bin/vpinstall
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/ftp/wviewftpd $(1)/usr/bin/wviewftpd
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/ssh/wviewsshd $(1)/usr/bin/wviewsshd
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/Virtual/wviewd_virtual $(1)/usr/bin/wviewd_virtual
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/archive-be2le/arc_be2le $(1)/usr/bin/arc_be2le
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/archive-le2be/arc_le2be $(1)/usr/bin/arc_le2be
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/alarms/wvalarmd $(1)/usr/bin/wvalarmd
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/wlk2sqlite/wlk2sqlite $(1)/usr/bin/wlk2sqlite
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/Simulator/wviewd_sim $(1)/usr/bin/wviewd_sim
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/TWI/wviewd_twi $(1)/usr/bin/wviewd_twi
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/VantagePro/wviewd_vpro $(1)/usr/bin/wviewd_vpro
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/wviewconfig/wviewconfig $(1)/usr/bin/wviewconfig
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/wviewconfig/wviewhtmlconfig $(1)/usr/bin/wviewhtmlconfig
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/WH1080/wviewd_wh1080 $(1)/usr/bin/wviewd_wh1080
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/WMR918/wviewd_wmr918 $(1)/usr/bin/wviewd_wmr918
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/WS-2300/wviewd_ws2300 $(1)/usr/bin/wviewd_ws2300
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/WMRUSB/wviewd_wmrusb $(1)/usr/bin/wviewd_wmrusb
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/WXT510/wviewd_wxt510 $(1)/usr/bin/wviewd_wxt510
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/VantagePro/vpconfig/vpconfig $(1)/usr/bin/vpconfig
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/wviewconfig/wviewcleardata $(1)/usr/bin/wviewcleardata
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/TE923/wviewd_te923 $(1)/usr/bin/wviewd_te923
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/WXT510/wxt510config/wxt510config $(1)/usr/bin/wxt510config
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/etc/init.d/wview $(1)/etc/init.d/
+ $(INSTALL_DIR) $(1)/etc/wview
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/conf/wview-conf.sql $(1)/etc/wview/wview-conf.sql
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/graphics.conf $(1)/etc/wview/graphics.conf
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/post-generate.sh $(1)/etc/wview/post-generate.sh
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/images.conf $(1)/etc/wview/images.conf
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/images-user.conf $(1)/etc/wview/images-user.conf
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/conf/arcrec-header.conf $(1)/etc/wview/arcrec-header.conf
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/pre-generate.sh $(1)/etc/wview/pre-generate.sh
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/conf/wview-conf-update.sql $(1)/etc/wview/wview-conf-update.sql
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/conf/forecast.conf-no-forecast $(1)/etc/wview/forecast.conf-no-forecast
+ echo $(PKG_VERSION) > $(1)/etc/wview/wview-version
+ echo wviewd_sim > $(1)/etc/wview/wview-binary
+
+# This should never be defined as the user is expected to manually install all the
+# theme files he wants to an appropriate place and to specify that place in the config.
+# Leaving here for the future reference to be able to prepare a full variant of the package
+ifdef INSTALL_TEMPLATES
+ $(INSTALL_DIR) $(1)/etc/wview/html
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/Template-Skins-HOWTO.txt $(1)/etc/wview/html/Template-Skins-HOWTO.txt
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/parameterlist.htx $(1)/etc/wview/html/parameterlist.htx
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/parameterlist.txt $(1)/etc/wview/html/parameterlist.txt
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/awekas_wl.htx-metric $(1)/etc/wview/html/awekas_wl.htx-metric
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/Current.htx $(1)/etc/wview/html/Current.htx
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/html-templates.conf $(1)/etc/wview/html/html-templates.conf
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/Weekly.htx $(1)/etc/wview/html/Weekly.htx
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/Monthly.htx $(1)/etc/wview/html/Monthly.htx
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/data.htx $(1)/etc/wview/html/data.htx
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/index-day.htx $(1)/etc/wview/html/index-day.htx
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/Yearly.htx $(1)/etc/wview/html/Yearly.htx
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/Daily.htx $(1)/etc/wview/html/Daily.htx
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/almanac.htx $(1)/etc/wview/html/almanac.htx
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/header-big.incx $(1)/etc/wview/html/header-big.incx
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/index.htx $(1)/etc/wview/html/index.htx
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/awekas_wl.htx-us $(1)/etc/wview/html/awekas_wl.htx-us
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/Current_Conditions.htx $(1)/etc/wview/html/Current_Conditions.htx
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/header.incx $(1)/etc/wview/html/header.incx
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/index-night.htx $(1)/etc/wview/html/index-night.htx
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/wxrss.xtx $(1)/etc/wview/html/wxrss.xtx
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/readings.incx $(1)/etc/wview/html/readings.incx
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/nav-buttons.incx $(1)/etc/wview/html/nav-buttons.incx
+ $(INSTALL_DIR) $(1)/etc/wview/alarms
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/examples/alarms/outtempMax.sh $(1)/etc/wview/alarms/outtempMax.sh
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/examples/alarms/outtempMin.sh $(1)/etc/wview/alarms/outtempMin.sh
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/examples/alarms/outtempMaxEmail.sh $(1)/etc/wview/alarms/outtempMaxEmail.sh
+ $(INSTALL_DIR) $(1)/var/run/wview
+ $(INSTALL_DIR) $(1)/var/wview/img
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/fc-icon-partlycloudy.gif $(1)/var/wview/img/fc-icon-partlycloudy.gif
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/fc-icon-rain.gif $(1)/var/wview/img/fc-icon-rain.gif
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/chart_bg.png $(1)/var/wview/img/chart_bg.png
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/dot_bg.png $(1)/var/wview/img/dot_bg.png
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/fc-icon-snowandrain.gif $(1)/var/wview/img/fc-icon-snowandrain.gif
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/Clouds.jpg $(1)/var/wview/img/Clouds.jpg
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/Clouds-blue.jpg $(1)/var/wview/img/Clouds-blue.jpg
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/fc-icon-partlycloudyandsnow.gif $(1)/var/wview/img/fc-icon-partlycloudyandsnow.gif
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/dial_bg.png $(1)/var/wview/img/dial_bg.png
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/fc-icon-snow.gif $(1)/var/wview/img/fc-icon-snow.gif
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/bucket_bg.png $(1)/var/wview/img/bucket_bg.png
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/fc-icon-cloudy.gif $(1)/var/wview/img/fc-icon-cloudy.gif
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/django_bg.jpg $(1)/var/wview/img/django_bg.jpg
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/fc-icon-sunny.gif $(1)/var/wview/img/fc-icon-sunny.gif
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/fc-icon-partlycloudyandrain.gif $(1)/var/wview/img/fc-icon-partlycloudyandrain.gif
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/above-clouds.jpg $(1)/var/wview/img/above-clouds.jpg
+
+# These files and the directories should be created manually wherever the user is going to
+# have her weather archive and the generated html files
+ $(INSTALL_DIR) $(1)/var/wview/img/NOAA
+ $(INSTALL_DIR) $(1)/var/wview/img/Archive
+ $(INSTALL_DIR) $(1)/var/wview/noaa
+ $(INSTALL_DIR) $(1)/var/wview/alarms
+ $(INSTALL_DIR) $(1)/var/wview/archive
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/bin/archive/wview-archive.sql $(1)/var/wview/archive/wview-archive.sql
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/bin/archive/readme.txt $(1)/var/wview/archive/readme.txt
+endif
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/bin/archive/wview-archive.sql $(1)/etc/wview/wview-archive.sql
+endef
+
+$(eval $(call BuildPackage,wview))
+
--- /dev/null
+--- a/alarms/Makefile.am
++++ b/alarms/Makefile.am
+@@ -8,7 +8,6 @@ bin_PROGRAMS = wvalarmd
+ # define include directories
+ INCLUDES = \
+ -I$(top_srcdir)/common \
+- -I$(prefix)/include \
+ -D_GNU_SOURCE \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -36,9 +35,7 @@ wvalarmd_SOURCES = \
+ wvalarmd_LDADD =
+
+ # define library directories
+-wvalarmd_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-wvalarmd_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/cwop/Makefile.am
++++ b/cwop/Makefile.am
+@@ -8,7 +8,6 @@ bin_PROGRAMS = wvcwopd
+ # define include directories\r
+ INCLUDES = \\r
+ -I$(top_srcdir)/common \\r
+- -I$(prefix)/include \\r
+ -D_GNU_SOURCE \\r
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \\r
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \\r
+@@ -32,9 +31,7 @@ wvcwopd_SOURCES = \
+ wvcwopd_LDADD =\r
+ \r
+ # define library directories\r
+-wvcwopd_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib\r
+ \r
+ if CROSSCOMPILE\r
+-wvcwopd_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o\r
+ endif\r
+ \r
+--- a/ftp/Makefile.am
++++ b/ftp/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS = wviewftpd
+
+ # define include directories
+ INCLUDES = -I$(top_srcdir)/common \
+- -I$(prefix)/include \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+ -D_GNU_SOURCE
+@@ -33,9 +32,7 @@ wviewftpd_SOURCES = \
+ wviewftpd_LDADD = -lssl -lcurl
+
+ # define library directories
+-wviewftpd_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-wviewftpd_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/htmlgenerator/Makefile.am
++++ b/htmlgenerator/Makefile.am
+@@ -8,7 +8,6 @@ bin_PROGRAMS = htmlgend
+ # define include directories
+ INCLUDES = \
+ -I$(top_srcdir)/common \
+- -I$(prefix)/include \
+ -D_GNU_SOURCE \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -66,9 +65,7 @@ htmlgend_SOURCES = \
+ htmlgend_LDADD =
+
+ # define library directories
+-htmlgend_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-htmlgend_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/http/Makefile.am
++++ b/http/Makefile.am
+@@ -8,9 +8,6 @@ bin_PROGRAMS = wvhttpd
+ # define include directories
+ INCLUDES = \
+ -I$(top_srcdir)/common \
+- -I$(prefix)/include \
+- -I/usr/include \
+- -I/usr/local/include \
+ -D_GNU_SOURCE \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -38,9 +35,7 @@ wvhttpd_SOURCES = \
+ wvhttpd_LDADD = -lssl -lcurl
+
+ # define library directories
+-wvhttpd_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-wvhttpd_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/procmon/Makefile.am
++++ b/procmon/Makefile.am
+@@ -8,7 +8,6 @@ bin_PROGRAMS = wvpmond
+ # define include directories
+ INCLUDES = \
+ -I$(top_srcdir)/common \
+- -I$(prefix)/include \
+ -D_GNU_SOURCE \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -33,9 +32,7 @@ wvpmond_SOURCES = \
+ wvpmond_LDADD =
+
+ # define library directories
+-wvpmond_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-wvpmond_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/ssh/Makefile.am
++++ b/ssh/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS = wviewsshd
+
+ # define include directories
+ INCLUDES = -I$(top_srcdir)/common \
+- -I$(prefix)/include \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+ -D_GNU_SOURCE
+@@ -33,9 +32,7 @@ wviewsshd_SOURCES = \
+ wviewsshd_LDADD =
+
+ # define library directories
+-wviewsshd_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-wviewsshd_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/stations/Simulator/Makefile.am
++++ b/stations/Simulator/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS = wviewd_sim
+ INCLUDES = \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/stations/common \
+- -I$(prefix)/include \
+ -D_GNU_SOURCE \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -52,9 +51,7 @@ wviewd_sim_SOURCES = \
+ wviewd_sim_LDADD =
+
+ # define library directories
+-wviewd_sim_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-wviewd_sim_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/stations/TE923/Makefile.am
++++ b/stations/TE923/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS = wviewd_te923
+ INCLUDES = \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/stations/common \
+- -I$(prefix)/include \
+ -D_GNU_SOURCE \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -53,11 +52,9 @@ wviewd_te923_SOURCES = \
+
+ if DARWIN
+ wviewd_te923_SOURCES += $(top_srcdir)/stations/common/hidapi-osx.c
+-wviewd_te923_LDFLAGS = -L$(prefix)/lib -L/usr/lib -L/usr/local/lib -framework IOKit -framework CoreFoundation
+ wviewd_te923_LDADD =
+ else
+ wviewd_te923_SOURCES += $(top_srcdir)/stations/common/hidapi-linux.c
+-wviewd_te923_LDFLAGS = -L$(prefix)/lib -L/usr/lib -L/usr/local/lib
+ if FREEBSD
+ wviewd_te923_LDADD = -lusb
+ else
+--- a/stations/TWI/Makefile.am
++++ b/stations/TWI/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS = wviewd_twi
+ INCLUDES = \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/stations/common \
+- -I$(prefix)/include \
+ -D_GNU_SOURCE \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -57,9 +56,7 @@ wviewd_twi_SOURCES = \
+ wviewd_twi_LDADD =
+
+ # define library directories
+-wviewd_twi_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-wviewd_twi_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/stations/VantagePro/Makefile.am
++++ b/stations/VantagePro/Makefile.am
+@@ -9,7 +9,6 @@ bin_PROGRAMS = wviewd_vpro
+ INCLUDES = \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/stations/common \
+- -I$(prefix)/include \
+ -D_GNU_SOURCE \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -56,9 +55,7 @@ wviewd_vpro_SOURCES = \
+ wviewd_vpro_LDADD =
+
+ # define library directories
+-wviewd_vpro_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-wviewd_vpro_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/stations/VantagePro/vpconfig/Makefile.am
++++ b/stations/VantagePro/vpconfig/Makefile.am
+@@ -13,7 +13,6 @@ INCLUDES = \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/stations/common \
+ -I$(top_srcdir)/stations/VantagePro \
+- -I$(prefix)/include \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+ -D_VP_CONFIG_ONLY \
+@@ -40,10 +39,8 @@ vpconfig_SOURCES = \
+ vpconfig_LDADD =
+
+ # define library directories
+-vpconfig_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-vpconfig_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+ CLEANFILES = $(bin_SCRIPTS)
+--- a/stations/Virtual/Makefile.am
++++ b/stations/Virtual/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS = wviewd_virtual
+ INCLUDES = \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/stations/common \
+- -I$(prefix)/include \
+ -D_GNU_SOURCE \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -58,9 +57,7 @@ wviewd_virtual_SOURCES = \
+ wviewd_virtual_LDADD =
+
+ # define library directories
+-wviewd_virtual_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-wviewd_virtual_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/stations/WH1080/Makefile.am
++++ b/stations/WH1080/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS = wviewd_wh1080
+ INCLUDES = \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/stations/common \
+- -I$(prefix)/include \
+ -D_GNU_SOURCE \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -53,11 +52,9 @@ wviewd_wh1080_SOURCES = \
+
+ if DARWIN
+ wviewd_wh1080_SOURCES += $(top_srcdir)/stations/common/hidapi-osx.c
+-wviewd_wh1080_LDFLAGS = -L$(prefix)/lib -L/usr/lib -L/usr/local/lib -framework IOKit -framework CoreFoundation
+ wviewd_wh1080_LDADD =
+ else
+ wviewd_wh1080_SOURCES += $(top_srcdir)/stations/common/hidapi-linux.c
+-wviewd_wh1080_LDFLAGS = -L$(prefix)/lib -L/usr/lib -L/usr/local/lib
+ if FREEBSD
+ wviewd_wh1080_LDADD = -lusb
+ else
+--- a/stations/WMR918/Makefile.am
++++ b/stations/WMR918/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS = wviewd_wmr918
+ INCLUDES = \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/stations/common \
+- -I$(prefix)/include \
+ -D_GNU_SOURCE \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -56,9 +55,7 @@ wviewd_wmr918_SOURCES = \
+ wviewd_wmr918_LDADD =
+
+ # define library directories
+-wviewd_wmr918_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-wviewd_wmr918_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/stations/WMRUSB/Makefile.am
++++ b/stations/WMRUSB/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS = wviewd_wmrusb
+ INCLUDES = \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/stations/common \
+- -I$(prefix)/include \
+ -D_GNU_SOURCE \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -52,11 +51,9 @@ wviewd_wmrusb_SOURCES = \
+
+ if DARWIN
+ wviewd_wmrusb_SOURCES += $(top_srcdir)/stations/common/hidapi-osx.c
+-wviewd_wmrusb_LDFLAGS = -L$(prefix)/lib -L/usr/lib -L/usr/local/lib -framework IOKit -framework CoreFoundation
+ wviewd_wmrusb_LDADD =
+ else
+ wviewd_wmrusb_SOURCES += $(top_srcdir)/stations/common/hidapi-linux.c
+-wviewd_wmrusb_LDFLAGS = -L$(prefix)/lib -L/usr/lib -L/usr/local/lib
+ if FREEBSD
+ wviewd_wmrusb_LDADD = -lusb
+ else
+--- a/stations/WS-2300/Makefile.am
++++ b/stations/WS-2300/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS = wviewd_ws2300
+ INCLUDES = \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/stations/common \
+- -I$(prefix)/include \
+ -D_GNU_SOURCE \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -56,9 +55,7 @@ wviewd_ws2300_SOURCES = \
+ wviewd_ws2300_LDADD =
+
+ # define library directories
+-wviewd_ws2300_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-wviewd_ws2300_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/stations/WXT510/Makefile.am
++++ b/stations/WXT510/Makefile.am
+@@ -10,7 +10,6 @@ bin_PROGRAMS = wviewd_wxt510
+ INCLUDES = \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/stations/common \
+- -I$(prefix)/include \
+ -D_GNU_SOURCE \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -59,9 +58,7 @@ wviewd_wxt510_SOURCES = \
+ wviewd_wxt510_LDADD =
+
+ # define library directories
+-wviewd_wxt510_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-wviewd_wxt510_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/stations/WXT510/wxt510config/Makefile.am
++++ b/stations/WXT510/wxt510config/Makefile.am
+@@ -8,7 +8,6 @@ INCLUDES = \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/stations/common \
+ -I$(top_srcdir)/stations/WXT510 \
+- -I$(prefix)/include \
+ -D_WXT510_CONFIG_ONLY \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -38,9 +37,7 @@ wxt510config_SOURCES = \
+ wxt510config_LDADD =
+
+ # define library directories
+-wxt510config_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-wxt510config_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/utilities/archive-be2le/Makefile.am
++++ b/utilities/archive-be2le/Makefile.am
+@@ -8,7 +8,6 @@ INCLUDES = \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/stations/VantagePro \
+ -I$(top_srcdir)/utilities \
+- -I$(prefix)/include \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+ -DBUILD_UTILITIES \
+@@ -31,9 +30,7 @@ arc_be2le_SOURCES = \
+ arc_be2le_LDADD =
+
+ # define library directories
+-arc_be2le_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-arc_be2le_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/utilities/archive-le2be/Makefile.am
++++ b/utilities/archive-le2be/Makefile.am
+@@ -8,7 +8,6 @@ INCLUDES = \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/stations/VantagePro \
+ -I$(top_srcdir)/utilities \
+- -I$(prefix)/include \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+ -DBUILD_UTILITIES \
+@@ -31,9 +30,7 @@ arc_le2be_SOURCES = \
+ arc_le2be_LDADD =
+
+ # define library directories
+-arc_le2be_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-arc_le2be_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/utilities/hilowcreate/Makefile.am
++++ b/utilities/hilowcreate/Makefile.am
+@@ -6,7 +6,6 @@ bin_PROGRAMS = hilowcreate
+ # define include directories
+ INCLUDES = \
+ -I$(top_srcdir)/common \
+- -I$(prefix)/include \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+ -DBUILD_UTILITIES=1 \
+@@ -28,9 +27,7 @@ hilowcreate_SOURCES = \
+ hilowcreate_LDADD =
+
+ # define library directories
+-hilowcreate_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-hilowcreate_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/utilities/sqlite2wlk/Makefile.am
++++ b/utilities/sqlite2wlk/Makefile.am
+@@ -8,7 +8,6 @@ INCLUDES = \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/stations/VantagePro \
+ -I$(top_srcdir)/utilities \
+- -I$(prefix)/include \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+ -DBUILD_UTILITIES \
+@@ -29,9 +28,7 @@ sqlite2wlk_SOURCES = \
+ sqlite2wlk_LDADD =
+
+ # define library directories
+-sqlite2wlk_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-sqlite2wlk_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/utilities/wlk2sqlite/Makefile.am
++++ b/utilities/wlk2sqlite/Makefile.am
+@@ -8,7 +8,6 @@ INCLUDES = \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/stations/VantagePro \
+ -I$(top_srcdir)/utilities \
+- -I$(prefix)/include \
+ -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+ -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+ -DBUILD_UTILITIES \
+@@ -29,9 +28,7 @@ wlk2sqlite_SOURCES = \
+ wlk2sqlite_LDADD =
+
+ # define library directories
+-wlk2sqlite_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+
+ if CROSSCOMPILE
+-wlk2sqlite_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+
+--- a/stations/common/hidapi-linux.c
++++ b/stations/common/hidapi-linux.c
+@@ -79,7 +79,6 @@
+ #else\r
+ #include "libusb-1.0/libusb.h"\r
+ #endif\r
+-#include "iconv.h"\r
+ \r
+ #include "hidapi.h"\r
+ \r