--- /dev/null
+#
+# Copyright (C) 2006-2014 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:=gammu
+PKG_VERSION:=1.33.0
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://dl.cihar.com/gammu/releases/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_MD5SUM:=66b95afbde3085168c4a20266e8cb5c0
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_MAINTAINER:=Vitaly Protsko <villy@sft.ru>
+PKG_LICENCE:=GPL-2.0
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/gammu
+ SECTION:=utils
+ CATEGORY:=Utilities
+ TITLE:=Cell phone/modem SMS and control tool
+ URL:=http://dl.cihar.com/gammu/releases/
+ DEPENDS:=@BUILD_NLS +libpthread +libcurl +glib2 $(ICONV_DEPENDS) $(INTL_DEPENDS)
+ DEPENDS+=+PACKAGE_python:python +PACKAGE_bluez-libs:bluez-libs
+ DEPENDS+=+PACKAGE_libmysqlclient:libmysqlclient +PACKAGE_unixodbc:unixodbc
+endef
+
+CONFIGURE_ARGS:= \
+ --prefix=/usr \
+ --cross-root="$(STAGING_DIR) $(TOOLCHAIN_DIR)" \
+ --enable-shared
+
+define Build/Compile
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ $(TARGET_CONFIGURE_OPTS) \
+ LDSHARED="$(TARGET_CROSS)ld -shared" \
+ CFLAGS="$(TARGET_CFLAGS) $(FPIC)"
+endef
+
+define Build/Install
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ DESTDIR="$(PKG_INSTALL_DIR)" \
+ install
+endef
+
+define Build/InstallDev
+ mkdir -p $(1)/usr/include
+ $(CP) -r $(PKG_INSTALL_DIR)/usr/include/gammu $(1)/usr/include/
+ mkdir -p $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{Gammu*,gsmsd*} $(1)/usr/lib/
+endef
+
+define Package/gammu/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gammu $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gammu-{smsd,smsd-inject,smsd-monitor} $(1)/usr/bin
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lib{Gammu*,gsmsd*} $(1)/usr/lib
+ $(INSTALL_BIN) ./files/gammurc $(1)/etc
+endef
+
+$(eval $(call BuildPackage,gammu))
--- /dev/null
+# Port : "/dev/ttyS%" or "/dev/ircomm%" ("irda" connection), "/dev/ttyUSB%"
+# (instead of "%" please put "0", "1", "2", etc.)
+# Model : use only, when Gammu doesn't recognize your phone model.
+# Put it here. Example values: "6110", "6150", "6210", "8210"
+# Connection : type of connection. Use "fbus" or "mbus" or "dlr3" or
+# "irda" (Infrared over sockets) or "infrared" (DirectIR)
+# or "at19200" (AT commands on 19200, 8 bits, None parity,
+# 1 stop bit, no flow control) or "at115200" (AT commands on
+# 115200, 8 bits, None parity, 1 stop bit, no flow control)
+# or "atblue" (AT over BlueTooth) or "dlr3blue" (FBUS
+# over BlueTooth)
+# SynchronizeTime: If you want to set time from computer to phone during
+# starting connection. Do not rather use this option when want
+# to reset phone during connection (in some phones need to
+# set time again after restart)
+# Logfile : Use, when want to have logfile from communication.
+# Logformat : What debug info and format should be used:
+# "nothing" - no debug level, "text" - transmission dump in
+# text format, "textall" - all possible info in text format,
+# "errors" - errors in text format, "binary" - transmission
+# dump in binary format
+# Use_Locking : under Unix/Linux use "yes", if want to lock used device
+# to prevent using it by other applications
+# GammuLoc : name of localisation file
+
+[gammu]
+
+port = /dev/ttyUSB0
+#model =
+connection = at
+#synchronizetime = yes
+#logfile =
+#logformat = errors
+use_locking = yes
+#gammuloc =
+
+# EOF /etc/gammurc
--- /dev/null
+--- a/cmake/FindIconv.cmake
++++ b/cmake/FindIconv.cmake
+@@ -34,9 +34,9 @@ string(REGEX REPLACE "(.*)/include/?" "\
+
+ FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c HINTS "${ICONV_INCLUDE_BASE_DIR}/lib" PATHS /opt/local/lib)
+
+-IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
++IF(NOT DISABLE_ICONV AND ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
+ SET(ICONV_FOUND TRUE)
+-ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
++ENDIF(NOT DISABLE_ICONV AND ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
+
+ set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
+ set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
+--- a/configure
++++ b/configure
+@@ -31,6 +31,7 @@ Usage: ./configure [options]
+ --enable-backup enable backup support
+ --enable-win32 enable mingw crosscomilation
+ --enable-protection enable compile time protections
++--disable-iconv disable iconv support
+ --with-python=<path> path to Python interpreter
+ --without-gnapplet disable installation of gnapplet
+ --without-completion disable installation of bash completion script
+@@ -57,6 +58,7 @@ CMAKE_PROTECTION=
+ CMAKE_PYTHON=
+ CMAKE_GNAP=
+ CMAKE_COMPLETE=
++CMAKE_ICONV=
+
+ # process command line
+ while [ "$#" -gt 0 ] ; do
+@@ -94,6 +96,12 @@ while [ "$#" -gt 0 ] ; do
+ --disable-protection)
+ CMAKE_PROTECTION="-DENABLE_PROTECTION=OFF"
+ ;;
++ --enable-iconv)
++ CMAKE_ICONV="-DDISABLE_ICONV=OFF"
++ ;;
++ --disable-iconv)
++ CMAKE_ICONV="-DDISABLE_ICONV=ON"
++ ;;
+ --enable-debug)
+ CMAKE_DEBUG="-DCMAKE_BUILD_TYPE=Debug"
+ ;;
+@@ -142,4 +150,4 @@ fi
+ cd "$BUILD_DIR"
+
+ # invoke cmake to do configuration
+-cmake $SOURCE_DIR $CMAKE_PREFIX $CMAKE_SHARED $CMAKE_DEBUG $CMAKE_BACKUP $CMAKE_CROSS $CMAKE_PROTECTION $CMAKE_PYTHON $CMAKE_GNAP $CMAKE_COMPLETE
++cmake $SOURCE_DIR $CMAKE_PREFIX $CMAKE_SHARED $CMAKE_DEBUG $CMAKE_BACKUP $CMAKE_CROSS $CMAKE_PROTECTION $CMAKE_PYTHON $CMAKE_GNAP $CMAKE_COMPLETE $CMAKE_ICONV
--- /dev/null
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -537,8 +537,6 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMP
+ # MACRO_TUNE_LINKER("-pie")
+ # These do not work on Windows right now
+ if (NOT WIN32)
+- # Stack protector
+- MACRO_TUNE_COMPILER("-fstack-protector")
+ # Mark code read only
+ MACRO_TUNE_LINKER("-Wl,-zrelro")
+ endif (NOT WIN32)
--- /dev/null
+--- /dev/null
++++ b/cmake/Toolchain-cross.cmake
+@@ -0,0 +1,5 @@
++# search for programs in the build host directories
++SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
++# for libraries and headers in the target directories
++SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
++SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+--- a/configure
++++ b/configure
+@@ -25,6 +25,7 @@ Usage: ./configure [options]
+
+ --help|-h shows this help
+ --prefix=<path> installation prefix
++--cross-root=<path> cross-compilation prefix
+ --enable-shared enables shared build
+ --enable-debug enables debug build
+ --enable-tiger enables Mac OS X 10.4 (Tiger) build
+@@ -50,6 +51,7 @@ SOURCE_DIR=`pwd`
+
+ # cmake parameters
+ CMAKE_PREFIX=
++CMAKE_ROOT=
+ CMAKE_SHARED=
+ CMAKE_DEBUG=
+ CMAKE_BACKUP=
+@@ -69,6 +71,10 @@ while [ "$#" -gt 0 ] ; do
+ --prefix=*)
+ CMAKE_PREFIX="-DCMAKE_INSTALL_PREFIX=${1##--prefix=}"
+ ;;
++ --cross-root=*)
++ CMAKE_ROOT="-DCMAKE_TOOLCHAIN_FILE=$SOURCE_DIR/cmake/Toolchain-cross.cmake"
++ echo "SET(CMAKE_FIND_ROOT_PATH ${1##--cross-root=})" >> $SOURCE_DIR/cmake/Toolchain-cross.cmake
++ ;;
+ --with-python=*)
+ CMAKE_PYTHON="-DBUILD_PYTHON=${1##--with-python=}"
+ ;;
+@@ -150,4 +156,4 @@ fi
+ cd "$BUILD_DIR"
+
+ # invoke cmake to do configuration
+-cmake $SOURCE_DIR $CMAKE_PREFIX $CMAKE_SHARED $CMAKE_DEBUG $CMAKE_BACKUP $CMAKE_CROSS $CMAKE_PROTECTION $CMAKE_PYTHON $CMAKE_GNAP $CMAKE_COMPLETE $CMAKE_ICONV
++cmake $SOURCE_DIR $CMAKE_ROOT $CMAKE_PREFIX $CMAKE_SHARED $CMAKE_DEBUG $CMAKE_BACKUP $CMAKE_CROSS $CMAKE_PROTECTION $CMAKE_PYTHON $CMAKE_GNAP $CMAKE_COMPLETE $CMAKE_ICONV
--- /dev/null
+--- a/utils/gammu-config
++++ b/utils/gammu-config
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ # Gammu configuration generator
+ # Copyright (C) 2003 - 2009 Michal Cihar <michal@cihar.com>
+ # vim: expandtab sw=4 ts=4 sts=4:
+--- a/utils/jadmaker
++++ b/utils/jadmaker
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ # JAD file generator
+ # Copyright © 2008 - 2009 Michal Čihař <michal@cihar.com>
+ # vim: expandtab sw=4 ts=4 sts=4: