diff --git a/config/redbear-desktop.toml b/config/redbear-desktop.toml index fdce13ec..3c7c03f4 100644 --- a/config/redbear-desktop.toml +++ b/config/redbear-desktop.toml @@ -12,3 +12,6 @@ filesystem_size = 10240 [packages] # Red Bear OS branding (os-release, hostname, motd) redbear-release = {} + +# Terminal file manager (Midnight Commander port) +mc = {} diff --git a/config/redbear-full.toml b/config/redbear-full.toml index 70cd566c..9f75792e 100644 --- a/config/redbear-full.toml +++ b/config/redbear-full.toml @@ -17,6 +17,9 @@ filesystem_size = 2048 # Red Bear OS branding (os-release, hostname, motd) redbear-release = {} +# Terminal file manager (Midnight Commander port) +mc = {} + # ext4 filesystem support (our custom port) ext4d = {} diff --git a/config/redbear-minimal.toml b/config/redbear-minimal.toml index c0091fba..5f1fda62 100644 --- a/config/redbear-minimal.toml +++ b/config/redbear-minimal.toml @@ -12,6 +12,9 @@ filesystem_size = 512 # Red Bear OS branding redbear-release = {} +# Terminal file manager +mc = {} + # Firmware loading firmware-loader = {} diff --git a/local/recipes/tui/mc/recipe.toml b/local/recipes/tui/mc/recipe.toml new file mode 100644 index 00000000..6e565252 --- /dev/null +++ b/local/recipes/tui/mc/recipe.toml @@ -0,0 +1,44 @@ +[source] +tar = "https://ftp.osuosl.org/pub/midnightcommander/mc-4.8.33.tar.xz" +patches = ["redox.patch"] + +[build] +template = "custom" +dependencies = [ + "glib", + "ncursesw", +] +script = """ +DYNAMIC_INIT + +# Set pkg-config and include paths for glib +export GLIB_CFLAGS="-I${COOKBOOK_SYSROOT}/usr/include/glib-2.0 -I${COOKBOOK_SYSROOT}/usr/lib/glib-2.0/include" +export GLIB_LIBS="-lglib-2.0 -lgobject-2.0" +export CFLAGS="${CFLAGS} -I${COOKBOOK_SYSROOT}/usr/include ${GLIB_CFLAGS}" +export LIBS="${LIBS} -lintl" + +# Tell configure about sysroot headers. MC's ncurses probe resets CPPFLAGS from CFLAGS. +export CPPFLAGS="-I${COOKBOOK_SYSROOT}/usr/include ${GLIB_CFLAGS}" + +# Redox lacks PTY and resolver interfaces expected by optional MC features. +export ac_cv_func_posix_openpt=no +export ac_cv_func_getpt=no +export ac_cv_func_grantpt=no +export ac_cv_func_unlockpt=no +export ac_cv_func_ptsname=no +export ac_cv_func_openpty=no +export ac_cv_header_arpa_nameser_h=no +export ac_cv_header_resolv_h=no + +# Configure with minimal features for initial port +COOKBOOK_CONFIGURE_FLAGS+=( + --without-x + --without-gpm-mouse + --without-subshell + --disable-vfs-sftp + --disable-vfs-ftp + --with-screen=ncurses +) + +cookbook_configure +""" diff --git a/local/recipes/tui/mc/redox.patch b/local/recipes/tui/mc/redox.patch new file mode 100644 index 00000000..de3dc8dd --- /dev/null +++ b/local/recipes/tui/mc/redox.patch @@ -0,0 +1,67 @@ +diff --git a/src/subshell/common.c b/src/subshell/common.c +--- a/src/subshell/common.c ++++ b/src/subshell/common.c +@@ -95,6 +95,45 @@ + #endif + #endif + ++#ifdef __redox__ ++static int ++mc_posix_openpt (int flags) ++{ ++ (void) flags; ++ errno = ENOSYS; ++ return -1; ++} ++ ++static int ++mc_grantpt (int fd) ++{ ++ (void) fd; ++ errno = ENOSYS; ++ return -1; ++} ++ ++static int ++mc_unlockpt (int fd) ++{ ++ (void) fd; ++ errno = ENOSYS; ++ return -1; ++} ++ ++static char * ++mc_ptsname (int fd) ++{ ++ (void) fd; ++ errno = ENOSYS; ++ return NULL; ++} ++ ++#define posix_openpt mc_posix_openpt ++#define grantpt mc_grantpt ++#define unlockpt mc_unlockpt ++#define ptsname mc_ptsname ++#endif ++ + #include "lib/global.h" + + #include "lib/fileloc.h" +diff --git a/configure b/configure +--- a/configure ++++ b/configure +@@ -24408,10 +24408,10 @@ + fi + + if test -z "$ac_list_mounted_fs"; then +- as_fn_error $? "could not determine how to read list of mounted file systems" "$LINENO" 5 +- # FIXME -- no need to abort building the whole package +- # Can't build mountlist.c or anything that needs its functions ++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: could not determine how to read list of mounted file systems" >&5 ++printf "%s\n" "$as_me: WARNING: could not determine how to read list of mounted file systems" >&2; } ++ ac_list_mounted_fs=missing + fi + + if test $ac_list_mounted_fs = found; then + gl_cv_list_mounted_fs=yes + diff --git a/recipes/tui/mc b/recipes/tui/mc new file mode 120000 index 00000000..49b52c73 --- /dev/null +++ b/recipes/tui/mc @@ -0,0 +1 @@ +../../local/recipes/tui/mc \ No newline at end of file