testing/pebble-le: new aport

This commit is contained in:
leso-kn 2023-05-04 04:53:58 +00:00 committed by psykose
parent 2a78865eed
commit 3d92d75c82
5 changed files with 194 additions and 0 deletions

View File

@ -0,0 +1,57 @@
# Maintainer: leso-kn <info@lesosoftware.com>
pkgname=pebble-le
pkgver=0.1.0
pkgrel=0
_dbus_gatt="cd667d0d3cf8446fbe166b972e68cba2ba95368f"
pkgdesc="Library to talk to Pebble Smartwatches via Bluetooth Low Energy (BLE)"
url="https://github.com/leso-kn/pebble-le"
arch="all"
license="MIT"
makedepends="
boost-dev
cmake
fmt-dev
dbus-dev
glib-dev
samurai
simpleble-dev
"
install="$pkgname.pre-install"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/leso-kn/pebble-le/archive/refs/tags/v$pkgver.tar.gz
dbus_gatt-$_dbus_gatt.tar.gz::https://github.com/RomaSo/dbus_gatt/archive/$_dbus_gatt.tar.gz
gcc13.patch
dbus-gatt-cmake.patch
simpleble.patch
"
options="!check" # soon pebble-le unit-tests
prepare() {
rmdir third_party/dbus_gatt third_party/SimpleBLE
mv "$srcdir"/dbus_gatt-$_dbus_gatt third_party/dbus_gatt
default_prepare
}
build() {
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=None \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_INCLUDEDIR=/usr/include \
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DCMAKE_SKIP_INSTALL_RPATH=ON
cmake --build build
}
package() {
DESTDIR="$pkgdir" cmake --install build
}
sha512sums="
56651d4b47a4cdca42094507e80c8240fe3a3c74bac3276d3c20574ec1fed45dc472880994b4363d3ec81149a38ac7c82c4ce4c9416262e4a5e7bf86e1315497 pebble-le-0.1.0.tar.gz
2df542ec2ac75632d7d66f1a43b6d9af577525757dc5fbcd7b0860520d86c4e89c2fcbb117cd132d1414493f6e30ecfc68027a0de2eec02c9c12bbe04e5dc3c7 dbus_gatt-cd667d0d3cf8446fbe166b972e68cba2ba95368f.tar.gz
5ba7164eeb5f1d19ebe88e69eb3edaba7ca3bb92aed2743e1ae9cc851086cd57a1de925d6ed196c0f2a655ec17b0cb778f00591f06f2b9d395cc8ee0e9392c41 gcc13.patch
260b04e3cbe170ac3e9cb22dcc9e855151fa3fb812934c901a3f925d651c11ae9663264fc65034e2afc4e614f2cca60bd15acec953a014631c183d058a532b41 dbus-gatt-cmake.patch
2bb0af3873f9d8295ef7a465da43e7563d5ab17a702e4f61a7e13ea799213b7fbba43385bb0807063b96997bc263d09d12f17f9d574104830d3d2b2eb1adbdbe simpleble.patch
"

View File

