kpty: add recipe

This commit is contained in:
Gerasim Troeglazov
2021-01-05 16:36:00 +10:00
parent fc2c4cc688
commit 90ada9e9dc
2 changed files with 191 additions and 0 deletions

View File

@@ -0,0 +1,85 @@
SUMMARY="Interfacing with pseudo terminal devices"
DESCRIPTION="This library provides primitives to interface with pseudo terminal \
devices as well as a KProcess derived class for running child processes and \
communicating with them using a pty.."
HOMEPAGE="https://github.com/KDE/kpty/"
COPYRIGHT="2010-2020 KDE Organisation"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://github.com/KDE/kpty/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="32f5fe3c678afe077d089e2c0038c5437c19bd66e37b6a3721db6f1decbe35dd"
PATCHES="kpty-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 x86_64"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
kpty$secondaryArchSuffix = $portVersion
lib:libKF5Pty$secondaryArchSuffix = $portVersion compat >= 5
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libKF5ConfigGui$secondaryArchSuffix
lib:libKF5CoreAddons$secondaryArchSuffix
lib:libKF5I18n$secondaryArchSuffix
lib:libKF5WidgetsAddons$secondaryArchSuffix
lib:libQt5Core$secondaryArchSuffix
lib:libQt5Gui$secondaryArchSuffix
lib:libQt5Xml$secondaryArchSuffix
"
PROVIDES_devel="
kpty${secondaryArchSuffix}_devel = $portVersion
devel:libKF5Pty$secondaryArchSuffix = $portVersion compat >= 5
"
REQUIRES_devel="
kpty$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
extra_cmake_modules$secondaryArchSuffix >= $portVersion
devel:libKF5ConfigGui$secondaryArchSuffix == $portVersion
devel:libKF5CoreAddons$secondaryArchSuffix == $portVersion
devel:libKF5I18n$secondaryArchSuffix
devel:libKF5WidgetsAddons$secondaryArchSuffix == $portVersion
devel:libQt5Core$secondaryArchSuffix >= 5.15
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:g++$secondaryArchSuffix
cmd:lrelease$secondaryArchSuffix >= 5
cmd:make
"
BUILD()
{
mkdir -p build
cd build
cmake .. $cmakeDirArgs \
-DCMAKE_CXX_FLAGS=-D_BSD_SOURCE \
-DECM_MKSPECS_INSTALL_DIR=$dataDir/Qt5/mkspecs \
-DECM_DIR=/system/data/cmake/Modules/ECM/cmake
make $jobArgs
}
INSTALL()
{
cd build
make install
prepareInstalledDevelLibs \
libKF5Pty
packageEntries devel \
$libDir/cmake \
$dataDir/Qt5 \
$developDir
}
TEST()
{
cd build
make test
}

View File

@@ -0,0 +1,106 @@
From 2704ef9f79a04e9f4f71e9cc7b5a1e33050482ae Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Tue, 5 Jan 2021 13:36:16 +1000
Subject: Fixes for haiku
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e348996..e3b9bcf 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -26,7 +26,8 @@ target_link_libraries(KF5Pty PUBLIC Qt5::Core
PRIVATE
${UTIL_LIBRARY}
${kpty_OPTIONAL_LIBS}
- KF5::I18n)
+ KF5::I18n
+ bsd)
target_include_directories(KF5Pty PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..)
diff --git a/src/kpty.cpp b/src/kpty.cpp
index 55b057b..7e3ae34 100644
--- a/src/kpty.cpp
+++ b/src/kpty.cpp
@@ -69,7 +69,9 @@ public:
int cmdFd;
};
#else
+# if HAVE_UTMP
# include <utmp.h>
+# endif
# if HAVE_UTMPX
# include <utmpx.h>
# endif
@@ -318,6 +320,10 @@ grantedpt:
fcntl(d->masterFd, F_SETFD, FD_CLOEXEC);
fcntl(d->slaveFd, F_SETFD, FD_CLOEXEC);
+#ifdef __HAIKU__
+ setEcho(true);
+#endif
+
return true;
}
@@ -358,6 +364,10 @@ bool KPty::open(int fd)
return false;
}
+#ifdef __HAIKU__
+ setEcho(true);
+#endif
+
return true;
#endif
}
diff --git a/src/kpty_p.h b/src/kpty_p.h
index 730ef98..9581a11 100644
--- a/src/kpty_p.h
+++ b/src/kpty_p.h
@@ -12,6 +12,19 @@
#include <config-pty.h>
+#ifdef __HAIKU__
+#undef HAVE_OPENPTY
+#define HAVE_OPENPTY 1
+#undef HAVE_UTMP
+#define HAVE_UTMP 0
+#define ut_name ut_user
+#define ut_host ut_line
+#define _PATH_UTMPX ""
+#define _PATH_WTMPX ""
+#define utmpxname(a)
+#define updwtmpx(a, b)
+#endif
+
#include <QByteArray>
#include <QString>
--
2.28.0
From 2cefbabf9ff75582842d0bd6e208037cf7752c31 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Tue, 5 Jan 2021 13:45:26 +1000
Subject: Fixes for haiku2
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e3b9bcf..a28557f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -81,7 +81,7 @@ endif()
########### next target ###############
-if (NOT HAVE_OPENPTY)
+if (NOT HAVE_OPENPTY AND NOT HAIKU)
add_executable(kgrantpty kgrantpty.c)
ecm_mark_nongui_executable(kgrantpty)
install(TARGETS kgrantpty DESTINATION ${KDE_INSTALL_LIBEXECDIR_KF5})
--
2.28.0