recipe for libcec (#4638)

* recipe for libcec
This commit is contained in:
TURX
2020-01-23 22:35:36 +08:00
committed by Schrijvers Luc
parent 1c9f53d66c
commit 4e6a5fcec7
3 changed files with 314 additions and 0 deletions

View File

@@ -0,0 +1,104 @@
SUMMARY="USB CEC Adapter communication Library"
DESCRIPTION="This library provides support for CEC capable hardware"
HOMEPAGE="http://libcec.pulse-eight.com/"
COPYRIGHT="2011-2015 Pulse-Eight Limited"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="$portVersion"
SOURCE_URI="https://github.com/Pulse-Eight/libcec/archive/libcec-$srcGitRev.tar.gz"
CHECKSUM_SHA256="ef90d6e4cf9d5847c14d3ff21b71579e5110643f31e8574766d3fa6c89c6239c"
SOURCE_DIR="libcec-libcec-$srcGitRev"
PATCHES="libcec-$srcGitRev.patchset"
srcGitRev2="63ec40a9e2dbe26d49dba0a73071a410dcc6b73b"
SOURCE_URI_2="https://github.com/Pulse-Eight/libcec-support/archive/$srcGitRev2.tar.gz"
CHECKSUM_SHA256_2="752695072aaf45de54d4edf46f415f836834500d03739a4dc56cd922065a75dc"
SOURCE_FILENAME_2="libcec-support-$srcGitRev2.tar.gz"
SOURCE_DIR_2="libcec-support-$srcGitRev2"
srcGitRev3="180cbe2b4e2b2d6a58c4b22d09760aba4b67a8e5"
SOURCE_URI_3="https://github.com/Pulse-Eight/cec-dotnet/archive/$srcGitRev3.tar.gz"
CHECKSUM_SHA256_3="1c542d1f07841aa7de85f21ee0157f413ad8e7043eef525f4c10b6111fa3aef9"
SOURCE_FILENAME_3="cec-dotnet-$srcGitRev3.tar.gz"
SOURCE_DIR_3="cec-dotnet-$srcGitRev3"
srcGitRev4="6535e48d68d69264c32d46ab9386ac18f77da5f7"
SOURCE_URI_4="https://github.com/Pulse-Eight/platform/archive/$srcGitRev4.tar.gz"
CHECKSUM_SHA256_4="2fa23d6242c249ba257b3ad8cbf8104ca816685c5567cf56e304b707ebd12d22"
SOURCE_FILENAME_4="platform-$srcGitRev4.tar.gz"
SOURCE_DIR_4="platform-$srcGitRev4"
PATCHES_4="platform-$srcGitRev4.patchset"
srcGitRev5="1149a12c79595a03a1915585159d5e6952484325"
SOURCE_URI_5="https://github.com/Pulse-Eight/libcec-support/archive/$srcGitRev5.tar.gz"
CHECKSUM_SHA256_5="39fd78a0f08ba7ad97e9be6339a6f7ba4e667ab5d050d35904012aebb77b7262"
SOURCE_FILENAME_5="libcec-support-$srcGitRev5.tar.gz"
SOURCE_DIR_5="libcec-support-$srcGitRev5"
ARCHITECTURES="x86_64"
SECONDARY_ARCHITECTURES="x86"
libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
PROVIDES="
libcec$secondaryArchSuffix = $portVersion
cmd:cec_client = $portVersion
cmd:cec_client_$portVersion = $portVersion
cmd:cecc_client = $portVersion
cmd:cecc_client_$portVersion = $portVersion
cmd:pycecclient
lib:libcec$secondaryArchSuffix = $libVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libncurses$secondaryArchSuffix
lib:libp8_platform$secondaryArchSuffix
lib:libpython3.7m$secondaryArchSuffix
"
PROVIDES_devel="
libcec${secondaryArchSuffix}_devel = $portVersion
devel:libcec$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
libcec$secondaryArchSuffix == $portVersion base
devel:libp8_platform$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libncurses$secondaryArchSuffix
devel:libp8_platform$secondaryArchSuffix
devel:libpython3.7m$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
cmd:swig$secondaryArchSuffix
"
BUILD()
{
# submodules
ln -sfn $sourceDir2 support
ln -sfn $sourceDir3 src/dotnet
ln -sfn $sourceDir4 src/platform
ln -sfn $sourceDir5 src/platform/support
# building
mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$prefix \
-DCMAKE_INSTALL_LIBDIR=$libDir \
-DCMAKE_INSTALL_INCLUDEDIR=$includeDir ..
make $jobArgs
}
INSTALL()
{
cd build
make install
prepareInstalledDevelLib libcec
fixPkgconfig
packageEntries devel $developDir
}

View File

@@ -0,0 +1,127 @@
From 2f56001ed94a90648d69945216bfcfde6c653d43 Mon Sep 17 00:00:00 2001
From: TURX <turx2003@gmail.com>
Date: Thu, 23 Jan 2020 11:24:33 +0800
Subject: [PATCH 1/2] add includedir support for cmake
---
src/libcec/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libcec/CMakeLists.txt b/src/libcec/CMakeLists.txt
index 6baee69..2b1cf34 100644
--- a/src/libcec/CMakeLists.txt
+++ b/src/libcec/CMakeLists.txt
@@ -163,7 +163,7 @@ else()
${CMAKE_CURRENT_SOURCE_DIR}/libcec.pc
${CMAKE_INSTALL_PREFIX}
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
- ${CMAKE_INSTALL_PREFIX}/include)
+ ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/libcec.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
@@ -176,7 +176,7 @@ install(FILES ${PROJECT_SOURCE_DIR}/../../include/cec.h
${PROJECT_SOURCE_DIR}/../../include/ceccloader.h
${PROJECT_SOURCE_DIR}/../../include/cectypes.h
${PROJECT_SOURCE_DIR}/../../include/version.h
- DESTINATION include/libcec)
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libcec)
# libCEC target
add_library(cec SHARED ${CEC_SOURCES})
--
2.20.1
From ec6c5c9cb2a56e93ffcf1df4e465ad526d82c473 Mon Sep 17 00:00:00 2001
From: TURX <turx2003@gmail.com>
Date: Thu, 23 Jan 2020 17:23:19 +0800
Subject: [PATCH] fix Haiku support
---
src/cec-client/CMakeLists.txt | 12 ++++++++++--
src/libcec/cmake/SetBuildInfo.cmake | 4 ++++
src/libcec/platform/drm/drm-edid.cpp | 4 +++-
src/libcec/platform/posix/serialport.cpp | 4 ++++
4 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/src/cec-client/CMakeLists.txt b/src/cec-client/CMakeLists.txt
index 8002d49..30fa489 100644
--- a/src/cec-client/CMakeLists.txt
+++ b/src/cec-client/CMakeLists.txt
@@ -24,7 +24,11 @@ find_package(Threads REQUIRED)
set(cecclient_SOURCES cec-client.cpp)
# curses
-check_library_exists(curses initscr "" HAVE_CURSES_API)
+if (HAIKU)
+ check_library_exists(ncurses initscr "" HAVE_CURSES_API)
+else()
+ check_library_exists(curses initscr "" HAVE_CURSES_API)
+endif()
if (HAVE_CURSES_API)
list(APPEND cecclient_SOURCES curses/CursesControl.cpp)
@@ -47,7 +51,11 @@ if (NOT WIN32)
# curses
if (HAVE_CURSES_API)
- target_link_libraries(cec-client curses)
+ if (HAIKU)
+ target_link_libraries(cec-client ncurses)
+ else()
+ target_link_libraries(cec-client curses)
+ endif()
if (HAVE_CURSES_TINFO)
target_link_libraries(cec-client tinfo)
endif()
diff --git a/src/libcec/cmake/SetBuildInfo.cmake b/src/libcec/cmake/SetBuildInfo.cmake
index 39bf4be..f0859cd 100644
--- a/src/libcec/cmake/SetBuildInfo.cmake
+++ b/src/libcec/cmake/SetBuildInfo.cmake
@@ -45,7 +45,11 @@ else()
# add host on which this was built to compile info
find_program(HAVE_HOSTNAME_BIN hostname /bin /usr/bin /usr/local/bin)
if(HAVE_HOSTNAME_BIN)
+ if(HAIKU)
+ exec_program(hostname OUTPUT_VARIABLE BUILD_HOST)
+ else()
exec_program(hostname ARGS -f OUTPUT_VARIABLE BUILD_HOST)
+ endif()
set(LIB_INFO "${LIB_INFO}@${BUILD_HOST}")
endif()
diff --git a/src/libcec/platform/drm/drm-edid.cpp b/src/libcec/platform/drm/drm-edid.cpp
index a3b1596..20b1bba 100644
--- a/src/libcec/platform/drm/drm-edid.cpp
+++ b/src/libcec/platform/drm/drm-edid.cpp
@@ -62,7 +62,9 @@ uint16_t CDRMEdidParser::GetPhysicalAddress(void)
while (entry != NULL && enablededid.empty())
{
// We look if the element is a symlinl
- if (entry->d_type == DT_LNK)
+ #ifndef __HAIKU__
+ if (entry->d_type == DT_LNK)
+ #endif // HAIKU
{
// We look for the file enable to find the active video card
std::string path, enabledPath, edidPath;
diff --git a/src/libcec/platform/posix/serialport.cpp b/src/libcec/platform/posix/serialport.cpp
index c97bd69..eaff978 100644
--- a/src/libcec/platform/posix/serialport.cpp
+++ b/src/libcec/platform/posix/serialport.cpp
@@ -186,7 +186,11 @@ bool CSerialSocket::Open(uint64_t iTimeoutMs /* = 0 */)
else
m_options.c_iflag |= INPCK | ISTRIP;
+#ifdef IMAXBEL
m_options.c_iflag &= ~(IXON | IXOFF | IXANY | BRKINT | INLCR | IGNCR | ICRNL | IUCLC | IMAXBEL);
+#else
+ m_options.c_iflag &= ~(IXON | IXOFF | IXANY | BRKINT | INLCR | IGNCR | ICRNL | IUCLC);
+#endif
m_options.c_oflag &= ~(OPOST | ONLCR | OCRNL);
if (tcsetattr(m_socket, TCSANOW, &m_options) != 0)
--
2.20.1

View File

@@ -0,0 +1,83 @@
From 3114837a171dc36063a524f710ce875efd6198e5 Mon Sep 17 00:00:00 2001
From: TURX <turx2003@gmail.com>
Date: Thu, 23 Jan 2020 11:26:46 +0800
Subject: [PATCH 1/2] add includedir support for cmake
---
CMakeLists.txt | 2 +-
p8-platform-config.cmake.in | 2 +-
p8-platform.pc.in | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7144b0b..9111041 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,7 +22,7 @@ if(WIN32)
src/windows/os-threads.cpp)
endif()
-set(p8-platform_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include/p8-platform")
+set(p8-platform_INCLUDE_DIRS "${CMAKE_INSTALL_INCLUDEDIR}/p8-platform")
IF(WIN32)
LIST(APPEND p8-platform_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include/p8-platform/windows")
ENDIF(WIN32)
diff --git a/p8-platform-config.cmake.in b/p8-platform-config.cmake.in
index 47f30f1..abdd905 100644
--- a/p8-platform-config.cmake.in
+++ b/p8-platform-config.cmake.in
@@ -10,7 +10,7 @@
#
# propagate these properties from one build system to the other
set (p8-platform_VERSION "@p8-platform_VERSION_MAJOR@.@p8-platform_VERSION_MINOR@")
-set (p8-platform_INCLUDE_DIRS @p8-platform_INCLUDE_DIRS@ @CMAKE_INSTALL_PREFIX@/include)
+set (p8-platform_INCLUDE_DIRS @p8-platform_INCLUDE_DIRS@ @CMAKE_INSTALL_INCLUDEDIR@)
set (p8-platform_LIBRARY_DIRS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
set (p8-platform_LINKER_FLAGS "@p8-platform_LINKER_FLAGS@")
set (p8-platform_CONFIG_VARS "@p8-platform_CONFIG_VARS@")
diff --git a/p8-platform.pc.in b/p8-platform.pc.in
index f97a2d4..611edb7 100644
--- a/p8-platform.pc.in
+++ b/p8-platform.pc.in
@@ -1,6 +1,6 @@
prefix=@CMAKE_INSTALL_PREFIX@
libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@
-includedir=@CMAKE_INSTALL_PREFIX@/include
+includedir=@CMAKE_INSTALL_INCLUDEDIR@
DEPENDENCIES=@p8-platform_LIBRARIES@
Name: @p8-platform_NAME@
--
2.20.1
From 367a56a405e6611a4c287be3dacc8dbcadc02a59 Mon Sep 17 00:00:00 2001
From: TURX <turx2003@gmail.com>
Date: Thu, 23 Jan 2020 11:26:59 +0800
Subject: [PATCH 2/2] fix Haiku support
---
src/posix/os-types.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/posix/os-types.h b/src/posix/os-types.h
index 7fb832c..be38edd 100644
--- a/src/posix/os-types.h
+++ b/src/posix/os-types.h
@@ -36,9 +36,12 @@
#include <string.h>
#include <errno.h>
#include <sys/time.h>
-#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__HAIKU__)
#include <sys/prctl.h>
#endif
+#if defined(__HAIKU__)
+#include <OS.h>
+#endif
#include <pthread.h>
#include <poll.h>
#include <semaphore.h>
--
2.20.1