kbuild: update to latest revision (#3996)

This commit is contained in:
Simon South
2019-07-15 19:44:33 -04:00
committed by waddlesplash
parent 96e6239d2a
commit 61b8c3375f
4 changed files with 824 additions and 92 deletions

View File

@@ -1,92 +0,0 @@
SUMMARY="A makefile framework for writing simple makefiles for complex tasks"
DESCRIPTION="The goals of the kBuild framework:
Similar behavior cross all supported platforms.
Flexibility, don't create unnecessary restrictions preventing ad-hoc solutions.
Makefile can very simple to write and maintain.
There are four concepts being tried out in the current kBuild incaration:
One configuration file for a subtree automatically included.
Target configuration templates as the primary mechanism for makefile \n
simplification.
Tools and SDKs for helping out the templates with flexibility.
Non-recursive makefile method by using sub-makefiles."
HOMEPAGE="https://trac.netlabs.org/kbuild/"
COPYRIGHT="kBuild developers"
LICENSE="GNU LGPL v3"
REVISION="2"
srcGitRev="96a1801b3d446bfc80aab1ed1cb9b704d5d3dfbb"
SOURCE_URI="https://anonscm.debian.org/cgit/pkg-virtualbox/kbuild.git/snapshot/kbuild-$srcGitRev.tar.gz"
CHECKSUM_SHA256="575734d3f6540feda3cb2b4e447009af8e6b76ef081157d139df13f62bfe6e3c"
SOURCE_DIR="kbuild-$srcGitRev"
ARCHITECTURES="?x86_gcc2 ?x86 x86_64"
SECONDARY_ARCHITECTURES="?x86"
PROVIDES="
kbuild$secondaryArchSuffix = $portVersion
cmd:kDepIDB = $portVersion
cmd:kDepPre = $portVersion
cmd:kDepObj = $portVersion
cmd:kmk = $portVersion
cmd:kmk_append = $portVersion
cmd:kmk_ash = $portVersion
cmd:kmk_cat = $portVersion
cmd:kmk_chmod = $portVersion
cmd:kmk_cmp = $portVersion
cmd:kmk_cp = $portVersion
cmd:kmk_echo = $portVersion
cmd:kmk_expr = $portVersion
cmd:kmk_gmake = $portVersion
cmd:kmk_install = $portVersion
cmd:kmk_ln = $portVersion
cmd:kmk_md5sum = $portVersion
cmd:kmk_mkdir = $portVersion
cmd:kmk_mv = $portVersion
cmd:kmk_printf = $portVersion
cmd:kmk_redirect = $portVersion
cmd:kmk_rm = $portVersion
cmd:kmk_rmdir = $portVersion
cmd:kmk_sed = $portVersion
cmd:kmk_sleep = $portVersion
cmd:kmk_test = $portVersion
cmd:kmk_time = $portVersion
cmd:kObjCache = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:aclocal
cmd:autopoint
cmd:autoreconf
cmd:find
cmd:flex
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:makeinfo
cmd:tar
cmd:yacc
"
archpath=x86
if [ "$targetArchitecture" = x86_64 ]; then
archpath=amd64
fi
BUILD()
{
kBuild/env.sh --full make $jobArgs -f bootstrap.gmk
}
INSTALL()
{
mkdir -p $binDir $dataDir/kBuild
cp -R kBuild/bin/haiku.${archpath}/* $binDir
cp -R kBuild/{tools,units,*.kmk} $dataDir/kBuild
}

View File

@@ -0,0 +1,127 @@
SUMMARY="A makefile framework for writing simple makefiles for complex tasks"
DESCRIPTION="kBuild is a build framework derived from GNU make that delivers \
power and flexibility using makefiles that are easy to write and maintain. \
Its features include a template mechanism that simplifies configuration and \
a set of supporting tools that provide consistent behavior across multiple \
platforms."
HOMEPAGE="https://trac.netlabs.org/kbuild/"
COPYRIGHT="2005-2018 Knut St. Osmundsen"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://salsa.debian.org/pkg-virtualbox-team/kbuild/-/archive/upstream/0.1.9998svn3296+dfsg/kbuild-upstream-0.1.9998svn3296+dfsg.tar.bz2"
CHECKSUM_SHA256="30c025d076f561984932801c143d57e833386f6e96bf244d57d0f9074e59f683"
SOURCE_DIR="kbuild-upstream-0.1.9998svn3296+dfsg"
PATCHES="
kbuild-0.1.9998svn3296-distribution.patch
kbuild-0.1.9998svn3296-haiku.patch
"
ARCHITECTURES="!x86_gcc2 x86 x86_64"
if [ "$targetArchitecture" = x86_gcc2 ]; then
SECONDARY_ARCHITECTURES="x86"
fi
PROVIDES="
kbuild$secondaryArchSuffix = $portVersion
cmd:kDepIDB$secondaryArchSuffix = $portVersion
cmd:kDepObj$secondaryArchSuffix = $portVersion
cmd:kDepPre$secondaryArchSuffix = $portVersion
cmd:kmk$secondaryArchSuffix = $portVersion
cmd:kmk_append$secondaryArchSuffix = $portVersion
cmd:kmk_ash$secondaryArchSuffix = $portVersion
cmd:kmk_cat$secondaryArchSuffix = $portVersion
cmd:kmk_chmod$secondaryArchSuffix = $portVersion
cmd:kmk_cmp$secondaryArchSuffix = $portVersion
cmd:kmk_cp$secondaryArchSuffix = $portVersion
cmd:kmk_echo$secondaryArchSuffix = $portVersion
cmd:kmk_expr$secondaryArchSuffix = $portVersion
cmd:kmk_gmake$secondaryArchSuffix = $portVersion
cmd:kmk_install$secondaryArchSuffix = $portVersion
cmd:kmk_ln$secondaryArchSuffix = $portVersion
cmd:kmk_md5sum$secondaryArchSuffix = $portVersion
cmd:kmk_mkdir$secondaryArchSuffix = $portVersion
cmd:kmk_mv$secondaryArchSuffix = $portVersion
cmd:kmk_printf$secondaryArchSuffix = $portVersion
cmd:kmk_redirect$secondaryArchSuffix = $portVersion
cmd:kmk_rm$secondaryArchSuffix = $portVersion
cmd:kmk_rmdir$secondaryArchSuffix = $portVersion
cmd:kmk_sed$secondaryArchSuffix = $portVersion
cmd:kmk_sleep$secondaryArchSuffix = $portVersion
cmd:kmk_test$secondaryArchSuffix = $portVersion
cmd:kmk_time$secondaryArchSuffix = $portVersion
cmd:kmk_touch$secondaryArchSuffix = $portVersion
cmd:kObjCache$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:aclocal
cmd:autopoint
cmd:autoreconf
cmd:find
cmd:flex
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:makeinfo
cmd:yacc
"
defineDebugInfoPackage kbuild$secondaryArchSuffix \
$binDir/kDepIDB \
$binDir/kDepObj \
$binDir/kDepPre \
$binDir/kmk \
$binDir/kmk_append \
$binDir/kmk_ash \
$binDir/kmk_cat \
$binDir/kmk_chmod \
$binDir/kmk_cmp \
$binDir/kmk_cp \
$binDir/kmk_echo \
$binDir/kmk_expr \
$binDir/kmk_gmake \
$binDir/kmk_install \
$binDir/kmk_ln \
$binDir/kmk_md5sum \
$binDir/kmk_mkdir \
$binDir/kmk_mv \
$binDir/kmk_printf \
$binDir/kmk_redirect \
$binDir/kmk_rm \
$binDir/kmk_rmdir \
$binDir/kmk_sed \
$binDir/kmk_sleep \
$binDir/kmk_test \
$binDir/kmk_time \
$binDir/kmk_touch \
$binDir/kObjCache
# Map our target architecture's name to the corresponding name used by kBuild
case $targetArchitecture in
x86_gcc2) kbuildArch=x86;;
x86_64) kbuildArch=amd64;;
*) kbuildArch=$targetArchitecture;;
esac
BUILD()
{
kBuild/env.sh --full make $jobArgs -f bootstrap.gmk
}
INSTALL()
{
mkdir -p $binDir $dataDir/kBuild $dataDir/profile.d
cp -R kBuild/bin/haiku.${kbuildArch}/* $binDir
cp -R kBuild/{tools,units,*.kmk} $dataDir/kBuild
kbuildProfile=$dataDir/profile.d/kbuild.sh
echo "export KBUILD_PATH=$dataDir/kBuild" > $kbuildProfile
echo "export KBUILD_BIN_PATH=$binDir" >> $kbuildProfile
}

View File

@@ -0,0 +1,21 @@
diff --git a/SvnInfo.kmk b/SvnInfo.kmk
new file mode 100644
index 0000000..23713f6
--- /dev/null
+++ b/SvnInfo.kmk
@@ -0,0 +1,2 @@
+KBUILD_SVN_URL := http://svn.netlabs.org/repos/kbuild/trunk
+KBUILD_SVN_REV := 3296
diff --git a/src/kmk/doc/Makefile.am b/src/kmk/doc/Makefile.am
index 11aa4d4..caf8951 100644
--- a/src/kmk/doc/Makefile.am
+++ b/src/kmk/doc/Makefile.am
@@ -18,7 +18,7 @@
TEXI2HTML = texi2html
TEXI2HTML_FLAGS = -split_chapter
-info_TEXINFOS = make.texi
+#info_TEXINFOS = make.texi
make_TEXINFOS = fdl.texi make-stds.texi
CLEANFILES = make*.html

View File

@@ -0,0 +1,676 @@
diff --git a/src/kmk/Makefile.am b/src/kmk/Makefile.am
index ca8acb1..a9c96c8 100644
--- a/src/kmk/Makefile.am
+++ b/src/kmk/Makefile.am
@@ -98,6 +98,9 @@ kmk_SOURCES = ar.c arscan.c commands.c default.c dir.c expand.c file.c \
kmkbuiltin/osdep.c \
kmkbuiltin/kbuild_protection.c \
kmkbuiltin/common-env-and-cwd-opt.c
+if HAIKUENV
+ kmk_CFLAGS = -D_BSD_SOURCE
+endif
kmk_redirect_SOURCES = kmkbuiltin/redirect.c \
kmkbuiltin/common-env-and-cwd-opt.c \
@@ -113,6 +116,9 @@ noinst_HEADERS = commands.h dep.h filedef.h job.h makeint.h rule.h variable.h \
#kmk_LDADD = @LIBOBJS@ @ALLOCA@ $(GLOBLIB) @GETLOADAVG_LIBS@ @LIBINTL@
kmk_LDADD = @LIBOBJS@ @ALLOCA@ $(GLOBLIB) @GETLOADAVG_LIBS@ \
$(GUILE_LIBS)
+if HAIKUENV
+ kmk_LDADD += -lbsd
+endif
# Only process if target is MS-Windows
if WINDOWSENV
kmk_LDADD += $(W32LIB)
diff --git a/src/kmk/Makefile.kmk b/src/kmk/Makefile.kmk
index 44e86e7..2405310 100644
--- a/src/kmk/Makefile.kmk
+++ b/src/kmk/Makefile.kmk
@@ -61,6 +61,10 @@ ifneq ($(KBUILD_TARGET),os2)
TEMPLATE_BIN-KMK_INCS += glob
endif
TEMPLATE_BIN-KMK_LIBS = $(LIB_KUTIL) $(TEMPLATE_BIN-THREADED_LIBS) $(kmkmissing_1_TARGET) $(LIB_KUTIL)
+ifeq ($(KBUILD_TARGET),haiku)
+ TEMPLATE_BIN-KMK_DEFS += _BSD_SOURCE
+ TEMPLATE_BIN-KMK_LIBS += bsd
+endif
ifdef ELECTRIC_HEAP # for electric heap (see electric.c).
ifeq ($(KBUILD_TARGET),win)
TEMPLATE_BIN-KMK_CFLAGS = $(TEMPLATE_BIN-THREADED_CFLAGS) /FI$(kmk_DEFPATH)/electric.h -DELECTRIC_HEAP=1
diff --git a/src/kmk/config.h.haiku b/src/kmk/config.h.haiku
index 3580374..7c79b6f 100644
--- a/src/kmk/config.h.haiku
+++ b/src/kmk/config.h.haiku
@@ -1,5 +1,5 @@
/* config.h. Generated from config.h.in by configure. */
-/* config.h.in. Generated from configure.in by autoheader. */
+/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if the `closedir' function returns void instead of `int'. */
/* #undef CLOSEDIR_VOID */
@@ -32,9 +32,6 @@
*/
#define HAVE_ALLOCA_H 1
-/* Define to 1 if your compiler conforms to the ANSI C standard. */
-#define HAVE_ANSI_COMPILER 1
-
/* Define to 1 if you have the `atexit' function. */
#define HAVE_ATEXIT 1
@@ -48,6 +45,18 @@
don't. */
#define HAVE_DECL_BSD_SIGNAL 0
+/* Define to 1 if you have the declaration of `dlerror', and to 0 if you
+ don't. */
+#define HAVE_DECL_DLERROR 1
+
+/* Define to 1 if you have the declaration of `dlopen', and to 0 if you don't.
+ */
+#define HAVE_DECL_DLOPEN 1
+
+/* Define to 1 if you have the declaration of `dlsym', and to 0 if you don't.
+ */
+#define HAVE_DECL_DLSYM 1
+
/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
don't. */
#define HAVE_DECL_SYS_SIGLIST 1
@@ -64,12 +73,12 @@
*/
#define HAVE_DIRENT_H 1
-/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
-/* #undef HAVE_DOPRNT */
-
/* Use platform specific coding */
/* #undef HAVE_DOS_PATHS */
+/* Define to 1 if you have the `dup' function. */
+#define HAVE_DUP 1
+
/* Define to 1 if you have the `dup2' function. */
#define HAVE_DUP2 1
@@ -109,6 +118,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
+/* Define to 1 if you have the `isatty' function. */
+#define HAVE_ISATTY 1
+
/* Define to 1 if you have the `dgc' library (-ldgc). */
/* #undef HAVE_LIBDGC */
@@ -145,6 +157,9 @@
/* Define to 1 if you have the `pipe' function. */
#define HAVE_PIPE 1
+/* Define to 1 if you have the `pselect' function. */
+#define HAVE_PSELECT 1
+
/* Define to 1 if you have the `pstat_getdynamic' function. */
/* #undef HAVE_PSTAT_GETDYNAMIC */
@@ -190,9 +205,6 @@
/* Define to 1 if you have the `socket' function. */
/* #undef HAVE_SOCKET */
-/* Define to 1 if you have the <stdarg.h> header file. */
-#define HAVE_STDARG_H 1
-
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
@@ -256,6 +268,9 @@
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
@@ -271,14 +286,20 @@
/* Define to 1 if you have the <sys/wait.h> header file. */
#define HAVE_SYS_WAIT_H 1
-/* Define to 1 if you have the \`union wait' type in <sys/wait.h>. */
+/* Define to 1 if you have the `ttyname' function. */
+#define HAVE_TTYNAME 1
+
+/* Define to 1 if the system has the type `uintmax_t'. */
+#define HAVE_UINTMAX_T 1
+
+/* Define to 1 if you have the 'union wait' type in <sys/wait.h>. */
/* #undef HAVE_UNION_WAIT */
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
-/* Define to 1 if you have the <varargs.h> header file. */
-/* #undef HAVE_VARARGS_H */
+/* Define to 1 if the system has the type `unsigned long long int'. */
+#define HAVE_UNSIGNED_LONG_LONG_INT 1
/* Define to 1 if you have the `vfork' function. */
#define HAVE_VFORK 1
@@ -286,9 +307,6 @@
/* Define to 1 if you have the <vfork.h> header file. */
/* #undef HAVE_VFORK_H */
-/* Define to 1 if you have the `vprintf' function. */
-#define HAVE_VPRINTF 1
-
/* Define to 1 if you have the `wait3' function. */
/* #undef HAVE_WAIT3 */
@@ -301,12 +319,15 @@
/* Define to 1 if `vfork' works. */
#define HAVE_WORKING_VFORK 1
-/* Build host information. (not used by kmk) */
-#define MAKE_HOST "i586-pc-haiku"
+/* Build host information. */
+#define MAKE_HOST "x86_64-unknown-haiku"
/* Define to 1 to enable job server support in GNU make. */
#define MAKE_JOBSERVER 1
+/* Define to 1 to enable 'load' support in GNU make. */
+#define MAKE_LOAD 1
+
/* Define to 1 to enable symbolic link timestamp checking. */
#define MAKE_SYMLINKS 1
@@ -317,9 +338,6 @@
/* Define to 1 if struct nlist.n_name is a pointer rather than an array. */
/* #undef NLIST_STRUCT */
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-/* #undef NO_MINUS_C_MINUS_O */
-
/* Name of package */
#define PACKAGE "make"
@@ -330,7 +348,7 @@
#define PACKAGE_NAME "GNU make"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "GNU make 3.82"
+#define PACKAGE_STRING "GNU make 4.2.1"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "make"
@@ -339,7 +357,7 @@
#define PACKAGE_URL "http://www.gnu.org/software/make/"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "3.82"
+#define PACKAGE_VERSION "4.2.1"
/* Define to the character that separates directories in PATH. */
#define PATH_SEPARATOR_CHAR ':'
@@ -368,7 +386,10 @@
#define STDC_HEADERS 1
/* Define if struct stat contains a nanoseconds field */
-#define ST_MTIM_NSEC tv_nsec
+#define ST_ATIM_NSEC st_atim.tv_nsec
+
+/* Define if struct stat contains a nanoseconds field */
+#define ST_MTIM_NSEC st_mtim.tv_nsec
/* Define to 1 on System V Release 4. */
/* #undef SVR4 */
@@ -406,7 +427,7 @@
/* Version number of package */
-#define VERSION "3.82"
+#define VERSION "4.2.1"
/* Use platform specific coding */
/* #undef WINDOWS32 */
@@ -441,19 +462,24 @@
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef gid_t */
+/* Define to `long int' if <sys/types.h> does not define. */
+/* #undef off_t */
+
/* Define to `int' if <sys/types.h> does not define. */
/* #undef pid_t */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef ssize_t */
+
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef uid_t */
-/* Define uintmax_t if not defined in <stdint.h> or <inttypes.h>. */
+/* Define to the widest unsigned integer type if <stdint.h> and <inttypes.h>
+ do not define. */
/* #undef uintmax_t */
/* Define as `fork' if `vfork' does not work. */
/* #undef vfork */
-
-#include "inlined_memchr.h"
diff --git a/src/kmk/configure.ac b/src/kmk/configure.ac
index 76a38a2..9eddc7d 100644
--- a/src/kmk/configure.ac
+++ b/src/kmk/configure.ac
@@ -431,6 +431,8 @@ AC_DEFINE_UNQUOTED([MAKE_HOST],["$host"],[Build host information.])
MAKE_HOST="$host"
AC_SUBST([MAKE_HOST])
+AM_CONDITIONAL([HAIKUENV], [test "$host_os" = "haiku"])
+
w32_target_env=no
AM_CONDITIONAL([WINDOWSENV], [false])
diff --git a/src/kmk/getopt.c b/src/kmk/getopt.c
index f0d58a9..cc43ab8 100644
--- a/src/kmk/getopt.c
+++ b/src/kmk/getopt.c
@@ -68,6 +68,10 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
# include <unistd.h>
#endif /* GNU C library. */
+#ifdef __HAIKU__
+# include <stdlib.h>
+#endif
+
#ifdef VMS
# include <unixlib.h>
# if HAVE_STRING_H - 0
diff --git a/src/kmk/kmkbuiltin.h b/src/kmk/kmkbuiltin.h
index c6c40f0..32b0add 100644
--- a/src/kmk/kmkbuiltin.h
+++ b/src/kmk/kmkbuiltin.h
@@ -26,6 +26,10 @@
#ifndef ___kmk_kmkbuiltin_h___
#define ___kmk_kmkbuiltin_h___
+#ifdef __HAIKU__
+# include <sys/param.h>
+#endif
+
#ifdef _MSC_VER
# ifndef pid_t /* see config.h.win */
# define pid_t intptr_t /* Note! sub_proc.c needs it to be pointer sized. */
diff --git a/src/kmk/kmkbuiltin/cp_utils.c b/src/kmk/kmkbuiltin/cp_utils.c
index e97e75d..e3daeae 100644
--- a/src/kmk/kmkbuiltin/cp_utils.c
+++ b/src/kmk/kmkbuiltin/cp_utils.c
@@ -56,9 +56,7 @@ __FBSDID("$FreeBSD: src/bin/cp/utils.c,v 1.43 2004/04/06 20:06:44 markm Exp $");
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
-#ifndef __HAIKU__
-# include <sysexits.h>
-#endif
+#include <sysexits.h>
#include <unistd.h>
#ifdef __sun__
# include "solfakes.h"
diff --git a/src/kmk/kmkbuiltin/haikufakes.h b/src/kmk/kmkbuiltin/haikufakes.h
index eff20bb..9b27737 100644
--- a/src/kmk/kmkbuiltin/haikufakes.h
+++ b/src/kmk/kmkbuiltin/haikufakes.h
@@ -26,14 +26,6 @@
#ifndef ___haikufakes_h
#define ___haikufakes_h
-#define EX_OK 0
-#define EX_OSERR 1
-#define EX_NOUSER 1
-#define EX_USAGE 1
-#define EX_TEMPFAIL 1
-#define EX_SOFTWARE 1
-
-#define lutimes(path, tvs) utimes(path, tvs)
#define lchmod haiku_lchmod
extern int haiku_lchmod(const char *pszPath, mode_t mode);
diff --git a/src/kmk/kmkbuiltin/install.c b/src/kmk/kmkbuiltin/install.c
index 2864573..1bdf3e5 100644
--- a/src/kmk/kmkbuiltin/install.c
+++ b/src/kmk/kmkbuiltin/install.c
@@ -68,9 +68,7 @@ __FBSDID("$FreeBSD: src/usr.bin/xinstall/xinstall.c,v 1.66 2005/01/25 14:34:57 s
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifndef __HAIKU__
-# include <sysexits.h>
-#endif
+#include <sysexits.h>
#ifdef __NetBSD__
# include <util.h>
# define strtofflags(a, b, c) string_to_flags(a, b, c)
diff --git a/src/kmk/kmkbuiltin/mkdir.c b/src/kmk/kmkbuiltin/mkdir.c
index 2fede17..ffee5d9 100644
--- a/src/kmk/kmkbuiltin/mkdir.c
+++ b/src/kmk/kmkbuiltin/mkdir.c
@@ -54,9 +54,7 @@ __FBSDID("$FreeBSD: src/bin/mkdir/mkdir.c,v 1.28 2004/04/06 20:06:48 markm Exp $
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifndef __HAIKU__
-# include <sysexits.h>
-#endif
+#include <sysexits.h>
#include <unistd.h>
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
diff --git a/src/kmk/kmkbuiltin/mv.c b/src/kmk/kmkbuiltin/mv.c
index 7db962c..cf2a8ed 100644
--- a/src/kmk/kmkbuiltin/mv.c
+++ b/src/kmk/kmkbuiltin/mv.c
@@ -76,9 +76,7 @@ __FBSDID("$FreeBSD: src/bin/mv/mv.c,v 1.46 2005/09/05 04:36:08 csjp Exp $");
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifndef __HAIKU__
-# include <sysexits.h>
-#endif
+#include <sysexits.h>
#include <unistd.h>
#include "getopt_r.h"
#ifdef __sun__
diff --git a/src/kmk/kmkbuiltin/rm.c b/src/kmk/kmkbuiltin/rm.c
index 41cbd7c..2a8c450 100644
--- a/src/kmk/kmkbuiltin/rm.c
+++ b/src/kmk/kmkbuiltin/rm.c
@@ -48,9 +48,9 @@ static char sccsid[] = "@(#)rm.c 8.5 (Berkeley) 4/18/94";
#define FAKES_NO_GETOPT_H /* bird */
#include "config.h"
#include <sys/stat.h>
-#if !defined(_MSC_VER) && !defined(__HAIKU__)
+#ifndef _MSC_VER
# include <sys/param.h>
-# ifndef __gnu_hurd__
+# if !defined(__gnu_hurd__) && !defined(__HAIKU__)
# include <sys/mount.h>
# endif
#endif
@@ -64,9 +64,7 @@ static char sccsid[] = "@(#)rm.c 8.5 (Berkeley) 4/18/94";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifndef __HAIKU__
-# include <sysexits.h>
-#endif
+#include <sysexits.h>
#include <unistd.h>
#include <ctype.h>
#include "getopt_r.h"
diff --git a/src/sed/config.h.haiku b/src/sed/config.h.haiku
index a925451..2e885bd 100644
--- a/src/sed/config.h.haiku
+++ b/src/sed/config.h.haiku
@@ -23,9 +23,6 @@
/* Define to 1 if you have the <argz.h> header file. */
/* #undef HAVE_ARGZ_H */
-/* Define to 1 if you have the `asprintf' function. */
-#define HAVE_ASPRINTF 1
-
/* Define to 1 if you have the `bcopy' function. */
#define HAVE_BCOPY 1
@@ -39,26 +36,6 @@
*/
/* #undef HAVE_DCGETTEXT */
-/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you
- don't. */
-#define HAVE_DECL_FEOF_UNLOCKED 1
-
-/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if
- you don't. */
-#define HAVE_DECL_FGETS_UNLOCKED 0
-
-/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
- don't. */
-#define HAVE_DECL_GETC_UNLOCKED 1
-
-/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you
- don't. */
-#define HAVE_DECL__SNPRINTF 0
-
-/* Define to 1 if you have the declaration of `_snwprintf', and to 0 if you
- don't. */
-#define HAVE_DECL__SNWPRINTF 0
-
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#define HAVE_DIRENT_H 1
@@ -75,12 +52,18 @@
/* Define to 1 if you have the `fchown' function. */
#define HAVE_FCHOWN 1
-/* Define to 1 if you have the `fwprintf' function. */
-#define HAVE_FWPRINTF 1
+/* Define to 1 if you have the `feof_unlocked' function. */
+#define HAVE_FEOF_UNLOCKED 1
+
+/* Define to 1 if you have the `fgets_unlocked' function. */
+#define HAVE_FGETS_UNLOCKED 1
/* Define to 1 if you have the `getcwd' function. */
#define HAVE_GETCWD 1
+/* Define to 1 if you have the `getc_unlocked' function. */
+#define HAVE_GETC_UNLOCKED 1
+
/* Define to 1 if you have the `getegid' function. */
#define HAVE_GETEGID 1
@@ -100,18 +83,11 @@
#define HAVE_GETUID 1
/* Define if you have the iconv() function. */
-#define HAVE_ICONV 1
-
-/* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */
-#define HAVE_INTMAX_T 1
+/* #undef HAVE_ICONV */
-/* Define if <inttypes.h> exists and doesn't clash with <sys/types.h>. */
+/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
-/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and
- declares uintmax_t. */
-#define HAVE_INTTYPES_H_WITH_UINTMAX 1
-
/* Define to 1 if you have the <io.h> header file. */
/* #undef HAVE_IO_H */
@@ -139,15 +115,9 @@
/* Define to 1 if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
-/* Define if you have the 'long double' type. */
-#define HAVE_LONG_DOUBLE 1
-
/* Define to 1 if you support file names longer than 14 characters. */
#define HAVE_LONG_FILE_NAMES 1
-/* Define if you have the 'long long' type. */
-#define HAVE_LONG_LONG 1
-
/* Define to 1 if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1
@@ -205,9 +175,6 @@
/* Define to 1 if you have the `popen' function. */
#define HAVE_POPEN 1
-/* Define if your printf() function supports format strings with positions. */
-#define HAVE_POSIX_PRINTF 1
-
/* Define to 1 if you have the `putenv' function. */
#define HAVE_PUTENV 1
@@ -220,14 +187,11 @@
/* Define to 1 if you have the `setlocale' function. */
#define HAVE_SETLOCALE 1
-/* Define to 1 if you have the `snprintf' function. */
-#define HAVE_SNPRINTF 1
-
/* Define to 1 if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1
/* Define to 1 if stdbool.h conforms to C99. */
-/* #undef HAVE_STDBOOL_H */
+#define HAVE_STDBOOL_H 1
/* Define to 1 if you have the <stddef.h> header file. */
#define HAVE_STDDEF_H 1
@@ -235,10 +199,6 @@
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
-/* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares
- uintmax_t. */
-#define HAVE_STDINT_H_WITH_UINTMAX 1
-
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
@@ -292,41 +252,26 @@
/* Define to 1 if you have the `tsearch' function. */
#define HAVE_TSEARCH 1
-/* Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>. */
-#define HAVE_UINTMAX_T 1
-
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
-/* Define if you have the 'unsigned long long' type. */
-#define HAVE_UNSIGNED_LONG_LONG 1
-
/* Define to 1 if you have the `vprintf' function. */
#define HAVE_VPRINTF 1
/* Define to 1 if you have the <wchar.h> header file. */
#define HAVE_WCHAR_H 1
-/* Define if you have the 'wchar_t' type. */
-#define HAVE_WCHAR_T 1
-
/* Define to 1 if you have the `wcrtomb' function. */
#define HAVE_WCRTOMB 1
/* Define to 1 if you have the `wcscoll' function. */
#define HAVE_WCSCOLL 1
-/* Define to 1 if you have the `wcslen' function. */
-#define HAVE_WCSLEN 1
-
/* Define to 1 if you have the <wctype.h> header file. */
#define HAVE_WCTYPE_H 1
-/* Define if you have the 'wint_t' type. */
-#define HAVE_WINT_T 1
-
/* Define to 1 if the system has the type `_Bool'. */
-/* #undef HAVE__BOOL */
+#define HAVE__BOOL 1
/* Define to 1 if you have the `__argz_count' function. */
/* #undef HAVE___ARGZ_COUNT */
@@ -337,14 +282,8 @@
/* Define to 1 if you have the `__argz_stringify' function. */
/* #undef HAVE___ARGZ_STRINGIFY */
-/* Define to 1 if you have the `__fsetlocking' function. */
-#define HAVE___FSETLOCKING 1
-
/* Define as const if the declaration of iconv() needs const. */
-#define ICONV_CONST
-
-/* Define if integer division by zero raises signal SIGFPE. */
-#define INTDIV0_RAISES_SIGFPE 1
+/* #undef ICONV_CONST */
/* Name of package */
#define PACKAGE "sed"
@@ -367,17 +306,10 @@
/* Define to the version of this package. */
#define PACKAGE_VERSION "4.1.5"
-/* Define if <inttypes.h> exists and defines unusable PRI* macros. */
-/* #undef PRI_MACROS_BROKEN */
-
/* Define to the version of GNU sed whose features are supported by this sed.
*/
#define SED_FEATURE_VERSION "4.1"
-/* Define as the maximum value of type 'size_t', if the system doesn't define
- it. */
-/* #undef SIZE_MAX */
-
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at runtime.
@@ -453,19 +385,8 @@
/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */
-/* Define as the type of the result of subtracting two pointers, if the system
- doesn't define it. */
-/* #undef ptrdiff_t */
-
-/* Define to empty if the C compiler doesn't support this keyword. */
-/* #undef signed */
-
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef ssize_t */
-
-/* Define to unsigned long or unsigned long long if <stdint.h> and
- <inttypes.h> don't define. */
-/* #undef uintmax_t */
diff --git a/src/sed/lib/getopt.c b/src/sed/lib/getopt.c
index d341fe0..48876d4 100644
--- a/src/sed/lib/getopt.c
+++ b/src/sed/lib/getopt.c
@@ -72,6 +72,10 @@
# include <unistd.h>
#endif /* GNU C library. */
+#ifdef __HAIKU__
+# include <string.h>
+#endif
+
#ifdef VMS
# include <unixlib.h>
# if HAVE_STRING_H - 0
diff --git a/src/sed/lib/utils.c b/src/sed/lib/utils.c
index 14e6073..fdec2cb 100644
--- a/src/sed/lib/utils.c
+++ b/src/sed/lib/utils.c
@@ -35,6 +35,10 @@
# include <stdlib.h>
#endif /* HAVE_STDLIB_H */
+#ifdef __HAIKU__
+# include <unistd.h>
+#endif
+
#include "utils.h"
#ifdef KBUILD_OS_WINDOWS /* bird: Way faster console output! */