sysutils/rw-tui: New port: Read & Write Everything (only memory for now on FreeBSD)
This commit is contained in:
@@ -1324,6 +1324,7 @@
|
||||
SUBDIR += rust-coreutils
|
||||
SUBDIR += rust-findutils
|
||||
SUBDIR += rw
|
||||
SUBDIR += rw-tui
|
||||
SUBDIR += s-tui
|
||||
SUBDIR += s6
|
||||
SUBDIR += s6-rc
|
||||
|
||||
26
sysutils/rw-tui/Makefile
Normal file
26
sysutils/rw-tui/Makefile
Normal file
@@ -0,0 +1,26 @@
|
||||
PORTNAME= rw-tui
|
||||
DISTVERSIONPREFIX= v
|
||||
DISTVERSION= 1.0.0-1
|
||||
DISTVERSIONSUFFIX= -gfd62cef
|
||||
CATEGORIES= sysutils
|
||||
|
||||
MAINTAINER= yuri@FreeBSD.org
|
||||
COMMENT= Read & Write Everything (only memory for now on FreeBSD)
|
||||
WWW= https://github.com/LeeKyuHyuk/rw-tui
|
||||
|
||||
LICENSE= MIT
|
||||
LICENSE_FILE= ${WRKSRC}/LICENSE
|
||||
|
||||
LIB_DEPENDS= libftxui-screen.so:devel/ftxui
|
||||
|
||||
USES= cmake #localbase:ldflags
|
||||
|
||||
USE_GITHUB= yes
|
||||
GH_ACCOUNT= LeeKyuHyuk
|
||||
|
||||
PLIST_FILES= bin/${PORTNAME}
|
||||
|
||||
do-install:
|
||||
${INSTALL_PROGRAM} ${BUILD_WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
|
||||
|
||||
.include <bsd.port.mk>
|
||||
3
sysutils/rw-tui/distinfo
Normal file
3
sysutils/rw-tui/distinfo
Normal file
@@ -0,0 +1,3 @@
|
||||
TIMESTAMP = 1718043067
|
||||
SHA256 (LeeKyuHyuk-rw-tui-v1.0.0-1-gfd62cef_GH0.tar.gz) = 920ce14c2d4932277fac1a97906cdd731953a7eaeb30f99a6d0c4254cbedfbd1
|
||||
SIZE (LeeKyuHyuk-rw-tui-v1.0.0-1-gfd62cef_GH0.tar.gz) = 2005010
|
||||
16
sysutils/rw-tui/files/patch-CMakeLists.txt
Normal file
16
sysutils/rw-tui/files/patch-CMakeLists.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
--- CMakeLists.txt.orig 2023-07-30 15:32:56 UTC
|
||||
+++ CMakeLists.txt
|
||||
@@ -14,11 +14,10 @@ set_property(TARGET rw-tui PROPERTY CXX_STANDARD 17)
|
||||
|
||||
set_property(TARGET rw-tui PROPERTY CXX_STANDARD 17)
|
||||
|
||||
-add_subdirectory(${CMAKE_SOURCE_DIR}/lib/ftxui ${CMAKE_BINARY_DIR}/ftxui EXCLUDE_FROM_ALL)
|
||||
+find_package(ftxui REQUIRED)
|
||||
|
||||
target_link_libraries(rw-tui
|
||||
PRIVATE ftxui::screen
|
||||
PRIVATE ftxui::dom
|
||||
PRIVATE ftxui::component
|
||||
- -static
|
||||
)
|
||||
\ No newline at end of file
|
||||
21
sysutils/rw-tui/files/patch-src_dataview.cpp
Normal file
21
sysutils/rw-tui/files/patch-src_dataview.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
--- src/dataview.cpp.orig 2023-07-30 15:32:56 UTC
|
||||
+++ src/dataview.cpp
|
||||
@@ -5,6 +5,9 @@
|
||||
#include "global.hpp"
|
||||
#include "utils/hex_string.hpp"
|
||||
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+
|
||||
DataView::DataView(uint64_t address) {
|
||||
mContainer = Container::Vertical({});
|
||||
mAddress = address;
|
||||
@@ -25,7 +28,7 @@ void DataView::refresh() {
|
||||
void DataView::refresh() {
|
||||
void *mapBase, *virtAddress;
|
||||
mContainer->DetachAllChildren();
|
||||
- mapBase = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
|
||||
+ mapBase = mmap(0, getpagesize(), PROT_READ | PROT_WRITE, MAP_SHARED,
|
||||
*gFileDescriptor, mAddress & ~MAP_MASK);
|
||||
if (mapBase == (void *)-1)
|
||||
FATAL;
|
||||
72
sysutils/rw-tui/files/patch-src_main.cpp
Normal file
72
sysutils/rw-tui/files/patch-src_main.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
--- src/main.cpp.orig 2023-07-30 15:32:56 UTC
|
||||
+++ src/main.cpp
|
||||
@@ -25,7 +25,13 @@
|
||||
#include "utils/is_file_exist.hpp"
|
||||
|
||||
#define DEV_MEM "/dev/mem"
|
||||
-#define DEV_FMEM "/dev/fmem"
|
||||
+#if defined(__linux__)
|
||||
+# define DEV_FMEM "/dev/fmem"
|
||||
+#elif defined(__FreeBSD__)
|
||||
+# define DEV_KMEM "/dev/kmem"
|
||||
+#else
|
||||
+# error "Unsupported OS"
|
||||
+#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace ftxui;
|
||||
@@ -71,6 +77,7 @@ int main(int argc, char *argv[]) {
|
||||
gShowMessageModal = &showMessageModal;
|
||||
gMessageStr = &messageStr;
|
||||
|
||||
+#if defined(__linux__)
|
||||
if (isFileExist(DEV_FMEM) == false) {
|
||||
if (isFileExist(DEV_MEM) == false) {
|
||||
cerr << "[ERROR] Neither /dev/mem nor /dev/fmem exist.\nGet the source "
|
||||
@@ -90,9 +97,21 @@ int main(int argc, char *argv[]) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
+#elif defined(__FreeBSD__)
|
||||
+ if (isFileExist(DEV_MEM) == false /*|| isFileExist(DEV_KMEM) == false*/) {
|
||||
+ cerr << "[ERROR] Either /dev/mem or /dev/kmem doesn't exist.\n"
|
||||
+ "Please check if the kernel was configured with 'device mem'."
|
||||
+ << endl;
|
||||
+ return EXIT_FAILURE;
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
int fileDescriptor;
|
||||
+#if defined(__linux__)
|
||||
if ((fileDescriptor = open(DEV_FMEM, O_RDWR | O_SYNC)) == -1)
|
||||
+#elif defined(__FreeBSD__)
|
||||
+ if ((fileDescriptor = open(DEV_MEM, O_RDWR | O_SYNC)) == -1)
|
||||
+#endif
|
||||
FATAL;
|
||||
gFileDescriptor = &fileDescriptor;
|
||||
|
||||
@@ -102,7 +121,7 @@ int main(int argc, char *argv[]) {
|
||||
int tabSelected = 0;
|
||||
vector<string> tabValues{
|
||||
" Memory ",
|
||||
- " PCI ",
|
||||
+ //" PCI ",
|
||||
};
|
||||
auto tabToggle =
|
||||
Menu(&tabValues, &tabSelected, MenuOption::Horizontal()) | border;
|
||||
@@ -110,7 +129,7 @@ int main(int argc, char *argv[]) {
|
||||
Component tabContainer = Container::Tab(
|
||||
{
|
||||
(new Memory(0x00000000))->getComponent(),
|
||||
- (new PCI(*gBaseAddress))->getComponent(),
|
||||
+ //(new PCI(*gBaseAddress))->getComponent(),
|
||||
},
|
||||
&tabSelected);
|
||||
|
||||
@@ -140,4 +159,4 @@ int main(int argc, char *argv[]) {
|
||||
center);
|
||||
close(fileDescriptor);
|
||||
return EXIT_SUCCESS;
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
1
sysutils/rw-tui/pkg-descr
Normal file
1
sysutils/rw-tui/pkg-descr
Normal file
@@ -0,0 +1 @@
|
||||
rgb-tui is a color picker with a terminal UI.
|
||||
Reference in New Issue
Block a user