Added GNU `tar` to Akaros.
authorDan Cross <crossd@gmail.com>
Wed, 17 Aug 2016 15:22:18 +0000 (11:22 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 18 Aug 2016 19:50:13 +0000 (15:50 -0400)
Change-Id: I04a71cffdfac2eea2f424616a5bcfbd7f0b34956
Signed-off-by: Dan Cross <crossd@gmail.com>
[moved to app-arch]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
tools/app-arch/tar/.gitignore [new file with mode: 0644]
tools/app-arch/tar/Makefile [new file with mode: 0644]
tools/app-arch/tar/akaros-patches/1.29/tar-1.29.patch [new file with mode: 0644]

diff --git a/tools/app-arch/tar/.gitignore b/tools/app-arch/tar/.gitignore
new file mode 100644 (file)
index 0000000..1fe6044
--- /dev/null
@@ -0,0 +1 @@
+tar-*
diff --git a/tools/app-arch/tar/Makefile b/tools/app-arch/tar/Makefile
new file mode 100644 (file)
index 0000000..641313d
--- /dev/null
@@ -0,0 +1,55 @@
+include ../../Makefrag
+
+########## Package-specific variables
+version := 1.29
+src-dir = tar-$(version)
+build-dir = $(src-dir)/build
+tarball = tar-$(version).tar.xz
+fetch-url = http://ftp.gnu.org/gnu/tar/$(tarball)
+config-opts = --prefix=/usr \
+              --bindir=/bin \
+              --disable-nls \
+              --host=x86_64-ucb-akaros \
+              --build=i686-pc-linux-gnu
+
+########## Generic Infrastructure
+
+PHONY := all
+all: make
+
+%.tar.xz:
+       $(Q)wget $(fetch-url)
+
+akaros-patches := $(sort $(wildcard akaros-patches/$(version)/*))
+
+$(build-dir): $(tarball) $(akaros-patches)
+       rm -fr $(src-dir)
+       tar -xf $<
+       $(Q)mkdir $(build-dir) &&                                                  \
+       for i in $(akaros-patches); do                                             \
+               (cd $(src-dir) && patch -p1 < ../$$i);                                 \
+       done
+
+PHONY += config
+$(build-dir)/Makefile config: $(build-dir)
+       cd $(build-dir) && env ../configure $(config-opts)
+
+PHONY += make
+make: config
+       $(Q)$(MAKE) -C $(build-dir)
+
+PHONY += install
+install: make
+       $(Q)$(MAKE) -C $(build-dir) install-exec DESTDIR=$(KFS_ROOT)
+
+PHONY += clean
+clean:
+       $(Q)[ -d $(build-dir) ] &&                                                 \
+           [ -f $(build-dir)/Makefile ] &&                                        \
+           $(MAKE) -C $(build-dir) clean || true
+
+PHONY += mrproper
+mrproper:
+       $(Q)rm -rf $(src-dir)
+
+.PHONY: $(PHONY)
diff --git a/tools/app-arch/tar/akaros-patches/1.29/tar-1.29.patch b/tools/app-arch/tar/akaros-patches/1.29/tar-1.29.patch
new file mode 100644 (file)
index 0000000..03f77db
--- /dev/null
@@ -0,0 +1,68 @@
+diff -ur tar-1.29.dist/build-aux/config.guess tar-1.29/build-aux/config.guess
+--- tar-1.29.dist/build-aux/config.guess       2015-08-24 06:07:56.000000000 -0400
++++ tar-1.29/build-aux/config.guess    2016-05-25 16:16:49.269134261 -0400
+@@ -229,6 +229,10 @@
+       # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+       echo "${machine}-${os}${release}${abi}"
+       exit ;;
++    *:Akaros:*:*)
++      UNAME_MACHINE_ARCH=x86_64
++      echo x86_64-ucb-akaros1.0
++      exit ;;
+     *:Bitrig:*:*)
+       UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+       echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+diff -ur tar-1.29.dist/build-aux/config.sub tar-1.29/build-aux/config.sub
+--- tar-1.29.dist/build-aux/config.sub 2015-08-24 06:07:56.000000000 -0400
++++ tar-1.29/build-aux/config.sub      2016-05-25 16:18:07.055248027 -0400
+@@ -1379,7 +1379,7 @@
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+             | -sym* | -kopensolaris* | -plan9* \
+             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+-            | -aos* | -aros* | -cloudabi* | -sortix* \
++            | -akaros* | -aos* | -aros* | -cloudabi* | -sortix* \
+             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+diff -ur tar-1.29.dist/gnu/error.c tar-1.29/gnu/error.c
+--- tar-1.29.dist/gnu/error.c  2015-08-24 06:08:23.000000000 -0400
++++ tar-1.29/gnu/error.c       2016-08-16 15:00:28.414028967 -0400
+@@ -170,7 +170,8 @@
+ static void
+ print_errno_message (int errnum)
+ {
+-  char const *s;
++  char const *s, *estr;
++  int serrno = errno;
+ #if defined HAVE_STRERROR_R || _LIBC
+   char errbuf[1024];
+@@ -196,6 +197,11 @@
+ #else
+   fprintf (stderr, ": %s", s);
+ #endif
++#ifdef __ros__
++  estr = errstr();
++  if (serrno == errnum && estr != NULL && *estr != '\0')
++    fprintf (stderr, ", %s", estr);
++#endif
+ }
+ static void _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3))
+diff -ur tar-1.29.dist/lib/system.h tar-1.29/lib/system.h
+--- tar-1.29.dist/lib/system.h 2014-12-20 11:01:28.000000000 -0500
++++ tar-1.29/lib/system.h      2016-05-25 16:21:00.643965577 -0400
+@@ -304,6 +304,13 @@
+ # define GOT_MAJOR
+ #endif
++#ifdef __ros__
++# define major(device)                (device)
++# define minor(device)                (device)
++# define makedev(major, minor)        (((major) << 8) | (minor))
++# define GOT_MAJOR
++#endif
++
+ #ifndef GOT_MAJOR
+ # if MSDOS
+ #  define major(device)               (device)