@ -0,0 +1,71 @@
diff --git a/third_party/dbus_gatt/CMakeLists.txt b/third_party/dbus_gatt/CMakeLists.txt
index ef07d8e..1a5b988 100644
--- a/third_party/dbus_gatt/CMakeLists.txt
+++ b/third_party/dbus_gatt/CMakeLists.txt
@@ -27,7 +27,7 @@ endif ()
include_directories(
include
${GLIB_INCLUDE_DIRS}
- ${DBUS_INCLUDE_DIRS}
+ ${DBus_INCLUDE_DIRS}
${GIO_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
)
diff --git a/third_party/dbus_gatt/cmake/FindDBus.cmake b/third_party/dbus_gatt/cmake/FindDBus.cmake
index e677b77..475e5bc 100644
--- a/third_party/dbus_gatt/cmake/FindDBus.cmake
+++ b/third_party/dbus_gatt/cmake/FindDBus.cmake
@@ -29,27 +29,27 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
FIND_PACKAGE(PkgConfig)
-PKG_CHECK_MODULES(PC_DBUS QUIET dbus-1)
+PKG_CHECK_MODULES(PC_DBus QUIET dbus-1)
-FIND_LIBRARY(DBUS_LIBRARIES
+FIND_LIBRARY(DBus_LIBRARIES
NAMES dbus-1
- HINTS ${PC_DBUS_LIBDIR}
- ${PC_DBUS_LIBRARY_DIRS}
+ HINTS ${PC_DBus_LIBDIR}
+ ${PC_DBus_LIBRARY_DIRS}
)
-FIND_PATH(DBUS_INCLUDE_DIR
+FIND_PATH(DBus_INCLUDE_DIR
NAMES dbus/dbus.h
- HINTS ${PC_DBUS_INCLUDEDIR}
- ${PC_DBUS_INCLUDE_DIRS}
+ HINTS ${PC_DBus_INCLUDEDIR}
+ ${PC_DBus_INCLUDE_DIRS}
)
-GET_FILENAME_COMPONENT(_DBUS_LIBRARY_DIR ${DBUS_LIBRARIES} PATH)
-FIND_PATH(DBUS_ARCH_INCLUDE_DIR
+GET_FILENAME_COMPONENT(_DBus_LIBRARY_DIR ${DBus_LIBRARIES} PATH)
+FIND_PATH(DBus_ARCH_INCLUDE_DIR
NAMES dbus/dbus-arch-deps.h
- HINTS ${PC_DBUS_INCLUDEDIR}
- ${PC_DBUS_INCLUDE_DIRS}
- ${_DBUS_LIBRARY_DIR}
- ${DBUS_INCLUDE_DIR}
+ HINTS ${PC_DBus_INCLUDEDIR}
+ ${PC_DBus_INCLUDE_DIRS}
+ ${_DBus_LIBRARY_DIR}
+ ${DBus_INCLUDE_DIR}
PATH_SUFFIXES dbus-1.0/include
)
@@ -58,10 +58,10 @@ FIND_PATH(DBUS_ARCH_INCLUDE_DIR
#message("!!!!!!!!!!! ${DBUS_LIBRARIES} | ${PC_DBUS_LIBDIR} | ${PC_DBUS_LIBRARY_DIRS}")
#message("!!!!!!!!!!! ${DBUS_INCLUDE_DIR} | ${PC_DBUS_INCLUDEDIR} | ${PC_DBUS_INCLUDE_DIRS}")
-SET(DBUS_INCLUDE_DIRS ${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR})
+SET(DBus_INCLUDE_DIRS ${DBus_INCLUDE_DIR} ${DBus_ARCH_INCLUDE_DIR})
#message("!!!!!!!!!!! ${DBUS_ARCH_INCLUDE_DIR} |")
#message("!!!!!!!!!!! ${DBUS_INCLUDE_DIRS} | ${PC_DBUS_INCLUDEDIR} | ${PC_DBUS_INCLUDE_DIRS}")
INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBUS REQUIRED_VARS DBUS_INCLUDE_DIRS DBUS_LIBRARIES)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBus REQUIRED_VARS DBus_INCLUDE_DIRS DBus_LIBRARIES)

View File

@ -0,0 +1,20 @@
--- a/third_party/dbus_gatt/src/impl/dbus_method.h
+++ b/third_party/dbus_gatt/src/impl/dbus_method.h
@@ -23,6 +23,7 @@
#ifndef DBUS_GATT_DBUS_METHOD_H_
#define DBUS_GATT_DBUS_METHOD_H_
+#include <cstdint>
#include <functional>
#include <iostream>
#include <string>
--- a/third_party/dbus_gatt/include/dbus_gatt/dbus_gatt_types.h
+++ b/third_party/dbus_gatt/include/dbus_gatt/dbus_gatt_types.h
@@ -24,6 +24,7 @@
#define DBUS_GATT_SRC_DBUS_GATT_TYPES_H_
#include <cstddef>
+#include <cstdint>
#include <functional>
#include <variant>

View File

@ -0,0 +1,5 @@
#!/bin/sh
addgroup -S pebble-le 2>/dev/null
exit 0

View File

@ -0,0 +1,41 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e606af7..f125f0e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,18 +22,13 @@ set(pebble_le_SOURCES
src/util.cpp)
# Third-Party Dependencies
-add_subdirectory(third_party/SimpleBLE/simpleble EXCLUDE_FROM_ALL)
add_subdirectory(third_party/dbus_gatt EXCLUDE_FROM_ALL)
-set(SimpleBLE_INCLUDE_DIRS
- ${CMAKE_SOURCE_DIR}/third_party/SimpleBLE/simpleble/include
- ${CMAKE_SOURCE_DIR}/third_party/SimpleBLE/simplebluez/include
- ${CMAKE_SOURCE_DIR}/third_party/SimpleBLE/simpledbus/include
- ${CMAKE_BINARY_DIR}/third_party/SimpleBLE/simpleble/export)
-
find_package(PkgConfig REQUIRED)
pkg_search_module(GLIB REQUIRED glib-2.0)
pkg_search_module(DBus1 REQUIRED dbus-1)
+pkg_search_module(SimpleBLE REQUIRED simpleble)
+pkg_search_module(SimpleBLUEZ REQUIRED simplebluez)
# libpebble-le
add_library(pebble-le_o OBJECT ${pebble_le_SOURCES})
@@ -51,12 +46,13 @@ set_target_properties(pebble-le PROPERTIES
set_target_properties(pebble-le_static PROPERTIES
OUTPUT_NAME pebble-le)
-target_include_directories(pebble-le_o PRIVATE ${SimpleBLE_INCLUDE_DIRS} ${DBus1_INCLUDE_DIRS} ${GLIB_INCLUDE_DIRS})
+target_include_directories(pebble-le_o PRIVATE ${SimpleBLE_INCLUDE_DIRS} ${SimpleBLUEZ_INCLUDE_DIRS} ${DBus1_INCLUDE_DIRS} ${GLIB_INCLUDE_DIRS})
target_include_directories(pebble-le_o PUBLIC include ${CMAKE_BINARY_DIR}/exports)
target_link_libraries(pebble-le_o PUBLIC
dbus_gatt
- simpleble
+ ${SimpleBLE_LIBRARIES}
+ ${SimpleBLUEZ_LIBRARIES}
${DBus1_LIBRARIES}
${GLIB_LIBRARIES}
${GLIB_GIO_LIBRARIES})