initial commit

This commit is contained in:
Christoph Haag 2020-05-08 02:06:39 +02:00
commit 17491d23ae
4 changed files with 148 additions and 0 deletions

23
.SRCINFO Normal file
View file

@ -0,0 +1,23 @@
pkgbase = libsurvive-git
pkgdesc = Open-Source tool for working with lighthouse-based tracking data, including support for the HTC Vive, Vive Pro and Valve Index.
pkgver = 1398.457a0a5
pkgrel = 1
url = https://github.com/cntools/libsurvive
arch = x86_64
arch = i686
license = MIT
makedepends = cmake
makedepends = ninja
depends = hidapi
depends = xr-hardware
provides = libsurvive
conflicts = libsurvive
source = libsurvive::git+https://github.com/cntools/libsurvive.git
source = 0001-add-pkg-config-file.patch
source = 0002-install-redist-headers.patch
sha256sums = SKIP
sha256sums = 607becf44993ea872e4777e8127cd8c5ded706f43b6e2f4db77b02cccf463909
sha256sums = fa18552e1ffa684c51a0cd057070888094d7c38b0841dbb59067a52f06ec6fe3
pkgname = libsurvive-git

View file

@ -0,0 +1,42 @@
From 13c5834a80a338cac364a08e5e0dc1873752199b Mon Sep 17 00:00:00 2001
From: Christoph Haag <christoph.haag@collabora.com>
Date: Thu, 7 May 2020 14:29:28 +0200
Subject: [PATCH 1/2] add pkg-config file
---
CMakeLists.txt | 4 ++++
survive.pc.in | 10 ++++++++++
2 files changed, 14 insertions(+)
create mode 100644 survive.pc.in
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5ce53d9..4ab40e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -247,3 +247,7 @@ if(CTYPESGEN)
add_custom_target(pysurvive COMMAND ${CTYPESGEN} ${CMAKE_SOURCE_DIR}/include/libsurvive/*.h ${INCLUDE_FLAGS} --no-macros -L$<TARGET_FILE_DIR:survive> -llibsurvive.so
--strip-prefix=survive_ -P Survive -o ${PYTHON_GENERATED_DIR}pysurvive_generated.py )
endif()
+
+include(GNUInstallDirs)
+configure_file(survive.pc.in survive.pc @ONLY)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/survive.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
diff --git a/survive.pc.in b/survive.pc.in
new file mode 100644
index 0000000..5e3ce69
--- /dev/null
+++ b/survive.pc.in
@@ -0,0 +1,10 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
+includedir=${prefix}/include/libsurvive
+
+Name: @CMAKE_PROJECT_NAME@
+Description: Libsurvive
+Version: 0
+Libs: -L${libdir} -lsurvive @EXTRA_LIBS@
+Cflags: -I${includedir}
--
2.26.2

View file

@ -0,0 +1,39 @@
From 457a0a53c49a656424c51898b1150d0753c39673 Mon Sep 17 00:00:00 2001
From: Christoph Haag <christoph.haag@collabora.com>
Date: Thu, 7 May 2020 14:53:54 +0200
Subject: [PATCH 2/2] install redist headers
---
CMakeLists.txt | 5 +++++
survive.pc.in | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ab40e9..78a76a5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -236,6 +236,11 @@ INSTALL(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink survive
install(DIRECTORY include/libsurvive DESTINATION include)
+file(GLOB REDIST_HEADERS
+ "redist/*.h"
+)
+install(FILES ${REDIST_HEADERS} DESTINATION include/libsurvive/redist)
+
find_program(CTYPESGEN ctypesgen PATHS $ENV{HOME}/anaconda3/bin)
if(CTYPESGEN)
get_property(include_directories DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
diff --git a/survive.pc.in b/survive.pc.in
index 5e3ce69..1a6a1d2 100644
--- a/survive.pc.in
+++ b/survive.pc.in
@@ -7,4 +7,4 @@ Name: @CMAKE_PROJECT_NAME@
Description: Libsurvive
Version: 0
Libs: -L${libdir} -lsurvive @EXTRA_LIBS@
-Cflags: -I${includedir}
+Cflags: -I${includedir} -I${includedir}/redist
--
2.26.2

44
PKGBUILD Normal file
View file

@ -0,0 +1,44 @@
basename=libsurvive
pkgname=$basename-git
pkgver=1396.0d06d9a
pkgrel=1
pkgdesc="Open-Source tool for working with lighthouse-based tracking data, including support for the HTC Vive, Vive Pro and Valve Index."
arch=(x86_64 i686)
url="https://github.com/cntools/libsurvive"
license=(MIT)
depends=("hidapi" "xr-hardware")
conflicts=($basename)
provides=($basename)
makedepends=("cmake" "ninja")
source=($basename::"git+https://github.com/cntools/libsurvive.git"
"0001-add-pkg-config-file.patch"
"0002-install-redist-headers.patch")
sha256sums=('SKIP'
'607becf44993ea872e4777e8127cd8c5ded706f43b6e2f4db77b02cccf463909'
'fa18552e1ffa684c51a0cd057070888094d7c38b0841dbb59067a52f06ec6fe3')
pkgver() {
cd $basename
hash=$(git log --pretty=format:'%h' -n 1)
revision=$(git rev-list --count HEAD)
echo $revision.$hash
}
prepare() {
cd $basename
git apply "$srcdir"/0001-add-pkg-config-file.patch
git apply "$srcdir"/0002-install-redist-headers.patch
}
build() {
cd $basename
rm -rf build
cmake -B build -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib
ninja -C build
}
package() {
cd $basename
DESTDIR="$pkgdir" ninja -C build install
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}