Add GNU `diffutils` for Akaros.
authorDan Cross <crossd@gmail.com>
Wed, 17 Aug 2016 15:21:48 +0000 (11:21 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 18 Aug 2016 19:44:55 +0000 (15:44 -0400)
Change-Id: I292616827359fde95fde313034794e040eb72ad4
Signed-off-by: Dan Cross <crossd@gmail.com>
[typo in gitignore]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
tools/sys-apps/diffutils/.gitignore [new file with mode: 0644]
tools/sys-apps/diffutils/Makefile [new file with mode: 0644]
tools/sys-apps/diffutils/akaros-patches/3.3/diffutils-3.3.patch [new file with mode: 0644]

diff --git a/tools/sys-apps/diffutils/.gitignore b/tools/sys-apps/diffutils/.gitignore
new file mode 100644 (file)
index 0000000..64ce48d
--- /dev/null
@@ -0,0 +1 @@
+diffutils-*
diff --git a/tools/sys-apps/diffutils/Makefile b/tools/sys-apps/diffutils/Makefile
new file mode 100644 (file)
index 0000000..21426c6
--- /dev/null
@@ -0,0 +1,55 @@
+include ../../Makefrag
+
+########## Package-specific variables
+version := 3.3
+src-dir = diffutils-$(version)
+build-dir = $(src-dir)/build
+tarball = diffutils-$(version).tar.xz
+fetch-url = http://ftp.gnu.org/gnu/diffutils/$(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/sys-apps/diffutils/akaros-patches/3.3/diffutils-3.3.patch b/tools/sys-apps/diffutils/akaros-patches/3.3/diffutils-3.3.patch
new file mode 100644 (file)
index 0000000..cbd9ebf
--- /dev/null
@@ -0,0 +1,26 @@
+diff -ru diffutils-3.3.dist/build-aux/config.guess diffutils-3.3/build-aux/config.guess
+--- diffutils-3.3.dist/build-aux/config.guess  2013-03-22 00:20:48.000000000 -0400
++++ diffutils-3.3/build-aux/config.guess       2016-05-25 15:26:34.263108318 -0400
+@@ -194,6 +194,10 @@
+       # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+       echo "${machine}-${os}${release}"
+       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 -ru diffutils-3.3.dist/build-aux/config.sub diffutils-3.3/build-aux/config.sub
+--- diffutils-3.3.dist/build-aux/config.sub    2013-03-22 00:20:48.000000000 -0400
++++ diffutils-3.3/build-aux/config.sub 2016-05-25 15:26:21.374757287 -0400
+@@ -1354,7 +1354,7 @@
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+             | -sym* | -kopensolaris* | -plan9* \
+             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+-            | -aos* | -aros* \
++            | -akaros* | -aos* | -aros* \
+             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \