Skip to content

Instantly share code, notes, and snippets.

@idoop
Created November 17, 2021 10:20
Show Gist options
  • Save idoop/7e56ed5a90c971a2a88c3a62cf0d16b4 to your computer and use it in GitHub Desktop.
Save idoop/7e56ed5a90c971a2a88c3a62cf0d16b4 to your computer and use it in GitHub Desktop.
GattLib as OpenWRT package

Download or pull OpenWRT repository, and create a directory gattlib in the openwrt/package/libs/ path, and copy the Makefile file to this directory. Enjoy it.

#
# Copyright (C) 2020-2030 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
# Author: Chen Yang <idoop@msn.cn>
# Github: https://github.com/idoop
include $(TOPDIR)/rules.mk
PKG_NAME:=gattlib
PKG_VERSION:=master
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/labapart/gattlib.git
PKG_SOURCE_DATE:=2021-10-18
PKG_SOURCE_VERSION:=1afaa8b460d0395989663e0e3baa6f8aeec48b78
PKG_MAINTAINER:=Chen Yang <idoop@msn.cn>
PKG_LICENSE:=BSD-3-Clause
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/$(PKG_NAME)
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+bluez-daemon +bluez-utils +libpcre
TITLE:=GattLib
endef
define Package/$(PKG_NAME)/description
GattLib is a library used to access Generic Attribute Profile (GATT) protocol of BLE (Bluetooth Low Energy) devices.
endef
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
CMAKE_OPTIONS = \
-DGATTLIB_BUILD_DOCS=OFF \
-DGATTLIB_BUILD_EXAMPLES=OFF \
-DGATTLIB_PYTHON_INTERFACE=OFF
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/include/* $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/dbus/lib* $(1)/usr/lib/
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/dbus/lib* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,$(PKG_NAME)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment