From a0709b517a5c3ac5b586017a1116319580bef0da Mon Sep 17 00:00:00 2001
From: Chris Roberts <cpr420@gmail.com>
Date: Wed, 9 Oct 2013 16:04:04 -0600
Subject: Enhance Haiku support by tweaking paths and defining a HAIKU
 variable.


diff --git a/slsh/slsh.c b/slsh/slsh.c
index 9745543..18a599e 100644
--- a/slsh/slsh.c
+++ b/slsh/slsh.c
@@ -26,6 +26,10 @@ USA.
 # include <windows.h>
 # include <io.h>
 #endif
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <fs_info.h>
+#endif
 
 #include <sys/stat.h>
 
@@ -52,7 +56,11 @@ static char *Slsh_Version = "0.8.6-0";
 # define SLSH_LIB_DIR_ENV "SLSH_LIB_DIR"
 #endif
 
-#if defined(REAL_UNIX_SYSTEM) || defined(__APPLE__)
+#if defined(__HAIKU__)
+/* # define DEFAULT_LIBRARY_PATH "/usr/local/share/slsh:/usr/local/lib/slsh:/usr/share/slsh:/usr/lib/slsh"; */
+# define DEFAULT_CONF_PATH "/boot/system/settings:/boot/home/config/settings";
+# define USER_SLSHRC "slsh.rc"
+#elif defined(REAL_UNIX_SYSTEM) || defined(__APPLE__)
 /* # define DEFAULT_LIBRARY_PATH "/usr/local/share/slsh:/usr/local/lib/slsh:/usr/share/slsh:/usr/lib/slsh"; */
 # define DEFAULT_CONF_PATH "/usr/local/etc:/usr/local/etc/slsh:/etc:/etc/slsh";
 # define USER_SLSHRC ".slshrc"
@@ -494,6 +502,9 @@ int main (int argc, char **argv)
    int test_mode = 0;
    char *exec_string = NULL;
    int quiet = 0;
+#if defined(__HAIKU__)
+   char buffer[B_PATH_NAME_LENGTH+B_FILE_NAME_LENGTH];
+#endif
 
    (void) SLutf8_enable (-1);
 
@@ -512,8 +523,13 @@ int main (int argc, char **argv)
 #endif
 
    /* FIXME for other systems */
-#ifdef __WIN32__
+#if defined(__WIN32__)
    init_file_dir = getenv ("USERPROFILE");
+#elif defined(__HAIKU__)
+   if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, buffer, sizeof(buffer)) != B_OK)
+     sprintf(buffer, "/boot/home/config/settings");
+
+   init_file_dir = &buffer;
 #else
    init_file_dir = getenv ("HOME");
 #endif
diff --git a/src/slstd.c b/src/slstd.c
index d86765e..f80295e 100644
--- a/src/slstd.c
+++ b/src/slstd.c
@@ -1279,6 +1279,9 @@ int SLang_init_slang (void) /*{{{*/
 #ifdef REAL_UNIX_SYSTEM
 	"UNIX",
 #endif
+#if defined(__HAIKU__)
+	"HAIKU",
+#endif
 #if SLANG_HAS_FLOAT
 	"SLANG_DOUBLE_TYPE",
 #endif
-- 
2.7.0


From 7dae865b7917ae55df3c62b1792b3096878d4c1c Mon Sep 17 00:00:00 2001
From: Chris Roberts <cpr420@gmail.com>
Date: Fri, 11 Oct 2013 00:32:22 -0600
Subject: Change location of some install paths


diff --git a/modules/Makefile.in b/modules/Makefile.in
index 0384359..9d84c93 100644
--- a/modules/Makefile.in
+++ b/modules/Makefile.in
@@ -63,7 +63,7 @@ INSTALL		= @INSTALL@
 INSTALL_DATA	= @INSTALL_DATA@
 INSTALL_MODULE	= @INSTALL_MODULE@
 MKINSDIR	= $(CONFIG_DIR)/autoconf/mkinsdir.sh
-SLSH_DIR	= $(prefix)/share/slsh
+SLSH_DIR	= @datarootdir@/slsh
 CMAPS_DIR	= $(SLSH_DIR)/cmaps
 HELP_DIR	= $(SLSH_DIR)/help
 #---------------------------------------------------------------------------
diff --git a/slsh/Makefile.in b/slsh/Makefile.in
index b71b9bc..be16ada 100644
--- a/slsh/Makefile.in
+++ b/slsh/Makefile.in
@@ -30,7 +30,7 @@ MKINSDIR	= $(CONFIG_DIR)/autoconf/mkinsdir.sh
 SLSH_CONF_DIR	= @sysconfdir@
 SLSH_LIB_DIR	= $(datarootdir)/slsh
 SLSH_HELP_DIR	= $(SLSH_LIB_DIR)/help
-SLSH_DOC_DIR	= $(datarootdir)/doc/slsh
+SLSH_DOC_DIR	= @docdir@/slsh
 SLSH_LOCALLIB_DIR = $(SLSH_LIB_DIR)/local-packages
 SLSH_SCRIPT_DIR	= $(SLSH_LIB_DIR)/scripts
 SCRIPTS		= jpegsize lsrpm sldb svnsh slprof slstkchk
diff --git a/src/Makefile.in b/src/Makefile.in
index 03fa056..fab1477 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -45,7 +45,7 @@ exec_prefix = @exec_prefix@
 install_lib_dir = @libdir@
 install_bin_dir = @bindir@
 install_include_dir = @includedir@
-install_doc_dir = $(prefix)/share/doc/slang/v@slang_major_version@
+install_doc_dir = @docdir@/slang/v@slang_major_version@
 DOC_FILES = ../changes.txt ../COPY* ../doc/slangdoc.html ../doc/text/*.txt
 MODULE_INSTALL_DIR = @libdir@/slang/v@slang_major_version@/modules
 #---------------------------------------------------------------------------
-- 
2.7.0


From ba3be9eed7ff3d68889bd874890fbf5390fdd23d Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Fri, 24 Mar 2017 11:59:23 +0000
Subject: update the check for ncurses to version6


diff --git a/configure b/configure
index f1586c3..945e06f 100755
--- a/configure
+++ b/configure
@@ -6702,16 +6702,16 @@ _ACEOF
 
 
 
-# Extract the first word of "ncurses5-config", so it can be a program name with args.
-set dummy ncurses5-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+# Extract the first word of "ncurses6-config", so it can be a program name with args.
+set dummy ncurses6-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&6
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_nc5config+set}" = set; then :
+if test "${ac_cv_path_nc6config+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  case $nc5config in
+  case $nc6config in
   [\\/]* | ?:[\\/]*)
-  ac_cv_path_nc5config="$nc5config" # Let the user override the test with a path.
+  ac_cv_path_nc5config="$nc6config" # Let the user override the test with a path.
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -6721,40 +6721,40 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_nc5config="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_path_nc6config="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&6
     break 2
   fi
 done
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_path_nc5config" && ac_cv_path_nc5config="no"
+  test -z "$ac_cv_path_nc6config" && ac_cv_path_nc6config="no"
   ;;
 esac
 fi
-nc5config=$ac_cv_path_nc5config
-if test -n "$nc5config"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $nc5config" >&5
-$as_echo "$nc5config" >&6; }
+nc6config=$ac_cv_path_nc6config
+if test -n "$nc6config"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $nc6config" >&6
+$as_echo "$nc6config" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&6
 $as_echo "no" >&6; }
 fi
 
 
-if test "$nc5config" = "no"
+if test "$nc6config" = "no"
 then
-  # Extract the first word of "ncurses5w-config", so it can be a program name with args.
-set dummy ncurses5w-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+  # Extract the first word of "ncursesw6-config", so it can be a program name with args.
+set dummy ncursesw6-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&6
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_nc5config+set}" = set; then :
+if test "${ac_cv_path_nc6config+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  case $nc5config in
+  case $nc6config in
   [\\/]* | ?:[\\/]*)
-  ac_cv_path_nc5config="$nc5config" # Let the user override the test with a path.
+  ac_cv_path_nc5config="$nc6config" # Let the user override the test with a path.
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -6764,24 +6764,24 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_nc5config="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_path_nc6config="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&6
     break 2
   fi
 done
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_path_nc5config" && ac_cv_path_nc5config="no"
+  test -z "$ac_cv_path_nc6config" && ac_cv_path_nc6config="no"
   ;;
 esac
 fi
-nc5config=$ac_cv_path_nc5config
-if test -n "$nc5config"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $nc5config" >&5
-$as_echo "$nc5config" >&6; }
+nc6config=$ac_cv_path_nc6config
+if test -n "$nc6config"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $nc6config" >&6
+$as_echo "$nc6config" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&6
 $as_echo "no" >&6; }
 fi
 
@@ -6789,9 +6789,9 @@ fi
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for terminfo" >&5
 $as_echo_n "checking for terminfo... " >&6; }
-if test "$nc5config" != "no"
+if test "$nc6config" != "no"
 then
-   MISC_TERMINFO_DIRS=`$nc5config --terminfo`
+   MISC_TERMINFO_DIRS=`$nc6config --terminfo`
 else
    MISC_TERMINFO_DIRS=""
 fi
@@ -6800,20 +6800,20 @@ JD_Terminfo_Dirs="$MISC_TERMINFO_DIRS \
                   /usr/share/terminfo \
                   /usr/share/lib/terminfo \
 		  /usr/local/lib/terminfo"
-TERMCAP=-ltermcap
+TERMCAP=-lncurses
 
 for terminfo_dir in $JD_Terminfo_Dirs
 do
    if test -d $terminfo_dir
    then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&6
 $as_echo "yes" >&6; }
       TERMCAP=""
       break
    fi
 done
 if test "$TERMCAP"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&6
 $as_echo "no" >&6; }
 
 $as_echo "#define USE_TERMCAP 1" >>confdefs.h
-- 
2.7.0

