summaryrefslogtreecommitdiffstats
path: root/testing/kbuild
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-02-23 19:58:09 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-02-23 19:58:16 +0000
commit3a044aaeb7856d4c0f4cf1be8da64027b686d452 (patch)
tree168a0a0e8feb1daa86e860a0f6817d6ff4d0a972 /testing/kbuild
parentcd89b051ddac83b13379b776dcbf0c591e878667 (diff)
downloadaports-3a044aaeb7856d4c0f4cf1be8da64027b686d452.tar.bz2
aports-3a044aaeb7856d4c0f4cf1be8da64027b686d452.tar.xz
testing/kbuild: new aport
A makefile framework for writing simple makefiles for complex tasks http://svn.netlabs.org/kbuild/wiki needed for virtualbox
Diffstat (limited to 'testing/kbuild')
-rw-r--r--testing/kbuild/APKBUILD68
-rw-r--r--testing/kbuild/getloadavg.patch32
-rw-r--r--testing/kbuild/kbuild-0.1.5_p2-qa.patch26
-rw-r--r--testing/kbuild/lchmod.patch27
-rw-r--r--testing/kbuild/strlcpy.patch26
-rw-r--r--testing/kbuild/sys_siglist.patch15
-rw-r--r--testing/kbuild/uclibc.patch24
-rw-r--r--testing/kbuild/underlinking.patch13
8 files changed, 231 insertions, 0 deletions
diff --git a/testing/kbuild/APKBUILD b/testing/kbuild/APKBUILD
new file mode 100644
index 000000000..61815c1be
--- /dev/null
+++ b/testing/kbuild/APKBUILD
@@ -0,0 +1,68 @@
+# Contributor: Natanael Copa <ncopa@alpinelinux.org>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=kbuild
+pkgver=0.1.5_p2
+_ver=${pkgver/_/-}
+pkgrel=0
+pkgdesc="A makefile framework for writing simple makefiles for complex tasks"
+url="http://svn.netlabs.org/kbuild/wiki"
+arch="all"
+license="GPL-3"
+depends=""
+depends_dev=""
+makedepends="autoconf automake flex"
+install=""
+subpackages="$pkgname-doc"
+source="ftp://ftp.netlabs.org/pub/kbuild/kBuild-$_ver-src.tar.gz
+ kbuild-0.1.5_p2-qa.patch
+ lchmod.patch
+ strlcpy.patch
+ underlinking.patch
+ sys_siglist.patch
+ uclibc.patch"
+
+_builddir="$srcdir"/kBuild-$_ver
+prepare() {
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+ cd "$_builddir"/src/kmk
+ aclocal -I config && autoheader && autoconf && automake --add-missing \
+ || return 1
+ cd "$_builddir"/src/sed
+ aclocal -I config && autoheader && autoconf && automake --add-missing \
+ || return 1
+
+ # the bootstrap process will create a symlink to the system shell,
+ # which happens to be (/bin/sh) a symlink to /bin/busybox
+ # and busybox will get confused since there are no applet named
+ # kmk_ash.
+ echo '#!/bin/sh' >"$srcdir"/sh
+ echo 'exec /bin/busybox sh "$@"' >> "$srcdir"/sh
+ chmod +x "$srcdir"/sh
+ sed -i -e "s:/bin/sh:$srcdir/sh:" "$_builddir"/bootstrap.gmk
+}
+
+build() {
+ cd "$_builddir"
+ kBuild/env.sh --full make -f bootstrap.gmk AUTORECONF=true \
+ || return 1
+}
+
+package() {
+ cd "$_builddir"
+ kBuild/env.sh kmk NIX_INSTALL_DIR=/usr PATH_INS="$pkgdir" install \
+ || return 1
+}
+
+md5sums="5e4e2193aa6cb3f095af2f99bf90d01d kBuild-0.1.5-p2-src.tar.gz
+79d4d445b28f0c50f2a7a8ca12bbed4b kbuild-0.1.5_p2-qa.patch
+b3dd26cc185c96658d9b554eef2f811c lchmod.patch
+90cae3b53b4ec6fc5f1c336922083df0 strlcpy.patch
+ca09174d7c885fdea1e3c2dc580d80b3 underlinking.patch
+234e03febb8eb35106ecf85682e9233a sys_siglist.patch
+4bf9eead328a38059dadb56317e7aaa4 uclibc.patch"
diff --git a/testing/kbuild/getloadavg.patch b/testing/kbuild/getloadavg.patch
new file mode 100644
index 000000000..e145ed0e5
--- /dev/null
+++ b/testing/kbuild/getloadavg.patch
@@ -0,0 +1,32 @@
+diff --git a/src/kmk/job.c b/src/kmk/job.c
+index 6d14300..16731fc 100644
+--- a/src/kmk/job.c
++++ b/src/kmk/job.c
+@@ -240,6 +240,27 @@ unsigned long job_counter = 0;
+
+ unsigned int jobserver_tokens = 0;
+
++#ifdef __UCLIBC__
++int getloadavg(double list[], int nelem)
++{
++ FILE *LOADAVG;
++ double avg[3] = { 0.0, 0.0, 0.0 };
++ int i, res = -1;
++
++ if ((LOADAVG = fopen("/proc/loadavg", "r"))) {
++ fscanf(LOADAVG, "%lf %lf %lf", &avg[0], &avg[1], &avg[2]);
++ res = 0;
++ fclose(LOADAVG);
++ }
++
++ for (i = 0; (i < nelem) && (i < 3); i++) {
++ list[i] = avg[i];
++ }
++
++ return res;
++}
++#endif
++
+ #ifdef WINDOWS32
+ /*
+ * The macro which references this function is defined in make.h.
diff --git a/testing/kbuild/kbuild-0.1.5_p2-qa.patch b/testing/kbuild/kbuild-0.1.5_p2-qa.patch
new file mode 100644
index 000000000..706c3a7fd
--- /dev/null
+++ b/testing/kbuild/kbuild-0.1.5_p2-qa.patch
@@ -0,0 +1,26 @@
+* warning: implicit declaration of function ‘unlink’
+* warning: too few arguments for format
+--- a/src/sed/lib/utils.c
++++ b/src/sed/lib/utils.c
+@@ -35,6 +35,10 @@
+ # include <stdlib.h>
+ #endif /* HAVE_STDLIB_H */
+
++#ifdef HAVE_UNISTD_H
++# include <unistd.h>
++#endif /* HAVE_UNISTD_H */
++
+ #include "utils.h"
+
+ const char *myname;
+--- a/src/kmk/kmkbuiltin/printf.c
++++ b/src/kmk/kmkbuiltin/printf.c
+@@ -206,7 +206,7 @@
+
+ (void)funcname;
+ if (rc != 0)
+- fatal (NILF, _("$(%s): failure rc=%d\n"), rc);
++ fatal (NILF, _("$(%s): failure rc=%d\n"), funcname, rc);
+ return o;
+ }
+ #endif
diff --git a/testing/kbuild/lchmod.patch b/testing/kbuild/lchmod.patch
new file mode 100644
index 000000000..de111867d
--- /dev/null
+++ b/testing/kbuild/lchmod.patch
@@ -0,0 +1,27 @@
+--- ./src/kmk/kmkbuiltin/chmod.c.orig
++++ ./src/kmk/kmkbuiltin/chmod.c
+@@ -177,9 +177,9 @@
+ } else
+ fts_options = hflag ? FTS_PHYSICAL : FTS_LOGICAL;
+
+- if (hflag)
++/* if (hflag)
+ change_mode = lchmod;
+- else
++ else */
+ change_mode = chmod;
+
+ mode = *argv;
+diff --git a/src/kmk/kmkbuiltin/cp_utils.c b/src/kmk/kmkbuiltin/cp_utils.c
+index 1773815..a1ff924 100644
+--- a/src/kmk/kmkbuiltin/cp_utils.c
++++ b/src/kmk/kmkbuiltin/cp_utils.c
+@@ -359,7 +359,7 @@ setfile(struct stat *fs, int fd)
+
+ if (!gotstat || fs->st_mode != ts.st_mode)
+ if (fdval ? fchmod(fd, fs->st_mode) :
+- (islink ? lchmod(to.p_path, fs->st_mode) :
++ (islink ? chmod(to.p_path, fs->st_mode) :
+ chmod(to.p_path, fs->st_mode))) {
+ warn("chmod: %s", to.p_path);
+ rval = 1;
diff --git a/testing/kbuild/strlcpy.patch b/testing/kbuild/strlcpy.patch
new file mode 100644
index 000000000..42b25bdad
--- /dev/null
+++ b/testing/kbuild/strlcpy.patch
@@ -0,0 +1,26 @@
+diff --git a/src/kmk/kmkbuiltin/cp.c b/src/kmk/kmkbuiltin/cp.c
+index 44b76ab..85fec01 100644
+--- a/src/kmk/kmkbuiltin/cp.c
++++ b/src/kmk/kmkbuiltin/cp.c
+@@ -81,7 +81,7 @@ __FBSDID("$FreeBSD: src/bin/cp/cp.c,v 1.50 2004/04/06 20:06:44 markm Exp $");
+ #include "kmkbuiltin.h"
+ #include "kbuild_protection.h"
+
+-#if defined(_MSC_VER) || defined(__gnu_linux__) || defined(__linux__)
++#if defined(_MSC_VER) || defined(__gnu_linux__) || defined(__linux__) && !defined(__UCLIBC__)
+ extern char *strlcpy(char *, const char *, size_t);
+ #endif
+
+diff --git a/src/kmk/Makefile.kmk b/src/kmk/Makefile.kmk
+index 12b9697..db1deb2 100644
+--- a/src/kmk/Makefile.kmk
++++ b/src/kmk/Makefile.kmk
+@@ -101,7 +101,7 @@ kmkmissing_SOURCES.freebsd = \
+ glob/fnmatch.c
+
+ kmkmissing_SOURCES.linux += \
+- kmkbuiltin/strlcpy.c
++ getloadavg.c
+
+ kmkmissing_SOURCES.solaris = \
+ kmkbuiltin/strlcpy.c \
diff --git a/testing/kbuild/sys_siglist.patch b/testing/kbuild/sys_siglist.patch
new file mode 100644
index 000000000..883b2ef3a
--- /dev/null
+++ b/testing/kbuild/sys_siglist.patch
@@ -0,0 +1,15 @@
+diff --git a/src/ash/jobs.c b/src/ash/jobs.c
+index 146326a..cbf0c3e 100644
+--- a/src/ash/jobs.c
++++ b/src/ash/jobs.c
+@@ -463,8 +463,8 @@ showjob(struct output *out, struct job *jp, int mode)
+ #endif
+ st = WTERMSIG(ps->status);
+ st &= 0x7f;
+- if (st < NSIG && sys_siglist[st])
+- scopyn(sys_siglist[st], s + col, 32);
++ if (st < NSIG && strsignal(st))
++ scopyn(strsignal(st), s + col, 32);
+ else
+ fmtstr(s + col, 16, "Signal %d", st);
+ if (WCOREDUMP(ps->status)) {
diff --git a/testing/kbuild/uclibc.patch b/testing/kbuild/uclibc.patch
new file mode 100644
index 000000000..cf38529f1
--- /dev/null
+++ b/testing/kbuild/uclibc.patch
@@ -0,0 +1,24 @@
+--- ./src/lib/k/kDefs.h.orig
++++ ./src/lib/k/kDefs.h
+@@ -78,7 +78,7 @@
+ # define K_OS K_OS_DRAGONFLY
+ # elif defined(__FreeBSD__) /*??*/
+ # define K_OS K_OS_FREEBSD
+-# elif defined(__gnu_linux__)
++# elif defined(__gnu_linux__) || defined(__UCLIBC__)
+ # define K_OS K_OS_LINUX
+ # elif defined(__NetBSD__) /*??*/
+ # define K_OS K_OS_NETBSD
+diff --git a/src/kmk/kmkbuiltin/fts.c b/src/kmk/kmkbuiltin/fts.c
+index f913f17..febb900 100644
+--- a/src/kmk/kmkbuiltin/fts.c
++++ b/src/kmk/kmkbuiltin/fts.c
+@@ -75,7 +75,7 @@ __RCSID("$NetBSD: __fts13.c,v 1.44 2005/01/19 00:59:48 mycroft Exp $");
+ #endif
+
+ #if ! HAVE_NBTOOL_CONFIG_H
+-# if !defined(__sun__) && !defined(__gnu_linux__)
++# if !defined(__sun__) && !defined(__gnu_linux__) && !defined(__UCLIBC__)
+ # define HAVE_STRUCT_DIRENT_D_NAMLEN 1
+ # endif
+ #endif
diff --git a/testing/kbuild/underlinking.patch b/testing/kbuild/underlinking.patch
new file mode 100644
index 000000000..e72c3c1f6
--- /dev/null
+++ b/testing/kbuild/underlinking.patch
@@ -0,0 +1,13 @@
+diff --git a/src/kmk/Makefile.kmk b/src/kmk/Makefile.kmk
+index db1deb2..00981b8 100644
+--- a/src/kmk/Makefile.kmk
++++ b/src/kmk/Makefile.kmk
+@@ -215,6 +215,8 @@ kmk_SOURCES = \
+ vpath.c \
+ remote-stub.c
+
++kmk_LIBS.linux = pthread
++
+ #kmk_LIBS.solaris = malloc
+ #kmk_DEFS.solaris += HAVE_MALLINFO
+