[OpenWrt-Devel] [PATCH] [utils] gammu: new package in tree

Виталий Процко villy at sft.ru
Tue Nov 25 11:27:48 EST 2014


This add new package gammu v 1.33.0 to the build tree.

Gammu is the name of the project as well as name of command line
utility, which you can use to control your cell phone. It is written in C.

Signed-off-by: Vitaly Protsko <villy at sft.ru>
---
  Makefile                                 |   66 
+++++++++++++++++++++++++++++++
  patches/001-iconv-disabling-option.patch |   51 +++++++++++++++++++++++
  patches/002-no-fstack-protector.patch    |   11 +++++
  patches/003-cmake-cross-toolchain.patch  |   43 ++++++++++++++++++++
  4 files changed, 171 insertions(+)

diff -Naurp a/package/utils/gammu/Makefile b/package/utils/gammu/Makefile
--- a/package/utils/gammu/Makefile	1970-01-01 03:00:00.000000000 +0300
+++ b/package/utils/gammu/Makefile	2014-11-19 17:20:57.000000000 +0300
@@ -0,0 +1,66 @@
+#
+# Copyright (C) 2006-2009 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)
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/gammu
+	SECTION:=utils
+	CATEGORY:=Utilities
+	TITLE:=Command line utility which you can use to control your cellphone
+	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
+	MAINTAINER:=Vitaly Protsko <villy at sft.ru>
+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-{config,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
+endef
+
+$(eval $(call BuildPackage,gammu))
diff -Naurp 
a/package/utils/gammu/patches/001-iconv-disabling-option.patch 
b/package/utils/gammu/patches/001-iconv-disabling-option.patch
--- a/package/utils/gammu/patches/001-iconv-disabling-option.patch 
1970-01-01 03:00:00.000000000 +0300
+++ b/package/utils/gammu/patches/001-iconv-disabling-option.patch 
2014-11-13 19:20:30.000000000 +0300
@@ -0,0 +1,51 @@
+--- 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
diff -Naurp a/package/utils/gammu/patches/002-no-fstack-protector.patch 
b/package/utils/gammu/patches/002-no-fstack-protector.patch
--- a/package/utils/gammu/patches/002-no-fstack-protector.patch 
1970-01-01 03:00:00.000000000 +0300
+++ b/package/utils/gammu/patches/002-no-fstack-protector.patch 
2014-11-13 19:20:30.000000000 +0300
@@ -0,0 +1,11 @@
+--- 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)
diff -Naurp 
a/package/utils/gammu/patches/003-cmake-cross-toolchain.patch 
b/package/utils/gammu/patches/003-cmake-cross-toolchain.patch
--- a/package/utils/gammu/patches/003-cmake-cross-toolchain.patch 
1970-01-01 03:00:00.000000000 +0300
+++ b/package/utils/gammu/patches/003-cmake-cross-toolchain.patch 
2014-11-13 19:24:15.000000000 +0300
@@ -0,0 +1,43 @@
+--- /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
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list