diff --git a/sysutils/rw-tui/Makefile b/sysutils/rw-tui/Makefile index eb60676d76db..5ea2ffa4a24c 100644 --- a/sysutils/rw-tui/Makefile +++ b/sysutils/rw-tui/Makefile @@ -1,26 +1,27 @@ PORTNAME= rw-tui DISTVERSIONPREFIX= v DISTVERSION= 1.0.0-1 +PORTREVISION= 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 diff --git a/sysutils/rw-tui/files/patch-src_main.cpp b/sysutils/rw-tui/files/patch-src_main.cpp index f303ecfd92f3..558765a75b06 100644 --- a/sysutils/rw-tui/files/patch-src_main.cpp +++ b/sysutils/rw-tui/files/patch-src_main.cpp @@ -1,72 +1,82 @@ --- src/main.cpp.orig 2023-07-30 15:32:56 UTC +++ src/main.cpp -@@ -25,7 +25,13 @@ +@@ -5,6 +5,9 @@ + #include + #include + ++#include ++using namespace std; ++ + #include "ftxui/component/captured_mouse.hpp" + #include "ftxui/component/component.hpp" + #include "ftxui/component/component_base.hpp" +@@ -25,7 +28,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[]) { +@@ -71,6 +80,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[]) { +@@ -90,9 +100,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[]) { +@@ -102,7 +124,7 @@ int main(int argc, char *argv[]) { int tabSelected = 0; vector tabValues{ " Memory ", - " PCI ", + //" PCI ", }; auto tabToggle = Menu(&tabValues, &tabSelected, MenuOption::Horizontal()) | border; -@@ -110,7 +129,7 @@ int main(int argc, char *argv[]) { +@@ -110,7 +132,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[]) { +@@ -140,4 +162,4 @@ int main(int argc, char *argv[]) { center); close(fileDescriptor); return EXIT_SUCCESS; -} \ No newline at end of file +}